@telus-uds/components-base 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (415) hide show
  1. package/.turbo/turbo-build.log +8 -0
  2. package/CHANGELOG.json +61 -0
  3. package/CHANGELOG.md +45 -2
  4. package/__tests__/ActivityIndicator/ActivityIndicator.test.jsx +35 -0
  5. package/__tests__/ActivityIndicator/__snapshots__/ActivityIndicator.test.jsx.snap +287 -0
  6. package/__tests__/FlexGrid/Col.test.jsx +6 -10
  7. package/__tests__/utils/props.test.js +36 -0
  8. package/__tests__/utils/semantics.test.jsx +1 -10
  9. package/babel.config.js +27 -5
  10. package/component-docs.json +170 -494
  11. package/generate-component-docs.js +3 -0
  12. package/lib/A11yText/index.js +6 -5
  13. package/lib/ActivityIndicator/Spinner.js +46 -37
  14. package/lib/ActivityIndicator/Spinner.native.js +26 -15
  15. package/lib/ActivityIndicator/index.js +3 -3
  16. package/lib/Box/Box.js +8 -8
  17. package/lib/Button/Button.js +2 -2
  18. package/lib/Button/ButtonBase.js +7 -8
  19. package/lib/Button/ButtonGroup.js +10 -12
  20. package/lib/Button/ButtonLink.js +4 -4
  21. package/lib/Button/propTypes.js +4 -2
  22. package/lib/Card/Card.js +6 -5
  23. package/lib/Card/CardBase.js +6 -9
  24. package/lib/Card/PressableCardBase.js +6 -11
  25. package/lib/Checkbox/Checkbox.js +4 -6
  26. package/lib/Divider/Divider.js +14 -13
  27. package/lib/ExpandCollapse/Control.js +7 -7
  28. package/lib/ExpandCollapse/ExpandCollapse.js +6 -2
  29. package/lib/ExpandCollapse/Panel.js +6 -7
  30. package/lib/Feedback/Feedback.js +6 -5
  31. package/lib/Fieldset/Fieldset.js +1 -3
  32. package/lib/FlexGrid/FlexGrid.js +4 -4
  33. package/lib/FlexGrid/helpers/index.js +1 -4
  34. package/lib/HorizontalScroll/HorizontalScroll.js +5 -6
  35. package/lib/IconButton/IconButton.js +6 -6
  36. package/lib/InputLabel/InputLabel.js +7 -2
  37. package/lib/InputSupports/InputSupports.js +2 -2
  38. package/lib/Link/LinkBase.js +12 -13
  39. package/lib/List/List.js +4 -6
  40. package/lib/List/ListItem.js +6 -2
  41. package/lib/Modal/Modal.js +6 -2
  42. package/lib/Notification/Notification.js +12 -8
  43. package/lib/Pagination/Pagination.js +8 -3
  44. package/lib/Progress/Progress.js +5 -4
  45. package/lib/Progress/ProgressBar.js +8 -7
  46. package/lib/Radio/Radio.js +4 -6
  47. package/lib/Radio/RadioButton.js +6 -3
  48. package/lib/Radio/RadioGroup.js +7 -2
  49. package/lib/RadioCard/RadioCard.js +4 -4
  50. package/lib/RadioCard/RadioCardGroup.js +9 -6
  51. package/lib/Search/Search.js +7 -2
  52. package/lib/Select/Select.js +10 -9
  53. package/lib/SideNav/Item.js +7 -7
  54. package/lib/SideNav/SideNav.js +7 -3
  55. package/lib/Skeleton/Skeleton.js +6 -2
  56. package/lib/Spacer/Spacer.js +9 -20
  57. package/lib/StackView/StackView.js +7 -7
  58. package/lib/StackView/StackWrapBox.js +6 -7
  59. package/lib/StackView/StackWrapGap.js +6 -5
  60. package/lib/StackView/getStackedContent.js +1 -1
  61. package/lib/StepTracker/Step.js +7 -3
  62. package/lib/StepTracker/StepTracker.js +7 -7
  63. package/lib/Tabs/Tabs.js +6 -2
  64. package/lib/Tabs/TabsItem.js +6 -5
  65. package/lib/Tags/Tags.js +11 -12
  66. package/lib/TextInput/TextArea.js +13 -14
  67. package/lib/TextInput/TextInput.js +13 -14
  68. package/lib/TextInput/TextInputBase.js +5 -3
  69. package/lib/ThemeProvider/useThemeTokens.js +3 -3
  70. package/lib/ThemeProvider/utils/theme-tokens.js +3 -3
  71. package/lib/ToggleSwitch/ToggleSwitch.js +10 -9
  72. package/lib/ToggleSwitch/ToggleSwitchGroup.js +10 -12
  73. package/lib/Tooltip/Tooltip.js +7 -2
  74. package/lib/TooltipButton/TooltipButton.js +7 -2
  75. package/lib/Typography/Typography.js +8 -6
  76. package/lib/index.js +7 -0
  77. package/lib/utils/a11y/semantics.js +4 -3
  78. package/lib/utils/children.js +5 -1
  79. package/lib/utils/index.js +18 -4
  80. package/lib/utils/pressability.js +2 -2
  81. package/lib/utils/props/a11yProps.js +153 -0
  82. package/lib/utils/props/clickProps.js +36 -0
  83. package/lib/utils/props/componentPropType.js +70 -0
  84. package/lib/utils/props/copyPropTypes.js +14 -0
  85. package/lib/utils/props/getPropSelector.js +13 -0
  86. package/lib/utils/props/hrefAttrsProp.js +41 -0
  87. package/lib/utils/props/index.js +158 -0
  88. package/lib/{InputSupports/propTypes.js → utils/props/inputSupportsProps.js} +2 -3
  89. package/lib/utils/props/linkProps.js +64 -0
  90. package/lib/utils/props/paddingProp.js +20 -0
  91. package/lib/utils/props/pressProps.js +57 -0
  92. package/lib/utils/props/rectProp.js +20 -0
  93. package/lib/utils/props/responsiveProps.js +40 -0
  94. package/lib/utils/props/selectSystemProps.js +31 -0
  95. package/lib/utils/props/spacingProps.js +71 -0
  96. package/lib/utils/props/tokens.js +145 -0
  97. package/lib/utils/props/variantProp.js +28 -0
  98. package/lib/utils/props/viewProps.js +34 -0
  99. package/lib/utils/ssr.js +51 -0
  100. package/lib/utils/useResponsiveProp.js +1 -1
  101. package/lib/utils/useSpacingScale.js +4 -4
  102. package/lib-module/A11yInfoProvider/index.js +62 -0
  103. package/lib-module/A11yText/index.js +55 -0
  104. package/lib-module/ActivityIndicator/Spinner.js +76 -0
  105. package/lib-module/ActivityIndicator/Spinner.native.js +143 -0
  106. package/lib-module/ActivityIndicator/index.js +40 -0
  107. package/lib-module/ActivityIndicator/shared.js +12 -0
  108. package/lib-module/BaseProvider/index.js +26 -0
  109. package/lib-module/Box/Box.js +243 -0
  110. package/lib-module/Box/index.js +2 -0
  111. package/lib-module/Button/Button.js +25 -0
  112. package/lib-module/Button/ButtonBase.js +254 -0
  113. package/lib-module/Button/ButtonGroup.js +164 -0
  114. package/lib-module/Button/ButtonLink.js +39 -0
  115. package/lib-module/Button/index.js +4 -0
  116. package/lib-module/Button/propTypes.js +36 -0
  117. package/lib-module/Card/Card.js +83 -0
  118. package/lib-module/Card/CardBase.js +62 -0
  119. package/lib-module/Card/PressableCardBase.js +113 -0
  120. package/lib-module/Card/index.js +4 -0
  121. package/lib-module/Checkbox/Checkbox.js +321 -0
  122. package/lib-module/Checkbox/CheckboxGroup.js +218 -0
  123. package/lib-module/Checkbox/CheckboxInput.js +58 -0
  124. package/lib-module/Checkbox/CheckboxInput.native.js +6 -0
  125. package/lib-module/Checkbox/index.js +3 -0
  126. package/lib-module/Divider/Divider.js +123 -0
  127. package/lib-module/Divider/index.js +2 -0
  128. package/lib-module/ExpandCollapse/Accordion.js +15 -0
  129. package/lib-module/ExpandCollapse/Control.js +130 -0
  130. package/lib-module/ExpandCollapse/ExpandCollapse.js +94 -0
  131. package/lib-module/ExpandCollapse/Panel.js +158 -0
  132. package/lib-module/ExpandCollapse/index.js +7 -0
  133. package/lib-module/Feedback/Feedback.js +144 -0
  134. package/lib-module/Feedback/index.js +2 -0
  135. package/lib-module/Fieldset/Fieldset.js +145 -0
  136. package/lib-module/Fieldset/FieldsetContainer.js +29 -0
  137. package/lib-module/Fieldset/FieldsetContainer.native.js +20 -0
  138. package/lib-module/Fieldset/Legend.js +21 -0
  139. package/lib-module/Fieldset/Legend.native.js +28 -0
  140. package/lib-module/Fieldset/cssReset.js +14 -0
  141. package/lib-module/Fieldset/index.js +2 -0
  142. package/lib-module/FlexGrid/Col/Col.js +265 -0
  143. package/lib-module/FlexGrid/Col/index.js +2 -0
  144. package/lib-module/FlexGrid/FlexGrid.js +147 -0
  145. package/lib-module/FlexGrid/Row/Row.js +177 -0
  146. package/lib-module/FlexGrid/Row/index.js +2 -0
  147. package/lib-module/FlexGrid/helpers/index.js +18 -0
  148. package/lib-module/FlexGrid/index.js +2 -0
  149. package/lib-module/FlexGrid/providers/GutterContext.js +3 -0
  150. package/lib-module/HorizontalScroll/HorizontalScroll.js +171 -0
  151. package/lib-module/HorizontalScroll/HorizontalScrollButton.js +102 -0
  152. package/lib-module/HorizontalScroll/ScrollViewEnd.js +47 -0
  153. package/lib-module/HorizontalScroll/ScrollViewEnd.native.js +24 -0
  154. package/lib-module/HorizontalScroll/dictionary.js +11 -0
  155. package/lib-module/HorizontalScroll/index.js +11 -0
  156. package/lib-module/HorizontalScroll/itemPositions.js +106 -0
  157. package/lib-module/Icon/Icon.js +61 -0
  158. package/lib-module/Icon/IconText.js +81 -0
  159. package/lib-module/Icon/index.js +4 -0
  160. package/lib-module/IconButton/IconButton.js +115 -0
  161. package/lib-module/IconButton/index.js +2 -0
  162. package/lib-module/InputLabel/InputLabel.js +131 -0
  163. package/lib-module/InputLabel/LabelContent.js +24 -0
  164. package/lib-module/InputLabel/LabelContent.native.js +16 -0
  165. package/lib-module/InputLabel/index.js +2 -0
  166. package/lib-module/InputSupports/InputSupports.js +88 -0
  167. package/lib-module/InputSupports/index.js +2 -0
  168. package/lib-module/InputSupports/useInputSupports.js +31 -0
  169. package/lib-module/Link/ChevronLink.js +51 -0
  170. package/lib-module/Link/InlinePressable.js +37 -0
  171. package/lib-module/Link/InlinePressable.native.js +85 -0
  172. package/lib-module/Link/Link.js +27 -0
  173. package/lib-module/Link/LinkBase.js +210 -0
  174. package/lib-module/Link/TextButton.js +43 -0
  175. package/lib-module/Link/index.js +5 -0
  176. package/lib-module/List/List.js +55 -0
  177. package/lib-module/List/ListItem.js +213 -0
  178. package/lib-module/List/index.js +5 -0
  179. package/lib-module/Modal/Modal.js +208 -0
  180. package/lib-module/Modal/dictionary.js +9 -0
  181. package/lib-module/Modal/index.js +2 -0
  182. package/lib-module/Notification/Notification.js +196 -0
  183. package/lib-module/Notification/dictionary.js +8 -0
  184. package/lib-module/Notification/index.js +2 -0
  185. package/lib-module/Pagination/PageButton.js +65 -0
  186. package/lib-module/Pagination/Pagination.js +140 -0
  187. package/lib-module/Pagination/SideButton.js +103 -0
  188. package/lib-module/Pagination/dictionary.js +18 -0
  189. package/lib-module/Pagination/index.js +2 -0
  190. package/lib-module/Pagination/usePagination.js +72 -0
  191. package/lib-module/Progress/Progress.js +85 -0
  192. package/lib-module/Progress/ProgressBar.js +134 -0
  193. package/lib-module/Progress/ProgressBarBackground.js +41 -0
  194. package/lib-module/Progress/index.js +4 -0
  195. package/lib-module/Radio/Radio.js +263 -0
  196. package/lib-module/Radio/RadioButton.js +128 -0
  197. package/lib-module/Radio/RadioGroup.js +225 -0
  198. package/lib-module/Radio/RadioInput.js +60 -0
  199. package/lib-module/Radio/RadioInput.native.js +6 -0
  200. package/lib-module/Radio/index.js +3 -0
  201. package/lib-module/RadioCard/RadioCard.js +218 -0
  202. package/lib-module/RadioCard/RadioCardGroup.js +232 -0
  203. package/lib-module/RadioCard/index.js +3 -0
  204. package/lib-module/Search/Search.js +233 -0
  205. package/lib-module/Search/dictionary.js +12 -0
  206. package/lib-module/Search/index.js +2 -0
  207. package/lib-module/Select/Group.js +20 -0
  208. package/lib-module/Select/Group.native.js +14 -0
  209. package/lib-module/Select/Item.js +17 -0
  210. package/lib-module/Select/Item.native.js +9 -0
  211. package/lib-module/Select/Picker.js +67 -0
  212. package/lib-module/Select/Picker.native.js +110 -0
  213. package/lib-module/Select/Select.js +317 -0
  214. package/lib-module/Select/index.js +6 -0
  215. package/lib-module/SideNav/Item.js +139 -0
  216. package/lib-module/SideNav/ItemContent.js +45 -0
  217. package/lib-module/SideNav/ItemsGroup.js +115 -0
  218. package/lib-module/SideNav/SideNav.js +133 -0
  219. package/lib-module/SideNav/index.js +1 -0
  220. package/lib-module/Skeleton/Skeleton.js +117 -0
  221. package/lib-module/Skeleton/index.js +2 -0
  222. package/lib-module/Skeleton/skeleton.constant.js +3 -0
  223. package/lib-module/Skeleton/skeletonWebAnimation.js +18 -0
  224. package/lib-module/Skeleton/useSkeletonNativeAnimation.js +24 -0
  225. package/lib-module/Spacer/Spacer.js +97 -0
  226. package/lib-module/Spacer/index.js +2 -0
  227. package/lib-module/StackView/StackView.js +124 -0
  228. package/lib-module/StackView/StackWrap.js +48 -0
  229. package/lib-module/StackView/StackWrap.native.js +3 -0
  230. package/lib-module/StackView/StackWrapBox.js +114 -0
  231. package/lib-module/StackView/StackWrapGap.js +58 -0
  232. package/lib-module/StackView/common.js +32 -0
  233. package/lib-module/StackView/getStackedContent.js +123 -0
  234. package/lib-module/StackView/index.js +5 -0
  235. package/lib-module/StepTracker/Step.js +229 -0
  236. package/lib-module/StepTracker/StepTracker.js +175 -0
  237. package/lib-module/StepTracker/dictionary.js +10 -0
  238. package/lib-module/StepTracker/index.js +2 -0
  239. package/lib-module/Tabs/Tabs.js +113 -0
  240. package/lib-module/Tabs/TabsItem.js +215 -0
  241. package/lib-module/Tabs/index.js +2 -0
  242. package/lib-module/Tags/Tags.js +238 -0
  243. package/lib-module/Tags/index.js +2 -0
  244. package/lib-module/TextInput/TextArea.js +88 -0
  245. package/lib-module/TextInput/TextInput.js +60 -0
  246. package/lib-module/TextInput/TextInputBase.js +233 -0
  247. package/lib-module/TextInput/index.js +3 -0
  248. package/lib-module/TextInput/propTypes.js +31 -0
  249. package/lib-module/ThemeProvider/ThemeProvider.js +35 -0
  250. package/lib-module/ThemeProvider/index.js +6 -0
  251. package/lib-module/ThemeProvider/useSetTheme.js +22 -0
  252. package/lib-module/ThemeProvider/useTheme.js +14 -0
  253. package/lib-module/ThemeProvider/useThemeTokens.js +105 -0
  254. package/lib-module/ThemeProvider/utils/index.js +2 -0
  255. package/lib-module/ThemeProvider/utils/styles.js +174 -0
  256. package/lib-module/ThemeProvider/utils/theme-tokens.js +151 -0
  257. package/lib-module/ToggleSwitch/ToggleSwitch.js +224 -0
  258. package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +202 -0
  259. package/lib-module/ToggleSwitch/index.js +3 -0
  260. package/lib-module/Tooltip/Backdrop.js +52 -0
  261. package/lib-module/Tooltip/Backdrop.native.js +43 -0
  262. package/lib-module/Tooltip/Tooltip.js +332 -0
  263. package/lib-module/Tooltip/dictionary.js +8 -0
  264. package/lib-module/Tooltip/getTooltipPosition.js +164 -0
  265. package/lib-module/Tooltip/index.js +2 -0
  266. package/lib-module/TooltipButton/TooltipButton.js +71 -0
  267. package/lib-module/TooltipButton/index.js +2 -0
  268. package/lib-module/Typography/Typography.js +118 -0
  269. package/lib-module/Typography/index.js +2 -0
  270. package/lib-module/ViewportProvider/ViewportProvider.js +28 -0
  271. package/lib-module/ViewportProvider/index.js +3 -0
  272. package/lib-module/ViewportProvider/useViewport.js +3 -0
  273. package/lib-module/ViewportProvider/useViewportListener.js +43 -0
  274. package/lib-module/index.js +48 -0
  275. package/lib-module/utils/a11y/index.js +2 -0
  276. package/lib-module/utils/a11y/semantics.js +154 -0
  277. package/lib-module/utils/a11y/textSize.js +34 -0
  278. package/lib-module/utils/animation/index.js +2 -0
  279. package/lib-module/utils/animation/useVerticalExpandAnimation.js +49 -0
  280. package/lib-module/utils/children.js +118 -0
  281. package/lib-module/utils/index.js +15 -0
  282. package/lib-module/utils/info/index.js +7 -0
  283. package/lib-module/utils/info/platform/index.js +11 -0
  284. package/lib-module/utils/info/platform/platform.android.js +1 -0
  285. package/lib-module/utils/info/platform/platform.ios.js +1 -0
  286. package/lib-module/utils/info/platform/platform.js +1 -0
  287. package/lib-module/utils/info/platform/platform.native.js +4 -0
  288. package/lib-module/utils/info/versions.js +5 -0
  289. package/lib-module/utils/input.js +180 -0
  290. package/lib-module/utils/pressability.js +97 -0
  291. package/lib-module/utils/props/a11yProps.js +140 -0
  292. package/lib-module/utils/props/clickProps.js +25 -0
  293. package/lib-module/utils/props/componentPropType.js +63 -0
  294. package/lib-module/utils/props/copyPropTypes.js +2 -0
  295. package/lib-module/utils/props/getPropSelector.js +6 -0
  296. package/lib-module/utils/props/hrefAttrsProp.js +30 -0
  297. package/lib-module/utils/props/index.js +16 -0
  298. package/lib-module/utils/props/inputSupportsProps.js +54 -0
  299. package/lib-module/utils/props/linkProps.js +47 -0
  300. package/lib-module/utils/props/paddingProp.js +9 -0
  301. package/lib-module/utils/props/pressProps.js +42 -0
  302. package/lib-module/utils/props/rectProp.js +9 -0
  303. package/lib-module/utils/props/responsiveProps.js +30 -0
  304. package/lib-module/utils/props/selectSystemProps.js +24 -0
  305. package/lib-module/utils/props/spacingProps.js +56 -0
  306. package/lib-module/utils/props/tokens.js +120 -0
  307. package/lib-module/utils/props/variantProp.js +18 -0
  308. package/lib-module/utils/props/viewProps.js +22 -0
  309. package/lib-module/utils/ssr.js +35 -0
  310. package/lib-module/utils/useCopy.js +42 -0
  311. package/lib-module/utils/useHash.js +44 -0
  312. package/lib-module/utils/useHash.native.js +7 -0
  313. package/lib-module/utils/useResponsiveProp.js +47 -0
  314. package/lib-module/utils/useSpacingScale.js +123 -0
  315. package/lib-module/utils/useUniqueId.js +12 -0
  316. package/lib-module/utils/withLinkRouter.js +82 -0
  317. package/package.json +9 -5
  318. package/src/A11yText/index.jsx +7 -3
  319. package/src/ActivityIndicator/Spinner.jsx +56 -44
  320. package/src/ActivityIndicator/Spinner.native.jsx +20 -12
  321. package/src/ActivityIndicator/index.jsx +1 -1
  322. package/src/Box/Box.jsx +15 -13
  323. package/src/Button/Button.jsx +1 -1
  324. package/src/Button/ButtonBase.jsx +9 -8
  325. package/src/Button/ButtonGroup.jsx +17 -8
  326. package/src/Button/ButtonLink.jsx +1 -1
  327. package/src/Button/propTypes.js +2 -1
  328. package/src/Card/Card.jsx +7 -4
  329. package/src/Card/CardBase.jsx +6 -5
  330. package/src/Card/PressableCardBase.jsx +12 -12
  331. package/src/Checkbox/Checkbox.jsx +12 -5
  332. package/src/Divider/Divider.jsx +19 -12
  333. package/src/ExpandCollapse/Control.jsx +12 -7
  334. package/src/ExpandCollapse/ExpandCollapse.jsx +13 -3
  335. package/src/ExpandCollapse/Panel.jsx +15 -5
  336. package/src/Feedback/Feedback.jsx +13 -3
  337. package/src/Fieldset/Fieldset.jsx +1 -1
  338. package/src/FlexGrid/FlexGrid.jsx +11 -5
  339. package/src/FlexGrid/helpers/index.js +1 -3
  340. package/src/HorizontalScroll/HorizontalScroll.jsx +12 -5
  341. package/src/IconButton/IconButton.jsx +12 -8
  342. package/src/InputLabel/InputLabel.jsx +16 -2
  343. package/src/InputSupports/InputSupports.jsx +1 -1
  344. package/src/Link/LinkBase.jsx +11 -10
  345. package/src/List/List.jsx +12 -5
  346. package/src/List/ListItem.jsx +16 -2
  347. package/src/Modal/Modal.jsx +63 -50
  348. package/src/Notification/Notification.jsx +23 -6
  349. package/src/Pagination/Pagination.jsx +10 -3
  350. package/src/Progress/Progress.jsx +5 -3
  351. package/src/Progress/ProgressBar.jsx +8 -6
  352. package/src/Radio/Radio.jsx +13 -5
  353. package/src/Radio/RadioButton.jsx +13 -3
  354. package/src/Radio/RadioGroup.jsx +14 -2
  355. package/src/RadioCard/RadioCard.jsx +9 -6
  356. package/src/RadioCard/RadioCardGroup.jsx +16 -4
  357. package/src/Search/Search.jsx +15 -3
  358. package/src/Select/Select.jsx +21 -7
  359. package/src/SideNav/Item.jsx +15 -7
  360. package/src/SideNav/SideNav.jsx +13 -2
  361. package/src/Skeleton/Skeleton.jsx +55 -43
  362. package/src/Spacer/Spacer.jsx +10 -18
  363. package/src/StackView/StackView.jsx +13 -12
  364. package/src/StackView/StackWrapBox.jsx +12 -12
  365. package/src/StackView/StackWrapGap.jsx +9 -7
  366. package/src/StackView/getStackedContent.jsx +1 -1
  367. package/src/StepTracker/Step.jsx +7 -4
  368. package/src/StepTracker/StepTracker.jsx +8 -8
  369. package/src/Tabs/Tabs.jsx +16 -3
  370. package/src/Tabs/TabsItem.jsx +13 -9
  371. package/src/Tags/Tags.jsx +16 -7
  372. package/src/TextInput/TextArea.jsx +20 -8
  373. package/src/TextInput/TextInput.jsx +20 -8
  374. package/src/TextInput/TextInputBase.jsx +13 -3
  375. package/src/ThemeProvider/useThemeTokens.js +3 -3
  376. package/src/ThemeProvider/utils/theme-tokens.js +3 -3
  377. package/src/ToggleSwitch/ToggleSwitch.jsx +12 -7
  378. package/src/ToggleSwitch/ToggleSwitchGroup.jsx +14 -6
  379. package/src/Tooltip/Tooltip.jsx +13 -3
  380. package/src/TooltipButton/TooltipButton.jsx +6 -4
  381. package/src/Typography/Typography.jsx +10 -6
  382. package/src/index.js +1 -1
  383. package/src/utils/a11y/semantics.js +3 -2
  384. package/src/utils/children.jsx +2 -1
  385. package/src/utils/index.js +2 -1
  386. package/src/utils/pressability.js +1 -1
  387. package/src/utils/props/a11yProps.js +151 -0
  388. package/src/utils/props/clickProps.js +31 -0
  389. package/src/utils/props/componentPropType.js +67 -0
  390. package/src/utils/props/copyPropTypes.js +3 -0
  391. package/src/utils/props/getPropSelector.js +14 -0
  392. package/src/utils/props/hrefAttrsProp.js +25 -0
  393. package/src/utils/props/index.js +16 -0
  394. package/src/{InputSupports/propTypes.js → utils/props/inputSupportsProps.js} +2 -4
  395. package/src/utils/props/linkProps.js +43 -0
  396. package/src/utils/props/paddingProp.js +10 -0
  397. package/src/utils/props/pressProps.js +45 -0
  398. package/src/utils/props/rectProp.js +10 -0
  399. package/src/utils/props/responsiveProps.js +30 -0
  400. package/src/utils/props/selectSystemProps.js +25 -0
  401. package/src/utils/props/spacingProps.js +58 -0
  402. package/src/utils/props/tokens.js +150 -0
  403. package/src/utils/props/variantProp.js +20 -0
  404. package/src/utils/props/viewProps.js +23 -0
  405. package/src/utils/ssr.js +35 -0
  406. package/src/utils/useResponsiveProp.js +1 -1
  407. package/src/utils/useSpacingScale.js +4 -4
  408. package/.ultra.cache.json +0 -1
  409. package/lib/utils/a11y/propTypes.js +0 -61
  410. package/lib/utils/a11y/propTypes.native.js +0 -47
  411. package/lib/utils/propTypes.js +0 -566
  412. package/release-context.json +0 -7
  413. package/src/utils/a11y/propTypes.js +0 -61
  414. package/src/utils/a11y/propTypes.native.js +0 -39
  415. package/src/utils/propTypes.js +0 -561
@@ -0,0 +1,208 @@
1
+ import React, { forwardRef } from 'react';
2
+ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
3
+ import TouchableWithoutFeedback from "react-native-web/dist/exports/TouchableWithoutFeedback";
4
+ import View from "react-native-web/dist/exports/View";
5
+ import NativeModal from "react-native-web/dist/exports/Modal";
6
+ import Platform from "react-native-web/dist/exports/Platform";
7
+ import PropTypes from 'prop-types';
8
+ import { applyShadowToken, useThemeTokens } from '../ThemeProvider';
9
+ import { a11yProps, copyPropTypes, getTokensPropType, selectSystemProps, useCopy, variantProp, viewProps } from '../utils';
10
+ import { useViewport } from '../ViewportProvider';
11
+ import ButtonBase from '../Button/ButtonBase';
12
+ import dictionary from './dictionary';
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { jsxs as _jsxs } from "react/jsx-runtime";
15
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
16
+
17
+ const selectContainerStyles = ({
18
+ containerPaddingLeft,
19
+ containerPaddingRight,
20
+ containerPaddingTop,
21
+ containerPaddingBottom,
22
+ maxWidth,
23
+ height
24
+ }) => ({
25
+ height,
26
+ maxWidth,
27
+ paddingLeft: containerPaddingLeft,
28
+ paddingRight: containerPaddingRight,
29
+ paddingTop: containerPaddingTop,
30
+ paddingBottom: containerPaddingBottom
31
+ });
32
+
33
+ const selectModalStyles = ({
34
+ backgroundColor,
35
+ borderRadius,
36
+ height,
37
+ paddingLeft,
38
+ paddingRight,
39
+ paddingTop,
40
+ paddingBottom,
41
+ shadow
42
+ }) => ({
43
+ backgroundColor,
44
+ borderRadius,
45
+ height,
46
+ paddingLeft,
47
+ paddingRight,
48
+ paddingTop,
49
+ paddingBottom,
50
+ ...applyShadowToken(shadow)
51
+ });
52
+
53
+ const selectBackdropStyles = ({
54
+ backdropColor,
55
+ backdropOpacity
56
+ }) => ({
57
+ backgroundColor: backdropColor,
58
+ opacity: backdropOpacity
59
+ });
60
+
61
+ const selectCloseButtonContainerStyles = ({
62
+ paddingRight,
63
+ paddingTop
64
+ }) => ({
65
+ paddingRight,
66
+ paddingTop
67
+ });
68
+
69
+ const selectCloseIconProps = ({
70
+ closeIconSize,
71
+ closeIconColor
72
+ }) => ({
73
+ size: closeIconSize,
74
+ color: closeIconColor
75
+ });
76
+ /**
77
+ * A modal window is a secondary window that opens on top of the main one.
78
+ * Users have to interact with it before they can carry out their task and return to the main window.
79
+ * Use to reveal additional information to a user after they have performed an explicit interaction.
80
+ * They are a strongly discouraged pattern; it's preferred to have all relevant information within a page,
81
+ * and irrelevant information either linked externally or omitted.
82
+ *
83
+ * - Must only appear after a customer interaction, not on page load or any other circumstance
84
+ * - Open a modal based on explicit customer action e.g. clicking on a button/link/form field
85
+ * - Only one modal should be "current" at any time
86
+ * - Read [WebAIM's documentation](https://www.w3.org/TR/wai-aria-practices/examples/dialog-modal/dialog.html) to create accessible modals
87
+ * - Don’t use modals to reinforce or repeat information already available in the parent page or view
88
+ * - Don’t use modals consecutively
89
+ */
90
+
91
+
92
+ const Modal = /*#__PURE__*/forwardRef(({
93
+ children,
94
+ isOpen,
95
+ onClose,
96
+ maxWidth,
97
+ tokens,
98
+ variant,
99
+ copy,
100
+ ...rest
101
+ }, ref) => {
102
+ const viewport = useViewport();
103
+ const themeTokens = useThemeTokens('Modal', tokens, variant, {
104
+ viewport,
105
+ maxWidth
106
+ });
107
+ const {
108
+ closeIcon: CloseIconComponent
109
+ } = themeTokens;
110
+ const getCopy = useCopy({
111
+ dictionary,
112
+ copy
113
+ });
114
+ const closeLabel = getCopy('closeButton');
115
+
116
+ const handleClose = () => {
117
+ if (typeof onClose === 'function') onClose();
118
+ };
119
+
120
+ const handleKeyUp = event => {
121
+ if (event.key === 'Escape') onClose();
122
+ };
123
+
124
+ if (!isOpen) {
125
+ return null;
126
+ } // TODO: replace the close button with IconButton when implemented (https://github.com/telus/universal-design-system/issues/281)
127
+
128
+
129
+ return /*#__PURE__*/_jsx(NativeModal, {
130
+ transparent: true,
131
+ ...selectProps(rest),
132
+ children: /*#__PURE__*/_jsxs(View, {
133
+ style: [staticStyles.positioningContainer],
134
+ children: [/*#__PURE__*/_jsx(View, {
135
+ style: [staticStyles.sizingContainer, selectContainerStyles(themeTokens)],
136
+ pointerEvents: "box-none" // don't capture backdrop press events
137
+ ,
138
+ children: /*#__PURE__*/_jsxs(View, {
139
+ ref: ref,
140
+ style: [staticStyles.modal, selectModalStyles(themeTokens)],
141
+ onKeyUp: handleKeyUp,
142
+ children: [/*#__PURE__*/_jsx(View, {
143
+ style: [staticStyles.closeButtonContainer, selectCloseButtonContainerStyles(themeTokens)],
144
+ children: /*#__PURE__*/_jsx(ButtonBase, {
145
+ onPress: handleClose,
146
+ accessibilityRole: "button",
147
+ accessibilityLabel: closeLabel,
148
+ children: // TODO: add close button interactive states after IconButton is done
149
+ () => /*#__PURE__*/_jsx(CloseIconComponent, { ...selectCloseIconProps(themeTokens)
150
+ })
151
+ })
152
+ }), children]
153
+ })
154
+ }), /*#__PURE__*/_jsx(TouchableWithoutFeedback, {
155
+ onPress: handleClose,
156
+ children: /*#__PURE__*/_jsx(View, {
157
+ style: [staticStyles.backdrop, selectBackdropStyles(themeTokens)]
158
+ })
159
+ })]
160
+ })
161
+ });
162
+ });
163
+ Modal.displayName = 'Modal';
164
+ Modal.propTypes = { ...selectedSystemPropTypes,
165
+ children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
166
+ copy: copyPropTypes,
167
+ isOpen: PropTypes.bool,
168
+ onClose: PropTypes.func,
169
+ maxWidth: PropTypes.bool,
170
+ tokens: getTokensPropType('Modal'),
171
+ variant: variantProp.propType
172
+ };
173
+ export default Modal;
174
+ const staticStyles = StyleSheet.create({
175
+ backdrop: {
176
+ position: 'absolute',
177
+ top: 0,
178
+ left: 0,
179
+ right: 0,
180
+ bottom: 0,
181
+ zIndex: -1,
182
+ ...Platform.select({
183
+ web: {
184
+ cursor: 'pointer'
185
+ }
186
+ })
187
+ },
188
+ positioningContainer: {
189
+ flexBasis: '100%',
190
+ alignItems: 'center',
191
+ justifyContent: 'center'
192
+ },
193
+ sizingContainer: {
194
+ maxHeight: '100%',
195
+ // so that the container can expand up to the full viewport height
196
+ width: '100%' // ensure that the modal actually expands to the set maxWidth
197
+
198
+ },
199
+ modal: {
200
+ maxHeight: '100%' // so that the modal can expand vertically up to the sizing container's height (exclusive of its vertical padding)
201
+
202
+ },
203
+ closeButtonContainer: {
204
+ position: 'absolute',
205
+ top: 0,
206
+ right: 0
207
+ }
208
+ });
@@ -0,0 +1,9 @@
1
+ export default {
2
+ en: {
3
+ // English text from TDS Community `Modal`
4
+ closeButton: 'Close'
5
+ },
6
+ fr: {
7
+ closeButton: 'Fermer'
8
+ }
9
+ };
@@ -0,0 +1,2 @@
1
+ import Modal from './Modal';
2
+ export default Modal;
@@ -0,0 +1,196 @@
1
+ import React, { forwardRef, useState } from 'react';
2
+ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
3
+ import View from "react-native-web/dist/exports/View";
4
+ import PropTypes from 'prop-types';
5
+ import { applyTextStyles, useThemeTokens } from '../ThemeProvider';
6
+ import { a11yProps, getTokensPropType, selectSystemProps, selectTokens, variantProp, viewProps, wrapStringsInText } from '../utils';
7
+ import ButtonBase from '../Button/ButtonBase';
8
+ import useCopy from '../utils/useCopy';
9
+ import dictionary from './dictionary';
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
12
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
13
+
14
+ const selectContainerStyles = tokens => ({ ...tokens
15
+ });
16
+
17
+ const selectTextStyles = tokens => applyTextStyles(selectTokens('Typography', tokens));
18
+
19
+ const selectIconProps = ({
20
+ iconSize,
21
+ iconColor
22
+ }) => ({
23
+ size: iconSize,
24
+ color: iconColor
25
+ });
26
+
27
+ const selectIconContainerStyles = ({
28
+ iconGap
29
+ }) => ({
30
+ paddingRight: iconGap
31
+ });
32
+
33
+ const selectDismissIconProps = ({
34
+ dismissIconSize,
35
+ dismissIconColor
36
+ }) => ({
37
+ size: dismissIconSize,
38
+ color: dismissIconColor
39
+ });
40
+
41
+ const selectDismissButtonContainerStyles = ({
42
+ dismissButtonGap
43
+ }) => ({
44
+ paddingLeft: dismissButtonGap
45
+ });
46
+ /**
47
+ * A banner that highlights important messages:
48
+ * - Status message to show there is an error or outage of services
49
+ * - Confirmation message in response to user action
50
+ * - Account information letting the user know they have almost used all their data
51
+ *
52
+ * ## Usage criteria
53
+ * - Use simple text content only, such as bold test or links. Don’t use other complex components or paragraphs
54
+ * - Show notifications before the content that the message is related to, otherwise show at the top of the main content
55
+ * - Show system notifications at the top of the page, below the navigation, and expands the full-width of the viewport
56
+ * - When showing multiple notifications, show them in order of importance from top to bottom
57
+ * - Use variants to visually show the type of message contained within the Notification.
58
+ * - The icon and colour will indicate meaning and importance
59
+ *
60
+ * ### Variants
61
+ * - Use `variant.style` to set the visual style of the notification
62
+ * - Use `dismissible` prop to enable dismissible functionality
63
+ * - Use `system` prop to set the visual style of the notification and denote an announcement from the system or application
64
+ *
65
+ * ### When to use the system prop?
66
+ * - Use `system` to show system-based messages coming from the application
67
+ * - Don’t use `system` when the message is in response to user action
68
+ *
69
+ * ## Variants
70
+ *
71
+ * #### Success
72
+ * Use the success variant to provide feedback of a successful operation. The message will include an icon to indicate meaning and importance.
73
+ *
74
+ * #### Warning
75
+ * Use the warning variant to provide feedback of a warning; users would still be able to proceed forward.
76
+ * The message will include an icon to indicate meaning and importance.
77
+ *
78
+ * #### Error
79
+ * Use the error variant to provide feedback of a failed operation. The message will include an icon to indicate meaning and importance.
80
+ *
81
+ * #### Dismissible
82
+ * Dismissible notifications should only be used for default or success notifications where there is no action needed from the user.
83
+ * If the information is passive then it should be dismissible as indicated by an interactive close button on the far right.
84
+ * If the notification requires an action then make the option(s) clear with a `ChevronLink` or `Link`.
85
+ *
86
+ * Use the `dismissible` prop to allow users to dismiss the Notification at any time. Once dismissed, the Notification is removed from the DOM.
87
+ *
88
+ * Please note:
89
+ *
90
+ * - Default and Success variants are dismissible
91
+ * - Error and Warning variants are not dismissible
92
+ *
93
+ * #### System message
94
+ * Use full-width `Notifications` to show system-based messages coming from the application, not in response to user action.
95
+ * Show system notifications at the top of the page, below the navigation, and expands the full-width of the viewport
96
+ */
97
+
98
+
99
+ const Notification = /*#__PURE__*/forwardRef(({
100
+ children,
101
+ system,
102
+ dismissible,
103
+ copy = 'en',
104
+ tokens,
105
+ variant,
106
+ ...rest
107
+ }, ref) => {
108
+ const [isDismissed, setIsDismissed] = useState(false);
109
+ const themeTokens = useThemeTokens('Notification', tokens, variant, {
110
+ system
111
+ });
112
+ const getCopy = useCopy({
113
+ dictionary,
114
+ copy
115
+ });
116
+
117
+ if (isDismissed) {
118
+ return null;
119
+ }
120
+
121
+ const textStyles = selectTextStyles(themeTokens);
122
+ const content = wrapStringsInText(typeof children === 'function' ? children({
123
+ textStyles
124
+ }) : children, {
125
+ style: textStyles
126
+ });
127
+ const {
128
+ icon: IconComponent,
129
+ dismissIcon: DismissIconComponent
130
+ } = themeTokens;
131
+
132
+ const onDismissPress = () => setIsDismissed(true); // TODO: replace the dismiss button with IconButton when implemented (https://github.com/telus/universal-design-system/issues/281)
133
+
134
+
135
+ return /*#__PURE__*/_jsxs(View, {
136
+ ref: ref,
137
+ style: [staticStyles.container, selectContainerStyles(themeTokens)],
138
+ ...selectProps(rest),
139
+ children: [IconComponent && /*#__PURE__*/_jsx(View, {
140
+ style: selectIconContainerStyles(themeTokens),
141
+ children: /*#__PURE__*/_jsx(IconComponent, { ...selectIconProps(themeTokens)
142
+ })
143
+ }), /*#__PURE__*/_jsx(View, {
144
+ style: staticStyles.contentContainer,
145
+ children: content && typeof content === 'function' ? content({
146
+ textStyles,
147
+ variant
148
+ }) : content
149
+ }), dismissible && DismissIconComponent && /*#__PURE__*/_jsx(View, {
150
+ style: selectDismissButtonContainerStyles(themeTokens),
151
+ children: /*#__PURE__*/_jsx(ButtonBase, {
152
+ onPress: onDismissPress,
153
+ accessibilityRole: "button",
154
+ accessibilityLabel: getCopy('dismiss'),
155
+ children: () => /*#__PURE__*/_jsx(DismissIconComponent, { ...selectDismissIconProps(themeTokens)
156
+ })
157
+ })
158
+ })]
159
+ });
160
+ });
161
+ Notification.displayName = 'Notification';
162
+ Notification.propTypes = { ...selectedSystemPropTypes,
163
+
164
+ /**
165
+ * Content of the `Notification`.
166
+ */
167
+ children: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.func]),
168
+
169
+ /**
170
+ * Use `system` prop to set the visual style of the notification and denote an announcement from the system or application
171
+ */
172
+ system: PropTypes.bool,
173
+
174
+ /**
175
+ * Use the `dismissible` prop to allow users to dismiss the Notification at any time.
176
+ */
177
+ dismissible: PropTypes.bool,
178
+
179
+ /**
180
+ * Select english or french copy for the accessible label of the dismiss button.
181
+ */
182
+ copy: PropTypes.oneOfType([PropTypes.oneOf(['en', 'fr']), PropTypes.shape({
183
+ dismiss: PropTypes.string
184
+ })]),
185
+ tokens: getTokensPropType('Notification'),
186
+ variant: variantProp.propType
187
+ };
188
+ export default Notification;
189
+ const staticStyles = StyleSheet.create({
190
+ container: {
191
+ flexDirection: 'row'
192
+ },
193
+ contentContainer: {
194
+ flex: 1
195
+ }
196
+ });
@@ -0,0 +1,8 @@
1
+ export default {
2
+ en: {
3
+ dismiss: 'Close'
4
+ },
5
+ fr: {
6
+ dismiss: 'Fermer'
7
+ }
8
+ };
@@ -0,0 +1,2 @@
1
+ import Notification from './Notification';
2
+ export default Notification;
@@ -0,0 +1,65 @@
1
+ import React, { forwardRef } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import ButtonBase from '../Button/ButtonBase';
4
+ import { useThemeTokensCallback } from '../ThemeProvider';
5
+ import { a11yProps, copyPropTypes, getTokensPropType, hrefAttrsProp, linkProps, selectTokens, variantProp, withLinkRouter } from '../utils';
6
+ import useCopy from '../utils/useCopy';
7
+ import dictionary from './dictionary';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ const PageButton = /*#__PURE__*/forwardRef(({
10
+ label,
11
+ onPress,
12
+ href,
13
+ isActive,
14
+ copy,
15
+ variant,
16
+ tokens,
17
+ ...props
18
+ }, ref) => {
19
+ const getTokens = useThemeTokensCallback('PaginationPageButton', tokens, variant);
20
+ const getCopy = useCopy({
21
+ dictionary,
22
+ copy
23
+ });
24
+
25
+ const getButtonTokens = buttonState => selectTokens('Button', getTokens(buttonState));
26
+
27
+ const activeProps = isActive ? {
28
+ selected: true,
29
+ ...a11yProps.nonFocusableProps,
30
+ // a brute fix for the focus state being stuck on an active item since it becomes non-focusable
31
+ // (see https://github.com/telus/universal-design-system/pull/577#issuecomment-931344107)
32
+ key: 'active-item'
33
+ } : {};
34
+ const accessibilityRole = href !== undefined ? 'link' : 'button';
35
+ const activeLabel = isActive ? ` ${getCopy('currentLabel')}` : '';
36
+ const accessibilityLabel = `${getCopy('goToLabel')} ${label}${activeLabel}`;
37
+ const {
38
+ hrefAttrs,
39
+ rest
40
+ } = hrefAttrsProp.bundle(props);
41
+ const buttonProps = {
42
+ accessibilityRole,
43
+ accessibilityLabel,
44
+ onPress,
45
+ href,
46
+ hrefAttrs,
47
+ ...rest
48
+ };
49
+ return /*#__PURE__*/_jsx(ButtonBase, {
50
+ ref: ref,
51
+ ...buttonProps,
52
+ tokens: getButtonTokens,
53
+ ...activeProps,
54
+ children: label
55
+ });
56
+ });
57
+ PageButton.displayName = 'PageButton';
58
+ PageButton.propTypes = { ...linkProps.types,
59
+ label: PropTypes.string,
60
+ isActive: PropTypes.bool,
61
+ copy: copyPropTypes,
62
+ variant: variantProp.propType,
63
+ tokens: getTokensPropType('PaginationPageButton')
64
+ };
65
+ export default withLinkRouter(PageButton);
@@ -0,0 +1,140 @@
1
+ import React, { forwardRef } from 'react';
2
+ import View from "react-native-web/dist/exports/View";
3
+ import Text from "react-native-web/dist/exports/Text";
4
+ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
5
+ import { a11yProps, componentPropType, copyPropTypes, getTokensPropType, selectSystemProps, variantProp, viewProps, withLinkRouter } from '../utils';
6
+ import { applyTextStyles, useThemeTokens } from '../ThemeProvider';
7
+ import { useViewport } from '../ViewportProvider';
8
+ import Box from '../Box';
9
+ import usePagination from './usePagination';
10
+ import PageButton from './PageButton';
11
+ import SideButton from './SideButton';
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
14
+
15
+ const selectTextStyles = ({
16
+ color,
17
+ fontName,
18
+ fontSize,
19
+ fontWeight,
20
+ lineHeight
21
+ }) => applyTextStyles({
22
+ color,
23
+ fontName,
24
+ fontSize,
25
+ fontWeight,
26
+ lineHeight
27
+ });
28
+
29
+ const Pagination = /*#__PURE__*/forwardRef(({
30
+ children,
31
+ copy = 'en',
32
+ variant,
33
+ tokens,
34
+ sideButtonVariant,
35
+ sideButtonTokens,
36
+ LinkRouter,
37
+ linkRouterProps,
38
+ ...rest
39
+ }, ref) => {
40
+ const viewport = useViewport();
41
+ const {
42
+ truncateAbove,
43
+ gap,
44
+ ...themeTokens
45
+ } = useThemeTokens('Pagination', tokens, variant, {
46
+ viewport
47
+ });
48
+ const items = React.Children.toArray(children);
49
+ const {
50
+ isItemActive,
51
+ getItemProps,
52
+ showPrevious,
53
+ showNext,
54
+ nextItemProps,
55
+ previousItemProps,
56
+ shouldRenderButton,
57
+ shouldRenderEllipsis
58
+ } = usePagination({
59
+ items,
60
+ truncateAbove
61
+ });
62
+ const ellipsisTextStyles = selectTextStyles(themeTokens);
63
+
64
+ if (items.length === 0) {
65
+ return null;
66
+ } // TODO: replace with a spacing component when https://github.com/telus/universal-design-system/pull/531 is implemented
67
+ // concatenate all items to easily wrap them in identical spacing components
68
+
69
+
70
+ const buttons = [showPrevious && /*#__PURE__*/_jsx(SideButton, { ...previousItemProps,
71
+ direction: "previous",
72
+ copy: copy,
73
+ variant: sideButtonVariant,
74
+ tokens: sideButtonTokens,
75
+ LinkRouter: LinkRouter,
76
+ linkRouterProps: linkRouterProps
77
+ }), ...items.map((_child, itemIndex) => {
78
+ const buttonLabel = `${itemIndex + 1}`;
79
+ const itemProps = getItemProps(itemIndex);
80
+ const ItemLinkRouter = itemProps.LinkRouter ?? LinkRouter;
81
+ const itemLinkRouterProps = { ...linkRouterProps,
82
+ ...itemProps.linkRouterProps
83
+ };
84
+
85
+ if (shouldRenderButton(itemIndex)) {
86
+ return /*#__PURE__*/_jsx(PageButton, { ...itemProps,
87
+ LinkRouter: ItemLinkRouter,
88
+ linkRouterProps: itemLinkRouterProps,
89
+ label: buttonLabel,
90
+ copy: copy,
91
+ isActive: isItemActive(itemIndex)
92
+ });
93
+ }
94
+
95
+ if (shouldRenderEllipsis(itemIndex)) {
96
+ return /*#__PURE__*/_jsx(Text, {
97
+ style: ellipsisTextStyles,
98
+ children: "..."
99
+ });
100
+ }
101
+
102
+ return null;
103
+ }), showNext && /*#__PURE__*/_jsx(SideButton, { ...nextItemProps,
104
+ direction: "next",
105
+ copy: copy,
106
+ variant: sideButtonVariant,
107
+ tokens: sideButtonTokens,
108
+ LinkRouter: LinkRouter,
109
+ linkRouterProps: linkRouterProps
110
+ })];
111
+ return /*#__PURE__*/_jsx(View, {
112
+ style: staticStyles.container,
113
+ ref: ref,
114
+ ...selectProps(rest),
115
+ children: buttons // keep the keys in-line with the page numbers regardless of which buttons are actually rendered
116
+ .map((element, index) => [element, `page-${index + 1}`]).filter(([element]) => element !== null).map(([element, key]) => /*#__PURE__*/_jsx(Box, {
117
+ right: gap,
118
+ children: element
119
+ }, key))
120
+ });
121
+ });
122
+ PageButton.displayName = 'PageButton';
123
+ Pagination.PageButton = PageButton;
124
+ Pagination.propTypes = { ...selectedSystemPropTypes,
125
+ ...withLinkRouter.propTypes,
126
+ children: componentPropType('PageButton'),
127
+ copy: copyPropTypes,
128
+ variant: variantProp.propType,
129
+ tokens: getTokensPropType('Pagination'),
130
+ sideButtonVariant: variantProp.propType,
131
+ sideButtonTokens: getTokensPropType('PaginationSideButton')
132
+ };
133
+ const staticStyles = StyleSheet.create({
134
+ container: {
135
+ flexDirection: 'row',
136
+ flexWrap: 'wrap',
137
+ alignItems: 'center'
138
+ }
139
+ });
140
+ export default Pagination;