@telus-uds/components-base 2.3.0 → 2.5.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 (102) hide show
  1. package/CHANGELOG.md +34 -2
  2. package/lib/A11yInfoProvider/index.js +2 -2
  3. package/lib/Autocomplete/Autocomplete.js +22 -32
  4. package/lib/Autocomplete/Suggestions.js +1 -1
  5. package/lib/BaseProvider/HydrationContext.js +1 -2
  6. package/lib/BaseProvider/index.js +1 -2
  7. package/lib/Button/ButtonDropdown.js +1 -1
  8. package/lib/Card/Card.js +12 -13
  9. package/lib/Card/CardBase.js +1 -1
  10. package/lib/Card/PressableCardBase.js +1 -1
  11. package/lib/CardGroup/CardGroup.js +3 -3
  12. package/lib/Carousel/Carousel.js +5 -6
  13. package/lib/Carousel/CarouselStepTracker/CarouselStepTracker.js +3 -0
  14. package/lib/Carousel/CarouselTabs/CarouselTabs.js +1 -2
  15. package/lib/Carousel/CarouselTabs/CarouselTabsPanel.js +1 -1
  16. package/lib/Carousel/CarouselTabs/CarouselTabsPanelItem.js +1 -1
  17. package/lib/Carousel/CarouselThumbnail.js +1 -1
  18. package/lib/Checkbox/Checkbox.js +1 -1
  19. package/lib/ColourToggle/ColourToggle.js +1 -1
  20. package/lib/ExpandCollapseMini/ExpandCollapseMini.js +77 -0
  21. package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +126 -0
  22. package/lib/ExpandCollapseMini/index.js +2 -0
  23. package/lib/Footnote/Footnote.js +4 -4
  24. package/lib/HorizontalScroll/HorizontalScroll.js +1 -2
  25. package/lib/Icon/Icon.js +1 -1
  26. package/lib/Icon/IconText.js +2 -3
  27. package/lib/IconButton/IconButton.js +1 -2
  28. package/lib/InputLabel/InputLabel.js +36 -2
  29. package/lib/InputSupports/InputSupports.js +31 -8
  30. package/lib/InputSupports/dictionary.js +12 -0
  31. package/lib/InputSupports/useInputSupports.js +12 -3
  32. package/lib/Link/LinkBase.js +25 -18
  33. package/lib/List/List.js +1 -2
  34. package/lib/List/ListItemContent.js +1 -1
  35. package/lib/Listbox/Listbox.js +5 -8
  36. package/lib/Listbox/PressableItem.js +4 -4
  37. package/lib/Modal/Modal.js +4 -7
  38. package/lib/MultiSelectFilter/MultiSelectFilter.js +55 -42
  39. package/lib/Notification/Notification.js +15 -13
  40. package/lib/OrderedList/OrderedList.js +2 -3
  41. package/lib/Pagination/usePagination.js +1 -2
  42. package/lib/PriceLockup/utils/renderFootnoteContent.js +2 -2
  43. package/lib/PriceLockup/utils/renderFootnoteLinks.js +2 -2
  44. package/lib/PriceLockup/utils/renderPrice.js +2 -2
  45. package/lib/ProductCard/ProductCard.js +2 -3
  46. package/lib/Progress/ProgressBarBackground.js +2 -2
  47. package/lib/QuickLinksFeature/QuickLinksFeature.js +1 -2
  48. package/lib/Radio/Radio.js +1 -1
  49. package/lib/Search/Search.js +41 -11
  50. package/lib/Select/Picker.js +2 -2
  51. package/lib/Select/Picker.native.js +8 -4
  52. package/lib/Select/constants.js +4 -2
  53. package/lib/StackView/StackWrap.js +1 -4
  54. package/lib/StackView/getStackedContent.js +1 -2
  55. package/lib/StepTracker/StepTracker.js +1 -2
  56. package/lib/TabBar/TabBar.js +1 -1
  57. package/lib/Tabs/Tabs.js +1 -1
  58. package/lib/Tabs/TabsItem.js +2 -2
  59. package/lib/TextInput/TextArea.js +7 -6
  60. package/lib/TextInput/TextInput.js +7 -6
  61. package/lib/TextInput/TextInputBase.js +57 -25
  62. package/lib/ThemeProvider/utils/theme-tokens.js +2 -4
  63. package/lib/Timeline/Timeline.js +1 -2
  64. package/lib/Tooltip/Tooltip.native.js +4 -4
  65. package/lib/Typography/Typography.js +4 -5
  66. package/lib/Validator/Validator.js +9 -14
  67. package/lib/ViewportProvider/useViewportListener.js +1 -1
  68. package/lib/index.js +1 -0
  69. package/lib/utils/children.js +2 -6
  70. package/lib/utils/input.js +1 -1
  71. package/lib/utils/props/componentPropType.js +1 -2
  72. package/lib/utils/props/inputSupportsProps.js +15 -3
  73. package/lib/utils/props/selectSystemProps.js +2 -2
  74. package/lib/utils/ssr-media-query/create-stylesheet/create-stylesheet-mobile.js +1 -1
  75. package/lib/utils/ssr-media-query/create-stylesheet/index.js +2 -3
  76. package/lib/utils/ssr-media-query/utils/inject.js +3 -5
  77. package/lib/utils/useHash.js +1 -4
  78. package/lib/utils/useOverlaidPosition.js +25 -4
  79. package/lib/utils/useScrollBlocking.js +2 -4
  80. package/lib/utils/useSpacingScale.js +2 -2
  81. package/package.json +2 -2
  82. package/src/Carousel/CarouselStepTracker/CarouselStepTracker.jsx +3 -0
  83. package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +76 -0
  84. package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +119 -0
  85. package/src/ExpandCollapseMini/index.js +3 -0
  86. package/src/InputLabel/InputLabel.jsx +39 -2
  87. package/src/InputSupports/InputSupports.jsx +33 -7
  88. package/src/InputSupports/dictionary.js +12 -0
  89. package/src/InputSupports/useInputSupports.js +24 -3
  90. package/src/Link/LinkBase.jsx +25 -18
  91. package/src/Modal/Modal.jsx +1 -1
  92. package/src/MultiSelectFilter/MultiSelectFilter.jsx +55 -27
  93. package/src/Notification/Notification.jsx +9 -3
  94. package/src/Search/Search.jsx +52 -24
  95. package/src/Select/Picker.native.jsx +10 -4
  96. package/src/Select/constants.js +4 -1
  97. package/src/TextInput/TextArea.jsx +12 -5
  98. package/src/TextInput/TextInput.jsx +13 -6
  99. package/src/TextInput/TextInputBase.jsx +57 -10
  100. package/src/index.js +1 -0
  101. package/src/utils/props/inputSupportsProps.js +15 -3
  102. package/src/utils/useOverlaidPosition.js +23 -0
@@ -25,30 +25,14 @@ const {
25
25
  Col,
26
26
  Row
27
27
  } = FlexGrid;
28
- const selectSubTitleTokens = _ref => {
29
- let {
30
- subtitleColor
31
- } = _ref;
32
- return {
33
- color: subtitleColor
34
- };
35
- };
36
- const selectDividerTokens = _ref2 => {
37
- let {
38
- dividerColor
39
- } = _ref2;
40
- return {
41
- color: dividerColor
42
- };
43
- };
44
- const selectHeaderTokens = _ref3 => {
28
+ const selectHeaderTokens = _ref => {
45
29
  let {
46
30
  contentMarginLeft,
47
31
  contentMarginRight,
48
32
  contentMarginTop,
49
33
  contentPaddingLeft,
50
34
  contentPaddingRight
51
- } = _ref3;
35
+ } = _ref;
52
36
  return {
53
37
  marginLeft: contentMarginLeft,
54
38
  marginRight: contentMarginRight,
@@ -58,14 +42,14 @@ const selectHeaderTokens = _ref3 => {
58
42
  flexGrow: 1
59
43
  };
60
44
  };
61
- const selectControlsTokens = _ref4 => {
45
+ const selectControlsTokens = _ref2 => {
62
46
  let {
63
47
  contentMarginBottom,
64
48
  contentMarginLeft,
65
49
  contentMarginRight,
66
50
  contentPaddingLeft,
67
51
  contentPaddingRight
68
- } = _ref4;
52
+ } = _ref2;
69
53
  return {
70
54
  marginBottom: contentMarginBottom,
71
55
  marginLeft: contentMarginLeft,
@@ -80,7 +64,7 @@ const selectContainerStyle = (windowHeight, windowWidth) => ({
80
64
  });
81
65
  const TOTAL_COLUMNS = 12;
82
66
  const MAX_ITEMS_THRESHOLD = 12;
83
- const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
67
+ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
84
68
  let {
85
69
  label,
86
70
  subtitle,
@@ -102,7 +86,7 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
102
86
  rowLimit = 12,
103
87
  dictionary = defaultDictionary,
104
88
  ...rest
105
- } = _ref5;
89
+ } = _ref3;
106
90
  const viewport = useViewport();
107
91
  const {
108
92
  currentValues,
@@ -117,23 +101,6 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
117
101
  const [isOpen, setIsOpen] = React.useState(false);
118
102
  const [checkedIds, setCheckedIds] = React.useState(currentValues ?? []);
119
103
  const [maxWidth, setMaxWidth] = React.useState(false);
120
- const themeTokens = useThemeTokens('ButtonDropdown', tokens, variant);
121
- const getItemTokens = useThemeTokensCallback('ButtonDropdown', tokens, variant);
122
- const getButtonTokens = buttonState => selectTokens('Button', getItemTokens(buttonState));
123
- const getCopy = useCopy({
124
- dictionary,
125
- copy
126
- });
127
- const colSizeNotMobile = items.length > rowLimit ? 2 : 1;
128
- const colSize = viewport !== 'xs' ? colSizeNotMobile : 1;
129
- const itemsLengthNotMobile = items.length > 24 ? items.length / 2 : rowLimit;
130
- const isSelected = currentValues.length > 0;
131
- const rowLength = viewport !== 'xs' ? itemsLengthNotMobile : items.length;
132
- React.useEffect(() => {
133
- if (colSize === 1) return setMaxWidth(false);
134
- return colSize === 2 && setMaxWidth(true);
135
- }, [colSize]);
136
- React.useEffect(() => setCheckedIds(currentValues ?? []), [currentValues]);
137
104
  const {
138
105
  headerFontColor,
139
106
  headerFontSize,
@@ -147,6 +114,20 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
147
114
  subHeaderLineHeight,
148
115
  minHeight,
149
116
  minWidth,
117
+ labelFontName,
118
+ labelFontSize,
119
+ labelFontWeight,
120
+ labelColor,
121
+ labelLineHeight,
122
+ labelPaddingTop,
123
+ labelPaddingBottom,
124
+ labelPaddingLeft,
125
+ labelPaddingRight,
126
+ buttonBorderColor,
127
+ buttonIconSize,
128
+ buttonIconPadding,
129
+ subtitleColor,
130
+ dividerColor,
150
131
  ...restTokens
151
132
  } = useThemeTokens('MultiSelectFilter', tokens, {
152
133
  ...variant,
@@ -155,6 +136,36 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
155
136
  }, {
156
137
  viewport
157
138
  });
139
+ const dropdownTokens = {
140
+ borderColor: buttonBorderColor,
141
+ iconSize: buttonIconSize,
142
+ iconPadding: buttonIconPadding,
143
+ lineHeight: labelLineHeight,
144
+ fontName: labelFontName,
145
+ fontSize: labelFontSize,
146
+ fontWeight: labelFontWeight,
147
+ color: labelColor,
148
+ paddingTop: labelPaddingTop,
149
+ paddingBottom: labelPaddingBottom,
150
+ paddingLeft: labelPaddingLeft,
151
+ paddingRight: labelPaddingRight
152
+ };
153
+ const getButtonDropdownTokens = useThemeTokensCallback('ButtonDropdown', dropdownTokens, variant);
154
+ const getButtonTokens = buttonState => selectTokens('ButtonDropdown', getButtonDropdownTokens(buttonState));
155
+ const getCopy = useCopy({
156
+ dictionary,
157
+ copy
158
+ });
159
+ const colSizeNotMobile = items.length > rowLimit ? 2 : 1;
160
+ const colSize = viewport !== 'xs' ? colSizeNotMobile : 1;
161
+ const itemsLengthNotMobile = items.length > 24 ? items.length / 2 : rowLimit;
162
+ const isSelected = currentValues.length > 0;
163
+ const rowLength = viewport !== 'xs' ? itemsLengthNotMobile : items.length;
164
+ React.useEffect(() => {
165
+ if (colSize === 1) return setMaxWidth(false);
166
+ return colSize === 2 && setMaxWidth(true);
167
+ }, [colSize]);
168
+ React.useEffect(() => setCheckedIds(currentValues ?? []), [currentValues]);
158
169
  const uniqueFields = ['id', 'label'];
159
170
  if (!containUniqueFields(items, uniqueFields)) {
160
171
  throw new Error(`MultiSelectFilter items must have unique ${uniqueFields.join(', ')}`);
@@ -166,7 +177,7 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
166
177
  currentValues
167
178
  }]);
168
179
  const handleChange = event => {
169
- if (pressHandlers.onPress) pressHandlers === null || pressHandlers === void 0 || pressHandlers.onPress(event);
180
+ if (pressHandlers.onPress) pressHandlers?.onPress(event);
170
181
  if (isOpen) onOpen();
171
182
  setIsOpen(!isOpen);
172
183
  };
@@ -213,7 +224,7 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
213
224
  const subeHeaderStyles = applyTextStyles({
214
225
  fontSize: subHeaderFontSize,
215
226
  fontWeight: subHeaderFontWeight,
216
- fontColor: selectSubTitleTokens(themeTokens)
227
+ fontColor: subtitleColor
217
228
  });
218
229
  const {
219
230
  overlaidPosition,
@@ -299,7 +310,9 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
299
310
  });
300
311
  const controlsContent = /*#__PURE__*/_jsxs(_Fragment, {
301
312
  children: [isScrolling ? /*#__PURE__*/_jsx(Divider, {
302
- tokens: selectDividerTokens(themeTokens),
313
+ tokens: {
314
+ color: dividerColor
315
+ },
303
316
  space: 4
304
317
  }) : /*#__PURE__*/_jsx(Spacer, {
305
318
  space: 4
@@ -66,11 +66,10 @@ const selectDismissButtonContainerStyles = _ref4 => {
66
66
  const selectContentContainerStyle = (themeTokens, maxWidth, viewport, system) => ({
67
67
  maxWidth: viewport === 'xl' && system === true ? maxWidth : 'auto',
68
68
  minWidth: viewport === 'xl' && system === true ? maxWidth : 'auto',
69
- paddingRight: themeTokens === null || themeTokens === void 0 ? void 0 : themeTokens.containerPaddingRight,
70
- paddingLeft: themeTokens === null || themeTokens === void 0 ? void 0 : themeTokens.containerPaddingLeft
69
+ paddingRight: themeTokens?.containerPaddingRight,
70
+ paddingLeft: themeTokens?.containerPaddingLeft
71
71
  });
72
72
  const getMediaQueryStyles = (themeTokens, themeOptions, mediaIdsRef, dismissible, viewport, system) => {
73
- var _themeOptions$content, _themeOptions$content2, _themeOptions$content3, _themeOptions$content4, _themeOptions$content5;
74
73
  const transformedSelectContainerStyles = Object.entries(themeTokens).reduce((acc, _ref5) => {
75
74
  let [vp, viewportTokens] = _ref5;
76
75
  acc[vp] = selectContainerStyles({
@@ -98,19 +97,19 @@ const getMediaQueryStyles = (themeTokens, themeOptions, mediaIdsRef, dismissible
98
97
  justifyContent: 'space-between',
99
98
  ...createMediaQueryStyles({
100
99
  xs: {
101
- maxWidth: (themeOptions === null || themeOptions === void 0 || (_themeOptions$content = themeOptions.contentMaxWidth) === null || _themeOptions$content === void 0 ? void 0 : _themeOptions$content.xs) || '100%'
100
+ maxWidth: themeOptions?.contentMaxWidth?.xs || '100%'
102
101
  },
103
102
  md: {
104
- maxWidth: (themeOptions === null || themeOptions === void 0 || (_themeOptions$content2 = themeOptions.contentMaxWidth) === null || _themeOptions$content2 === void 0 ? void 0 : _themeOptions$content2.md) || '100%'
103
+ maxWidth: themeOptions?.contentMaxWidth?.md || '100%'
105
104
  },
106
105
  lg: {
107
- maxWidth: (themeOptions === null || themeOptions === void 0 || (_themeOptions$content3 = themeOptions.contentMaxWidth) === null || _themeOptions$content3 === void 0 ? void 0 : _themeOptions$content3.lg) || '100%'
106
+ maxWidth: themeOptions?.contentMaxWidth?.lg || '100%'
108
107
  },
109
108
  sm: {
110
- maxWidth: (themeOptions === null || themeOptions === void 0 || (_themeOptions$content4 = themeOptions.contentMaxWidth) === null || _themeOptions$content4 === void 0 ? void 0 : _themeOptions$content4.sm) || '100%'
109
+ maxWidth: themeOptions?.contentMaxWidth?.sm || '100%'
111
110
  },
112
111
  xl: {
113
- maxWidth: (themeOptions === null || themeOptions === void 0 || (_themeOptions$content5 = themeOptions.contentMaxWidth) === null || _themeOptions$content5 === void 0 ? void 0 : _themeOptions$content5.xl) || '100%'
112
+ maxWidth: themeOptions?.contentMaxWidth?.xl || '100%'
114
113
  }
115
114
  })
116
115
  }
@@ -290,6 +289,9 @@ const Notification = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
290
289
  dictionary,
291
290
  copy
292
291
  });
292
+
293
+ // TODO: Remove this once the system style variant is deprecated
294
+ const isSystemEnabled = system || variant?.style?.includes('system');
293
295
  const {
294
296
  themeOptions
295
297
  } = useTheme();
@@ -298,10 +300,10 @@ const Notification = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
298
300
  } = themeOptions;
299
301
  const useTokens = enableMediaQueryStyleSheet ? useResponsiveThemeTokens : useThemeTokens;
300
302
  const themeTokens = useTokens('Notification', tokens, variant, {
301
- system,
303
+ system: isSystemEnabled,
302
304
  viewport
303
305
  });
304
- const maxWidth = useResponsiveProp(themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.contentMaxWidth);
306
+ const maxWidth = useResponsiveProp(themeOptions?.contentMaxWidth);
305
307
  const notificationComponentRef = React.useRef({
306
308
  containerStyles: {},
307
309
  contentContainerStyles: {},
@@ -323,9 +325,9 @@ const Notification = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
323
325
  selectDismissIconPropsIds: {}
324
326
  });
325
327
  if (enableMediaQueryStyleSheet) {
326
- notificationComponentRef.current = getMediaQueryStyles(themeTokens, themeOptions, mediaIdsRef, dismissible, viewport, system);
328
+ notificationComponentRef.current = getMediaQueryStyles(themeTokens, themeOptions, mediaIdsRef, dismissible, viewport, isSystemEnabled);
327
329
  } else {
328
- notificationComponentRef.current = getDefaultStyles(themeTokens, themeOptions, maxWidth, dismissible, viewport, system);
330
+ notificationComponentRef.current = getDefaultStyles(themeTokens, themeOptions, maxWidth, dismissible, viewport, isSystemEnabled);
329
331
  }
330
332
  if (isDismissed) {
331
333
  return null;
@@ -343,7 +345,7 @@ const Notification = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
343
345
  } = enableMediaQueryStyleSheet === false ? themeTokens : themeTokens[viewport];
344
346
  const onDismissPress = () => {
345
347
  setIsDismissed(true);
346
- onDismiss === null || onDismiss === void 0 || onDismiss();
348
+ onDismiss?.();
347
349
  };
348
350
  return /*#__PURE__*/_jsx(View, {
349
351
  ref: ref,
@@ -16,9 +16,8 @@ const OrderedList = /*#__PURE__*/React.forwardRef((_ref, ref) => {
16
16
  // Pass any variants and tokens "OrderedList" receives down to the individual list items.
17
17
  const childrenWithParentVariants = React.useMemo(() => {
18
18
  const addVariantAndTokensToProps = (child, i, isLastChild) => {
19
- var _child$props, _child$props2;
20
- const existingChildVariants = ((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.variant) ?? {};
21
- const existingChildTokens = ((_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.tokens) ?? {};
19
+ const existingChildVariants = child.props?.variant ?? {};
20
+ const existingChildTokens = child.props?.tokens ?? {};
22
21
  return /*#__PURE__*/React.cloneElement(child, {
23
22
  index: start + i,
24
23
  isLastChild,
@@ -16,14 +16,13 @@ function usePagination(_ref) {
16
16
  const activeItemIndex = Math.max(items.findIndex(item => item.props.isActive), 0 // default to the first item if none is marked as active
17
17
  );
18
18
  const getItemProps = index => {
19
- var _items$index;
20
19
  const {
21
20
  onPress,
22
21
  href,
23
22
  hrefAttrs,
24
23
  variant,
25
24
  tokens
26
- } = ((_items$index = items[index]) === null || _items$index === void 0 ? void 0 : _items$index.props) ?? {};
25
+ } = items[index]?.props ?? {};
27
26
  return {
28
27
  onPress,
29
28
  href,
@@ -42,13 +42,13 @@ const renderFootnoteContent = (footnoteMarginTop, bottomTextMarginTop, bottomTex
42
42
  bottomTextMarginTop
43
43
  }),
44
44
  children: [renderTypography(bottomText, bottomTextTypographyTokens, undefined, fontColor), ' ']
45
- }), (footnoteLinks === null || footnoteLinks === void 0 ? void 0 : footnoteLinks.length) <= MAX_FOOTNOTE_LINKS_ALLOWED ? /*#__PURE__*/_jsx(View, {
45
+ }), footnoteLinks?.length <= MAX_FOOTNOTE_LINKS_ALLOWED ? /*#__PURE__*/_jsx(View, {
46
46
  style: [staticStyles.footnoteLinkContainer, selectFootnoteLinksStyles({
47
47
  bottomLinksMarginLeft
48
48
  })],
49
49
  children: renderFootnoteLinks(footnoteLinks, themeTokens, onClickFootnote)
50
50
  }) : null]
51
- }), (footnoteLinks === null || footnoteLinks === void 0 ? void 0 : footnoteLinks.length) > MAX_FOOTNOTE_LINKS_ALLOWED ? /*#__PURE__*/_jsx(View, {
51
+ }), footnoteLinks?.length > MAX_FOOTNOTE_LINKS_ALLOWED ? /*#__PURE__*/_jsx(View, {
52
52
  style: staticStyles.verticalFootnoteLinkContainer,
53
53
  children: renderFootnoteLinks(footnoteLinks, themeTokens, onClickFootnote)
54
54
  }) : null]
@@ -11,7 +11,7 @@ const selectFootnoteLinkStyles = (_ref, footnoteLinks) => {
11
11
  } = _ref;
12
12
  // This is used to apply the proper line height when there is 4 or more footnote links
13
13
  const MAX_FOOTNOTE_LINKS_ALLOWED = 3;
14
- const lineHeight = (footnoteLinks === null || footnoteLinks === void 0 ? void 0 : footnoteLinks.length) > MAX_FOOTNOTE_LINKS_ALLOWED ? footnoteLinkFontSize * footnoteLinkLineHeight : undefined;
14
+ const lineHeight = footnoteLinks?.length > MAX_FOOTNOTE_LINKS_ALLOWED ? footnoteLinkFontSize * footnoteLinkLineHeight : undefined;
15
15
  return {
16
16
  color: footnoteLinkColor,
17
17
  fontName: footnoteLinkFontName,
@@ -20,7 +20,7 @@ const selectFootnoteLinkStyles = (_ref, footnoteLinks) => {
20
20
  fontSize: footnoteLinkFontSize
21
21
  };
22
22
  };
23
- const renderFootnoteLinks = (footnoteLinks, themeTokens, onClickFootnote) => (footnoteLinks === null || footnoteLinks === void 0 ? void 0 : footnoteLinks.length) > 0 ? /*#__PURE__*/_jsx(FootnoteLink, {
23
+ const renderFootnoteLinks = (footnoteLinks, themeTokens, onClickFootnote) => footnoteLinks?.length > 0 ? /*#__PURE__*/_jsx(FootnoteLink, {
24
24
  tokens: selectFootnoteLinkStyles(themeTokens, footnoteLinks),
25
25
  content: footnoteLinks,
26
26
  onClick: onClickFootnote
@@ -66,13 +66,13 @@ const renderPrice = (price, rateText, ratePosition, signDirection, currencySymbo
66
66
  }), rateText ? /*#__PURE__*/_jsx(Text, {
67
67
  style: ratePosition === 'bottom' ? staticStyles.rateTextVerticalPosition : [staticStyles.rateTextPosition, staticStyles.rateTextVerticalPosition],
68
68
  children: renderTypography(rateText, rateTypographyTokens, ratePosition, fontColor)
69
- }) : null, !bottomText && (footnoteLinks === null || footnoteLinks === void 0 ? void 0 : footnoteLinks.length) <= MAX_FOOTNOTE_LINKS_ALLOWED ? /*#__PURE__*/_jsx(Text, {
69
+ }) : null, !bottomText && footnoteLinks?.length <= MAX_FOOTNOTE_LINKS_ALLOWED ? /*#__PURE__*/_jsx(Text, {
70
70
  style: [footnoteLinkPositionStyles, selectFootnoteLinksStyles({
71
71
  bottomLinksMarginLeft
72
72
  })],
73
73
  children: renderFootnoteLinks(footnoteLinks, themeTokens, onClickFootnote)
74
74
  }) : null]
75
- }), !bottomText && (footnoteLinks === null || footnoteLinks === void 0 ? void 0 : footnoteLinks.length) > MAX_FOOTNOTE_LINKS_ALLOWED ? /*#__PURE__*/_jsx(View, {
75
+ }), !bottomText && footnoteLinks?.length > MAX_FOOTNOTE_LINKS_ALLOWED ? /*#__PURE__*/_jsx(View, {
76
76
  style: staticStyles.verticalFootnoteLinkContainer,
77
77
  children: renderFootnoteLinks(footnoteLinks, themeTokens, onClickFootnote)
78
78
  }) : null]
@@ -35,7 +35,6 @@ const selectProductCardTokens = _ref => {
35
35
  };
36
36
  };
37
37
  const ProductCard = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
38
- var _getCopy;
39
38
  let {
40
39
  copy = 'en',
41
40
  dictionary = defaultDictionary,
@@ -102,7 +101,7 @@ const ProductCard = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
102
101
  ...selectProps(rest),
103
102
  style: [selectProductCardTokens(themeTokens), staticStyles.container],
104
103
  ref: ref,
105
- children: [image !== null && image !== void 0 && image.src ? /*#__PURE__*/_jsx(View, {
104
+ children: [image?.src ? /*#__PURE__*/_jsx(View, {
106
105
  style: staticStyles.imageContainer,
107
106
  children: /*#__PURE__*/_jsx(Image, {
108
107
  source: image.src,
@@ -146,7 +145,7 @@ const ProductCard = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
146
145
  ...getCopy('primaryPrice'),
147
146
  size: "small",
148
147
  ratePosition: "bottom"
149
- }), (_getCopy = getCopy('secondaryPrice')) !== null && _getCopy !== void 0 && _getCopy.price ? /*#__PURE__*/_jsx(PriceLockup, {
148
+ }), getCopy('secondaryPrice')?.price ? /*#__PURE__*/_jsx(PriceLockup, {
150
149
  ...getCopy('secondaryPrice'),
151
150
  size: "small",
152
151
  ratePosition: "bottom"
@@ -12,9 +12,9 @@ const ProgressBarBackground = /*#__PURE__*/React.forwardRef((_ref, ref) => {
12
12
  } = _ref;
13
13
  let source = null;
14
14
  // TODO: Remove the `variant?.inactive` & `variant?.negative` to complete the deprecation
15
- if (variant !== null && variant !== void 0 && variant.inactive || (variant === null || variant === void 0 ? void 0 : variant.style) === INACTIVE_VARIANT) {
15
+ if (variant?.inactive || variant?.style === INACTIVE_VARIANT) {
16
16
  source = inactiveBackground;
17
- } else if (variant !== null && variant !== void 0 && variant.negative || (variant === null || variant === void 0 ? void 0 : variant.style) === NEGATIVE_VARIANT) {
17
+ } else if (variant?.negative || variant?.style === NEGATIVE_VARIANT) {
18
18
  source = negativeBackground;
19
19
  } else {
20
20
  return null;
@@ -9,8 +9,7 @@ import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
11
11
  const isQuickListItem = element => {
12
- var _element$type, _element$type2;
13
- const elementName = (element === null || element === void 0 || (_element$type = element.type) === null || _element$type === void 0 ? void 0 : _element$type.displayName) || (element === null || element === void 0 || (_element$type2 = element.type) === null || _element$type2 === void 0 ? void 0 : _element$type2.name);
12
+ const elementName = element?.type?.displayName || element?.type?.name;
14
13
  return Boolean(elementName.match(/QuickLinksFeatureItem/));
15
14
  };
16
15
 
@@ -145,7 +145,7 @@ const Radio = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
145
145
  };
146
146
  const handleKeyDown = event => {
147
147
  // The expected keyboard shortcut for activating a radio is the Space key
148
- if ((event === null || event === void 0 ? void 0 : event.key) === ' ') handleChange(event);
148
+ if (event?.key === ' ') handleChange(event);
149
149
  };
150
150
  const uniqueId = useUniqueId('radio');
151
151
  const inputId = id ?? uniqueId;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import View from "react-native-web/dist/exports/View";
3
+ import Platform from "react-native-web/dist/exports/Platform";
3
4
  import PropTypes from 'prop-types';
4
5
  import { useThemeTokens, useThemeTokensCallback } from '../ThemeProvider';
5
6
  import { a11yProps, getTokensPropType, selectSystemProps, selectTokens, useInputValue, useSpacingScale, textInputHandlerProps, textInputProps, variantProp, viewProps, contentfulProps } from '../utils';
@@ -7,6 +8,7 @@ import TextInputBase from '../TextInput/TextInputBase';
7
8
  import ButtonBase from '../Button/ButtonBase';
8
9
  import useCopy from '../utils/useCopy';
9
10
  import dictionary from './dictionary';
11
+ import Icon from '../Icon';
10
12
  import { jsx as _jsx } from "react/jsx-runtime";
11
13
  const [selectContainerProps, selectedContainerPropTypes] = selectSystemProps([a11yProps, viewProps, contentfulProps]);
12
14
  const [selectInputProps, selectedInputPropTypes] = selectSystemProps([textInputHandlerProps, textInputProps]);
@@ -33,7 +35,7 @@ const selectInputTokens = _ref => {
33
35
  paddingRight: paddingWithButtons
34
36
  };
35
37
  };
36
- const selectButtonTokens = tokens => selectTokens('Button', tokens);
38
+ const selectButtonTokens = tokens => selectTokens('SearchButton', tokens);
37
39
  const selectIconTokens = _ref2 => {
38
40
  let {
39
41
  iconSize,
@@ -44,6 +46,26 @@ const selectIconTokens = _ref2 => {
44
46
  size: iconSize
45
47
  };
46
48
  };
49
+ const selectBorderTokens = _ref3 => {
50
+ let {
51
+ borderWidth,
52
+ mobileBorderWidth,
53
+ ...tokens
54
+ } = _ref3;
55
+ return {
56
+ borderWidth: Platform.OS === 'web' ? borderWidth : mobileBorderWidth,
57
+ ...tokens
58
+ };
59
+ };
60
+ const modifyButtonTokens = tokens => {
61
+ const modifiedTokens = {
62
+ ...tokens
63
+ };
64
+ if (Platform.OS !== 'web') {
65
+ modifiedTokens.backgroundColor = tokens.mobileBackgroundColor;
66
+ }
67
+ return modifiedTokens;
68
+ };
47
69
 
48
70
  /**
49
71
  * The `Search` component is a combination of a `TextInput` and 2 different kinds of custom buttons.
@@ -58,7 +80,7 @@ const selectIconTokens = _ref2 => {
58
80
  * Use the following props to supply additional accessibility labels for the input - `accessibilityLabel`,
59
81
  * clear button - `clearButtonAccessibilityLabel`, and submit button - `submitButtonAccessibilityLabel`.
60
82
  */
61
- const Search = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
83
+ const Search = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
62
84
  let {
63
85
  initialValue,
64
86
  value,
@@ -73,9 +95,10 @@ const Search = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
73
95
  tokens,
74
96
  variant,
75
97
  nativeSubmitBtnID,
98
+ searchIconPosition = 'right',
76
99
  dataSet,
77
100
  ...rest
78
- } = _ref3;
101
+ } = _ref4;
79
102
  const {
80
103
  currentValue = '',
81
104
  setValue
@@ -112,10 +135,9 @@ const Search = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
112
135
  }
113
136
  };
114
137
  const handleClear = event => {
115
- var _ref$current;
116
138
  setValue('', event);
117
- onClear === null || onClear === void 0 || onClear('', event);
118
- ref === null || ref === void 0 || (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.focus();
139
+ onClear?.('', event);
140
+ ref?.current?.focus();
119
141
  };
120
142
  const handleFocus = event => {
121
143
  if (onFocus !== undefined) onFocus(event);
@@ -139,8 +161,8 @@ const Search = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
139
161
  testID: testID,
140
162
  ...selectInputProps(rest),
141
163
  ref: ref,
142
- tokens: appearances => selectInputTokens({
143
- searchTokens: getThemeTokens(appearances),
164
+ tokens: pressableStates => selectInputTokens({
165
+ searchTokens: selectBorderTokens(getThemeTokens(pressableStates)),
144
166
  buttonTokens,
145
167
  buttonsGapSize,
146
168
  isEmpty
@@ -155,16 +177,17 @@ const Search = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
155
177
  onSubmitEditing: handleSubmit,
156
178
  onFocus: handleFocus,
157
179
  accessibilityLabel: a11yLabelText,
180
+ direction: searchIconPosition,
158
181
  buttons: [ClearButtonIcon && !isEmpty && /*#__PURE__*/_jsx(ButtonBase, {
159
182
  accessibilityLabel: getCopy('clearButtonAccessibilityLabel'),
160
183
  accessibilityRole: "button",
161
184
  inactive: inactive,
162
185
  onPress: handleClear,
163
- tokens: appearances => selectButtonTokens(getButtonTokens(appearances)),
186
+ tokens: pressableStates => modifyButtonTokens(selectButtonTokens(getButtonTokens(pressableStates))),
164
187
  children: buttonState => /*#__PURE__*/_jsx(ClearButtonIcon, {
165
188
  ...selectIconTokens(getButtonTokens(buttonState))
166
189
  })
167
- }, "clear"), SubmitButtonIcon && /*#__PURE__*/_jsx(ButtonBase, {
190
+ }, "clear"), SubmitButtonIcon && (searchIconPosition === 'right' ? /*#__PURE__*/_jsx(ButtonBase, {
168
191
  accessibilityLabel: getCopy('submitButtonAccessibilityLabel'),
169
192
  accessibilityRole: "button",
170
193
  inactive: inactive,
@@ -180,7 +203,14 @@ const Search = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
180
203
  priority: 'high'
181
204
  }))
182
205
  })
183
- }, "submit")]
206
+ }, "submit-right") : /*#__PURE__*/_jsx(Icon, {
207
+ icon: SubmitButtonIcon,
208
+ testID: "iconLeft",
209
+ tokens: {
210
+ color: themeTokens.iconLeftColor,
211
+ size: themeTokens.iconLeftSize
212
+ }
213
+ }, "submitIcon"))]
184
214
  })
185
215
  });
186
216
  });
@@ -39,8 +39,8 @@ const Picker = /*#__PURE__*/React.forwardRef((_ref, ref) => {
39
39
  style: style,
40
40
  onMouseOver: onMouseOver,
41
41
  onMouseOut: () => {
42
- onMouseOut === null || onMouseOut === void 0 || onMouseOut();
43
- onClose === null || onClose === void 0 || onClose();
42
+ onMouseOut?.();
43
+ onClose?.();
44
44
  },
45
45
  onFocus: onFocus,
46
46
  onBlur: onBlur,
@@ -5,7 +5,7 @@ import Platform from "react-native-web/dist/exports/Platform";
5
5
  import NativePicker from 'react-native-picker-select';
6
6
  import { a11yProps, componentPropType } from '../utils';
7
7
  import Group from './Group';
8
- import { ANDROID_HEIGHT_OFFSET, ANDROID_HORIZONTAL_PADDING_OFFSET, ANDROID_DEFAULT_PADDING } from './constants';
8
+ import { ANDROID_HORIZONTAL_PADDING_OFFSET, ANDROID_DEFAULT_PADDING, ALLOW_FONT_SCALING, ADJUSTS_FONT_SIZE_TO_FIT, MAX_FONT_SIZE_MULTIPLIER } from './constants';
9
9
 
10
10
  // Styling of the native input is very limited, most of the styles have to be applied to an additional View
11
11
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
@@ -34,8 +34,7 @@ const selectAndroidContainerStyles = _ref2 => {
34
34
  paddingLeft: paddingLeft > ANDROID_HORIZONTAL_PADDING_OFFSET ? paddingLeft - ANDROID_HORIZONTAL_PADDING_OFFSET : ANDROID_DEFAULT_PADDING,
35
35
  paddingRight: paddingRight > ANDROID_HORIZONTAL_PADDING_OFFSET ? paddingRight - ANDROID_HORIZONTAL_PADDING_OFFSET : ANDROID_DEFAULT_PADDING,
36
36
  paddingBottom: ANDROID_DEFAULT_PADDING,
37
- paddingTop: ANDROID_DEFAULT_PADDING,
38
- height: rest.height + ANDROID_HEIGHT_OFFSET
37
+ paddingTop: ANDROID_DEFAULT_PADDING
39
38
  };
40
39
  };
41
40
  const Picker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
@@ -94,7 +93,12 @@ const Picker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
94
93
  inputIOS: style,
95
94
  inputAndroid: selectAndroidInputStyles(style)
96
95
  },
97
- placeholder: placeholder !== undefined ? placeholder : {}
96
+ placeholder: placeholder !== undefined ? placeholder : {},
97
+ textInputProps: {
98
+ allowFontScaling: ALLOW_FONT_SCALING,
99
+ adjustFontSizeToFit: ADJUSTS_FONT_SIZE_TO_FIT,
100
+ maxFontSizeMultiplier: MAX_FONT_SIZE_MULTIPLIER
101
+ }
98
102
  });
99
103
  return /*#__PURE__*/_jsx(_Fragment, {
100
104
  children: Platform.OS === 'android' ? /*#__PURE__*/_jsx(View, {
@@ -1,5 +1,7 @@
1
1
  // Because Android
2
2
  export const ANDROID_VALIDATION_ICON_CONTAINER_OFFSET = 5;
3
- export const ANDROID_HEIGHT_OFFSET = 12;
4
3
  export const ANDROID_HORIZONTAL_PADDING_OFFSET = 8;
5
- export const ANDROID_DEFAULT_PADDING = 0;
4
+ export const ANDROID_DEFAULT_PADDING = 0;
5
+ export const ALLOW_FONT_SCALING = true;
6
+ export const ADJUSTS_FONT_SIZE_TO_FIT = true;
7
+ export const MAX_FONT_SIZE_MULTIPLIER = 3;
@@ -6,10 +6,7 @@ import StackWrapGap from './StackWrapGap';
6
6
 
7
7
  // In Jest/CI/SSR, global CSS isn't always available and doesn't always have .supports method
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
- const cssSupports = (property, value) => {
10
- var _window$CSS;
11
- return Platform.OS === 'web' && typeof window !== 'undefined' && typeof ((_window$CSS = window.CSS) === null || _window$CSS === void 0 ? void 0 : _window$CSS.supports) === 'function' && window.CSS.supports(property, value);
12
- };
9
+ const cssSupports = (property, value) => Platform.OS === 'web' && typeof window !== 'undefined' && typeof window.CSS?.supports === 'function' && window.CSS.supports(property, value);
13
10
 
14
11
  // CSS.supports needs an example of the type of value you intend to use.
15
12
  // Will be an integer appended `px` after hooks and JSX styles are resolved.
@@ -109,12 +109,11 @@ const getStackedContent = (children, _ref) => {
109
109
  * @returns {ReactChildren}
110
110
  */
111
111
  const unpackFragment = child => {
112
- var _child$props;
113
112
  // If this level is a set of top-level siblings rather than one child, check each in turn
114
113
  if (React.Children.count(child) > 1) return React.Children.map(child, unpackFragment);
115
114
 
116
115
  // When a fragment is found, unpack its children to the top level and check them
117
- if ((child === null || child === void 0 ? void 0 : child.type) === React.Fragment) return unpackFragment((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.children);
116
+ if (child?.type === React.Fragment) return unpackFragment(child.props?.children);
118
117
 
119
118
  // Stop unpacking as soon as any non-fragment child is found
120
119
  return child;
@@ -112,8 +112,7 @@ const StepTracker = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
112
112
  const stepTrackerLabel = showStepTrackerLabel ? (typeof copy === 'string' ? getCopy(textStepTrackerLabel ?? 1).stepTrackerLabel : getCopy('stepTrackerLabel')).replace('%{stepNumber}', current < steps.length ? current + 1 : steps.length).replace('%{stepCount}', steps.length).replace('%{stepLabel}', current < steps.length ? steps[current] : steps[steps.length - 1]) : getCopy('stepTrackerLabel');
113
113
  const getStepLabel = index => {
114
114
  if (themeTokens.showStepLabel) {
115
- var _getCopy;
116
- return (_getCopy = getCopy(index + 1)) === null || _getCopy === void 0 ? void 0 : _getCopy.stepLabel.replace('%{stepNumber}', index + 1);
115
+ return getCopy(index + 1)?.stepLabel.replace('%{stepNumber}', index + 1);
117
116
  }
118
117
  return '';
119
118
  };
@@ -68,7 +68,7 @@ const TabBar = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
68
68
  const themeTokens = useThemeTokens('TabBar', tokens, variant);
69
69
  const handlePress = itemId => {
70
70
  setIsSelected(itemId);
71
- onChange === null || onChange === void 0 || onChange(itemId);
71
+ onChange?.(itemId);
72
72
  };
73
73
  return /*#__PURE__*/_jsx(View, {
74
74
  ref: ref,
package/lib/Tabs/Tabs.js CHANGED
@@ -25,7 +25,7 @@ const getDefaultTabItemAccessibilityRole = parentRole => {
25
25
  }
26
26
  };
27
27
  const getStackViewTokens = variant => {
28
- const equalWidth = variant === null || variant === void 0 ? void 0 : variant.equalWidth;
28
+ const equalWidth = variant?.equalWidth;
29
29
  return Platform.select({
30
30
  web: {
31
31
  justifyContent: equalWidth ? 'space-evenly' : 'flex-start',