@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
|
@@ -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,
|
|
@@ -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
|
|
|
@@ -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
|
/**
|
|
31
35
|
* StackView evenly spaces its children, by default placing `Spacer` components between them.
|
|
32
36
|
*
|
|
@@ -69,18 +73,21 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
69
73
|
* It applies no accessibility props of its own, unless `divider` prop is passed (`Divider` has a
|
|
70
74
|
* semantic role but only on web, not within native apps).
|
|
71
75
|
*/
|
|
72
|
-
const StackView = ({
|
|
76
|
+
const StackView = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
73
77
|
space = 1,
|
|
74
78
|
divider,
|
|
75
79
|
direction: directionProp = 'column',
|
|
76
80
|
children,
|
|
77
81
|
variant,
|
|
78
82
|
tokens,
|
|
83
|
+
tag,
|
|
84
|
+
accessibilityRole,
|
|
79
85
|
...rest
|
|
80
|
-
}) => {
|
|
86
|
+
}, ref) => {
|
|
81
87
|
const viewport = (0, _ViewportProvider.useViewport)();
|
|
82
88
|
const direction = (0, _utils.useResponsiveProp)(directionProp, 'column');
|
|
83
|
-
const props = { ..._utils.
|
|
89
|
+
const props = { ...(0, _utils.getA11yPropsFromHtmlTag)(tag, accessibilityRole),
|
|
90
|
+
..._utils.a11yProps.select(rest),
|
|
84
91
|
..._utils.viewProps.select(rest)
|
|
85
92
|
};
|
|
86
93
|
const content = (0, _getStackedContent.default)(children, {
|
|
@@ -92,13 +99,16 @@ const StackView = ({
|
|
|
92
99
|
viewport
|
|
93
100
|
});
|
|
94
101
|
const flexStyles = (0, _common.selectFlexStyles)(themeTokens);
|
|
95
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
102
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
103
|
+
ref: ref,
|
|
104
|
+
...props,
|
|
96
105
|
style: [flexStyles, _common.staticStyles[direction]],
|
|
97
106
|
children: content
|
|
98
107
|
});
|
|
99
|
-
};
|
|
100
|
-
|
|
108
|
+
});
|
|
109
|
+
StackView.displayName = 'StackView';
|
|
101
110
|
StackView.propTypes = { ..._utils.a11yProps.propTypes,
|
|
111
|
+
tokens: (0, _utils.getTokensPropType)('StackView'),
|
|
102
112
|
variant: _utils.variantProp.propType,
|
|
103
113
|
|
|
104
114
|
/**
|
|
@@ -119,6 +129,14 @@ StackView.propTypes = { ..._utils.a11yProps.propTypes,
|
|
|
119
129
|
*/
|
|
120
130
|
space: _utils.spacingProps.types.spacingValue,
|
|
121
131
|
|
|
132
|
+
/**
|
|
133
|
+
* Optional semantic HTML tag, to apply to the container on web. Does not change styling.
|
|
134
|
+
*
|
|
135
|
+
* In native apps, if a header tag is provided ("h1", "h2" etc) and accessibilityRole prop
|
|
136
|
+
* is not defined, the accessibilityRole will default to "heading".
|
|
137
|
+
*/
|
|
138
|
+
tag: _propTypes.default.oneOf(_utils.layoutTags),
|
|
139
|
+
|
|
122
140
|
/**
|
|
123
141
|
* A StackView may take any children, but will have no effect if it is only passed one child or is passed children
|
|
124
142
|
* wrapped in a component. If necessary, children may be wrapped in one React Fragment.
|
|
@@ -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 _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
11
11
|
|
|
@@ -17,6 +17,10 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
|
|
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); }
|
|
21
|
+
|
|
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
|
+
|
|
20
24
|
// CSS.supports needs an example of the type of value you intend to use.
|
|
21
25
|
// Will be an integer appended `px` after hooks and JSX styles are resolved.
|
|
22
26
|
const exampleGapValue = '1px';
|
|
@@ -28,28 +32,31 @@ const exampleGapValue = '1px';
|
|
|
28
32
|
* If a different spacing is desired between wrapped lines, pass a spacing value to the `gap` prop.
|
|
29
33
|
*/
|
|
30
34
|
|
|
31
|
-
const StackWrap = props => {
|
|
32
|
-
var
|
|
35
|
+
const StackWrap = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
36
|
+
var _CSS;
|
|
33
37
|
|
|
34
38
|
const {
|
|
35
39
|
space
|
|
36
40
|
} = props; // Don't apply separate gap if `null` or `undefined`, so can be unset in Storybook etc
|
|
37
|
-
// eslint-disable-next-line react/destructuring-assignment
|
|
38
41
|
|
|
39
|
-
const gap =
|
|
42
|
+
const gap = props.gap ?? space;
|
|
40
43
|
const canUseCSSGap = _Platform.default.OS === 'web' && gap === space && // In Jest/CI, global CSS isn't always available and doesn't always have .supports method
|
|
41
44
|
typeof ((_CSS = CSS) === null || _CSS === void 0 ? void 0 : _CSS.supports) === 'function' && CSS.supports('gap', exampleGapValue);
|
|
42
45
|
return canUseCSSGap ?
|
|
43
46
|
/*#__PURE__*/
|
|
44
47
|
// If possible, use the cleaner implementation that applies CSS `gap` styles to the container.
|
|
45
|
-
(0, _jsxRuntime.jsx)(_StackWrapGap.default, {
|
|
48
|
+
(0, _jsxRuntime.jsx)(_StackWrapGap.default, {
|
|
49
|
+
ref: ref,
|
|
50
|
+
...props
|
|
46
51
|
}) :
|
|
47
52
|
/*#__PURE__*/
|
|
48
53
|
// Else, use the fallback implementation which renders a `Box` component around each child.
|
|
49
|
-
(0, _jsxRuntime.jsx)(_StackWrapBox.default, {
|
|
54
|
+
(0, _jsxRuntime.jsx)(_StackWrapBox.default, {
|
|
55
|
+
ref: ref,
|
|
56
|
+
...props
|
|
50
57
|
});
|
|
51
|
-
};
|
|
52
|
-
|
|
58
|
+
});
|
|
59
|
+
StackWrap.displayName = 'StackWrap';
|
|
53
60
|
StackWrap.propTypes = _StackWrapBox.default.propTypes;
|
|
54
61
|
var _default = StackWrap;
|
|
55
62
|
exports.default = _default;
|