@telus-uds/components-base 1.0.0 → 1.2.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 (121) hide show
  1. package/.storybook/main.js +4 -0
  2. package/.storybook/preview.js +37 -0
  3. package/.ultra.cache.json +1 -1
  4. package/CHANGELOG.md +26 -0
  5. package/README.md +1 -1
  6. package/__fixtures__/Accessible.js +4 -2
  7. package/__fixtures__/Accessible.native.js +5 -2
  8. package/__fixtures__/testTheme.js +9 -0
  9. package/__tests__/HorizontalScroll/HorizontalScroll.test.jsx +1 -0
  10. package/__tests__/ToggleSwitch/ToggleSwitch.test.jsx +10 -0
  11. package/__tests__/ToggleSwitch/ToggleSwitchGroup.test.jsx +192 -0
  12. package/babel.config.js +9 -16
  13. package/component-docs.json +10131 -0
  14. package/generate-component-docs.js +56 -0
  15. package/lib/Box/Box.js +1 -0
  16. package/lib/Button/ButtonBase.js +20 -6
  17. package/lib/Card/CardBase.js +1 -0
  18. package/lib/Card/PressableCardBase.js +9 -3
  19. package/lib/Checkbox/Checkbox.js +0 -2
  20. package/lib/FlexGrid/FlexGrid.js +1 -1
  21. package/lib/IconButton/IconButton.js +8 -3
  22. package/lib/Link/LinkBase.js +10 -3
  23. package/lib/List/List.js +1 -2
  24. package/lib/List/ListItem.js +14 -27
  25. package/lib/List/index.js +15 -0
  26. package/lib/Pagination/PageButton.js +4 -8
  27. package/lib/Pagination/Pagination.js +16 -4
  28. package/lib/Pagination/SideButton.js +3 -1
  29. package/lib/Radio/Radio.js +0 -2
  30. package/lib/StackView/StackView.js +1 -0
  31. package/lib/StackView/StackWrap.js +9 -5
  32. package/lib/StackView/StackWrapBox.js +1 -0
  33. package/lib/Tabs/Tabs.js +12 -4
  34. package/lib/Tabs/TabsItem.js +12 -6
  35. package/lib/ToggleSwitch/ToggleSwitch.js +99 -37
  36. package/lib/ToggleSwitch/ToggleSwitchGroup.js +230 -0
  37. package/lib/ToggleSwitch/index.js +14 -4
  38. package/lib/index.js +28 -9
  39. package/lib/utils/a11y/propTypes.js +61 -0
  40. package/lib/utils/a11y/propTypes.native.js +47 -0
  41. package/lib/utils/index.js +10 -1
  42. package/lib/utils/propTypes.js +35 -91
  43. package/lib/utils/withLinkRouter.js +98 -0
  44. package/package.json +10 -6
  45. package/release-context.json +4 -4
  46. package/src/Box/Box.jsx +1 -0
  47. package/src/Button/ButtonBase.jsx +11 -4
  48. package/src/Card/CardBase.jsx +1 -0
  49. package/src/Card/PressableCardBase.jsx +6 -4
  50. package/src/Checkbox/Checkbox.jsx +0 -2
  51. package/src/FlexGrid/FlexGrid.jsx +1 -1
  52. package/src/IconButton/IconButton.jsx +6 -4
  53. package/src/Link/LinkBase.jsx +6 -4
  54. package/src/List/List.jsx +1 -3
  55. package/src/List/ListItem.jsx +11 -26
  56. package/src/List/index.js +5 -0
  57. package/src/Pagination/PageButton.jsx +5 -8
  58. package/src/Pagination/Pagination.jsx +29 -2
  59. package/src/Pagination/SideButton.jsx +2 -2
  60. package/src/Radio/Radio.jsx +0 -2
  61. package/src/StackView/StackView.jsx +1 -0
  62. package/src/StackView/StackWrap.jsx +7 -6
  63. package/src/StackView/StackWrapBox.jsx +1 -0
  64. package/src/Tabs/Tabs.jsx +49 -22
  65. package/src/Tabs/TabsItem.jsx +11 -7
  66. package/src/ToggleSwitch/ToggleSwitch.jsx +92 -34
  67. package/src/ToggleSwitch/ToggleSwitchGroup.jsx +203 -0
  68. package/src/ToggleSwitch/index.js +2 -1
  69. package/src/index.js +2 -2
  70. package/src/utils/a11y/propTypes.js +61 -0
  71. package/src/utils/a11y/propTypes.native.js +39 -0
  72. package/src/utils/index.js +1 -0
  73. package/src/utils/propTypes.js +33 -111
  74. package/src/utils/withLinkRouter.jsx +68 -0
  75. package/stories/A11yText/A11yText.stories.jsx +1 -1
  76. package/stories/ActivityIndicator/ActivityIndicator.stories.jsx +1 -1
  77. package/stories/Box/Box.stories.jsx +1 -1
  78. package/stories/Button/Button.stories.jsx +1 -1
  79. package/stories/Button/ButtonGroup.stories.jsx +1 -1
  80. package/stories/Button/ButtonLink.stories.jsx +1 -1
  81. package/stories/Card/Card.stories.jsx +1 -1
  82. package/stories/Checkbox/Checkbox.stories.jsx +1 -1
  83. package/stories/Divider/Divider.stories.jsx +1 -1
  84. package/stories/ExpandCollapse/ExpandCollapse.stories.jsx +1 -1
  85. package/stories/Feedback/Feedback.stories.jsx +1 -1
  86. package/stories/FlexGrid/01 FlexGrid.stories.jsx +1 -1
  87. package/stories/FlexGrid/02 Row.stories.jsx +1 -1
  88. package/stories/FlexGrid/03 Col.stories.jsx +1 -1
  89. package/stories/Icon/Icon.stories.jsx +1 -1
  90. package/stories/IconButton/IconButton.stories.jsx +1 -1
  91. package/stories/InputLabel/InputLabel.stories.jsx +1 -1
  92. package/stories/Link/ChevronLink.stories.jsx +1 -1
  93. package/stories/Link/Link.stories.jsx +1 -1
  94. package/stories/Link/TextButton.stories.jsx +1 -1
  95. package/stories/List/List.stories.jsx +1 -1
  96. package/stories/Modal/Modal.stories.jsx +1 -1
  97. package/stories/Notification/Notification.stories.jsx +1 -1
  98. package/stories/Pagination/Pagination.stories.jsx +1 -1
  99. package/stories/Progress/Progress.stories.jsx +1 -1
  100. package/stories/Radio/Radio.stories.jsx +1 -1
  101. package/stories/RadioCard/RadioCard.stories.jsx +1 -1
  102. package/stories/Search/Search.stories.jsx +1 -1
  103. package/stories/Select/Select.stories.jsx +1 -1
  104. package/stories/SideNav/SideNav.stories.jsx +1 -1
  105. package/stories/SideNav/SideNavItem.stories.jsx +1 -1
  106. package/stories/SideNav/SideNavItemsGroup.stories.jsx +1 -1
  107. package/stories/Skeleton/Skeleton.stories.jsx +1 -1
  108. package/stories/Spacer/Spacer.stories.jsx +1 -1
  109. package/stories/StackView/StackView.stories.jsx +1 -1
  110. package/stories/StackView/StackWrap.stories.jsx +1 -1
  111. package/stories/StepTracker/StepTracker.stories.jsx +1 -1
  112. package/stories/Tabs/Tabs.stories.jsx +1 -1
  113. package/stories/Tags/Tags.stories.jsx +1 -1
  114. package/stories/TextInput/TextArea.stories.jsx +2 -1
  115. package/stories/TextInput/TextInput.stories.jsx +1 -1
  116. package/stories/ToggleSwitch/ToggleSwitch.stories.jsx +6 -2
  117. package/stories/ToggleSwitch/ToggleSwitchGroup.stories.jsx +81 -0
  118. package/stories/Tooltip/Tooltip.stories.jsx +1 -1
  119. package/stories/TooltipButton/TooltipButton.stories.jsx +1 -1
  120. package/stories/Typography/Typography.stories.jsx +1 -1
  121. package/stories/supports.jsx +2 -3
@@ -11,18 +11,24 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
12
  var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
13
13
 
14
+ var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
15
+
14
16
  var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
15
17
 
16
- var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
18
+ var _InputLabel = _interopRequireDefault(require("../InputLabel"));
17
19
 
18
20
  var _ButtonBase = _interopRequireDefault(require("../Button/ButtonBase"));
19
21
 
22
+ var _StackView = _interopRequireDefault(require("../StackView"));
23
+
20
24
  var _ThemeProvider = require("../ThemeProvider");
21
25
 
22
26
  var _propTypes2 = require("../utils/propTypes");
23
27
 
24
28
  var _input = require("../utils/input");
25
29
 
30
+ var _utils = require("../utils");
31
+
26
32
  var _jsxRuntime = require("react/jsx-runtime");
27
33
 
28
34
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -80,16 +86,41 @@ const selectSwitchStyles = ({
80
86
  })
81
87
  });
82
88
 
89
+ const selectLabelStyles = ({
90
+ labelMarginLeft
91
+ }) => ({
92
+ marginLeft: labelMarginLeft
93
+ });
94
+
95
+ const selectLabelTokens = ({
96
+ labelColor,
97
+ labelFontName,
98
+ labelFontSize,
99
+ labelFontWeight,
100
+ labelLineHeight
101
+ }) => ({
102
+ color: labelColor,
103
+ fontName: labelFontName,
104
+ fontWeight: labelFontWeight,
105
+ fontSize: labelFontSize,
106
+ lineHeight: labelLineHeight
107
+ });
108
+
83
109
  const ToggleSwitch = /*#__PURE__*/(0, _react.forwardRef)(({
84
110
  value,
85
111
  initialValue,
86
112
  onChange,
113
+ id,
114
+ label,
87
115
  inactive,
88
116
  tokens,
117
+ tooltip,
89
118
  variant,
90
- accessibilityRole = 'switch'
119
+ accessibilityRole = 'switch',
120
+ accessibilityLabel = label
91
121
  }, ref) => {
92
122
  const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('ToggleSwitch', tokens, variant);
123
+ const themeTokens = getTokens();
93
124
  const {
94
125
  currentValue,
95
126
  setValue
@@ -103,41 +134,57 @@ const ToggleSwitch = /*#__PURE__*/(0, _react.forwardRef)(({
103
134
 
104
135
  const getButtonTokens = buttonState => selectButtonTokens(getTokens(buttonState));
105
136
 
106
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
107
- ref: ref,
108
- selected: currentValue,
109
- inactive: inactive,
110
- tokens: getButtonTokens,
111
- accessibilityRole: accessibilityRole,
112
- accessibilityState: {
113
- checked: currentValue
114
- },
115
- onPress: handlePress,
116
- children: buttonState => {
117
- const themeTokens = getTokens(buttonState);
118
- const IconComponent = themeTokens.icon;
119
- const switchStyles = selectSwitchStyles(themeTokens);
120
- const trackStyles = selectTrackStyles(themeTokens);
121
- const iconTokens = selectIconTokens(themeTokens); // If drag-slide support is needed, use a PanResponder and apply these to an Animated value.
122
- // Use translate transforms for smoothest non-thread-blocking animations and to allow drag.
123
-
124
- const slideStart = 0;
125
- const slideEnd = themeTokens.width - themeTokens.switchSize - themeTokens.trackBorderWidth * 2;
126
- const switchOffset = buttonState.selected ? slideEnd : slideStart;
127
- const switchPositionStyle = {
128
- transform: [{
129
- translateX: switchOffset
130
- }]
131
- };
132
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
133
- style: [staticStyles.track, trackStyles],
134
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
135
- style: [staticStyles.switch, switchStyles, switchPositionStyle],
136
- children: IconComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, { ...iconTokens
137
+ const uniqueId = (0, _utils.useUniqueId)('toggleSwitch');
138
+ const inputId = id ?? uniqueId;
139
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StackView.default, {
140
+ space: 2,
141
+ direction: "row",
142
+ children: [Boolean(label) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
143
+ style: selectLabelStyles(themeTokens),
144
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputLabel.default, {
145
+ forId: inputId,
146
+ label: label,
147
+ tokens: selectLabelTokens(themeTokens),
148
+ tooltip: tooltip
149
+ })
150
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
151
+ id: id,
152
+ ref: ref,
153
+ selected: currentValue,
154
+ inactive: inactive,
155
+ tokens: getButtonTokens,
156
+ accessibilityLabel: accessibilityLabel,
157
+ accessibilityRole: accessibilityRole,
158
+ accessibilityState: {
159
+ checked: currentValue
160
+ },
161
+ onPress: handlePress,
162
+ children: buttonState => {
163
+ const stateTokens = getTokens(buttonState);
164
+ const IconComponent = stateTokens.icon;
165
+ const switchStyles = selectSwitchStyles(stateTokens);
166
+ const trackStyles = selectTrackStyles(stateTokens);
167
+ const iconTokens = selectIconTokens(stateTokens); // If drag-slide support is needed, use a PanResponder and apply these to an Animated value.
168
+ // Use translate transforms for smoothest non-thread-blocking animations and to allow drag.
169
+
170
+ const slideStart = 0;
171
+ const slideEnd = stateTokens.width - stateTokens.switchSize - stateTokens.trackBorderWidth * 2;
172
+ const switchOffset = buttonState.selected ? slideEnd : slideStart;
173
+ const switchPositionStyle = {
174
+ transform: [{
175
+ translateX: switchOffset
176
+ }]
177
+ };
178
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
179
+ style: [staticStyles.track, trackStyles],
180
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
181
+ style: [staticStyles.switch, switchStyles, switchPositionStyle],
182
+ children: IconComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, { ...iconTokens
183
+ })
137
184
  })
138
- })
139
- });
140
- }
185
+ });
186
+ }
187
+ })]
141
188
  });
142
189
  });
143
190
  ToggleSwitch.displayName = 'ToggleSwitch';
@@ -165,11 +212,26 @@ ToggleSwitch.propTypes = { ..._propTypes2.a11yProps.propTypes,
165
212
  */
166
213
  onChange: _propTypes.default.func,
167
214
 
215
+ /**
216
+ * Input ID.
217
+ */
218
+ id: _propTypes.default.string,
219
+
220
+ /**
221
+ * An optional label.
222
+ */
223
+ label: _propTypes.default.string,
224
+
168
225
  /**
169
226
  * If passed, the switch does not respond to user input and may recieve different
170
227
  * theme tokens if the theme supports inactive appearance.
171
228
  */
172
- inactive: _propTypes.default.bool
229
+ inactive: _propTypes.default.bool,
230
+
231
+ /**
232
+ * Content of an optional Tooltip. If set, a tooltip button will be shown next to the label.
233
+ */
234
+ tooltip: _propTypes.default.string
173
235
  };
174
236
 
175
237
  const staticStyles = _StyleSheet.default.create({
@@ -0,0 +1,230 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _airbnbPropTypes = _interopRequireDefault(require("airbnb-prop-types"));
13
+
14
+ var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
15
+
16
+ var _ToggleSwitch = _interopRequireDefault(require("./ToggleSwitch"));
17
+
18
+ var _Fieldset = _interopRequireDefault(require("../Fieldset"));
19
+
20
+ var _StackView = require("../StackView");
21
+
22
+ var _ViewportProvider = require("../ViewportProvider");
23
+
24
+ var _ThemeProvider = require("../ThemeProvider");
25
+
26
+ var _propTypes2 = require("../utils/propTypes");
27
+
28
+ var _input = require("../utils/input");
29
+
30
+ var _jsxRuntime = require("react/jsx-runtime");
31
+
32
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
+
34
+ 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); }
35
+
36
+ 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
+
38
+ const ToggleSwitchGroup = /*#__PURE__*/(0, _react.forwardRef)(({
39
+ variant,
40
+ tokens,
41
+ items = [],
42
+ values,
43
+ initialValues,
44
+ maxValues = 1,
45
+ onChange,
46
+ readOnly = false,
47
+ inactive = false,
48
+ feedback,
49
+ hint,
50
+ tooltip,
51
+ legend,
52
+ name: inputGroupName,
53
+ accessibilityRole = maxValues === 1 ? 'radiogroup' // radiogroup is cross-platform; only web aria has generic groups
54
+ : _Platform.default.select({
55
+ web: 'group',
56
+ default: 'none'
57
+ }),
58
+ toggleSwitchTokens,
59
+ validation,
60
+ ...rest
61
+ }, ref) => {
62
+ const viewport = (0, _ViewportProvider.useViewport)();
63
+ const {
64
+ space,
65
+ fieldSpace
66
+ } = (0, _ThemeProvider.useThemeTokens)('ToggleSwitchGroup', tokens, variant, {
67
+ viewport
68
+ });
69
+ const {
70
+ currentValues,
71
+ toggleOneValue
72
+ } = (0, _input.useMultipleInputValues)({
73
+ initialValues,
74
+ values,
75
+ maxValues,
76
+ onChange,
77
+ readOnly
78
+ });
79
+
80
+ const a11y = _propTypes2.a11yProps.select({
81
+ accessibilityRole,
82
+ ...rest
83
+ });
84
+
85
+ const itemA11yRole = a11y.accessibilityRole === 'radiogroup' ? 'radio' : 'switch';
86
+ const toggleSwitches = items.map(({
87
+ label,
88
+ id = label,
89
+ accessibilityLabel = label,
90
+ onChange: itemOnChange,
91
+ ref: itemRef,
92
+ tooltip: itemTooltip
93
+ }, index) => {
94
+ const isSelected = currentValues.includes(id);
95
+
96
+ const handleChange = (newCheckedState, event) => {
97
+ if (typeof itemOnChange === 'function') itemOnChange(newCheckedState, event);
98
+ toggleOneValue(id, event);
99
+ };
100
+
101
+ const itemA11y = {
102
+ accessibilityState: {
103
+ checked: isSelected
104
+ },
105
+ accessibilityRole: itemA11yRole,
106
+ accessibilityLabel,
107
+ ..._propTypes2.a11yProps.getPositionInSet(items.length, index)
108
+ };
109
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToggleSwitch.default, {
110
+ id: id,
111
+ ref: itemRef,
112
+ onChange: handleChange,
113
+ tokens: toggleSwitchTokens,
114
+ value: isSelected,
115
+ inactive: inactive,
116
+ label: label,
117
+ tooltip: itemTooltip,
118
+ ...itemA11y
119
+ }, id);
120
+ });
121
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Fieldset.default, {
122
+ ref: ref,
123
+ name: inputGroupName,
124
+ legend: legend,
125
+ tooltip: tooltip,
126
+ hint: hint,
127
+ space: fieldSpace,
128
+ feedback: feedback,
129
+ inactive: inactive,
130
+ validation: validation,
131
+ ...a11y,
132
+ children: (0, _StackView.getStackedContent)(toggleSwitches, {
133
+ space,
134
+ direction: 'column'
135
+ })
136
+ });
137
+ });
138
+ ToggleSwitchGroup.displayName = 'ToggleSwitchGroup';
139
+ ToggleSwitchGroup.propTypes = { ..._propTypes2.a11yProps.propTypes,
140
+ ..._propTypes2.pressProps.propTypes,
141
+ tokens: (0, _propTypes2.getTokensPropType)('ToggleSwitchGroup'),
142
+ variant: _propTypes2.variantProp.propType,
143
+
144
+ /**
145
+ * The maximum number of items a user may select at once. Defaults to 1 and behaves
146
+ * like radio buttons. To have no limit and allow any number of selections, pass `null`.
147
+ */
148
+ maxValues: _propTypes.default.number,
149
+
150
+ /**
151
+ * The options a user may select
152
+ */
153
+ items: _propTypes.default.arrayOf(_propTypes.default.shape({
154
+ /**
155
+ * The text displayed to the user on the label.
156
+ */
157
+ label: _propTypes.default.string.isRequired,
158
+
159
+ /**
160
+ * An optional accessibility label may be passed to each ToggleSwitch
161
+ * and will be applied as normal for a React Native accessibilityLabel prop.
162
+ */
163
+ accessibilityLabel: _propTypes.default.string,
164
+
165
+ /**
166
+ * An optional unique string may be provided to identify this option,
167
+ * which will be used in code and passed to any onChange function.
168
+ * If not provided, the label is used.
169
+ */
170
+ id: _propTypes.default.string,
171
+
172
+ /**
173
+ * An optional ref for one individual ToggleSwitch in the ToggleSwitchGroup
174
+ */
175
+ ref: _airbnbPropTypes.default.ref()
176
+ })),
177
+
178
+ /**
179
+ * If provided, this function is called when the current selection is changed
180
+ * and is passed an array of the `id`s of all currently selected `items`.
181
+ */
182
+ onChange: _propTypes.default.func,
183
+
184
+ /**
185
+ * If the selected item(s) in the toggle switch group are to be controlled externally by
186
+ * a parent component, pass an array of strings as well as an `onChange` handler.
187
+ * Passing an array for "values" makes the ToggleSwitchGroup a "controlled" component that
188
+ * expects its state to be handled via `onChange` and so doesn't handle it itself.
189
+ */
190
+ values: _propTypes.default.arrayOf(_propTypes.default.string),
191
+
192
+ /**
193
+ * If `values` is not passed, making the ToggleSwitchGroup an "uncontrolled" component
194
+ * managing its own selected state, a default set of selections may be provided.
195
+ * Changing the `initialValues` does not change the user's selections.
196
+ */
197
+ initialValues: _propTypes.default.arrayOf(_propTypes.default.string),
198
+
199
+ /**
200
+ * Optional additional text giving more detail to help a user make a choice.
201
+ */
202
+ hint: _propTypes.default.string,
203
+
204
+ /**
205
+ * Optional tooltip text content to include alongside the legend and hint.
206
+ */
207
+ tooltip: _propTypes.default.string,
208
+
209
+ /**
210
+ * If provided, a Feedback element is rendered containing this text.
211
+ */
212
+ feedback: _propTypes.default.string,
213
+
214
+ /**
215
+ * Main text used to describe this group, used in Fieldset's Legend element.
216
+ */
217
+ legend: _propTypes.default.string,
218
+
219
+ /**
220
+ * Toggle switch token overrides.
221
+ */
222
+ toggleSwitchTokens: (0, _propTypes2.getTokensPropType)('ToggleSwitch'),
223
+
224
+ /**
225
+ * Current validation status of the group, passed to the feedback element if there is one.
226
+ */
227
+ validation: _propTypes.default.oneOf(['error', 'success'])
228
+ };
229
+ var _default = ToggleSwitchGroup;
230
+ exports.default = _default;
@@ -3,11 +3,21 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ Object.defineProperty(exports, "ToggleSwitch", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _ToggleSwitch.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "ToggleSwitchGroup", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _ToggleSwitchGroup.default;
16
+ }
17
+ });
7
18
 
8
19
  var _ToggleSwitch = _interopRequireDefault(require("./ToggleSwitch"));
9
20
 
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+ var _ToggleSwitchGroup = _interopRequireDefault(require("./ToggleSwitchGroup"));
11
22
 
12
- var _default = _ToggleSwitch.default;
13
- exports.default = _default;
23
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
package/lib/index.js CHANGED
@@ -21,6 +21,8 @@ var _exportNames = {
21
21
  IconButton: true,
22
22
  InputLabel: true,
23
23
  List: true,
24
+ ListItem: true,
25
+ ListBase: true,
24
26
  Modal: true,
25
27
  Notification: true,
26
28
  Pagination: true,
@@ -36,7 +38,6 @@ var _exportNames = {
36
38
  StepTracker: true,
37
39
  Tabs: true,
38
40
  Tags: true,
39
- ToggleSwitch: true,
40
41
  Tooltip: true,
41
42
  TooltipButton: true,
42
43
  Typography: true,
@@ -153,6 +154,18 @@ Object.defineProperty(exports, "List", {
153
154
  return _List.default;
154
155
  }
155
156
  });
157
+ Object.defineProperty(exports, "ListItem", {
158
+ enumerable: true,
159
+ get: function () {
160
+ return _List.ListItem;
161
+ }
162
+ });
163
+ Object.defineProperty(exports, "ListBase", {
164
+ enumerable: true,
165
+ get: function () {
166
+ return _List.ListBase;
167
+ }
168
+ });
156
169
  Object.defineProperty(exports, "Modal", {
157
170
  enumerable: true,
158
171
  get: function () {
@@ -243,12 +256,6 @@ Object.defineProperty(exports, "Tags", {
243
256
  return _Tags.default;
244
257
  }
245
258
  });
246
- Object.defineProperty(exports, "ToggleSwitch", {
247
- enumerable: true,
248
- get: function () {
249
- return _ToggleSwitch.default;
250
- }
251
- });
252
259
  Object.defineProperty(exports, "Tooltip", {
253
260
  enumerable: true,
254
261
  get: function () {
@@ -420,7 +427,7 @@ Object.keys(_Link).forEach(function (key) {
420
427
  });
421
428
  });
422
429
 
423
- var _List = _interopRequireDefault(require("./List"));
430
+ var _List = _interopRequireWildcard(require("./List"));
424
431
 
425
432
  var _Modal = _interopRequireDefault(require("./Modal"));
426
433
 
@@ -502,7 +509,19 @@ Object.keys(_TextInput).forEach(function (key) {
502
509
  });
503
510
  });
504
511
 
505
- var _ToggleSwitch = _interopRequireDefault(require("./ToggleSwitch"));
512
+ var _ToggleSwitch = require("./ToggleSwitch");
513
+
514
+ Object.keys(_ToggleSwitch).forEach(function (key) {
515
+ if (key === "default" || key === "__esModule") return;
516
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
517
+ if (key in exports && exports[key] === _ToggleSwitch[key]) return;
518
+ Object.defineProperty(exports, key, {
519
+ enumerable: true,
520
+ get: function () {
521
+ return _ToggleSwitch[key];
522
+ }
523
+ });
524
+ });
506
525
 
507
526
  var _Tooltip = _interopRequireDefault(require("./Tooltip"));
508
527
 
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+
10
+ var _propTypes2 = _interopRequireDefault(require("./propTypes.native"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ var _default = { ..._propTypes2.default,
15
+ // React Native Web adds many a11y props that alias aria-* attributes
16
+ // Types based on https://necolas.github.io/react-native-web/docs/accessibility/
17
+ accessibilityActiveDescendant: _propTypes.default.string,
18
+ accessibilityAtomic: _propTypes.default.bool,
19
+ accessibilityAutoComplete: _propTypes.default.string,
20
+ accessibilityBusy: _propTypes.default.bool,
21
+ accessibilityChecked: _propTypes.default.oneOf([true, false, 'mixed']),
22
+ accessibilityColumnCount: _propTypes.default.number,
23
+ accessibilityColumnIndex: _propTypes.default.number,
24
+ accessibilityColumnSpan: _propTypes.default.number,
25
+ accessibilityControls: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
26
+ accessibilityCurrent: _propTypes.default.oneOf([true, false, 'page', 'step', 'location', 'date', 'time']),
27
+ accessibilityDescribedBy: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
28
+ accessibilityDetails: _propTypes.default.string,
29
+ accessibilityDisabled: _propTypes.default.bool,
30
+ accessibilityErrorMessage: _propTypes.default.string,
31
+ accessibilityExpanded: _propTypes.default.bool,
32
+ accessibilityFlowTo: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
33
+ accessibilityHasPopup: _propTypes.default.string,
34
+ accessibilityHidden: _propTypes.default.bool,
35
+ accessibilityInvalid: _propTypes.default.bool,
36
+ accessibilityKeyShortcuts: _propTypes.default.string,
37
+ accessibilityLabelledBy: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
38
+ accessibilityLevel: _propTypes.default.number,
39
+ accessibilityModal: _propTypes.default.bool,
40
+ accessibilityMultiline: _propTypes.default.bool,
41
+ accessibilityMultiSelectable: _propTypes.default.bool,
42
+ accessibilityOrientation: _propTypes.default.oneOf(['horizontal', 'vertical']),
43
+ accessibilityOwns: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
44
+ accessibilityPlaceholder: _propTypes.default.string,
45
+ accessibilityPosInSet: _propTypes.default.number,
46
+ accessibilityPressed: _propTypes.default.bool,
47
+ accessibilityReadOnly: _propTypes.default.bool,
48
+ accessibilityRequired: _propTypes.default.bool,
49
+ accessibilityRoleDescription: _propTypes.default.string,
50
+ accessibilityRowCount: _propTypes.default.number,
51
+ accessibilityRowIndex: _propTypes.default.number,
52
+ accessibilityRowSpan: _propTypes.default.number,
53
+ accessibilitySelected: _propTypes.default.bool,
54
+ accessibilitySetSize: _propTypes.default.number,
55
+ accessibilitySort: _propTypes.default.oneOf(['ascending', 'descending', 'none', 'other']),
56
+ accessibilityValueMax: _propTypes.default.number,
57
+ accessibilityValueMin: _propTypes.default.number,
58
+ accessibilityValueNow: _propTypes.default.number,
59
+ accessibilityValueText: _propTypes.default.string
60
+ };
61
+ exports.default = _default;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ // React Native exports a11y prop definitions as TypeScript Interfaces, but no longer exports PropTypes
13
+ // so we have to define them ourselves.
14
+ var _default = {
15
+ accessible: _propTypes.default.bool,
16
+ focusable: _propTypes.default.bool,
17
+ accessibilityElementsHidden: _propTypes.default.bool,
18
+ accessibilityHint: _propTypes.default.string,
19
+ // react-native-web ignores `accessibilityHint`
20
+ accessibilityIgnoresInvertColors: _propTypes.default.bool,
21
+ accessibilityLabel: _propTypes.default.string,
22
+ accessibilityRole: _propTypes.default.string,
23
+ accessibilityActions: _propTypes.default.arrayOf(_propTypes.default.shape({
24
+ name: _propTypes.default.string.isRequired,
25
+ label: _propTypes.default.string
26
+ })),
27
+ accessibilityLiveRegion: _propTypes.default.oneOf(['none', 'polite', 'assertive']),
28
+ accessibilityState: _propTypes.default.shape({
29
+ disabled: _propTypes.default.bool,
30
+ selected: _propTypes.default.bool,
31
+ checked: _propTypes.default.oneOf([true, false, 'mixed']),
32
+ busy: _propTypes.default.bool,
33
+ expanded: _propTypes.default.bool
34
+ }),
35
+ accessibilityValue: _propTypes.default.shape({
36
+ min: _propTypes.default.number,
37
+ max: _propTypes.default.number,
38
+ now: _propTypes.default.number,
39
+ text: _propTypes.default.string
40
+ }),
41
+ accessibilityViewIsModal: _propTypes.default.bool,
42
+ importantForAccessibility: _propTypes.default.oneOf(['auto', 'yes', 'no', 'no-hide-descendants']),
43
+ onAccessibilityAction: _propTypes.default.func,
44
+ onAccessibilityEscape: _propTypes.default.func,
45
+ onAccessibilityTap: _propTypes.default.func
46
+ };
47
+ exports.default = _default;
@@ -9,7 +9,8 @@ var _exportNames = {
9
9
  useHash: true,
10
10
  useSpacingScale: true,
11
11
  useResponsiveProp: true,
12
- useUniqueId: true
12
+ useUniqueId: true,
13
+ withLinkRouter: true
13
14
  };
14
15
  Object.defineProperty(exports, "info", {
15
16
  enumerable: true,
@@ -47,6 +48,12 @@ Object.defineProperty(exports, "useUniqueId", {
47
48
  return _useUniqueId.default;
48
49
  }
49
50
  });
51
+ Object.defineProperty(exports, "withLinkRouter", {
52
+ enumerable: true,
53
+ get: function () {
54
+ return _withLinkRouter.default;
55
+ }
56
+ });
50
57
 
51
58
  var _a11y = require("./a11y");
52
59
 
@@ -156,6 +163,8 @@ Object.keys(_useResponsiveProp).forEach(function (key) {
156
163
 
157
164
  var _useUniqueId = _interopRequireDefault(require("./useUniqueId"));
158
165
 
166
+ var _withLinkRouter = _interopRequireDefault(require("./withLinkRouter"));
167
+
159
168
  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); }
160
169
 
161
170
  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; }