@telus-uds/components-base 1.3.0 → 1.3.1

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 (342) hide show
  1. package/.turbo/turbo-build.log +5 -2
  2. package/CHANGELOG.json +38 -0
  3. package/CHANGELOG.md +15 -2
  4. package/__tests__/ActivityIndicator/ActivityIndicator.test.jsx +35 -0
  5. package/__tests__/ActivityIndicator/__snapshots__/ActivityIndicator.test.jsx.snap +287 -0
  6. package/babel.config.js +27 -5
  7. package/component-docs.json +88 -424
  8. package/lib/A11yText/index.js +5 -4
  9. package/lib/ActivityIndicator/Spinner.js +46 -37
  10. package/lib/ActivityIndicator/Spinner.native.js +26 -15
  11. package/lib/Box/Box.js +4 -4
  12. package/lib/Button/ButtonBase.js +7 -8
  13. package/lib/Card/Card.js +5 -4
  14. package/lib/Card/PressableCardBase.js +6 -11
  15. package/lib/Checkbox/Checkbox.js +4 -6
  16. package/lib/Divider/Divider.js +12 -11
  17. package/lib/ExpandCollapse/Control.js +7 -7
  18. package/lib/ExpandCollapse/ExpandCollapse.js +6 -2
  19. package/lib/ExpandCollapse/Panel.js +6 -7
  20. package/lib/Feedback/Feedback.js +6 -5
  21. package/lib/Fieldset/Fieldset.js +1 -3
  22. package/lib/HorizontalScroll/HorizontalScroll.js +5 -6
  23. package/lib/IconButton/IconButton.js +6 -6
  24. package/lib/InputLabel/InputLabel.js +7 -2
  25. package/lib/InputSupports/InputSupports.js +2 -2
  26. package/lib/Link/LinkBase.js +5 -6
  27. package/lib/List/List.js +4 -6
  28. package/lib/List/ListItem.js +6 -2
  29. package/lib/Modal/Modal.js +6 -2
  30. package/lib/Notification/Notification.js +7 -2
  31. package/lib/Pagination/Pagination.js +8 -3
  32. package/lib/Progress/Progress.js +5 -4
  33. package/lib/Progress/ProgressBar.js +8 -7
  34. package/lib/Radio/Radio.js +4 -6
  35. package/lib/Radio/RadioButton.js +6 -3
  36. package/lib/Radio/RadioGroup.js +7 -2
  37. package/lib/RadioCard/RadioCard.js +4 -4
  38. package/lib/RadioCard/RadioCardGroup.js +9 -6
  39. package/lib/Search/Search.js +7 -2
  40. package/lib/Select/Select.js +10 -9
  41. package/lib/SideNav/Item.js +7 -7
  42. package/lib/SideNav/SideNav.js +7 -3
  43. package/lib/Skeleton/Skeleton.js +6 -2
  44. package/lib/Spacer/Spacer.js +7 -18
  45. package/lib/StackView/StackView.js +7 -7
  46. package/lib/StackView/StackWrapBox.js +6 -7
  47. package/lib/StackView/StackWrapGap.js +6 -5
  48. package/lib/StepTracker/Step.js +7 -3
  49. package/lib/StepTracker/StepTracker.js +7 -7
  50. package/lib/Tabs/Tabs.js +6 -2
  51. package/lib/Tabs/TabsItem.js +6 -5
  52. package/lib/Tags/Tags.js +5 -6
  53. package/lib/TextInput/TextArea.js +13 -14
  54. package/lib/TextInput/TextInput.js +13 -14
  55. package/lib/TextInput/TextInputBase.js +5 -3
  56. package/lib/ToggleSwitch/ToggleSwitch.js +10 -9
  57. package/lib/ToggleSwitch/ToggleSwitchGroup.js +5 -7
  58. package/lib/Tooltip/Tooltip.js +7 -2
  59. package/lib/TooltipButton/TooltipButton.js +7 -2
  60. package/lib/Typography/Typography.js +8 -6
  61. package/lib/index.js +7 -0
  62. package/lib/utils/children.js +5 -1
  63. package/lib/utils/index.js +14 -0
  64. package/lib/utils/props/index.js +9 -0
  65. package/lib/{InputSupports/propTypes.js → utils/props/inputSupportsProps.js} +2 -3
  66. package/lib/utils/ssr.js +51 -0
  67. package/lib-module/A11yInfoProvider/index.js +62 -0
  68. package/lib-module/A11yText/index.js +55 -0
  69. package/lib-module/ActivityIndicator/Spinner.js +76 -0
  70. package/lib-module/ActivityIndicator/Spinner.native.js +143 -0
  71. package/lib-module/ActivityIndicator/index.js +40 -0
  72. package/lib-module/ActivityIndicator/shared.js +12 -0
  73. package/lib-module/BaseProvider/index.js +26 -0
  74. package/lib-module/Box/Box.js +243 -0
  75. package/lib-module/Box/index.js +2 -0
  76. package/lib-module/Button/Button.js +25 -0
  77. package/lib-module/Button/ButtonBase.js +254 -0
  78. package/lib-module/Button/ButtonGroup.js +164 -0
  79. package/lib-module/Button/ButtonLink.js +39 -0
  80. package/lib-module/Button/index.js +4 -0
  81. package/lib-module/Button/propTypes.js +36 -0
  82. package/lib-module/Card/Card.js +83 -0
  83. package/lib-module/Card/CardBase.js +62 -0
  84. package/lib-module/Card/PressableCardBase.js +113 -0
  85. package/lib-module/Card/index.js +4 -0
  86. package/lib-module/Checkbox/Checkbox.js +321 -0
  87. package/lib-module/Checkbox/CheckboxGroup.js +218 -0
  88. package/lib-module/Checkbox/CheckboxInput.js +58 -0
  89. package/lib-module/Checkbox/CheckboxInput.native.js +6 -0
  90. package/lib-module/Checkbox/index.js +3 -0
  91. package/lib-module/Divider/Divider.js +123 -0
  92. package/lib-module/Divider/index.js +2 -0
  93. package/lib-module/ExpandCollapse/Accordion.js +15 -0
  94. package/lib-module/ExpandCollapse/Control.js +130 -0
  95. package/lib-module/ExpandCollapse/ExpandCollapse.js +94 -0
  96. package/lib-module/ExpandCollapse/Panel.js +158 -0
  97. package/lib-module/ExpandCollapse/index.js +7 -0
  98. package/lib-module/Feedback/Feedback.js +144 -0
  99. package/lib-module/Feedback/index.js +2 -0
  100. package/lib-module/Fieldset/Fieldset.js +145 -0
  101. package/lib-module/Fieldset/FieldsetContainer.js +29 -0
  102. package/lib-module/Fieldset/FieldsetContainer.native.js +20 -0
  103. package/lib-module/Fieldset/Legend.js +21 -0
  104. package/lib-module/Fieldset/Legend.native.js +28 -0
  105. package/lib-module/Fieldset/cssReset.js +14 -0
  106. package/lib-module/Fieldset/index.js +2 -0
  107. package/lib-module/FlexGrid/Col/Col.js +265 -0
  108. package/lib-module/FlexGrid/Col/index.js +2 -0
  109. package/lib-module/FlexGrid/FlexGrid.js +147 -0
  110. package/lib-module/FlexGrid/Row/Row.js +177 -0
  111. package/lib-module/FlexGrid/Row/index.js +2 -0
  112. package/lib-module/FlexGrid/helpers/index.js +18 -0
  113. package/lib-module/FlexGrid/index.js +2 -0
  114. package/lib-module/FlexGrid/providers/GutterContext.js +3 -0
  115. package/lib-module/HorizontalScroll/HorizontalScroll.js +171 -0
  116. package/lib-module/HorizontalScroll/HorizontalScrollButton.js +102 -0
  117. package/lib-module/HorizontalScroll/ScrollViewEnd.js +47 -0
  118. package/lib-module/HorizontalScroll/ScrollViewEnd.native.js +24 -0
  119. package/lib-module/HorizontalScroll/dictionary.js +11 -0
  120. package/lib-module/HorizontalScroll/index.js +11 -0
  121. package/lib-module/HorizontalScroll/itemPositions.js +106 -0
  122. package/lib-module/Icon/Icon.js +61 -0
  123. package/lib-module/Icon/IconText.js +81 -0
  124. package/lib-module/Icon/index.js +4 -0
  125. package/lib-module/IconButton/IconButton.js +115 -0
  126. package/lib-module/IconButton/index.js +2 -0
  127. package/lib-module/InputLabel/InputLabel.js +131 -0
  128. package/lib-module/InputLabel/LabelContent.js +24 -0
  129. package/lib-module/InputLabel/LabelContent.native.js +16 -0
  130. package/lib-module/InputLabel/index.js +2 -0
  131. package/lib-module/InputSupports/InputSupports.js +88 -0
  132. package/lib-module/InputSupports/index.js +2 -0
  133. package/lib-module/InputSupports/useInputSupports.js +31 -0
  134. package/lib-module/Link/ChevronLink.js +51 -0
  135. package/lib-module/Link/InlinePressable.js +37 -0
  136. package/lib-module/Link/InlinePressable.native.js +85 -0
  137. package/lib-module/Link/Link.js +27 -0
  138. package/lib-module/Link/LinkBase.js +210 -0
  139. package/lib-module/Link/TextButton.js +43 -0
  140. package/lib-module/Link/index.js +5 -0
  141. package/lib-module/List/List.js +55 -0
  142. package/lib-module/List/ListItem.js +213 -0
  143. package/lib-module/List/index.js +5 -0
  144. package/lib-module/Modal/Modal.js +208 -0
  145. package/lib-module/Modal/dictionary.js +9 -0
  146. package/lib-module/Modal/index.js +2 -0
  147. package/lib-module/Notification/Notification.js +196 -0
  148. package/lib-module/Notification/dictionary.js +8 -0
  149. package/lib-module/Notification/index.js +2 -0
  150. package/lib-module/Pagination/PageButton.js +65 -0
  151. package/lib-module/Pagination/Pagination.js +140 -0
  152. package/lib-module/Pagination/SideButton.js +103 -0
  153. package/lib-module/Pagination/dictionary.js +18 -0
  154. package/lib-module/Pagination/index.js +2 -0
  155. package/lib-module/Pagination/usePagination.js +72 -0
  156. package/lib-module/Progress/Progress.js +85 -0
  157. package/lib-module/Progress/ProgressBar.js +134 -0
  158. package/lib-module/Progress/ProgressBarBackground.js +41 -0
  159. package/lib-module/Progress/index.js +4 -0
  160. package/lib-module/Radio/Radio.js +263 -0
  161. package/lib-module/Radio/RadioButton.js +128 -0
  162. package/lib-module/Radio/RadioGroup.js +225 -0
  163. package/lib-module/Radio/RadioInput.js +60 -0
  164. package/lib-module/Radio/RadioInput.native.js +6 -0
  165. package/lib-module/Radio/index.js +3 -0
  166. package/lib-module/RadioCard/RadioCard.js +218 -0
  167. package/lib-module/RadioCard/RadioCardGroup.js +232 -0
  168. package/lib-module/RadioCard/index.js +3 -0
  169. package/lib-module/Search/Search.js +233 -0
  170. package/lib-module/Search/dictionary.js +12 -0
  171. package/lib-module/Search/index.js +2 -0
  172. package/lib-module/Select/Group.js +20 -0
  173. package/lib-module/Select/Group.native.js +14 -0
  174. package/lib-module/Select/Item.js +17 -0
  175. package/lib-module/Select/Item.native.js +9 -0
  176. package/lib-module/Select/Picker.js +67 -0
  177. package/lib-module/Select/Picker.native.js +110 -0
  178. package/lib-module/Select/Select.js +317 -0
  179. package/lib-module/Select/index.js +6 -0
  180. package/lib-module/SideNav/Item.js +139 -0
  181. package/lib-module/SideNav/ItemContent.js +45 -0
  182. package/lib-module/SideNav/ItemsGroup.js +115 -0
  183. package/lib-module/SideNav/SideNav.js +133 -0
  184. package/lib-module/SideNav/index.js +1 -0
  185. package/lib-module/Skeleton/Skeleton.js +117 -0
  186. package/lib-module/Skeleton/index.js +2 -0
  187. package/lib-module/Skeleton/skeleton.constant.js +3 -0
  188. package/lib-module/Skeleton/skeletonWebAnimation.js +18 -0
  189. package/lib-module/Skeleton/useSkeletonNativeAnimation.js +24 -0
  190. package/lib-module/Spacer/Spacer.js +97 -0
  191. package/lib-module/Spacer/index.js +2 -0
  192. package/lib-module/StackView/StackView.js +124 -0
  193. package/lib-module/StackView/StackWrap.js +48 -0
  194. package/lib-module/StackView/StackWrap.native.js +3 -0
  195. package/lib-module/StackView/StackWrapBox.js +114 -0
  196. package/lib-module/StackView/StackWrapGap.js +58 -0
  197. package/lib-module/StackView/common.js +32 -0
  198. package/lib-module/StackView/getStackedContent.js +123 -0
  199. package/lib-module/StackView/index.js +5 -0
  200. package/lib-module/StepTracker/Step.js +229 -0
  201. package/lib-module/StepTracker/StepTracker.js +175 -0
  202. package/lib-module/StepTracker/dictionary.js +10 -0
  203. package/lib-module/StepTracker/index.js +2 -0
  204. package/lib-module/Tabs/Tabs.js +113 -0
  205. package/lib-module/Tabs/TabsItem.js +215 -0
  206. package/lib-module/Tabs/index.js +2 -0
  207. package/lib-module/Tags/Tags.js +238 -0
  208. package/lib-module/Tags/index.js +2 -0
  209. package/lib-module/TextInput/TextArea.js +88 -0
  210. package/lib-module/TextInput/TextInput.js +60 -0
  211. package/lib-module/TextInput/TextInputBase.js +233 -0
  212. package/lib-module/TextInput/index.js +3 -0
  213. package/lib-module/TextInput/propTypes.js +31 -0
  214. package/lib-module/ThemeProvider/ThemeProvider.js +35 -0
  215. package/lib-module/ThemeProvider/index.js +6 -0
  216. package/lib-module/ThemeProvider/useSetTheme.js +22 -0
  217. package/lib-module/ThemeProvider/useTheme.js +14 -0
  218. package/lib-module/ThemeProvider/useThemeTokens.js +105 -0
  219. package/lib-module/ThemeProvider/utils/index.js +2 -0
  220. package/lib-module/ThemeProvider/utils/styles.js +174 -0
  221. package/lib-module/ThemeProvider/utils/theme-tokens.js +151 -0
  222. package/lib-module/ToggleSwitch/ToggleSwitch.js +224 -0
  223. package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +202 -0
  224. package/lib-module/ToggleSwitch/index.js +3 -0
  225. package/lib-module/Tooltip/Backdrop.js +52 -0
  226. package/lib-module/Tooltip/Backdrop.native.js +43 -0
  227. package/lib-module/Tooltip/Tooltip.js +332 -0
  228. package/lib-module/Tooltip/dictionary.js +8 -0
  229. package/lib-module/Tooltip/getTooltipPosition.js +164 -0
  230. package/lib-module/Tooltip/index.js +2 -0
  231. package/lib-module/TooltipButton/TooltipButton.js +71 -0
  232. package/lib-module/TooltipButton/index.js +2 -0
  233. package/lib-module/Typography/Typography.js +118 -0
  234. package/lib-module/Typography/index.js +2 -0
  235. package/lib-module/ViewportProvider/ViewportProvider.js +28 -0
  236. package/lib-module/ViewportProvider/index.js +3 -0
  237. package/lib-module/ViewportProvider/useViewport.js +3 -0
  238. package/lib-module/ViewportProvider/useViewportListener.js +43 -0
  239. package/lib-module/index.js +48 -0
  240. package/lib-module/utils/a11y/index.js +2 -0
  241. package/lib-module/utils/a11y/semantics.js +154 -0
  242. package/lib-module/utils/a11y/textSize.js +34 -0
  243. package/lib-module/utils/animation/index.js +2 -0
  244. package/lib-module/utils/animation/useVerticalExpandAnimation.js +49 -0
  245. package/lib-module/utils/children.js +118 -0
  246. package/lib-module/utils/index.js +15 -0
  247. package/lib-module/utils/info/index.js +7 -0
  248. package/lib-module/utils/info/platform/index.js +11 -0
  249. package/lib-module/utils/info/platform/platform.android.js +1 -0
  250. package/lib-module/utils/info/platform/platform.ios.js +1 -0
  251. package/lib-module/utils/info/platform/platform.js +1 -0
  252. package/lib-module/utils/info/platform/platform.native.js +4 -0
  253. package/lib-module/utils/info/versions.js +5 -0
  254. package/lib-module/utils/input.js +180 -0
  255. package/lib-module/utils/pressability.js +97 -0
  256. package/lib-module/utils/props/a11yProps.js +140 -0
  257. package/lib-module/utils/props/clickProps.js +25 -0
  258. package/lib-module/utils/props/componentPropType.js +63 -0
  259. package/lib-module/utils/props/copyPropTypes.js +2 -0
  260. package/lib-module/utils/props/getPropSelector.js +6 -0
  261. package/lib-module/utils/props/hrefAttrsProp.js +30 -0
  262. package/lib-module/utils/props/index.js +16 -0
  263. package/lib-module/utils/props/inputSupportsProps.js +54 -0
  264. package/lib-module/utils/props/linkProps.js +47 -0
  265. package/lib-module/utils/props/paddingProp.js +9 -0
  266. package/lib-module/utils/props/pressProps.js +42 -0
  267. package/lib-module/utils/props/rectProp.js +9 -0
  268. package/lib-module/utils/props/responsiveProps.js +30 -0
  269. package/lib-module/utils/props/selectSystemProps.js +24 -0
  270. package/lib-module/utils/props/spacingProps.js +56 -0
  271. package/lib-module/utils/props/tokens.js +120 -0
  272. package/lib-module/utils/props/variantProp.js +18 -0
  273. package/lib-module/utils/props/viewProps.js +22 -0
  274. package/lib-module/utils/ssr.js +35 -0
  275. package/lib-module/utils/useCopy.js +42 -0
  276. package/lib-module/utils/useHash.js +44 -0
  277. package/lib-module/utils/useHash.native.js +7 -0
  278. package/lib-module/utils/useResponsiveProp.js +47 -0
  279. package/lib-module/utils/useSpacingScale.js +123 -0
  280. package/lib-module/utils/useUniqueId.js +12 -0
  281. package/lib-module/utils/withLinkRouter.js +82 -0
  282. package/package.json +9 -5
  283. package/src/A11yText/index.jsx +7 -3
  284. package/src/ActivityIndicator/Spinner.jsx +56 -44
  285. package/src/ActivityIndicator/Spinner.native.jsx +20 -12
  286. package/src/Box/Box.jsx +10 -9
  287. package/src/Button/ButtonBase.jsx +9 -8
  288. package/src/Card/Card.jsx +7 -4
  289. package/src/Card/PressableCardBase.jsx +12 -12
  290. package/src/Checkbox/Checkbox.jsx +12 -5
  291. package/src/Divider/Divider.jsx +17 -10
  292. package/src/ExpandCollapse/Control.jsx +12 -7
  293. package/src/ExpandCollapse/ExpandCollapse.jsx +13 -3
  294. package/src/ExpandCollapse/Panel.jsx +15 -5
  295. package/src/Feedback/Feedback.jsx +13 -3
  296. package/src/Fieldset/Fieldset.jsx +1 -1
  297. package/src/HorizontalScroll/HorizontalScroll.jsx +12 -5
  298. package/src/IconButton/IconButton.jsx +12 -8
  299. package/src/InputLabel/InputLabel.jsx +16 -2
  300. package/src/InputSupports/InputSupports.jsx +1 -1
  301. package/src/Link/LinkBase.jsx +10 -9
  302. package/src/List/List.jsx +12 -5
  303. package/src/List/ListItem.jsx +16 -2
  304. package/src/Modal/Modal.jsx +63 -50
  305. package/src/Notification/Notification.jsx +17 -3
  306. package/src/Pagination/Pagination.jsx +10 -3
  307. package/src/Progress/Progress.jsx +5 -3
  308. package/src/Progress/ProgressBar.jsx +8 -6
  309. package/src/Radio/Radio.jsx +13 -5
  310. package/src/Radio/RadioButton.jsx +13 -3
  311. package/src/Radio/RadioGroup.jsx +14 -2
  312. package/src/RadioCard/RadioCard.jsx +9 -6
  313. package/src/RadioCard/RadioCardGroup.jsx +16 -4
  314. package/src/Search/Search.jsx +15 -3
  315. package/src/Select/Select.jsx +21 -7
  316. package/src/SideNav/Item.jsx +15 -7
  317. package/src/SideNav/SideNav.jsx +13 -2
  318. package/src/Skeleton/Skeleton.jsx +55 -43
  319. package/src/Spacer/Spacer.jsx +8 -16
  320. package/src/StackView/StackView.jsx +13 -12
  321. package/src/StackView/StackWrapBox.jsx +12 -12
  322. package/src/StackView/StackWrapGap.jsx +9 -7
  323. package/src/StepTracker/Step.jsx +7 -4
  324. package/src/StepTracker/StepTracker.jsx +8 -8
  325. package/src/Tabs/Tabs.jsx +16 -3
  326. package/src/Tabs/TabsItem.jsx +13 -9
  327. package/src/Tags/Tags.jsx +20 -5
  328. package/src/TextInput/TextArea.jsx +20 -8
  329. package/src/TextInput/TextInput.jsx +20 -8
  330. package/src/TextInput/TextInputBase.jsx +13 -3
  331. package/src/ToggleSwitch/ToggleSwitch.jsx +16 -5
  332. package/src/ToggleSwitch/ToggleSwitchGroup.jsx +14 -6
  333. package/src/Tooltip/Tooltip.jsx +13 -3
  334. package/src/TooltipButton/TooltipButton.jsx +6 -4
  335. package/src/Typography/Typography.jsx +10 -6
  336. package/src/index.js +1 -1
  337. package/src/utils/children.jsx +2 -1
  338. package/src/utils/index.js +1 -0
  339. package/src/utils/props/index.js +1 -0
  340. package/src/{InputSupports/propTypes.js → utils/props/inputSupportsProps.js} +2 -4
  341. package/src/utils/ssr.js +35 -0
  342. package/release-context.json +0 -7
@@ -1,13 +1,25 @@
1
1
  import React, { forwardRef, useState } from 'react'
2
2
 
3
3
  import { Platform } from 'react-native'
4
- import { getTokensPropType, variantProp } from '../utils'
4
+ import {
5
+ a11yProps,
6
+ getTokensPropType,
7
+ inputSupportsProps,
8
+ selectSystemProps,
9
+ variantProp,
10
+ viewProps
11
+ } from '../utils'
5
12
  import InputSupports from '../InputSupports'
6
13
  import TextInputBase from './TextInputBase'
7
14
  import { useThemeTokens } from '../ThemeProvider'
8
- import inputSupportProps from '../InputSupports/propTypes'
9
15
  import textInputPropTypes from './propTypes'
10
16
 
17
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([
18
+ a11yProps,
19
+ inputSupportsProps,
20
+ viewProps
21
+ ])
22
+
11
23
  /**
12
24
  * Use to collect long-form information such as product feedback or support queries.
13
25
  * Due to React Native's implementation of `TextInput` it's not possible to access the current value by passing a ref.
@@ -32,7 +44,7 @@ import textInputPropTypes from './propTypes'
32
44
  * or an indicator that the field is optional.
33
45
  * It is a more usable and accessible option than the HTML `placeholder` attribute.
34
46
  */
35
- const TextArea = forwardRef(({ tokens, variant = {}, ...remainingProps }, ref) => {
47
+ const TextArea = forwardRef(({ tokens, variant = {}, ...rest }, ref) => {
36
48
  const themeTokens = useThemeTokens('TextArea', tokens, variant)
37
49
  const [inputHeight, setInputHeight] = useState()
38
50
 
@@ -48,10 +60,10 @@ const TextArea = forwardRef(({ tokens, variant = {}, ...remainingProps }, ref) =
48
60
  }
49
61
  }
50
62
 
51
- const { props: supportsProps, rest } = inputSupportProps.select(remainingProps)
63
+ const { props: supportsProps, ...selectedProps } = selectProps(rest)
52
64
 
53
65
  const inputProps = {
54
- ...rest,
66
+ ...selectedProps,
55
67
  variant: { ...variant, validation: supportsProps.validation },
56
68
  multiline: true,
57
69
  onContentSizeChange: onHeightChange,
@@ -61,8 +73,8 @@ const TextArea = forwardRef(({ tokens, variant = {}, ...remainingProps }, ref) =
61
73
 
62
74
  return (
63
75
  <InputSupports {...supportsProps}>
64
- {({ a11yProps, inputId }) => (
65
- <TextInputBase ref={ref} {...inputProps} {...a11yProps} nativeID={inputId} />
76
+ {({ inputId, ...props }) => (
77
+ <TextInputBase ref={ref} {...inputProps} nativeID={inputId} {...props} />
66
78
  )}
67
79
  </InputSupports>
68
80
  )
@@ -70,7 +82,7 @@ const TextArea = forwardRef(({ tokens, variant = {}, ...remainingProps }, ref) =
70
82
  TextArea.displayName = 'TextArea'
71
83
 
72
84
  TextArea.propTypes = {
73
- ...inputSupportProps.types,
85
+ ...selectedSystemPropTypes,
74
86
  ...textInputPropTypes,
75
87
  tokens: getTokensPropType('TextArea', 'TextInput'), // TODO: support both TextArea and TextInput tokens
76
88
  variant: variantProp.propType
@@ -1,11 +1,23 @@
1
1
  import React, { forwardRef } from 'react'
2
2
 
3
- import { getTokensPropType, variantProp } from '../utils'
3
+ import {
4
+ a11yProps,
5
+ getTokensPropType,
6
+ inputSupportsProps,
7
+ selectSystemProps,
8
+ variantProp,
9
+ viewProps
10
+ } from '../utils'
4
11
  import InputSupports from '../InputSupports'
5
12
  import TextInputBase from './TextInputBase'
6
- import inputSupportProps from '../InputSupports/propTypes'
7
13
  import textInputPropTypes from './propTypes'
8
14
 
15
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([
16
+ a11yProps,
17
+ inputSupportsProps,
18
+ viewProps
19
+ ])
20
+
9
21
  /**
10
22
  * A basic text input component. Use in forms or individually to receive user's input.
11
23
  * Due to React Native's implementation of `TextInput` it's not possible to access the current value by passing a ref.
@@ -24,19 +36,19 @@ import textInputPropTypes from './propTypes'
24
36
  * supported props and <a href="https://reactnative.dev/docs/textinput" target="_blank">React Native Web documentation</a> for
25
37
  * their implementation on the web.
26
38
  */
27
- const TextInput = forwardRef(({ tokens, variant = {}, ...remainingProps }, ref) => {
28
- const { props: supportsProps, rest } = inputSupportProps.select(remainingProps)
39
+ const TextInput = forwardRef(({ tokens, variant = {}, ...rest }, ref) => {
40
+ const { props: supportsProps, ...selectedProps } = selectProps(rest)
29
41
 
30
42
  const inputProps = {
31
- ...rest,
43
+ ...selectedProps,
32
44
  tokens,
33
45
  variant: { ...variant, validation: supportsProps.validation }
34
46
  }
35
47
 
36
48
  return (
37
49
  <InputSupports {...supportsProps}>
38
- {({ a11yProps, inputId }) => (
39
- <TextInputBase ref={ref} {...inputProps} {...a11yProps} nativeID={inputId} />
50
+ {({ inputId, ...props }) => (
51
+ <TextInputBase ref={ref} {...inputProps} nativeID={inputId} {...props} />
40
52
  )}
41
53
  </InputSupports>
42
54
  )
@@ -44,7 +56,7 @@ const TextInput = forwardRef(({ tokens, variant = {}, ...remainingProps }, ref)
44
56
  TextInput.displayName = 'TextInput'
45
57
 
46
58
  TextInput.propTypes = {
47
- ...inputSupportProps.types,
59
+ ...selectedSystemPropTypes,
48
60
  ...textInputPropTypes,
49
61
  tokens: getTokensPropType('TextInput'),
50
62
  variant: variantProp.propType
@@ -3,7 +3,16 @@ import { Platform, StyleSheet, TextInput as NativeTextInput, View } from 'react-
3
3
 
4
4
  import PropTypes from 'prop-types'
5
5
  import { applyTextStyles, useThemeTokens, applyOuterBorder } from '../ThemeProvider'
6
- import { getTokensPropType, useInputValue, variantProp } from '../utils'
6
+ import {
7
+ a11yProps,
8
+ getTokensPropType,
9
+ selectSystemProps,
10
+ useInputValue,
11
+ variantProp,
12
+ viewProps
13
+ } from '../utils'
14
+
15
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps])
7
16
 
8
17
  const selectInputStyles = (
9
18
  {
@@ -114,7 +123,7 @@ const TextInputBase = forwardRef(
114
123
  onMouseOut,
115
124
  tokens,
116
125
  variant = {},
117
- ...remainingProps
126
+ ...rest
118
127
  },
119
128
  ref
120
129
  ) => {
@@ -158,7 +167,7 @@ const TextInputBase = forwardRef(
158
167
  const { icon: IconComponent } = themeTokens
159
168
 
160
169
  const inputProps = {
161
- ...remainingProps,
170
+ ...selectProps(rest),
162
171
  editable: !inactive,
163
172
  onFocus: handleFocus,
164
173
  onBlur: handleBlur,
@@ -191,6 +200,7 @@ const TextInputBase = forwardRef(
191
200
  TextInputBase.displayName = 'TextInputBase'
192
201
 
193
202
  TextInputBase.propTypes = {
203
+ ...selectedSystemPropTypes,
194
204
  value: PropTypes.string,
195
205
  height: PropTypes.number,
196
206
  initialValue: PropTypes.string,
@@ -6,9 +6,19 @@ import InputLabel from '../InputLabel'
6
6
  import ButtonBase from '../Button/ButtonBase'
7
7
  import StackView from '../StackView'
8
8
  import { useThemeTokensCallback, applyShadowToken } from '../ThemeProvider'
9
- import { a11yProps, pressProps, variantProp, getTokensPropType, selectTokens } from '../utils/props'
9
+ import {
10
+ a11yProps,
11
+ getTokensPropType,
12
+ selectTokens,
13
+ pressProps,
14
+ selectSystemProps,
15
+ useUniqueId,
16
+ variantProp,
17
+ viewProps
18
+ } from '../utils'
10
19
  import { useInputValue } from '../utils/input'
11
- import { useUniqueId } from '../utils'
20
+
21
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, pressProps, viewProps])
12
22
 
13
23
  const selectButtonTokens = (tokens) =>
14
24
  selectTokens('Button', {
@@ -79,7 +89,8 @@ const ToggleSwitch = forwardRef(
79
89
  tooltip,
80
90
  variant,
81
91
  accessibilityRole = 'switch',
82
- accessibilityLabel = label
92
+ accessibilityLabel = label,
93
+ ...rest
83
94
  },
84
95
  ref
85
96
  ) => {
@@ -119,6 +130,7 @@ const ToggleSwitch = forwardRef(
119
130
  accessibilityRole={accessibilityRole}
120
131
  accessibilityState={{ checked: currentValue }}
121
132
  onPress={handlePress}
133
+ {...selectProps(rest)}
122
134
  >
123
135
  {(buttonState) => {
124
136
  const stateTokens = getTokens(buttonState)
@@ -151,8 +163,7 @@ const ToggleSwitch = forwardRef(
151
163
  ToggleSwitch.displayName = 'ToggleSwitch'
152
164
 
153
165
  ToggleSwitch.propTypes = {
154
- ...a11yProps.propTypes,
155
- ...pressProps.propTypes,
166
+ ...selectedSystemPropTypes,
156
167
  tokens: getTokensPropType('ToggleSwitch'),
157
168
  variant: variantProp.propType,
158
169
  /**
@@ -8,9 +8,18 @@ import Fieldset from '../Fieldset'
8
8
  import { getStackedContent } from '../StackView'
9
9
  import { useViewport } from '../ViewportProvider'
10
10
  import { useThemeTokens } from '../ThemeProvider'
11
- import { a11yProps, pressProps, variantProp, getTokensPropType } from '../utils/props'
11
+ import {
12
+ a11yProps,
13
+ getTokensPropType,
14
+ pressProps,
15
+ selectSystemProps,
16
+ variantProp,
17
+ viewProps
18
+ } from '../utils/props'
12
19
  import { useMultipleInputValues } from '../utils/input'
13
20
 
21
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, pressProps, viewProps])
22
+
14
23
  const ToggleSwitchGroup = forwardRef(
15
24
  (
16
25
  {
@@ -51,11 +60,11 @@ const ToggleSwitchGroup = forwardRef(
51
60
  readOnly
52
61
  })
53
62
 
54
- const a11y = a11yProps.select({
63
+ const selectedProps = selectProps({
55
64
  accessibilityRole,
56
65
  ...rest
57
66
  })
58
- const itemA11yRole = a11y.accessibilityRole === 'radiogroup' ? 'radio' : 'switch'
67
+ const itemA11yRole = selectedProps.accessibilityRole === 'radiogroup' ? 'radio' : 'switch'
59
68
 
60
69
  const toggleSwitches = items.map(
61
70
  (
@@ -111,7 +120,7 @@ const ToggleSwitchGroup = forwardRef(
111
120
  feedback={feedback}
112
121
  inactive={inactive}
113
122
  validation={validation}
114
- {...a11y}
123
+ {...selectedProps}
115
124
  >
116
125
  {getStackedContent(toggleSwitches, { space, direction: 'column' })}
117
126
  </Fieldset>
@@ -121,8 +130,7 @@ const ToggleSwitchGroup = forwardRef(
121
130
  ToggleSwitchGroup.displayName = 'ToggleSwitchGroup'
122
131
 
123
132
  ToggleSwitchGroup.propTypes = {
124
- ...a11yProps.propTypes,
125
- ...pressProps.propTypes,
133
+ ...selectedSystemPropTypes,
126
134
  tokens: getTokensPropType('ToggleSwitchGroup'),
127
135
  variant: variantProp.propType,
128
136
  /**
@@ -3,13 +3,22 @@ import { Dimensions, Platform, Pressable, StyleSheet, Text, View } from 'react-n
3
3
 
4
4
  import PropTypes from 'prop-types'
5
5
  import { applyShadowToken, applyTextStyles, useThemeTokens } from '../ThemeProvider'
6
- import { getTokensPropType, selectTokens, variantProp } from '../utils'
6
+ import {
7
+ a11yProps,
8
+ getTokensPropType,
9
+ selectSystemProps,
10
+ selectTokens,
11
+ variantProp,
12
+ viewProps
13
+ } from '../utils'
7
14
  import Backdrop from './Backdrop'
8
15
  import getTooltipPosition from './getTooltipPosition'
9
16
  import TooltipButton from '../TooltipButton'
10
17
  import useCopy from '../utils/useCopy'
11
18
  import dictionary from './dictionary'
12
19
 
20
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps])
21
+
13
22
  const selectTooltipStyles = ({
14
23
  backgroundColor,
15
24
  paddingTop,
@@ -100,7 +109,7 @@ const defaultControl = (pressableState, variant) => (
100
109
  * - Tooltips may also be useful when vertical space is an issue.
101
110
  */
102
111
  const Tooltip = forwardRef(
103
- ({ children, content, position = 'auto', copy = 'en', tokens, variant }, ref) => {
112
+ ({ children, content, position = 'auto', copy = 'en', tokens, variant, ...rest }, ref) => {
104
113
  const [isOpen, setIsOpen] = useState(false)
105
114
 
106
115
  const controlRef = useRef()
@@ -209,7 +218,7 @@ const Tooltip = forwardRef(
209
218
  control === defaultControl ? { top: 10, bottom: 10, left: 10, right: 10 } : undefined
210
219
 
211
220
  return (
212
- <View style={staticStyles.container}>
221
+ <View style={staticStyles.container} {...selectProps(rest)}>
213
222
  <Pressable
214
223
  onPress={toggleIsOpen}
215
224
  ref={controlRef}
@@ -256,6 +265,7 @@ const Tooltip = forwardRef(
256
265
  Tooltip.displayName = 'Tooltip'
257
266
 
258
267
  Tooltip.propTypes = {
268
+ ...selectedSystemPropTypes,
259
269
  /**
260
270
  * Used to render the control (i.e. tooltip trigger). If a render function is used it will receive the
261
271
  * pressable state and tooltip variant as an argument.
@@ -1,11 +1,12 @@
1
1
  import React from 'react'
2
2
  import { View } from 'react-native'
3
-
4
3
  import PropTypes from 'prop-types'
5
4
  import { useThemeTokens, applyOuterBorder } from '../ThemeProvider'
6
- import { getTokensPropType, variantProp } from '../utils'
5
+ import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps } from '../utils'
7
6
  import Icon from '../Icon'
8
7
 
8
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps])
9
+
9
10
  const selectInnerContainerStyles = ({ borderRadius, width }) => ({ borderRadius, width })
10
11
 
11
12
  const selectIconTokens = ({ iconSize, iconColor /* iconScale = 1 */ }) => ({
@@ -19,13 +20,13 @@ const selectIconTokens = ({ iconSize, iconColor /* iconScale = 1 */ }) => ({
19
20
  * In fact though, it isn't actually a pressable - it's meant to be used as pressable's content.
20
21
  * Due to this any interaction states (e.g. pressed, hover, etc.) has to be passed down to it as a prop.
21
22
  */
22
- const TooltipButton = ({ pressableState, tokens, variant }) => {
23
+ const TooltipButton = ({ pressableState, tokens, variant, ...rest }) => {
23
24
  const themeTokens = useThemeTokens('TooltipButton', tokens, variant, pressableState)
24
25
 
25
26
  const { icon: IconComponent } = themeTokens
26
27
 
27
28
  return (
28
- <View style={applyOuterBorder(themeTokens)}>
29
+ <View style={applyOuterBorder(themeTokens)} {...selectProps(rest)}>
29
30
  <View style={selectInnerContainerStyles(themeTokens)}>
30
31
  {IconComponent && <Icon icon={IconComponent} tokens={selectIconTokens(themeTokens)} />}
31
32
  </View>
@@ -34,6 +35,7 @@ const TooltipButton = ({ pressableState, tokens, variant }) => {
34
35
  }
35
36
 
36
37
  TooltipButton.propTypes = {
38
+ ...selectedSystemPropTypes,
37
39
  /**
38
40
  * Used as appearances when resolving theme tokens.
39
41
  */
@@ -11,13 +11,17 @@ import {
11
11
  getTokensPropType,
12
12
  getMaxFontMultiplier,
13
13
  headingTags,
14
+ selectSystemProps,
14
15
  textTags,
16
+ viewProps,
15
17
  getA11yPropsFromHtmlTag
16
18
  } from '../utils'
17
19
  /**
18
20
  * @typedef {import('../utils/a11y/semantics').TextTag} TextTag
19
21
  */
20
22
 
23
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps])
24
+
21
25
  const selectTextStyles = ({
22
26
  fontWeight,
23
27
  fontSize,
@@ -64,17 +68,17 @@ const Typography = forwardRef(
64
68
  maxFontSizeMultiplier: getMaxFontMultiplier(themeTokens)
65
69
  }
66
70
 
67
- const a11y = {
71
+ const selectedProps = selectProps({
68
72
  ...getA11yPropsFromHtmlTag(tag, accessibilityRole),
69
- ...a11yProps.select(rest)
70
- }
73
+ ...rest
74
+ })
71
75
 
72
76
  return block ? (
73
- <View ref={ref} {...a11y}>
77
+ <View ref={ref} {...selectedProps}>
74
78
  <Text {...textProps}>{children}</Text>
75
79
  </View>
76
80
  ) : (
77
- <Text ref={ref} {...textProps} {...a11y}>
81
+ <Text ref={ref} {...textProps} {...selectedProps}>
78
82
  {children}
79
83
  </Text>
80
84
  )
@@ -83,7 +87,7 @@ const Typography = forwardRef(
83
87
  Typography.displayName = 'Typography'
84
88
 
85
89
  Typography.propTypes = {
86
- ...a11yProps.types,
90
+ ...selectedSystemPropTypes,
87
91
  tokens: getTokensPropType('Typography'),
88
92
  variant: variantProp.propType,
89
93
  /**
package/src/index.js CHANGED
@@ -44,7 +44,7 @@ export { default as Typography } from './Typography'
44
44
 
45
45
  export { default as A11yInfoProvider, useA11yInfo } from './A11yInfoProvider'
46
46
  export { default as BaseProvider } from './BaseProvider'
47
- export { default as ViewportProvider, useViewport } from './ViewportProvider'
47
+ export { default as ViewportProvider, useViewport, ViewportContext } from './ViewportProvider'
48
48
  export {
49
49
  default as ThemeProvider,
50
50
  useTheme,
@@ -47,7 +47,8 @@ export const unpackFragment = (child) => {
47
47
 
48
48
  const isStringOrNumber = (child) => typeof child === 'string' || typeof child === 'number'
49
49
  // Wrap an A11yText with neighouring text strings so it doesn't split them into multiple <Text>s
50
- const isWrapable = (child) => isStringOrNumber(child) || child.type === A11yText
50
+ const isWrapable = (child) =>
51
+ isStringOrNumber(child) || child.type === A11yText || child.type?.name === 'FootnoteLink'
51
52
  const combineKeys = (childrenArray) =>
52
53
  childrenArray.reduce((newKey, child) => `${newKey}${child.key || ''}`, '')
53
54
 
@@ -13,3 +13,4 @@ export { default as useResponsiveProp } from './useResponsiveProp'
13
13
  export * from './useResponsiveProp'
14
14
  export { default as useUniqueId } from './useUniqueId'
15
15
  export { default as withLinkRouter } from './withLinkRouter'
16
+ export * from './ssr'
@@ -4,6 +4,7 @@ export { default as clickProps } from './clickProps'
4
4
  export { default as copyPropTypes } from './copyPropTypes'
5
5
  export { default as componentPropType } from './componentPropType'
6
6
  export { default as hrefAttrsProp } from './hrefAttrsProp'
7
+ export { default as inputSupportsProps } from './inputSupportsProps'
7
8
  export { default as linkProps } from './linkProps'
8
9
  export { default as pressProps } from './pressProps'
9
10
  export { default as paddingProp } from './paddingProp'
@@ -1,6 +1,6 @@
1
1
  import PropTypes from 'prop-types'
2
2
 
3
- const inputSupportProps = {
3
+ export default {
4
4
  types: {
5
5
  /**
6
6
  * The input label.
@@ -37,8 +37,6 @@ const inputSupportProps = {
37
37
  tooltip,
38
38
  validation
39
39
  },
40
- rest
40
+ ...rest
41
41
  })
42
42
  }
43
-
44
- export default inputSupportProps
@@ -0,0 +1,35 @@
1
+ import { AppRegistry } from 'react-native'
2
+ /** @typedef {import('react').ComponentType} ReactComponent */
3
+ /** @typedef {import('react').ReactElement} ReactElement */
4
+
5
+ /**
6
+ * Registers the app's root component with React Native Web and generates
7
+ * the main <style> tag containing React Native Web stylesheet styles.
8
+ *
9
+ * @param {ReactComponent} AppRoot
10
+ * @param {string} [appName]
11
+ * @returns {ReactElement[]}
12
+ */
13
+
14
+ export const getReactNativeWebSSRStyles = (AppRoot, appName = 'app') => {
15
+ AppRegistry.registerComponent(appName, () => AppRoot)
16
+ const { getStyleElement } = AppRegistry.getApplication(appName)
17
+ return [getStyleElement()]
18
+ }
19
+
20
+ /**
21
+ * Gets style tags for each currently supported CSS-in-JS library and returns
22
+ * them alongside any existing style tags.
23
+ *
24
+ * @param {ReactComponent} AppRoot
25
+ * @param {string} [appName]
26
+ * @param {ReactElement[]} [existingStyles]
27
+ * @returns {ReactElement[]}
28
+ */
29
+ export const getSSRStyles = (AppRoot, appName = 'app', existingStyles = []) => {
30
+ return [
31
+ ...existingStyles,
32
+ ...getReactNativeWebSSRStyles(AppRoot, appName)
33
+ // if any other CSS-in-JS is added e.g. styled-components generate and add its styles here
34
+ ]
35
+ }
@@ -1,7 +0,0 @@
1
- {
2
- "previousReleaseTag": "@telus-uds/components-base/v1.2.0",
3
- "changelog": "## [1.3.0](https://github.com/telus/universal-design-system/compare/@telus-uds/components-base/v1.2.0...@telus-uds/components-base/v1.3.0) (2022-03-21)\n\n\n### Features\n\n* **components-base:** add common system props handler and restructure props-related utils ([#1444](https://github.com/telus/universal-design-system/issues/1444)) ([ab655ec](https://github.com/telus/universal-design-system/commit/ab655ec61796b6a6d7094c2c42ceef8b5197c634))\n* **docs:** add tokens override documentation ([#1330](https://github.com/telus/universal-design-system/issues/1330)) ([49092e5](https://github.com/telus/universal-design-system/commit/49092e5d5f6c2d3a85de930a74a03afff8a60062))\n\n\n### Bug Fixes\n\n* **base:** inherit FlexGrid.Col responsive size if 0 ([#1419](https://github.com/telus/universal-design-system/issues/1419)) ([9defeb0](https://github.com/telus/universal-design-system/commit/9defeb0da08099afb83df9e7ee902f037cb4de02))\n* **ds-allium:** fix some errors in RN builds ([#1448](https://github.com/telus/universal-design-system/issues/1448)) ([8bc4778](https://github.com/telus/universal-design-system/commit/8bc477890f0183584fdc1009d7929b71d23820a3))\n",
4
- "releaseTag": "@telus-uds/components-base/v1.3.0",
5
- "newVersion": "1.3.0",
6
- "packageName": "@telus-uds/components-base"
7
- }