@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,35 +17,42 @@ import { jsx as _jsx } from "react/jsx-runtime";
17
17
  import { jsxs as _jsxs } from "react/jsx-runtime";
18
18
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
19
19
 
20
- const selectTooltipStyles = ({
21
- backgroundColor,
22
- paddingTop,
23
- paddingBottom,
24
- paddingLeft,
25
- paddingRight,
26
- borderRadius
27
- }) => ({
28
- backgroundColor,
29
- paddingTop,
30
- paddingBottom,
31
- paddingLeft,
32
- paddingRight,
33
- borderRadius
34
- });
20
+ const selectTooltipStyles = _ref => {
21
+ let {
22
+ backgroundColor,
23
+ paddingTop,
24
+ paddingBottom,
25
+ paddingLeft,
26
+ paddingRight,
27
+ borderRadius
28
+ } = _ref;
29
+ return {
30
+ backgroundColor,
31
+ paddingTop,
32
+ paddingBottom,
33
+ paddingLeft,
34
+ paddingRight,
35
+ borderRadius
36
+ };
37
+ };
35
38
 
36
- const selectTooltipShadowStyles = ({
37
- shadow,
38
- borderRadius
39
- }) => ({
40
- borderRadius,
41
- ...applyShadowToken(shadow)
42
- });
39
+ const selectTooltipShadowStyles = _ref2 => {
40
+ let {
41
+ shadow,
42
+ borderRadius
43
+ } = _ref2;
44
+ return {
45
+ borderRadius,
46
+ ...applyShadowToken(shadow)
47
+ };
48
+ };
43
49
 
44
- const selectTooltipPositionStyles = ({
45
- top,
46
- left,
47
- width
48
- }) => {
50
+ const selectTooltipPositionStyles = _ref3 => {
51
+ let {
52
+ top,
53
+ left,
54
+ width
55
+ } = _ref3;
49
56
  return {
50
57
  top,
51
58
  left,
@@ -53,16 +60,18 @@ const selectTooltipPositionStyles = ({
53
60
  };
54
61
  };
55
62
 
56
- const selectArrowStyles = ({
57
- backgroundColor,
58
- arrowWidth,
59
- arrowBorderRadius,
60
- shadow
61
- }, {
62
- position,
63
- width: tooltipWidth,
64
- height: tooltipHeight
65
- }) => {
63
+ const selectArrowStyles = (_ref4, _ref5) => {
64
+ let {
65
+ backgroundColor,
66
+ arrowWidth,
67
+ arrowBorderRadius,
68
+ shadow
69
+ } = _ref4;
70
+ let {
71
+ position,
72
+ width: tooltipWidth,
73
+ height: tooltipHeight
74
+ } = _ref5;
66
75
  // the arrow width is actually a diagonal of the rectangle that we'll use as a tip
67
76
  const rectangleSide = Math.sqrt(arrowWidth * arrowWidth / 2); // position the arrow at the side and center of the tooltip - this happens before rotation
68
77
  // so we use the rectangle size as basis
@@ -135,15 +144,16 @@ const defaultControl = (pressableState, variant) => /*#__PURE__*/_jsx(TooltipBut
135
144
  */
136
145
 
137
146
 
138
- const Tooltip = /*#__PURE__*/forwardRef(({
139
- children,
140
- content,
141
- position = 'auto',
142
- copy = 'en',
143
- tokens,
144
- variant,
145
- ...rest
146
- }, ref) => {
147
+ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
148
+ let {
149
+ children,
150
+ content,
151
+ position = 'auto',
152
+ copy = 'en',
153
+ tokens,
154
+ variant,
155
+ ...rest
156
+ } = _ref6;
147
157
  const [isOpen, setIsOpen] = useState(false);
148
158
  const controlRef = useRef();
149
159
  const [controlLayout, setControlLayout] = useState(null);
@@ -160,9 +170,10 @@ const Tooltip = /*#__PURE__*/forwardRef(({
160
170
  arrowOffset
161
171
  } = themeTokens;
162
172
  useEffect(() => {
163
- const subscription = Dimensions.addEventListener('change', ({
164
- window
165
- }) => {
173
+ const subscription = Dimensions.addEventListener('change', _ref7 => {
174
+ let {
175
+ window
176
+ } = _ref7;
166
177
  setWindowDimensions(window);
167
178
  });
168
179
  return () => subscription === null || subscription === void 0 ? void 0 : subscription.remove();
@@ -172,24 +183,29 @@ const Tooltip = /*#__PURE__*/forwardRef(({
172
183
 
173
184
  const close = () => setIsOpen(false);
174
185
 
175
- const getPressableState = ({
176
- pressed,
177
- hovered,
178
- focused
179
- }) => ({
180
- pressed,
181
- hover: hovered,
182
- focus: focused
183
- });
186
+ const getPressableState = _ref8 => {
187
+ let {
188
+ pressed,
189
+ hovered,
190
+ focused
191
+ } = _ref8;
192
+ return {
193
+ pressed,
194
+ hover: hovered,
195
+ focus: focused
196
+ };
197
+ };
184
198
 
185
- const onTooltipLayout = ({
186
- nativeEvent: {
187
- layout: {
188
- width,
189
- height
199
+ const onTooltipLayout = _ref9 => {
200
+ let {
201
+ nativeEvent: {
202
+ layout: {
203
+ width,
204
+ height
205
+ }
190
206
  }
191
- }
192
- }) => {
207
+ } = _ref9;
208
+
193
209
  if (tooltipDimensions === null || tooltipDimensions.width !== width || tooltipDimensions.height !== height) {
194
210
  setTooltipDimensions({
195
211
  width: Platform.select({
@@ -49,9 +49,12 @@ function invertPosition(position) {
49
49
  }
50
50
 
51
51
  function findRectByPosition(position, rectsArray) {
52
- return rectsArray.find(({
53
- position: rectPosition
54
- }) => rectPosition === position);
52
+ return rectsArray.find(_ref => {
53
+ let {
54
+ position: rectPosition
55
+ } = _ref;
56
+ return rectPosition === position;
57
+ });
55
58
  }
56
59
  /**
57
60
  * Used for absolute positioning of the tooltip. Since the tooltip is always centered relatively
@@ -63,13 +66,14 @@ function findRectByPosition(position, rectsArray) {
63
66
  */
64
67
 
65
68
 
66
- function getTooltipPosition(position, {
67
- controlLayout,
68
- tooltipDimensions,
69
- windowDimensions,
70
- arrowWidth = 0,
71
- arrowOffset = 0
72
- }) {
69
+ function getTooltipPosition(position, _ref2) {
70
+ let {
71
+ controlLayout,
72
+ tooltipDimensions,
73
+ windowDimensions,
74
+ arrowWidth = 0,
75
+ arrowOffset = 0
76
+ } = _ref2;
73
77
  const {
74
78
  width: controlWidth,
75
79
  height: controlHeight,
@@ -139,9 +143,12 @@ function getTooltipPosition(position, {
139
143
  }
140
144
  }
141
145
 
142
- const inWindow = boundingRects.filter(({
143
- overflow
144
- }) => overflow === 0); // pick the first position that fits in window
146
+ const inWindow = boundingRects.filter(_ref3 => {
147
+ let {
148
+ overflow
149
+ } = _ref3;
150
+ return overflow === 0;
151
+ }); // pick the first position that fits in window
145
152
  // (these are sorted clockwise which makes them show where one would expect them to be)
146
153
 
147
154
  if (inWindow.length > 0) {
@@ -150,11 +157,15 @@ function getTooltipPosition(position, {
150
157
  // the least overflowing and normalize its position to fit within window bounds
151
158
 
152
159
 
153
- boundingRects.sort(({
154
- overflow: overflowA
155
- }, {
156
- overflow: overflowB
157
- }) => overflowA - overflowB);
160
+ boundingRects.sort((_ref4, _ref5) => {
161
+ let {
162
+ overflow: overflowA
163
+ } = _ref4;
164
+ let {
165
+ overflow: overflowB
166
+ } = _ref5;
167
+ return overflowA - overflowB;
168
+ });
158
169
  const leastOverflowing = boundingRects[0]; // prefer 'below' over 'above', since we can always expand the document downwards,
159
170
  // and 'above' might cause issues on small viewports with large tooltips
160
171
 
@@ -7,24 +7,30 @@ import Icon from '../Icon';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
9
9
 
10
- const selectInnerContainerStyles = ({
11
- borderRadius,
12
- width
13
- }) => ({
14
- borderRadius,
15
- width
16
- });
10
+ const selectInnerContainerStyles = _ref => {
11
+ let {
12
+ borderRadius,
13
+ width
14
+ } = _ref;
15
+ return {
16
+ borderRadius,
17
+ width
18
+ };
19
+ };
17
20
 
18
- const selectIconTokens = ({
19
- iconSize,
20
- iconColor
21
- /* iconScale = 1 */
21
+ const selectIconTokens = _ref2 => {
22
+ let {
23
+ iconSize,
24
+ iconColor
25
+ /* iconScale = 1 */
22
26
 
23
- }) => ({
24
- size: iconSize,
25
- color: iconColor // scale: iconScale TODO re-enable with icon component
27
+ } = _ref2;
28
+ return {
29
+ size: iconSize,
30
+ color: iconColor // scale: iconScale TODO re-enable with icon component
26
31
 
27
- });
32
+ };
33
+ };
28
34
  /**
29
35
  * `TooltipButton` is a helper component used as a default control for the `Tooltip` component.
30
36
  * In fact though, it isn't actually a pressable - it's meant to be used as pressable's content.
@@ -32,12 +38,13 @@ const selectIconTokens = ({
32
38
  */
33
39
 
34
40
 
35
- const TooltipButton = ({
36
- pressableState,
37
- tokens,
38
- variant,
39
- ...rest
40
- }) => {
41
+ const TooltipButton = _ref3 => {
42
+ let {
43
+ pressableState,
44
+ tokens,
45
+ variant,
46
+ ...rest
47
+ } = _ref3;
41
48
  const themeTokens = useThemeTokens('TooltipButton', tokens, variant, pressableState);
42
49
  const {
43
50
  icon: IconComponent
@@ -14,39 +14,43 @@ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  const [selectContainerProps, selectedContainerPropTypes] = selectSystemProps([a11yProps, viewProps]);
15
15
  const [selectTextProps, selectedTextPropTypes] = selectSystemProps([textProps]);
16
16
 
17
- const selectTextStyles = ({
18
- fontWeight,
19
- fontSize,
20
- color,
21
- lineHeight,
22
- fontName,
23
- textAlign,
24
- textTransform,
25
- letterSpacing
26
- }) => applyTextStyles({
27
- fontWeight,
28
- fontSize,
29
- color,
30
- lineHeight,
31
- fontName,
32
- textAlign,
33
- textTransform,
34
- letterSpacing
35
- }); // General-purpose flexible theme-neutral base component for text
17
+ const selectTextStyles = _ref => {
18
+ let {
19
+ fontWeight,
20
+ fontSize,
21
+ color,
22
+ lineHeight,
23
+ fontName,
24
+ textAlign,
25
+ textTransform,
26
+ letterSpacing
27
+ } = _ref;
28
+ return applyTextStyles({
29
+ fontWeight,
30
+ fontSize,
31
+ color,
32
+ lineHeight,
33
+ fontName,
34
+ textAlign,
35
+ textTransform,
36
+ letterSpacing
37
+ });
38
+ }; // General-purpose flexible theme-neutral base component for text
36
39
 
37
40
 
38
- const Typography = /*#__PURE__*/forwardRef(({
39
- children,
40
- variant,
41
- heading,
42
- tag = typeof heading === 'string' ? heading : undefined,
43
- accessibilityRole = heading === true ? 'header' : undefined,
44
- block = false,
45
- align = undefined,
46
- tokens,
47
- dataSet,
48
- ...rest
49
- }, ref) => {
41
+ const Typography = /*#__PURE__*/forwardRef((_ref2, ref) => {
42
+ let {
43
+ children,
44
+ variant,
45
+ heading,
46
+ tag = typeof heading === 'string' ? heading : undefined,
47
+ accessibilityRole = heading === true ? 'header' : undefined,
48
+ block = false,
49
+ align = undefined,
50
+ tokens,
51
+ dataSet,
52
+ ...rest
53
+ } = _ref2;
50
54
  const viewport = useViewport();
51
55
  const themeTokens = useThemeTokens('Typography', tokens, variant, {
52
56
  viewport
@@ -9,9 +9,10 @@ import useViewportListener from './useViewportListener';
9
9
 
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
 
12
- const ViewportProvider = ({
13
- children
14
- }) => {
12
+ const ViewportProvider = _ref => {
13
+ let {
14
+ children
15
+ } = _ref;
15
16
  // Default to the smallest viewport for mobile-first SSR. On client side, this is updated
16
17
  // by useViewportListener in a layout effect before anything is shown to the user.
17
18
  const [viewport, setViewport] = useState(viewports.keys[0]);
@@ -26,9 +26,12 @@ const useViewportListenerCSR = setViewport => {
26
26
  useLayoutEffect(() => {
27
27
  setViewport(lookupViewport());
28
28
 
29
- const onChange = ({
30
- window
31
- }) => setViewport(viewports.select(window.width));
29
+ const onChange = _ref => {
30
+ let {
31
+ window
32
+ } = _ref;
33
+ return setViewport(viewports.select(window.width));
34
+ };
32
35
 
33
36
  const listener = Dimensions.addEventListener('change', onChange); // From RN 0.65.0, Dimensions.removeEventListener is deprecated for `remove` on addEventListener return value;
34
37
  // however, that is not available in RN <=0.64.X, therefore not in any Expo release as of 2021 (Expo SDK 43).
@@ -49,7 +49,10 @@ const rolesToTags =
49
49
 
50
50
  }; // Invert React Native Web's mapping, so a tag gets the role that gets that tag
51
51
 
52
- export const tagsToRoles = Object.fromEntries(Object.entries(rolesToTags).map(([key, value]) => [value, key]));
52
+ export const tagsToRoles = Object.fromEntries(Object.entries(rolesToTags).map(_ref => {
53
+ let [key, value] = _ref;
54
+ return [value, key];
55
+ }));
53
56
  /**
54
57
  * Heading HTML tags map to the "heading" accessibilityRole in native apps, which is similar
55
58
  * to headings on web but without the expectation of a hierarchy of headings within one screen.
@@ -8,7 +8,8 @@ import Platform from "react-native-web/dist/exports/Platform";
8
8
  * @param {number} [maxScale] - the maximum multiplier to apply; defaults to no maximum
9
9
  */
10
10
 
11
- export const scaleWithText = (value, maxScale = Infinity) => {
11
+ export const scaleWithText = function (value) {
12
+ let maxScale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
12
13
  if (!value) return value;
13
14
  const scale = Math.min(PixelRatio.getFontScale(), maxScale) || 1;
14
15
  return value * scale;
@@ -24,10 +25,11 @@ export const scaleWithText = (value, maxScale = Infinity) => {
24
25
  * `maxFontSizeMultiplier` prop value.
25
26
  */
26
27
 
27
- export const getMaxFontMultiplier = ({
28
- fontSize,
29
- fontScaleCap
30
- }) => {
28
+ export const getMaxFontMultiplier = _ref => {
29
+ let {
30
+ fontSize,
31
+ fontScaleCap
32
+ } = _ref;
31
33
  if (Platform.OS === 'web' || !fontScaleCap || !fontSize) return undefined;
32
34
  if (fontScaleCap <= fontSize) return 1;
33
35
  return fontScaleCap / fontSize;
@@ -1,25 +1,32 @@
1
- import { useEffect, useRef, useState } from 'react';
1
+ import { useEffect, useLayoutEffect, useRef, useState } from 'react';
2
2
  import Animated from "react-native-web/dist/exports/Animated";
3
3
  import Easing from "react-native-web/dist/exports/Easing";
4
4
  import Platform from "react-native-web/dist/exports/Platform"; // TODO: systematise animations
5
5
  // https://github.com/telus/universal-design-system/issues/487
6
6
 
7
- function useVerticalExpandAnimation({
8
- containerHeight,
9
- isExpanded,
10
- tokens
11
- }) {
7
+ function useVerticalExpandAnimation(_ref) {
8
+ let {
9
+ containerHeight,
10
+ isExpanded,
11
+ tokens
12
+ } = _ref;
12
13
  const [isAnimating, setIsAnimating] = useState(false);
14
+ const [wasExpanded, setWasExpanded] = useState(isExpanded);
15
+ const expandStateChanged = isExpanded !== wasExpanded;
13
16
  const expandAnimatedValue = useRef(new Animated.Value(0)).current;
14
17
  const elementRef = useRef(null);
15
18
  const {
16
19
  expandDuration,
17
20
  collapseDuration
18
- } = tokens; // Treat as animating from when expanded state changes, until animation completes
19
-
20
- useEffect(() => setIsAnimating(true), [isExpanded]);
21
+ } = tokens;
22
+ useLayoutEffect(() => {
23
+ if (expandStateChanged) {
24
+ setIsAnimating(true);
25
+ setWasExpanded(isExpanded);
26
+ }
27
+ }, [expandStateChanged, isExpanded]);
21
28
  useEffect(() => {
22
- const onComplete = () => !isExpanded && setIsAnimating(false);
29
+ const onComplete = () => setIsAnimating(false);
23
30
 
24
31
  if (Platform.OS === 'web') {
25
32
  if (!elementRef.current) return () => {}; // React Native Web does not pass `onTransitionEnd` through, must attach manually.
@@ -39,20 +46,40 @@ function useVerticalExpandAnimation({
39
46
  const animation = Animated.timing(expandAnimatedValue, animationConfig);
40
47
  animation.start(onComplete);
41
48
  return () => animation.stop();
42
- }, [isExpanded, expandAnimatedValue, containerHeight, expandDuration, collapseDuration]); // Without `visibility: 'hidden', descendents are focusable on web even when collapsed
49
+ }, [isExpanded, expandAnimatedValue, containerHeight, expandDuration, collapseDuration]);
50
+ const containerStyles = {};
51
+ if (isAnimating || expandStateChanged) containerStyles.overflow = 'hidden';
43
52
 
44
- const containerStyles = !isExpanded && !isAnimating ? {
45
- visibility: 'hidden'
46
- } : {}; // don't visually collapse the container until we have it measured
47
-
48
- if (containerHeight !== null) {
53
+ if (!isExpanded && !isAnimating && !expandStateChanged) {
49
54
  if (Platform.OS === 'web') {
50
- const transitionDuration = isExpanded ? expandDuration : collapseDuration;
51
- containerStyles.transition = `height ${transitionDuration}ms ease-in-out`;
52
- containerStyles.height = isExpanded ? containerHeight : 0;
55
+ // Without `visibility: 'hidden', descendents are focusable on web even when collapsed.
56
+ containerStyles.visibility = 'hidden';
53
57
  } else {
54
- containerStyles.height = expandAnimatedValue;
58
+ // There's no `visibility: hidden` in React Native, and display: none causes a flicker on expand.
59
+ // Without some form of hiding, some children leak through even when closed e.g. `List.Item` bullets.
60
+ containerStyles.opacity = 0;
61
+ }
62
+ } // don't visually collapse the container until we have it measured
63
+
64
+
65
+ if (containerHeight === null) {
66
+ if (Platform.OS === 'web') {
67
+ // on web we can hide the contents until we have the container measured and avoid occasional jitter
68
+ // this won't work on native platforms
69
+ containerStyles.height = 0;
70
+ containerStyles.visibility = 'hidden';
55
71
  }
72
+ } else if (Platform.OS === 'web') {
73
+ const transitionDuration = isExpanded ? expandDuration : collapseDuration;
74
+ containerStyles.transition = "height ".concat(transitionDuration, "ms ease-in-out");
75
+ containerStyles.height = isExpanded ? containerHeight : 0;
76
+ } else if (Platform.OS === 'ios' && isExpanded && !isAnimating && !expandStateChanged && typeof containerHeight === 'number') {
77
+ // iOS reflows text while the height animation is in progress. Sometimes, it hits a timing bug where
78
+ // it fails to reflow properly after the last animation frame, leaving the last line of text not visible.
79
+ // Force reflow after animation completes with a static height non-identical to the last animated height.
80
+ containerStyles.height = containerHeight + 1;
81
+ } else {
82
+ containerStyles.height = expandAnimatedValue;
56
83
  }
57
84
 
58
85
  return [containerStyles, elementRef];
@@ -55,7 +55,7 @@ const isWrapable = child => {
55
55
  return isStringOrNumber(child) || child.type === A11yText || ((_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.name) === 'FootnoteLink';
56
56
  };
57
57
 
58
- const combineKeys = childrenArray => childrenArray.reduce((newKey, child) => `${newKey}${child.key || ''}`, ''); // Group wrappable children for one `<Text>` parent, merging adjacent text nodes
58
+ const combineKeys = childrenArray => childrenArray.reduce((newKey, child) => "".concat(newKey).concat(child.key || ''), ''); // Group wrappable children for one `<Text>` parent, merging adjacent text nodes
59
59
 
60
60
 
61
61
  const wrapChild = (child, wrappedText) => {
@@ -64,7 +64,7 @@ const wrapChild = (child, wrappedText) => {
64
64
 
65
65
  if (lastIndex >= 0 && isStringOrNumber(child) && isStringOrNumber(wrappedText[lastIndex])) {
66
66
  /* eslint-disable-next-line no-param-reassign */
67
- wrappedText[lastIndex] = `${wrappedText[lastIndex]}${child}`;
67
+ wrappedText[lastIndex] = "".concat(wrappedText[lastIndex]).concat(child);
68
68
  } else {
69
69
  wrappedText.push(child);
70
70
  }
@@ -86,7 +86,8 @@ const wrapChild = (child, wrappedText) => {
86
86
  */
87
87
 
88
88
 
89
- export const wrapStringsInText = (children, textProps = {}) => {
89
+ export const wrapStringsInText = function (children) {
90
+ let textProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
90
91
  const childrenArray = unpackFragment(Children.toArray(children)); // Group adjacent wrapable children together in one Text element to create as few Text elements
91
92
  // as possible, e.g. give <X>Text {someString}</X> one Text, same as <X>{`Text ${someString}`}</X>
92
93