@telus-uds/components-base 0.0.2-prerelease.9 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +9 -0
- package/.storybook/main.js +4 -0
- package/.storybook/preview.js +37 -0
- package/.ultra.cache.json +1 -1
- package/CHANGELOG.md +50 -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/babel.config.js +9 -16
- package/component-docs.json +10313 -0
- package/generate-component-docs.js +56 -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 +103 -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 +13 -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 +6 -6
- package/lib/List/ListItem.js +28 -33
- package/lib/List/index.js +15 -0
- package/lib/Modal/Modal.js +10 -5
- package/lib/Notification/Notification.js +21 -5
- package/lib/Pagination/PageButton.js +16 -11
- 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 +26 -7
- package/lib/StackView/StackWrap.js +24 -13
- package/lib/StackView/StackWrapBox.js +34 -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 +36 -1
- package/lib/utils/a11y/index.js +13 -0
- package/lib/utils/a11y/propTypes.js +61 -0
- package/lib/utils/a11y/propTypes.native.js +47 -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 +40 -68
- 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 +14 -6
- 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 +125 -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 +6 -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 +6 -7
- package/src/List/ListItem.jsx +70 -90
- package/src/List/index.js +5 -0
- package/src/Modal/Modal.jsx +9 -4
- package/src/Notification/Notification.jsx +58 -43
- package/src/Pagination/PageButton.jsx +37 -34
- 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 +47 -23
- package/src/StackView/StackWrap.jsx +14 -12
- package/src/StackView/StackWrapBox.jsx +62 -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 +3 -1
- package/src/utils/a11y/index.js +1 -0
- package/src/utils/a11y/propTypes.js +61 -0
- package/src/utils/a11y/propTypes.native.js +39 -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 +30 -76
- package/src/utils/useCopy.js +1 -1
- package/src/utils/useHash.js +8 -3
- package/stories/A11yText/A11yText.stories.jsx +3 -3
- package/stories/ActivityIndicator/ActivityIndicator.stories.jsx +2 -2
- package/stories/Box/Box.stories.jsx +2 -2
- package/stories/Button/Button.stories.jsx +3 -3
- package/stories/Button/ButtonGroup.stories.jsx +2 -2
- package/stories/Button/ButtonLink.stories.jsx +2 -2
- package/stories/Card/Card.stories.jsx +2 -2
- package/stories/Checkbox/Checkbox.stories.jsx +2 -2
- package/stories/Divider/Divider.stories.jsx +2 -2
- package/stories/ExpandCollapse/ExpandCollapse.stories.jsx +3 -3
- package/stories/Feedback/Feedback.stories.jsx +2 -2
- package/stories/FlexGrid/01 FlexGrid.stories.jsx +2 -2
- package/stories/FlexGrid/02 Row.stories.jsx +2 -2
- package/stories/FlexGrid/03 Col.stories.jsx +2 -2
- package/stories/Icon/Icon.stories.jsx +2 -2
- package/stories/IconButton/IconButton.stories.jsx +2 -2
- package/stories/InputLabel/InputLabel.stories.jsx +2 -2
- package/stories/Link/ChevronLink.stories.jsx +2 -2
- package/stories/Link/Link.stories.jsx +2 -2
- package/stories/Link/TextButton.stories.jsx +2 -2
- package/stories/List/List.stories.jsx +2 -2
- package/stories/Modal/Modal.stories.jsx +2 -2
- package/stories/Notification/Notification.stories.jsx +2 -2
- package/stories/Pagination/Pagination.stories.jsx +2 -2
- package/stories/Progress/Progress.stories.jsx +2 -2
- package/stories/Radio/Radio.stories.jsx +2 -2
- package/stories/RadioCard/RadioCard.stories.jsx +2 -2
- package/stories/Search/Search.stories.jsx +2 -2
- package/stories/Select/Select.stories.jsx +2 -2
- package/stories/SideNav/SideNav.stories.jsx +2 -2
- package/stories/SideNav/SideNavItem.stories.jsx +2 -2
- package/stories/SideNav/SideNavItemsGroup.stories.jsx +2 -2
- package/stories/Skeleton/Skeleton.stories.jsx +3 -3
- package/stories/Spacer/Spacer.stories.jsx +2 -2
- package/stories/StackView/StackView.stories.jsx +2 -2
- package/stories/StackView/StackWrap.stories.jsx +2 -2
- package/stories/StepTracker/StepTracker.stories.jsx +2 -2
- package/stories/Tabs/Tabs.stories.jsx +2 -2
- package/stories/Tags/Tags.stories.jsx +2 -2
- package/stories/TextInput/TextArea.stories.jsx +2 -2
- package/stories/TextInput/TextInput.stories.jsx +2 -2
- package/stories/ToggleSwitch/ToggleSwitch.stories.jsx +2 -2
- package/stories/Tooltip/Tooltip.stories.jsx +2 -2
- package/stories/TooltipButton/TooltipButton.stories.jsx +2 -2
- package/stories/Typography/Typography.stories.jsx +2 -2
- package/stories/platform-supports.jsx +1 -1
- package/stories/supports.jsx +4 -5
- package/src/Tabs/HorizontalScroll.jsx +0 -165
- package/src/Tabs/TabsScrollButton.jsx +0 -100
package/lib/Search/Search.js
CHANGED
|
@@ -87,7 +87,7 @@ const selectIconTokens = ({
|
|
|
87
87
|
*/
|
|
88
88
|
|
|
89
89
|
|
|
90
|
-
const Search = ({
|
|
90
|
+
const Search = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
91
91
|
initialValue = '',
|
|
92
92
|
placeholder = 'Search',
|
|
93
93
|
inactive,
|
|
@@ -98,7 +98,7 @@ const Search = ({
|
|
|
98
98
|
copy = 'en',
|
|
99
99
|
tokens,
|
|
100
100
|
variant
|
|
101
|
-
}) => {
|
|
101
|
+
}, ref) => {
|
|
102
102
|
const [value, setValue] = (0, _react.useState)(initialValue);
|
|
103
103
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('Search', tokens, variant);
|
|
104
104
|
const buttonTokens = (0, _ThemeProvider.useThemeTokens)('SearchButton', tokens, variant);
|
|
@@ -118,26 +118,28 @@ const Search = ({
|
|
|
118
118
|
|
|
119
119
|
const buttonsGapSize = (0, _utils.useSpacingScale)(buttonsGap);
|
|
120
120
|
|
|
121
|
-
const handleSubmit =
|
|
121
|
+
const handleSubmit = event => {
|
|
122
122
|
if (onSubmit !== undefined) {
|
|
123
|
-
onSubmit(value);
|
|
123
|
+
onSubmit(value, event);
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
-
const handleChange = currentValue => {
|
|
128
|
-
setValue(currentValue);
|
|
129
|
-
if (onChange !== undefined) onChange(currentValue);
|
|
127
|
+
const handleChange = (currentValue, event) => {
|
|
128
|
+
setValue(currentValue, event);
|
|
129
|
+
if (onChange !== undefined) onChange(currentValue, event);
|
|
130
130
|
};
|
|
131
131
|
|
|
132
|
-
const handleClear =
|
|
133
|
-
setValue('');
|
|
134
|
-
if (onClear !== undefined) onClear();
|
|
135
|
-
if (onChange !== undefined) onChange('');
|
|
132
|
+
const handleClear = event => {
|
|
133
|
+
setValue('', event);
|
|
134
|
+
if (onClear !== undefined) onClear('', event);
|
|
135
|
+
if (onChange !== undefined) onChange('', event);
|
|
136
136
|
};
|
|
137
137
|
|
|
138
138
|
const isEmpty = value === '';
|
|
139
139
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
140
|
+
style: staticStyles.container,
|
|
140
141
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextInputBase.default, {
|
|
142
|
+
ref: ref,
|
|
141
143
|
tokens: appearances => selectInputTokens({
|
|
142
144
|
searchTokens: getThemeTokens(appearances),
|
|
143
145
|
buttonTokens,
|
|
@@ -164,8 +166,7 @@ const Search = ({
|
|
|
164
166
|
accessibilityRole: "button",
|
|
165
167
|
accessibilityLabel: getCopy('clearButtonAccessibilityLabel'),
|
|
166
168
|
tokens: appearances => selectButtonTokens(getButtonTokens(appearances)),
|
|
167
|
-
children: buttonState => /*#__PURE__*/(0, _jsxRuntime.jsx)(ClearButtonIcon, {
|
|
168
|
-
tokens: selectIconTokens(getButtonTokens(buttonState))
|
|
169
|
+
children: buttonState => /*#__PURE__*/(0, _jsxRuntime.jsx)(ClearButtonIcon, { ...selectIconTokens(getButtonTokens(buttonState))
|
|
169
170
|
})
|
|
170
171
|
}), SubmitButtonIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
|
|
171
172
|
onPress: handleSubmit,
|
|
@@ -175,8 +176,7 @@ const Search = ({
|
|
|
175
176
|
tokens: buttonState => selectButtonTokens(getButtonTokens({ ...buttonState,
|
|
176
177
|
priority: 'high'
|
|
177
178
|
})),
|
|
178
|
-
children: buttonState => /*#__PURE__*/(0, _jsxRuntime.jsx)(SubmitButtonIcon, {
|
|
179
|
-
tokens: selectIconTokens(getButtonTokens({ ...buttonState,
|
|
179
|
+
children: buttonState => /*#__PURE__*/(0, _jsxRuntime.jsx)(SubmitButtonIcon, { ...selectIconTokens(getButtonTokens({ ...buttonState,
|
|
180
180
|
priority: 'high'
|
|
181
181
|
}))
|
|
182
182
|
})
|
|
@@ -184,8 +184,8 @@ const Search = ({
|
|
|
184
184
|
})
|
|
185
185
|
})]
|
|
186
186
|
});
|
|
187
|
-
};
|
|
188
|
-
|
|
187
|
+
});
|
|
188
|
+
Search.displayName = 'Search';
|
|
189
189
|
Search.propTypes = {
|
|
190
190
|
/**
|
|
191
191
|
* Use this to set the initial value of the search input.
|
|
@@ -225,7 +225,16 @@ Search.propTypes = {
|
|
|
225
225
|
* Use to provide an accessible label for the input (visually hidden).
|
|
226
226
|
*/
|
|
227
227
|
accessibilityLabel: _propTypes.default.string,
|
|
228
|
-
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Select english or french copy for the accessible labels.
|
|
231
|
+
* You may also pass in a custom dictionary object.
|
|
232
|
+
*/
|
|
233
|
+
copy: _propTypes.default.oneOfType([_propTypes.default.oneOf(['en', 'fr']), _propTypes.default.shape({
|
|
234
|
+
accessibilityLabel: _propTypes.default.string,
|
|
235
|
+
clearButtonAccessibilityLabel: _propTypes.default.string,
|
|
236
|
+
submitButtonAccessibilityLabel: _propTypes.default.string
|
|
237
|
+
})]),
|
|
229
238
|
tokens: (0, _utils.getTokensPropType)('Search'),
|
|
230
239
|
variant: _utils.variantProp.propType
|
|
231
240
|
};
|
|
@@ -233,6 +242,8 @@ var _default = Search;
|
|
|
233
242
|
exports.default = _default;
|
|
234
243
|
|
|
235
244
|
const staticStyles = _StyleSheet.default.create({
|
|
245
|
+
container: {// No styles needed here except the View defaults (position: relative etc)
|
|
246
|
+
},
|
|
236
247
|
iconsContainer: {
|
|
237
248
|
position: 'absolute',
|
|
238
249
|
right: 0,
|
package/lib/Select/Picker.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
|
|
|
@@ -15,7 +15,11 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
const Picker = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
19
23
|
value,
|
|
20
24
|
onChange,
|
|
21
25
|
onFocus,
|
|
@@ -29,13 +33,14 @@ const Picker = ({
|
|
|
29
33
|
nativeID,
|
|
30
34
|
testID,
|
|
31
35
|
...rest
|
|
32
|
-
}) => {
|
|
36
|
+
}, ref) => {
|
|
33
37
|
const {
|
|
34
38
|
accessibilityLabel,
|
|
35
39
|
accessibilityDescribedBy,
|
|
36
40
|
accessibilityInvalid
|
|
37
41
|
} = rest;
|
|
38
42
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("select", {
|
|
43
|
+
ref: ref,
|
|
39
44
|
style: style,
|
|
40
45
|
onMouseOver: onMouseOver,
|
|
41
46
|
onMouseOut: onMouseOut,
|
|
@@ -43,7 +48,7 @@ const Picker = ({
|
|
|
43
48
|
onBlur: onBlur,
|
|
44
49
|
disabled: inactive,
|
|
45
50
|
value: value || (placeholder !== undefined ? placeholder.value : undefined),
|
|
46
|
-
onChange: event => onChange(event.target.value),
|
|
51
|
+
onChange: event => onChange(event.target.value, event),
|
|
47
52
|
id: nativeID,
|
|
48
53
|
"aria-label": accessibilityLabel,
|
|
49
54
|
"aria-describedby": accessibilityDescribedBy,
|
|
@@ -56,8 +61,8 @@ const Picker = ({
|
|
|
56
61
|
children: placeholder.label
|
|
57
62
|
}), children]
|
|
58
63
|
});
|
|
59
|
-
};
|
|
60
|
-
|
|
64
|
+
});
|
|
65
|
+
Picker.displayName = 'Picker';
|
|
61
66
|
var _default = Picker;
|
|
62
67
|
exports.default = _default;
|
|
63
68
|
Picker.propTypes = {
|
|
@@ -50,7 +50,7 @@ const selectAndroidContainerStyles = ({
|
|
|
50
50
|
...rest
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
const Picker = ({
|
|
53
|
+
const Picker = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
54
54
|
value,
|
|
55
55
|
onChange,
|
|
56
56
|
onFocus,
|
|
@@ -60,7 +60,7 @@ const Picker = ({
|
|
|
60
60
|
children,
|
|
61
61
|
placeholder,
|
|
62
62
|
...rest
|
|
63
|
-
}) => {
|
|
63
|
+
}, ref) => {
|
|
64
64
|
// ungroup items, since there's no way to support groups on native
|
|
65
65
|
const flatChildren = _react.Children.toArray(children).flatMap(child => {
|
|
66
66
|
if (child.type === _Group.default) {
|
|
@@ -75,15 +75,30 @@ const Picker = ({
|
|
|
75
75
|
}) => ({
|
|
76
76
|
label: props.children,
|
|
77
77
|
value: props.value
|
|
78
|
-
}));
|
|
78
|
+
})); // Unlike other input components, react-native-picker-select doesn't pass an event to its change fn.
|
|
79
|
+
|
|
80
|
+
const handleChange = (newValue, index) => {
|
|
81
|
+
if (onChange) onChange(newValue, {
|
|
82
|
+
// TODO: see if it's possible to pass a real React SyntheticEvent here. For now, just pass an
|
|
83
|
+
// object with a shape where if an onChange deconstructs `event.nativeEvent`, it won't crash.
|
|
84
|
+
nativeEvent: {
|
|
85
|
+
index,
|
|
86
|
+
value: newValue
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
|
|
79
91
|
const picker = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativePickerSelect.default, {
|
|
92
|
+
pickerProps: {
|
|
93
|
+
ref
|
|
94
|
+
},
|
|
80
95
|
touchableWrapperProps: _utils.a11yProps.select(rest),
|
|
81
96
|
onOpen: onFocus,
|
|
82
97
|
onClose: onBlur,
|
|
83
98
|
disabled: inactive,
|
|
84
99
|
items: items,
|
|
85
100
|
value: value,
|
|
86
|
-
onValueChange:
|
|
101
|
+
onValueChange: handleChange,
|
|
87
102
|
style: {
|
|
88
103
|
inputIOS: style,
|
|
89
104
|
inputAndroid: selectAndroidInputStyles(style)
|
|
@@ -96,8 +111,8 @@ const Picker = ({
|
|
|
96
111
|
children: picker
|
|
97
112
|
}) : picker
|
|
98
113
|
});
|
|
99
|
-
};
|
|
100
|
-
|
|
114
|
+
});
|
|
115
|
+
Picker.displayName = 'Picker';
|
|
101
116
|
var _default = Picker;
|
|
102
117
|
exports.default = _default;
|
|
103
118
|
Picker.propTypes = {
|
package/lib/Select/Select.js
CHANGED
|
@@ -185,7 +185,7 @@ const selectValidationIconContainerStyles = ({
|
|
|
185
185
|
*/
|
|
186
186
|
|
|
187
187
|
|
|
188
|
-
const Select = ({
|
|
188
|
+
const Select = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
189
189
|
value,
|
|
190
190
|
initialValue,
|
|
191
191
|
onChange,
|
|
@@ -198,7 +198,7 @@ const Select = ({
|
|
|
198
198
|
variant,
|
|
199
199
|
testID,
|
|
200
200
|
...rest
|
|
201
|
-
}) => {
|
|
201
|
+
}, ref) => {
|
|
202
202
|
const {
|
|
203
203
|
currentValue,
|
|
204
204
|
setValue
|
|
@@ -241,6 +241,7 @@ const Select = ({
|
|
|
241
241
|
}) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
242
242
|
style: selectOuterBorderStyles(themeTokens),
|
|
243
243
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Picker.default, {
|
|
244
|
+
ref: ref,
|
|
244
245
|
style: selectInputStyles(themeTokens, inactive),
|
|
245
246
|
onFocus: handleFocus,
|
|
246
247
|
onBlur: handleBlur,
|
|
@@ -274,18 +275,59 @@ const Select = ({
|
|
|
274
275
|
})]
|
|
275
276
|
})
|
|
276
277
|
});
|
|
277
|
-
};
|
|
278
|
-
|
|
278
|
+
});
|
|
279
|
+
Select.displayName = 'Select';
|
|
279
280
|
Select.propTypes = { ..._propTypes2.default.types,
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Initial value for the uncontrolled version.
|
|
284
|
+
*/
|
|
280
285
|
initialValue: _propTypes.default.string,
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Current value to be set as selected.
|
|
289
|
+
*/
|
|
281
290
|
value: _propTypes.default.string,
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Callback to be called when the value changes.
|
|
294
|
+
*/
|
|
282
295
|
onChange: _propTypes.default.func,
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* An array of items or item groups to be used as options.
|
|
299
|
+
*/
|
|
283
300
|
children: (0, _utils.componentPropType)(['Item', 'Group']),
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Whether the select is disabled.
|
|
304
|
+
*/
|
|
284
305
|
inactive: _propTypes.default.bool,
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Whether the select is read-only.
|
|
309
|
+
*/
|
|
285
310
|
readOnly: _propTypes.default.bool,
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* A placeholder to provide instructions (such as "Please select...")
|
|
314
|
+
* as an unselectable option
|
|
315
|
+
*/
|
|
286
316
|
placeholder: _propTypes.default.string,
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Select tokens.
|
|
320
|
+
*/
|
|
287
321
|
tokens: (0, _utils.getTokensPropType)('Select'),
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Select variant.
|
|
325
|
+
*/
|
|
288
326
|
variant: _utils.variantProp.propType,
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Dedicated ID for testing.
|
|
330
|
+
*/
|
|
289
331
|
testID: _propTypes.default.string
|
|
290
332
|
};
|
|
291
333
|
var _default = Select;
|
package/lib/SideNav/Item.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 _Pressable = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Pressable"));
|
|
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
|
function selectItemStyles({
|
|
25
29
|
backgroundColor,
|
|
26
30
|
borderColor,
|
|
@@ -53,7 +57,7 @@ function selectItemStyles({
|
|
|
53
57
|
*/
|
|
54
58
|
|
|
55
59
|
|
|
56
|
-
const Item = ({
|
|
60
|
+
const Item = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
57
61
|
children,
|
|
58
62
|
itemId,
|
|
59
63
|
groupId,
|
|
@@ -66,7 +70,7 @@ const Item = ({
|
|
|
66
70
|
accessibilityRole = 'link',
|
|
67
71
|
testID,
|
|
68
72
|
...props
|
|
69
|
-
}) => {
|
|
73
|
+
}, ref) => {
|
|
70
74
|
const handlePress = () => onPress(itemId, groupId);
|
|
71
75
|
|
|
72
76
|
const {
|
|
@@ -95,6 +99,7 @@ const Item = ({
|
|
|
95
99
|
const getPressableStyle = pressableState => selectItemStyles(getTokens(getAppearanceState(pressableState)));
|
|
96
100
|
|
|
97
101
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
|
|
102
|
+
ref: ref,
|
|
98
103
|
style: getPressableStyle,
|
|
99
104
|
...linkPropSet,
|
|
100
105
|
accessibilityState: {
|
|
@@ -109,8 +114,8 @@ const Item = ({
|
|
|
109
114
|
});
|
|
110
115
|
}
|
|
111
116
|
});
|
|
112
|
-
};
|
|
113
|
-
|
|
117
|
+
});
|
|
118
|
+
Item.displayName = 'Item';
|
|
114
119
|
Item.propTypes = {
|
|
115
120
|
/**
|
|
116
121
|
* Text content of the `Item`.
|
|
@@ -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
|
/**
|
|
25
29
|
Expandable content areas for use within `SideNav`.
|
|
26
30
|
|
|
@@ -31,7 +35,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
31
35
|
## Usage Criteria
|
|
32
36
|
- Use `SideNav.ItemsGroup` with large pages that have multiple sections
|
|
33
37
|
*/
|
|
34
|
-
const ItemsGroup = ({
|
|
38
|
+
const ItemsGroup = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
35
39
|
children,
|
|
36
40
|
label,
|
|
37
41
|
openGroups,
|
|
@@ -41,7 +45,7 @@ const ItemsGroup = ({
|
|
|
41
45
|
tokens,
|
|
42
46
|
itemTokens,
|
|
43
47
|
onToggle
|
|
44
|
-
}) => {
|
|
48
|
+
}, ref) => {
|
|
45
49
|
// A SideNav control uses the same style and theme as SideNavItem, with a 'parent' variant,
|
|
46
50
|
// plus control-specific tokens from the SideNavItemsGroup theme (e.g. open/close icon, etc).
|
|
47
51
|
const getAppearance = appearance => ({ ...variant,
|
|
@@ -74,6 +78,7 @@ const ItemsGroup = ({
|
|
|
74
78
|
};
|
|
75
79
|
|
|
76
80
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandCollapse.default.Panel, {
|
|
81
|
+
ref: ref,
|
|
77
82
|
openIds: openGroups,
|
|
78
83
|
panelId: groupId,
|
|
79
84
|
onToggle: onToggle,
|
|
@@ -86,8 +91,8 @@ const ItemsGroup = ({
|
|
|
86
91
|
,
|
|
87
92
|
children: children
|
|
88
93
|
});
|
|
89
|
-
};
|
|
90
|
-
|
|
94
|
+
});
|
|
95
|
+
ItemsGroup.displayName = 'ItemsGroup';
|
|
91
96
|
ItemsGroup.propTypes = {
|
|
92
97
|
/**
|
|
93
98
|
* Specifies the links contained within. It may only contain `SideNav.Item`.
|
package/lib/SideNav/SideNav.js
CHANGED
|
@@ -41,14 +41,14 @@ function selectBorderStyles(tokens) {
|
|
|
41
41
|
*/
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
const SideNav = ({
|
|
44
|
+
const SideNav = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
45
45
|
children,
|
|
46
46
|
variant = {},
|
|
47
47
|
tokens,
|
|
48
48
|
accordion = true,
|
|
49
49
|
itemTokens,
|
|
50
50
|
groupTokens
|
|
51
|
-
}) => {
|
|
51
|
+
}, ref) => {
|
|
52
52
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('SideNav', tokens, variant);
|
|
53
53
|
const [active, setActive] = (0, _react.useState)({
|
|
54
54
|
groupId: undefined,
|
|
@@ -67,6 +67,7 @@ const SideNav = ({
|
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandCollapse.default, {
|
|
70
|
+
ref: ref,
|
|
70
71
|
maxOpen: accordion ? 1 : null,
|
|
71
72
|
style: selectBorderStyles(themeTokens),
|
|
72
73
|
children: ({
|
|
@@ -75,7 +76,7 @@ const SideNav = ({
|
|
|
75
76
|
}) => {
|
|
76
77
|
const renderItem = (item, index, groupId) => {
|
|
77
78
|
const {
|
|
78
|
-
itemId =
|
|
79
|
+
itemId = `item-${index}`,
|
|
79
80
|
onPress
|
|
80
81
|
} = item.props;
|
|
81
82
|
|
|
@@ -103,9 +104,12 @@ const SideNav = ({
|
|
|
103
104
|
|
|
104
105
|
if (child.type === _ItemsGroup.default) {
|
|
105
106
|
const {
|
|
106
|
-
groupId =
|
|
107
|
+
groupId = `group-${index}`
|
|
107
108
|
} = child.props;
|
|
108
109
|
const isGroupActive = active.itemId !== undefined && active.groupId === groupId;
|
|
110
|
+
|
|
111
|
+
const handleToggle = event => onToggle(groupId, event);
|
|
112
|
+
|
|
109
113
|
return /*#__PURE__*/(0, _react.createElement)(_ItemsGroup.default, { ...child.props,
|
|
110
114
|
key: groupId,
|
|
111
115
|
groupId: groupId,
|
|
@@ -114,7 +118,7 @@ const SideNav = ({
|
|
|
114
118
|
itemTokens: itemTokens,
|
|
115
119
|
openGroups: openIds,
|
|
116
120
|
isActive: isGroupActive,
|
|
117
|
-
onToggle:
|
|
121
|
+
onToggle: handleToggle
|
|
118
122
|
}, _react.default.Children.map(child.props.children, (item, itemIndex) => renderItem(item, itemIndex, groupId)));
|
|
119
123
|
}
|
|
120
124
|
|
|
@@ -122,8 +126,8 @@ const SideNav = ({
|
|
|
122
126
|
});
|
|
123
127
|
}
|
|
124
128
|
});
|
|
125
|
-
};
|
|
126
|
-
|
|
129
|
+
});
|
|
130
|
+
SideNav.displayName = 'SideNav';
|
|
127
131
|
SideNav.propTypes = {
|
|
128
132
|
/**
|
|
129
133
|
* Specifies the structure and links of the `SideNav`. It may only consist of `SideNav.Item` and `SideNav.ItemsGroup`.
|
package/lib/Skeleton/Skeleton.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 _Animated = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Animated"));
|
|
11
11
|
|
|
@@ -27,6 +27,10 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
27
27
|
|
|
28
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
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
|
+
|
|
30
34
|
const selectSkeletonStyles = ({
|
|
31
35
|
color,
|
|
32
36
|
radius,
|
|
@@ -58,14 +62,14 @@ const selectSquareStyles = ({
|
|
|
58
62
|
borderRadius: radius
|
|
59
63
|
});
|
|
60
64
|
|
|
61
|
-
const Skeleton = ({
|
|
65
|
+
const Skeleton = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
62
66
|
tokens,
|
|
63
67
|
variant,
|
|
64
68
|
size,
|
|
65
69
|
characters,
|
|
66
70
|
lines,
|
|
67
71
|
shape = 'line'
|
|
68
|
-
}) => {
|
|
72
|
+
}, ref) => {
|
|
69
73
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('Skeleton', tokens, variant);
|
|
70
74
|
const skeletonHeight = (0, _utils.useSpacingScale)(size || themeTokens.size);
|
|
71
75
|
const nativeAnimation = (0, _useSkeletonNativeAnimation.default)();
|
|
@@ -112,19 +116,15 @@ const Skeleton = ({
|
|
|
112
116
|
style: [selectSkeletonStyles({ ...themeTokens,
|
|
113
117
|
fadeAnimation: getAnimationBaseOnPlatform()
|
|
114
118
|
}), getStyledBasedOnShape()]
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
if (lines) {
|
|
118
|
-
const arrayOfSkeletons = [...Array(lines)];
|
|
119
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.default, {
|
|
120
|
-
space: themeTokens.spaceBetweenLines,
|
|
121
|
-
children: arrayOfSkeletons.map((_, index) => renderSkeleton(index))
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return renderSkeleton();
|
|
126
|
-
};
|
|
119
|
+
}, `skeleton-${index + 1}`);
|
|
127
120
|
|
|
121
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.default, {
|
|
122
|
+
space: themeTokens.spaceBetweenLines,
|
|
123
|
+
ref: ref,
|
|
124
|
+
children: lines > 1 ? [...Array(lines)].map((_, index) => renderSkeleton(index)) : renderSkeleton()
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
Skeleton.displayName = 'Skeleton';
|
|
128
128
|
Skeleton.propTypes = {
|
|
129
129
|
tokens: (0, _utils.getTokensPropType)('Skeleton'),
|
|
130
130
|
variant: _utils.variantProp.propType,
|
|
@@ -8,7 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _skeleton = require("./skeleton.constant");
|
|
9
9
|
|
|
10
10
|
var _default = {
|
|
11
|
-
animationDuration:
|
|
11
|
+
animationDuration: `${_skeleton.ANIMATION_DURATION}ms`,
|
|
12
12
|
animationTimingFunction: 'ease-in-out',
|
|
13
13
|
animationDelay: '0.5s',
|
|
14
14
|
animationIterationCount: 'infinite',
|
package/lib/Spacer/Spacer.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
|
|
|
@@ -19,6 +19,10 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
22
|
+
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); }
|
|
23
|
+
|
|
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
|
+
|
|
22
26
|
/**
|
|
23
27
|
* @typedef {import('../utils/propTypes.js').SpacingValue} SpacingValue
|
|
24
28
|
* @typedef {import('../utils/propTypes.js').SpacingObject} SpacingObject
|
|
@@ -70,19 +74,22 @@ const selectSizeStyle = (size, direction) => ({
|
|
|
70
74
|
*/
|
|
71
75
|
|
|
72
76
|
|
|
73
|
-
const Spacer = ({
|
|
77
|
+
const Spacer = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
74
78
|
space = 1,
|
|
75
79
|
direction = 'column',
|
|
76
|
-
testID
|
|
77
|
-
|
|
80
|
+
testID,
|
|
81
|
+
dataSet
|
|
82
|
+
}, ref) => {
|
|
78
83
|
const size = (0, _utils.useSpacingScale)(space);
|
|
79
84
|
const sizeStyle = selectSizeStyle(size, direction);
|
|
80
85
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
86
|
+
ref: ref,
|
|
81
87
|
testID: testID,
|
|
82
|
-
style: [staticStyles.stretch, sizeStyle]
|
|
88
|
+
style: [staticStyles.stretch, sizeStyle],
|
|
89
|
+
dataSet: dataSet
|
|
83
90
|
});
|
|
84
|
-
};
|
|
85
|
-
|
|
91
|
+
});
|
|
92
|
+
Spacer.displayName = 'Spacer';
|
|
86
93
|
Spacer.propTypes = {
|
|
87
94
|
/**
|
|
88
95
|
* The size of the spacer according to the theme's spacing scale.
|
|
@@ -99,6 +106,11 @@ Spacer.propTypes = {
|
|
|
99
106
|
*/
|
|
100
107
|
direction: _propTypes.default.oneOf(['column', 'row']),
|
|
101
108
|
|
|
109
|
+
/**
|
|
110
|
+
* @ignore
|
|
111
|
+
*/
|
|
112
|
+
dataSet: _propTypes.default.object,
|
|
113
|
+
|
|
102
114
|
/**
|
|
103
115
|
* @ignore
|
|
104
116
|
* In tests, the only way to select Spacers is with testID prop and getByTestId, since they have no content,
|