@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.
- package/.storybook/main.js +4 -0
- package/.storybook/preview.js +37 -0
- package/.turbo/turbo-build.log +5 -0
- package/CHANGELOG.md +32 -0
- package/README.md +1 -1
- package/__fixtures__/Accessible.js +4 -2
- package/__fixtures__/Accessible.native.js +5 -2
- package/__fixtures__/testTheme.js +9 -0
- package/__tests__/FlexGrid/Col.test.jsx +6 -10
- package/__tests__/HorizontalScroll/HorizontalScroll.test.jsx +1 -0
- package/__tests__/ToggleSwitch/ToggleSwitch.test.jsx +10 -0
- package/__tests__/ToggleSwitch/ToggleSwitchGroup.test.jsx +192 -0
- package/__tests__/utils/props.test.js +36 -0
- package/__tests__/utils/semantics.test.jsx +1 -10
- package/babel.config.js +9 -16
- package/component-docs.json +10142 -0
- package/generate-component-docs.js +59 -0
- package/lib/A11yText/index.js +2 -2
- package/lib/ActivityIndicator/index.js +3 -3
- package/lib/Box/Box.js +4 -4
- package/lib/Button/Button.js +2 -2
- package/lib/Button/ButtonBase.js +20 -6
- package/lib/Button/ButtonGroup.js +10 -12
- package/lib/Button/ButtonLink.js +4 -4
- package/lib/Button/propTypes.js +4 -2
- package/lib/Card/Card.js +2 -2
- package/lib/Card/CardBase.js +6 -9
- package/lib/Card/PressableCardBase.js +12 -6
- package/lib/Checkbox/Checkbox.js +3 -5
- package/lib/Divider/Divider.js +2 -2
- package/lib/FlexGrid/FlexGrid.js +4 -4
- package/lib/FlexGrid/helpers/index.js +1 -4
- package/lib/IconButton/IconButton.js +11 -6
- package/lib/Link/LinkBase.js +19 -12
- package/lib/List/List.js +4 -5
- package/lib/List/ListItem.js +14 -27
- package/lib/List/index.js +15 -0
- package/lib/Pagination/PageButton.js +4 -8
- package/lib/Pagination/Pagination.js +16 -4
- package/lib/Pagination/SideButton.js +3 -1
- package/lib/Progress/Progress.js +2 -2
- package/lib/Progress/ProgressBar.js +2 -2
- package/lib/Radio/Radio.js +3 -5
- package/lib/Spacer/Spacer.js +2 -2
- package/lib/StackView/StackWrap.js +9 -5
- package/lib/StackView/getStackedContent.js +1 -1
- package/lib/StepTracker/StepTracker.js +2 -2
- package/lib/Tabs/Tabs.js +12 -4
- package/lib/Tabs/TabsItem.js +12 -6
- package/lib/Tags/Tags.js +9 -9
- package/lib/ThemeProvider/useThemeTokens.js +3 -3
- package/lib/ThemeProvider/utils/theme-tokens.js +3 -3
- package/lib/ToggleSwitch/ToggleSwitch.js +105 -43
- package/lib/ToggleSwitch/ToggleSwitchGroup.js +230 -0
- package/lib/ToggleSwitch/index.js +14 -4
- package/lib/index.js +28 -9
- package/lib/utils/a11y/semantics.js +4 -3
- package/lib/utils/index.js +14 -5
- package/lib/utils/pressability.js +2 -2
- package/lib/utils/props/a11yProps.js +153 -0
- package/lib/utils/props/clickProps.js +36 -0
- package/lib/utils/props/componentPropType.js +70 -0
- package/lib/utils/props/copyPropTypes.js +14 -0
- package/lib/utils/props/getPropSelector.js +13 -0
- package/lib/utils/props/hrefAttrsProp.js +41 -0
- package/lib/utils/props/index.js +149 -0
- package/lib/utils/props/linkProps.js +64 -0
- package/lib/utils/props/paddingProp.js +20 -0
- package/lib/utils/props/pressProps.js +57 -0
- package/lib/utils/props/rectProp.js +20 -0
- package/lib/utils/props/responsiveProps.js +40 -0
- package/lib/utils/props/selectSystemProps.js +31 -0
- package/lib/utils/props/spacingProps.js +71 -0
- package/lib/utils/props/tokens.js +145 -0
- package/lib/utils/props/variantProp.js +28 -0
- package/lib/utils/props/viewProps.js +34 -0
- package/lib/utils/useResponsiveProp.js +1 -1
- package/lib/utils/useSpacingScale.js +4 -4
- package/lib/utils/withLinkRouter.js +98 -0
- package/package.json +9 -5
- package/release-context.json +4 -4
- package/src/A11yText/index.jsx +1 -1
- package/src/ActivityIndicator/index.jsx +1 -1
- package/src/Box/Box.jsx +5 -4
- package/src/Button/Button.jsx +1 -1
- package/src/Button/ButtonBase.jsx +11 -4
- package/src/Button/ButtonGroup.jsx +17 -8
- package/src/Button/ButtonLink.jsx +1 -1
- package/src/Button/propTypes.js +2 -1
- package/src/Card/Card.jsx +1 -1
- package/src/Card/CardBase.jsx +6 -5
- package/src/Card/PressableCardBase.jsx +7 -5
- package/src/Checkbox/Checkbox.jsx +1 -3
- package/src/Divider/Divider.jsx +2 -2
- package/src/FlexGrid/FlexGrid.jsx +11 -5
- package/src/FlexGrid/helpers/index.js +1 -3
- package/src/IconButton/IconButton.jsx +7 -5
- package/src/Link/LinkBase.jsx +7 -5
- package/src/List/List.jsx +2 -4
- package/src/List/ListItem.jsx +11 -26
- package/src/List/index.js +5 -0
- package/src/Pagination/PageButton.jsx +5 -8
- package/src/Pagination/Pagination.jsx +29 -2
- package/src/Pagination/SideButton.jsx +2 -2
- package/src/Progress/Progress.jsx +1 -1
- package/src/Progress/ProgressBar.jsx +1 -1
- package/src/Radio/Radio.jsx +1 -3
- package/src/Spacer/Spacer.jsx +2 -2
- package/src/StackView/StackWrap.jsx +7 -6
- package/src/StackView/getStackedContent.jsx +1 -1
- package/src/StepTracker/StepTracker.jsx +1 -1
- package/src/Tabs/Tabs.jsx +49 -22
- package/src/Tabs/TabsItem.jsx +11 -7
- package/src/Tags/Tags.jsx +1 -7
- package/src/ThemeProvider/useThemeTokens.js +3 -3
- package/src/ThemeProvider/utils/theme-tokens.js +3 -3
- package/src/ToggleSwitch/ToggleSwitch.jsx +93 -41
- package/src/ToggleSwitch/ToggleSwitchGroup.jsx +203 -0
- package/src/ToggleSwitch/index.js +2 -1
- package/src/index.js +2 -2
- package/src/utils/a11y/semantics.js +3 -2
- package/src/utils/index.js +2 -1
- package/src/utils/pressability.js +1 -1
- package/src/utils/props/a11yProps.js +151 -0
- package/src/utils/props/clickProps.js +31 -0
- package/src/utils/props/componentPropType.js +67 -0
- package/src/utils/props/copyPropTypes.js +3 -0
- package/src/utils/props/getPropSelector.js +14 -0
- package/src/utils/props/hrefAttrsProp.js +25 -0
- package/src/utils/props/index.js +15 -0
- package/src/utils/props/linkProps.js +43 -0
- package/src/utils/props/paddingProp.js +10 -0
- package/src/utils/props/pressProps.js +45 -0
- package/src/utils/props/rectProp.js +10 -0
- package/src/utils/props/responsiveProps.js +30 -0
- package/src/utils/props/selectSystemProps.js +25 -0
- package/src/utils/props/spacingProps.js +58 -0
- package/src/utils/props/tokens.js +150 -0
- package/src/utils/props/variantProp.js +20 -0
- package/src/utils/props/viewProps.js +23 -0
- package/src/utils/useResponsiveProp.js +1 -1
- package/src/utils/useSpacingScale.js +4 -4
- package/src/utils/withLinkRouter.jsx +68 -0
- package/stories/A11yText/A11yText.stories.jsx +1 -1
- package/stories/ActivityIndicator/ActivityIndicator.stories.jsx +1 -1
- package/stories/Box/Box.stories.jsx +1 -1
- package/stories/Button/Button.stories.jsx +1 -1
- package/stories/Button/ButtonGroup.stories.jsx +1 -1
- package/stories/Button/ButtonLink.stories.jsx +1 -1
- package/stories/Card/Card.stories.jsx +1 -1
- package/stories/Checkbox/Checkbox.stories.jsx +1 -1
- package/stories/Divider/Divider.stories.jsx +1 -1
- package/stories/ExpandCollapse/ExpandCollapse.stories.jsx +1 -1
- package/stories/Feedback/Feedback.stories.jsx +1 -1
- package/stories/FlexGrid/01 FlexGrid.stories.jsx +1 -1
- package/stories/FlexGrid/02 Row.stories.jsx +1 -1
- package/stories/FlexGrid/03 Col.stories.jsx +1 -1
- package/stories/Icon/Icon.stories.jsx +1 -1
- package/stories/IconButton/IconButton.stories.jsx +1 -1
- package/stories/InputLabel/InputLabel.stories.jsx +1 -1
- package/stories/Link/ChevronLink.stories.jsx +1 -1
- package/stories/Link/Link.stories.jsx +1 -1
- package/stories/Link/TextButton.stories.jsx +1 -1
- package/stories/List/List.stories.jsx +1 -1
- package/stories/Modal/Modal.stories.jsx +1 -1
- package/stories/Notification/Notification.stories.jsx +1 -1
- package/stories/Pagination/Pagination.stories.jsx +1 -1
- package/stories/Progress/Progress.stories.jsx +1 -1
- package/stories/Radio/Radio.stories.jsx +1 -1
- package/stories/RadioCard/RadioCard.stories.jsx +1 -1
- package/stories/Search/Search.stories.jsx +1 -1
- package/stories/Select/Select.stories.jsx +1 -1
- package/stories/SideNav/SideNav.stories.jsx +1 -1
- package/stories/SideNav/SideNavItem.stories.jsx +1 -1
- package/stories/SideNav/SideNavItemsGroup.stories.jsx +1 -1
- package/stories/Skeleton/Skeleton.stories.jsx +1 -1
- package/stories/Spacer/Spacer.stories.jsx +1 -1
- package/stories/StackView/StackView.stories.jsx +1 -1
- package/stories/StackView/StackWrap.stories.jsx +1 -1
- package/stories/StepTracker/StepTracker.stories.jsx +1 -1
- package/stories/Tabs/Tabs.stories.jsx +1 -1
- package/stories/Tags/Tags.stories.jsx +1 -1
- package/stories/TextInput/TextArea.stories.jsx +2 -1
- package/stories/TextInput/TextInput.stories.jsx +1 -1
- package/stories/ToggleSwitch/ToggleSwitch.stories.jsx +6 -2
- package/stories/ToggleSwitch/ToggleSwitchGroup.stories.jsx +81 -0
- package/stories/Tooltip/Tooltip.stories.jsx +1 -1
- package/stories/TooltipButton/TooltipButton.stories.jsx +1 -1
- package/stories/Typography/Typography.stories.jsx +1 -1
- package/stories/supports.jsx +2 -3
- package/.ultra.cache.json +0 -1
- package/lib/utils/propTypes.js +0 -623
- 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
|
|
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
|
-
*
|
|
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 =
|
|
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.
|
|
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'),
|
package/lib/List/ListItem.js
CHANGED
|
@@ -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
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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,
|
|
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
|
-
|
|
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,
|
package/lib/Progress/Progress.js
CHANGED
|
@@ -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
|
|
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
|
-
...
|
|
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
|
|
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
|
-
...
|
|
105
|
+
..._props.a11yProps.select(rest)
|
|
106
106
|
};
|
|
107
107
|
return percentage > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
108
108
|
ref: ref,
|
package/lib/Radio/Radio.js
CHANGED
|
@@ -25,7 +25,7 @@ var _ThemeProvider = require("../ThemeProvider");
|
|
|
25
25
|
|
|
26
26
|
var _utils = require("../utils");
|
|
27
27
|
|
|
28
|
-
var
|
|
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 =
|
|
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 = { ...
|
|
221
|
+
Radio.propTypes = { ..._props.a11yProps.propTypes,
|
|
224
222
|
|
|
225
223
|
/**
|
|
226
224
|
* Use `checked` for controlled Radio. For uncontrolled Radio, use the `defaultChecked` prop.
|
package/lib/Spacer/Spacer.js
CHANGED
|
@@ -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/
|
|
28
|
-
* @typedef {import('../utils/
|
|
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
|
-
//
|
|
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 &&
|
|
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/
|
|
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
|
|
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
|
-
...
|
|
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,
|
package/lib/Tabs/TabsItem.js
CHANGED
|
@@ -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
|
-
...
|
|
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
|
|
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,
|
|
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,
|
|
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 =
|
|
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
|
-
...
|
|
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 = { ...
|
|
206
|
-
...
|
|
207
|
-
tokens: (0,
|
|
208
|
-
variant:
|
|
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/
|
|
18
|
-
* @typedef {import('../utils/
|
|
19
|
-
* @typedef {import('../utils/
|
|
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/
|
|
18
|
-
* @typedef {import('../../utils/
|
|
19
|
-
* @typedef {import('../../utils/
|
|
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
|
/**
|