@telus-uds/components-base 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/.turbo/turbo-lint.log +13 -0
  3. package/CHANGELOG.json +98 -1
  4. package/CHANGELOG.md +24 -2
  5. package/__tests__/FlexGrid/Row.test.jsx +100 -25
  6. package/__tests__/utils/containUniqueFields.test.js +25 -0
  7. package/component-docs.json +18 -2
  8. package/lib/Button/ButtonBase.js +1 -1
  9. package/lib/Button/ButtonGroup.js +20 -12
  10. package/lib/Card/PressableCardBase.js +1 -1
  11. package/lib/Checkbox/Checkbox.js +27 -16
  12. package/lib/Checkbox/CheckboxGroup.js +19 -5
  13. package/lib/ExpandCollapse/Panel.js +10 -10
  14. package/lib/FlexGrid/Col/Col.js +13 -3
  15. package/lib/FlexGrid/Row/Row.js +8 -2
  16. package/lib/InputLabel/InputLabel.js +27 -25
  17. package/lib/Link/LinkBase.js +19 -6
  18. package/lib/Modal/Modal.js +18 -18
  19. package/lib/Radio/Radio.js +23 -12
  20. package/lib/Radio/RadioGroup.js +12 -3
  21. package/lib/RadioCard/RadioCard.js +1 -1
  22. package/lib/RadioCard/RadioCardGroup.js +11 -2
  23. package/lib/Select/Select.js +2 -3
  24. package/lib/Tags/Tags.js +23 -17
  25. package/lib/TextInput/TextArea.js +2 -2
  26. package/lib/TextInput/TextInput.js +12 -2
  27. package/lib/TextInput/TextInputBase.js +1 -1
  28. package/lib/TextInput/propTypes.js +8 -1
  29. package/lib/ToggleSwitch/ToggleSwitch.js +5 -2
  30. package/lib/ToggleSwitch/ToggleSwitchGroup.js +20 -12
  31. package/lib/utils/containUniqueFields.js +34 -0
  32. package/lib/utils/index.js +10 -1
  33. package/lib/utils/props/handlerProps.js +72 -0
  34. package/lib/utils/props/index.js +14 -0
  35. package/lib/utils/props/inputSupportsProps.js +3 -5
  36. package/lib-module/Button/ButtonBase.js +2 -2
  37. package/lib-module/Button/ButtonGroup.js +15 -6
  38. package/lib-module/Card/PressableCardBase.js +2 -2
  39. package/lib-module/Checkbox/Checkbox.js +28 -17
  40. package/lib-module/Checkbox/CheckboxGroup.js +20 -7
  41. package/lib-module/ExpandCollapse/Panel.js +10 -10
  42. package/lib-module/FlexGrid/Col/Col.js +13 -3
  43. package/lib-module/FlexGrid/Row/Row.js +8 -2
  44. package/lib-module/InputLabel/InputLabel.js +28 -25
  45. package/lib-module/Link/LinkBase.js +19 -6
  46. package/lib-module/Modal/Modal.js +19 -19
  47. package/lib-module/Radio/Radio.js +24 -13
  48. package/lib-module/Radio/RadioGroup.js +13 -4
  49. package/lib-module/RadioCard/RadioCard.js +2 -2
  50. package/lib-module/RadioCard/RadioCardGroup.js +12 -3
  51. package/lib-module/Select/Select.js +2 -3
  52. package/lib-module/Tags/Tags.js +18 -11
  53. package/lib-module/TextInput/TextArea.js +3 -3
  54. package/lib-module/TextInput/TextInput.js +11 -3
  55. package/lib-module/TextInput/TextInputBase.js +2 -2
  56. package/lib-module/TextInput/propTypes.js +7 -1
  57. package/lib-module/ToggleSwitch/ToggleSwitch.js +6 -3
  58. package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +15 -6
  59. package/lib-module/utils/containUniqueFields.js +26 -0
  60. package/lib-module/utils/index.js +2 -1
  61. package/lib-module/utils/props/handlerProps.js +59 -0
  62. package/lib-module/utils/props/index.js +1 -0
  63. package/lib-module/utils/props/inputSupportsProps.js +3 -5
  64. package/package.json +5 -5
  65. package/src/Button/ButtonBase.jsx +8 -2
  66. package/src/Button/ButtonGroup.jsx +51 -34
  67. package/src/Card/PressableCardBase.jsx +6 -1
  68. package/src/Checkbox/Checkbox.jsx +35 -23
  69. package/src/Checkbox/CheckboxGroup.jsx +52 -22
  70. package/src/ExpandCollapse/Panel.jsx +9 -9
  71. package/src/FlexGrid/Col/Col.jsx +11 -2
  72. package/src/FlexGrid/Row/Row.jsx +8 -2
  73. package/src/InputLabel/InputLabel.jsx +36 -27
  74. package/src/Link/LinkBase.jsx +20 -4
  75. package/src/Modal/Modal.jsx +30 -26
  76. package/src/Radio/Radio.jsx +26 -14
  77. package/src/Radio/RadioGroup.jsx +39 -21
  78. package/src/RadioCard/RadioCard.jsx +6 -1
  79. package/src/RadioCard/RadioCardGroup.jsx +17 -1
  80. package/src/Select/Select.jsx +2 -2
  81. package/src/Tags/Tags.jsx +23 -9
  82. package/src/TextInput/TextArea.jsx +5 -1
  83. package/src/TextInput/TextInput.jsx +13 -3
  84. package/src/TextInput/TextInputBase.jsx +6 -1
  85. package/src/TextInput/propTypes.js +7 -1
  86. package/src/ToggleSwitch/ToggleSwitch.jsx +11 -2
  87. package/src/ToggleSwitch/ToggleSwitchGroup.jsx +19 -6
  88. package/src/utils/containUniqueFields.js +32 -0
  89. package/src/utils/index.js +1 -0
  90. package/src/utils/props/handlerProps.js +47 -0
  91. package/src/utils/props/index.js +1 -0
  92. package/src/utils/props/inputSupportsProps.js +3 -4
  93. package/stories/InputLabel/InputLabel.stories.jsx +25 -28
  94. package/stories/Modal/Modal.stories.jsx +25 -0
  95. package/stories/Search/Search.stories.jsx +4 -1
  96. package/stories/TextInput/TextInput.stories.jsx +40 -2
@@ -1,8 +1,8 @@
1
- @telus-uds/components-base:build: cache hit, replaying output 6a69e9bf21c07998
2
- @telus-uds/components-base:build: $ yarn build:code && yarn build:docs
3
- @telus-uds/components-base:build: $ yarn build:main && yarn build:module
4
- @telus-uds/components-base:build: $ babel src -d lib
5
- @telus-uds/components-base:build: Successfully compiled 215 files with Babel (4882ms).
6
- @telus-uds/components-base:build: $ babel src -d lib-module --env-name module
7
- @telus-uds/components-base:build: Successfully compiled 215 files with Babel (3426ms).
8
- @telus-uds/components-base:build: $ babel-node --plugins=react-docgen-alpha generate-component-docs.js
1
+ @telus-uds/components-base:build: cache hit, replaying output d1359cc1069914c5
2
+ @telus-uds/components-base:build: $ yarn build:code && yarn build:docs
3
+ @telus-uds/components-base:build: $ yarn build:main && yarn build:module
4
+ @telus-uds/components-base:build: $ babel src -d lib
5
+ @telus-uds/components-base:build: Successfully compiled 217 files with Babel (8026ms).
6
+ @telus-uds/components-base:build: $ babel src -d lib-module --env-name module
7
+ @telus-uds/components-base:build: Successfully compiled 217 files with Babel (5098ms).
8
+ @telus-uds/components-base:build: $ babel-node --plugins=@nearform/babel-plugin-react-docgen generate-component-docs.js
@@ -0,0 +1,13 @@
1
+ @telus-uds/components-base:lint: cache hit, replaying output 946abc71241dcfa6
2
+ @telus-uds/components-base:lint: $ yarn --cwd ../.. lint:path --color packages/components-base
3
+ @telus-uds/components-base:lint: $ eslint --ignore-path .gitignore --ext .js,.jsx,.mjs,.cjs --color packages/components-base
4
+ @telus-uds/components-base:lint: 
5
+ @telus-uds/components-base:lint: /home/runner/work/universal-design-system/universal-design-system/packages/components-base/__tests__/FlexGrid/Col.test.jsx
6
+ @telus-uds/components-base:lint:  51:71 warning Expect must have a corresponding matcher call jest/valid-expect
7
+ @telus-uds/components-base:lint:  106:71 warning Expect must have a corresponding matcher call jest/valid-expect
8
+ @telus-uds/components-base:lint:  155:63 warning Expect must have a corresponding matcher call jest/valid-expect
9
+ @telus-uds/components-base:lint:  200:71 warning Expect must have a corresponding matcher call jest/valid-expect
10
+ @telus-uds/components-base:lint:  248:71 warning Expect must have a corresponding matcher call jest/valid-expect
11
+ @telus-uds/components-base:lint: 
12
+ @telus-uds/components-base:lint: ✖ 5 problems (0 errors, 5 warnings)
13
+ @telus-uds/components-base:lint: 
package/CHANGELOG.json CHANGED
@@ -2,7 +2,104 @@
2
2
  "name": "@telus-uds/components-base",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 07 Apr 2022 20:33:50 GMT",
5
+ "date": "Thu, 28 Apr 2022 15:40:15 GMT",
6
+ "tag": "@telus-uds/components-base_v1.6.0",
7
+ "version": "1.6.0",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "author": "shahzaibkhalidmalik@outlook.com",
12
+ "package": "@telus-uds/components-base",
13
+ "commit": "3db648cd2964f06f91e5d34140cb9f44ede740d5",
14
+ "comment": "Add `pattern` prop for `TextInput` (web)"
15
+ },
16
+ {
17
+ "author": "ruslan.bredikhin@nearform.com",
18
+ "package": "@telus-uds/components-base",
19
+ "commit": "3db648cd2964f06f91e5d34140cb9f44ede740d5",
20
+ "comment": "feat: add unique ids validation to the group components"
21
+ },
22
+ {
23
+ "author": "eugene@michasiw.com",
24
+ "package": "@telus-uds/components-base",
25
+ "commit": "3db648cd2964f06f91e5d34140cb9f44ede740d5",
26
+ "comment": "use IconButton for modal close"
27
+ },
28
+ {
29
+ "author": "alan.slater@nearform.com",
30
+ "package": "@telus-uds/components-base",
31
+ "commit": "3db648cd2964f06f91e5d34140cb9f44ede740d5",
32
+ "comment": "Add flex prop to FlexGrid.Col"
33
+ },
34
+ {
35
+ "author": "ruslan.bredikhin@nearform.com",
36
+ "package": "@telus-uds/components-base",
37
+ "commit": "3db648cd2964f06f91e5d34140cb9f44ede740d5",
38
+ "comment": "feat: add handler props whitelisting to the input components"
39
+ },
40
+ {
41
+ "author": "beachball",
42
+ "package": "@telus-uds/components-base",
43
+ "comment": "Bump @telus-uds/system-theme-tokens to v1.5.0",
44
+ "commit": "3db648cd2964f06f91e5d34140cb9f44ede740d5"
45
+ }
46
+ ],
47
+ "patch": [
48
+ {
49
+ "author": "alan.slater@nearform.com",
50
+ "package": "@telus-uds/components-base",
51
+ "commit": "3db648cd2964f06f91e5d34140cb9f44ede740d5",
52
+ "comment": "V-align Checkbox/Radio with label first line"
53
+ },
54
+ {
55
+ "author": "shahzaibkhalidmalik@outlook.com",
56
+ "package": "@telus-uds/components-base",
57
+ "commit": "3db648cd2964f06f91e5d34140cb9f44ede740d5",
58
+ "comment": "Fix ExpandCollapse unable to response to window resize"
59
+ },
60
+ {
61
+ "author": "ruslan.bredikhin@nearform.com",
62
+ "package": "@telus-uds/components-base",
63
+ "commit": "3db648cd2964f06f91e5d34140cb9f44ede740d5",
64
+ "comment": "fix: move link underline to the inline pressable becoming the anchor tag on web"
65
+ },
66
+ {
67
+ "author": "shahzaibkhalidmalik@outlook.com",
68
+ "package": "@telus-uds/components-base",
69
+ "commit": "3db648cd2964f06f91e5d34140cb9f44ede740d5",
70
+ "comment": "Fix scenario where `reverse` props might not work when elements wrap"
71
+ },
72
+ {
73
+ "author": "alan.slater@nearform.com",
74
+ "package": "@telus-uds/components-base",
75
+ "commit": "3db648cd2964f06f91e5d34140cb9f44ede740d5",
76
+ "comment": "Fix input label text wrap"
77
+ },
78
+ {
79
+ "author": "alan.slater@nearform.com",
80
+ "package": "@telus-uds/components-base",
81
+ "commit": "3db648cd2964f06f91e5d34140cb9f44ede740d5",
82
+ "comment": "fix Select validation icons"
83
+ }
84
+ ],
85
+ "none": [
86
+ {
87
+ "author": "simon.lawrence@nearform.com",
88
+ "package": "@telus-uds/components-base",
89
+ "commit": "3db648cd2964f06f91e5d34140cb9f44ede740d5",
90
+ "comment": "update babel plugin used for docs generation to maintained fork"
91
+ },
92
+ {
93
+ "author": "cody.zuschlag@nearform.com",
94
+ "package": "@telus-uds/components-base",
95
+ "commit": "3db648cd2964f06f91e5d34140cb9f44ede740d5",
96
+ "comment": "improve linting"
97
+ }
98
+ ]
99
+ }
100
+ },
101
+ {
102
+ "date": "Thu, 07 Apr 2022 20:33:56 GMT",
6
103
  "tag": "@telus-uds/components-base_v1.5.0",
7
104
  "version": "1.5.0",
8
105
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,34 @@
1
1
  # Change Log - @telus-uds/components-base
2
2
 
3
- This log was last generated on Thu, 07 Apr 2022 20:33:50 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 28 Apr 2022 15:40:15 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.6.0
8
+
9
+ Thu, 28 Apr 2022 15:40:15 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - Add `pattern` prop for `TextInput` (web) (shahzaibkhalidmalik@outlook.com)
14
+ - feat: add unique ids validation to the group components (ruslan.bredikhin@nearform.com)
15
+ - use IconButton for modal close (eugene@michasiw.com)
16
+ - Add flex prop to FlexGrid.Col (alan.slater@nearform.com)
17
+ - feat: add handler props whitelisting to the input components (ruslan.bredikhin@nearform.com)
18
+ - Bump @telus-uds/system-theme-tokens to v1.5.0
19
+
20
+ ### Patches
21
+
22
+ - V-align Checkbox/Radio with label first line (alan.slater@nearform.com)
23
+ - Fix ExpandCollapse unable to response to window resize (shahzaibkhalidmalik@outlook.com)
24
+ - fix: move link underline to the inline pressable becoming the anchor tag on web (ruslan.bredikhin@nearform.com)
25
+ - Fix scenario where `reverse` props might not work when elements wrap (shahzaibkhalidmalik@outlook.com)
26
+ - Fix input label text wrap (alan.slater@nearform.com)
27
+ - fix Select validation icons (alan.slater@nearform.com)
28
+
7
29
  ## 1.5.0
8
30
 
9
- Thu, 07 Apr 2022 20:33:50 GMT
31
+ Thu, 07 Apr 2022 20:33:56 GMT
10
32
 
11
33
  ### Minor changes
12
34
 
@@ -151,48 +151,123 @@ describe('FlexGrid Row', () => {
151
151
 
152
152
  it('applies correct row order for each reverse prop at viewport "xs"', () => {
153
153
  const { getByText } = renderEachReverseProp('xs')
154
- expect(getByText('xs--xsReverse').parent).toHaveStyle({ flexDirection: 'row-reverse' })
155
- expect(getByText('xs--smReverse').parent).toHaveStyle({ flexDirection: 'row' })
156
- expect(getByText('xs--mdReverse').parent).toHaveStyle({ flexDirection: 'row' })
157
- expect(getByText('xs--lgReverse').parent).toHaveStyle({ flexDirection: 'row' })
158
- expect(getByText('xs--xlReverse').parent).toHaveStyle({ flexDirection: 'row' })
154
+ expect(getByText('xs--xsReverse').parent).toHaveStyle({
155
+ flexDirection: 'row-reverse',
156
+ flexWrap: 'wrap-reverse'
157
+ })
158
+ expect(getByText('xs--smReverse').parent).toHaveStyle({
159
+ flexDirection: 'row',
160
+ flexWrap: 'wrap'
161
+ })
162
+ expect(getByText('xs--mdReverse').parent).toHaveStyle({
163
+ flexDirection: 'row',
164
+ flexWrap: 'wrap'
165
+ })
166
+ expect(getByText('xs--lgReverse').parent).toHaveStyle({
167
+ flexDirection: 'row',
168
+ flexWrap: 'wrap'
169
+ })
170
+ expect(getByText('xs--xlReverse').parent).toHaveStyle({
171
+ flexDirection: 'row',
172
+ flexWrap: 'wrap'
173
+ })
159
174
  })
160
175
 
161
176
  it('applies correct row order for each reverse prop at viewport "sm"', () => {
162
177
  const { getByText } = renderEachReverseProp('sm')
163
- expect(getByText('sm--xsReverse').parent).toHaveStyle({ flexDirection: 'row-reverse' })
164
- expect(getByText('sm--smReverse').parent).toHaveStyle({ flexDirection: 'row-reverse' })
165
- expect(getByText('sm--mdReverse').parent).toHaveStyle({ flexDirection: 'row' })
166
- expect(getByText('sm--lgReverse').parent).toHaveStyle({ flexDirection: 'row' })
167
- expect(getByText('sm--xlReverse').parent).toHaveStyle({ flexDirection: 'row' })
178
+ expect(getByText('sm--xsReverse').parent).toHaveStyle({
179
+ flexDirection: 'row-reverse',
180
+ flexWrap: 'wrap-reverse'
181
+ })
182
+ expect(getByText('sm--smReverse').parent).toHaveStyle({
183
+ flexDirection: 'row-reverse',
184
+ flexWrap: 'wrap-reverse'
185
+ })
186
+ expect(getByText('sm--mdReverse').parent).toHaveStyle({
187
+ flexDirection: 'row',
188
+ flexWrap: 'wrap'
189
+ })
190
+ expect(getByText('sm--lgReverse').parent).toHaveStyle({
191
+ flexDirection: 'row',
192
+ flexWrap: 'wrap'
193
+ })
194
+ expect(getByText('sm--xlReverse').parent).toHaveStyle({
195
+ flexDirection: 'row',
196
+ flexWrap: 'wrap'
197
+ })
168
198
  })
169
199
 
170
200
  it('applies correct row order for each reverse prop at viewport "md"', () => {
171
201
  const { getByText } = renderEachReverseProp('md')
172
- expect(getByText('md--xsReverse').parent).toHaveStyle({ flexDirection: 'row-reverse' })
173
- expect(getByText('md--smReverse').parent).toHaveStyle({ flexDirection: 'row-reverse' })
174
- expect(getByText('md--mdReverse').parent).toHaveStyle({ flexDirection: 'row-reverse' })
175
- expect(getByText('md--lgReverse').parent).toHaveStyle({ flexDirection: 'row' })
176
- expect(getByText('md--xlReverse').parent).toHaveStyle({ flexDirection: 'row' })
202
+ expect(getByText('md--xsReverse').parent).toHaveStyle({
203
+ flexDirection: 'row-reverse',
204
+ flexWrap: 'wrap-reverse'
205
+ })
206
+ expect(getByText('md--smReverse').parent).toHaveStyle({
207
+ flexDirection: 'row-reverse',
208
+ flexWrap: 'wrap-reverse'
209
+ })
210
+ expect(getByText('md--mdReverse').parent).toHaveStyle({
211
+ flexDirection: 'row-reverse',
212
+ flexWrap: 'wrap-reverse'
213
+ })
214
+ expect(getByText('md--lgReverse').parent).toHaveStyle({
215
+ flexDirection: 'row',
216
+ flexWrap: 'wrap'
217
+ })
218
+ expect(getByText('md--xlReverse').parent).toHaveStyle({
219
+ flexDirection: 'row',
220
+ flexWrap: 'wrap'
221
+ })
177
222
  })
178
223
 
179
224
  it('applies correct row order for each reverse prop at viewport "lg"', () => {
180
225
  const { getByText } = renderEachReverseProp('lg')
181
226
 
182
- expect(getByText('lg--xsReverse').parent).toHaveStyle({ flexDirection: 'row-reverse' })
183
- expect(getByText('lg--smReverse').parent).toHaveStyle({ flexDirection: 'row-reverse' })
184
- expect(getByText('lg--mdReverse').parent).toHaveStyle({ flexDirection: 'row-reverse' })
185
- expect(getByText('lg--lgReverse').parent).toHaveStyle({ flexDirection: 'row-reverse' })
186
- expect(getByText('lg--xlReverse').parent).toHaveStyle({ flexDirection: 'row' })
227
+ expect(getByText('lg--xsReverse').parent).toHaveStyle({
228
+ flexDirection: 'row-reverse',
229
+ flexWrap: 'wrap-reverse'
230
+ })
231
+ expect(getByText('lg--smReverse').parent).toHaveStyle({
232
+ flexDirection: 'row-reverse',
233
+ flexWrap: 'wrap-reverse'
234
+ })
235
+ expect(getByText('lg--mdReverse').parent).toHaveStyle({
236
+ flexDirection: 'row-reverse',
237
+ flexWrap: 'wrap-reverse'
238
+ })
239
+ expect(getByText('lg--lgReverse').parent).toHaveStyle({
240
+ flexDirection: 'row-reverse',
241
+ flexWrap: 'wrap-reverse'
242
+ })
243
+ expect(getByText('lg--xlReverse').parent).toHaveStyle({
244
+ flexDirection: 'row',
245
+ flexWrap: 'wrap'
246
+ })
187
247
  })
188
248
 
189
249
  it('applies correct row order for each reverse prop at viewport "xl"', () => {
190
250
  const { getByText } = renderEachReverseProp('xl')
191
251
 
192
- expect(getByText('xl--xsReverse').parent).toHaveStyle({ flexDirection: 'row-reverse' })
193
- expect(getByText('xl--smReverse').parent).toHaveStyle({ flexDirection: 'row-reverse' })
194
- expect(getByText('xl--mdReverse').parent).toHaveStyle({ flexDirection: 'row-reverse' })
195
- expect(getByText('xl--lgReverse').parent).toHaveStyle({ flexDirection: 'row-reverse' })
196
- expect(getByText('xl--xlReverse').parent).toHaveStyle({ flexDirection: 'row-reverse' })
252
+ expect(getByText('xl--xsReverse').parent).toHaveStyle({
253
+ flexDirection: 'row-reverse',
254
+ flexWrap: 'wrap-reverse'
255
+ })
256
+ expect(getByText('xl--smReverse').parent).toHaveStyle({
257
+ flexDirection: 'row-reverse',
258
+ flexWrap: 'wrap-reverse'
259
+ })
260
+ expect(getByText('xl--mdReverse').parent).toHaveStyle({
261
+ flexDirection: 'row-reverse',
262
+ flexWrap: 'wrap-reverse'
263
+ })
264
+ expect(getByText('xl--lgReverse').parent).toHaveStyle({
265
+ flexDirection: 'row-reverse',
266
+ flexWrap: 'wrap-reverse'
267
+ })
268
+ expect(getByText('xl--xlReverse').parent).toHaveStyle({
269
+ flexDirection: 'row-reverse',
270
+ flexWrap: 'wrap-reverse'
271
+ })
197
272
  })
198
273
  })
@@ -0,0 +1,25 @@
1
+ import { containUniqueFields } from '../../src'
2
+
3
+ const unique = [
4
+ { a: 1, b: 'B' },
5
+ { a: 2, b: 'A' }
6
+ ]
7
+
8
+ const notUnique = [
9
+ { a: 1, b: 'B' },
10
+ { a: 1, b: 'A' }
11
+ ]
12
+
13
+ describe('containUniqueFields util', () => {
14
+ it('returns true if no specified fields have duplicates', () => {
15
+ expect(containUniqueFields(unique, ['a', 'b'])).toBe(true)
16
+ })
17
+
18
+ it('returns false if specified fields have duplicates', () => {
19
+ expect(containUniqueFields(notUnique, ['a'])).toBe(false)
20
+ })
21
+
22
+ it('returns false if fields have duplicates, but not the specified ones', () => {
23
+ expect(containUniqueFields(notUnique, ['b'])).toBe(true)
24
+ })
25
+ })
@@ -283,7 +283,8 @@
283
283
  "paddingBottom": "size",
284
284
  "closeIcon": "icon",
285
285
  "closeIconColor": "color",
286
- "closeIconSize": "size"
286
+ "closeIconSize": "size",
287
+ "closePadding": "size"
287
288
  },
288
289
  "Notification": {
289
290
  "backgroundColor": "color",
@@ -3893,6 +3894,13 @@
3893
3894
  },
3894
3895
  "required": false,
3895
3896
  "description": "Align content horizontally within the column.\n\nAccepts a `PropType.string` following the [responsive prop](#/Layout?id=responsive) structure."
3897
+ },
3898
+ "flex": {
3899
+ "type": {
3900
+ "name": "bool"
3901
+ },
3902
+ "required": false,
3903
+ "description": "(web only) Stretches the column to fill vertical space using `display: flex`.\nIn native apps, FlexGrid.Col behaves as if this is always true (as do all `View`s)."
3896
3904
  }
3897
3905
  },
3898
3906
  "attributes": {
@@ -4757,7 +4765,8 @@
4757
4765
  "paddingBottom": "size",
4758
4766
  "closeIcon": "icon",
4759
4767
  "closeIconColor": "color",
4760
- "closeIconSize": "size"
4768
+ "closeIconSize": "size",
4769
+ "closePadding": "size"
4761
4770
  }
4762
4771
  },
4763
4772
  "required": false,
@@ -4783,6 +4792,13 @@
4783
4792
  },
4784
4793
  "required": false,
4785
4794
  "description": ""
4795
+ },
4796
+ "closeButton": {
4797
+ "type": {
4798
+ "name": "node"
4799
+ },
4800
+ "required": false,
4801
+ "description": "Pass a react node to override the default close button or pass `null` to hide the close button."
4786
4802
  }
4787
4803
  },
4788
4804
  "attributes": {
@@ -31,7 +31,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
31
31
 
32
32
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
33
 
34
- const [selectProps, selectedSystemPropTypes] = (0, _utils2.selectSystemProps)([_utils2.a11yProps, _utils2.linkProps, _utils2.viewProps]);
34
+ const [selectProps, selectedSystemPropTypes] = (0, _utils2.selectSystemProps)([_utils2.a11yProps, _utils2.focusHandlerProps, _utils2.linkProps, _utils2.viewProps]);
35
35
 
36
36
  const getOuterBorderOffset = ({
37
37
  outerBorderGap = 0,
@@ -21,9 +21,7 @@ var _ViewportProvider = require("../ViewportProvider");
21
21
 
22
22
  var _ThemeProvider = require("../ThemeProvider");
23
23
 
24
- var _props = require("../utils/props");
25
-
26
- var _input = require("../utils/input");
24
+ var _utils = require("../utils");
27
25
 
28
26
  var _pressability = require("../utils/pressability");
29
27
 
@@ -35,7 +33,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
35
33
 
36
34
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
37
35
 
38
- const [selectProps, selectedSystemPropTypes] = (0, _props.selectSystemProps)([_props.a11yProps, _props.pressProps, _props.viewProps]);
36
+ const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
37
+ const [selectItemProps, selectedItemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.focusHandlerProps, _utils.pressProps, _utils.viewProps]);
39
38
  const ButtonGroup = /*#__PURE__*/(0, _react.forwardRef)(({
40
39
  variant,
41
40
  tokens,
@@ -57,7 +56,7 @@ const ButtonGroup = /*#__PURE__*/(0, _react.forwardRef)(({
57
56
  const themeTokens = (0, _ThemeProvider.useThemeTokens)('ButtonGroup', tokens, variant, {
58
57
  viewport
59
58
  });
60
- const stackTokens = (0, _props.selectTokens)('StackView', themeTokens);
59
+ const stackTokens = (0, _utils.selectTokens)('StackView', themeTokens);
61
60
  const {
62
61
  direction,
63
62
  space
@@ -66,7 +65,7 @@ const ButtonGroup = /*#__PURE__*/(0, _react.forwardRef)(({
66
65
  const {
67
66
  currentValues,
68
67
  toggleOneValue
69
- } = (0, _input.useMultipleInputValues)({
68
+ } = (0, _utils.useMultipleInputValues)({
70
69
  initialValues,
71
70
  values,
72
71
  maxValues,
@@ -78,6 +77,12 @@ const ButtonGroup = /*#__PURE__*/(0, _react.forwardRef)(({
78
77
  ...rest
79
78
  });
80
79
  const itemA11yRole = systemProps.accessibilityRole === 'radiogroup' ? 'radio' : 'checkbox';
80
+ const uniqueFields = ['id', 'label'];
81
+
82
+ if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
83
+ throw new Error(`ButtonGroup items must have unique ${uniqueFields.join(', ')}`);
84
+ }
85
+
81
86
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.StackWrap, { ...systemProps,
82
87
  space: space,
83
88
  direction: direction,
@@ -87,7 +92,8 @@ const ButtonGroup = /*#__PURE__*/(0, _react.forwardRef)(({
87
92
  label,
88
93
  id = label,
89
94
  accessibilityLabel,
90
- ref: itemRef
95
+ ref: itemRef,
96
+ ...itemRest
91
97
  }, index) => {
92
98
  const isSelected = currentValues.includes(id); // Pass an object of relevant component state as first argument for any passed-in press handlers
93
99
 
@@ -98,7 +104,7 @@ const ButtonGroup = /*#__PURE__*/(0, _react.forwardRef)(({
98
104
  }]);
99
105
 
100
106
  const handlePress = event => {
101
- if (pressHandlers.onPress) pressHandlers.onPress();
107
+ if (pressHandlers.onPress) pressHandlers.onPress(event);
102
108
  toggleOneValue(id, event);
103
109
  };
104
110
 
@@ -108,7 +114,7 @@ const ButtonGroup = /*#__PURE__*/(0, _react.forwardRef)(({
108
114
  },
109
115
  accessibilityRole: itemA11yRole,
110
116
  accessibilityLabel,
111
- ..._props.a11yProps.getPositionInSet(items.length, index)
117
+ ..._utils.a11yProps.getPositionInSet(items.length, index)
112
118
  }; // Ensure button is direct child of group as MacOS voiceover only applies "X of Y" to
113
119
  // "radio" if it's a direct child of "radiogroup", even if aria-posinset etc exists
114
120
 
@@ -120,6 +126,7 @@ const ButtonGroup = /*#__PURE__*/(0, _react.forwardRef)(({
120
126
  selected: isSelected,
121
127
  inactive: inactive,
122
128
  ...itemA11y,
129
+ ...selectItemProps(itemRest),
123
130
  children: label
124
131
  }, id);
125
132
  })
@@ -127,8 +134,8 @@ const ButtonGroup = /*#__PURE__*/(0, _react.forwardRef)(({
127
134
  });
128
135
  ButtonGroup.displayName = 'ButtonGroup';
129
136
  ButtonGroup.propTypes = { ...selectedSystemPropTypes,
130
- tokens: (0, _props.getTokensPropType)('ButtonGroup'),
131
- variant: _props.variantProp.propType,
137
+ tokens: (0, _utils.getTokensPropType)('ButtonGroup'),
138
+ variant: _utils.variantProp.propType,
132
139
 
133
140
  /**
134
141
  * The maximum number of items a user may select at once. Defaults to 1 and behaves
@@ -139,7 +146,8 @@ ButtonGroup.propTypes = { ...selectedSystemPropTypes,
139
146
  /**
140
147
  * The options a user may select
141
148
  */
142
- items: _propTypes.default.arrayOf(_propTypes.default.shape({
149
+ items: _propTypes.default.arrayOf(_propTypes.default.shape({ ...selectedItemPropTypes,
150
+
143
151
  /**
144
152
  * The text displayed to the user in the button, describing this option,
145
153
  * passed to the button as its child.
@@ -29,7 +29,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
29
29
 
30
30
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
31
 
32
- const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
32
+ const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.focusHandlerProps, _utils.viewProps]);
33
33
  const tokenKeys = [...(0, _utils.getTokenNames)('Card'), // Outer border tokens. TODO: centralise common token sets like these as part of
34
34
  // https://github.com/telus/universal-design-system/issues/782
35
35
  'outerBorderColor', 'outerBorderWidth', 'outerBorderGap'];
@@ -41,7 +41,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
41
41
 
42
42
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
43
43
 
44
- const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
44
+ const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.focusHandlerProps, _utils.viewProps]);
45
45
 
46
46
  const selectInputStyles = ({
47
47
  iconBackgroundColor,
@@ -232,24 +232,31 @@ const Checkbox = /*#__PURE__*/(0, _react.forwardRef)(({
232
232
  pressed
233
233
  });
234
234
  const iconTokens = selectIconTokens(stateTokens);
235
+ const labelStyles = selectLabelStyles(stateTokens);
236
+ const alignWithLabel = label ? [staticStyles.alignWithLabel, {
237
+ height: labelStyles.lineHeight
238
+ }] : null;
235
239
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
236
240
  style: staticStyles.container,
237
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
238
- style: _StyleSheet.default.flatten([staticStyles.defaultInputStyles, selectInputStyles(stateTokens, isChecked)]),
239
- testID: "Checkbox-Input",
240
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckboxInput.default, {
241
- checked: isChecked,
242
- defaultChecked: defaultChecked,
243
- disabled: inactive,
244
- id: inputId,
245
- isControlled: isControlled,
246
- name: name,
247
- value: value
248
- }), isChecked && IconComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, { ...iconTokens,
249
- testID: "Checkbox-Icon"
250
- })]
241
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
242
+ style: alignWithLabel,
243
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
244
+ style: [staticStyles.defaultInputStyles, selectInputStyles(stateTokens, isChecked)],
245
+ testID: "Checkbox-Input",
246
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckboxInput.default, {
247
+ checked: isChecked,
248
+ defaultChecked: defaultChecked,
249
+ disabled: inactive,
250
+ id: inputId,
251
+ isControlled: isControlled,
252
+ name: name,
253
+ value: value
254
+ }), isChecked && IconComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, { ...iconTokens,
255
+ testID: "Checkbox-Icon"
256
+ })]
257
+ })
251
258
  }), Boolean(label) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
252
- style: selectLabelStyles(stateTokens),
259
+ style: labelStyles,
253
260
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_LabelContent.default, {
254
261
  forId: inputId,
255
262
  children: label
@@ -347,5 +354,9 @@ const staticStyles = _StyleSheet.default.create({
347
354
  defaultInputStyles: {
348
355
  alignItems: 'center',
349
356
  justifyContent: 'center'
357
+ },
358
+ alignWithLabel: {
359
+ alignSelf: 'flex-start',
360
+ justifyContent: 'center'
350
361
  }
351
362
  });