@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
@@ -17,56 +17,65 @@ const {
17
17
  getItemPositionLayoutHandler
18
18
  } = horizontalScrollUtils;
19
19
 
20
- const selectHighlightBarStyles = ({
21
- highlightColor,
22
- highlightBarBorderRadius = 0,
23
- highlightBarBorderWidth = 0,
24
- highlightBarHeight = 0
25
- }) => ({
26
- backgroundColor: highlightColor,
27
- borderColor: highlightColor,
28
- height: highlightBarHeight + highlightBarBorderWidth * 2,
29
- borderRadius: highlightBarBorderRadius,
30
- borderWidth: highlightBarBorderWidth,
31
- bottom: -1 * (highlightBarHeight + highlightBarBorderWidth),
32
- left: -1 * highlightBarBorderWidth,
33
- right: -1 * highlightBarBorderWidth,
34
- zIndex: 1 + highlightBarBorderWidth
35
- });
20
+ const selectHighlightBarStyles = _ref => {
21
+ let {
22
+ highlightColor,
23
+ highlightBarBorderRadius = 0,
24
+ highlightBarBorderWidth = 0,
25
+ highlightBarHeight = 0
26
+ } = _ref;
27
+ return {
28
+ backgroundColor: highlightColor,
29
+ borderColor: highlightColor,
30
+ height: highlightBarHeight + highlightBarBorderWidth * 2,
31
+ borderRadius: highlightBarBorderRadius,
32
+ borderWidth: highlightBarBorderWidth,
33
+ bottom: -1 * (highlightBarHeight + highlightBarBorderWidth),
34
+ left: -1 * highlightBarBorderWidth,
35
+ right: -1 * highlightBarBorderWidth,
36
+ zIndex: 1 + highlightBarBorderWidth
37
+ };
38
+ };
36
39
 
37
- const selectHighlightTriangleStyles = ({
38
- highlightColor,
39
- highlightTriangleSize
40
- }) => ({
41
- container: {
42
- bottom: 0 - highlightTriangleSize * 2
43
- },
44
- triangle: {
45
- height: 0,
46
- width: 0,
47
- borderWidth: highlightTriangleSize,
48
- borderTopColor: highlightColor,
49
- borderBottomColor: 'transparent',
50
- borderLeftColor: 'transparent',
51
- borderRightColor: 'transparent'
52
- }
53
- });
40
+ const selectHighlightTriangleStyles = _ref2 => {
41
+ let {
42
+ highlightColor,
43
+ highlightTriangleSize
44
+ } = _ref2;
45
+ return {
46
+ container: {
47
+ bottom: 0 - highlightTriangleSize * 2
48
+ },
49
+ triangle: {
50
+ height: 0,
51
+ width: 0,
52
+ borderWidth: highlightTriangleSize,
53
+ borderTopColor: highlightColor,
54
+ borderBottomColor: 'transparent',
55
+ borderLeftColor: 'transparent',
56
+ borderRightColor: 'transparent'
57
+ }
58
+ };
59
+ };
54
60
 
55
- const selectContainerStyles = ({
56
- backgroundColor,
57
- borderColor,
58
- borderWidth = 0,
59
- borderRadius,
60
- paddingHorizontal = 0,
61
- paddingVertical = 0
62
- }) => ({
63
- backgroundColor,
64
- borderColor,
65
- borderWidth,
66
- borderRadius,
67
- paddingHorizontal: paddingHorizontal - borderWidth,
68
- paddingVertical: paddingVertical - borderWidth
69
- });
61
+ const selectContainerStyles = _ref3 => {
62
+ let {
63
+ backgroundColor,
64
+ borderColor,
65
+ borderWidth = 0,
66
+ borderRadius,
67
+ paddingHorizontal = 0,
68
+ paddingVertical = 0
69
+ } = _ref3;
70
+ return {
71
+ backgroundColor,
72
+ borderColor,
73
+ borderWidth,
74
+ borderRadius,
75
+ paddingHorizontal: paddingHorizontal - borderWidth,
76
+ paddingVertical: paddingVertical - borderWidth
77
+ };
78
+ };
70
79
  /**
71
80
  * Item within a Tabs component representing one tab of content. May be rendered as a link
72
81
  * or as a "menuitem" button depending on whether 'href' is passed.
@@ -75,23 +84,22 @@ const selectContainerStyles = ({
75
84
  */
76
85
 
77
86
 
78
- const TabsItem = /*#__PURE__*/forwardRef(({
79
- href,
80
- variant,
81
- tokens,
82
- selected,
83
- itemPositions,
84
- index,
85
- children,
86
- accessibilityRole = href ? 'link' : 'tab',
87
- accessibilityState = Platform.OS === 'web' && accessibilityRole === 'link' ? // Web links can't be aria-selected but can be aria-current
88
- {
89
- current: selected ? 'page' : false
90
- } : {
91
- selected
92
- },
93
- ...rawRest
94
- }, ref) => {
87
+ const TabsItem = /*#__PURE__*/forwardRef((_ref4, ref) => {
88
+ let {
89
+ href,
90
+ variant,
91
+ tokens,
92
+ selected,
93
+ itemPositions,
94
+ index,
95
+ children,
96
+ accessibilityRole,
97
+ accessibilityCurrent = Platform.OS === 'web' && accessibilityRole === 'link' && selected ? 'page' : undefined,
98
+ accessibilityState = accessibilityRole === 'tab' ? {
99
+ selected
100
+ } : undefined,
101
+ ...rawRest
102
+ } = _ref4;
95
103
  // Convert onClick etc to onPress etc if used in an integration
96
104
  const {
97
105
  onPress,
@@ -119,12 +127,13 @@ const TabsItem = /*#__PURE__*/forwardRef(({
119
127
  const openHref = href && linkProps.handleHref({
120
128
  href
121
129
  });
122
- const handlePress = onPress || openHref ? (...args) => {
123
- if (onPress) onPress(...args);
124
- if (openHref) openHref(...args);
130
+ const handlePress = onPress || openHref ? function () {
131
+ if (onPress) onPress(...arguments);
132
+ if (openHref) openHref(...arguments);
125
133
  } : undefined;
126
134
  const selectedProps = selectProps({
127
135
  accessibilityRole,
136
+ accessibilityCurrent,
128
137
  accessibilityState,
129
138
  ...rest
130
139
  });
@@ -15,58 +15,62 @@ import { jsx as _jsx } from "react/jsx-runtime";
15
15
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
16
16
  const [selectItemProps, selectedItemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, pressProps, viewProps]);
17
17
 
18
- const selectIconTextTokens = ({
19
- icon,
20
- iconPosition,
21
- iconSpace,
22
- iconSize,
23
- iconColor,
24
- iconBackground,
25
- iconBorderRadius,
26
- iconAlignSelf,
27
- iconPadding,
28
- iconTranslateX,
29
- iconTranslateY
30
- }) => ({
31
- icon,
32
- iconPosition,
33
- iconSpace,
34
- iconWrapperStyle: {
35
- backgroundColor: iconBackground,
36
- borderRadius: iconBorderRadius,
37
- alignSelf: iconAlignSelf,
38
- padding: iconPadding,
39
- ...Platform.select({
40
- // TODO: https://github.com/telus/universal-design-system/issues/487
41
- web: {
42
- transition: 'color 200ms, background 200ms'
43
- }
44
- })
45
- },
46
- iconTokens: {
47
- size: iconSize,
48
- color: iconColor,
49
- translateX: iconTranslateX,
50
- translateY: iconTranslateY
51
- }
52
- });
18
+ const selectIconTextTokens = _ref => {
19
+ let {
20
+ icon,
21
+ iconPosition,
22
+ iconSpace,
23
+ iconSize,
24
+ iconColor,
25
+ iconBackground,
26
+ iconBorderRadius,
27
+ iconAlignSelf,
28
+ iconPadding,
29
+ iconTranslateX,
30
+ iconTranslateY
31
+ } = _ref;
32
+ return {
33
+ icon,
34
+ iconPosition,
35
+ iconSpace,
36
+ iconWrapperStyle: {
37
+ backgroundColor: iconBackground,
38
+ borderRadius: iconBorderRadius,
39
+ alignSelf: iconAlignSelf,
40
+ padding: iconPadding,
41
+ ...Platform.select({
42
+ // TODO: https://github.com/telus/universal-design-system/issues/487
43
+ web: {
44
+ transition: 'color 200ms, background 200ms'
45
+ }
46
+ })
47
+ },
48
+ iconTokens: {
49
+ size: iconSize,
50
+ color: iconColor,
51
+ translateX: iconTranslateX,
52
+ translateY: iconTranslateY
53
+ }
54
+ };
55
+ };
53
56
 
54
- const Tags = /*#__PURE__*/forwardRef(({
55
- variant,
56
- tokens,
57
- items = [],
58
- values,
59
- initialValues,
60
- maxValues,
61
- onChange,
62
- readOnly = false,
63
- inactive = false,
64
- accessibilityRole = Platform.select({
65
- web: 'group',
66
- default: 'none'
67
- }),
68
- ...rest
69
- }, ref) => {
57
+ const Tags = /*#__PURE__*/forwardRef((_ref2, ref) => {
58
+ let {
59
+ variant,
60
+ tokens,
61
+ items = [],
62
+ values,
63
+ initialValues,
64
+ maxValues,
65
+ onChange,
66
+ readOnly = false,
67
+ inactive = false,
68
+ accessibilityRole = Platform.select({
69
+ web: 'group',
70
+ default: 'none'
71
+ }),
72
+ ...rest
73
+ } = _ref2;
70
74
  const viewport = useViewport();
71
75
  const themeTokens = useThemeTokens('Tags', tokens, variant, {
72
76
  viewport
@@ -98,7 +102,7 @@ const Tags = /*#__PURE__*/forwardRef(({
98
102
  const uniqueFields = ['id', 'label'];
99
103
 
100
104
  if (!containUniqueFields(items, uniqueFields)) {
101
- throw new Error(`Tags items must have unique ${uniqueFields.join(', ')}`);
105
+ throw new Error("Tags items must have unique ".concat(uniqueFields.join(', ')));
102
106
  }
103
107
 
104
108
  return /*#__PURE__*/_jsx(StackWrap, {
@@ -107,12 +111,13 @@ const Tags = /*#__PURE__*/forwardRef(({
107
111
  space: space,
108
112
  direction: direction,
109
113
  tokens: stackTokens,
110
- children: items.map(({
111
- label,
112
- id = label,
113
- ref: itemRef,
114
- ...itemRest
115
- }, index) => {
114
+ children: items.map((_ref3, index) => {
115
+ let {
116
+ label,
117
+ id = label,
118
+ ref: itemRef,
119
+ ...itemRest
120
+ } = _ref3;
116
121
  const isSelected = currentValues.includes(id); // Pass an object of relevant component state as first argument for any passed-in press handlers
117
122
 
118
123
  const pressHandlers = getPressHandlersWithArgs(rest, [{
@@ -142,10 +147,11 @@ const Tags = /*#__PURE__*/forwardRef(({
142
147
  selected: isSelected,
143
148
  inactive: inactive,
144
149
  ...itemProps,
145
- children: ({
146
- textStyles,
147
- ...buttonState
148
- }) => {
150
+ children: _ref4 => {
151
+ let {
152
+ textStyles,
153
+ ...buttonState
154
+ } = _ref4;
149
155
  // TODO: once Icon/IconButton designs are stable, see if this sort of styling around
150
156
  // an icon should go in Icon itself, or possibly via an IconText token set. Related issues:
151
157
  // - Icon: https://github.com/telus/universal-design-system/issues/327
@@ -32,21 +32,24 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, foc
32
32
  * It is a more usable and accessible option than the HTML `placeholder` attribute.
33
33
  */
34
34
 
35
- const TextArea = /*#__PURE__*/forwardRef(({
36
- tokens,
37
- variant = {},
38
- ...rest
39
- }, ref) => {
35
+ const TextArea = /*#__PURE__*/forwardRef((_ref, ref) => {
36
+ let {
37
+ tokens,
38
+ variant = {},
39
+ ...rest
40
+ } = _ref;
40
41
  const themeTokens = useThemeTokens('TextArea', tokens, variant);
41
42
  const [inputHeight, setInputHeight] = useState(); // adjust the text area's height as new lines are added to the content
42
43
 
43
- const onHeightChange = ({
44
- nativeEvent: {
45
- contentSize: {
46
- height
44
+ const onHeightChange = _ref2 => {
45
+ let {
46
+ nativeEvent: {
47
+ contentSize: {
48
+ height
49
+ }
47
50
  }
48
- }
49
- }) => {
51
+ } = _ref2;
52
+
50
53
  // on native this is happens out of the box
51
54
  if (Platform.OS === 'web') {
52
55
  setInputHeight(height);
@@ -67,15 +70,18 @@ const TextArea = /*#__PURE__*/forwardRef(({
67
70
  tokens: themeTokens
68
71
  };
69
72
  return /*#__PURE__*/_jsx(InputSupports, { ...supportsProps,
70
- children: ({
71
- inputId,
72
- ...props
73
- }) => /*#__PURE__*/_jsx(TextInputBase, {
74
- ref: ref,
75
- ...inputProps,
76
- nativeID: inputId,
77
- ...props
78
- })
73
+ children: _ref3 => {
74
+ let {
75
+ inputId,
76
+ ...props
77
+ } = _ref3;
78
+ return /*#__PURE__*/_jsx(TextInputBase, {
79
+ ref: ref,
80
+ ...inputProps,
81
+ nativeID: inputId,
82
+ ...props
83
+ });
84
+ }
79
85
  });
80
86
  });
81
87
  TextArea.displayName = 'TextArea';
@@ -25,12 +25,13 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, foc
25
25
  * their implementation on the web.
26
26
  */
27
27
 
28
- const TextInput = /*#__PURE__*/forwardRef(({
29
- tokens,
30
- variant = {},
31
- pattern,
32
- ...rest
33
- }, ref) => {
28
+ const TextInput = /*#__PURE__*/forwardRef((_ref, ref) => {
29
+ let {
30
+ tokens,
31
+ variant = {},
32
+ pattern,
33
+ ...rest
34
+ } = _ref;
34
35
  React.useEffect(() => {
35
36
  if (Platform.OS === 'web' && pattern && ref.current) {
36
37
  // eslint-disable-next-line no-param-reassign
@@ -48,15 +49,18 @@ const TextInput = /*#__PURE__*/forwardRef(({
48
49
  }
49
50
  };
50
51
  return /*#__PURE__*/_jsx(InputSupports, { ...supportsProps,
51
- children: ({
52
- inputId,
53
- ...props
54
- }) => /*#__PURE__*/_jsx(TextInputBase, {
55
- ref: ref,
56
- ...inputProps,
57
- nativeID: inputId,
58
- ...props
59
- })
52
+ children: _ref2 => {
53
+ let {
54
+ inputId,
55
+ ...props
56
+ } = _ref2;
57
+ return /*#__PURE__*/_jsx(TextInputBase, {
58
+ ref: ref,
59
+ ...inputProps,
60
+ nativeID: inputId,
61
+ ...props
62
+ });
63
+ }
60
64
  });
61
65
  });
62
66
  TextInput.displayName = 'TextInput';
@@ -10,27 +10,29 @@ import { jsx as _jsx } from "react/jsx-runtime";
10
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
11
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, textInputHandlerProps, textInputProps, viewProps]);
12
12
 
13
- const selectInputStyles = ({
14
- backgroundColor,
15
- color,
16
- borderWidth = 0,
17
- borderColor,
18
- borderRadius,
19
- paddingTop = 0,
20
- paddingBottom = 0,
21
- paddingLeft,
22
- paddingRight = 0,
23
- fontName,
24
- fontSize,
25
- fontWeight,
26
- lineHeight,
27
- icon,
28
- iconSize = 0,
29
- minLines,
30
- maxLines,
31
- width,
32
- height
33
- }, inactive) => {
13
+ const selectInputStyles = (_ref, inactive) => {
14
+ let {
15
+ backgroundColor,
16
+ color,
17
+ borderWidth = 0,
18
+ borderColor,
19
+ borderRadius,
20
+ paddingTop = 0,
21
+ paddingBottom = 0,
22
+ paddingLeft,
23
+ paddingRight = 0,
24
+ fontName,
25
+ fontSize,
26
+ fontWeight,
27
+ lineHeight,
28
+ icon,
29
+ iconSize = 0,
30
+ minLines,
31
+ maxLines,
32
+ width,
33
+ height
34
+ } = _ref;
35
+
34
36
  // Subtract border width from padding so overall input width/height doesn't
35
37
  // jump around if the border width changes (avoiding NaN and negative padding)
36
38
  const offsetBorder = value => typeof value === 'number' ? Math.max(0, value - borderWidth) : value;
@@ -79,52 +81,62 @@ const selectInputStyles = ({
79
81
  };
80
82
  };
81
83
 
82
- const selectOuterBorderStyles = ({
83
- outerBackgroundColor,
84
- outerBorderWidth,
85
- outerBorderColor,
86
- borderRadius
87
- }) => ({
88
- background: outerBackgroundColor,
89
- ...applyOuterBorder({
90
- outerBorderColor,
84
+ const selectOuterBorderStyles = _ref2 => {
85
+ let {
86
+ outerBackgroundColor,
91
87
  outerBorderWidth,
88
+ outerBorderColor,
92
89
  borderRadius
93
- })
94
- });
90
+ } = _ref2;
91
+ return {
92
+ background: outerBackgroundColor,
93
+ ...applyOuterBorder({
94
+ outerBorderColor,
95
+ outerBorderWidth,
96
+ borderRadius
97
+ })
98
+ };
99
+ };
95
100
 
96
- const selectIconTokens = ({
97
- iconSize,
98
- iconColor
99
- }) => ({
100
- size: iconSize,
101
- color: iconColor
102
- });
101
+ const selectIconTokens = _ref3 => {
102
+ let {
103
+ iconSize,
104
+ iconColor
105
+ } = _ref3;
106
+ return {
107
+ size: iconSize,
108
+ color: iconColor
109
+ };
110
+ };
103
111
 
104
- const selectIconContainerStyles = ({
105
- paddingRight,
106
- paddingBottom
107
- }) => ({
108
- paddingRight,
109
- paddingBottom
110
- });
112
+ const selectIconContainerStyles = _ref4 => {
113
+ let {
114
+ paddingRight,
115
+ paddingBottom
116
+ } = _ref4;
117
+ return {
118
+ paddingRight,
119
+ paddingBottom
120
+ };
121
+ };
111
122
 
112
- const TextInputBase = /*#__PURE__*/forwardRef(({
113
- value,
114
- height,
115
- initialValue,
116
- inactive,
117
- readOnly,
118
- onChange,
119
- onChangeText,
120
- onFocus,
121
- onBlur,
122
- onMouseOver,
123
- onMouseOut,
124
- tokens,
125
- variant = {},
126
- ...rest
127
- }, ref) => {
123
+ const TextInputBase = /*#__PURE__*/forwardRef((_ref5, ref) => {
124
+ let {
125
+ value,
126
+ height,
127
+ initialValue,
128
+ inactive,
129
+ readOnly,
130
+ onChange,
131
+ onChangeText,
132
+ onFocus,
133
+ onBlur,
134
+ onMouseOver,
135
+ onMouseOut,
136
+ tokens,
137
+ variant = {},
138
+ ...rest
139
+ } = _ref5;
128
140
  const [isFocused, setIsFocused] = useState(false);
129
141
 
130
142
  const handleFocus = event => {
@@ -6,10 +6,11 @@ export const uninitialisedError = new Error('Theme context used outside of Theme
6
6
  export const ThemeContext = /*#__PURE__*/createContext(uninitialisedError);
7
7
  export const ThemeSetterContext = /*#__PURE__*/createContext(uninitialisedError);
8
8
 
9
- const ThemeProvider = ({
10
- children,
11
- defaultTheme
12
- }) => {
9
+ const ThemeProvider = _ref => {
10
+ let {
11
+ children,
12
+ defaultTheme
13
+ } = _ref;
13
14
  const [theme, setTheme] = useState(defaultTheme); // Validate the theme tokens version on every render.
14
15
  // This will intentionally break the application when attempting to use an invalid theme.
15
16
  // This will surface an incompatibility quickly rather than allowing the potential for strange bugs due to missing or incompatible tokens.
@@ -10,9 +10,12 @@ const useSetTheme = () => {
10
10
  } // Merge provided object into current theme
11
11
 
12
12
 
13
- const editTheme = useCallback(newTheme => setTheme((oldTheme = {}) => ({ ...oldTheme,
14
- ...newTheme
15
- })), [setTheme]);
13
+ const editTheme = useCallback(newTheme => setTheme(function () {
14
+ let oldTheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
15
+ return { ...oldTheme,
16
+ ...newTheme
17
+ };
18
+ }), [setTheme]);
16
19
  return {
17
20
  setTheme,
18
21
  editTheme
@@ -34,7 +34,10 @@ import { getComponentTheme, getThemeTokens, resolveThemeTokens, mergeAppearances
34
34
  * @returns {TokensSet} - the currently-applicable resolved set of theme tokens to apply
35
35
  */
36
36
 
37
- export const useThemeTokens = (componentName, tokens = {}, variants = {}, states = {}) => {
37
+ export const useThemeTokens = function (componentName) {
38
+ let tokens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
39
+ let variants = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
40
+ let states = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
38
41
  const theme = useTheme();
39
42
  const componentTheme = getComponentTheme(theme, componentName);
40
43
  const themeTokens = getThemeTokens(componentTheme, tokens, variants, states);
@@ -93,7 +96,9 @@ export const useThemeTokens = (componentName, tokens = {}, variants = {}, states
93
96
  * e.g. if one theme tokens callback needs to pass certain token overrides to another.
94
97
  */
95
98
 
96
- export const useThemeTokensCallback = (componentName, tokens = {}, variants = {}) => {
99
+ export const useThemeTokensCallback = function (componentName) {
100
+ let tokens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
101
+ let variants = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
97
102
  const theme = useTheme();
98
103
  const componentTheme = getComponentTheme(theme, componentName);
99
104
  const getThemeTokensCallback = useCallback((states, tokenOverrides) => {