@telus-uds/components-base 0.0.2-prerelease.9 → 1.0.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/.eslintrc.js +9 -0
- package/.ultra.cache.json +1 -1
- package/CHANGELOG.md +32 -0
- package/README.md +4 -2
- package/__fixtures__/test-utils.js +25 -0
- package/__fixtures__/testTheme.js +4 -2
- package/__tests__/Button/ButtonGroup.test.jsx +4 -5
- package/__tests__/Checkbox/Checkbox.test.jsx +2 -2
- package/__tests__/Checkbox/CheckboxGroup.test.jsx +4 -5
- package/__tests__/ExpandCollapse/ExpandCollapse.test.jsx +2 -2
- package/__tests__/HorizontalScroll/HorizontalScroll.test.jsx +164 -0
- package/__tests__/Link/LinkBase.test.jsx +0 -14
- package/__tests__/Radio/Radio.test.jsx +2 -2
- package/__tests__/Radio/RadioGroup.test.jsx +4 -5
- package/__tests__/RadioCard/RadioCard.test.jsx +2 -2
- package/__tests__/RadioCard/RadioCardGroup.test.jsx +4 -5
- package/__tests__/Search/Search.test.jsx +9 -8
- package/__tests__/Select/Select.test.jsx +3 -2
- package/__tests__/Tabs/Tabs.test.jsx +1 -161
- package/__tests__/Tags/Tags.test.jsx +4 -5
- package/__tests__/TextInput/TextArea.test.jsx +3 -2
- package/__tests__/TextInput/TextInputBase.test.jsx +10 -5
- package/__tests__/ThemeProvider/ThemeProvider.test.jsx +77 -0
- package/__tests__/ThemeProvider/useThemeTokens.test.jsx +9 -5
- package/__tests__/ThemeProvider/utils/theme-tokens.test.js +41 -0
- package/__tests__/ToggleSwitch/ToggleSwitch.test.jsx +3 -2
- package/__tests__/utils/children.test.jsx +128 -0
- package/__tests__/utils/input.test.js +1 -1
- package/__tests__/utils/semantics.test.jsx +43 -0
- package/lib/A11yText/index.js +10 -5
- package/lib/ActivityIndicator/Spinner.js +16 -13
- package/lib/ActivityIndicator/Spinner.native.js +12 -8
- package/lib/Box/Box.js +102 -8
- package/lib/Button/Button.js +9 -8
- package/lib/Button/ButtonBase.js +14 -7
- package/lib/Button/ButtonGroup.js +25 -10
- package/lib/Button/ButtonLink.js +10 -7
- package/lib/Card/Card.js +2 -0
- package/lib/Card/CardBase.js +12 -5
- package/lib/Card/PressableCardBase.js +12 -8
- package/lib/Checkbox/Checkbox.js +25 -14
- package/lib/Checkbox/CheckboxGroup.js +22 -12
- package/lib/Divider/Divider.js +12 -7
- package/lib/ExpandCollapse/Accordion.js +10 -4
- package/lib/ExpandCollapse/Control.js +12 -6
- package/lib/ExpandCollapse/ExpandCollapse.js +10 -5
- package/lib/ExpandCollapse/Panel.js +8 -7
- package/lib/Feedback/Feedback.js +10 -5
- package/lib/Fieldset/Fieldset.js +10 -5
- package/lib/Fieldset/FieldsetContainer.js +10 -5
- package/lib/Fieldset/FieldsetContainer.native.js +10 -5
- package/lib/Fieldset/Legend.js +10 -5
- package/lib/Fieldset/Legend.native.js +10 -5
- package/lib/FlexGrid/Col/Col.js +8 -5
- package/lib/FlexGrid/FlexGrid.js +31 -6
- package/lib/FlexGrid/Row/Row.js +12 -5
- package/lib/{Tabs → HorizontalScroll}/HorizontalScroll.js +5 -4
- package/lib/{Tabs/TabsScrollButton.js → HorizontalScroll/HorizontalScrollButton.js} +14 -8
- package/lib/{Tabs → HorizontalScroll}/ScrollViewEnd.js +0 -0
- package/lib/{Tabs → HorizontalScroll}/ScrollViewEnd.native.js +0 -0
- package/lib/{Tabs → HorizontalScroll}/dictionary.js +0 -0
- package/lib/HorizontalScroll/index.js +35 -0
- package/lib/{Tabs → HorizontalScroll}/itemPositions.js +0 -0
- package/lib/Icon/Icon.js +16 -9
- package/lib/Icon/IconText.js +8 -7
- package/lib/IconButton/IconButton.js +10 -5
- package/lib/InputLabel/InputLabel.js +33 -5
- package/lib/InputLabel/LabelContent.js +22 -12
- package/lib/InputLabel/LabelContent.native.js +23 -5
- package/lib/InputSupports/InputSupports.js +10 -5
- package/lib/Link/ChevronLink.js +12 -5
- package/lib/Link/InlinePressable.js +10 -4
- package/lib/Link/InlinePressable.native.js +5 -4
- package/lib/Link/Link.js +12 -5
- package/lib/Link/LinkBase.js +12 -5
- package/lib/Link/TextButton.js +10 -5
- package/lib/List/List.js +5 -4
- package/lib/List/ListItem.js +16 -8
- package/lib/Modal/Modal.js +10 -5
- package/lib/Notification/Notification.js +21 -5
- package/lib/Pagination/PageButton.js +21 -10
- package/lib/Pagination/Pagination.js +12 -7
- package/lib/Pagination/SideButton.js +12 -7
- package/lib/Pagination/usePagination.js +2 -2
- package/lib/Progress/Progress.js +10 -5
- package/lib/Progress/ProgressBar.js +21 -10
- package/lib/Progress/ProgressBarBackground.js +12 -8
- package/lib/Radio/Radio.js +14 -13
- package/lib/Radio/RadioButton.js +20 -9
- package/lib/Radio/RadioGroup.js +24 -13
- package/lib/RadioCard/RadioCard.js +14 -10
- package/lib/RadioCard/RadioCardGroup.js +13 -12
- package/lib/Search/Search.js +29 -18
- package/lib/Select/Picker.js +11 -6
- package/lib/Select/Picker.native.js +21 -6
- package/lib/Select/Select.js +46 -4
- package/lib/SideNav/Item.js +10 -5
- package/lib/SideNav/ItemsGroup.js +10 -5
- package/lib/SideNav/SideNav.js +11 -7
- package/lib/Skeleton/Skeleton.js +15 -15
- package/lib/Skeleton/skeletonWebAnimation.js +1 -1
- package/lib/Spacer/Spacer.js +19 -7
- package/lib/StackView/StackView.js +25 -7
- package/lib/StackView/StackWrap.js +16 -9
- package/lib/StackView/StackWrapBox.js +33 -8
- package/lib/StackView/StackWrapGap.js +16 -7
- package/lib/StackView/common.js +4 -2
- package/lib/StackView/getStackedContent.js +2 -2
- package/lib/StepTracker/StepTracker.js +10 -5
- package/lib/Tabs/Tabs.js +26 -19
- package/lib/Tabs/TabsItem.js +16 -12
- package/lib/Tags/Tags.js +27 -11
- package/lib/TextInput/TextArea.js +7 -5
- package/lib/TextInput/TextInput.js +12 -6
- package/lib/TextInput/TextInputBase.js +12 -8
- package/lib/ThemeProvider/ThemeProvider.js +14 -10
- package/lib/ThemeProvider/useSetTheme.js +6 -1
- package/lib/ThemeProvider/utils/styles.js +2 -2
- package/lib/ThemeProvider/utils/theme-tokens.js +39 -8
- package/lib/ToggleSwitch/ToggleSwitch.js +11 -6
- package/lib/Tooltip/Backdrop.js +10 -2
- package/lib/Tooltip/Tooltip.js +5 -4
- package/lib/Typography/Typography.js +40 -24
- package/lib/index.js +21 -0
- package/lib/utils/a11y/index.js +13 -0
- package/lib/utils/a11y/semantics.js +173 -0
- package/lib/utils/animation/useVerticalExpandAnimation.js +1 -1
- package/lib/utils/children.js +55 -8
- package/lib/utils/input.js +27 -17
- package/lib/utils/propTypes.js +82 -29
- package/lib/utils/useCopy.js +1 -1
- package/lib/utils/useHash.js +8 -4
- package/lib/utils/useSpacingScale.js +1 -3
- package/lib/utils/useUniqueId.js +1 -1
- package/package.json +9 -5
- package/release-context.json +4 -4
- package/src/A11yText/index.jsx +6 -4
- package/src/ActivityIndicator/Spinner.jsx +5 -3
- package/src/ActivityIndicator/Spinner.native.jsx +5 -3
- package/src/Box/Box.jsx +124 -39
- package/src/Button/Button.jsx +7 -4
- package/src/Button/ButtonBase.jsx +86 -77
- package/src/Button/ButtonGroup.jsx +81 -69
- package/src/Button/ButtonLink.jsx +18 -13
- package/src/Card/Card.jsx +2 -2
- package/src/Card/CardBase.jsx +5 -4
- package/src/Card/PressableCardBase.jsx +71 -64
- package/src/Checkbox/Checkbox.jsx +118 -108
- package/src/Checkbox/CheckboxGroup.jsx +72 -62
- package/src/Divider/Divider.jsx +7 -4
- package/src/ExpandCollapse/Accordion.jsx +3 -2
- package/src/ExpandCollapse/Control.jsx +40 -43
- package/src/ExpandCollapse/ExpandCollapse.jsx +26 -23
- package/src/ExpandCollapse/Panel.jsx +69 -63
- package/src/Feedback/Feedback.jsx +36 -33
- package/src/Fieldset/Fieldset.jsx +63 -56
- package/src/Fieldset/FieldsetContainer.jsx +14 -5
- package/src/Fieldset/FieldsetContainer.native.jsx +7 -4
- package/src/Fieldset/Legend.jsx +7 -2
- package/src/Fieldset/Legend.native.jsx +7 -2
- package/src/FlexGrid/Col/Col.jsx +139 -132
- package/src/FlexGrid/FlexGrid.jsx +79 -51
- package/src/FlexGrid/Row/Row.jsx +55 -48
- package/src/HorizontalScroll/HorizontalScroll.jsx +168 -0
- package/src/HorizontalScroll/HorizontalScrollButton.jsx +105 -0
- package/src/{Tabs → HorizontalScroll}/ScrollViewEnd.jsx +0 -0
- package/src/{Tabs → HorizontalScroll}/ScrollViewEnd.native.jsx +0 -0
- package/src/{Tabs → HorizontalScroll}/dictionary.js +0 -0
- package/src/HorizontalScroll/index.js +17 -0
- package/src/{Tabs → HorizontalScroll}/itemPositions.js +0 -0
- package/src/Icon/Icon.jsx +37 -35
- package/src/Icon/IconText.jsx +22 -17
- package/src/IconButton/IconButton.jsx +49 -42
- package/src/InputLabel/InputLabel.jsx +53 -38
- package/src/InputLabel/LabelContent.jsx +14 -6
- package/src/InputLabel/LabelContent.native.jsx +11 -2
- package/src/InputSupports/InputSupports.jsx +29 -34
- package/src/Link/ChevronLink.jsx +26 -16
- package/src/Link/InlinePressable.jsx +5 -3
- package/src/Link/InlinePressable.native.jsx +5 -3
- package/src/Link/Link.jsx +22 -16
- package/src/Link/LinkBase.jsx +67 -58
- package/src/Link/TextButton.jsx +30 -23
- package/src/List/List.jsx +5 -4
- package/src/List/ListItem.jsx +77 -82
- package/src/Modal/Modal.jsx +9 -4
- package/src/Notification/Notification.jsx +58 -43
- package/src/Pagination/PageButton.jsx +42 -35
- package/src/Pagination/Pagination.jsx +88 -92
- package/src/Pagination/SideButton.jsx +44 -41
- package/src/Progress/Progress.jsx +5 -4
- package/src/Progress/ProgressBar.jsx +42 -29
- package/src/Progress/ProgressBarBackground.jsx +5 -3
- package/src/Radio/Radio.jsx +85 -78
- package/src/Radio/RadioButton.jsx +54 -43
- package/src/Radio/RadioGroup.jsx +74 -63
- package/src/RadioCard/RadioCard.jsx +75 -68
- package/src/RadioCard/RadioCardGroup.jsx +82 -75
- package/src/Search/Search.jsx +127 -106
- package/src/Select/Picker.jsx +49 -42
- package/src/Select/Picker.native.jsx +56 -49
- package/src/Select/Select.jsx +115 -72
- package/src/SideNav/Item.jsx +53 -46
- package/src/SideNav/ItemsGroup.jsx +50 -43
- package/src/SideNav/SideNav.jsx +68 -60
- package/src/Skeleton/Skeleton.jsx +9 -13
- package/src/Spacer/Spacer.jsx +11 -4
- package/src/StackView/StackView.jsx +46 -23
- package/src/StackView/StackWrap.jsx +7 -6
- package/src/StackView/StackWrapBox.jsx +61 -28
- package/src/StackView/StackWrapGap.jsx +46 -24
- package/src/StackView/common.jsx +3 -2
- package/src/StepTracker/StepTracker.jsx +73 -62
- package/src/Tabs/Tabs.jsx +70 -62
- package/src/Tabs/TabsItem.jsx +111 -103
- package/src/Tags/Tags.jsx +114 -102
- package/src/TextInput/TextArea.jsx +5 -4
- package/src/TextInput/TextInput.jsx +5 -4
- package/src/TextInput/TextInputBase.jsx +84 -77
- package/src/ThemeProvider/ThemeProvider.jsx +11 -7
- package/src/ThemeProvider/useSetTheme.js +4 -0
- package/src/ThemeProvider/utils/theme-tokens.js +28 -0
- package/src/ToggleSwitch/ToggleSwitch.jsx +49 -50
- package/src/Tooltip/Tooltip.jsx +134 -130
- package/src/Typography/Typography.jsx +67 -44
- package/src/index.js +2 -0
- package/src/utils/a11y/index.js +1 -0
- package/src/utils/a11y/semantics.js +162 -0
- package/src/utils/children.jsx +60 -7
- package/src/utils/input.js +20 -17
- package/src/utils/propTypes.js +101 -39
- package/src/utils/useCopy.js +1 -1
- package/src/utils/useHash.js +8 -3
- package/stories/A11yText/A11yText.stories.jsx +2 -2
- package/stories/ActivityIndicator/ActivityIndicator.stories.jsx +1 -1
- package/stories/Box/Box.stories.jsx +1 -1
- package/stories/Button/Button.stories.jsx +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +1 -1
- package/stories/TextInput/TextInput.stories.jsx +1 -1
- package/stories/ToggleSwitch/ToggleSwitch.stories.jsx +1 -1
- 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/platform-supports.jsx +1 -1
- package/stories/supports.jsx +2 -2
- package/src/Tabs/HorizontalScroll.jsx +0 -165
- package/src/Tabs/TabsScrollButton.jsx +0 -100
package/lib/List/ListItem.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
11
11
|
|
|
@@ -25,6 +25,10 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
25
25
|
|
|
26
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
27
|
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
28
32
|
const selectBulletStyles = ({
|
|
29
33
|
itemBulletWidth,
|
|
30
34
|
itemBulletHeight,
|
|
@@ -92,7 +96,7 @@ const selectDividerStyles = ({
|
|
|
92
96
|
*/
|
|
93
97
|
|
|
94
98
|
|
|
95
|
-
const ListItem = ({
|
|
99
|
+
const ListItem = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
96
100
|
tokens,
|
|
97
101
|
variant,
|
|
98
102
|
icon,
|
|
@@ -101,7 +105,7 @@ const ListItem = ({
|
|
|
101
105
|
showDivider,
|
|
102
106
|
children,
|
|
103
107
|
isLastItem
|
|
104
|
-
}) => {
|
|
108
|
+
}, ref) => {
|
|
105
109
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('List', tokens, variant);
|
|
106
110
|
const itemStyles = selectItemStyles(themeTokens);
|
|
107
111
|
const itemBlockStyles = selectItemBlockStyles(themeTokens);
|
|
@@ -133,6 +137,7 @@ const ListItem = ({
|
|
|
133
137
|
}
|
|
134
138
|
|
|
135
139
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
140
|
+
style: staticStyles.wrap,
|
|
136
141
|
children: children
|
|
137
142
|
});
|
|
138
143
|
};
|
|
@@ -168,10 +173,8 @@ const ListItem = ({
|
|
|
168
173
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
169
174
|
style: [sideItemContainerStyles, areChildrenStrings() ? staticStyles.centeredIcons : undefined],
|
|
170
175
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
color: iconColor || iconTokens.color
|
|
174
|
-
}
|
|
176
|
+
size: iconSize || iconTokens.size,
|
|
177
|
+
color: iconColor || iconTokens.color
|
|
175
178
|
})
|
|
176
179
|
});
|
|
177
180
|
}
|
|
@@ -186,11 +189,13 @@ const ListItem = ({
|
|
|
186
189
|
};
|
|
187
190
|
|
|
188
191
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
192
|
+
ref: ref,
|
|
189
193
|
style: [staticStyles.itemContainer, getContainerStyle()],
|
|
190
194
|
accessibilityRole: accessibilityRole,
|
|
191
195
|
children: [renderMarker(), renderItem()]
|
|
192
196
|
});
|
|
193
|
-
};
|
|
197
|
+
});
|
|
198
|
+
ListItem.displayName = 'ListItem';
|
|
194
199
|
|
|
195
200
|
const staticStyles = _StyleSheet.default.create({
|
|
196
201
|
itemContainer: {
|
|
@@ -198,6 +203,9 @@ const staticStyles = _StyleSheet.default.create({
|
|
|
198
203
|
},
|
|
199
204
|
centeredIcons: {
|
|
200
205
|
justifyContent: 'center'
|
|
206
|
+
},
|
|
207
|
+
wrap: {
|
|
208
|
+
flex: 1
|
|
201
209
|
}
|
|
202
210
|
});
|
|
203
211
|
|
package/lib/Modal/Modal.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
11
11
|
|
|
@@ -33,6 +33,10 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
33
33
|
|
|
34
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
35
|
|
|
36
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
|
+
|
|
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
|
+
|
|
36
40
|
const selectContainerStyles = ({
|
|
37
41
|
containerPaddingLeft,
|
|
38
42
|
containerPaddingRight,
|
|
@@ -108,7 +112,7 @@ const selectCloseIconProps = ({
|
|
|
108
112
|
*/
|
|
109
113
|
|
|
110
114
|
|
|
111
|
-
const Modal = ({
|
|
115
|
+
const Modal = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
112
116
|
children,
|
|
113
117
|
isOpen,
|
|
114
118
|
onClose,
|
|
@@ -116,7 +120,7 @@ const Modal = ({
|
|
|
116
120
|
tokens,
|
|
117
121
|
variant,
|
|
118
122
|
copy
|
|
119
|
-
}) => {
|
|
123
|
+
}, ref) => {
|
|
120
124
|
const viewport = (0, _ViewportProvider.useViewport)();
|
|
121
125
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('Modal', tokens, variant, {
|
|
122
126
|
viewport,
|
|
@@ -153,6 +157,7 @@ const Modal = ({
|
|
|
153
157
|
pointerEvents: "box-none" // don't capture backdrop press events
|
|
154
158
|
,
|
|
155
159
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
160
|
+
ref: ref,
|
|
156
161
|
style: [staticStyles.modal, selectModalStyles(themeTokens)],
|
|
157
162
|
onKeyUp: handleKeyUp,
|
|
158
163
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
@@ -175,8 +180,8 @@ const Modal = ({
|
|
|
175
180
|
})]
|
|
176
181
|
})
|
|
177
182
|
});
|
|
178
|
-
};
|
|
179
|
-
|
|
183
|
+
});
|
|
184
|
+
Modal.displayName = 'Modal';
|
|
180
185
|
Modal.propTypes = {
|
|
181
186
|
children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.arrayOf(_propTypes.default.node)]),
|
|
182
187
|
copy: _utils.copyPropTypes,
|
|
@@ -77,7 +77,7 @@ const selectDismissButtonContainerStyles = ({
|
|
|
77
77
|
* - Show system notifications at the top of the page, below the navigation, and expands the full-width of the viewport
|
|
78
78
|
* - When showing multiple notifications, show them in order of importance from top to bottom
|
|
79
79
|
* - Use variants to visually show the type of message contained within the Notification.
|
|
80
|
-
* The icon and colour will indicate meaning and importance
|
|
80
|
+
* - The icon and colour will indicate meaning and importance
|
|
81
81
|
*
|
|
82
82
|
* ### Variants
|
|
83
83
|
* - Use `variant.style` to set the visual style of the notification
|
|
@@ -118,14 +118,14 @@ const selectDismissButtonContainerStyles = ({
|
|
|
118
118
|
*/
|
|
119
119
|
|
|
120
120
|
|
|
121
|
-
const Notification = ({
|
|
121
|
+
const Notification = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
122
122
|
children,
|
|
123
123
|
system,
|
|
124
124
|
dismissible,
|
|
125
125
|
copy = 'en',
|
|
126
126
|
tokens,
|
|
127
127
|
variant
|
|
128
|
-
}) => {
|
|
128
|
+
}, ref) => {
|
|
129
129
|
const [isDismissed, setIsDismissed] = (0, _react.useState)(false);
|
|
130
130
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('Notification', tokens, variant, {
|
|
131
131
|
system
|
|
@@ -153,6 +153,7 @@ const Notification = ({
|
|
|
153
153
|
|
|
154
154
|
|
|
155
155
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
156
|
+
ref: ref,
|
|
156
157
|
style: [staticStyles.container, selectContainerStyles(themeTokens)],
|
|
157
158
|
children: [IconComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
158
159
|
style: selectIconContainerStyles(themeTokens),
|
|
@@ -175,12 +176,27 @@ const Notification = ({
|
|
|
175
176
|
})
|
|
176
177
|
})]
|
|
177
178
|
});
|
|
178
|
-
};
|
|
179
|
-
|
|
179
|
+
});
|
|
180
|
+
Notification.displayName = 'Notification';
|
|
180
181
|
Notification.propTypes = {
|
|
182
|
+
/**
|
|
183
|
+
* Content of the `Notification`.
|
|
184
|
+
*/
|
|
181
185
|
children: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node, _propTypes.default.func]),
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Use `system` prop to set the visual style of the notification and denote an announcement from the system or application
|
|
189
|
+
*/
|
|
182
190
|
system: _propTypes.default.bool,
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Use the `dismissible` prop to allow users to dismiss the Notification at any time.
|
|
194
|
+
*/
|
|
183
195
|
dismissible: _propTypes.default.bool,
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Select english or french copy for the accessible label of the dismiss button.
|
|
199
|
+
*/
|
|
184
200
|
copy: _propTypes.default.oneOfType([_propTypes.default.oneOf(['en', 'fr']), _propTypes.default.shape({
|
|
185
201
|
dismiss: _propTypes.default.string
|
|
186
202
|
})]),
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
@@ -23,7 +23,11 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
23
23
|
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
25
|
|
|
26
|
-
function
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
|
|
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
|
+
|
|
30
|
+
const PageButton = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
27
31
|
label,
|
|
28
32
|
onPress,
|
|
29
33
|
href,
|
|
@@ -32,7 +36,7 @@ function PageButton({
|
|
|
32
36
|
variant,
|
|
33
37
|
tokens,
|
|
34
38
|
...props
|
|
35
|
-
}) {
|
|
39
|
+
}, ref) => {
|
|
36
40
|
const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('PaginationPageButton', tokens, variant);
|
|
37
41
|
const getCopy = (0, _useCopy.default)({
|
|
38
42
|
dictionary: _dictionary.default,
|
|
@@ -49,8 +53,8 @@ function PageButton({
|
|
|
49
53
|
key: 'active-item'
|
|
50
54
|
} : {};
|
|
51
55
|
const accessibilityRole = href !== undefined ? 'link' : 'button';
|
|
52
|
-
const activeLabel = isActive ?
|
|
53
|
-
const accessibilityLabel =
|
|
56
|
+
const activeLabel = isActive ? ` ${getCopy('currentLabel')}` : '';
|
|
57
|
+
const accessibilityLabel = `${getCopy('goToLabel')} ${label}${activeLabel}`;
|
|
54
58
|
|
|
55
59
|
const {
|
|
56
60
|
hrefAttrs,
|
|
@@ -65,20 +69,27 @@ function PageButton({
|
|
|
65
69
|
hrefAttrs,
|
|
66
70
|
...rest
|
|
67
71
|
};
|
|
68
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
|
|
72
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
|
|
73
|
+
ref: ref,
|
|
74
|
+
...buttonProps,
|
|
69
75
|
tokens: getButtonTokens,
|
|
70
76
|
...activeProps,
|
|
71
77
|
children: label
|
|
72
78
|
});
|
|
73
|
-
}
|
|
74
|
-
|
|
79
|
+
});
|
|
80
|
+
PageButton.displayName = 'PageButton';
|
|
75
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,
|
|
76
88
|
label: _propTypes.default.string,
|
|
77
89
|
isActive: _propTypes.default.bool,
|
|
78
90
|
copy: _utils.copyPropTypes,
|
|
79
91
|
variant: _utils.variantProp.propType,
|
|
80
|
-
tokens: (0, _utils.getTokensPropType)('PaginationPageButton')
|
|
81
|
-
..._utils.linkProps.types
|
|
92
|
+
tokens: (0, _utils.getTokensPropType)('PaginationPageButton')
|
|
82
93
|
};
|
|
83
94
|
var _default = PageButton;
|
|
84
95
|
exports.default = _default;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
11
11
|
|
|
@@ -31,6 +31,10 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
31
31
|
|
|
32
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
33
|
|
|
34
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
|
+
|
|
36
|
+
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; }
|
|
37
|
+
|
|
34
38
|
const selectTextStyles = ({
|
|
35
39
|
color,
|
|
36
40
|
fontName,
|
|
@@ -45,14 +49,14 @@ const selectTextStyles = ({
|
|
|
45
49
|
lineHeight
|
|
46
50
|
});
|
|
47
51
|
|
|
48
|
-
|
|
52
|
+
const Pagination = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
49
53
|
children,
|
|
50
54
|
copy = 'en',
|
|
51
55
|
variant,
|
|
52
56
|
tokens,
|
|
53
57
|
sideButtonVariant,
|
|
54
58
|
sideButtonTokens
|
|
55
|
-
}) {
|
|
59
|
+
}, ref) => {
|
|
56
60
|
const viewport = (0, _ViewportProvider.useViewport)();
|
|
57
61
|
const {
|
|
58
62
|
truncateAbove,
|
|
@@ -91,7 +95,7 @@ function Pagination({
|
|
|
91
95
|
variant: sideButtonVariant,
|
|
92
96
|
tokens: sideButtonTokens
|
|
93
97
|
}), ...items.map((child, itemIndex) => {
|
|
94
|
-
const buttonLabel =
|
|
98
|
+
const buttonLabel = `${itemIndex + 1}`;
|
|
95
99
|
const itemProps = getItemProps(itemIndex);
|
|
96
100
|
|
|
97
101
|
if (shouldRenderButton(itemIndex)) {
|
|
@@ -118,14 +122,15 @@ function Pagination({
|
|
|
118
122
|
})];
|
|
119
123
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
120
124
|
style: staticStyles.container,
|
|
125
|
+
ref: ref,
|
|
121
126
|
children: buttons // keep the keys in-line with the page numbers regardless of which buttons are actually rendered
|
|
122
|
-
.map((element, index) => [element,
|
|
127
|
+
.map((element, index) => [element, `page-${index + 1}`]).filter(([element]) => element !== null).map(([element, key]) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
123
128
|
right: gap,
|
|
124
129
|
children: element
|
|
125
130
|
}, key))
|
|
126
131
|
});
|
|
127
|
-
}
|
|
128
|
-
|
|
132
|
+
});
|
|
133
|
+
_PageButton.default.displayName = 'PageButton';
|
|
129
134
|
Pagination.PageButton = _PageButton.default;
|
|
130
135
|
Pagination.propTypes = {
|
|
131
136
|
children: (0, _utils.componentPropType)('PageButton'),
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _Text = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Text"));
|
|
11
11
|
|
|
@@ -29,6 +29,10 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
29
29
|
|
|
30
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
31
|
|
|
32
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
32
36
|
const selectIconTokens = ({
|
|
33
37
|
color,
|
|
34
38
|
iconSize,
|
|
@@ -45,8 +49,7 @@ const directionToSide = {
|
|
|
45
49
|
previous: 'left',
|
|
46
50
|
next: 'right'
|
|
47
51
|
};
|
|
48
|
-
|
|
49
|
-
function SideButton({
|
|
52
|
+
const SideButton = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
50
53
|
direction = 'previous',
|
|
51
54
|
onPress,
|
|
52
55
|
href,
|
|
@@ -54,7 +57,7 @@ function SideButton({
|
|
|
54
57
|
variant,
|
|
55
58
|
tokens,
|
|
56
59
|
...props
|
|
57
|
-
}) {
|
|
60
|
+
}, ref) => {
|
|
58
61
|
const viewport = (0, _ViewportProvider.useViewport)();
|
|
59
62
|
const buttonVariant = {
|
|
60
63
|
direction,
|
|
@@ -92,7 +95,9 @@ function SideButton({
|
|
|
92
95
|
hrefAttrs,
|
|
93
96
|
...rest
|
|
94
97
|
};
|
|
95
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
|
|
98
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
|
|
99
|
+
ref: ref,
|
|
100
|
+
...buttonProps,
|
|
96
101
|
tokens: getButtonTokens,
|
|
97
102
|
children: ({
|
|
98
103
|
textStyles,
|
|
@@ -113,8 +118,8 @@ function SideButton({
|
|
|
113
118
|
});
|
|
114
119
|
}
|
|
115
120
|
});
|
|
116
|
-
}
|
|
117
|
-
|
|
121
|
+
});
|
|
122
|
+
SideButton.displayName = 'SideButton';
|
|
118
123
|
SideButton.propTypes = {
|
|
119
124
|
direction: _propTypes.default.oneOf(['previous', 'next']),
|
|
120
125
|
copy: _utils.copyPropTypes,
|
|
@@ -20,7 +20,7 @@ function usePagination({
|
|
|
20
20
|
);
|
|
21
21
|
|
|
22
22
|
const getItemProps = index => {
|
|
23
|
-
var _items$index
|
|
23
|
+
var _items$index;
|
|
24
24
|
|
|
25
25
|
const {
|
|
26
26
|
onPress,
|
|
@@ -28,7 +28,7 @@ function usePagination({
|
|
|
28
28
|
hrefAttrs,
|
|
29
29
|
variant,
|
|
30
30
|
tokens
|
|
31
|
-
} = (
|
|
31
|
+
} = ((_items$index = items[index]) === null || _items$index === void 0 ? void 0 : _items$index.props) ?? {};
|
|
32
32
|
return {
|
|
33
33
|
onPress,
|
|
34
34
|
href,
|
package/lib/Progress/Progress.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
@@ -21,6 +21,10 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
24
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
24
28
|
const selectProgressStyles = ({
|
|
25
29
|
backgroundColor,
|
|
26
30
|
borderWidth,
|
|
@@ -65,20 +69,21 @@ const selectProgressStyles = ({
|
|
|
65
69
|
*/
|
|
66
70
|
|
|
67
71
|
|
|
68
|
-
const Progress = ({
|
|
72
|
+
const Progress = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
69
73
|
children,
|
|
70
74
|
tokens,
|
|
71
75
|
variant,
|
|
72
76
|
...rest
|
|
73
|
-
}) => {
|
|
77
|
+
}, ref) => {
|
|
74
78
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('Progress', tokens, variant);
|
|
75
79
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
80
|
+
ref: ref,
|
|
76
81
|
style: selectProgressStyles(themeTokens),
|
|
77
82
|
..._propTypes2.a11yProps.select(rest),
|
|
78
83
|
children: children
|
|
79
84
|
});
|
|
80
|
-
};
|
|
81
|
-
|
|
85
|
+
});
|
|
86
|
+
Progress.displayName = 'Progress';
|
|
82
87
|
Progress.propTypes = {
|
|
83
88
|
/**
|
|
84
89
|
* Use the `children` prop to supply one or several `ProgressBar`s.
|
|
@@ -5,10 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
13
|
+
|
|
12
14
|
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
13
15
|
|
|
14
16
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
@@ -25,6 +27,10 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
25
27
|
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
29
|
|
|
30
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
28
34
|
const selectBarStyles = ({
|
|
29
35
|
backgroundColor,
|
|
30
36
|
borderRadius,
|
|
@@ -35,7 +41,7 @@ const selectBarStyles = ({
|
|
|
35
41
|
borderRadius,
|
|
36
42
|
outlineWidth,
|
|
37
43
|
outlineColor,
|
|
38
|
-
width:
|
|
44
|
+
width: `${percentage}%`
|
|
39
45
|
});
|
|
40
46
|
/**
|
|
41
47
|
* The `ProgressBar` is a visual representation of linear progression.
|
|
@@ -73,13 +79,13 @@ const selectBarStyles = ({
|
|
|
73
79
|
*/
|
|
74
80
|
|
|
75
81
|
|
|
76
|
-
const ProgressBar = ({
|
|
82
|
+
const ProgressBar = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
77
83
|
children = null,
|
|
78
84
|
percentage = 0,
|
|
79
85
|
tokens,
|
|
80
86
|
variant,
|
|
81
87
|
...rest
|
|
82
|
-
}) => {
|
|
88
|
+
}, ref) => {
|
|
83
89
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('ProgressBar', tokens, variant);
|
|
84
90
|
|
|
85
91
|
if (percentage < 0) {
|
|
@@ -94,19 +100,20 @@ const ProgressBar = ({
|
|
|
94
100
|
min: 0,
|
|
95
101
|
max: 100,
|
|
96
102
|
now: percentage,
|
|
97
|
-
text:
|
|
103
|
+
text: `${percentage}%`
|
|
98
104
|
},
|
|
99
105
|
..._propTypes2.a11yProps.select(rest)
|
|
100
106
|
};
|
|
101
107
|
return percentage > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
108
|
+
ref: ref,
|
|
102
109
|
style: [staticStyles.bar, selectBarStyles(themeTokens, percentage)],
|
|
103
110
|
...accessibilityProps,
|
|
104
|
-
children: children
|
|
111
|
+
children: children ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProgressBarBackground.default, {
|
|
105
112
|
variant: variant
|
|
106
113
|
})
|
|
107
114
|
}) : null;
|
|
108
|
-
};
|
|
109
|
-
|
|
115
|
+
});
|
|
116
|
+
ProgressBar.displayName = 'ProgressBar';
|
|
110
117
|
ProgressBar.propTypes = {
|
|
111
118
|
/**
|
|
112
119
|
* Optional children that can be used to customize the progress bar filling.
|
|
@@ -139,8 +146,12 @@ exports.default = _default;
|
|
|
139
146
|
const staticStyles = _StyleSheet.default.create({
|
|
140
147
|
bar: {
|
|
141
148
|
height: '100%',
|
|
142
|
-
outlineStyle: 'solid',
|
|
143
149
|
overflow: 'hidden',
|
|
144
|
-
position: 'absolute'
|
|
150
|
+
position: 'absolute',
|
|
151
|
+
..._Platform.default.select({
|
|
152
|
+
web: {
|
|
153
|
+
outlineStyle: 'solid'
|
|
154
|
+
}
|
|
155
|
+
})
|
|
145
156
|
}
|
|
146
157
|
});
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _ImageBackground = _interopRequireDefault(require("react-native-web/dist/cjs/exports/ImageBackground"));
|
|
11
11
|
|
|
@@ -17,12 +17,15 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
const negativeBackground = "%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='NegativeProgress6' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23C12335'%3E%3C/rect%3E%3Cpath d='M 0,8 l 8,-8 M -2,2 l 4,-4 M 6,10 l 4,-4' stroke-width='2' shape-rendering='auto' stroke='%23e7adb4' stroke-linecap='square'%3E%3C/path%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23NegativeProgress6");'%3E%3C/path%3E%3C/svg%3E";
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
22
21
|
|
|
23
|
-
|
|
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
|
+
|
|
24
|
+
const inactiveBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='DisabledProgress7' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23B2B9BF'%3E%3C/rect%3E%3Ccircle cx='4' cy='4' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='0' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='8' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='0' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='8' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23DisabledProgress7");'%3E%3C/path%3E%3C/svg%3E`;
|
|
25
|
+
const negativeBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='NegativeProgress6' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23C12335'%3E%3C/rect%3E%3Cpath d='M 0,8 l 8,-8 M -2,2 l 4,-4 M 6,10 l 4,-4' stroke-width='2' shape-rendering='auto' stroke='%23e7adb4' stroke-linecap='square'%3E%3C/path%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23NegativeProgress6");'%3E%3C/path%3E%3C/svg%3E`;
|
|
26
|
+
const ProgressBarBackground = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
24
27
|
variant
|
|
25
|
-
}) => {
|
|
28
|
+
}, ref) => {
|
|
26
29
|
let source = null;
|
|
27
30
|
|
|
28
31
|
if (variant !== null && variant !== void 0 && variant.inactive) {
|
|
@@ -34,13 +37,14 @@ const ProgressBarBackground = ({
|
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageBackground.default, {
|
|
40
|
+
ref: ref,
|
|
37
41
|
source: {
|
|
38
|
-
uri:
|
|
42
|
+
uri: `data:image/svg+xml,${source}`
|
|
39
43
|
},
|
|
40
44
|
style: staticStyles.imageBackground
|
|
41
45
|
});
|
|
42
|
-
};
|
|
43
|
-
|
|
46
|
+
});
|
|
47
|
+
ProgressBarBackground.displayName = 'ProgressBarBackground';
|
|
44
48
|
ProgressBarBackground.propTypes = {
|
|
45
49
|
/**
|
|
46
50
|
* Progress bar variant.
|