@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
|
@@ -18,17 +18,18 @@ export const selectPressableCardTokens = tokens => Object.fromEntries(tokenKeys.
|
|
|
18
18
|
* apps or sites directly: build themed components on top of this.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
const PressableCardBase = /*#__PURE__*/forwardRef(({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
const PressableCardBase = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
22
|
+
let {
|
|
23
|
+
children,
|
|
24
|
+
tokens,
|
|
25
|
+
checked,
|
|
26
|
+
validation,
|
|
27
|
+
inactive,
|
|
28
|
+
href,
|
|
29
|
+
hrefAttrs,
|
|
30
|
+
accessibilityRole = href ? 'link' : undefined,
|
|
31
|
+
...rawRest
|
|
32
|
+
} = _ref;
|
|
32
33
|
const {
|
|
33
34
|
onPress,
|
|
34
35
|
...rest
|
|
@@ -16,71 +16,83 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
16
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, viewProps]);
|
|
18
18
|
|
|
19
|
-
const selectInputStyles = ({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
19
|
+
const selectInputStyles = (_ref, isChecked) => {
|
|
20
|
+
let {
|
|
21
|
+
iconBackgroundColor,
|
|
22
|
+
inputBorderColor,
|
|
23
|
+
inputBorderRadius,
|
|
24
|
+
inputBorderWidth,
|
|
25
|
+
inputBackgroundColor,
|
|
26
|
+
inputHeight,
|
|
27
|
+
inputOutlineColor,
|
|
28
|
+
inputOutlineWidth,
|
|
29
|
+
inputShadow,
|
|
30
|
+
inputWidth
|
|
31
|
+
} = _ref;
|
|
32
|
+
return {
|
|
33
|
+
borderColor: inputBorderColor,
|
|
34
|
+
borderWidth: inputBorderWidth,
|
|
35
|
+
borderRadius: inputBorderRadius,
|
|
36
|
+
backgroundColor: isChecked ? iconBackgroundColor : inputBackgroundColor,
|
|
37
|
+
height: inputHeight,
|
|
38
|
+
width: inputWidth,
|
|
39
|
+
...applyShadowToken(inputShadow),
|
|
40
|
+
...Platform.select({
|
|
41
|
+
web: {
|
|
42
|
+
outlineStyle: 'solid',
|
|
43
|
+
outlineColor: inputOutlineColor,
|
|
44
|
+
outlineWidth: inputOutlineWidth
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
};
|
|
48
|
+
};
|
|
46
49
|
|
|
47
|
-
const selectLabelStyles =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
const selectLabelStyles = _ref2 => {
|
|
51
|
+
let {
|
|
52
|
+
labelColor,
|
|
53
|
+
labelFontName,
|
|
54
|
+
labelFontSize,
|
|
55
|
+
labelFontWeight,
|
|
56
|
+
labelMarginLeft,
|
|
57
|
+
labelLineHeight
|
|
58
|
+
} = _ref2;
|
|
59
|
+
return {
|
|
60
|
+
marginLeft: labelMarginLeft,
|
|
61
|
+
...applyTextStyles({
|
|
62
|
+
color: labelColor,
|
|
63
|
+
fontName: labelFontName,
|
|
64
|
+
fontWeight: labelFontWeight,
|
|
65
|
+
fontSize: labelFontSize,
|
|
66
|
+
lineHeight: labelLineHeight
|
|
67
|
+
})
|
|
68
|
+
};
|
|
69
|
+
};
|
|
64
70
|
|
|
65
|
-
const selectIconTokens =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
const selectIconTokens = _ref3 => {
|
|
72
|
+
let {
|
|
73
|
+
icon,
|
|
74
|
+
iconColor,
|
|
75
|
+
iconSize
|
|
76
|
+
} = _ref3;
|
|
77
|
+
return {
|
|
78
|
+
icon,
|
|
79
|
+
color: iconColor,
|
|
80
|
+
size: iconSize
|
|
81
|
+
};
|
|
82
|
+
};
|
|
74
83
|
|
|
75
|
-
const selectFeedbackTokens =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
const selectFeedbackTokens = _ref4 => {
|
|
85
|
+
let {
|
|
86
|
+
feedbackMarginBottom,
|
|
87
|
+
feedbackMarginTop,
|
|
88
|
+
feedbackPosition
|
|
89
|
+
} = _ref4;
|
|
90
|
+
return {
|
|
91
|
+
feedbackPosition,
|
|
92
|
+
feedbackMarginBottom,
|
|
93
|
+
feedbackMarginTop
|
|
94
|
+
};
|
|
95
|
+
};
|
|
84
96
|
/**
|
|
85
97
|
* Basic Checkbox component.
|
|
86
98
|
*
|
|
@@ -118,21 +130,22 @@ const selectFeedbackTokens = ({
|
|
|
118
130
|
*/
|
|
119
131
|
|
|
120
132
|
|
|
121
|
-
const Checkbox = /*#__PURE__*/forwardRef(({
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
const Checkbox = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
134
|
+
let {
|
|
135
|
+
checked,
|
|
136
|
+
defaultChecked,
|
|
137
|
+
error = false,
|
|
138
|
+
feedback,
|
|
139
|
+
id,
|
|
140
|
+
inactive,
|
|
141
|
+
label,
|
|
142
|
+
name,
|
|
143
|
+
onChange,
|
|
144
|
+
tokens,
|
|
145
|
+
value,
|
|
146
|
+
variant,
|
|
147
|
+
...rest
|
|
148
|
+
} = _ref5;
|
|
136
149
|
const {
|
|
137
150
|
currentValue: isChecked,
|
|
138
151
|
setValue: setIsChecked,
|
|
@@ -173,7 +186,7 @@ const Checkbox = /*#__PURE__*/forwardRef(({
|
|
|
173
186
|
};
|
|
174
187
|
|
|
175
188
|
const uniqueId = useUniqueId('checkbox');
|
|
176
|
-
const inputId = id
|
|
189
|
+
const inputId = id !== null && id !== void 0 ? id : uniqueId;
|
|
177
190
|
return /*#__PURE__*/_jsx(View, {
|
|
178
191
|
style: staticStyles.wrapper,
|
|
179
192
|
ref: ref,
|
|
@@ -190,11 +203,12 @@ const Checkbox = /*#__PURE__*/forwardRef(({
|
|
|
190
203
|
disabled: inactive
|
|
191
204
|
},
|
|
192
205
|
...selectProps(rest),
|
|
193
|
-
children:
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
206
|
+
children: _ref6 => {
|
|
207
|
+
let {
|
|
208
|
+
focused: focus,
|
|
209
|
+
hovered: hover,
|
|
210
|
+
pressed
|
|
211
|
+
} = _ref6;
|
|
198
212
|
const {
|
|
199
213
|
icon: IconComponent,
|
|
200
214
|
...stateTokens
|
|
@@ -58,24 +58,25 @@ const [selectItemProps, selectedItemPropTypes] = selectSystemProps([a11yProps, f
|
|
|
58
58
|
* ```
|
|
59
59
|
*/
|
|
60
60
|
|
|
61
|
-
const CheckboxGroup = /*#__PURE__*/forwardRef(({
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
61
|
+
const CheckboxGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
62
|
+
let {
|
|
63
|
+
tokens,
|
|
64
|
+
radioTokens,
|
|
65
|
+
variant,
|
|
66
|
+
items = [],
|
|
67
|
+
legend,
|
|
68
|
+
tooltip,
|
|
69
|
+
hint,
|
|
70
|
+
validation,
|
|
71
|
+
feedback,
|
|
72
|
+
initialCheckedIds,
|
|
73
|
+
checkedIds,
|
|
74
|
+
onChange,
|
|
75
|
+
readOnly,
|
|
76
|
+
name: inputGroupName,
|
|
77
|
+
inactive,
|
|
78
|
+
...rest
|
|
79
|
+
} = _ref;
|
|
79
80
|
const viewport = useViewport();
|
|
80
81
|
const {
|
|
81
82
|
space,
|
|
@@ -95,17 +96,18 @@ const CheckboxGroup = /*#__PURE__*/forwardRef(({
|
|
|
95
96
|
const uniqueFields = ['id', 'label'];
|
|
96
97
|
|
|
97
98
|
if (!containUniqueFields(items, uniqueFields)) {
|
|
98
|
-
throw new Error(
|
|
99
|
+
throw new Error("CheckboxGroup items must have unique ".concat(uniqueFields.join(', ')));
|
|
99
100
|
}
|
|
100
101
|
|
|
101
|
-
const checkboxes = items.map(({
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
102
|
+
const checkboxes = items.map((_ref2, index) => {
|
|
103
|
+
let {
|
|
104
|
+
label,
|
|
105
|
+
id,
|
|
106
|
+
onChange: itemOnChange,
|
|
107
|
+
ref: itemRef,
|
|
108
|
+
...itemRest
|
|
109
|
+
} = _ref2;
|
|
110
|
+
const checkboxId = id || "Checkbox[".concat(index, "]");
|
|
109
111
|
|
|
110
112
|
const handleChange = (newCheckedState, event) => {
|
|
111
113
|
if (typeof itemOnChange === 'function') itemOnChange(newCheckedState, event);
|
|
@@ -5,16 +5,18 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
const CheckboxInput = /*#__PURE__*/forwardRef(({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
const CheckboxInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
9
|
+
let {
|
|
10
|
+
checked,
|
|
11
|
+
defaultChecked,
|
|
12
|
+
disabled,
|
|
13
|
+
id,
|
|
14
|
+
isControlled,
|
|
15
|
+
name,
|
|
16
|
+
onChange,
|
|
17
|
+
value
|
|
18
|
+
} = _ref;
|
|
19
|
+
|
|
18
20
|
const handleClick = event => {
|
|
19
21
|
// Cancel the click dispatched via the label tag, since it's already wrapped
|
|
20
22
|
// in <Pressable>
|
|
@@ -52,13 +52,14 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
|
|
|
52
52
|
* For accessibility purposes a divider component will be described with ARIA attributes, i.e. `role="separator"` and `aria-orientation="vertical/horizontal"`.
|
|
53
53
|
*/
|
|
54
54
|
|
|
55
|
-
const Divider = /*#__PURE__*/forwardRef(({
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
const Divider = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
56
|
+
let {
|
|
57
|
+
variant,
|
|
58
|
+
vertical = false,
|
|
59
|
+
space,
|
|
60
|
+
tokens,
|
|
61
|
+
...rest
|
|
62
|
+
} = _ref;
|
|
62
63
|
const {
|
|
63
64
|
color,
|
|
64
65
|
width
|
|
@@ -97,9 +98,9 @@ const Divider = /*#__PURE__*/forwardRef(({
|
|
|
97
98
|
};
|
|
98
99
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
99
100
|
children: [/*#__PURE__*/_jsx(Spacer, { ...spacerProps,
|
|
100
|
-
testID: testID ?
|
|
101
|
+
testID: testID ? "".concat(testID, "-Spacer-before") : undefined
|
|
101
102
|
}), divider, /*#__PURE__*/_jsx(Spacer, { ...spacerProps,
|
|
102
|
-
testID: testID ?
|
|
103
|
+
testID: testID ? "".concat(testID, "-Spacer-after") : undefined
|
|
103
104
|
})]
|
|
104
105
|
});
|
|
105
106
|
});
|
|
@@ -9,19 +9,20 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
11
11
|
|
|
12
|
-
function selectContainerStyles({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
function selectContainerStyles(_ref) {
|
|
13
|
+
let {
|
|
14
|
+
backgroundColor,
|
|
15
|
+
borderColor,
|
|
16
|
+
borderWidth,
|
|
17
|
+
borderStyle,
|
|
18
|
+
paddingLeft,
|
|
19
|
+
paddingRight,
|
|
20
|
+
paddingTop,
|
|
21
|
+
paddingBottom,
|
|
22
|
+
justifyContent,
|
|
23
|
+
verticalAlign,
|
|
24
|
+
iconPosition
|
|
25
|
+
} = _ref;
|
|
25
26
|
return {
|
|
26
27
|
backgroundColor,
|
|
27
28
|
borderTopColor: borderColor,
|
|
@@ -37,10 +38,11 @@ function selectContainerStyles({
|
|
|
37
38
|
} // TODO: use stack / spacer when available
|
|
38
39
|
|
|
39
40
|
|
|
40
|
-
function selectIconContainerStyles({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
function selectIconContainerStyles(_ref2) {
|
|
42
|
+
let {
|
|
43
|
+
iconGap,
|
|
44
|
+
iconPosition
|
|
45
|
+
} = _ref2;
|
|
44
46
|
const paddingSide = iconPosition === 'right' ? 'paddingLeft' : 'paddingRight';
|
|
45
47
|
return {
|
|
46
48
|
[paddingSide]: iconGap
|
|
@@ -54,15 +56,16 @@ function selectIconTokens(tokens) {
|
|
|
54
56
|
};
|
|
55
57
|
}
|
|
56
58
|
|
|
57
|
-
const ExpandCollapseControl = /*#__PURE__*/forwardRef(({
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
const ExpandCollapseControl = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
60
|
+
let {
|
|
61
|
+
onPress,
|
|
62
|
+
isExpanded,
|
|
63
|
+
children,
|
|
64
|
+
tokens,
|
|
65
|
+
accessibilityRole = 'button',
|
|
66
|
+
variant,
|
|
67
|
+
...rest
|
|
68
|
+
} = _ref3;
|
|
66
69
|
const getTokens = useThemeTokensCallback('ExpandCollapseControl', tokens, variant);
|
|
67
70
|
const selectedProps = selectProps({ ...rest,
|
|
68
71
|
accessibilityRole
|
|
@@ -71,16 +74,19 @@ const ExpandCollapseControl = /*#__PURE__*/forwardRef(({
|
|
|
71
74
|
expanded: isExpanded
|
|
72
75
|
};
|
|
73
76
|
|
|
74
|
-
const getControlState =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
const getControlState = _ref4 => {
|
|
78
|
+
let {
|
|
79
|
+
pressed,
|
|
80
|
+
hovered,
|
|
81
|
+
focused
|
|
82
|
+
} = _ref4;
|
|
83
|
+
return {
|
|
84
|
+
pressed,
|
|
85
|
+
hover: hovered,
|
|
86
|
+
focus: focused,
|
|
87
|
+
expanded: isExpanded
|
|
88
|
+
};
|
|
89
|
+
};
|
|
84
90
|
|
|
85
91
|
const getControlTokens = pressableState => getTokens(getControlState(pressableState));
|
|
86
92
|
|
|
@@ -22,16 +22,17 @@ function selectBorderStyles(tokens) {
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
const ExpandCollapse = /*#__PURE__*/forwardRef(({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
const ExpandCollapse = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
26
|
+
let {
|
|
27
|
+
children,
|
|
28
|
+
tokens,
|
|
29
|
+
variant,
|
|
30
|
+
maxOpen,
|
|
31
|
+
open,
|
|
32
|
+
initialOpen,
|
|
33
|
+
onChange,
|
|
34
|
+
...rest
|
|
35
|
+
} = _ref;
|
|
35
36
|
const {
|
|
36
37
|
currentValues: openIds,
|
|
37
38
|
toggleOneValue: onToggle,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef, useState } from 'react';
|
|
2
2
|
import Animated from "react-native-web/dist/exports/Animated";
|
|
3
3
|
import Platform from "react-native-web/dist/exports/Platform";
|
|
4
|
-
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
5
4
|
import View from "react-native-web/dist/exports/View";
|
|
6
5
|
import PropTypes from 'prop-types';
|
|
7
6
|
import ExpandCollapseControl from './Control';
|
|
@@ -13,17 +12,20 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
|
|
|
13
12
|
|
|
14
13
|
const selectGroupStyles = () => {};
|
|
15
14
|
|
|
16
|
-
const selectContainerStyles =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
const selectContainerStyles = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
contentPaddingLeft,
|
|
18
|
+
contentPaddingRight,
|
|
19
|
+
contentPaddingTop,
|
|
20
|
+
contentPaddingBottom
|
|
21
|
+
} = _ref;
|
|
22
|
+
return {
|
|
23
|
+
paddingLeft: contentPaddingLeft,
|
|
24
|
+
paddingRight: contentPaddingRight,
|
|
25
|
+
paddingTop: contentPaddingTop,
|
|
26
|
+
paddingBottom: contentPaddingBottom
|
|
27
|
+
};
|
|
28
|
+
};
|
|
27
29
|
/**
|
|
28
30
|
* An item in an `ExpandCollapse` which contains collapsible `children` and a `control` that opens
|
|
29
31
|
* and closes the collapsible children when pressed.
|
|
@@ -36,18 +38,19 @@ const selectContainerStyles = ({
|
|
|
36
38
|
*/
|
|
37
39
|
|
|
38
40
|
|
|
39
|
-
const ExpandCollapsePanel = /*#__PURE__*/forwardRef(({
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
const ExpandCollapsePanel = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
42
|
+
let {
|
|
43
|
+
openIds = [],
|
|
44
|
+
panelId,
|
|
45
|
+
onToggle,
|
|
46
|
+
onPress,
|
|
47
|
+
control,
|
|
48
|
+
controlTokens,
|
|
49
|
+
children,
|
|
50
|
+
tokens,
|
|
51
|
+
variant,
|
|
52
|
+
...rest
|
|
53
|
+
} = _ref2;
|
|
51
54
|
const [containerHeight, setContainerHeight] = useState(null);
|
|
52
55
|
const isExpanded = openIds.includes(panelId);
|
|
53
56
|
const selectedProps = selectProps(rest);
|
|
@@ -79,13 +82,7 @@ const ExpandCollapsePanel = /*#__PURE__*/forwardRef(({
|
|
|
79
82
|
containerHeight,
|
|
80
83
|
isExpanded,
|
|
81
84
|
tokens: themeTokens
|
|
82
|
-
});
|
|
83
|
-
// this won't work on native platforms
|
|
84
|
-
|
|
85
|
-
const overflowContainerStyles = containerHeight === null && Platform.OS === 'web' ? {
|
|
86
|
-
height: 0,
|
|
87
|
-
visibility: 'hidden'
|
|
88
|
-
} : undefined;
|
|
85
|
+
});
|
|
89
86
|
const focusabilityProps = isExpanded ? {} : a11yProps.nonFocusableProps;
|
|
90
87
|
return /*#__PURE__*/_jsxs(View, {
|
|
91
88
|
ref: ref,
|
|
@@ -97,7 +94,7 @@ const ExpandCollapsePanel = /*#__PURE__*/forwardRef(({
|
|
|
97
94
|
children: control
|
|
98
95
|
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
99
96
|
ref: animatedRef,
|
|
100
|
-
style:
|
|
97
|
+
style: animatedStyles,
|
|
101
98
|
...focusabilityProps,
|
|
102
99
|
children: /*#__PURE__*/_jsx(View, {
|
|
103
100
|
onLayout: onContainerLayout,
|
|
@@ -151,9 +148,4 @@ ExpandCollapsePanel.propTypes = { ...selectedSystemPropTypes,
|
|
|
151
148
|
*/
|
|
152
149
|
controlTokens: getTokensPropType('ExpandCollapseControl')
|
|
153
150
|
};
|
|
154
|
-
const staticStyles = StyleSheet.create({
|
|
155
|
-
itemsContainer: {
|
|
156
|
-
overflow: 'hidden'
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
151
|
export default ExpandCollapsePanel;
|