@telus-uds/components-base 1.8.1 → 1.8.4

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 (288) hide show
  1. package/CHANGELOG.md +35 -2
  2. package/component-docs.json +711 -669
  3. package/lib/A11yInfoProvider/index.js +4 -3
  4. package/lib/A11yText/index.js +6 -5
  5. package/lib/ActivityIndicator/Spinner.js +14 -13
  6. package/lib/ActivityIndicator/Spinner.native.js +10 -8
  7. package/lib/ActivityIndicator/index.js +6 -5
  8. package/lib/ActivityIndicator/shared.js +1 -1
  9. package/lib/BaseProvider/index.js +13 -10
  10. package/lib/Box/Box.js +20 -19
  11. package/lib/Button/Button.js +7 -6
  12. package/lib/Button/ButtonBase.js +97 -79
  13. package/lib/Button/ButtonGroup.js +34 -32
  14. package/lib/Button/ButtonLink.js +9 -7
  15. package/lib/Button/index.js +4 -4
  16. package/lib/Button/propTypes.js +1 -1
  17. package/lib/Card/Card.js +8 -7
  18. package/lib/Card/CardBase.js +35 -31
  19. package/lib/Card/PressableCardBase.js +14 -12
  20. package/lib/Checkbox/Checkbox.js +97 -83
  21. package/lib/Checkbox/CheckboxGroup.js +29 -27
  22. package/lib/Checkbox/CheckboxInput.js +12 -10
  23. package/lib/Divider/Divider.js +10 -9
  24. package/lib/ExpandCollapse/Control.js +42 -36
  25. package/lib/ExpandCollapse/ExpandCollapse.js +11 -10
  26. package/lib/ExpandCollapse/Panel.js +29 -40
  27. package/lib/Feedback/Feedback.js +48 -35
  28. package/lib/Fieldset/Fieldset.js +16 -15
  29. package/lib/Fieldset/FieldsetContainer.js +16 -13
  30. package/lib/Fieldset/FieldsetContainer.native.js +11 -8
  31. package/lib/Fieldset/Legend.js +10 -7
  32. package/lib/Fieldset/Legend.native.js +10 -7
  33. package/lib/FlexGrid/Col/Col.js +18 -17
  34. package/lib/FlexGrid/FlexGrid.js +15 -14
  35. package/lib/FlexGrid/Row/Row.js +13 -12
  36. package/lib/HorizontalScroll/HorizontalScroll.js +25 -20
  37. package/lib/HorizontalScroll/HorizontalScrollButton.js +18 -14
  38. package/lib/HorizontalScroll/ScrollViewEnd.js +6 -5
  39. package/lib/HorizontalScroll/ScrollViewEnd.native.js +12 -9
  40. package/lib/HorizontalScroll/itemPositions.js +19 -13
  41. package/lib/Icon/Icon.js +11 -10
  42. package/lib/Icon/IconText.js +8 -7
  43. package/lib/Icon/index.js +5 -5
  44. package/lib/IconButton/IconButton.js +50 -42
  45. package/lib/InputLabel/InputLabel.js +37 -30
  46. package/lib/InputLabel/LabelContent.js +12 -9
  47. package/lib/InputLabel/LabelContent.native.js +9 -6
  48. package/lib/InputSupports/InputSupports.js +11 -10
  49. package/lib/InputSupports/useInputSupports.js +7 -6
  50. package/lib/Link/ChevronLink.js +9 -8
  51. package/lib/Link/InlinePressable.js +13 -10
  52. package/lib/Link/InlinePressable.native.js +20 -16
  53. package/lib/Link/Link.js +10 -9
  54. package/lib/Link/LinkBase.js +96 -78
  55. package/lib/Link/TextButton.js +9 -8
  56. package/lib/List/List.js +20 -13
  57. package/lib/List/ListItem.js +103 -79
  58. package/lib/Modal/Modal.js +74 -60
  59. package/lib/Notification/Notification.js +46 -33
  60. package/lib/Pagination/PageButton.js +13 -12
  61. package/lib/Pagination/Pagination.js +43 -30
  62. package/lib/Pagination/SideButton.js +21 -18
  63. package/lib/Pagination/usePagination.js +7 -6
  64. package/lib/Progress/Progress.js +23 -19
  65. package/lib/Progress/ProgressBar.js +25 -21
  66. package/lib/Progress/ProgressBarBackground.js +7 -6
  67. package/lib/Radio/Radio.js +80 -69
  68. package/lib/Radio/RadioButton.js +63 -53
  69. package/lib/Radio/RadioGroup.js +30 -28
  70. package/lib/Radio/RadioInput.js +12 -10
  71. package/lib/RadioCard/RadioCard.js +16 -15
  72. package/lib/RadioCard/RadioCardGroup.js +30 -28
  73. package/lib/Search/Search.js +52 -32
  74. package/lib/Select/Group.js +5 -4
  75. package/lib/Select/Group.native.js +4 -3
  76. package/lib/Select/Item.js +10 -7
  77. package/lib/Select/Item.native.js +1 -9
  78. package/lib/Select/Picker.js +16 -15
  79. package/lib/Select/Picker.native.js +49 -38
  80. package/lib/Select/Select.js +134 -113
  81. package/lib/SideNav/Item.js +39 -33
  82. package/lib/SideNav/ItemContent.js +15 -12
  83. package/lib/SideNav/ItemsGroup.js +13 -11
  84. package/lib/SideNav/SideNav.js +21 -18
  85. package/lib/Skeleton/Skeleton.js +60 -44
  86. package/lib/Skeleton/skeleton.constant.js +1 -1
  87. package/lib/Skeleton/skeletonWebAnimation.js +1 -1
  88. package/lib/Spacer/Spacer.js +6 -5
  89. package/lib/StackView/StackView.js +12 -11
  90. package/lib/StackView/StackWrap.js +5 -3
  91. package/lib/StackView/StackWrapBox.js +12 -11
  92. package/lib/StackView/StackWrapGap.js +11 -10
  93. package/lib/StackView/common.js +14 -11
  94. package/lib/StackView/getStackedContent.js +10 -9
  95. package/lib/StackView/index.js +1 -1
  96. package/lib/StepTracker/Step.js +122 -103
  97. package/lib/StepTracker/StepTracker.js +48 -38
  98. package/lib/Tabs/Tabs.js +57 -27
  99. package/lib/Tabs/TabsItem.js +78 -68
  100. package/lib/Tags/Tags.js +68 -62
  101. package/lib/TextInput/TextArea.js +26 -20
  102. package/lib/TextInput/TextInput.js +20 -15
  103. package/lib/TextInput/TextInputBase.js +74 -62
  104. package/lib/TextInput/index.js +4 -4
  105. package/lib/ThemeProvider/ThemeProvider.js +6 -5
  106. package/lib/ThemeProvider/index.js +5 -5
  107. package/lib/ThemeProvider/useSetTheme.js +6 -3
  108. package/lib/ThemeProvider/useThemeTokens.js +7 -2
  109. package/lib/ThemeProvider/utils/styles.js +50 -43
  110. package/lib/ThemeProvider/utils/theme-tokens.js +33 -21
  111. package/lib/ToggleSwitch/ToggleSwitch.js +90 -74
  112. package/lib/ToggleSwitch/ToggleSwitchGroup.js +37 -35
  113. package/lib/Tooltip/Backdrop.js +6 -13
  114. package/lib/Tooltip/Backdrop.native.js +5 -4
  115. package/lib/Tooltip/Tooltip.js +81 -65
  116. package/lib/Tooltip/getTooltipPosition.js +29 -18
  117. package/lib/TooltipButton/TooltipButton.js +28 -21
  118. package/lib/Typography/Typography.js +37 -33
  119. package/lib/ViewportProvider/ViewportProvider.js +4 -3
  120. package/lib/ViewportProvider/useViewportListener.js +6 -3
  121. package/lib/index.js +54 -54
  122. package/lib/utils/a11y/semantics.js +5 -2
  123. package/lib/utils/a11y/textSize.js +8 -6
  124. package/lib/utils/animation/useVerticalExpandAnimation.js +46 -19
  125. package/lib/utils/children.js +4 -3
  126. package/lib/utils/index.js +10 -10
  127. package/lib/utils/input.js +28 -29
  128. package/lib/utils/pressability.js +36 -22
  129. package/lib/utils/props/clickProps.js +2 -1
  130. package/lib/utils/props/componentPropType.js +3 -3
  131. package/lib/utils/props/getPropSelector.js +6 -3
  132. package/lib/utils/props/handlerProps.js +25 -19
  133. package/lib/utils/props/hrefAttrsProp.js +14 -11
  134. package/lib/utils/props/index.js +12 -12
  135. package/lib/utils/props/inputSupportsProps.js +15 -12
  136. package/lib/utils/props/linkProps.js +7 -6
  137. package/lib/utils/props/pressProps.js +1 -1
  138. package/lib/utils/props/selectSystemProps.js +2 -2
  139. package/lib/utils/props/tokens.js +29 -15
  140. package/lib/utils/ssr.js +6 -2
  141. package/lib/utils/useCopy.js +6 -4
  142. package/lib/utils/useHash.js +2 -1
  143. package/lib/utils/useResponsiveProp.js +1 -1
  144. package/lib/utils/useSpacingScale.js +3 -1
  145. package/lib/utils/useUniqueId.js +3 -2
  146. package/lib/utils/withLinkRouter.js +6 -5
  147. package/lib-module/A11yInfoProvider/index.js +4 -3
  148. package/lib-module/A11yText/index.js +6 -5
  149. package/lib-module/ActivityIndicator/Spinner.js +14 -13
  150. package/lib-module/ActivityIndicator/Spinner.native.js +9 -8
  151. package/lib-module/ActivityIndicator/index.js +6 -5
  152. package/lib-module/BaseProvider/index.js +13 -10
  153. package/lib-module/Box/Box.js +20 -19
  154. package/lib-module/Button/Button.js +7 -6
  155. package/lib-module/Button/ButtonBase.js +96 -79
  156. package/lib-module/Button/ButtonGroup.js +34 -32
  157. package/lib-module/Button/ButtonLink.js +8 -7
  158. package/lib-module/Card/Card.js +8 -7
  159. package/lib-module/Card/CardBase.js +35 -31
  160. package/lib-module/Card/PressableCardBase.js +12 -11
  161. package/lib-module/Checkbox/Checkbox.js +97 -83
  162. package/lib-module/Checkbox/CheckboxGroup.js +29 -27
  163. package/lib-module/Checkbox/CheckboxInput.js +12 -10
  164. package/lib-module/Divider/Divider.js +10 -9
  165. package/lib-module/ExpandCollapse/Control.js +42 -36
  166. package/lib-module/ExpandCollapse/ExpandCollapse.js +11 -10
  167. package/lib-module/ExpandCollapse/Panel.js +29 -37
  168. package/lib-module/Feedback/Feedback.js +46 -33
  169. package/lib-module/Fieldset/Fieldset.js +16 -15
  170. package/lib-module/Fieldset/FieldsetContainer.js +16 -13
  171. package/lib-module/Fieldset/FieldsetContainer.native.js +11 -8
  172. package/lib-module/Fieldset/Legend.js +10 -7
  173. package/lib-module/Fieldset/Legend.native.js +10 -7
  174. package/lib-module/FlexGrid/Col/Col.js +18 -17
  175. package/lib-module/FlexGrid/FlexGrid.js +15 -14
  176. package/lib-module/FlexGrid/Row/Row.js +13 -12
  177. package/lib-module/HorizontalScroll/HorizontalScroll.js +24 -19
  178. package/lib-module/HorizontalScroll/HorizontalScrollButton.js +18 -14
  179. package/lib-module/HorizontalScroll/ScrollViewEnd.js +6 -5
  180. package/lib-module/HorizontalScroll/ScrollViewEnd.native.js +12 -9
  181. package/lib-module/HorizontalScroll/itemPositions.js +18 -12
  182. package/lib-module/Icon/Icon.js +10 -9
  183. package/lib-module/Icon/IconText.js +9 -7
  184. package/lib-module/IconButton/IconButton.js +48 -41
  185. package/lib-module/InputLabel/InputLabel.js +37 -30
  186. package/lib-module/InputLabel/LabelContent.js +12 -9
  187. package/lib-module/InputLabel/LabelContent.native.js +9 -6
  188. package/lib-module/InputSupports/InputSupports.js +11 -10
  189. package/lib-module/InputSupports/useInputSupports.js +7 -6
  190. package/lib-module/Link/ChevronLink.js +9 -8
  191. package/lib-module/Link/InlinePressable.js +13 -10
  192. package/lib-module/Link/InlinePressable.native.js +20 -16
  193. package/lib-module/Link/Link.js +10 -9
  194. package/lib-module/Link/LinkBase.js +94 -77
  195. package/lib-module/Link/TextButton.js +9 -8
  196. package/lib-module/List/List.js +20 -13
  197. package/lib-module/List/ListItem.js +103 -78
  198. package/lib-module/Modal/Modal.js +74 -60
  199. package/lib-module/Notification/Notification.js +46 -33
  200. package/lib-module/Pagination/PageButton.js +13 -12
  201. package/lib-module/Pagination/Pagination.js +43 -30
  202. package/lib-module/Pagination/SideButton.js +21 -18
  203. package/lib-module/Pagination/usePagination.js +7 -6
  204. package/lib-module/Progress/Progress.js +23 -19
  205. package/lib-module/Progress/ProgressBar.js +25 -21
  206. package/lib-module/Progress/ProgressBarBackground.js +7 -6
  207. package/lib-module/Radio/Radio.js +80 -69
  208. package/lib-module/Radio/RadioButton.js +62 -52
  209. package/lib-module/Radio/RadioGroup.js +30 -28
  210. package/lib-module/Radio/RadioInput.js +12 -10
  211. package/lib-module/RadioCard/RadioCard.js +16 -15
  212. package/lib-module/RadioCard/RadioCardGroup.js +30 -28
  213. package/lib-module/Search/Search.js +52 -32
  214. package/lib-module/Select/Group.js +5 -4
  215. package/lib-module/Select/Group.native.js +4 -3
  216. package/lib-module/Select/Item.js +10 -7
  217. package/lib-module/Select/Item.native.js +1 -7
  218. package/lib-module/Select/Picker.js +16 -15
  219. package/lib-module/Select/Picker.native.js +46 -36
  220. package/lib-module/Select/Select.js +134 -113
  221. package/lib-module/SideNav/Item.js +39 -33
  222. package/lib-module/SideNav/ItemContent.js +14 -11
  223. package/lib-module/SideNav/ItemsGroup.js +13 -11
  224. package/lib-module/SideNav/SideNav.js +21 -18
  225. package/lib-module/Skeleton/Skeleton.js +60 -44
  226. package/lib-module/Skeleton/skeletonWebAnimation.js +1 -1
  227. package/lib-module/Spacer/Spacer.js +6 -5
  228. package/lib-module/StackView/StackView.js +12 -11
  229. package/lib-module/StackView/StackWrap.js +5 -3
  230. package/lib-module/StackView/StackWrapBox.js +12 -11
  231. package/lib-module/StackView/StackWrapGap.js +11 -10
  232. package/lib-module/StackView/common.js +14 -11
  233. package/lib-module/StackView/getStackedContent.js +10 -9
  234. package/lib-module/StepTracker/Step.js +122 -103
  235. package/lib-module/StepTracker/StepTracker.js +48 -38
  236. package/lib-module/Tabs/Tabs.js +57 -27
  237. package/lib-module/Tabs/TabsItem.js +77 -68
  238. package/lib-module/Tags/Tags.js +68 -62
  239. package/lib-module/TextInput/TextArea.js +26 -20
  240. package/lib-module/TextInput/TextInput.js +19 -15
  241. package/lib-module/TextInput/TextInputBase.js +74 -62
  242. package/lib-module/ThemeProvider/ThemeProvider.js +5 -4
  243. package/lib-module/ThemeProvider/useSetTheme.js +6 -3
  244. package/lib-module/ThemeProvider/useThemeTokens.js +7 -2
  245. package/lib-module/ThemeProvider/utils/styles.js +48 -41
  246. package/lib-module/ThemeProvider/utils/theme-tokens.js +32 -20
  247. package/lib-module/ToggleSwitch/ToggleSwitch.js +90 -74
  248. package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +37 -35
  249. package/lib-module/Tooltip/Backdrop.js +6 -13
  250. package/lib-module/Tooltip/Backdrop.native.js +5 -4
  251. package/lib-module/Tooltip/Tooltip.js +81 -65
  252. package/lib-module/Tooltip/getTooltipPosition.js +29 -18
  253. package/lib-module/TooltipButton/TooltipButton.js +28 -21
  254. package/lib-module/Typography/Typography.js +35 -31
  255. package/lib-module/ViewportProvider/ViewportProvider.js +4 -3
  256. package/lib-module/ViewportProvider/useViewportListener.js +6 -3
  257. package/lib-module/utils/a11y/semantics.js +4 -1
  258. package/lib-module/utils/a11y/textSize.js +7 -5
  259. package/lib-module/utils/animation/useVerticalExpandAnimation.js +47 -20
  260. package/lib-module/utils/children.js +4 -3
  261. package/lib-module/utils/input.js +28 -29
  262. package/lib-module/utils/pressability.js +35 -21
  263. package/lib-module/utils/props/clickProps.js +2 -1
  264. package/lib-module/utils/props/componentPropType.js +3 -3
  265. package/lib-module/utils/props/getPropSelector.js +6 -3
  266. package/lib-module/utils/props/handlerProps.js +24 -18
  267. package/lib-module/utils/props/hrefAttrsProp.js +14 -11
  268. package/lib-module/utils/props/inputSupportsProps.js +15 -12
  269. package/lib-module/utils/props/linkProps.js +7 -6
  270. package/lib-module/utils/props/selectSystemProps.js +2 -2
  271. package/lib-module/utils/props/tokens.js +27 -14
  272. package/lib-module/utils/ssr.js +5 -2
  273. package/lib-module/utils/useCopy.js +6 -4
  274. package/lib-module/utils/useHash.js +2 -1
  275. package/lib-module/utils/useSpacingScale.js +3 -1
  276. package/lib-module/utils/useUniqueId.js +3 -2
  277. package/lib-module/utils/withLinkRouter.js +6 -5
  278. package/package.json +13 -11
  279. package/src/ExpandCollapse/Panel.jsx +2 -19
  280. package/src/List/List.jsx +34 -19
  281. package/src/List/ListItem.jsx +12 -2
  282. package/src/Modal/Modal.jsx +2 -1
  283. package/src/Pagination/Pagination.jsx +3 -0
  284. package/src/Search/Search.jsx +11 -0
  285. package/src/Select/Item.native.jsx +0 -7
  286. package/src/Tabs/Tabs.jsx +24 -2
  287. package/src/Tabs/TabsItem.jsx +6 -5
  288. package/src/utils/animation/useVerticalExpandAnimation.js +47 -13
@@ -52,17 +52,18 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
52
52
  * semantic role but only on web, not within native apps).
53
53
  */
54
54
 
55
- const StackView = /*#__PURE__*/forwardRef(({
56
- space = 1,
57
- divider,
58
- direction: directionProp = 'column',
59
- children,
60
- variant,
61
- tokens,
62
- tag,
63
- accessibilityRole,
64
- ...rest
65
- }, ref) => {
55
+ const StackView = /*#__PURE__*/forwardRef((_ref, ref) => {
56
+ let {
57
+ space = 1,
58
+ divider,
59
+ direction: directionProp = 'column',
60
+ children,
61
+ variant,
62
+ tokens,
63
+ tag,
64
+ accessibilityRole,
65
+ ...rest
66
+ } = _ref;
66
67
  const viewport = useViewport();
67
68
  const direction = useResponsiveProp(directionProp, 'column');
68
69
  const selectedProps = selectProps({ ...getA11yPropsFromHtmlTag(tag, accessibilityRole),
@@ -5,10 +5,10 @@ import StackWrapGap from './StackWrapGap'; // In Jest/CI/SSR, global CSS isn't a
5
5
 
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
 
8
- const cssSupports = (...args) => {
8
+ const cssSupports = function () {
9
9
  var _window$CSS;
10
10
 
11
- return typeof window !== 'undefined' && typeof ((_window$CSS = window.CSS) === null || _window$CSS === void 0 ? void 0 : _window$CSS.supports) === 'function' && window.CSS.supports(...args);
11
+ return typeof window !== 'undefined' && typeof ((_window$CSS = window.CSS) === null || _window$CSS === void 0 ? void 0 : _window$CSS.supports) === 'function' && window.CSS.supports(...arguments);
12
12
  }; // CSS.supports needs an example of the type of value you intend to use.
13
13
  // Will be an integer appended `px` after hooks and JSX styles are resolved.
14
14
 
@@ -23,11 +23,13 @@ const exampleGapValue = '1px';
23
23
  */
24
24
 
25
25
  const StackWrap = /*#__PURE__*/forwardRef((props, ref) => {
26
+ var _props$gap;
27
+
26
28
  const {
27
29
  space
28
30
  } = props; // Don't apply separate gap if `null` or `undefined`, so can be unset in Storybook etc
29
31
 
30
- const gap = props.gap ?? space;
32
+ const gap = (_props$gap = props.gap) !== null && _props$gap !== void 0 ? _props$gap : space;
31
33
  const canUseCSSGap = Platform.OS === 'web' && gap === space && cssSupports('gap', exampleGapValue);
32
34
  return canUseCSSGap ?
33
35
  /*#__PURE__*/
@@ -33,17 +33,18 @@ const spaceSides = {
33
33
  * between the container and the stacked children, and requires a negative margin on the container.
34
34
  */
35
35
 
36
- const StackWrapBox = /*#__PURE__*/forwardRef(({
37
- space = 1,
38
- gap = space,
39
- direction: directionProp = 'row',
40
- children,
41
- tokens,
42
- variant,
43
- tag,
44
- accessibilityRole,
45
- ...rest
46
- }, ref) => {
36
+ const StackWrapBox = /*#__PURE__*/forwardRef((_ref, ref) => {
37
+ let {
38
+ space = 1,
39
+ gap = space,
40
+ direction: directionProp = 'row',
41
+ children,
42
+ tokens,
43
+ variant,
44
+ tag,
45
+ accessibilityRole,
46
+ ...rest
47
+ } = _ref;
47
48
  const viewport = useViewport();
48
49
  const direction = useResponsiveProp(directionProp, 'row');
49
50
  const themeTokens = useThemeTokens('StackView', tokens, variant, {
@@ -19,16 +19,17 @@ const [selectProps] = selectSystemProps([a11yProps, viewProps]);
19
19
  * default if `gap` prop is undefined)
20
20
  */
21
21
 
22
- const StackWrapGap = /*#__PURE__*/forwardRef(({
23
- space = 1,
24
- tokens,
25
- variant,
26
- direction: directionProp = 'row',
27
- children,
28
- tag,
29
- accessibilityRole,
30
- ...rest
31
- }, ref) => {
22
+ const StackWrapGap = /*#__PURE__*/forwardRef((_ref, ref) => {
23
+ let {
24
+ space = 1,
25
+ tokens,
26
+ variant,
27
+ direction: directionProp = 'row',
28
+ children,
29
+ tag,
30
+ accessibilityRole,
31
+ ...rest
32
+ } = _ref;
32
33
  const viewport = useViewport();
33
34
  const direction = useResponsiveProp(directionProp, 'row');
34
35
  const themeTokens = useThemeTokens('StackView', tokens, variant, {
@@ -1,15 +1,18 @@
1
1
  import StyleSheet from "react-native-web/dist/exports/StyleSheet";
2
- export const selectFlexStyles = ({
3
- alignItems,
4
- justifyContent,
5
- flexGrow,
6
- flexShrink
7
- }) => ({
8
- alignItems,
9
- justifyContent,
10
- flexGrow,
11
- flexShrink
12
- });
2
+ export const selectFlexStyles = _ref => {
3
+ let {
4
+ alignItems,
5
+ justifyContent,
6
+ flexGrow,
7
+ flexShrink
8
+ } = _ref;
9
+ return {
10
+ alignItems,
11
+ justifyContent,
12
+ flexGrow,
13
+ flexShrink
14
+ };
15
+ };
13
16
  export const staticStyles = StyleSheet.create({
14
17
  wrap: {
15
18
  flexShrink: 1,
@@ -32,13 +32,14 @@ import Spacer from '../Spacer';
32
32
  import { createElement as _createElement } from "react";
33
33
  import { jsx as _jsx } from "react/jsx-runtime";
34
34
 
35
- const getStackedContent = (children, {
36
- divider,
37
- space,
38
- direction = 'column',
39
- box,
40
- preserveFragments = false
41
- }) => {
35
+ const getStackedContent = (children, _ref) => {
36
+ let {
37
+ divider,
38
+ space,
39
+ direction = 'column',
40
+ box,
41
+ preserveFragments = false
42
+ } = _ref;
42
43
  const boxProps = box && typeof box === 'object' ? box : {
43
44
  space
44
45
  };
@@ -47,7 +48,7 @@ const getStackedContent = (children, {
47
48
  const topLevelChildren = preserveFragments ? children : unpackFragment(children);
48
49
  const validChildren = Children.toArray(topLevelChildren).filter(Boolean);
49
50
  const content = validChildren.reduce((newChildren, child, index) => {
50
- const boxID = `Stack-Box-${index}`;
51
+ const boxID = "Stack-Box-".concat(index);
51
52
  const item = box ?
52
53
  /*#__PURE__*/
53
54
  // If wrapped in Box, that Box needs a key.
@@ -57,7 +58,7 @@ const getStackedContent = (children, {
57
58
  testID: boxID
58
59
  }, child) : child;
59
60
  if (!index || !space && !divider) return [...newChildren, item];
60
- const testID = `Stack-${divider ? 'Divider' : 'Spacer'}-${index}`;
61
+ const testID = "Stack-".concat(divider ? 'Divider' : 'Spacer', "-").concat(index);
61
62
  const commonProps = {
62
63
  testID,
63
64
  key: testID,
@@ -11,105 +11,123 @@ import { jsx as _jsx } from "react/jsx-runtime";
11
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
12
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
13
13
 
14
- const selectCompletedIconTokens = ({
15
- completedIconColor,
16
- completedIconSize
17
- }) => ({
18
- size: completedIconSize,
19
- color: completedIconColor
20
- });
14
+ const selectCompletedIconTokens = _ref => {
15
+ let {
16
+ completedIconColor,
17
+ completedIconSize
18
+ } = _ref;
19
+ return {
20
+ size: completedIconSize,
21
+ color: completedIconColor
22
+ };
23
+ };
21
24
 
22
- const selectConnectorStyles = ({
23
- connectorColor,
24
- connectorHeight,
25
- connectorMinWidth,
26
- connectorCompletedHeight,
27
- connectorCompletedColor
28
- }, isCompleted) => ({
29
- backgroundColor: connectorColor,
30
- height: connectorHeight,
31
- minWidth: connectorMinWidth,
32
- ...(isCompleted && {
33
- height: connectorCompletedHeight,
34
- backgroundColor: connectorCompletedColor
35
- })
36
- });
25
+ const selectConnectorStyles = (_ref2, isCompleted) => {
26
+ let {
27
+ connectorColor,
28
+ connectorHeight,
29
+ connectorMinWidth,
30
+ connectorCompletedHeight,
31
+ connectorCompletedColor
32
+ } = _ref2;
33
+ return {
34
+ backgroundColor: connectorColor,
35
+ height: connectorHeight,
36
+ minWidth: connectorMinWidth,
37
+ ...(isCompleted && {
38
+ height: connectorCompletedHeight,
39
+ backgroundColor: connectorCompletedColor
40
+ })
41
+ };
42
+ };
37
43
 
38
- const selectCurrentInnerStyles = ({
39
- knobCurrentInnerColor,
40
- knobCurrentInnerSize
41
- }) => ({
42
- backgroundColor: knobCurrentInnerColor,
43
- borderRadius: knobCurrentInnerSize / 2,
44
- height: knobCurrentInnerSize,
45
- width: knobCurrentInnerSize
46
- });
44
+ const selectCurrentInnerStyles = _ref3 => {
45
+ let {
46
+ knobCurrentInnerColor,
47
+ knobCurrentInnerSize
48
+ } = _ref3;
49
+ return {
50
+ backgroundColor: knobCurrentInnerColor,
51
+ borderRadius: knobCurrentInnerSize / 2,
52
+ height: knobCurrentInnerSize,
53
+ width: knobCurrentInnerSize
54
+ };
55
+ };
47
56
 
48
- const selectKnobStyles = ({
49
- knobBackgroundColor,
50
- knobBorderColor,
51
- knobBorderWidth,
52
- knobCompletedBackgroundColor,
53
- knobCompletedBorderColor,
54
- knobCompletedPaddingLeft,
55
- knobCompletedPaddingTop,
56
- knobCurrentBackgroundColor,
57
- knobCurrentBorderColor,
58
- knobCurrentBorderWidth,
59
- knobCurrentPaddingLeft,
60
- knobCurrentPaddingTop,
61
- knobSize
62
- }, isCompleted, isCurrent) => ({
63
- backgroundColor: knobBackgroundColor,
64
- borderColor: knobBorderColor,
65
- borderRadius: knobSize / 2,
66
- borderWidth: knobBorderWidth,
67
- height: knobSize,
68
- width: knobSize,
69
- ...(isCompleted && {
70
- backgroundColor: knobCompletedBackgroundColor,
71
- borderColor: knobCompletedBorderColor,
72
- paddingLeft: knobCompletedPaddingLeft,
73
- paddingTop: knobCompletedPaddingTop
74
- }),
75
- ...(isCurrent && {
76
- backgroundColor: knobCurrentBackgroundColor,
77
- borderColor: knobCurrentBorderColor,
78
- borderWidth: knobCurrentBorderWidth,
79
- paddingLeft: knobCurrentPaddingLeft,
80
- paddingTop: knobCurrentPaddingTop
81
- })
82
- });
57
+ const selectKnobStyles = (_ref4, isCompleted, isCurrent) => {
58
+ let {
59
+ knobBackgroundColor,
60
+ knobBorderColor,
61
+ knobBorderWidth,
62
+ knobCompletedBackgroundColor,
63
+ knobCompletedBorderColor,
64
+ knobCompletedPaddingLeft,
65
+ knobCompletedPaddingTop,
66
+ knobCurrentBackgroundColor,
67
+ knobCurrentBorderColor,
68
+ knobCurrentBorderWidth,
69
+ knobCurrentPaddingLeft,
70
+ knobCurrentPaddingTop,
71
+ knobSize
72
+ } = _ref4;
73
+ return {
74
+ backgroundColor: knobBackgroundColor,
75
+ borderColor: knobBorderColor,
76
+ borderRadius: knobSize / 2,
77
+ borderWidth: knobBorderWidth,
78
+ height: knobSize,
79
+ width: knobSize,
80
+ ...(isCompleted && {
81
+ backgroundColor: knobCompletedBackgroundColor,
82
+ borderColor: knobCompletedBorderColor,
83
+ paddingLeft: knobCompletedPaddingLeft,
84
+ paddingTop: knobCompletedPaddingTop
85
+ }),
86
+ ...(isCurrent && {
87
+ backgroundColor: knobCurrentBackgroundColor,
88
+ borderColor: knobCurrentBorderColor,
89
+ borderWidth: knobCurrentBorderWidth,
90
+ paddingLeft: knobCurrentPaddingLeft,
91
+ paddingTop: knobCurrentPaddingTop
92
+ })
93
+ };
94
+ };
83
95
 
84
- const selectLabelContainerStyles = ({
85
- labelDirection,
86
- labelGap,
87
- labelMarginTop,
88
- labelPaddingLeft,
89
- labelPaddingRight
90
- }) => ({
91
- marginTop: labelMarginTop,
92
- paddingLeft: labelPaddingLeft,
93
- paddingRight: labelPaddingRight,
94
- flexDirection: labelDirection,
95
- gap: labelGap
96
- });
96
+ const selectLabelContainerStyles = _ref5 => {
97
+ let {
98
+ labelDirection,
99
+ labelGap,
100
+ labelMarginTop,
101
+ labelPaddingLeft,
102
+ labelPaddingRight
103
+ } = _ref5;
104
+ return {
105
+ marginTop: labelMarginTop,
106
+ paddingLeft: labelPaddingLeft,
107
+ paddingRight: labelPaddingRight,
108
+ flexDirection: labelDirection,
109
+ gap: labelGap
110
+ };
111
+ };
97
112
 
98
- const selectLabelStyles = ({
99
- labelColor,
100
- labelCurrentColor,
101
- labelCurrentFontWeight,
102
- labelFontSize,
103
- labelFontWeight,
104
- labelFontName,
105
- labelLineHeight
106
- }, isCurrent) => applyTextStyles({
107
- color: isCurrent ? labelCurrentColor : labelColor,
108
- fontSize: labelFontSize,
109
- lineHeight: labelLineHeight,
110
- fontWeight: isCurrent ? labelCurrentFontWeight : labelFontWeight,
111
- fontName: labelFontName
112
- });
113
+ const selectLabelStyles = (_ref6, isCurrent) => {
114
+ let {
115
+ labelColor,
116
+ labelCurrentColor,
117
+ labelCurrentFontWeight,
118
+ labelFontSize,
119
+ labelFontWeight,
120
+ labelFontName,
121
+ labelLineHeight
122
+ } = _ref6;
123
+ return applyTextStyles({
124
+ color: isCurrent ? labelCurrentColor : labelColor,
125
+ fontSize: labelFontSize,
126
+ lineHeight: labelLineHeight,
127
+ fontWeight: isCurrent ? labelCurrentFontWeight : labelFontWeight,
128
+ fontName: labelFontName
129
+ });
130
+ };
113
131
 
114
132
  const getStepTestID = (isCompleted, isCurrent) => {
115
133
  let testID = 'StepTracker-Step';
@@ -127,15 +145,16 @@ const getStepTestID = (isCompleted, isCurrent) => {
127
145
  */
128
146
 
129
147
 
130
- const Step = ({
131
- label,
132
- name,
133
- status = 0,
134
- stepCount = 0,
135
- stepIndex = 0,
136
- tokens,
137
- ...rest
138
- }) => {
148
+ const Step = _ref7 => {
149
+ let {
150
+ label,
151
+ name,
152
+ status = 0,
153
+ stepCount = 0,
154
+ stepIndex = 0,
155
+ tokens,
156
+ ...rest
157
+ } = _ref7;
139
158
  const {
140
159
  completedIcon,
141
160
  showStepLabel,
@@ -14,37 +14,46 @@ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
15
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
16
16
 
17
- const selectContainerStyles = ({
18
- containerPaddingBottom,
19
- containerPaddingLeft,
20
- containerPaddingRight,
21
- containerPaddingTop
22
- }) => ({
23
- paddingBottom: containerPaddingBottom,
24
- paddingLeft: containerPaddingLeft,
25
- paddingRight: containerPaddingRight,
26
- paddingTop: containerPaddingTop
27
- });
17
+ const selectContainerStyles = _ref => {
18
+ let {
19
+ containerPaddingBottom,
20
+ containerPaddingLeft,
21
+ containerPaddingRight,
22
+ containerPaddingTop
23
+ } = _ref;
24
+ return {
25
+ paddingBottom: containerPaddingBottom,
26
+ paddingLeft: containerPaddingLeft,
27
+ paddingRight: containerPaddingRight,
28
+ paddingTop: containerPaddingTop
29
+ };
30
+ };
28
31
 
29
- const selectStepTrackerLabelContainerStyles = ({
30
- labelMarginTop
31
- }) => ({
32
- marginTop: labelMarginTop
33
- });
32
+ const selectStepTrackerLabelContainerStyles = _ref2 => {
33
+ let {
34
+ labelMarginTop
35
+ } = _ref2;
36
+ return {
37
+ marginTop: labelMarginTop
38
+ };
39
+ };
34
40
 
35
- const selectStepTrackerLabelStyles = ({
36
- labelColor,
37
- labelFontSize,
38
- labelFontWeight,
39
- labelFontName,
40
- labelLineHeight
41
- }) => applyTextStyles({
42
- color: labelColor,
43
- fontSize: labelFontSize,
44
- lineHeight: labelLineHeight,
45
- fontWeight: labelFontWeight,
46
- fontName: labelFontName
47
- });
41
+ const selectStepTrackerLabelStyles = _ref3 => {
42
+ let {
43
+ labelColor,
44
+ labelFontSize,
45
+ labelFontWeight,
46
+ labelFontName,
47
+ labelLineHeight
48
+ } = _ref3;
49
+ return applyTextStyles({
50
+ color: labelColor,
51
+ fontSize: labelFontSize,
52
+ lineHeight: labelLineHeight,
53
+ fontWeight: labelFontWeight,
54
+ fontName: labelFontName
55
+ });
56
+ };
48
57
  /**
49
58
  * StepTracker component shows the current position in a sequence of steps.
50
59
  *
@@ -79,15 +88,16 @@ const selectStepTrackerLabelStyles = ({
79
88
  */
80
89
 
81
90
 
82
- const StepTracker = /*#__PURE__*/forwardRef(({
83
- current = 0,
84
- copy = 'en',
85
- dictionary = defaultDictionary,
86
- steps = [],
87
- tokens,
88
- variant,
89
- ...rest
90
- }, ref) => {
91
+ const StepTracker = /*#__PURE__*/forwardRef((_ref4, ref) => {
92
+ let {
93
+ current = 0,
94
+ copy = 'en',
95
+ dictionary = defaultDictionary,
96
+ steps = [],
97
+ tokens,
98
+ variant,
99
+ ...rest
100
+ } = _ref4;
91
101
  const viewport = useViewport();
92
102
  const {
93
103
  showStepTrackerLabel,
@@ -12,24 +12,45 @@ const {
12
12
  selectHorizontalScrollTokens,
13
13
  useItemPositions
14
14
  } = horizontalScrollUtils;
15
+
16
+ const getDefaultTabItemAccessibilityRole = parentRole => {
17
+ switch (parentRole) {
18
+ case 'tablist':
19
+ return 'tab';
20
+
21
+ case 'navigation':
22
+ return 'link';
23
+
24
+ default:
25
+ return undefined;
26
+ }
27
+ };
15
28
  /**
16
29
  * Tabs renders a horizontally-scrolling menu of selectable buttons which may link
17
30
  * to a page or control what content is displayed on this page.
31
+ *
32
+ * If you are using Tabs to navigate to a new page (web-only) you should pass
33
+ * `navigation`as the `accessibilityRole` to te Tabs component, this will cause
34
+ * TabItems to default to a role of link and obtain aria-current behaviour.
18
35
  */
19
36
 
20
- const Tabs = /*#__PURE__*/forwardRef(({
21
- tokens,
22
- itemTokens,
23
- scrollButtonTokens,
24
- variant,
25
- value,
26
- initialValue,
27
- onChange,
28
- items = [],
29
- LinkRouter,
30
- linkRouterProps,
31
- ...rest
32
- }, ref) => {
37
+
38
+ const Tabs = /*#__PURE__*/forwardRef((_ref, ref) => {
39
+ var _restProps$accessibil;
40
+
41
+ let {
42
+ tokens,
43
+ itemTokens,
44
+ scrollButtonTokens,
45
+ variant,
46
+ value,
47
+ initialValue,
48
+ onChange,
49
+ items = [],
50
+ LinkRouter,
51
+ linkRouterProps,
52
+ ...rest
53
+ } = _ref;
33
54
  const {
34
55
  space,
35
56
  ...themeTokens
@@ -44,32 +65,40 @@ const Tabs = /*#__PURE__*/forwardRef(({
44
65
  });
45
66
  const [itemPositions, isPositioningReady] = useItemPositions();
46
67
  useHash(useCallback((hash, event) => {
47
- const hashItem = hash && items.find(({
48
- href
49
- }) => hash === href);
68
+ const hashItem = hash && items.find(_ref2 => {
69
+ let {
70
+ href
71
+ } = _ref2;
72
+ return hash === href;
73
+ });
50
74
  const hashId = hashItem && (hashItem.id || hashItem.label);
51
75
  if (hashId) setTimeout(setValue(hashId, event), 500);
52
76
  }, [items, setValue]), isPositioningReady);
77
+ const restProps = selectProps(rest);
78
+ const parentAccessibilityRole = (_restProps$accessibil = restProps.accessibilityRole) !== null && _restProps$accessibil !== void 0 ? _restProps$accessibil : 'tablist';
79
+ const defaultTabItemAccessibiltyRole = getDefaultTabItemAccessibilityRole(parentAccessibilityRole);
53
80
  return /*#__PURE__*/_jsx(HorizontalScroll, {
54
81
  ref: ref,
55
82
  ScrollButton: HorizontalScrollButton,
56
83
  itemPositions: itemPositions,
57
84
  tokens: selectHorizontalScrollTokens(themeTokens),
58
85
  scrollButtonTokens: scrollButtonTokens,
59
- accessibilityRole: "tablist",
60
- ...selectProps(rest),
86
+ accessibilityRole: parentAccessibilityRole,
87
+ ...restProps,
61
88
  children: /*#__PURE__*/_jsx(StackView, {
62
89
  space: space,
63
90
  direction: "row",
64
- children: items.map(({
65
- href,
66
- label,
67
- id,
68
- ref: itemRef,
69
- LinkRouter: ItemLinkRouter = LinkRouter,
70
- linkRouterProps: itemLinkRouterProps
71
- }, index) => {
72
- const itemId = id ?? label;
91
+ children: items.map((_ref3, index) => {
92
+ let {
93
+ href,
94
+ label,
95
+ id,
96
+ accessibilityRole = defaultTabItemAccessibiltyRole,
97
+ ref: itemRef,
98
+ LinkRouter: ItemLinkRouter = LinkRouter,
99
+ linkRouterProps: itemLinkRouterProps
100
+ } = _ref3;
101
+ const itemId = id !== null && id !== void 0 ? id : label;
73
102
  const isSelected = Boolean(currentValue && currentValue === itemId);
74
103
 
75
104
  const handlePress = event => setValue(itemId, event);
@@ -83,6 +112,7 @@ const Tabs = /*#__PURE__*/forwardRef(({
83
112
  selected: isSelected,
84
113
  itemPositions: itemPositions,
85
114
  index: index,
115
+ accessibilityRole: accessibilityRole,
86
116
  LinkRouter: ItemLinkRouter,
87
117
  linkRouterProps: { ...linkRouterProps,
88
118
  ...itemLinkRouterProps