@telus-uds/components-base 0.0.2-prerelease.9 → 1.1.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 (293) hide show
  1. package/.eslintrc.js +9 -0
  2. package/.storybook/main.js +4 -0
  3. package/.storybook/preview.js +37 -0
  4. package/.ultra.cache.json +1 -1
  5. package/CHANGELOG.md +50 -0
  6. package/README.md +4 -2
  7. package/__fixtures__/test-utils.js +25 -0
  8. package/__fixtures__/testTheme.js +4 -2
  9. package/__tests__/Button/ButtonGroup.test.jsx +4 -5
  10. package/__tests__/Checkbox/Checkbox.test.jsx +2 -2
  11. package/__tests__/Checkbox/CheckboxGroup.test.jsx +4 -5
  12. package/__tests__/ExpandCollapse/ExpandCollapse.test.jsx +2 -2
  13. package/__tests__/HorizontalScroll/HorizontalScroll.test.jsx +164 -0
  14. package/__tests__/Link/LinkBase.test.jsx +0 -14
  15. package/__tests__/Radio/Radio.test.jsx +2 -2
  16. package/__tests__/Radio/RadioGroup.test.jsx +4 -5
  17. package/__tests__/RadioCard/RadioCard.test.jsx +2 -2
  18. package/__tests__/RadioCard/RadioCardGroup.test.jsx +4 -5
  19. package/__tests__/Search/Search.test.jsx +9 -8
  20. package/__tests__/Select/Select.test.jsx +3 -2
  21. package/__tests__/Tabs/Tabs.test.jsx +1 -161
  22. package/__tests__/Tags/Tags.test.jsx +4 -5
  23. package/__tests__/TextInput/TextArea.test.jsx +3 -2
  24. package/__tests__/TextInput/TextInputBase.test.jsx +10 -5
  25. package/__tests__/ThemeProvider/ThemeProvider.test.jsx +77 -0
  26. package/__tests__/ThemeProvider/useThemeTokens.test.jsx +9 -5
  27. package/__tests__/ThemeProvider/utils/theme-tokens.test.js +41 -0
  28. package/__tests__/ToggleSwitch/ToggleSwitch.test.jsx +3 -2
  29. package/__tests__/utils/children.test.jsx +128 -0
  30. package/__tests__/utils/input.test.js +1 -1
  31. package/__tests__/utils/semantics.test.jsx +43 -0
  32. package/babel.config.js +9 -16
  33. package/component-docs.json +10313 -0
  34. package/generate-component-docs.js +56 -0
  35. package/lib/A11yText/index.js +10 -5
  36. package/lib/ActivityIndicator/Spinner.js +16 -13
  37. package/lib/ActivityIndicator/Spinner.native.js +12 -8
  38. package/lib/Box/Box.js +103 -8
  39. package/lib/Button/Button.js +9 -8
  40. package/lib/Button/ButtonBase.js +14 -7
  41. package/lib/Button/ButtonGroup.js +25 -10
  42. package/lib/Button/ButtonLink.js +10 -7
  43. package/lib/Card/Card.js +2 -0
  44. package/lib/Card/CardBase.js +13 -5
  45. package/lib/Card/PressableCardBase.js +12 -8
  46. package/lib/Checkbox/Checkbox.js +25 -14
  47. package/lib/Checkbox/CheckboxGroup.js +22 -12
  48. package/lib/Divider/Divider.js +12 -7
  49. package/lib/ExpandCollapse/Accordion.js +10 -4
  50. package/lib/ExpandCollapse/Control.js +12 -6
  51. package/lib/ExpandCollapse/ExpandCollapse.js +10 -5
  52. package/lib/ExpandCollapse/Panel.js +8 -7
  53. package/lib/Feedback/Feedback.js +10 -5
  54. package/lib/Fieldset/Fieldset.js +10 -5
  55. package/lib/Fieldset/FieldsetContainer.js +10 -5
  56. package/lib/Fieldset/FieldsetContainer.native.js +10 -5
  57. package/lib/Fieldset/Legend.js +10 -5
  58. package/lib/Fieldset/Legend.native.js +10 -5
  59. package/lib/FlexGrid/Col/Col.js +8 -5
  60. package/lib/FlexGrid/FlexGrid.js +31 -6
  61. package/lib/FlexGrid/Row/Row.js +12 -5
  62. package/lib/{Tabs → HorizontalScroll}/HorizontalScroll.js +5 -4
  63. package/lib/{Tabs/TabsScrollButton.js → HorizontalScroll/HorizontalScrollButton.js} +14 -8
  64. package/lib/{Tabs → HorizontalScroll}/ScrollViewEnd.js +0 -0
  65. package/lib/{Tabs → HorizontalScroll}/ScrollViewEnd.native.js +0 -0
  66. package/lib/{Tabs → HorizontalScroll}/dictionary.js +0 -0
  67. package/lib/HorizontalScroll/index.js +35 -0
  68. package/lib/{Tabs → HorizontalScroll}/itemPositions.js +0 -0
  69. package/lib/Icon/Icon.js +16 -9
  70. package/lib/Icon/IconText.js +8 -7
  71. package/lib/IconButton/IconButton.js +10 -5
  72. package/lib/InputLabel/InputLabel.js +33 -5
  73. package/lib/InputLabel/LabelContent.js +22 -12
  74. package/lib/InputLabel/LabelContent.native.js +23 -5
  75. package/lib/InputSupports/InputSupports.js +10 -5
  76. package/lib/Link/ChevronLink.js +12 -5
  77. package/lib/Link/InlinePressable.js +10 -4
  78. package/lib/Link/InlinePressable.native.js +5 -4
  79. package/lib/Link/Link.js +12 -5
  80. package/lib/Link/LinkBase.js +12 -5
  81. package/lib/Link/TextButton.js +10 -5
  82. package/lib/List/List.js +6 -6
  83. package/lib/List/ListItem.js +28 -33
  84. package/lib/List/index.js +15 -0
  85. package/lib/Modal/Modal.js +10 -5
  86. package/lib/Notification/Notification.js +21 -5
  87. package/lib/Pagination/PageButton.js +16 -11
  88. package/lib/Pagination/Pagination.js +12 -7
  89. package/lib/Pagination/SideButton.js +12 -7
  90. package/lib/Pagination/usePagination.js +2 -2
  91. package/lib/Progress/Progress.js +10 -5
  92. package/lib/Progress/ProgressBar.js +21 -10
  93. package/lib/Progress/ProgressBarBackground.js +12 -8
  94. package/lib/Radio/Radio.js +14 -13
  95. package/lib/Radio/RadioButton.js +20 -9
  96. package/lib/Radio/RadioGroup.js +24 -13
  97. package/lib/RadioCard/RadioCard.js +14 -10
  98. package/lib/RadioCard/RadioCardGroup.js +13 -12
  99. package/lib/Search/Search.js +29 -18
  100. package/lib/Select/Picker.js +11 -6
  101. package/lib/Select/Picker.native.js +21 -6
  102. package/lib/Select/Select.js +46 -4
  103. package/lib/SideNav/Item.js +10 -5
  104. package/lib/SideNav/ItemsGroup.js +10 -5
  105. package/lib/SideNav/SideNav.js +11 -7
  106. package/lib/Skeleton/Skeleton.js +15 -15
  107. package/lib/Skeleton/skeletonWebAnimation.js +1 -1
  108. package/lib/Spacer/Spacer.js +19 -7
  109. package/lib/StackView/StackView.js +26 -7
  110. package/lib/StackView/StackWrap.js +24 -13
  111. package/lib/StackView/StackWrapBox.js +34 -8
  112. package/lib/StackView/StackWrapGap.js +16 -7
  113. package/lib/StackView/common.js +4 -2
  114. package/lib/StackView/getStackedContent.js +2 -2
  115. package/lib/StepTracker/StepTracker.js +10 -5
  116. package/lib/Tabs/Tabs.js +26 -19
  117. package/lib/Tabs/TabsItem.js +16 -12
  118. package/lib/Tags/Tags.js +27 -11
  119. package/lib/TextInput/TextArea.js +7 -5
  120. package/lib/TextInput/TextInput.js +12 -6
  121. package/lib/TextInput/TextInputBase.js +12 -8
  122. package/lib/ThemeProvider/ThemeProvider.js +14 -10
  123. package/lib/ThemeProvider/useSetTheme.js +6 -1
  124. package/lib/ThemeProvider/utils/styles.js +2 -2
  125. package/lib/ThemeProvider/utils/theme-tokens.js +39 -8
  126. package/lib/ToggleSwitch/ToggleSwitch.js +11 -6
  127. package/lib/Tooltip/Backdrop.js +10 -2
  128. package/lib/Tooltip/Tooltip.js +5 -4
  129. package/lib/Typography/Typography.js +40 -24
  130. package/lib/index.js +36 -1
  131. package/lib/utils/a11y/index.js +13 -0
  132. package/lib/utils/a11y/propTypes.js +61 -0
  133. package/lib/utils/a11y/propTypes.native.js +47 -0
  134. package/lib/utils/a11y/semantics.js +173 -0
  135. package/lib/utils/animation/useVerticalExpandAnimation.js +1 -1
  136. package/lib/utils/children.js +55 -8
  137. package/lib/utils/input.js +27 -17
  138. package/lib/utils/propTypes.js +40 -68
  139. package/lib/utils/useCopy.js +1 -1
  140. package/lib/utils/useHash.js +8 -4
  141. package/lib/utils/useSpacingScale.js +1 -3
  142. package/lib/utils/useUniqueId.js +1 -1
  143. package/package.json +14 -6
  144. package/release-context.json +4 -4
  145. package/src/A11yText/index.jsx +6 -4
  146. package/src/ActivityIndicator/Spinner.jsx +5 -3
  147. package/src/ActivityIndicator/Spinner.native.jsx +5 -3
  148. package/src/Box/Box.jsx +125 -39
  149. package/src/Button/Button.jsx +7 -4
  150. package/src/Button/ButtonBase.jsx +86 -77
  151. package/src/Button/ButtonGroup.jsx +81 -69
  152. package/src/Button/ButtonLink.jsx +18 -13
  153. package/src/Card/Card.jsx +2 -2
  154. package/src/Card/CardBase.jsx +6 -4
  155. package/src/Card/PressableCardBase.jsx +71 -64
  156. package/src/Checkbox/Checkbox.jsx +118 -108
  157. package/src/Checkbox/CheckboxGroup.jsx +72 -62
  158. package/src/Divider/Divider.jsx +7 -4
  159. package/src/ExpandCollapse/Accordion.jsx +3 -2
  160. package/src/ExpandCollapse/Control.jsx +40 -43
  161. package/src/ExpandCollapse/ExpandCollapse.jsx +26 -23
  162. package/src/ExpandCollapse/Panel.jsx +69 -63
  163. package/src/Feedback/Feedback.jsx +36 -33
  164. package/src/Fieldset/Fieldset.jsx +63 -56
  165. package/src/Fieldset/FieldsetContainer.jsx +14 -5
  166. package/src/Fieldset/FieldsetContainer.native.jsx +7 -4
  167. package/src/Fieldset/Legend.jsx +7 -2
  168. package/src/Fieldset/Legend.native.jsx +7 -2
  169. package/src/FlexGrid/Col/Col.jsx +139 -132
  170. package/src/FlexGrid/FlexGrid.jsx +79 -51
  171. package/src/FlexGrid/Row/Row.jsx +55 -48
  172. package/src/HorizontalScroll/HorizontalScroll.jsx +168 -0
  173. package/src/HorizontalScroll/HorizontalScrollButton.jsx +105 -0
  174. package/src/{Tabs → HorizontalScroll}/ScrollViewEnd.jsx +0 -0
  175. package/src/{Tabs → HorizontalScroll}/ScrollViewEnd.native.jsx +0 -0
  176. package/src/{Tabs → HorizontalScroll}/dictionary.js +0 -0
  177. package/src/HorizontalScroll/index.js +17 -0
  178. package/src/{Tabs → HorizontalScroll}/itemPositions.js +0 -0
  179. package/src/Icon/Icon.jsx +37 -35
  180. package/src/Icon/IconText.jsx +22 -17
  181. package/src/IconButton/IconButton.jsx +49 -42
  182. package/src/InputLabel/InputLabel.jsx +53 -38
  183. package/src/InputLabel/LabelContent.jsx +14 -6
  184. package/src/InputLabel/LabelContent.native.jsx +11 -2
  185. package/src/InputSupports/InputSupports.jsx +29 -34
  186. package/src/Link/ChevronLink.jsx +26 -16
  187. package/src/Link/InlinePressable.jsx +5 -3
  188. package/src/Link/InlinePressable.native.jsx +5 -3
  189. package/src/Link/Link.jsx +22 -16
  190. package/src/Link/LinkBase.jsx +67 -58
  191. package/src/Link/TextButton.jsx +30 -23
  192. package/src/List/List.jsx +6 -7
  193. package/src/List/ListItem.jsx +70 -90
  194. package/src/List/index.js +5 -0
  195. package/src/Modal/Modal.jsx +9 -4
  196. package/src/Notification/Notification.jsx +58 -43
  197. package/src/Pagination/PageButton.jsx +37 -34
  198. package/src/Pagination/Pagination.jsx +88 -92
  199. package/src/Pagination/SideButton.jsx +44 -41
  200. package/src/Progress/Progress.jsx +5 -4
  201. package/src/Progress/ProgressBar.jsx +42 -29
  202. package/src/Progress/ProgressBarBackground.jsx +5 -3
  203. package/src/Radio/Radio.jsx +85 -78
  204. package/src/Radio/RadioButton.jsx +54 -43
  205. package/src/Radio/RadioGroup.jsx +74 -63
  206. package/src/RadioCard/RadioCard.jsx +75 -68
  207. package/src/RadioCard/RadioCardGroup.jsx +82 -75
  208. package/src/Search/Search.jsx +127 -106
  209. package/src/Select/Picker.jsx +49 -42
  210. package/src/Select/Picker.native.jsx +56 -49
  211. package/src/Select/Select.jsx +115 -72
  212. package/src/SideNav/Item.jsx +53 -46
  213. package/src/SideNav/ItemsGroup.jsx +50 -43
  214. package/src/SideNav/SideNav.jsx +68 -60
  215. package/src/Skeleton/Skeleton.jsx +9 -13
  216. package/src/Spacer/Spacer.jsx +11 -4
  217. package/src/StackView/StackView.jsx +47 -23
  218. package/src/StackView/StackWrap.jsx +14 -12
  219. package/src/StackView/StackWrapBox.jsx +62 -28
  220. package/src/StackView/StackWrapGap.jsx +46 -24
  221. package/src/StackView/common.jsx +3 -2
  222. package/src/StepTracker/StepTracker.jsx +73 -62
  223. package/src/Tabs/Tabs.jsx +70 -62
  224. package/src/Tabs/TabsItem.jsx +111 -103
  225. package/src/Tags/Tags.jsx +114 -102
  226. package/src/TextInput/TextArea.jsx +5 -4
  227. package/src/TextInput/TextInput.jsx +5 -4
  228. package/src/TextInput/TextInputBase.jsx +84 -77
  229. package/src/ThemeProvider/ThemeProvider.jsx +11 -7
  230. package/src/ThemeProvider/useSetTheme.js +4 -0
  231. package/src/ThemeProvider/utils/theme-tokens.js +28 -0
  232. package/src/ToggleSwitch/ToggleSwitch.jsx +49 -50
  233. package/src/Tooltip/Tooltip.jsx +134 -130
  234. package/src/Typography/Typography.jsx +67 -44
  235. package/src/index.js +3 -1
  236. package/src/utils/a11y/index.js +1 -0
  237. package/src/utils/a11y/propTypes.js +61 -0
  238. package/src/utils/a11y/propTypes.native.js +39 -0
  239. package/src/utils/a11y/semantics.js +162 -0
  240. package/src/utils/children.jsx +60 -7
  241. package/src/utils/input.js +20 -17
  242. package/src/utils/propTypes.js +30 -76
  243. package/src/utils/useCopy.js +1 -1
  244. package/src/utils/useHash.js +8 -3
  245. package/stories/A11yText/A11yText.stories.jsx +3 -3
  246. package/stories/ActivityIndicator/ActivityIndicator.stories.jsx +2 -2
  247. package/stories/Box/Box.stories.jsx +2 -2
  248. package/stories/Button/Button.stories.jsx +3 -3
  249. package/stories/Button/ButtonGroup.stories.jsx +2 -2
  250. package/stories/Button/ButtonLink.stories.jsx +2 -2
  251. package/stories/Card/Card.stories.jsx +2 -2
  252. package/stories/Checkbox/Checkbox.stories.jsx +2 -2
  253. package/stories/Divider/Divider.stories.jsx +2 -2
  254. package/stories/ExpandCollapse/ExpandCollapse.stories.jsx +3 -3
  255. package/stories/Feedback/Feedback.stories.jsx +2 -2
  256. package/stories/FlexGrid/01 FlexGrid.stories.jsx +2 -2
  257. package/stories/FlexGrid/02 Row.stories.jsx +2 -2
  258. package/stories/FlexGrid/03 Col.stories.jsx +2 -2
  259. package/stories/Icon/Icon.stories.jsx +2 -2
  260. package/stories/IconButton/IconButton.stories.jsx +2 -2
  261. package/stories/InputLabel/InputLabel.stories.jsx +2 -2
  262. package/stories/Link/ChevronLink.stories.jsx +2 -2
  263. package/stories/Link/Link.stories.jsx +2 -2
  264. package/stories/Link/TextButton.stories.jsx +2 -2
  265. package/stories/List/List.stories.jsx +2 -2
  266. package/stories/Modal/Modal.stories.jsx +2 -2
  267. package/stories/Notification/Notification.stories.jsx +2 -2
  268. package/stories/Pagination/Pagination.stories.jsx +2 -2
  269. package/stories/Progress/Progress.stories.jsx +2 -2
  270. package/stories/Radio/Radio.stories.jsx +2 -2
  271. package/stories/RadioCard/RadioCard.stories.jsx +2 -2
  272. package/stories/Search/Search.stories.jsx +2 -2
  273. package/stories/Select/Select.stories.jsx +2 -2
  274. package/stories/SideNav/SideNav.stories.jsx +2 -2
  275. package/stories/SideNav/SideNavItem.stories.jsx +2 -2
  276. package/stories/SideNav/SideNavItemsGroup.stories.jsx +2 -2
  277. package/stories/Skeleton/Skeleton.stories.jsx +3 -3
  278. package/stories/Spacer/Spacer.stories.jsx +2 -2
  279. package/stories/StackView/StackView.stories.jsx +2 -2
  280. package/stories/StackView/StackWrap.stories.jsx +2 -2
  281. package/stories/StepTracker/StepTracker.stories.jsx +2 -2
  282. package/stories/Tabs/Tabs.stories.jsx +2 -2
  283. package/stories/Tags/Tags.stories.jsx +2 -2
  284. package/stories/TextInput/TextArea.stories.jsx +2 -2
  285. package/stories/TextInput/TextInput.stories.jsx +2 -2
  286. package/stories/ToggleSwitch/ToggleSwitch.stories.jsx +2 -2
  287. package/stories/Tooltip/Tooltip.stories.jsx +2 -2
  288. package/stories/TooltipButton/TooltipButton.stories.jsx +2 -2
  289. package/stories/Typography/Typography.stories.jsx +2 -2
  290. package/stories/platform-supports.jsx +1 -1
  291. package/stories/supports.jsx +4 -5
  292. package/src/Tabs/HorizontalScroll.jsx +0 -165
  293. package/src/Tabs/TabsScrollButton.jsx +0 -100
@@ -0,0 +1,162 @@
1
+ import { Platform } from 'react-native'
2
+ /**
3
+ * @typedef {import('react-native').AccessibilityRole} AccessibilityRole
4
+ */
5
+
6
+ /**
7
+ * This is based on the role-to-tag mapping that React Native Web uses to set HTML tags.
8
+ * It's not exported in any way from RNW, so we need to keep this up-to-date manually.
9
+ * https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/modules/AccessibilityUtil/propsToAccessibilityComponent.js
10
+ *
11
+ * Note: every role in this list is a web-only aria-role. There is no overlap between _these_ web tags
12
+ * or roles and native accessibilityRoles. Only h1, h2, h3 etc map to an RN equivalent ("heading").
13
+ *
14
+ * - RN "summary" native role maps to "region" aria-role, but setting `<section>`/"region" does not
15
+ * set React Native's "summary" role, which has a much narrower use case.
16
+ * - `<Header>`/"Banner" also do not map to RN's "heading". Only h1 / h2 etc map to RN "heading".
17
+ *
18
+ * Therefore, all of these tags / roles default to no accessibilityRole in native apps. This is not wrong:
19
+ * in general, RN accessibilityRoles tend to be more about interaction and less about semantics than web roles.
20
+ *
21
+ * RNW's one-way mapping of React Native accessibilityRoles to web aria-roles:
22
+ * https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/modules/AccessibilityUtil/propsToAriaRole.js
23
+ */
24
+ // Adding `/** @type {const} */ ({...})` denotes object content as `readonly` in many IDEs
25
+ // eslint-disable-next-line prettier/prettier
26
+ const rolesToTags = /** @type {const} */ ({
27
+ article: 'article',
28
+ banner: 'header',
29
+ blockquote: 'blockquote',
30
+ code: 'code',
31
+ complementary: 'aside',
32
+ contentinfo: 'footer',
33
+ deletion: 'del',
34
+ emphasis: 'em',
35
+ figure: 'figure',
36
+ insertion: 'ins',
37
+ form: 'form',
38
+ list: 'ul',
39
+ listitem: 'li',
40
+ main: 'main',
41
+ navigation: 'nav',
42
+ region: 'section',
43
+ strong: 'strong',
44
+
45
+ // Add special cases that are in RNW's function logic but not in its mapping object
46
+ label: 'label'
47
+ // eslint-disable-next-line prettier/prettier
48
+ })
49
+
50
+ // Invert React Native Web's mapping, so a tag gets the role that gets that tag
51
+ export const tagsToRoles = Object.fromEntries(
52
+ Object.entries(rolesToTags).map(([key, value]) => [value, key])
53
+ )
54
+
55
+ /**
56
+ * Heading HTML tags map to the "heading" accessibilityRole in native apps, which is similar
57
+ * to headings on web but without the expectation of a hierarchy of headings within one screen.
58
+ */
59
+ // eslint-disable-next-line prettier/prettier
60
+ export const headingTags = /** @type {const} */ (['h1', 'h2', 'h3', 'h4', 'h5', 'h6'])
61
+ /**
62
+ * @typedef {typeof headingTags[number]} HeadingTag
63
+ */
64
+
65
+ /**
66
+ * All HTML tags that may be set via RNW accesibility props alone and therefore may be set using
67
+ * the getA11yPropsFromHtmlTag function without changing other behaviour.
68
+ *
69
+ * Of these, only headers (h1, h2, ...h5, h6) set a corresponding accessibilityRole in native apps ("heading").
70
+ */
71
+ export const supportedTags = [...Object.keys(tagsToRoles), ...headingTags]
72
+ /**
73
+ * Uses readonly mapping keys/values to generate static types for IDEs that support TS in JSDoc.
74
+ * @typedef {keyof rolesToTags} RoleWithTag
75
+ * @typedef {typeof rolesToTags[RoleWithTag] | typeof headingTags[number]} SupportedTag
76
+ */
77
+
78
+ /**
79
+ * Subset of supported HTML tags that may be used with layout containers like Box.
80
+ *
81
+ * Of these, only headers (h1, h2, ...h5, h6) set a corresponding accessibilityRole in native apps ("heading").
82
+ */
83
+ // eslint-disable-next-line prettier/prettier
84
+ export const layoutTags = /** @type {const} */ ([
85
+ ...headingTags,
86
+ 'article',
87
+ 'aside',
88
+ 'blockquote',
89
+ 'footer',
90
+ 'figure',
91
+ 'form',
92
+ 'header',
93
+ 'ul',
94
+ 'li',
95
+ 'main',
96
+ 'nav',
97
+ 'section',
98
+ 'label'
99
+ // eslint-disable-next-line prettier/prettier
100
+ ])
101
+ /**
102
+ * @typedef {typeof layoutTags[number]} LayoutTag
103
+ */
104
+
105
+ /**
106
+ * Subset of supported HTML tags that may be used with text elements like Typography.
107
+ *
108
+ * Of these, only headers (h1, h2, ...h5, h6) set a corresponding accessibilityRole in native apps ("heading").
109
+ */
110
+ // eslint-disable-next-line prettier/prettier
111
+ export const textTags = /** @type {const} */ ([
112
+ ...headingTags,
113
+ 'blockquote',
114
+ 'code',
115
+ 'del',
116
+ 'em',
117
+ 'ins',
118
+ 'li',
119
+ 'strong',
120
+ 'label'
121
+ // eslint-disable-next-line prettier/prettier
122
+ ])
123
+ /**
124
+ * @typedef {typeof layoutTags[number]} TextTag
125
+ */
126
+
127
+ /**
128
+ * If passed a heading tag string like 'h1', 'h2' etc, returns the heading number as a number
129
+ * ready for use in `accessibilityLevel` props and similar.
130
+ *
131
+ * @param {string} [tag] - HTML tag string; returns undefined if not a {@link HeadingTag}
132
+ * @returns {'1' | '2' | '3' | '4' | '5' | '6' | undefined}
133
+ */
134
+ export const getHeadingLevel = (tag) => (headingTags.includes(tag) ? Number(tag[1]) : undefined)
135
+
136
+ /**
137
+ * Takes a supported HTML tag, and returns the accessibility props that, on web, make React Native Web
138
+ * render that tag.
139
+ *
140
+ * For cross-platform apps, a second argument may be passed with an [accessibilityRole](https://reactnative.dev/docs/accessibility#accessibilityrole)
141
+ * to use in native apps. Heading tags (h1, h2, ...h5, h6) map to "heading" role by default;
142
+ * no other supported semantic HTML tags have an equivalent native accessibilityRole.
143
+ *
144
+ * @param {SupportedTag} tag - HTML tag to use on web
145
+ * @param {AccessibilityRole | null} [nativeRole] - optional accessibilityRole for native apps
146
+ * @returns {{ accessibilityRole: string, accessibilityLevel?: string } | undefined}
147
+ */
148
+ export const getA11yPropsFromHtmlTag = (tag, nativeRole) => {
149
+ // Allow cross-platform apps to set accessibilityRoles alongside a web tag without conflict
150
+ if (nativeRole !== undefined && Platform.OS !== 'web') return { accessibilityRole: nativeRole }
151
+
152
+ if (tag) {
153
+ const accessibilityRole = tagsToRoles[tag]
154
+ if (accessibilityRole) return { accessibilityRole }
155
+
156
+ const accessibilityLevel = getHeadingLevel(tag)
157
+ if (accessibilityLevel) return { accessibilityRole: 'header', accessibilityLevel }
158
+ }
159
+ // If nothing matches or no tag supplied, return undefined and let component decide how to fall back.
160
+ // Note that return value may always be spread in objects (it is safe to spread undefined like { ...undefined })
161
+ return undefined
162
+ }
@@ -1,5 +1,6 @@
1
1
  import React, { Children, Fragment } from 'react'
2
2
  import { Text } from 'react-native'
3
+ import A11yText from '../A11yText'
3
4
 
4
5
  /**
5
6
  * Unpacks top-level fragments, so that common compositional patterns such as the following examples
@@ -44,23 +45,75 @@ export const unpackFragment = (child) => {
44
45
  return child
45
46
  }
46
47
 
48
+ const isStringOrNumber = (child) => typeof child === 'string' || typeof child === 'number'
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
51
+ const combineKeys = (childrenArray) =>
52
+ childrenArray.reduce((newKey, child) => `${newKey}${child.key || ''}`, '')
53
+
54
+ // Group wrappable children for one `<Text>` parent, merging adjacent text nodes
55
+ const wrapChild = (child, wrappedText) => {
56
+ const lastIndex = wrappedText.length - 1
57
+ // If possible, simplify content by combining text nodes into one string.
58
+ // jest-native's `.toHaveTextContent` is buggy about array of text nodes in <Text> elements.
59
+ if (lastIndex >= 0 && isStringOrNumber(child) && isStringOrNumber(wrappedText[lastIndex])) {
60
+ /* eslint-disable-next-line no-param-reassign */
61
+ wrappedText[lastIndex] = `${wrappedText[lastIndex]}${child}`
62
+ } else {
63
+ wrappedText.push(child)
64
+ }
65
+ }
66
+
47
67
  /**
48
68
  * React Native on Native crashes if text content is rendered outside `<Text>`, and on web,
49
- * text style inheritance isn't as expected.
69
+ * text style inheritance behaves differently with text compared to regular HTML.
50
70
  *
51
71
  * Call this function on children that may contain text (strings or numbers) at the top level,
52
72
  * and any that are found will be wrapped in a React Native `<Text>` element with supplied props.
53
73
  *
54
- * Note that this does not wrap strings that are nested children of the top level children:
74
+ * Note that this does not wrap strings that are nested children of rendered top level children:
55
75
  * `wrapStringsInText(<View>Some text</View>)` will not wrap the inner text and will still crash,
56
- * but `wrapStringsInText(<>{someString}{anotherString}</>)` will wrap the strings in the fragment.
76
+ * but `wrapStringsInText(<>{someString}{anotherString}</>)` wraps the strings inside the fragment.
57
77
  *
58
78
  * @param {ReactChildren} children
59
79
  * @param {TextProps} props
60
80
  * @returns {ReactChildren}
61
81
  */
62
- export const wrapStringsInText = (children, props = {}) => {
63
- return Children.map(unpackFragment(children), (child) =>
64
- typeof child === 'string' || typeof child === 'number' ? <Text {...props}>{child}</Text> : child
65
- )
82
+ export const wrapStringsInText = (children, textProps = {}) => {
83
+ const childrenArray = unpackFragment(Children.toArray(children))
84
+
85
+ // Group adjacent wrapable children together in one Text element to create as few Text elements
86
+ // as possible, e.g. give <X>Text {someString}</X> one Text, same as <X>{`Text ${someString}`}</X>
87
+ const wrapables = [[]]
88
+ let wrapablesIndex = 0
89
+ childrenArray.forEach((child) => {
90
+ if (isWrapable(child)) {
91
+ // Make this child a child of the current `Text`
92
+ wrapChild(child, wrapables[wrapablesIndex])
93
+ } else {
94
+ // Close current `Text` and start a new one after this child
95
+ wrapables.push(child, [])
96
+ wrapablesIndex += 2
97
+ }
98
+ })
99
+
100
+ const items = wrapables.reduce((flatChildren, group, index) => {
101
+ // Skip nullish children and empty arrays
102
+ if (!group || (Array.isArray(group) && !group.length)) return flatChildren
103
+
104
+ return [
105
+ ...flatChildren,
106
+ Array.isArray(group) && group.some((child) => isStringOrNumber(child)) ? (
107
+ // Wrap text nodes and their wrappable neighbours in Text with as stable a key as possible.
108
+ // Avoid one-item arrays because jest-native's `.toHaveTextContent` is buggy
109
+ // and sometimes fails to match text content in arrays.
110
+ <Text key={combineKeys(group) || index} {...textProps}>
111
+ {group.length === 1 ? group[0] : group}
112
+ </Text>
113
+ ) : (
114
+ group
115
+ )
116
+ ]
117
+ }, [])
118
+ return items.length === 1 ? items[0] : items
66
119
  }
@@ -77,16 +77,16 @@ export const useInputValue = (props = {}, hookName = 'useInputValue') => {
77
77
  valueRef.current.value = currentValue
78
78
 
79
79
  const setValue = useCallback(
80
- (arg) => {
80
+ (arg, event) => {
81
81
  if (readOnly) return
82
82
  const newValue = typeof arg === 'function' ? arg(valueRef.current.value) : arg
83
- // Only call onChange if the value actually changed
84
- if (onChange && valueRef.current.value !== newValue) onChange(newValue)
85
83
  if (!isControlled) setOwnValue(newValue)
84
+ // Call onChange handler if there's something for it to handle (event or a changed value)
85
+ if (onChange && (event || valueRef.current.value !== newValue)) onChange(newValue, event)
86
86
  },
87
87
  [isControlled, onChange, readOnly]
88
88
  )
89
- const resetValue = useCallback(() => setValue(valueRef.current.initial), [setValue])
89
+ const resetValue = useCallback((event) => setValue(valueRef.current.initial, event), [setValue])
90
90
 
91
91
  return { currentValue, setValue, resetValue, isControlled }
92
92
  }
@@ -146,23 +146,26 @@ export const useMultipleInputValues = ({
146
146
  )
147
147
  const currentValues = enforceMaxValues(currentValue)
148
148
 
149
- const setValues = useCallback((newValues) => setValue(enforceMaxValues(newValues)), [
150
- setValue,
151
- enforceMaxValues
152
- ])
149
+ const setValues = useCallback(
150
+ (newValues, event) => {
151
+ const validNewValues = enforceMaxValues(newValues)
152
+ setValue(validNewValues, event)
153
+ },
154
+ [setValue, enforceMaxValues]
155
+ )
153
156
 
154
157
  const resetValues = resetValue
155
- const unsetValues = useCallback(() => setValues([]), [setValues])
158
+ const unsetValues = useCallback((event) => setValues([], event), [setValues])
156
159
  const toggleOneValue = useCallback(
157
- (newValue) => {
160
+ (newValue, event) => {
158
161
  if (readOnly) return
159
- setValues(
160
- // This will only work with primitive values (e.g. strings, numbers), swap for .some() and
161
- // a deepEqual() function if there's any use case for toggling stored objects or arrays.
162
- currentValues.includes(newValue)
163
- ? currentValues.filter((oldValue) => oldValue !== newValue)
164
- : [...currentValues, newValue]
165
- )
162
+ // This will only work with primitive values (e.g. strings, numbers), swap for .some() and
163
+ // a deepEqual() function if there's any use case for toggling stored objects or arrays.
164
+ const newValues = currentValues.includes(newValue)
165
+ ? currentValues.filter((oldValue) => oldValue !== newValue)
166
+ : [...currentValues, newValue]
167
+
168
+ setValues(newValues, event)
166
169
  },
167
170
  [currentValues, readOnly, setValues]
168
171
  )
@@ -1,6 +1,7 @@
1
1
  import PropTypes from 'prop-types'
2
2
  import { Linking, Platform } from 'react-native'
3
- import { components as tokenKeys } from '@telus-uds/system-themes/schema'
3
+ import { components as tokenKeys } from '@telus-uds/system-theme-tokens'
4
+ import a11yPropTypes from './a11y/propTypes'
4
5
 
5
6
  export const paddingProp = {
6
7
  propType: PropTypes.shape({
@@ -51,11 +52,11 @@ const tokenValue = PropTypes.oneOfType([
51
52
  const tokenValueType = PropTypes.oneOfType([tokenValue, PropTypes.objectOf(tokenValue)])
52
53
 
53
54
  export const getTokenNames = (componentName) => {
54
- const componentTokenNames = tokenKeys[componentName]
55
- if (!componentTokenNames) {
56
- throw new Error(`No "${componentName}" tokenKeys in @telus-uds/system-themes/schema`)
55
+ const componentTokenSchema = tokenKeys[componentName]
56
+ if (!componentTokenSchema) {
57
+ throw new Error(`No "${componentName}" tokenKeys in @telus-uds/system-theme-tokens`)
57
58
  }
58
- return componentTokenNames
59
+ return Object.keys(componentTokenSchema)
59
60
  }
60
61
 
61
62
  /**
@@ -202,44 +203,6 @@ function getPropSelector(propTypes, regexp) {
202
203
  )
203
204
  }
204
205
 
205
- // React Native exports a11y prop definitions as TypeScript Interfaces, but no longer exports PropTypes
206
- // so we have to define them ourselves.
207
- const a11yPropTypes = {
208
- accessible: PropTypes.bool,
209
- focusable: PropTypes.bool,
210
-
211
- accessibilityElementsHidden: PropTypes.bool,
212
- accessibilityHint: PropTypes.string, // react-native-web ignores `accessibilityHint`
213
- accessibilityIgnoresInvertColors: PropTypes.bool,
214
- accessibilityLabel: PropTypes.string,
215
- accessibilityRole: PropTypes.string,
216
- accessibilityActions: PropTypes.arrayOf(
217
- PropTypes.shape({
218
- name: PropTypes.string.isRequired,
219
- label: PropTypes.string
220
- })
221
- ),
222
- accessibilityLiveRegion: PropTypes.oneOf(['none', 'polite', 'assertive']),
223
- accessibilityState: PropTypes.shape({
224
- disabled: PropTypes.bool,
225
- selected: PropTypes.bool,
226
- checked: PropTypes.oneOf([true, false, 'mixed']),
227
- busy: PropTypes.bool,
228
- expanded: PropTypes.bool
229
- }),
230
- accessibilityValue: PropTypes.shape({
231
- min: PropTypes.number,
232
- max: PropTypes.number,
233
- now: PropTypes.number,
234
- text: PropTypes.string
235
- }),
236
- accessibilityViewIsModal: PropTypes.bool,
237
- importantForAccessibility: PropTypes.oneOf(['auto', 'yes', 'no', 'no-hide-descendants']),
238
- onAccessibilityAction: PropTypes.func,
239
- onAccessibilityEscape: PropTypes.func,
240
- onAccessibilityTap: PropTypes.func
241
- }
242
-
243
206
  export const a11yProps = {
244
207
  /**
245
208
  * Proptypes for recognised React Native accessiblity (a11y) props.
@@ -337,8 +300,11 @@ const pressPropTypes = {
337
300
  ...pressHandlerPropTypes,
338
301
  disabled: PropTypes.bool,
339
302
  ...Platform.select({
340
- hitSlop: PropTypes.number,
341
- pressRetentionOffset: PropTypes.oneOfType([PropTypes.number, rectProp.propType])
303
+ web: {},
304
+ default: {
305
+ hitSlop: PropTypes.number,
306
+ pressRetentionOffset: PropTypes.oneOfType([PropTypes.number, rectProp.propType])
307
+ }
342
308
  })
343
309
  }
344
310
 
@@ -371,29 +337,32 @@ export const linkProps = {
371
337
  */
372
338
  select: getPropSelector(linkPropTypes),
373
339
  /**
374
- * Turn hrefs into press handlers on Native and throw if not given `onPress` xor `href`.
340
+ * Turn hrefs into press handlers on Native and throw if not given `onPress` or `href`.
375
341
  *
376
342
  * @param {({ onPress?: () => void, href?: string })}
377
343
  * @returns {(() => void)|undefined} Returns a press handler, or undefined on web if href
378
344
  * string is provided. Expects calling component to use href string on web (e.g. in `<a>`).
379
345
  */
380
346
  handleHref: ({ onPress, href }) => {
381
- // TODO: revisit this when integrating routing packages
382
- // https://github.com/telus/universal-design-system/issues/24
383
- if (href && onPress) {
384
- throw new Error("handleHref currently doesn't support both href and onPress")
385
- }
386
347
  if (!href && !onPress) {
387
348
  throw new Error('handleHref requires either href or onPress')
388
349
  }
389
- return Platform.OS !== 'web' && href ? () => Linking.openURL(href) : onPress
350
+ return Platform.select({
351
+ web: onPress,
352
+ default: (...args) => {
353
+ if (onPress) onPress(...args)
354
+ if (href) Linking.openURL(href)
355
+ }
356
+ })
390
357
  }
391
358
  }
392
359
 
393
360
  const viewPropTypes = {
394
361
  pointerEvents: PropTypes.oneOf(['all', 'none', 'box-only', 'box-none']),
395
362
  onLayout: PropTypes.func,
396
- nativeID: PropTypes.string
363
+ nativeID: PropTypes.string,
364
+ testID: PropTypes.string,
365
+ dataSet: PropTypes.object
397
366
  }
398
367
 
399
368
  export const viewProps = {
@@ -492,20 +461,19 @@ export const spacingProps = {
492
461
  }
493
462
 
494
463
  /**
495
- * Returns a prop type validator which checks whether a prop is either a component or an array of components of a given
496
- * type, based on their `name` property.
464
+ * Returns a prop type validator which checks whether a prop is either a component or an array of
465
+ * components of a given type, based on their `name` or `displayName` properties.
497
466
  * Use an array of strings for `passedName` to accept more than one component type.
498
467
  * For an array the validation fails on the first occurrence of an invalid element.
499
468
  *
500
469
  * @param {string|string[]} passedName
501
- * @param {boolean} [checkDisplayName] - if `true` then `displayName` property on the component will be validated instead of `name`
502
470
  * @return {function}
503
471
  */
504
- export const componentPropType = (passedName, checkDisplayName = false) => {
472
+ export const componentPropType = (passedName) => {
505
473
  const passedNames = typeof passedName === 'string' ? [passedName] : passedName
506
474
 
507
475
  const checkProp = (props, propName, componentName) => {
508
- if (typeof props[propName] === 'undefined' || props[propName] === null) {
476
+ if (props[propName] === undefined || props[propName] === null) {
509
477
  return undefined
510
478
  }
511
479
 
@@ -517,25 +485,11 @@ export const componentPropType = (passedName, checkDisplayName = false) => {
517
485
  .find(Boolean)
518
486
  }
519
487
 
520
- const testNameInObject = () =>
521
- typeof props[propName] === 'object' &&
522
- ((!checkDisplayName && !passedNames.includes(props[propName].type.name)) ||
523
- (checkDisplayName && !passedNames.includes(props[propName].type.displayName)))
524
-
525
- const testNameInFunction = () =>
526
- typeof props[propName] === 'function' &&
527
- ((!checkDisplayName && !passedNames.includes(props[propName].name)) ||
528
- (checkDisplayName && !passedNames.includes(props[propName].displayName)))
529
-
530
- if (
531
- (props[propName] &&
532
- typeof props[propName] !== 'object' &&
533
- typeof props[propName] !== 'function') ||
534
- testNameInObject() ||
535
- testNameInFunction()
536
- ) {
488
+ const nameInProp = props[propName].type?.displayName || props[propName].type?.name
489
+ if (!nameInProp || !passedNames.includes(nameInProp)) {
490
+ const propDescription = nameInProp ? `Component ${nameInProp}` : typeof props[propName]
537
491
  return new Error(
538
- `${componentName}: Component passed to \`${propName}\` prop should be ${passedNames.join(
492
+ `${componentName}: ${propDescription} was passed to \`${propName}\` prop; should be ${passedNames.join(
539
493
  ' or '
540
494
  )}`
541
495
  )
@@ -29,7 +29,7 @@ export const DEFAULT_COPY = 'en'
29
29
  */
30
30
  function useCopy({ dictionary, copy = DEFAULT_COPY }) {
31
31
  if (typeof copy === 'string') {
32
- return (key) => dictionary[copy][key]
32
+ return (key) => (key ? dictionary[copy][key] : dictionary[copy])
33
33
  }
34
34
 
35
35
  // support overriding the entire copy dictionary with an object for a single language
@@ -1,6 +1,11 @@
1
1
  import { useEffect, useState } from 'react'
2
2
 
3
- const doAction = (action) => typeof action === 'function' && action(window?.location?.hash)
3
+ const doAction = (action, event) =>
4
+ typeof action === 'function' && action(window?.location?.hash, event)
5
+
6
+ /**
7
+ * @typedef {import('react').SyntheticEvent} SyntheticEvent
8
+ */
4
9
 
5
10
  /**
6
11
  * Calls a function (passing it the current hash) based on the current hash state on mount,
@@ -10,7 +15,7 @@ const doAction = (action) => typeof action === 'function' && action(window?.loca
10
15
  *
11
16
  * On Native, this is replaced with a harmless no-op function as there is no direct equivalent.
12
17
  *
13
- * @param {(hash: string) => void} action - a function to act on the current hash on load and when it changes
18
+ * @param {(hash: string, event?: SyntheticEvent) => void} action - a function to act on the current hash on load and when it changes
14
19
  * @returns
15
20
  */
16
21
  const useHash = (action, isReady = true) => {
@@ -26,7 +31,7 @@ const useHash = (action, isReady = true) => {
26
31
 
27
32
  // Bind the action for each hash change; do re-bind if the function changes.
28
33
  useEffect(() => {
29
- const handleChange = () => doAction(action)
34
+ const handleChange = (event) => doAction(action, event)
30
35
  window.addEventListener('hashchange', handleChange)
31
36
  return () => window.removeEventListener('hashchange', handleChange)
32
37
  }, [action])
@@ -2,8 +2,8 @@
2
2
  import React from 'react'
3
3
  import { StyleSheet, View } from 'react-native'
4
4
 
5
- import A11yText from '../../lib/A11yText'
6
- import { Button, Typography } from '../../lib'
5
+ import A11yText from '../../src/A11yText'
6
+ import { Button, Typography } from '../../src'
7
7
  import { EachParentType, parentTypesParams } from '../supports'
8
8
 
9
9
  const defaultArgs = {
@@ -12,7 +12,7 @@ const defaultArgs = {
12
12
  }
13
13
 
14
14
  export default {
15
- title: 'Base/A11yText',
15
+ title: 'A11yText',
16
16
  component: A11yText,
17
17
  parameters: defaultArgs
18
18
  }
@@ -1,10 +1,10 @@
1
1
  /* eslint-disable react/no-multi-comp */
2
2
  import React from 'react'
3
- import { ActivityIndicator } from '../../lib'
3
+ import { ActivityIndicator } from '../../src'
4
4
  import { EachParentType, parentTypesParams } from '../supports'
5
5
 
6
6
  export default {
7
- title: 'Base/ActivityIndicator',
7
+ title: 'ActivityIndicator',
8
8
  component: ActivityIndicator,
9
9
  args: {
10
10
  label: 'loading...'
@@ -2,7 +2,7 @@
2
2
  import React from 'react'
3
3
 
4
4
  import { View, StyleSheet } from 'react-native'
5
- import { Box, Typography } from '../../lib'
5
+ import { Box, Typography } from '../../src'
6
6
  import {
7
7
  spacingObjectArg,
8
8
  Container,
@@ -12,7 +12,7 @@ import {
12
12
  } from '../supports'
13
13
 
14
14
  export default {
15
- title: 'Base/Box',
15
+ title: 'Box',
16
16
  component: Box
17
17
  }
18
18
 
@@ -1,8 +1,8 @@
1
1
  /* eslint-disable react/no-multi-comp */
2
2
  import React from 'react'
3
- import { Button, useTheme } from '../../lib'
3
+ import { Button, useTheme } from '../../src'
4
4
  import { Container, useVariants, EachParentType, parentTypesParams } from '../supports'
5
- import { getComponentTheme } from '../../lib/ThemeProvider/utils'
5
+ import { getComponentTheme } from '../../src/ThemeProvider/utils'
6
6
 
7
7
  export const Default = (args) => <Button {...args} />
8
8
  Default.storyName = 'Button'
@@ -10,7 +10,7 @@ Default.storyName = 'Button'
10
10
  const defaultLabel = "I'm a button"
11
11
 
12
12
  export default {
13
- title: 'Base/Button',
13
+ title: 'Button',
14
14
  component: Button,
15
15
  args: {
16
16
  // eslint-disable-next-line no-console
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable react/no-multi-comp */
2
2
  import React, { useState } from 'react'
3
3
  import { View } from 'react-native'
4
- import { ButtonGroup, Typography } from '../../lib'
4
+ import { ButtonGroup, Typography } from '../../src'
5
5
  import { Container } from '../supports'
6
6
 
7
7
  const defaultArgs = {
@@ -22,7 +22,7 @@ const defaultControlledArgs = {
22
22
  }
23
23
 
24
24
  export default {
25
- title: 'Base/ButtonGroup',
25
+ title: 'ButtonGroup',
26
26
  component: ButtonGroup,
27
27
  args: {
28
28
  ...defaultArgs
@@ -1,9 +1,9 @@
1
1
  import React from 'react'
2
- import { ButtonLink } from '../../lib'
2
+ import { ButtonLink } from '../../src'
3
3
  import { Container, useVariants } from '../supports'
4
4
 
5
5
  export default {
6
- title: 'Base/ButtonLink',
6
+ title: 'ButtonLink',
7
7
  component: ButtonLink,
8
8
  args: {
9
9
  children: "I'm a button link",
@@ -2,11 +2,11 @@
2
2
  import React from 'react'
3
3
  import { StyleSheet, Text, View } from 'react-native'
4
4
 
5
- import { Card } from '../../lib'
5
+ import { Card } from '../../src'
6
6
  import { Container, useVariants, EachParentType, parentTypesParams } from '../supports'
7
7
 
8
8
  export default {
9
- title: 'Base/Card',
9
+ title: 'Card',
10
10
  component: Card
11
11
  }
12
12
 
@@ -1,11 +1,11 @@
1
1
  /* eslint-disable react/no-multi-comp */
2
2
  import React from 'react'
3
3
 
4
- import { Checkbox, CheckboxGroup, Typography } from '../../lib'
4
+ import { Checkbox, CheckboxGroup, Typography } from '../../src'
5
5
  import { Container, EachParentType, parentTypesParams } from '../supports'
6
6
 
7
7
  export default {
8
- title: 'Base/Checkbox',
8
+ title: 'Checkbox',
9
9
  component: Checkbox,
10
10
  argTypes: {
11
11
  checked: {