@telus-uds/components-base 1.0.1 → 1.3.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 (193) hide show
  1. package/.storybook/main.js +4 -0
  2. package/.storybook/preview.js +37 -0
  3. package/.turbo/turbo-build.log +5 -0
  4. package/CHANGELOG.md +32 -0
  5. package/README.md +1 -1
  6. package/__fixtures__/Accessible.js +4 -2
  7. package/__fixtures__/Accessible.native.js +5 -2
  8. package/__fixtures__/testTheme.js +9 -0
  9. package/__tests__/FlexGrid/Col.test.jsx +6 -10
  10. package/__tests__/HorizontalScroll/HorizontalScroll.test.jsx +1 -0
  11. package/__tests__/ToggleSwitch/ToggleSwitch.test.jsx +10 -0
  12. package/__tests__/ToggleSwitch/ToggleSwitchGroup.test.jsx +192 -0
  13. package/__tests__/utils/props.test.js +36 -0
  14. package/__tests__/utils/semantics.test.jsx +1 -10
  15. package/babel.config.js +9 -16
  16. package/component-docs.json +10142 -0
  17. package/generate-component-docs.js +59 -0
  18. package/lib/A11yText/index.js +2 -2
  19. package/lib/ActivityIndicator/index.js +3 -3
  20. package/lib/Box/Box.js +4 -4
  21. package/lib/Button/Button.js +2 -2
  22. package/lib/Button/ButtonBase.js +20 -6
  23. package/lib/Button/ButtonGroup.js +10 -12
  24. package/lib/Button/ButtonLink.js +4 -4
  25. package/lib/Button/propTypes.js +4 -2
  26. package/lib/Card/Card.js +2 -2
  27. package/lib/Card/CardBase.js +6 -9
  28. package/lib/Card/PressableCardBase.js +12 -6
  29. package/lib/Checkbox/Checkbox.js +3 -5
  30. package/lib/Divider/Divider.js +2 -2
  31. package/lib/FlexGrid/FlexGrid.js +4 -4
  32. package/lib/FlexGrid/helpers/index.js +1 -4
  33. package/lib/IconButton/IconButton.js +11 -6
  34. package/lib/Link/LinkBase.js +19 -12
  35. package/lib/List/List.js +4 -5
  36. package/lib/List/ListItem.js +14 -27
  37. package/lib/List/index.js +15 -0
  38. package/lib/Pagination/PageButton.js +4 -8
  39. package/lib/Pagination/Pagination.js +16 -4
  40. package/lib/Pagination/SideButton.js +3 -1
  41. package/lib/Progress/Progress.js +2 -2
  42. package/lib/Progress/ProgressBar.js +2 -2
  43. package/lib/Radio/Radio.js +3 -5
  44. package/lib/Spacer/Spacer.js +2 -2
  45. package/lib/StackView/StackWrap.js +9 -5
  46. package/lib/StackView/getStackedContent.js +1 -1
  47. package/lib/StepTracker/StepTracker.js +2 -2
  48. package/lib/Tabs/Tabs.js +12 -4
  49. package/lib/Tabs/TabsItem.js +12 -6
  50. package/lib/Tags/Tags.js +9 -9
  51. package/lib/ThemeProvider/useThemeTokens.js +3 -3
  52. package/lib/ThemeProvider/utils/theme-tokens.js +3 -3
  53. package/lib/ToggleSwitch/ToggleSwitch.js +105 -43
  54. package/lib/ToggleSwitch/ToggleSwitchGroup.js +230 -0
  55. package/lib/ToggleSwitch/index.js +14 -4
  56. package/lib/index.js +28 -9
  57. package/lib/utils/a11y/semantics.js +4 -3
  58. package/lib/utils/index.js +14 -5
  59. package/lib/utils/pressability.js +2 -2
  60. package/lib/utils/props/a11yProps.js +153 -0
  61. package/lib/utils/props/clickProps.js +36 -0
  62. package/lib/utils/props/componentPropType.js +70 -0
  63. package/lib/utils/props/copyPropTypes.js +14 -0
  64. package/lib/utils/props/getPropSelector.js +13 -0
  65. package/lib/utils/props/hrefAttrsProp.js +41 -0
  66. package/lib/utils/props/index.js +149 -0
  67. package/lib/utils/props/linkProps.js +64 -0
  68. package/lib/utils/props/paddingProp.js +20 -0
  69. package/lib/utils/props/pressProps.js +57 -0
  70. package/lib/utils/props/rectProp.js +20 -0
  71. package/lib/utils/props/responsiveProps.js +40 -0
  72. package/lib/utils/props/selectSystemProps.js +31 -0
  73. package/lib/utils/props/spacingProps.js +71 -0
  74. package/lib/utils/props/tokens.js +145 -0
  75. package/lib/utils/props/variantProp.js +28 -0
  76. package/lib/utils/props/viewProps.js +34 -0
  77. package/lib/utils/useResponsiveProp.js +1 -1
  78. package/lib/utils/useSpacingScale.js +4 -4
  79. package/lib/utils/withLinkRouter.js +98 -0
  80. package/package.json +9 -5
  81. package/release-context.json +4 -4
  82. package/src/A11yText/index.jsx +1 -1
  83. package/src/ActivityIndicator/index.jsx +1 -1
  84. package/src/Box/Box.jsx +5 -4
  85. package/src/Button/Button.jsx +1 -1
  86. package/src/Button/ButtonBase.jsx +11 -4
  87. package/src/Button/ButtonGroup.jsx +17 -8
  88. package/src/Button/ButtonLink.jsx +1 -1
  89. package/src/Button/propTypes.js +2 -1
  90. package/src/Card/Card.jsx +1 -1
  91. package/src/Card/CardBase.jsx +6 -5
  92. package/src/Card/PressableCardBase.jsx +7 -5
  93. package/src/Checkbox/Checkbox.jsx +1 -3
  94. package/src/Divider/Divider.jsx +2 -2
  95. package/src/FlexGrid/FlexGrid.jsx +11 -5
  96. package/src/FlexGrid/helpers/index.js +1 -3
  97. package/src/IconButton/IconButton.jsx +7 -5
  98. package/src/Link/LinkBase.jsx +7 -5
  99. package/src/List/List.jsx +2 -4
  100. package/src/List/ListItem.jsx +11 -26
  101. package/src/List/index.js +5 -0
  102. package/src/Pagination/PageButton.jsx +5 -8
  103. package/src/Pagination/Pagination.jsx +29 -2
  104. package/src/Pagination/SideButton.jsx +2 -2
  105. package/src/Progress/Progress.jsx +1 -1
  106. package/src/Progress/ProgressBar.jsx +1 -1
  107. package/src/Radio/Radio.jsx +1 -3
  108. package/src/Spacer/Spacer.jsx +2 -2
  109. package/src/StackView/StackWrap.jsx +7 -6
  110. package/src/StackView/getStackedContent.jsx +1 -1
  111. package/src/StepTracker/StepTracker.jsx +1 -1
  112. package/src/Tabs/Tabs.jsx +49 -22
  113. package/src/Tabs/TabsItem.jsx +11 -7
  114. package/src/Tags/Tags.jsx +1 -7
  115. package/src/ThemeProvider/useThemeTokens.js +3 -3
  116. package/src/ThemeProvider/utils/theme-tokens.js +3 -3
  117. package/src/ToggleSwitch/ToggleSwitch.jsx +93 -41
  118. package/src/ToggleSwitch/ToggleSwitchGroup.jsx +203 -0
  119. package/src/ToggleSwitch/index.js +2 -1
  120. package/src/index.js +2 -2
  121. package/src/utils/a11y/semantics.js +3 -2
  122. package/src/utils/index.js +2 -1
  123. package/src/utils/pressability.js +1 -1
  124. package/src/utils/props/a11yProps.js +151 -0
  125. package/src/utils/props/clickProps.js +31 -0
  126. package/src/utils/props/componentPropType.js +67 -0
  127. package/src/utils/props/copyPropTypes.js +3 -0
  128. package/src/utils/props/getPropSelector.js +14 -0
  129. package/src/utils/props/hrefAttrsProp.js +25 -0
  130. package/src/utils/props/index.js +15 -0
  131. package/src/utils/props/linkProps.js +43 -0
  132. package/src/utils/props/paddingProp.js +10 -0
  133. package/src/utils/props/pressProps.js +45 -0
  134. package/src/utils/props/rectProp.js +10 -0
  135. package/src/utils/props/responsiveProps.js +30 -0
  136. package/src/utils/props/selectSystemProps.js +25 -0
  137. package/src/utils/props/spacingProps.js +58 -0
  138. package/src/utils/props/tokens.js +150 -0
  139. package/src/utils/props/variantProp.js +20 -0
  140. package/src/utils/props/viewProps.js +23 -0
  141. package/src/utils/useResponsiveProp.js +1 -1
  142. package/src/utils/useSpacingScale.js +4 -4
  143. package/src/utils/withLinkRouter.jsx +68 -0
  144. package/stories/A11yText/A11yText.stories.jsx +1 -1
  145. package/stories/ActivityIndicator/ActivityIndicator.stories.jsx +1 -1
  146. package/stories/Box/Box.stories.jsx +1 -1
  147. package/stories/Button/Button.stories.jsx +1 -1
  148. package/stories/Button/ButtonGroup.stories.jsx +1 -1
  149. package/stories/Button/ButtonLink.stories.jsx +1 -1
  150. package/stories/Card/Card.stories.jsx +1 -1
  151. package/stories/Checkbox/Checkbox.stories.jsx +1 -1
  152. package/stories/Divider/Divider.stories.jsx +1 -1
  153. package/stories/ExpandCollapse/ExpandCollapse.stories.jsx +1 -1
  154. package/stories/Feedback/Feedback.stories.jsx +1 -1
  155. package/stories/FlexGrid/01 FlexGrid.stories.jsx +1 -1
  156. package/stories/FlexGrid/02 Row.stories.jsx +1 -1
  157. package/stories/FlexGrid/03 Col.stories.jsx +1 -1
  158. package/stories/Icon/Icon.stories.jsx +1 -1
  159. package/stories/IconButton/IconButton.stories.jsx +1 -1
  160. package/stories/InputLabel/InputLabel.stories.jsx +1 -1
  161. package/stories/Link/ChevronLink.stories.jsx +1 -1
  162. package/stories/Link/Link.stories.jsx +1 -1
  163. package/stories/Link/TextButton.stories.jsx +1 -1
  164. package/stories/List/List.stories.jsx +1 -1
  165. package/stories/Modal/Modal.stories.jsx +1 -1
  166. package/stories/Notification/Notification.stories.jsx +1 -1
  167. package/stories/Pagination/Pagination.stories.jsx +1 -1
  168. package/stories/Progress/Progress.stories.jsx +1 -1
  169. package/stories/Radio/Radio.stories.jsx +1 -1
  170. package/stories/RadioCard/RadioCard.stories.jsx +1 -1
  171. package/stories/Search/Search.stories.jsx +1 -1
  172. package/stories/Select/Select.stories.jsx +1 -1
  173. package/stories/SideNav/SideNav.stories.jsx +1 -1
  174. package/stories/SideNav/SideNavItem.stories.jsx +1 -1
  175. package/stories/SideNav/SideNavItemsGroup.stories.jsx +1 -1
  176. package/stories/Skeleton/Skeleton.stories.jsx +1 -1
  177. package/stories/Spacer/Spacer.stories.jsx +1 -1
  178. package/stories/StackView/StackView.stories.jsx +1 -1
  179. package/stories/StackView/StackWrap.stories.jsx +1 -1
  180. package/stories/StepTracker/StepTracker.stories.jsx +1 -1
  181. package/stories/Tabs/Tabs.stories.jsx +1 -1
  182. package/stories/Tags/Tags.stories.jsx +1 -1
  183. package/stories/TextInput/TextArea.stories.jsx +2 -1
  184. package/stories/TextInput/TextInput.stories.jsx +1 -1
  185. package/stories/ToggleSwitch/ToggleSwitch.stories.jsx +6 -2
  186. package/stories/ToggleSwitch/ToggleSwitchGroup.stories.jsx +81 -0
  187. package/stories/Tooltip/Tooltip.stories.jsx +1 -1
  188. package/stories/TooltipButton/TooltipButton.stories.jsx +1 -1
  189. package/stories/Typography/Typography.stories.jsx +1 -1
  190. package/stories/supports.jsx +2 -3
  191. package/.ultra.cache.json +0 -1
  192. package/lib/utils/propTypes.js +0 -623
  193. package/src/utils/propTypes.js +0 -640
package/lib/List/List.js CHANGED
@@ -15,7 +15,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
15
15
 
16
16
  var _utils = require("../utils");
17
17
 
18
- var _propTypes2 = require("../utils/propTypes");
18
+ var _props = require("../utils/props");
19
19
 
20
20
  var _ListItem = _interopRequireDefault(require("./ListItem"));
21
21
 
@@ -28,7 +28,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
28
28
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
29
 
30
30
  /**
31
- * A Unordered List component has a child a ListItem that
31
+ * An unordered List component has a child a ListItem that
32
32
  * allows icon, dividers and customized typography
33
33
  */
34
34
  const List = /*#__PURE__*/(0, _react.forwardRef)(({
@@ -43,7 +43,7 @@ const List = /*#__PURE__*/(0, _react.forwardRef)(({
43
43
  default: 'none'
44
44
  });
45
45
 
46
- const a11y = _propTypes2.a11yProps.select(rest);
46
+ const a11y = _props.a11yProps.select(rest);
47
47
 
48
48
  const items = _react.Children.map(children, (child, index) => {
49
49
  if (child.type.name === _ListItem.default.name) {
@@ -66,8 +66,7 @@ const List = /*#__PURE__*/(0, _react.forwardRef)(({
66
66
  });
67
67
  });
68
68
  List.displayName = 'List';
69
- List.Item = _ListItem.default;
70
- List.propTypes = { ..._propTypes2.a11yProps.types,
69
+ List.propTypes = { ..._props.a11yProps.types,
71
70
  tokens: (0, _utils.getTokensPropType)('List'),
72
71
  variant: _utils.variantProp.propType,
73
72
  children: (0, _utils.componentPropType)('ListItem'),
@@ -11,8 +11,6 @@ var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Vi
11
11
 
12
12
  var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
13
13
 
14
- var _Text = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Text"));
15
-
16
14
  var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
17
15
 
18
16
  var _propTypes = _interopRequireDefault(require("prop-types"));
@@ -57,6 +55,12 @@ const selectItemIconTokens = ({
57
55
  color: itemIconColor
58
56
  });
59
57
 
58
+ const selectCommonIconStyles = ({
59
+ iconMarginTop
60
+ }) => ({
61
+ marginTop: iconMarginTop
62
+ });
63
+
60
64
  const selectSideItemContainerStyles = ({
61
65
  listGutter
62
66
  }) => ({
@@ -113,6 +117,7 @@ const ListItem = /*#__PURE__*/(0, _react.forwardRef)(({
113
117
  const itemBulletContainerStyles = selectBulletContainerStyles(themeTokens);
114
118
  const itemBulletStyles = selectBulletStyles(themeTokens);
115
119
  const iconTokens = selectItemIconTokens(themeTokens);
120
+ const commonIconStyles = selectCommonIconStyles(themeTokens);
116
121
  const sideItemContainerStyles = selectSideItemContainerStyles(themeTokens);
117
122
 
118
123
  const accessibilityRole = _Platform.default.select({
@@ -120,27 +125,12 @@ const ListItem = /*#__PURE__*/(0, _react.forwardRef)(({
120
125
  default: 'item'
121
126
  });
122
127
 
123
- const areChildrenStrings = () => {
124
- if (Array.isArray(children)) {
125
- return children.every(child => typeof child === 'string');
126
- }
127
-
128
- return typeof children === 'string';
129
- };
130
-
131
- const renderItem = () => {
132
- if (areChildrenStrings()) {
133
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
134
- style: itemStyles,
135
- children: children
136
- });
137
- }
138
-
139
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
140
- style: staticStyles.wrap,
141
- children: children
142
- });
143
- };
128
+ const renderItem = () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
129
+ style: staticStyles.wrap,
130
+ children: (0, _utils.wrapStringsInText)(children, {
131
+ style: itemStyles
132
+ })
133
+ });
144
134
  /**
145
135
  * Function responsible returning styling, in case the item is the last shouldn't
146
136
  * add extra margin on the bottom, if "showDivider" is true it should add a divider
@@ -171,7 +161,7 @@ const ListItem = /*#__PURE__*/(0, _react.forwardRef)(({
171
161
 
172
162
  if (icon) {
173
163
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
174
- style: [sideItemContainerStyles, areChildrenStrings() ? staticStyles.centeredIcons : undefined],
164
+ style: [sideItemContainerStyles, commonIconStyles],
175
165
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
176
166
  size: iconSize || iconTokens.size,
177
167
  color: iconColor || iconTokens.color
@@ -201,9 +191,6 @@ const staticStyles = _StyleSheet.default.create({
201
191
  itemContainer: {
202
192
  flexDirection: 'row'
203
193
  },
204
- centeredIcons: {
205
- justifyContent: 'center'
206
- },
207
194
  wrap: {
208
195
  flex: 1
209
196
  }
package/lib/List/index.js CHANGED
@@ -3,11 +3,26 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "ListBase", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _List.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "ListItem", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _ListItem.default;
16
+ }
17
+ });
6
18
  exports.default = void 0;
7
19
 
8
20
  var _List = _interopRequireDefault(require("./List"));
9
21
 
22
+ var _ListItem = _interopRequireDefault(require("./ListItem"));
23
+
10
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
25
 
26
+ _List.default.Item = _ListItem.default;
12
27
  var _default = _List.default;
13
28
  exports.default = _default;
@@ -78,18 +78,14 @@ const PageButton = /*#__PURE__*/(0, _react.forwardRef)(({
78
78
  });
79
79
  });
80
80
  PageButton.displayName = 'PageButton';
81
- PageButton.propTypes = {
82
- // Spreading any props into a secondary component accessed like Pagination.PageButton
83
- // crashes a Docusaurus props table, but only in production, not in development
84
- onPress: _propTypes.default.func,
85
- href: _propTypes.default.string,
86
- // If the above is fixed, the above can be replaced with this which includes full a11y etc:
87
- // ...linkProps.types,
81
+ PageButton.propTypes = { ..._utils.linkProps.types,
88
82
  label: _propTypes.default.string,
89
83
  isActive: _propTypes.default.bool,
90
84
  copy: _utils.copyPropTypes,
91
85
  variant: _utils.variantProp.propType,
92
86
  tokens: (0, _utils.getTokensPropType)('PaginationPageButton')
93
87
  };
94
- var _default = PageButton;
88
+
89
+ var _default = (0, _utils.withLinkRouter)(PageButton);
90
+
95
91
  exports.default = _default;
@@ -55,7 +55,9 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)(({
55
55
  variant,
56
56
  tokens,
57
57
  sideButtonVariant,
58
- sideButtonTokens
58
+ sideButtonTokens,
59
+ LinkRouter,
60
+ linkRouterProps
59
61
  }, ref) => {
60
62
  const viewport = (0, _ViewportProvider.useViewport)();
61
63
  const {
@@ -93,13 +95,21 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)(({
93
95
  direction: "previous",
94
96
  copy: copy,
95
97
  variant: sideButtonVariant,
96
- tokens: sideButtonTokens
98
+ tokens: sideButtonTokens,
99
+ LinkRouter: LinkRouter,
100
+ linkRouterProps: linkRouterProps
97
101
  }), ...items.map((child, itemIndex) => {
98
102
  const buttonLabel = `${itemIndex + 1}`;
99
103
  const itemProps = getItemProps(itemIndex);
104
+ const ItemLinkRouter = itemProps.LinkRouter ?? LinkRouter;
105
+ const itemLinkRouterProps = { ...linkRouterProps,
106
+ ...itemProps.linkRouterProps
107
+ };
100
108
 
101
109
  if (shouldRenderButton(itemIndex)) {
102
110
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PageButton.default, { ...itemProps,
111
+ LinkRouter: ItemLinkRouter,
112
+ linkRouterProps: itemLinkRouterProps,
103
113
  label: buttonLabel,
104
114
  copy: copy,
105
115
  isActive: isItemActive(itemIndex)
@@ -118,7 +128,9 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)(({
118
128
  direction: "next",
119
129
  copy: copy,
120
130
  variant: sideButtonVariant,
121
- tokens: sideButtonTokens
131
+ tokens: sideButtonTokens,
132
+ LinkRouter: LinkRouter,
133
+ linkRouterProps: linkRouterProps
122
134
  })];
123
135
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
124
136
  style: staticStyles.container,
@@ -132,7 +144,7 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)(({
132
144
  });
133
145
  _PageButton.default.displayName = 'PageButton';
134
146
  Pagination.PageButton = _PageButton.default;
135
- Pagination.propTypes = {
147
+ Pagination.propTypes = { ..._utils.withLinkRouter.propTypes,
136
148
  children: (0, _utils.componentPropType)('PageButton'),
137
149
  copy: _utils.copyPropTypes,
138
150
  variant: _utils.variantProp.propType,
@@ -125,5 +125,7 @@ SideButton.propTypes = {
125
125
  copy: _utils.copyPropTypes,
126
126
  ..._utils.linkProps.types
127
127
  };
128
- var _default = SideButton;
128
+
129
+ var _default = (0, _utils.withLinkRouter)(SideButton);
130
+
129
131
  exports.default = _default;
@@ -11,7 +11,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
12
  var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
13
13
 
14
- var _propTypes2 = require("../utils/propTypes");
14
+ var _props = require("../utils/props");
15
15
 
16
16
  var _ThemeProvider = require("../ThemeProvider");
17
17
 
@@ -79,7 +79,7 @@ const Progress = /*#__PURE__*/(0, _react.forwardRef)(({
79
79
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
80
80
  ref: ref,
81
81
  style: selectProgressStyles(themeTokens),
82
- ..._propTypes2.a11yProps.select(rest),
82
+ ..._props.a11yProps.select(rest),
83
83
  children: children
84
84
  });
85
85
  });
@@ -17,7 +17,7 @@ var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Vi
17
17
 
18
18
  var _ProgressBarBackground = _interopRequireDefault(require("./ProgressBarBackground"));
19
19
 
20
- var _propTypes2 = require("../utils/propTypes");
20
+ var _props = require("../utils/props");
21
21
 
22
22
  var _ThemeProvider = require("../ThemeProvider");
23
23
 
@@ -102,7 +102,7 @@ const ProgressBar = /*#__PURE__*/(0, _react.forwardRef)(({
102
102
  now: percentage,
103
103
  text: `${percentage}%`
104
104
  },
105
- ..._propTypes2.a11yProps.select(rest)
105
+ ..._props.a11yProps.select(rest)
106
106
  };
107
107
  return percentage > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
108
108
  ref: ref,
@@ -25,7 +25,7 @@ var _ThemeProvider = require("../ThemeProvider");
25
25
 
26
26
  var _utils = require("../utils");
27
27
 
28
- var _propTypes2 = require("../utils/propTypes");
28
+ var _props = require("../utils/props");
29
29
 
30
30
  var _StackView = _interopRequireDefault(require("../StackView"));
31
31
 
@@ -37,8 +37,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
37
37
 
38
38
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
39
39
 
40
- // @todo move `LabelContent` outside of the `InputLabel` and fix
41
- // the issue with the cursor not being pointer on Web
42
40
  const selectContainerStyles = ({
43
41
  containerBackgroundColor,
44
42
  containerBorderRadius,
@@ -165,7 +163,7 @@ const Radio = /*#__PURE__*/(0, _react.forwardRef)(({
165
163
  if ((event === null || event === void 0 ? void 0 : event.key) === ' ') handleChange(event);
166
164
  };
167
165
 
168
- const accessibilityProps = _propTypes2.a11yProps.select(rest);
166
+ const accessibilityProps = _props.a11yProps.select(rest);
169
167
 
170
168
  const uniqueId = (0, _utils.useUniqueId)('radio');
171
169
  const inputId = id ?? uniqueId;
@@ -220,7 +218,7 @@ const Radio = /*#__PURE__*/(0, _react.forwardRef)(({
220
218
  });
221
219
  });
222
220
  Radio.displayName = 'Radio';
223
- Radio.propTypes = { ..._propTypes2.a11yProps.propTypes,
221
+ Radio.propTypes = { ..._props.a11yProps.propTypes,
224
222
 
225
223
  /**
226
224
  * Use `checked` for controlled Radio. For uncontrolled Radio, use the `defaultChecked` prop.
@@ -24,8 +24,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
24
24
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
25
 
26
26
  /**
27
- * @typedef {import('../utils/propTypes.js').SpacingValue} SpacingValue
28
- * @typedef {import('../utils/propTypes.js').SpacingObject} SpacingObject
27
+ * @typedef {import('../utils/props/spacingProps.js').SpacingValue} SpacingValue
28
+ * @typedef {import('../utils/props/spacingProps.js').SpacingObject} SpacingObject
29
29
  */
30
30
  const selectSizeStyle = (size, direction) => ({
31
31
  // Only apply space in one direction at a time, else large spacers will increase the
@@ -21,8 +21,15 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
21
21
 
22
22
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
23
 
24
- // CSS.supports needs an example of the type of value you intend to use.
24
+ // In Jest/CI/SSR, global CSS isn't always available and doesn't always have .supports method
25
+ const cssSupports = (...args) => {
26
+ var _window$CSS;
27
+
28
+ return typeof window !== 'undefined' && typeof ((_window$CSS = window.CSS) === null || _window$CSS === void 0 ? void 0 : _window$CSS.supports) === 'function' && window.CSS.supports(...args);
29
+ }; // CSS.supports needs an example of the type of value you intend to use.
25
30
  // Will be an integer appended `px` after hooks and JSX styles are resolved.
31
+
32
+
26
33
  const exampleGapValue = '1px';
27
34
  /**
28
35
  * StackWrap is an alternative to StackView where the spaced items are allowed to wrap.
@@ -33,15 +40,12 @@ const exampleGapValue = '1px';
33
40
  */
34
41
 
35
42
  const StackWrap = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
36
- var _CSS;
37
-
38
43
  const {
39
44
  space
40
45
  } = props; // Don't apply separate gap if `null` or `undefined`, so can be unset in Storybook etc
41
46
 
42
47
  const gap = props.gap ?? space;
43
- const canUseCSSGap = _Platform.default.OS === 'web' && gap === space && // In Jest/CI, global CSS isn't always available and doesn't always have .supports method
44
- typeof ((_CSS = CSS) === null || _CSS === void 0 ? void 0 : _CSS.supports) === 'function' && CSS.supports('gap', exampleGapValue);
48
+ const canUseCSSGap = _Platform.default.OS === 'web' && gap === space && cssSupports('gap', exampleGapValue);
45
49
  return canUseCSSGap ?
46
50
  /*#__PURE__*/
47
51
  // If possible, use the cleaner implementation that applies CSS `gap` styles to the container.
@@ -24,7 +24,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
24
24
  /**
25
25
  * @typedef {import('react').ReactChildren} ReactChildren
26
26
  * @typedef {import('react').ReactElement} ReactElement
27
- * @typedef {import('../utils/propTypes.js').SpacingValue} SpacingValue
27
+ * @typedef {import('../utils/props/spacingProps.js').SpacingValue} SpacingValue
28
28
  */
29
29
 
30
30
  /**
@@ -21,7 +21,7 @@ var _ThemeProvider = require("../ThemeProvider");
21
21
 
22
22
  var _utils = require("../utils");
23
23
 
24
- var _propTypes2 = require("../utils/propTypes");
24
+ var _props = require("../utils/props");
25
25
 
26
26
  var _ViewportProvider = require("../ViewportProvider");
27
27
 
@@ -136,7 +136,7 @@ const StepTracker = /*#__PURE__*/(0, _react.forwardRef)(({
136
136
  now: current,
137
137
  text: steps[current]
138
138
  },
139
- ..._propTypes2.a11yProps.select(rest)
139
+ ..._props.a11yProps.select(rest)
140
140
  };
141
141
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
142
142
  ref: ref,
package/lib/Tabs/Tabs.js CHANGED
@@ -46,7 +46,9 @@ const Tabs = /*#__PURE__*/(0, _react.forwardRef)(({
46
46
  value,
47
47
  initialValue,
48
48
  onChange,
49
- items = []
49
+ items = [],
50
+ LinkRouter,
51
+ linkRouterProps
50
52
  }, ref) => {
51
53
  const {
52
54
  space,
@@ -82,7 +84,9 @@ const Tabs = /*#__PURE__*/(0, _react.forwardRef)(({
82
84
  href,
83
85
  label,
84
86
  id,
85
- ref: itemRef
87
+ ref: itemRef,
88
+ LinkRouter: ItemLinkRouter = LinkRouter,
89
+ linkRouterProps: itemLinkRouterProps
86
90
  }, index) => {
87
91
  const itemId = id ?? label;
88
92
  const isSelected = Boolean(currentValue && currentValue === itemId);
@@ -98,6 +102,10 @@ const Tabs = /*#__PURE__*/(0, _react.forwardRef)(({
98
102
  selected: isSelected,
99
103
  itemPositions: itemPositions,
100
104
  index: index,
105
+ LinkRouter: ItemLinkRouter,
106
+ linkRouterProps: { ...linkRouterProps,
107
+ ...itemLinkRouterProps
108
+ },
101
109
  children: label
102
110
  }, itemId);
103
111
  })
@@ -105,8 +113,8 @@ const Tabs = /*#__PURE__*/(0, _react.forwardRef)(({
105
113
  });
106
114
  });
107
115
  Tabs.displayName = 'Tabs';
108
- Tabs.propTypes = {
109
- items: _propTypes.default.arrayOf(_propTypes.default.shape({
116
+ Tabs.propTypes = { ..._utils.withLinkRouter.PropTypes,
117
+ items: _propTypes.default.arrayOf(_propTypes.default.shape({ ..._utils.withLinkRouter.PropTypes,
110
118
  href: _propTypes.default.string,
111
119
  label: _propTypes.default.string,
112
120
  id: _propTypes.default.string,
@@ -99,7 +99,6 @@ const selectContainerStyles = ({
99
99
 
100
100
 
101
101
  const TabsItem = /*#__PURE__*/(0, _react.forwardRef)(({
102
- onPress,
103
102
  href,
104
103
  variant,
105
104
  tokens,
@@ -114,8 +113,14 @@ const TabsItem = /*#__PURE__*/(0, _react.forwardRef)(({
114
113
  } : {
115
114
  selected
116
115
  },
117
- ...rest
116
+ ...rawRest
118
117
  }, ref) => {
118
+ // Convert onClick etc to onPress etc if used in an integration
119
+ const {
120
+ onPress,
121
+ ...rest
122
+ } = _utils.clickProps.toPressProps(rawRest);
123
+
119
124
  const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('TabsItem', tokens, variant);
120
125
 
121
126
  const resolveTokens = pressableState => (0, _utils.resolvePressableTokens)(getTokens, pressableState, {
@@ -139,9 +144,9 @@ const TabsItem = /*#__PURE__*/(0, _react.forwardRef)(({
139
144
  href
140
145
  });
141
146
 
142
- const handlePress = onPress || openHref ? () => {
143
- if (onPress) onPress();
144
- if (openHref) openHref();
147
+ const handlePress = onPress || openHref ? (...args) => {
148
+ if (onPress) onPress(...args);
149
+ if (openHref) openHref(...args);
145
150
  } : undefined;
146
151
  const a11y = {
147
152
  accessibilityRole,
@@ -234,5 +239,6 @@ const staticStyles = _StyleSheet.default.create({
234
239
  }
235
240
  });
236
241
 
237
- var _default = TabsItem;
242
+ var _default = (0, _utils.withLinkRouter)(TabsItem);
243
+
238
244
  exports.default = _default;
package/lib/Tags/Tags.js CHANGED
@@ -27,7 +27,7 @@ var _ViewportProvider = require("../ViewportProvider");
27
27
 
28
28
  var _ThemeProvider = require("../ThemeProvider");
29
29
 
30
- var _propTypes2 = require("../utils/propTypes");
30
+ var _props = require("../utils/props");
31
31
 
32
32
  var _input = require("../utils/input");
33
33
 
@@ -97,14 +97,14 @@ const Tags = /*#__PURE__*/(0, _react.forwardRef)(({
97
97
  const themeTokens = (0, _ThemeProvider.useThemeTokens)('Tags', tokens, variant, {
98
98
  viewport
99
99
  });
100
- const stackTokens = (0, _propTypes2.selectTokens)('StackView', themeTokens);
100
+ const stackTokens = (0, _props.selectTokens)('StackView', themeTokens);
101
101
  const {
102
102
  direction,
103
103
  space
104
104
  } = themeTokens;
105
105
  const getItemTokens = (0, _ThemeProvider.useThemeTokensCallback)('TagsItem', tokens, variant);
106
106
 
107
- const getButtonTokens = buttonState => (0, _propTypes2.selectTokens)('Button', getItemTokens(buttonState));
107
+ const getButtonTokens = buttonState => (0, _props.selectTokens)('Button', getItemTokens(buttonState));
108
108
 
109
109
  const {
110
110
  currentValues,
@@ -117,7 +117,7 @@ const Tags = /*#__PURE__*/(0, _react.forwardRef)(({
117
117
  readOnly
118
118
  });
119
119
 
120
- const a11y = _propTypes2.a11yProps.select({
120
+ const a11y = _props.a11yProps.select({
121
121
  accessibilityRole,
122
122
  ...rest
123
123
  });
@@ -154,7 +154,7 @@ const Tags = /*#__PURE__*/(0, _react.forwardRef)(({
154
154
  },
155
155
  accessibilityRole: itemA11yRole,
156
156
  accessibilityLabel,
157
- ..._propTypes2.a11yProps.getPositionInSet(items.length, index)
157
+ ..._props.a11yProps.getPositionInSet(items.length, index)
158
158
  };
159
159
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
160
160
  ref: itemRef,
@@ -202,10 +202,10 @@ const Tags = /*#__PURE__*/(0, _react.forwardRef)(({
202
202
  });
203
203
  });
204
204
  Tags.displayName = 'Tags';
205
- Tags.propTypes = { ..._propTypes2.a11yProps.propTypes,
206
- ..._propTypes2.pressProps.propTypes,
207
- tokens: (0, _propTypes2.getTokensPropType)('Tags'),
208
- variant: _propTypes2.variantProp.propType,
205
+ Tags.propTypes = { ..._props.a11yProps.propTypes,
206
+ ..._props.pressProps.propTypes,
207
+ tokens: (0, _props.getTokensPropType)('Tags'),
208
+ variant: _props.variantProp.propType,
209
209
 
210
210
  /**
211
211
  * If provided, sets a maximum number of items a user may select at once.
@@ -14,9 +14,9 @@ var _utils = require("./utils");
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
16
  /**
17
- * @typedef {import('../utils/propTypes.js').AppearanceSet} AppearanceSet
18
- * @typedef {import('../utils/propTypes.js').TokensProp} TokensProp
19
- * @typedef {import('../utils/propTypes.js').TokensSet} TokensSet
17
+ * @typedef {import('../utils/props/variantProp.js').AppearanceSet} AppearanceSet
18
+ * @typedef {import('../utils/props/tokens.js').TokensProp} TokensProp
19
+ * @typedef {import('../utils/props/tokens.js').TokensSet} TokensSet
20
20
  */
21
21
 
22
22
  /**
@@ -14,9 +14,9 @@ var _package = _interopRequireDefault(require("../../../package.json"));
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
16
  /**
17
- * @typedef {import('../../utils/propTypes.js').AppearanceSet} AppearanceSet
18
- * @typedef {import('../../utils/propTypes.js').TokensProp} TokensProp
19
- * @typedef {import('../../utils/propTypes.js').TokensSet} TokensSet
17
+ * @typedef {import('../../utils/props/variantProp.js').AppearanceSet} AppearanceSet
18
+ * @typedef {import('../../utils/props/tokens.js').TokensProp} TokensProp
19
+ * @typedef {import('../../utils/props/tokens.js').TokensSet} TokensSet
20
20
  */
21
21
 
22
22
  /**