@telus-uds/components-base 1.8.1 → 1.8.4
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/CHANGELOG.md +35 -2
- package/component-docs.json +711 -669
- package/lib/A11yInfoProvider/index.js +4 -3
- package/lib/A11yText/index.js +6 -5
- package/lib/ActivityIndicator/Spinner.js +14 -13
- package/lib/ActivityIndicator/Spinner.native.js +10 -8
- package/lib/ActivityIndicator/index.js +6 -5
- package/lib/ActivityIndicator/shared.js +1 -1
- package/lib/BaseProvider/index.js +13 -10
- package/lib/Box/Box.js +20 -19
- package/lib/Button/Button.js +7 -6
- package/lib/Button/ButtonBase.js +97 -79
- package/lib/Button/ButtonGroup.js +34 -32
- package/lib/Button/ButtonLink.js +9 -7
- package/lib/Button/index.js +4 -4
- package/lib/Button/propTypes.js +1 -1
- package/lib/Card/Card.js +8 -7
- package/lib/Card/CardBase.js +35 -31
- package/lib/Card/PressableCardBase.js +14 -12
- package/lib/Checkbox/Checkbox.js +97 -83
- package/lib/Checkbox/CheckboxGroup.js +29 -27
- package/lib/Checkbox/CheckboxInput.js +12 -10
- package/lib/Divider/Divider.js +10 -9
- package/lib/ExpandCollapse/Control.js +42 -36
- package/lib/ExpandCollapse/ExpandCollapse.js +11 -10
- package/lib/ExpandCollapse/Panel.js +29 -40
- package/lib/Feedback/Feedback.js +48 -35
- package/lib/Fieldset/Fieldset.js +16 -15
- package/lib/Fieldset/FieldsetContainer.js +16 -13
- package/lib/Fieldset/FieldsetContainer.native.js +11 -8
- package/lib/Fieldset/Legend.js +10 -7
- package/lib/Fieldset/Legend.native.js +10 -7
- package/lib/FlexGrid/Col/Col.js +18 -17
- package/lib/FlexGrid/FlexGrid.js +15 -14
- package/lib/FlexGrid/Row/Row.js +13 -12
- package/lib/HorizontalScroll/HorizontalScroll.js +25 -20
- package/lib/HorizontalScroll/HorizontalScrollButton.js +18 -14
- package/lib/HorizontalScroll/ScrollViewEnd.js +6 -5
- package/lib/HorizontalScroll/ScrollViewEnd.native.js +12 -9
- package/lib/HorizontalScroll/itemPositions.js +19 -13
- package/lib/Icon/Icon.js +11 -10
- package/lib/Icon/IconText.js +8 -7
- package/lib/Icon/index.js +5 -5
- package/lib/IconButton/IconButton.js +50 -42
- package/lib/InputLabel/InputLabel.js +37 -30
- package/lib/InputLabel/LabelContent.js +12 -9
- package/lib/InputLabel/LabelContent.native.js +9 -6
- package/lib/InputSupports/InputSupports.js +11 -10
- package/lib/InputSupports/useInputSupports.js +7 -6
- package/lib/Link/ChevronLink.js +9 -8
- package/lib/Link/InlinePressable.js +13 -10
- package/lib/Link/InlinePressable.native.js +20 -16
- package/lib/Link/Link.js +10 -9
- package/lib/Link/LinkBase.js +96 -78
- package/lib/Link/TextButton.js +9 -8
- package/lib/List/List.js +20 -13
- package/lib/List/ListItem.js +103 -79
- package/lib/Modal/Modal.js +74 -60
- package/lib/Notification/Notification.js +46 -33
- package/lib/Pagination/PageButton.js +13 -12
- package/lib/Pagination/Pagination.js +43 -30
- package/lib/Pagination/SideButton.js +21 -18
- package/lib/Pagination/usePagination.js +7 -6
- package/lib/Progress/Progress.js +23 -19
- package/lib/Progress/ProgressBar.js +25 -21
- package/lib/Progress/ProgressBarBackground.js +7 -6
- package/lib/Radio/Radio.js +80 -69
- package/lib/Radio/RadioButton.js +63 -53
- package/lib/Radio/RadioGroup.js +30 -28
- package/lib/Radio/RadioInput.js +12 -10
- package/lib/RadioCard/RadioCard.js +16 -15
- package/lib/RadioCard/RadioCardGroup.js +30 -28
- package/lib/Search/Search.js +52 -32
- package/lib/Select/Group.js +5 -4
- package/lib/Select/Group.native.js +4 -3
- package/lib/Select/Item.js +10 -7
- package/lib/Select/Item.native.js +1 -9
- package/lib/Select/Picker.js +16 -15
- package/lib/Select/Picker.native.js +49 -38
- package/lib/Select/Select.js +134 -113
- package/lib/SideNav/Item.js +39 -33
- package/lib/SideNav/ItemContent.js +15 -12
- package/lib/SideNav/ItemsGroup.js +13 -11
- package/lib/SideNav/SideNav.js +21 -18
- package/lib/Skeleton/Skeleton.js +60 -44
- package/lib/Skeleton/skeleton.constant.js +1 -1
- package/lib/Skeleton/skeletonWebAnimation.js +1 -1
- package/lib/Spacer/Spacer.js +6 -5
- package/lib/StackView/StackView.js +12 -11
- package/lib/StackView/StackWrap.js +5 -3
- package/lib/StackView/StackWrapBox.js +12 -11
- package/lib/StackView/StackWrapGap.js +11 -10
- package/lib/StackView/common.js +14 -11
- package/lib/StackView/getStackedContent.js +10 -9
- package/lib/StackView/index.js +1 -1
- package/lib/StepTracker/Step.js +122 -103
- package/lib/StepTracker/StepTracker.js +48 -38
- package/lib/Tabs/Tabs.js +57 -27
- package/lib/Tabs/TabsItem.js +78 -68
- package/lib/Tags/Tags.js +68 -62
- package/lib/TextInput/TextArea.js +26 -20
- package/lib/TextInput/TextInput.js +20 -15
- package/lib/TextInput/TextInputBase.js +74 -62
- package/lib/TextInput/index.js +4 -4
- package/lib/ThemeProvider/ThemeProvider.js +6 -5
- package/lib/ThemeProvider/index.js +5 -5
- package/lib/ThemeProvider/useSetTheme.js +6 -3
- package/lib/ThemeProvider/useThemeTokens.js +7 -2
- package/lib/ThemeProvider/utils/styles.js +50 -43
- package/lib/ThemeProvider/utils/theme-tokens.js +33 -21
- package/lib/ToggleSwitch/ToggleSwitch.js +90 -74
- package/lib/ToggleSwitch/ToggleSwitchGroup.js +37 -35
- package/lib/Tooltip/Backdrop.js +6 -13
- package/lib/Tooltip/Backdrop.native.js +5 -4
- package/lib/Tooltip/Tooltip.js +81 -65
- package/lib/Tooltip/getTooltipPosition.js +29 -18
- package/lib/TooltipButton/TooltipButton.js +28 -21
- package/lib/Typography/Typography.js +37 -33
- package/lib/ViewportProvider/ViewportProvider.js +4 -3
- package/lib/ViewportProvider/useViewportListener.js +6 -3
- package/lib/index.js +54 -54
- package/lib/utils/a11y/semantics.js +5 -2
- package/lib/utils/a11y/textSize.js +8 -6
- package/lib/utils/animation/useVerticalExpandAnimation.js +46 -19
- package/lib/utils/children.js +4 -3
- package/lib/utils/index.js +10 -10
- package/lib/utils/input.js +28 -29
- package/lib/utils/pressability.js +36 -22
- package/lib/utils/props/clickProps.js +2 -1
- package/lib/utils/props/componentPropType.js +3 -3
- package/lib/utils/props/getPropSelector.js +6 -3
- package/lib/utils/props/handlerProps.js +25 -19
- package/lib/utils/props/hrefAttrsProp.js +14 -11
- package/lib/utils/props/index.js +12 -12
- package/lib/utils/props/inputSupportsProps.js +15 -12
- package/lib/utils/props/linkProps.js +7 -6
- package/lib/utils/props/pressProps.js +1 -1
- package/lib/utils/props/selectSystemProps.js +2 -2
- package/lib/utils/props/tokens.js +29 -15
- package/lib/utils/ssr.js +6 -2
- package/lib/utils/useCopy.js +6 -4
- package/lib/utils/useHash.js +2 -1
- package/lib/utils/useResponsiveProp.js +1 -1
- package/lib/utils/useSpacingScale.js +3 -1
- package/lib/utils/useUniqueId.js +3 -2
- package/lib/utils/withLinkRouter.js +6 -5
- package/lib-module/A11yInfoProvider/index.js +4 -3
- package/lib-module/A11yText/index.js +6 -5
- package/lib-module/ActivityIndicator/Spinner.js +14 -13
- package/lib-module/ActivityIndicator/Spinner.native.js +9 -8
- package/lib-module/ActivityIndicator/index.js +6 -5
- package/lib-module/BaseProvider/index.js +13 -10
- package/lib-module/Box/Box.js +20 -19
- package/lib-module/Button/Button.js +7 -6
- package/lib-module/Button/ButtonBase.js +96 -79
- package/lib-module/Button/ButtonGroup.js +34 -32
- package/lib-module/Button/ButtonLink.js +8 -7
- package/lib-module/Card/Card.js +8 -7
- package/lib-module/Card/CardBase.js +35 -31
- package/lib-module/Card/PressableCardBase.js +12 -11
- package/lib-module/Checkbox/Checkbox.js +97 -83
- package/lib-module/Checkbox/CheckboxGroup.js +29 -27
- package/lib-module/Checkbox/CheckboxInput.js +12 -10
- package/lib-module/Divider/Divider.js +10 -9
- package/lib-module/ExpandCollapse/Control.js +42 -36
- package/lib-module/ExpandCollapse/ExpandCollapse.js +11 -10
- package/lib-module/ExpandCollapse/Panel.js +29 -37
- package/lib-module/Feedback/Feedback.js +46 -33
- package/lib-module/Fieldset/Fieldset.js +16 -15
- package/lib-module/Fieldset/FieldsetContainer.js +16 -13
- package/lib-module/Fieldset/FieldsetContainer.native.js +11 -8
- package/lib-module/Fieldset/Legend.js +10 -7
- package/lib-module/Fieldset/Legend.native.js +10 -7
- package/lib-module/FlexGrid/Col/Col.js +18 -17
- package/lib-module/FlexGrid/FlexGrid.js +15 -14
- package/lib-module/FlexGrid/Row/Row.js +13 -12
- package/lib-module/HorizontalScroll/HorizontalScroll.js +24 -19
- package/lib-module/HorizontalScroll/HorizontalScrollButton.js +18 -14
- package/lib-module/HorizontalScroll/ScrollViewEnd.js +6 -5
- package/lib-module/HorizontalScroll/ScrollViewEnd.native.js +12 -9
- package/lib-module/HorizontalScroll/itemPositions.js +18 -12
- package/lib-module/Icon/Icon.js +10 -9
- package/lib-module/Icon/IconText.js +9 -7
- package/lib-module/IconButton/IconButton.js +48 -41
- package/lib-module/InputLabel/InputLabel.js +37 -30
- package/lib-module/InputLabel/LabelContent.js +12 -9
- package/lib-module/InputLabel/LabelContent.native.js +9 -6
- package/lib-module/InputSupports/InputSupports.js +11 -10
- package/lib-module/InputSupports/useInputSupports.js +7 -6
- package/lib-module/Link/ChevronLink.js +9 -8
- package/lib-module/Link/InlinePressable.js +13 -10
- package/lib-module/Link/InlinePressable.native.js +20 -16
- package/lib-module/Link/Link.js +10 -9
- package/lib-module/Link/LinkBase.js +94 -77
- package/lib-module/Link/TextButton.js +9 -8
- package/lib-module/List/List.js +20 -13
- package/lib-module/List/ListItem.js +103 -78
- package/lib-module/Modal/Modal.js +74 -60
- package/lib-module/Notification/Notification.js +46 -33
- package/lib-module/Pagination/PageButton.js +13 -12
- package/lib-module/Pagination/Pagination.js +43 -30
- package/lib-module/Pagination/SideButton.js +21 -18
- package/lib-module/Pagination/usePagination.js +7 -6
- package/lib-module/Progress/Progress.js +23 -19
- package/lib-module/Progress/ProgressBar.js +25 -21
- package/lib-module/Progress/ProgressBarBackground.js +7 -6
- package/lib-module/Radio/Radio.js +80 -69
- package/lib-module/Radio/RadioButton.js +62 -52
- package/lib-module/Radio/RadioGroup.js +30 -28
- package/lib-module/Radio/RadioInput.js +12 -10
- package/lib-module/RadioCard/RadioCard.js +16 -15
- package/lib-module/RadioCard/RadioCardGroup.js +30 -28
- package/lib-module/Search/Search.js +52 -32
- package/lib-module/Select/Group.js +5 -4
- package/lib-module/Select/Group.native.js +4 -3
- package/lib-module/Select/Item.js +10 -7
- package/lib-module/Select/Item.native.js +1 -7
- package/lib-module/Select/Picker.js +16 -15
- package/lib-module/Select/Picker.native.js +46 -36
- package/lib-module/Select/Select.js +134 -113
- package/lib-module/SideNav/Item.js +39 -33
- package/lib-module/SideNav/ItemContent.js +14 -11
- package/lib-module/SideNav/ItemsGroup.js +13 -11
- package/lib-module/SideNav/SideNav.js +21 -18
- package/lib-module/Skeleton/Skeleton.js +60 -44
- package/lib-module/Skeleton/skeletonWebAnimation.js +1 -1
- package/lib-module/Spacer/Spacer.js +6 -5
- package/lib-module/StackView/StackView.js +12 -11
- package/lib-module/StackView/StackWrap.js +5 -3
- package/lib-module/StackView/StackWrapBox.js +12 -11
- package/lib-module/StackView/StackWrapGap.js +11 -10
- package/lib-module/StackView/common.js +14 -11
- package/lib-module/StackView/getStackedContent.js +10 -9
- package/lib-module/StepTracker/Step.js +122 -103
- package/lib-module/StepTracker/StepTracker.js +48 -38
- package/lib-module/Tabs/Tabs.js +57 -27
- package/lib-module/Tabs/TabsItem.js +77 -68
- package/lib-module/Tags/Tags.js +68 -62
- package/lib-module/TextInput/TextArea.js +26 -20
- package/lib-module/TextInput/TextInput.js +19 -15
- package/lib-module/TextInput/TextInputBase.js +74 -62
- package/lib-module/ThemeProvider/ThemeProvider.js +5 -4
- package/lib-module/ThemeProvider/useSetTheme.js +6 -3
- package/lib-module/ThemeProvider/useThemeTokens.js +7 -2
- package/lib-module/ThemeProvider/utils/styles.js +48 -41
- package/lib-module/ThemeProvider/utils/theme-tokens.js +32 -20
- package/lib-module/ToggleSwitch/ToggleSwitch.js +90 -74
- package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +37 -35
- package/lib-module/Tooltip/Backdrop.js +6 -13
- package/lib-module/Tooltip/Backdrop.native.js +5 -4
- package/lib-module/Tooltip/Tooltip.js +81 -65
- package/lib-module/Tooltip/getTooltipPosition.js +29 -18
- package/lib-module/TooltipButton/TooltipButton.js +28 -21
- package/lib-module/Typography/Typography.js +35 -31
- package/lib-module/ViewportProvider/ViewportProvider.js +4 -3
- package/lib-module/ViewportProvider/useViewportListener.js +6 -3
- package/lib-module/utils/a11y/semantics.js +4 -1
- package/lib-module/utils/a11y/textSize.js +7 -5
- package/lib-module/utils/animation/useVerticalExpandAnimation.js +47 -20
- package/lib-module/utils/children.js +4 -3
- package/lib-module/utils/input.js +28 -29
- package/lib-module/utils/pressability.js +35 -21
- package/lib-module/utils/props/clickProps.js +2 -1
- package/lib-module/utils/props/componentPropType.js +3 -3
- package/lib-module/utils/props/getPropSelector.js +6 -3
- package/lib-module/utils/props/handlerProps.js +24 -18
- package/lib-module/utils/props/hrefAttrsProp.js +14 -11
- package/lib-module/utils/props/inputSupportsProps.js +15 -12
- package/lib-module/utils/props/linkProps.js +7 -6
- package/lib-module/utils/props/selectSystemProps.js +2 -2
- package/lib-module/utils/props/tokens.js +27 -14
- package/lib-module/utils/ssr.js +5 -2
- package/lib-module/utils/useCopy.js +6 -4
- package/lib-module/utils/useHash.js +2 -1
- package/lib-module/utils/useSpacingScale.js +3 -1
- package/lib-module/utils/useUniqueId.js +3 -2
- package/lib-module/utils/withLinkRouter.js +6 -5
- package/package.json +13 -11
- package/src/ExpandCollapse/Panel.jsx +2 -19
- package/src/List/List.jsx +34 -19
- package/src/List/ListItem.jsx +12 -2
- package/src/Modal/Modal.jsx +2 -1
- package/src/Pagination/Pagination.jsx +3 -0
- package/src/Search/Search.jsx +11 -0
- package/src/Select/Item.native.jsx +0 -7
- package/src/Tabs/Tabs.jsx +24 -2
- package/src/Tabs/TabsItem.jsx +6 -5
- package/src/utils/animation/useVerticalExpandAnimation.js +47 -13
|
@@ -52,17 +52,18 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
|
|
|
52
52
|
* semantic role but only on web, not within native apps).
|
|
53
53
|
*/
|
|
54
54
|
|
|
55
|
-
const StackView = /*#__PURE__*/forwardRef(({
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
const StackView = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
56
|
+
let {
|
|
57
|
+
space = 1,
|
|
58
|
+
divider,
|
|
59
|
+
direction: directionProp = 'column',
|
|
60
|
+
children,
|
|
61
|
+
variant,
|
|
62
|
+
tokens,
|
|
63
|
+
tag,
|
|
64
|
+
accessibilityRole,
|
|
65
|
+
...rest
|
|
66
|
+
} = _ref;
|
|
66
67
|
const viewport = useViewport();
|
|
67
68
|
const direction = useResponsiveProp(directionProp, 'column');
|
|
68
69
|
const selectedProps = selectProps({ ...getA11yPropsFromHtmlTag(tag, accessibilityRole),
|
|
@@ -5,10 +5,10 @@ import StackWrapGap from './StackWrapGap'; // In Jest/CI/SSR, global CSS isn't a
|
|
|
5
5
|
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
|
|
8
|
-
const cssSupports = (
|
|
8
|
+
const cssSupports = function () {
|
|
9
9
|
var _window$CSS;
|
|
10
10
|
|
|
11
|
-
return typeof window !== 'undefined' && typeof ((_window$CSS = window.CSS) === null || _window$CSS === void 0 ? void 0 : _window$CSS.supports) === 'function' && window.CSS.supports(...
|
|
11
|
+
return typeof window !== 'undefined' && typeof ((_window$CSS = window.CSS) === null || _window$CSS === void 0 ? void 0 : _window$CSS.supports) === 'function' && window.CSS.supports(...arguments);
|
|
12
12
|
}; // CSS.supports needs an example of the type of value you intend to use.
|
|
13
13
|
// Will be an integer appended `px` after hooks and JSX styles are resolved.
|
|
14
14
|
|
|
@@ -23,11 +23,13 @@ const exampleGapValue = '1px';
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
const StackWrap = /*#__PURE__*/forwardRef((props, ref) => {
|
|
26
|
+
var _props$gap;
|
|
27
|
+
|
|
26
28
|
const {
|
|
27
29
|
space
|
|
28
30
|
} = props; // Don't apply separate gap if `null` or `undefined`, so can be unset in Storybook etc
|
|
29
31
|
|
|
30
|
-
const gap = props.gap
|
|
32
|
+
const gap = (_props$gap = props.gap) !== null && _props$gap !== void 0 ? _props$gap : space;
|
|
31
33
|
const canUseCSSGap = Platform.OS === 'web' && gap === space && cssSupports('gap', exampleGapValue);
|
|
32
34
|
return canUseCSSGap ?
|
|
33
35
|
/*#__PURE__*/
|
|
@@ -33,17 +33,18 @@ const spaceSides = {
|
|
|
33
33
|
* between the container and the stacked children, and requires a negative margin on the container.
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
|
-
const StackWrapBox = /*#__PURE__*/forwardRef(({
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
const StackWrapBox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
37
|
+
let {
|
|
38
|
+
space = 1,
|
|
39
|
+
gap = space,
|
|
40
|
+
direction: directionProp = 'row',
|
|
41
|
+
children,
|
|
42
|
+
tokens,
|
|
43
|
+
variant,
|
|
44
|
+
tag,
|
|
45
|
+
accessibilityRole,
|
|
46
|
+
...rest
|
|
47
|
+
} = _ref;
|
|
47
48
|
const viewport = useViewport();
|
|
48
49
|
const direction = useResponsiveProp(directionProp, 'row');
|
|
49
50
|
const themeTokens = useThemeTokens('StackView', tokens, variant, {
|
|
@@ -19,16 +19,17 @@ const [selectProps] = selectSystemProps([a11yProps, viewProps]);
|
|
|
19
19
|
* default if `gap` prop is undefined)
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
const StackWrapGap = /*#__PURE__*/forwardRef(({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
const StackWrapGap = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
23
|
+
let {
|
|
24
|
+
space = 1,
|
|
25
|
+
tokens,
|
|
26
|
+
variant,
|
|
27
|
+
direction: directionProp = 'row',
|
|
28
|
+
children,
|
|
29
|
+
tag,
|
|
30
|
+
accessibilityRole,
|
|
31
|
+
...rest
|
|
32
|
+
} = _ref;
|
|
32
33
|
const viewport = useViewport();
|
|
33
34
|
const direction = useResponsiveProp(directionProp, 'row');
|
|
34
35
|
const themeTokens = useThemeTokens('StackView', tokens, variant, {
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
2
|
-
export const selectFlexStyles =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
export const selectFlexStyles = _ref => {
|
|
3
|
+
let {
|
|
4
|
+
alignItems,
|
|
5
|
+
justifyContent,
|
|
6
|
+
flexGrow,
|
|
7
|
+
flexShrink
|
|
8
|
+
} = _ref;
|
|
9
|
+
return {
|
|
10
|
+
alignItems,
|
|
11
|
+
justifyContent,
|
|
12
|
+
flexGrow,
|
|
13
|
+
flexShrink
|
|
14
|
+
};
|
|
15
|
+
};
|
|
13
16
|
export const staticStyles = StyleSheet.create({
|
|
14
17
|
wrap: {
|
|
15
18
|
flexShrink: 1,
|
|
@@ -32,13 +32,14 @@ import Spacer from '../Spacer';
|
|
|
32
32
|
import { createElement as _createElement } from "react";
|
|
33
33
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
34
34
|
|
|
35
|
-
const getStackedContent = (children, {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
const getStackedContent = (children, _ref) => {
|
|
36
|
+
let {
|
|
37
|
+
divider,
|
|
38
|
+
space,
|
|
39
|
+
direction = 'column',
|
|
40
|
+
box,
|
|
41
|
+
preserveFragments = false
|
|
42
|
+
} = _ref;
|
|
42
43
|
const boxProps = box && typeof box === 'object' ? box : {
|
|
43
44
|
space
|
|
44
45
|
};
|
|
@@ -47,7 +48,7 @@ const getStackedContent = (children, {
|
|
|
47
48
|
const topLevelChildren = preserveFragments ? children : unpackFragment(children);
|
|
48
49
|
const validChildren = Children.toArray(topLevelChildren).filter(Boolean);
|
|
49
50
|
const content = validChildren.reduce((newChildren, child, index) => {
|
|
50
|
-
const boxID =
|
|
51
|
+
const boxID = "Stack-Box-".concat(index);
|
|
51
52
|
const item = box ?
|
|
52
53
|
/*#__PURE__*/
|
|
53
54
|
// If wrapped in Box, that Box needs a key.
|
|
@@ -57,7 +58,7 @@ const getStackedContent = (children, {
|
|
|
57
58
|
testID: boxID
|
|
58
59
|
}, child) : child;
|
|
59
60
|
if (!index || !space && !divider) return [...newChildren, item];
|
|
60
|
-
const testID =
|
|
61
|
+
const testID = "Stack-".concat(divider ? 'Divider' : 'Spacer', "-").concat(index);
|
|
61
62
|
const commonProps = {
|
|
62
63
|
testID,
|
|
63
64
|
key: testID,
|
|
@@ -11,105 +11,123 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
12
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
13
13
|
|
|
14
|
-
const selectCompletedIconTokens =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
const selectCompletedIconTokens = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
completedIconColor,
|
|
17
|
+
completedIconSize
|
|
18
|
+
} = _ref;
|
|
19
|
+
return {
|
|
20
|
+
size: completedIconSize,
|
|
21
|
+
color: completedIconColor
|
|
22
|
+
};
|
|
23
|
+
};
|
|
21
24
|
|
|
22
|
-
const selectConnectorStyles = ({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
const selectConnectorStyles = (_ref2, isCompleted) => {
|
|
26
|
+
let {
|
|
27
|
+
connectorColor,
|
|
28
|
+
connectorHeight,
|
|
29
|
+
connectorMinWidth,
|
|
30
|
+
connectorCompletedHeight,
|
|
31
|
+
connectorCompletedColor
|
|
32
|
+
} = _ref2;
|
|
33
|
+
return {
|
|
34
|
+
backgroundColor: connectorColor,
|
|
35
|
+
height: connectorHeight,
|
|
36
|
+
minWidth: connectorMinWidth,
|
|
37
|
+
...(isCompleted && {
|
|
38
|
+
height: connectorCompletedHeight,
|
|
39
|
+
backgroundColor: connectorCompletedColor
|
|
40
|
+
})
|
|
41
|
+
};
|
|
42
|
+
};
|
|
37
43
|
|
|
38
|
-
const selectCurrentInnerStyles =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
const selectCurrentInnerStyles = _ref3 => {
|
|
45
|
+
let {
|
|
46
|
+
knobCurrentInnerColor,
|
|
47
|
+
knobCurrentInnerSize
|
|
48
|
+
} = _ref3;
|
|
49
|
+
return {
|
|
50
|
+
backgroundColor: knobCurrentInnerColor,
|
|
51
|
+
borderRadius: knobCurrentInnerSize / 2,
|
|
52
|
+
height: knobCurrentInnerSize,
|
|
53
|
+
width: knobCurrentInnerSize
|
|
54
|
+
};
|
|
55
|
+
};
|
|
47
56
|
|
|
48
|
-
const selectKnobStyles = ({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
57
|
+
const selectKnobStyles = (_ref4, isCompleted, isCurrent) => {
|
|
58
|
+
let {
|
|
59
|
+
knobBackgroundColor,
|
|
60
|
+
knobBorderColor,
|
|
61
|
+
knobBorderWidth,
|
|
62
|
+
knobCompletedBackgroundColor,
|
|
63
|
+
knobCompletedBorderColor,
|
|
64
|
+
knobCompletedPaddingLeft,
|
|
65
|
+
knobCompletedPaddingTop,
|
|
66
|
+
knobCurrentBackgroundColor,
|
|
67
|
+
knobCurrentBorderColor,
|
|
68
|
+
knobCurrentBorderWidth,
|
|
69
|
+
knobCurrentPaddingLeft,
|
|
70
|
+
knobCurrentPaddingTop,
|
|
71
|
+
knobSize
|
|
72
|
+
} = _ref4;
|
|
73
|
+
return {
|
|
74
|
+
backgroundColor: knobBackgroundColor,
|
|
75
|
+
borderColor: knobBorderColor,
|
|
76
|
+
borderRadius: knobSize / 2,
|
|
77
|
+
borderWidth: knobBorderWidth,
|
|
78
|
+
height: knobSize,
|
|
79
|
+
width: knobSize,
|
|
80
|
+
...(isCompleted && {
|
|
81
|
+
backgroundColor: knobCompletedBackgroundColor,
|
|
82
|
+
borderColor: knobCompletedBorderColor,
|
|
83
|
+
paddingLeft: knobCompletedPaddingLeft,
|
|
84
|
+
paddingTop: knobCompletedPaddingTop
|
|
85
|
+
}),
|
|
86
|
+
...(isCurrent && {
|
|
87
|
+
backgroundColor: knobCurrentBackgroundColor,
|
|
88
|
+
borderColor: knobCurrentBorderColor,
|
|
89
|
+
borderWidth: knobCurrentBorderWidth,
|
|
90
|
+
paddingLeft: knobCurrentPaddingLeft,
|
|
91
|
+
paddingTop: knobCurrentPaddingTop
|
|
92
|
+
})
|
|
93
|
+
};
|
|
94
|
+
};
|
|
83
95
|
|
|
84
|
-
const selectLabelContainerStyles =
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
const selectLabelContainerStyles = _ref5 => {
|
|
97
|
+
let {
|
|
98
|
+
labelDirection,
|
|
99
|
+
labelGap,
|
|
100
|
+
labelMarginTop,
|
|
101
|
+
labelPaddingLeft,
|
|
102
|
+
labelPaddingRight
|
|
103
|
+
} = _ref5;
|
|
104
|
+
return {
|
|
105
|
+
marginTop: labelMarginTop,
|
|
106
|
+
paddingLeft: labelPaddingLeft,
|
|
107
|
+
paddingRight: labelPaddingRight,
|
|
108
|
+
flexDirection: labelDirection,
|
|
109
|
+
gap: labelGap
|
|
110
|
+
};
|
|
111
|
+
};
|
|
97
112
|
|
|
98
|
-
const selectLabelStyles = ({
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
const selectLabelStyles = (_ref6, isCurrent) => {
|
|
114
|
+
let {
|
|
115
|
+
labelColor,
|
|
116
|
+
labelCurrentColor,
|
|
117
|
+
labelCurrentFontWeight,
|
|
118
|
+
labelFontSize,
|
|
119
|
+
labelFontWeight,
|
|
120
|
+
labelFontName,
|
|
121
|
+
labelLineHeight
|
|
122
|
+
} = _ref6;
|
|
123
|
+
return applyTextStyles({
|
|
124
|
+
color: isCurrent ? labelCurrentColor : labelColor,
|
|
125
|
+
fontSize: labelFontSize,
|
|
126
|
+
lineHeight: labelLineHeight,
|
|
127
|
+
fontWeight: isCurrent ? labelCurrentFontWeight : labelFontWeight,
|
|
128
|
+
fontName: labelFontName
|
|
129
|
+
});
|
|
130
|
+
};
|
|
113
131
|
|
|
114
132
|
const getStepTestID = (isCompleted, isCurrent) => {
|
|
115
133
|
let testID = 'StepTracker-Step';
|
|
@@ -127,15 +145,16 @@ const getStepTestID = (isCompleted, isCurrent) => {
|
|
|
127
145
|
*/
|
|
128
146
|
|
|
129
147
|
|
|
130
|
-
const Step =
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
148
|
+
const Step = _ref7 => {
|
|
149
|
+
let {
|
|
150
|
+
label,
|
|
151
|
+
name,
|
|
152
|
+
status = 0,
|
|
153
|
+
stepCount = 0,
|
|
154
|
+
stepIndex = 0,
|
|
155
|
+
tokens,
|
|
156
|
+
...rest
|
|
157
|
+
} = _ref7;
|
|
139
158
|
const {
|
|
140
159
|
completedIcon,
|
|
141
160
|
showStepLabel,
|
|
@@ -14,37 +14,46 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
16
16
|
|
|
17
|
-
const selectContainerStyles =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
const selectContainerStyles = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
containerPaddingBottom,
|
|
20
|
+
containerPaddingLeft,
|
|
21
|
+
containerPaddingRight,
|
|
22
|
+
containerPaddingTop
|
|
23
|
+
} = _ref;
|
|
24
|
+
return {
|
|
25
|
+
paddingBottom: containerPaddingBottom,
|
|
26
|
+
paddingLeft: containerPaddingLeft,
|
|
27
|
+
paddingRight: containerPaddingRight,
|
|
28
|
+
paddingTop: containerPaddingTop
|
|
29
|
+
};
|
|
30
|
+
};
|
|
28
31
|
|
|
29
|
-
const selectStepTrackerLabelContainerStyles =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const selectStepTrackerLabelContainerStyles = _ref2 => {
|
|
33
|
+
let {
|
|
34
|
+
labelMarginTop
|
|
35
|
+
} = _ref2;
|
|
36
|
+
return {
|
|
37
|
+
marginTop: labelMarginTop
|
|
38
|
+
};
|
|
39
|
+
};
|
|
34
40
|
|
|
35
|
-
const selectStepTrackerLabelStyles =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
const selectStepTrackerLabelStyles = _ref3 => {
|
|
42
|
+
let {
|
|
43
|
+
labelColor,
|
|
44
|
+
labelFontSize,
|
|
45
|
+
labelFontWeight,
|
|
46
|
+
labelFontName,
|
|
47
|
+
labelLineHeight
|
|
48
|
+
} = _ref3;
|
|
49
|
+
return applyTextStyles({
|
|
50
|
+
color: labelColor,
|
|
51
|
+
fontSize: labelFontSize,
|
|
52
|
+
lineHeight: labelLineHeight,
|
|
53
|
+
fontWeight: labelFontWeight,
|
|
54
|
+
fontName: labelFontName
|
|
55
|
+
});
|
|
56
|
+
};
|
|
48
57
|
/**
|
|
49
58
|
* StepTracker component shows the current position in a sequence of steps.
|
|
50
59
|
*
|
|
@@ -79,15 +88,16 @@ const selectStepTrackerLabelStyles = ({
|
|
|
79
88
|
*/
|
|
80
89
|
|
|
81
90
|
|
|
82
|
-
const StepTracker = /*#__PURE__*/forwardRef(({
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
const StepTracker = /*#__PURE__*/forwardRef((_ref4, ref) => {
|
|
92
|
+
let {
|
|
93
|
+
current = 0,
|
|
94
|
+
copy = 'en',
|
|
95
|
+
dictionary = defaultDictionary,
|
|
96
|
+
steps = [],
|
|
97
|
+
tokens,
|
|
98
|
+
variant,
|
|
99
|
+
...rest
|
|
100
|
+
} = _ref4;
|
|
91
101
|
const viewport = useViewport();
|
|
92
102
|
const {
|
|
93
103
|
showStepTrackerLabel,
|
package/lib-module/Tabs/Tabs.js
CHANGED
|
@@ -12,24 +12,45 @@ const {
|
|
|
12
12
|
selectHorizontalScrollTokens,
|
|
13
13
|
useItemPositions
|
|
14
14
|
} = horizontalScrollUtils;
|
|
15
|
+
|
|
16
|
+
const getDefaultTabItemAccessibilityRole = parentRole => {
|
|
17
|
+
switch (parentRole) {
|
|
18
|
+
case 'tablist':
|
|
19
|
+
return 'tab';
|
|
20
|
+
|
|
21
|
+
case 'navigation':
|
|
22
|
+
return 'link';
|
|
23
|
+
|
|
24
|
+
default:
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
15
28
|
/**
|
|
16
29
|
* Tabs renders a horizontally-scrolling menu of selectable buttons which may link
|
|
17
30
|
* to a page or control what content is displayed on this page.
|
|
31
|
+
*
|
|
32
|
+
* If you are using Tabs to navigate to a new page (web-only) you should pass
|
|
33
|
+
* `navigation`as the `accessibilityRole` to te Tabs component, this will cause
|
|
34
|
+
* TabItems to default to a role of link and obtain aria-current behaviour.
|
|
18
35
|
*/
|
|
19
36
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
|
|
38
|
+
const Tabs = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
39
|
+
var _restProps$accessibil;
|
|
40
|
+
|
|
41
|
+
let {
|
|
42
|
+
tokens,
|
|
43
|
+
itemTokens,
|
|
44
|
+
scrollButtonTokens,
|
|
45
|
+
variant,
|
|
46
|
+
value,
|
|
47
|
+
initialValue,
|
|
48
|
+
onChange,
|
|
49
|
+
items = [],
|
|
50
|
+
LinkRouter,
|
|
51
|
+
linkRouterProps,
|
|
52
|
+
...rest
|
|
53
|
+
} = _ref;
|
|
33
54
|
const {
|
|
34
55
|
space,
|
|
35
56
|
...themeTokens
|
|
@@ -44,32 +65,40 @@ const Tabs = /*#__PURE__*/forwardRef(({
|
|
|
44
65
|
});
|
|
45
66
|
const [itemPositions, isPositioningReady] = useItemPositions();
|
|
46
67
|
useHash(useCallback((hash, event) => {
|
|
47
|
-
const hashItem = hash && items.find(
|
|
48
|
-
|
|
49
|
-
|
|
68
|
+
const hashItem = hash && items.find(_ref2 => {
|
|
69
|
+
let {
|
|
70
|
+
href
|
|
71
|
+
} = _ref2;
|
|
72
|
+
return hash === href;
|
|
73
|
+
});
|
|
50
74
|
const hashId = hashItem && (hashItem.id || hashItem.label);
|
|
51
75
|
if (hashId) setTimeout(setValue(hashId, event), 500);
|
|
52
76
|
}, [items, setValue]), isPositioningReady);
|
|
77
|
+
const restProps = selectProps(rest);
|
|
78
|
+
const parentAccessibilityRole = (_restProps$accessibil = restProps.accessibilityRole) !== null && _restProps$accessibil !== void 0 ? _restProps$accessibil : 'tablist';
|
|
79
|
+
const defaultTabItemAccessibiltyRole = getDefaultTabItemAccessibilityRole(parentAccessibilityRole);
|
|
53
80
|
return /*#__PURE__*/_jsx(HorizontalScroll, {
|
|
54
81
|
ref: ref,
|
|
55
82
|
ScrollButton: HorizontalScrollButton,
|
|
56
83
|
itemPositions: itemPositions,
|
|
57
84
|
tokens: selectHorizontalScrollTokens(themeTokens),
|
|
58
85
|
scrollButtonTokens: scrollButtonTokens,
|
|
59
|
-
accessibilityRole:
|
|
60
|
-
...
|
|
86
|
+
accessibilityRole: parentAccessibilityRole,
|
|
87
|
+
...restProps,
|
|
61
88
|
children: /*#__PURE__*/_jsx(StackView, {
|
|
62
89
|
space: space,
|
|
63
90
|
direction: "row",
|
|
64
|
-
children: items.map(({
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
91
|
+
children: items.map((_ref3, index) => {
|
|
92
|
+
let {
|
|
93
|
+
href,
|
|
94
|
+
label,
|
|
95
|
+
id,
|
|
96
|
+
accessibilityRole = defaultTabItemAccessibiltyRole,
|
|
97
|
+
ref: itemRef,
|
|
98
|
+
LinkRouter: ItemLinkRouter = LinkRouter,
|
|
99
|
+
linkRouterProps: itemLinkRouterProps
|
|
100
|
+
} = _ref3;
|
|
101
|
+
const itemId = id !== null && id !== void 0 ? id : label;
|
|
73
102
|
const isSelected = Boolean(currentValue && currentValue === itemId);
|
|
74
103
|
|
|
75
104
|
const handlePress = event => setValue(itemId, event);
|
|
@@ -83,6 +112,7 @@ const Tabs = /*#__PURE__*/forwardRef(({
|
|
|
83
112
|
selected: isSelected,
|
|
84
113
|
itemPositions: itemPositions,
|
|
85
114
|
index: index,
|
|
115
|
+
accessibilityRole: accessibilityRole,
|
|
86
116
|
LinkRouter: ItemLinkRouter,
|
|
87
117
|
linkRouterProps: { ...linkRouterProps,
|
|
88
118
|
...itemLinkRouterProps
|