@telus-uds/components-base 1.18.1 → 1.19.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 (36) hide show
  1. package/CHANGELOG.md +22 -2
  2. package/component-docs.json +111 -16
  3. package/jest.config-android.js +17 -0
  4. package/jest.config-ios.js +18 -0
  5. package/jest.config-web.js +31 -0
  6. package/lib/Button/ButtonBase.js +6 -2
  7. package/lib/Carousel/Carousel.js +32 -4
  8. package/lib/Carousel/CarouselTabs/CarouselTabsPanel.js +1 -10
  9. package/lib/Pagination/SideButton.js +6 -4
  10. package/lib/Responsive/Responsive.js +58 -0
  11. package/lib/Responsive/index.js +13 -0
  12. package/lib/Search/Search.js +29 -62
  13. package/lib/Tags/Tags.js +10 -4
  14. package/lib/TextInput/TextInputBase.js +53 -19
  15. package/lib/index.js +9 -0
  16. package/lib-module/Button/ButtonBase.js +6 -2
  17. package/lib-module/Carousel/Carousel.js +32 -4
  18. package/lib-module/Carousel/CarouselTabs/CarouselTabsPanel.js +1 -10
  19. package/lib-module/Pagination/SideButton.js +6 -4
  20. package/lib-module/Responsive/Responsive.js +45 -0
  21. package/lib-module/Responsive/index.js +2 -0
  22. package/lib-module/Search/Search.js +29 -60
  23. package/lib-module/Tags/Tags.js +10 -4
  24. package/lib-module/TextInput/TextInputBase.js +52 -19
  25. package/lib-module/index.js +1 -0
  26. package/package.json +6 -3
  27. package/src/Button/ButtonBase.jsx +4 -2
  28. package/src/Carousel/Carousel.jsx +42 -10
  29. package/src/Carousel/CarouselTabs/CarouselTabsPanel.jsx +0 -10
  30. package/src/Pagination/SideButton.jsx +5 -5
  31. package/src/Responsive/Responsive.jsx +33 -0
  32. package/src/Responsive/index.js +3 -0
  33. package/src/Search/Search.jsx +17 -32
  34. package/src/Tags/Tags.jsx +46 -33
  35. package/src/TextInput/TextInputBase.jsx +46 -16
  36. package/src/index.js +1 -0
@@ -9,8 +9,6 @@ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
11
11
 
12
- var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
13
-
14
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
15
13
 
16
14
  var _ThemeProvider = require("../ThemeProvider");
@@ -21,8 +19,6 @@ var _TextInputBase = _interopRequireDefault(require("../TextInput/TextInputBase"
21
19
 
22
20
  var _ButtonBase = _interopRequireDefault(require("../Button/ButtonBase"));
23
21
 
24
- var _StackView = _interopRequireDefault(require("../StackView"));
25
-
26
22
  var _useCopy = _interopRequireDefault(require("../utils/useCopy"));
27
23
 
28
24
  var _dictionary = _interopRequireDefault(require("./dictionary"));
@@ -63,20 +59,11 @@ const selectInputTokens = _ref => {
63
59
 
64
60
  const selectButtonTokens = tokens => (0, _utils.selectTokens)('Button', tokens);
65
61
 
66
- const selectIconsContainerStyle = _ref2 => {
67
- let {
68
- paddingRight
69
- } = _ref2;
70
- return {
71
- paddingRight
72
- };
73
- };
74
-
75
- const selectIconTokens = _ref3 => {
62
+ const selectIconTokens = _ref2 => {
76
63
  let {
77
64
  iconSize,
78
65
  iconColor
79
- } = _ref3;
66
+ } = _ref2;
80
67
  return {
81
68
  color: iconColor,
82
69
  size: iconSize
@@ -97,7 +84,7 @@ const selectIconTokens = _ref3 => {
97
84
  */
98
85
 
99
86
 
100
- const Search = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
87
+ const Search = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
101
88
  let {
102
89
  initialValue,
103
90
  value,
@@ -112,7 +99,7 @@ const Search = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
112
99
  tokens,
113
100
  variant,
114
101
  ...rest
115
- } = _ref4;
102
+ } = _ref3;
116
103
  const {
117
104
  currentValue = '',
118
105
  setValue
@@ -164,10 +151,8 @@ const Search = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
164
151
  testID,
165
152
  ...containerProps
166
153
  } = selectContainerProps(rest);
167
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
168
- style: staticStyles.container,
169
- ...containerProps,
170
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextInputBase.default, {
154
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, { ...containerProps,
155
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextInputBase.default, {
171
156
  nativeID: nativeID,
172
157
  testID: testID,
173
158
  ...selectInputProps(rest),
@@ -187,35 +172,29 @@ const Search = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
187
172
  onChange: setValue,
188
173
  onSubmitEditing: handleSubmit,
189
174
  onFocus: handleFocus,
190
- accessibilityLabel: a11yLabelText
191
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
192
- style: [staticStyles.iconsContainer, selectIconsContainerStyle(themeTokens)],
193
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StackView.default, {
194
- direction: "row",
195
- space: buttonsGap,
196
- children: [ClearButtonIcon && !isEmpty && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
197
- onPress: handleClear,
198
- inactive: inactive,
199
- accessibilityRole: "button",
200
- accessibilityLabel: getCopy('clearButtonAccessibilityLabel'),
201
- tokens: appearances => selectButtonTokens(getButtonTokens(appearances)),
202
- children: buttonState => /*#__PURE__*/(0, _jsxRuntime.jsx)(ClearButtonIcon, { ...selectIconTokens(getButtonTokens(buttonState))
203
- })
204
- }), SubmitButtonIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
205
- onPress: handleSubmit,
206
- inactive: inactive,
207
- accessibilityRole: "button",
208
- accessibilityLabel: getCopy('submitButtonAccessibilityLabel'),
209
- tokens: buttonState => selectButtonTokens(getButtonTokens({ ...buttonState,
175
+ accessibilityLabel: a11yLabelText,
176
+ buttons: [ClearButtonIcon && !isEmpty && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
177
+ accessibilityLabel: getCopy('clearButtonAccessibilityLabel'),
178
+ accessibilityRole: "button",
179
+ inactive: inactive,
180
+ onPress: handleClear,
181
+ tokens: appearances => selectButtonTokens(getButtonTokens(appearances)),
182
+ children: buttonState => /*#__PURE__*/(0, _jsxRuntime.jsx)(ClearButtonIcon, { ...selectIconTokens(getButtonTokens(buttonState))
183
+ })
184
+ }, "clear"), SubmitButtonIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
185
+ accessibilityLabel: getCopy('submitButtonAccessibilityLabel'),
186
+ accessibilityRole: "button",
187
+ inactive: inactive,
188
+ onPress: handleSubmit,
189
+ tokens: buttonState => selectButtonTokens(getButtonTokens({ ...buttonState,
190
+ priority: 'high'
191
+ })),
192
+ children: buttonState => /*#__PURE__*/(0, _jsxRuntime.jsx)(SubmitButtonIcon, { ...selectIconTokens(getButtonTokens({ ...buttonState,
210
193
  priority: 'high'
211
- })),
212
- children: buttonState => /*#__PURE__*/(0, _jsxRuntime.jsx)(SubmitButtonIcon, { ...selectIconTokens(getButtonTokens({ ...buttonState,
213
- priority: 'high'
214
- }))
215
- })
216
- })]
217
- })
218
- })]
194
+ }))
195
+ })
196
+ }, "submit")]
197
+ })
219
198
  });
220
199
  });
221
200
  Search.displayName = 'Search';
@@ -280,16 +259,4 @@ Search.propTypes = { ...selectedContainerPropTypes,
280
259
  variant: _utils.variantProp.propType
281
260
  };
282
261
  var _default = Search;
283
- exports.default = _default;
284
-
285
- const staticStyles = _StyleSheet.default.create({
286
- container: {// No styles needed here except the View defaults (position: relative etc)
287
- },
288
- iconsContainer: {
289
- position: 'absolute',
290
- right: 0,
291
- top: 0,
292
- bottom: 0,
293
- justifyContent: 'center'
294
- }
295
- });
262
+ exports.default = _default;
package/lib/Tags/Tags.js CHANGED
@@ -42,7 +42,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
42
42
  const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
43
43
  const [selectItemProps, selectedItemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.focusHandlerProps, _utils.pressProps, _utils.viewProps]);
44
44
 
45
- const selectIconTextTokens = _ref => {
45
+ const separateIconTextTokens = (_ref, returnRest) => {
46
46
  let {
47
47
  icon,
48
48
  iconPosition,
@@ -54,9 +54,10 @@ const selectIconTextTokens = _ref => {
54
54
  iconAlignSelf,
55
55
  iconPadding,
56
56
  iconTranslateX,
57
- iconTranslateY
57
+ iconTranslateY,
58
+ ...rest
58
59
  } = _ref;
59
- return {
60
+ return returnRest ? rest : {
60
61
  icon,
61
62
  iconPosition,
62
63
  iconSpace,
@@ -81,6 +82,10 @@ const selectIconTextTokens = _ref => {
81
82
  };
82
83
  };
83
84
 
85
+ const selectIconTextTokens = tokens => separateIconTextTokens(tokens, false);
86
+
87
+ const selectNonIconTextTokens = tokens => separateIconTextTokens(tokens, true);
88
+
84
89
  const Tags = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
85
90
  let {
86
91
  variant,
@@ -109,7 +114,8 @@ const Tags = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
109
114
  } = themeTokens;
110
115
  const getItemTokens = (0, _ThemeProvider.useThemeTokensCallback)('TagsItem', tokens, variant);
111
116
 
112
- const getButtonTokens = buttonState => (0, _utils.selectTokens)('Button', getItemTokens(buttonState));
117
+ const getButtonTokens = buttonState => // Remove icon-text-related tokens, since we want to handle them ourselves, not use ButtonBase's handling
118
+ (0, _utils.selectTokens)('Button', selectNonIconTextTokens(getItemTokens(buttonState)));
113
119
 
114
120
  const {
115
121
  currentValues,
@@ -7,6 +7,8 @@ exports.default = void 0;
7
7
 
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
 
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
10
12
  var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
11
13
 
12
14
  var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
@@ -15,10 +17,10 @@ var _TextInput = _interopRequireDefault(require("react-native-web/dist/cjs/expor
15
17
 
16
18
  var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
17
19
 
18
- var _propTypes = _interopRequireDefault(require("prop-types"));
19
-
20
20
  var _ThemeProvider = require("../ThemeProvider");
21
21
 
22
+ var _StackView = _interopRequireDefault(require("../StackView"));
23
+
22
24
  var _utils = require("../utils");
23
25
 
24
26
  var _jsxRuntime = require("react/jsx-runtime");
@@ -133,35 +135,47 @@ const selectIconTokens = _ref3 => {
133
135
  };
134
136
  };
135
137
 
136
- const selectIconContainerStyles = _ref4 => {
138
+ const selectIconContainerStyles = (_ref4, buttonCount) => {
137
139
  let {
140
+ buttonSize,
141
+ buttonsGapSize,
138
142
  paddingRight,
139
143
  paddingBottom
140
144
  } = _ref4;
141
145
  return {
142
- paddingRight,
146
+ paddingRight: paddingRight + buttonCount * (buttonSize + buttonsGapSize),
143
147
  paddingBottom
144
148
  };
145
149
  };
146
150
 
147
- const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
151
+ const selectButtonsContainerStyle = _ref5 => {
148
152
  let {
149
- value,
153
+ buttonsPaddingRight
154
+ } = _ref5;
155
+ return {
156
+ paddingRight: buttonsPaddingRight
157
+ };
158
+ };
159
+
160
+ const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
161
+ let {
162
+ buttons = [],
150
163
  height,
151
- initialValue,
152
164
  inactive,
153
- readOnly,
165
+ initialValue,
166
+ onBlur,
154
167
  onChange,
155
168
  onChangeText,
156
169
  onFocus,
157
- onBlur,
158
- onMouseOver,
159
170
  onMouseOut,
171
+ onMouseOver,
160
172
  pattern,
173
+ readOnly,
161
174
  tokens,
175
+ value,
162
176
  variant = {},
163
177
  ...rest
164
- } = _ref5;
178
+ } = _ref6;
165
179
  const [isFocused, setIsFocused] = (0, _react.useState)(false);
166
180
 
167
181
  const handleFocus = event => {
@@ -220,7 +234,8 @@ const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
220
234
  };
221
235
  const themeTokens = (0, _ThemeProvider.useThemeTokens)('TextInput', tokens, variant, states);
222
236
  const {
223
- icon: IconComponent
237
+ icon: IconComponent,
238
+ buttonsGap
224
239
  } = themeTokens;
225
240
  const inputProps = { ...selectProps(rest),
226
241
  editable: !inactive,
@@ -233,7 +248,9 @@ const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
233
248
  // currentValue is being updated even if the input is not controlled, passing it down to the
234
249
  // Input could lead to changing its state from uncontrolled to controlled
235
250
  value: isControlled ? currentValue : undefined
236
- };
251
+ }; // Get the actual gap value for the current viewport
252
+
253
+ const buttonsGapSize = (0, _utils.useSpacingScale)(buttonsGap);
237
254
  const {
238
255
  themeOptions
239
256
  } = (0, _ThemeProvider.useTheme)();
@@ -249,32 +266,49 @@ const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
249
266
  }), IconComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
250
267
  pointerEvents: "none" // avoid hijacking input press events
251
268
  ,
252
- style: [staticStyles.iconContainer, selectIconContainerStyles(themeTokens)],
269
+ style: [staticStyles.iconContainer, selectIconContainerStyles({ ...themeTokens,
270
+ buttonsGapSize
271
+ }, buttons === null || buttons === void 0 ? void 0 : buttons.length)],
253
272
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, { ...selectIconTokens(themeTokens)
254
273
  })
274
+ }), (buttons === null || buttons === void 0 ? void 0 : buttons.length) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
275
+ style: [staticStyles.buttonsContainer, selectButtonsContainerStyle(themeTokens)],
276
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.default, {
277
+ direction: "row",
278
+ space: buttonsGap,
279
+ children: buttons
280
+ })
255
281
  })]
256
282
  });
257
283
  });
258
284
  TextInputBase.displayName = 'TextInputBase';
259
285
  TextInputBase.propTypes = { ...selectedSystemPropTypes,
260
- value: _propTypes.default.string,
286
+ buttons: _propTypes.default.arrayOf(_propTypes.default.node),
261
287
  height: _propTypes.default.number,
262
- initialValue: _propTypes.default.string,
263
288
  inactive: _propTypes.default.bool,
264
- readOnly: _propTypes.default.bool,
289
+ initialValue: _propTypes.default.string,
290
+ onBlur: _propTypes.default.func,
265
291
  onChange: _propTypes.default.func,
266
292
  onChangeText: _propTypes.default.func,
267
293
  onFocus: _propTypes.default.func,
268
- onBlur: _propTypes.default.func,
269
- onMouseOver: _propTypes.default.func,
270
294
  onMouseOut: _propTypes.default.func,
295
+ onMouseOver: _propTypes.default.func,
296
+ readOnly: _propTypes.default.bool,
271
297
  tokens: (0, _utils.getTokensPropType)('TextInput', 'TextArea'),
298
+ value: _propTypes.default.string,
272
299
  variant: _utils.variantProp.propType
273
300
  };
274
301
  var _default = TextInputBase;
275
302
  exports.default = _default;
276
303
 
277
304
  const staticStyles = _StyleSheet.default.create({
305
+ buttonsContainer: {
306
+ position: 'absolute',
307
+ right: 0,
308
+ top: 0,
309
+ bottom: 0,
310
+ justifyContent: 'center'
311
+ },
278
312
  iconContainer: {
279
313
  position: 'absolute',
280
314
  right: 0,
package/lib/index.js CHANGED
@@ -31,6 +31,7 @@ var _exportNames = {
31
31
  QuickLinks: true,
32
32
  Radio: true,
33
33
  RadioCard: true,
34
+ Responsive: true,
34
35
  Search: true,
35
36
  Select: true,
36
37
  SideNav: true,
@@ -241,6 +242,12 @@ Object.defineProperty(exports, "RadioCard", {
241
242
  return _RadioCard.default;
242
243
  }
243
244
  });
245
+ Object.defineProperty(exports, "Responsive", {
246
+ enumerable: true,
247
+ get: function () {
248
+ return _Responsive.default;
249
+ }
250
+ });
244
251
  Object.defineProperty(exports, "Search", {
245
252
  enumerable: true,
246
253
  get: function () {
@@ -546,6 +553,8 @@ Object.keys(_RadioCard).forEach(function (key) {
546
553
  });
547
554
  });
548
555
 
556
+ var _Responsive = _interopRequireDefault(require("./Responsive"));
557
+
549
558
  var _Search = _interopRequireDefault(require("./Search"));
550
559
 
551
560
  var _Select = _interopRequireDefault(require("./Select"));
@@ -139,7 +139,9 @@ const selectTextStyles = (_ref6, themeOptions) => {
139
139
  lineHeight,
140
140
  fontName,
141
141
  fontWeight,
142
- textAlign
142
+ textAlign,
143
+ textLine,
144
+ textLineStyle
143
145
  } = _ref6;
144
146
  return applyTextStyles({
145
147
  fontSize,
@@ -148,7 +150,9 @@ const selectTextStyles = (_ref6, themeOptions) => {
148
150
  fontName,
149
151
  fontWeight,
150
152
  themeOptions,
151
- textAlign
153
+ textAlign,
154
+ textDecorationLine: textLine,
155
+ textDecorationStyle: textLineStyle
152
156
  });
153
157
  };
154
158
 
@@ -127,6 +127,8 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
127
127
  */
128
128
 
129
129
  const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
130
+ var _systemProps$accessib;
131
+
130
132
  let {
131
133
  tokens,
132
134
  variant,
@@ -150,7 +152,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
150
152
  }) : /*#__PURE__*/_jsx(CarouselStepTracker, {}),
151
153
  tag = 'ul',
152
154
  accessibilityRole,
153
- accessibilityLabel = title,
155
+ accessibilityLabel,
154
156
  accessibilityLiveRegion = 'polite',
155
157
  copy,
156
158
  ...rest
@@ -396,6 +398,33 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
396
398
  const activePanelNavigation = tabs && showPanelTabs ? /*#__PURE__*/_jsx(CarouselTabsPanel, {
397
399
  items: tabs
398
400
  }) : panelNavigation;
401
+ const isFirstFocusContainer = Boolean(refocus && !skipLinkHref);
402
+
403
+ const containerRef = element => {
404
+ // Apply both firstFocusRef to the container
405
+ firstFocusRef.current = element; // Also apply forwarded ref if there is one (which could be a function ref)
406
+
407
+ if (ref) {
408
+ if (typeof ref === 'object') {
409
+ // eslint-disable-next-line no-param-reassign
410
+ ref.current = element;
411
+ } else if (typeof ref === 'function') {
412
+ ref(element);
413
+ }
414
+ }
415
+ }; // If container isn't used for focus, give it a label of title if none is passed in,
416
+ // otherwise read the current position on focus
417
+
418
+
419
+ const containerAccessibilityLabel = ((_systemProps$accessib = systemProps.accessibilityLabel) !== null && _systemProps$accessib !== void 0 ? _systemProps$accessib : isFirstFocusContainer) ? "".concat(title ? "".concat(title, " ") : '').concat(getCopyWithPlaceholders('stepTrackerLabel')) : title;
420
+ const containerProps = {
421
+ accessibilityLabel: containerAccessibilityLabel,
422
+ // If used for focus, attach the ref and draw a focus box around the whole carousel
423
+ ...(isFirstFocusContainer && {
424
+ ref: containerRef,
425
+ focusable: true
426
+ })
427
+ };
399
428
  return /*#__PURE__*/_jsxs(CarouselProvider, {
400
429
  activeIndex: activeIndex,
401
430
  goTo: goTo,
@@ -411,6 +440,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
411
440
  onLayout: onContainerLayout,
412
441
  ref: ref,
413
442
  ...systemProps,
443
+ ...containerProps,
414
444
  children: [showPreviousNextNavigation && /*#__PURE__*/_jsx(View, {
415
445
  style: selectPreviousNextNavigationButtonStyles(previousNextNavigationButtonWidth, previousNextNavigationPosition, spaceBetweenSlideAndPreviousNextNavigation, isFirstSlide, isLastSlide, true),
416
446
  testID: "previous-button-container",
@@ -425,12 +455,10 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
425
455
  ref: firstFocusRef,
426
456
  href: skipLinkHref,
427
457
  children: getCopyWithPlaceholders('skipLink')
428
- }), /*#__PURE__*/_jsx(A11yText // Read the current slide position to screen readers on slide.
458
+ }), !isFirstFocusContainer && /*#__PURE__*/_jsx(A11yText // Read the current slide position to screen readers on slide.
429
459
  // If it's set to refocus and doesn't have a SkipLink to focus to, focus this.
430
460
  , {
431
- ref: !skipLinkHref && refocus ? firstFocusRef : null,
432
461
  accessibilityLiveRegion: !skipLinkHref && refocus ? undefined : 'polite',
433
- focusable: !skipLinkHref && refocus,
434
462
  text: getCopyWithPlaceholders('stepTrackerLabel')
435
463
  }), /*#__PURE__*/_jsx(View, {
436
464
  style: selectContainerStyles(containerLayout.width),
@@ -25,16 +25,7 @@ const CarouselTabsPanel = /*#__PURE__*/forwardRef((_ref, ref) => {
25
25
  };
26
26
  const lastTabSelected = activeIndex === items.length - 1;
27
27
  return /*#__PURE__*/_jsxs(_Fragment, {
28
- children: [/*#__PURE__*/_jsx(View, {
29
- focusable: true,
30
- accessible: true,
31
- onFocus: event => {
32
- // When user forward-tabs into this section, focus the next tab; if they backwards-tab
33
- // (shift-tab) back into the carousel content, don't interfere.
34
- const previousWebFocus = event.relatedTarget;
35
- if (previousWebFocus !== firstTabRef.current) nextFocusRef.current.focus();
36
- }
37
- }), /*#__PURE__*/_jsx(StackView, {
28
+ children: [/*#__PURE__*/_jsx(StackView, {
38
29
  direction: "row",
39
30
  space: 3,
40
31
  divider: {
@@ -8,13 +8,15 @@ import { useViewport } from '../ViewportProvider';
8
8
  import { copyPropTypes, hrefAttrsProp, linkProps, selectTokens, withLinkRouter } from '../utils';
9
9
  import dictionary from './dictionary';
10
10
  import useCopy from '../utils/useCopy'; // We need to drop the icon here since it gets rendered via children and not
11
- // `ButtonBase` in order to tap into the state of the button
11
+ // `ButtonBase` in order to tap into the state of the button; `displayLabel` flag
12
+ // is also not needed
12
13
 
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
 
15
16
  const selectButtonTokens = _ref => {
16
17
  let {
17
18
  icon: _,
19
+ displayLabel: __,
18
20
  ...rest
19
21
  } = _ref;
20
22
  return selectTokens('Button', rest);
@@ -59,7 +61,8 @@ const SideButton = /*#__PURE__*/forwardRef((_ref3, ref) => {
59
61
  copy
60
62
  });
61
63
  const {
62
- icon
64
+ icon,
65
+ displayLabel
63
66
  } = getTokens(tokens, buttonVariant);
64
67
 
65
68
  const getButtonTokens = buttonState => selectButtonTokens(getTokens(buttonState));
@@ -67,7 +70,6 @@ const SideButton = /*#__PURE__*/forwardRef((_ref3, ref) => {
67
70
  const getIconTokens = buttonState => selectIconTokens(getTokens(buttonState), direction);
68
71
 
69
72
  const label = direction === 'previous' ? getCopy('previousText') : getCopy('nextText');
70
- const showLabel = viewport !== 'sm' && viewport !== 'xs';
71
73
  const accessibilityLabel = direction === 'previous' ? getCopy('previousLabel') : getCopy('nextLabel');
72
74
  const accessibilityRole = href !== undefined ? 'link' : 'button';
73
75
  const {
@@ -99,7 +101,7 @@ const SideButton = /*#__PURE__*/forwardRef((_ref3, ref) => {
99
101
  space: 1,
100
102
  iconPosition: directionToSide[direction],
101
103
  iconProps: iconProps,
102
- children: showLabel && /*#__PURE__*/_jsx(Text, {
104
+ children: displayLabel && /*#__PURE__*/_jsx(Text, {
103
105
  style: textStyles,
104
106
  children: label
105
107
  })
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { viewports } from '@telus-uds/system-constants';
4
+ import { useResponsiveProp } from '../utils';
5
+ /**
6
+ * Responsive conditionally renders children based on whether the viewport matches the provided
7
+ * min and max viewports.
8
+ *
9
+ * In SSR, like other viewport utilities, it treats the viewport as `xs` both in SSR itself and
10
+ * during first hydration on the client side; then if the viewport is not `xs`, it re-renders
11
+ * after hydration. This may cause a layout shift on devices other than the narrowest.
12
+ */
13
+
14
+ import { Fragment as _Fragment } from "react/jsx-runtime";
15
+ import { jsx as _jsx } from "react/jsx-runtime";
16
+
17
+ const Responsive = _ref => {
18
+ let {
19
+ min = 'xs',
20
+ max,
21
+ children
22
+ } = _ref;
23
+ // Start returning children at the 'min' viewport or greater
24
+ const byViewports = {
25
+ [min]: children
26
+ };
27
+
28
+ if (max && max !== 'xl') {
29
+ // Stop returning children at the viewport one above 'max' or greater
30
+ const maxIndex = viewports.keys.indexOf(max);
31
+ const maxPlusOne = maxIndex >= 0 ? viewports.keys[maxIndex + 1] : null;
32
+ if (maxPlusOne) byViewports[maxPlusOne] = null;
33
+ }
34
+
35
+ return /*#__PURE__*/_jsx(_Fragment, {
36
+ children: useResponsiveProp(byViewports, null)
37
+ });
38
+ };
39
+
40
+ Responsive.propTypes = {
41
+ min: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
42
+ max: PropTypes.oneOf(['sm', 'md', 'lg', 'xl']),
43
+ children: PropTypes.node.isRequired
44
+ };
45
+ export default Responsive;
@@ -0,0 +1,2 @@
1
+ import Responsive from './Responsive';
2
+ export default Responsive;