@telus-uds/components-base 1.5.0 → 1.7.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 (125) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/.turbo/turbo-lint.log +13 -0
  3. package/CHANGELOG.json +154 -1
  4. package/CHANGELOG.md +47 -2
  5. package/__tests__/FlexGrid/Row.test.jsx +100 -25
  6. package/__tests__/utils/containUniqueFields.test.js +25 -0
  7. package/component-docs.json +78 -26
  8. package/generate-component-docs.js +20 -7
  9. package/lib/Button/ButtonBase.js +1 -1
  10. package/lib/Button/ButtonGroup.js +20 -12
  11. package/lib/Card/PressableCardBase.js +1 -1
  12. package/lib/Checkbox/Checkbox.js +27 -16
  13. package/lib/Checkbox/CheckboxGroup.js +19 -5
  14. package/lib/ExpandCollapse/Panel.js +10 -10
  15. package/lib/FlexGrid/Col/Col.js +13 -3
  16. package/lib/FlexGrid/Row/Row.js +8 -2
  17. package/lib/InputLabel/InputLabel.js +27 -25
  18. package/lib/Link/LinkBase.js +19 -6
  19. package/lib/Link/TextButton.js +1 -10
  20. package/lib/List/ListItem.js +22 -12
  21. package/lib/Modal/Modal.js +18 -18
  22. package/lib/Radio/Radio.js +23 -12
  23. package/lib/Radio/RadioGroup.js +12 -3
  24. package/lib/RadioCard/RadioCard.js +1 -1
  25. package/lib/RadioCard/RadioCardGroup.js +11 -2
  26. package/lib/Search/Search.js +27 -19
  27. package/lib/Select/Select.js +2 -3
  28. package/lib/Tags/Tags.js +23 -17
  29. package/lib/TextInput/TextArea.js +2 -2
  30. package/lib/TextInput/TextInput.js +12 -2
  31. package/lib/TextInput/TextInputBase.js +1 -1
  32. package/lib/TextInput/propTypes.js +8 -1
  33. package/lib/ToggleSwitch/ToggleSwitch.js +5 -2
  34. package/lib/ToggleSwitch/ToggleSwitchGroup.js +20 -12
  35. package/lib/Typography/Typography.js +12 -10
  36. package/lib/index.js +22 -1
  37. package/lib/utils/containUniqueFields.js +34 -0
  38. package/lib/utils/index.js +10 -1
  39. package/lib/utils/input.js +5 -6
  40. package/lib/utils/props/handlerProps.js +72 -0
  41. package/lib/utils/props/index.js +32 -0
  42. package/lib/utils/props/inputSupportsProps.js +3 -5
  43. package/lib/utils/props/linkProps.js +3 -7
  44. package/lib/utils/props/textInputProps.js +206 -0
  45. package/lib/utils/props/textProps.js +72 -0
  46. package/lib-module/Button/ButtonBase.js +2 -2
  47. package/lib-module/Button/ButtonGroup.js +15 -6
  48. package/lib-module/Card/PressableCardBase.js +2 -2
  49. package/lib-module/Checkbox/Checkbox.js +28 -17
  50. package/lib-module/Checkbox/CheckboxGroup.js +20 -7
  51. package/lib-module/ExpandCollapse/Panel.js +10 -10
  52. package/lib-module/FlexGrid/Col/Col.js +13 -3
  53. package/lib-module/FlexGrid/Row/Row.js +8 -2
  54. package/lib-module/InputLabel/InputLabel.js +28 -25
  55. package/lib-module/Link/LinkBase.js +19 -6
  56. package/lib-module/Link/TextButton.js +1 -10
  57. package/lib-module/List/ListItem.js +22 -12
  58. package/lib-module/Modal/Modal.js +19 -19
  59. package/lib-module/Radio/Radio.js +24 -13
  60. package/lib-module/Radio/RadioGroup.js +13 -4
  61. package/lib-module/RadioCard/RadioCard.js +2 -2
  62. package/lib-module/RadioCard/RadioCardGroup.js +12 -3
  63. package/lib-module/Search/Search.js +29 -21
  64. package/lib-module/Select/Select.js +2 -3
  65. package/lib-module/Tags/Tags.js +18 -11
  66. package/lib-module/TextInput/TextArea.js +3 -3
  67. package/lib-module/TextInput/TextInput.js +11 -3
  68. package/lib-module/TextInput/TextInputBase.js +2 -2
  69. package/lib-module/TextInput/propTypes.js +7 -1
  70. package/lib-module/ToggleSwitch/ToggleSwitch.js +6 -3
  71. package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +15 -6
  72. package/lib-module/Typography/Typography.js +13 -11
  73. package/lib-module/index.js +1 -1
  74. package/lib-module/utils/containUniqueFields.js +26 -0
  75. package/lib-module/utils/index.js +2 -1
  76. package/lib-module/utils/input.js +6 -6
  77. package/lib-module/utils/props/handlerProps.js +59 -0
  78. package/lib-module/utils/props/index.js +3 -0
  79. package/lib-module/utils/props/inputSupportsProps.js +3 -5
  80. package/lib-module/utils/props/linkProps.js +3 -7
  81. package/lib-module/utils/props/textInputProps.js +193 -0
  82. package/lib-module/utils/props/textProps.js +59 -0
  83. package/package.json +5 -5
  84. package/src/Button/ButtonBase.jsx +8 -2
  85. package/src/Button/ButtonGroup.jsx +51 -34
  86. package/src/Card/PressableCardBase.jsx +6 -1
  87. package/src/Checkbox/Checkbox.jsx +35 -23
  88. package/src/Checkbox/CheckboxGroup.jsx +52 -22
  89. package/src/ExpandCollapse/Panel.jsx +9 -9
  90. package/src/FlexGrid/Col/Col.jsx +11 -2
  91. package/src/FlexGrid/Row/Row.jsx +8 -2
  92. package/src/InputLabel/InputLabel.jsx +36 -27
  93. package/src/Link/LinkBase.jsx +20 -4
  94. package/src/Link/TextButton.jsx +1 -19
  95. package/src/List/ListItem.jsx +17 -9
  96. package/src/Modal/Modal.jsx +30 -26
  97. package/src/Radio/Radio.jsx +26 -14
  98. package/src/Radio/RadioGroup.jsx +39 -21
  99. package/src/RadioCard/RadioCard.jsx +6 -1
  100. package/src/RadioCard/RadioCardGroup.jsx +17 -1
  101. package/src/Search/Search.jsx +33 -21
  102. package/src/Select/Select.jsx +2 -2
  103. package/src/Tags/Tags.jsx +23 -9
  104. package/src/TextInput/TextArea.jsx +7 -1
  105. package/src/TextInput/TextInput.jsx +15 -3
  106. package/src/TextInput/TextInputBase.jsx +8 -1
  107. package/src/TextInput/propTypes.js +7 -1
  108. package/src/ToggleSwitch/ToggleSwitch.jsx +11 -2
  109. package/src/ToggleSwitch/ToggleSwitchGroup.jsx +19 -6
  110. package/src/Typography/Typography.jsx +13 -9
  111. package/src/index.js +4 -1
  112. package/src/utils/containUniqueFields.js +32 -0
  113. package/src/utils/index.js +1 -0
  114. package/src/utils/input.js +5 -7
  115. package/src/utils/props/handlerProps.js +47 -0
  116. package/src/utils/props/index.js +3 -0
  117. package/src/utils/props/inputSupportsProps.js +3 -4
  118. package/src/utils/props/linkProps.js +3 -6
  119. package/src/utils/props/textInputProps.js +177 -0
  120. package/src/utils/props/textProps.js +58 -0
  121. package/stories/InputLabel/InputLabel.stories.jsx +25 -28
  122. package/stories/Modal/Modal.stories.jsx +25 -0
  123. package/stories/Search/Search.stories.jsx +53 -3
  124. package/stories/TextInput/TextInput.stories.jsx +40 -2
  125. package/__tests__/Link/LinkBase.test.jsx +0 -22
@@ -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
  });
@@ -31,6 +31,8 @@ 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, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
35
+ const [selectItemProps, selectedItemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.focusHandlerProps, _utils.viewProps]);
34
36
  /**
35
37
  * A group of Checkboxs that behave as a fieldset. Use when users select any number of choices from options.
36
38
  *
@@ -78,6 +80,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
78
80
  * />
79
81
  * ```
80
82
  */
83
+
81
84
  const CheckboxGroup = /*#__PURE__*/(0, _react.forwardRef)(({
82
85
  tokens,
83
86
  radioTokens,
@@ -93,7 +96,8 @@ const CheckboxGroup = /*#__PURE__*/(0, _react.forwardRef)(({
93
96
  onChange,
94
97
  readOnly,
95
98
  name: inputGroupName,
96
- inactive
99
+ inactive,
100
+ ...rest
97
101
  }, ref) => {
98
102
  const viewport = (0, _ViewportProvider.useViewport)();
99
103
  const {
@@ -111,11 +115,18 @@ const CheckboxGroup = /*#__PURE__*/(0, _react.forwardRef)(({
111
115
  onChange,
112
116
  readOnly: readOnly || inactive
113
117
  });
118
+ const uniqueFields = ['id', 'label'];
119
+
120
+ if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
121
+ throw new Error(`CheckboxGroup items must have unique ${uniqueFields.join(', ')}`);
122
+ }
123
+
114
124
  const checkboxes = items.map(({
115
125
  label,
116
126
  id,
117
127
  onChange: itemOnChange,
118
- ref: itemRef
128
+ ref: itemRef,
129
+ ...itemRest
119
130
  }, index) => {
120
131
  const checkboxId = id || `Checkbox[${index}]`;
121
132
 
@@ -133,7 +144,8 @@ const CheckboxGroup = /*#__PURE__*/(0, _react.forwardRef)(({
133
144
  label: label,
134
145
  name: inputGroupName,
135
146
  tokens: radioTokens,
136
- variant: variant
147
+ variant: variant,
148
+ ...selectItemProps(itemRest)
137
149
  }, checkboxId);
138
150
  });
139
151
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Fieldset.default, {
@@ -146,6 +158,7 @@ const CheckboxGroup = /*#__PURE__*/(0, _react.forwardRef)(({
146
158
  feedback: feedback,
147
159
  inactive: inactive,
148
160
  validation: validation,
161
+ ...selectProps(rest),
149
162
  children: (0, _StackView.getStackedContent)(checkboxes, {
150
163
  space,
151
164
  direction: 'column'
@@ -153,7 +166,8 @@ const CheckboxGroup = /*#__PURE__*/(0, _react.forwardRef)(({
153
166
  });
154
167
  });
155
168
  CheckboxGroup.displayName = 'CheckboxGroup';
156
- CheckboxGroup.propTypes = {
169
+ CheckboxGroup.propTypes = { ...selectedSystemPropTypes,
170
+
157
171
  /**
158
172
  * Optional theme token overrides for the outer CheckboxGroup component
159
173
  */
@@ -172,7 +186,7 @@ CheckboxGroup.propTypes = {
172
186
  /**
173
187
  * Array of objects containing specifics for each Checkbox to be rendered in the group.
174
188
  */
175
- items: _propTypes.default.arrayOf(_propTypes.default.exact({
189
+ items: _propTypes.default.arrayOf(_propTypes.default.exact({ ...selectedItemPropTypes,
176
190
  label: _propTypes.default.string,
177
191
  id: _propTypes.default.string,
178
192
  onChange: _propTypes.default.func,
@@ -86,12 +86,13 @@ const ExpandCollapsePanel = /*#__PURE__*/(0, _react.forwardRef)(({
86
86
  };
87
87
 
88
88
  const onContainerLayout = event => {
89
- if (containerHeight === null) {
90
- const {
91
- layout: {
92
- height = 0
93
- } = {}
94
- } = event.nativeEvent;
89
+ const {
90
+ layout: {
91
+ height = 0
92
+ } = {}
93
+ } = event.nativeEvent;
94
+
95
+ if (_Platform.default.OS === 'web' || _Platform.default.OS !== 'web' && containerHeight === null) {
95
96
  setContainerHeight(height);
96
97
  }
97
98
  };
@@ -116,12 +117,11 @@ const ExpandCollapsePanel = /*#__PURE__*/(0, _react.forwardRef)(({
116
117
  tokens: controlTokens,
117
118
  onPress: handleControlPress,
118
119
  children: control
119
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
120
- style: overflowContainerStyles,
120
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Animated.default.View, {
121
+ style: [overflowContainerStyles, animatedStyles, staticStyles.itemsContainer],
121
122
  ...focusabilityProps,
122
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Animated.default.View, {
123
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
123
124
  onLayout: onContainerLayout,
124
- style: [staticStyles.itemsContainer, animatedStyles],
125
125
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
126
126
  style: selectContainerStyles(themeTokens),
127
127
  children: children
@@ -46,6 +46,7 @@ const Col = /*#__PURE__*/(0, _react.forwardRef)(({
46
46
  mdOffset,
47
47
  lgOffset,
48
48
  xlOffset,
49
+ flex,
49
50
  ...viewProps
50
51
  }, ref) => {
51
52
  const gutter = (0, _react.useContext)(_GutterContext.default);
@@ -119,8 +120,11 @@ const Col = /*#__PURE__*/(0, _react.forwardRef)(({
119
120
  paddingLeft: gutter ? 16 : 0,
120
121
  paddingRight: gutter ? 16 : 0
121
122
  };
122
- let hidingStyles = {};
123
- const shown = _Platform.default.OS === 'web' ? 'block' : 'flex';
123
+ let hidingStyles = {}; // TODO: consider setting this to always 'flex' in a major release.
124
+ // `display: block` is invalid in native apps.
125
+ // See https://telusdigital.atlassian.net/browse/UDS1-92
126
+
127
+ const shown = !flex && _Platform.default.OS === 'web' ? 'block' : 'flex';
124
128
 
125
129
  if (viewPort === _systemConstants.viewports.xs) {
126
130
  hidingStyles = {
@@ -286,7 +290,13 @@ Col.propTypes = {
286
290
  *
287
291
  * Accepts a `PropType.string` following the [responsive prop](#/Layout?id=responsive) structure.
288
292
  */
289
- horizontalAlign: _utils.responsiveProps.getTypeOptionallyByViewport(_propTypes.default.oneOf(['left', 'center', 'right']))
293
+ horizontalAlign: _utils.responsiveProps.getTypeOptionallyByViewport(_propTypes.default.oneOf(['left', 'center', 'right'])),
294
+
295
+ /**
296
+ * (web only) Stretches the column to fill vertical space using `display: flex`.
297
+ * In native apps, FlexGrid.Col behaves as if this is always true (as do all `View`s).
298
+ */
299
+ flex: _propTypes.default.bool
290
300
  };
291
301
  var _default = Col;
292
302
  exports.default = _default;
@@ -106,25 +106,31 @@ const Row = /*#__PURE__*/(0, _react.forwardRef)(({
106
106
  const viewPort = (0, _ViewportProvider.useViewport)();
107
107
  const reverseLevel = (0, _helpers.default)([xsReverse, smReverse, mdReverse, lgReverse, xlReverse]);
108
108
  let flexDirection = '';
109
+ let flexWrap = '';
109
110
 
110
111
  if (viewPort === _systemConstants.viewports.xs) {
111
112
  flexDirection = reverseLevel[0] ? 'row-reverse' : 'row';
113
+ flexWrap = reverseLevel[0] ? 'wrap-reverse' : 'wrap';
112
114
  }
113
115
 
114
116
  if (viewPort === _systemConstants.viewports.sm) {
115
117
  flexDirection = reverseLevel[1] ? 'row-reverse' : 'row';
118
+ flexWrap = reverseLevel[1] ? 'wrap-reverse' : 'wrap';
116
119
  }
117
120
 
118
121
  if (viewPort === _systemConstants.viewports.md) {
119
122
  flexDirection = reverseLevel[2] ? 'row-reverse' : 'row';
123
+ flexWrap = reverseLevel[2] ? 'wrap-reverse' : 'wrap';
120
124
  }
121
125
 
122
126
  if (viewPort === _systemConstants.viewports.lg) {
123
127
  flexDirection = reverseLevel[3] ? 'row-reverse' : 'row';
128
+ flexWrap = reverseLevel[3] ? 'wrap-reverse' : 'wrap';
124
129
  }
125
130
 
126
131
  if (viewPort === _systemConstants.viewports.xl) {
127
132
  flexDirection = reverseLevel[4] ? 'row-reverse' : 'row';
133
+ flexWrap = reverseLevel[4] ? 'wrap-reverse' : 'wrap';
128
134
  }
129
135
 
130
136
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
@@ -132,6 +138,7 @@ const Row = /*#__PURE__*/(0, _react.forwardRef)(({
132
138
  ...rest,
133
139
  style: [styles.row, {
134
140
  flexDirection,
141
+ flexWrap,
135
142
  ...horizontalAlignStyles(horizontalAlign),
136
143
  ...verticalAlignStyles(verticalAlign),
137
144
  ...distributeStyles(distribute)
@@ -149,8 +156,7 @@ const styles = _StyleSheet.default.create({
149
156
  flexGrow: 0,
150
157
  flexShrink: 1,
151
158
  flexBasis: 'auto',
152
- flexDirection: 'row',
153
- flexWrap: 'wrap'
159
+ flexDirection: 'row'
154
160
  }
155
161
  });
156
162
 
@@ -69,25 +69,29 @@ const InputLabel = /*#__PURE__*/(0, _react.forwardRef)(({
69
69
  const themeTokens = (0, _ThemeProvider.useThemeTokens)('InputLabel', tokens, variant);
70
70
  const hasTooltip = tooltip !== undefined;
71
71
  const isHintInline = hintPosition === 'inline';
72
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
73
- ref: ref,
74
- style: [staticStyles.container, !isHintInline && staticStyles.containerWithHintBelow],
75
- ...selectProps(rest),
76
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
77
- style: [selectLabelStyles(themeTokens), selectGapStyles(themeTokens), staticStyles.label],
78
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_LabelContent.default, {
79
- forId: forId,
80
- children: label
81
- })
82
- }), hint && isHintInline && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
83
- style: [selectHintStyles(themeTokens), hasTooltip && selectGapStyles(themeTokens)],
84
- nativeID: hintId,
85
- children: hint
86
- }), hasTooltip && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
87
- style: staticStyles.tooltipAlign,
88
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
89
- content: tooltip
90
- })
72
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
73
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
74
+ ref: ref,
75
+ style: staticStyles.container,
76
+ ...selectProps(rest),
77
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
78
+ style: [selectLabelStyles(themeTokens), selectGapStyles(themeTokens), staticStyles.label],
79
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_LabelContent.default, {
80
+ forId: forId,
81
+ children: label
82
+ })
83
+ }), hint && isHintInline && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
84
+ style: [selectHintStyles(themeTokens), hasTooltip && selectGapStyles(themeTokens), staticStyles.label],
85
+ nativeID: hintId,
86
+ children: hint
87
+ }), hasTooltip && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
88
+ style: [staticStyles.tooltipAlign, {
89
+ height: themeTokens.fontSize * themeTokens.lineHeight
90
+ }],
91
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
92
+ content: tooltip
93
+ })
94
+ })]
91
95
  }), hint && !isHintInline && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
92
96
  style: [selectHintStyles(themeTokens), staticStyles.hintBelow],
93
97
  nativeID: hintId,
@@ -135,21 +139,19 @@ exports.default = _default;
135
139
 
136
140
  const staticStyles = _StyleSheet.default.create({
137
141
  container: {
138
- display: 'flex',
142
+ flexShrink: 1,
139
143
  flexDirection: 'row',
140
144
  alignItems: 'baseline'
141
145
  },
142
- containerWithHintBelow: {
143
- flexWrap: 'wrap'
144
- },
145
146
  label: {
146
- flexShrink: 0
147
+ flexShrink: 1
147
148
  },
148
149
  hintBelow: {
149
150
  flexBasis: '100%',
150
151
  flexShrink: 0
151
152
  },
152
153
  tooltipAlign: {
153
- alignSelf: 'center'
154
+ alignSelf: 'flex-start',
155
+ justifyContent: 'center'
154
156
  }
155
157
  });
@@ -60,13 +60,9 @@ _Platform.default.OS === 'web' ? {
60
60
  } : {};
61
61
 
62
62
  const selectTextStyles = ({
63
- color,
64
- textLine,
65
- textLineStyle
63
+ color
66
64
  }) => ({
67
65
  color,
68
- textDecorationLine: textLine,
69
- textDecorationStyle: textLineStyle,
70
66
  ..._Platform.default.select({
71
67
  web: {
72
68
  // TODO: https://github.com/telus/universal-design-system/issues/487
@@ -87,6 +83,22 @@ const selectBlockStyles = ({
87
83
  fontName: blockFontName
88
84
  });
89
85
 
86
+ const selectDecorationStyles = ({
87
+ color,
88
+ textLine,
89
+ textLineStyle
90
+ }) => ({
91
+ color,
92
+ textDecorationLine: textLine,
93
+ textDecorationStyle: textLineStyle,
94
+ ..._Platform.default.select({
95
+ web: {
96
+ // TODO: https://github.com/telus/universal-design-system/issues/487
97
+ transition: 'color 200ms'
98
+ }
99
+ })
100
+ });
101
+
90
102
  const selectIconTokens = ({
91
103
  color,
92
104
  iconSize,
@@ -165,8 +177,9 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)(({
165
177
  style: linkState => {
166
178
  const themeTokens = resolveLinkTokens(linkState);
167
179
  const outerBorderStyles = selectOuterBorderStyles(themeTokens);
180
+ const decorationStyles = selectDecorationStyles(themeTokens);
168
181
  const hasIcon = Boolean(icon || themeTokens.icon);
169
- return [outerBorderStyles, blockLeftStyle, hasIcon && staticStyles.rowContainer];
182
+ return [outerBorderStyles, blockLeftStyle, decorationStyles, hasIcon && staticStyles.rowContainer];
170
183
  },
171
184
  children: linkState => {
172
185
  const themeTokens = resolveLinkTokens(linkState);
@@ -15,8 +15,6 @@ var _LinkBase = _interopRequireDefault(require("./LinkBase"));
15
15
 
16
16
  var _jsxRuntime = require("react/jsx-runtime");
17
17
 
18
- var _TextButton$propTypes;
19
-
20
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
19
 
22
20
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -33,8 +31,6 @@ const TextButton = /*#__PURE__*/(0, _react.forwardRef)(({
33
31
  children,
34
32
  variant,
35
33
  tokens,
36
- // TODO: this may need to use `link` role on Web in the case of being passed both `href` and
37
- // `onPress` in an omniplatform app that uses React Navigation's useLinkProps for internal nav.
38
34
  accessibilityRole = 'button',
39
35
  ...linkProps
40
36
  }, ref) => {
@@ -51,11 +47,6 @@ const TextButton = /*#__PURE__*/(0, _react.forwardRef)(({
51
47
  TextButton.displayName = 'TextButton';
52
48
  TextButton.propTypes = { ..._LinkBase.default.propTypes,
53
49
  onPress: _propTypes.default.func.isRequired
54
- }; // Remove incompatible Link prop (if this build includes propTypes)
55
- // TODO: test if this works with web navigation in omniplatform React Navigation
56
- // https://github.com/telus/universal-design-system/issues/665
57
- // eslint-disable-next-line react/forbid-foreign-prop-types
58
-
59
- if ((_TextButton$propTypes = TextButton.propTypes) !== null && _TextButton$propTypes !== void 0 && _TextButton$propTypes.href) delete TextButton.propTypes.href;
50
+ };
60
51
  var _default = TextButton;
61
52
  exports.default = _default;
@@ -45,8 +45,7 @@ const selectBulletContainerStyles = ({
45
45
  itemBulletContainerAlign
46
46
  }) => ({
47
47
  width: itemBulletContainerWidth,
48
- alignItems: itemBulletContainerAlign,
49
- justifyContent: itemBulletContainerAlign
48
+ alignItems: itemBulletContainerAlign
50
49
  });
51
50
 
52
51
  const selectItemIconTokens = ({
@@ -57,16 +56,20 @@ const selectItemIconTokens = ({
57
56
  color: itemIconColor
58
57
  });
59
58
 
60
- const selectCommonIconStyles = ({
59
+ const selectSideItemContainerStyles = ({
60
+ listGutter,
61
61
  iconMarginTop
62
62
  }) => ({
63
- marginTop: iconMarginTop
64
- });
63
+ marginTop: iconMarginTop,
64
+ marginRight: listGutter
65
+ }); // Align bullets with the top line of text the same way icons are aligned
65
66
 
66
- const selectSideItemContainerStyles = ({
67
- listGutter
67
+
68
+ const selectBulletPositioningStyles = ({
69
+ itemIconSize
68
70
  }) => ({
69
- marginRight: listGutter
71
+ width: itemIconSize,
72
+ height: itemIconSize
70
73
  });
71
74
 
72
75
  const selectItemStyles = ({
@@ -119,8 +122,8 @@ const ListItem = /*#__PURE__*/(0, _react.forwardRef)(({
119
122
  const dividerStyles = selectDividerStyles(themeTokens);
120
123
  const itemBulletContainerStyles = selectBulletContainerStyles(themeTokens);
121
124
  const itemBulletStyles = selectBulletStyles(themeTokens);
125
+ const itemBulletPositioningStyles = selectBulletPositioningStyles(themeTokens);
122
126
  const iconTokens = selectItemIconTokens(themeTokens);
123
- const commonIconStyles = selectCommonIconStyles(themeTokens);
124
127
  const sideItemContainerStyles = selectSideItemContainerStyles(themeTokens);
125
128
 
126
129
  const accessibilityRole = _Platform.default.select({
@@ -164,7 +167,7 @@ const ListItem = /*#__PURE__*/(0, _react.forwardRef)(({
164
167
 
165
168
  if (icon) {
166
169
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
167
- style: [sideItemContainerStyles, commonIconStyles],
170
+ style: sideItemContainerStyles,
168
171
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
169
172
  size: iconSize || iconTokens.size,
170
173
  color: iconColor || iconTokens.color
@@ -175,8 +178,11 @@ const ListItem = /*#__PURE__*/(0, _react.forwardRef)(({
175
178
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
176
179
  style: [sideItemContainerStyles, itemBulletContainerStyles],
177
180
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
178
- style: itemBulletStyles,
179
- testID: "unordered-item-bullet"
181
+ style: [staticStyles.bulletPositioning, itemBulletPositioningStyles],
182
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
183
+ style: itemBulletStyles,
184
+ testID: "unordered-item-bullet"
185
+ })
180
186
  })
181
187
  });
182
188
  };
@@ -197,6 +203,10 @@ const staticStyles = _StyleSheet.default.create({
197
203
  },
198
204
  wrap: {
199
205
  flex: 1
206
+ },
207
+ bulletPositioning: {
208
+ alignItems: 'center',
209
+ justifyContent: 'center'
200
210
  }
201
211
  });
202
212