@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
|
@@ -10,11 +10,12 @@ import dictionary from './dictionary';
|
|
|
10
10
|
import useCopy from '../utils/useCopy';
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
|
|
13
|
-
const selectIconTokens = ({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const selectIconTokens = (_ref, direction) => {
|
|
14
|
+
let {
|
|
15
|
+
color,
|
|
16
|
+
iconSize,
|
|
17
|
+
iconDisplace
|
|
18
|
+
} = _ref;
|
|
18
19
|
return {
|
|
19
20
|
color,
|
|
20
21
|
size: iconSize,
|
|
@@ -26,15 +27,16 @@ const directionToSide = {
|
|
|
26
27
|
previous: 'left',
|
|
27
28
|
next: 'right'
|
|
28
29
|
};
|
|
29
|
-
const SideButton = /*#__PURE__*/forwardRef(({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
const SideButton = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
31
|
+
let {
|
|
32
|
+
direction = 'previous',
|
|
33
|
+
onPress,
|
|
34
|
+
href,
|
|
35
|
+
copy,
|
|
36
|
+
variant,
|
|
37
|
+
tokens,
|
|
38
|
+
...props
|
|
39
|
+
} = _ref2;
|
|
38
40
|
const viewport = useViewport();
|
|
39
41
|
const buttonVariant = {
|
|
40
42
|
direction,
|
|
@@ -74,10 +76,11 @@ const SideButton = /*#__PURE__*/forwardRef(({
|
|
|
74
76
|
ref: ref,
|
|
75
77
|
...buttonProps,
|
|
76
78
|
tokens: getButtonTokens,
|
|
77
|
-
children:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
children: _ref3 => {
|
|
80
|
+
let {
|
|
81
|
+
textStyles,
|
|
82
|
+
...buttonState
|
|
83
|
+
} = _ref3;
|
|
81
84
|
const iconProps = {
|
|
82
85
|
tokens: getIconTokens(buttonState)
|
|
83
86
|
};
|
|
@@ -5,15 +5,16 @@
|
|
|
5
5
|
* @param {React.Element[]} items
|
|
6
6
|
* @param {number} truncateAbove
|
|
7
7
|
*/
|
|
8
|
-
function usePagination({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
function usePagination(_ref) {
|
|
9
|
+
let {
|
|
10
|
+
items,
|
|
11
|
+
truncateAbove
|
|
12
|
+
} = _ref;
|
|
12
13
|
const activeItemIndex = Math.max(items.findIndex(item => item.props.isActive), 0 // default to the first item if none is marked as active
|
|
13
14
|
);
|
|
14
15
|
|
|
15
16
|
const getItemProps = index => {
|
|
16
|
-
var _items$index;
|
|
17
|
+
var _items$index$props, _items$index;
|
|
17
18
|
|
|
18
19
|
const {
|
|
19
20
|
onPress,
|
|
@@ -21,7 +22,7 @@ function usePagination({
|
|
|
21
22
|
hrefAttrs,
|
|
22
23
|
variant,
|
|
23
24
|
tokens
|
|
24
|
-
} = ((_items$index = items[index]) === null || _items$index === void 0 ? void 0 : _items$index.props)
|
|
25
|
+
} = (_items$index$props = (_items$index = items[index]) === null || _items$index === void 0 ? void 0 : _items$index.props) !== null && _items$index$props !== void 0 ? _items$index$props : {};
|
|
25
26
|
return {
|
|
26
27
|
onPress,
|
|
27
28
|
href,
|
|
@@ -6,19 +6,22 @@ import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps
|
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
8
8
|
|
|
9
|
-
const selectProgressStyles =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
const selectProgressStyles = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
backgroundColor,
|
|
12
|
+
borderWidth,
|
|
13
|
+
borderColor,
|
|
14
|
+
borderRadius,
|
|
15
|
+
height
|
|
16
|
+
} = _ref;
|
|
17
|
+
return {
|
|
18
|
+
backgroundColor,
|
|
19
|
+
borderWidth,
|
|
20
|
+
borderColor,
|
|
21
|
+
borderRadius,
|
|
22
|
+
height
|
|
23
|
+
};
|
|
24
|
+
};
|
|
22
25
|
/**
|
|
23
26
|
* The `Progress` is a container for displaying one or several `ProgressBar`s.
|
|
24
27
|
*
|
|
@@ -50,12 +53,13 @@ const selectProgressStyles = ({
|
|
|
50
53
|
*/
|
|
51
54
|
|
|
52
55
|
|
|
53
|
-
const Progress = /*#__PURE__*/forwardRef(({
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
const Progress = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
57
|
+
let {
|
|
58
|
+
children,
|
|
59
|
+
tokens,
|
|
60
|
+
variant,
|
|
61
|
+
...rest
|
|
62
|
+
} = _ref2;
|
|
59
63
|
const themeTokens = useThemeTokens('Progress', tokens, variant);
|
|
60
64
|
return /*#__PURE__*/_jsx(View, {
|
|
61
65
|
ref: ref,
|
|
@@ -9,18 +9,21 @@ import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps
|
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
11
11
|
|
|
12
|
-
const selectBarStyles = ({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
const selectBarStyles = (_ref, percentage) => {
|
|
13
|
+
let {
|
|
14
|
+
backgroundColor,
|
|
15
|
+
borderRadius,
|
|
16
|
+
outlineWidth,
|
|
17
|
+
outlineColor
|
|
18
|
+
} = _ref;
|
|
19
|
+
return {
|
|
20
|
+
backgroundColor,
|
|
21
|
+
borderRadius,
|
|
22
|
+
outlineWidth,
|
|
23
|
+
outlineColor,
|
|
24
|
+
width: "".concat(percentage, "%")
|
|
25
|
+
};
|
|
26
|
+
};
|
|
24
27
|
/**
|
|
25
28
|
* The `ProgressBar` is a visual representation of linear progression.
|
|
26
29
|
* It provides simple but important information at a quick glance.
|
|
@@ -57,13 +60,14 @@ const selectBarStyles = ({
|
|
|
57
60
|
*/
|
|
58
61
|
|
|
59
62
|
|
|
60
|
-
const ProgressBar = /*#__PURE__*/forwardRef(({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
const ProgressBar = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
64
|
+
let {
|
|
65
|
+
children = null,
|
|
66
|
+
percentage = 0,
|
|
67
|
+
tokens,
|
|
68
|
+
variant,
|
|
69
|
+
...rest
|
|
70
|
+
} = _ref2;
|
|
67
71
|
const themeTokens = useThemeTokens('ProgressBar', tokens, variant);
|
|
68
72
|
|
|
69
73
|
if (percentage < 0) {
|
|
@@ -78,7 +82,7 @@ const ProgressBar = /*#__PURE__*/forwardRef(({
|
|
|
78
82
|
min: 0,
|
|
79
83
|
max: 100,
|
|
80
84
|
now: percentage,
|
|
81
|
-
text:
|
|
85
|
+
text: "".concat(percentage, "%")
|
|
82
86
|
},
|
|
83
87
|
...rest
|
|
84
88
|
});
|
|
@@ -86,7 +90,7 @@ const ProgressBar = /*#__PURE__*/forwardRef(({
|
|
|
86
90
|
ref: ref,
|
|
87
91
|
style: [staticStyles.bar, selectBarStyles(themeTokens, percentage)],
|
|
88
92
|
...selectedProps,
|
|
89
|
-
children: children
|
|
93
|
+
children: children !== null && children !== void 0 ? children : /*#__PURE__*/_jsx(ProgressBarBackground, {
|
|
90
94
|
variant: variant
|
|
91
95
|
})
|
|
92
96
|
}) : null;
|
|
@@ -3,11 +3,12 @@ import ImageBackground from "react-native-web/dist/exports/ImageBackground";
|
|
|
3
3
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
4
4
|
import { variantProp } from '../utils';
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
const inactiveBackground =
|
|
7
|
-
const negativeBackground =
|
|
8
|
-
const ProgressBarBackground = /*#__PURE__*/forwardRef(({
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
const inactiveBackground = "%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='DisabledProgress7' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23B2B9BF'%3E%3C/rect%3E%3Ccircle cx='4' cy='4' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='0' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='8' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='0' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='8' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23DisabledProgress7");'%3E%3C/path%3E%3C/svg%3E";
|
|
7
|
+
const negativeBackground = "%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='NegativeProgress6' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23C12335'%3E%3C/rect%3E%3Cpath d='M 0,8 l 8,-8 M -2,2 l 4,-4 M 6,10 l 4,-4' stroke-width='2' shape-rendering='auto' stroke='%23e7adb4' stroke-linecap='square'%3E%3C/path%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23NegativeProgress6");'%3E%3C/path%3E%3C/svg%3E";
|
|
8
|
+
const ProgressBarBackground = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
9
|
+
let {
|
|
10
|
+
variant
|
|
11
|
+
} = _ref;
|
|
11
12
|
let source = null;
|
|
12
13
|
|
|
13
14
|
if (variant !== null && variant !== void 0 && variant.inactive) {
|
|
@@ -21,7 +22,7 @@ const ProgressBarBackground = /*#__PURE__*/forwardRef(({
|
|
|
21
22
|
return /*#__PURE__*/_jsx(ImageBackground, {
|
|
22
23
|
ref: ref,
|
|
23
24
|
source: {
|
|
24
|
-
uri:
|
|
25
|
+
uri: "data:image/svg+xml,".concat(source)
|
|
25
26
|
},
|
|
26
27
|
style: staticStyles.imageBackground
|
|
27
28
|
});
|
|
@@ -13,56 +13,65 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, viewProps]);
|
|
15
15
|
|
|
16
|
-
const selectContainerStyles =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
16
|
+
const selectContainerStyles = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
containerBackgroundColor,
|
|
19
|
+
containerBorderRadius,
|
|
20
|
+
containerOpacity,
|
|
21
|
+
containerPaddingBottom,
|
|
22
|
+
containerPaddingLeft,
|
|
23
|
+
containerPaddingRight,
|
|
24
|
+
containerPaddingTop,
|
|
25
|
+
containerShadow
|
|
26
|
+
} = _ref;
|
|
27
|
+
return {
|
|
28
|
+
backgroundColor: containerBackgroundColor,
|
|
29
|
+
borderRadius: containerBorderRadius,
|
|
30
|
+
opacity: containerOpacity,
|
|
31
|
+
paddingBottom: containerPaddingBottom,
|
|
32
|
+
paddingLeft: containerPaddingLeft,
|
|
33
|
+
paddingRight: containerPaddingRight,
|
|
34
|
+
paddingTop: containerPaddingTop,
|
|
35
|
+
...applyShadowToken(containerShadow)
|
|
36
|
+
};
|
|
37
|
+
};
|
|
35
38
|
|
|
36
|
-
const selectDescriptionStyles =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
const selectDescriptionStyles = _ref2 => {
|
|
40
|
+
let {
|
|
41
|
+
containerPaddingLeft = 0,
|
|
42
|
+
descriptionFontSize,
|
|
43
|
+
descriptionLineHeight,
|
|
44
|
+
descriptionMarginLeft,
|
|
45
|
+
inputSize,
|
|
46
|
+
labelMarginLeft = 0
|
|
47
|
+
} = _ref2;
|
|
48
|
+
return {
|
|
49
|
+
marginLeft: descriptionMarginLeft !== null && descriptionMarginLeft !== void 0 ? descriptionMarginLeft : containerPaddingLeft + inputSize + labelMarginLeft,
|
|
50
|
+
...applyTextStyles({
|
|
51
|
+
fontSize: descriptionFontSize,
|
|
52
|
+
lineHeight: descriptionLineHeight
|
|
53
|
+
})
|
|
54
|
+
};
|
|
55
|
+
};
|
|
50
56
|
|
|
51
|
-
const selectLabelStyles =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
const selectLabelStyles = _ref3 => {
|
|
58
|
+
let {
|
|
59
|
+
labelColor,
|
|
60
|
+
labelFontName,
|
|
61
|
+
labelFontSize,
|
|
62
|
+
labelFontWeight,
|
|
63
|
+
labelMarginLeft,
|
|
64
|
+
labelLineHeight
|
|
65
|
+
} = _ref3;
|
|
66
|
+
return applyTextStyles({
|
|
67
|
+
color: labelColor,
|
|
68
|
+
fontName: labelFontName,
|
|
69
|
+
fontWeight: labelFontWeight,
|
|
70
|
+
fontSize: labelFontSize,
|
|
71
|
+
lineHeight: labelLineHeight,
|
|
72
|
+
marginLeft: labelMarginLeft
|
|
73
|
+
});
|
|
74
|
+
};
|
|
66
75
|
/**
|
|
67
76
|
* Basic Radio component.
|
|
68
77
|
*
|
|
@@ -97,21 +106,22 @@ const selectLabelStyles = ({
|
|
|
97
106
|
*/
|
|
98
107
|
|
|
99
108
|
|
|
100
|
-
const Radio = /*#__PURE__*/forwardRef(({
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
109
|
+
const Radio = /*#__PURE__*/forwardRef((_ref4, ref) => {
|
|
110
|
+
let {
|
|
111
|
+
checked,
|
|
112
|
+
defaultChecked,
|
|
113
|
+
description,
|
|
114
|
+
error = false,
|
|
115
|
+
id,
|
|
116
|
+
inactive,
|
|
117
|
+
label,
|
|
118
|
+
name: inputName,
|
|
119
|
+
onChange,
|
|
120
|
+
tokens,
|
|
121
|
+
value,
|
|
122
|
+
variant,
|
|
123
|
+
...rest
|
|
124
|
+
} = _ref4;
|
|
115
125
|
const {
|
|
116
126
|
currentValue: isChecked,
|
|
117
127
|
setValue: setIsChecked,
|
|
@@ -140,7 +150,7 @@ const Radio = /*#__PURE__*/forwardRef(({
|
|
|
140
150
|
};
|
|
141
151
|
|
|
142
152
|
const uniqueId = useUniqueId('radio');
|
|
143
|
-
const inputId = id
|
|
153
|
+
const inputId = id !== null && id !== void 0 ? id : uniqueId;
|
|
144
154
|
return /*#__PURE__*/_jsx(Pressable, {
|
|
145
155
|
ref: ref,
|
|
146
156
|
disabled: inactive,
|
|
@@ -152,11 +162,12 @@ const Radio = /*#__PURE__*/forwardRef(({
|
|
|
152
162
|
disabled: inactive
|
|
153
163
|
},
|
|
154
164
|
...selectProps(rest),
|
|
155
|
-
children:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
165
|
+
children: _ref5 => {
|
|
166
|
+
let {
|
|
167
|
+
focused: focus,
|
|
168
|
+
hovered: hover,
|
|
169
|
+
pressed
|
|
170
|
+
} = _ref5;
|
|
160
171
|
const stateTokens = getTokens({
|
|
161
172
|
focus,
|
|
162
173
|
hover,
|
|
@@ -16,69 +16,79 @@ export const selectRadioButtonTokens = (themeTokens, prefix) => selectTokens(tok
|
|
|
16
16
|
|
|
17
17
|
const getBorderRadius = inputSize => inputSize / 2;
|
|
18
18
|
|
|
19
|
-
const selectCheckedStyles =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
const selectCheckedStyles = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
checkedBackgroundColor,
|
|
22
|
+
checkedSize
|
|
23
|
+
} = _ref;
|
|
24
|
+
return {
|
|
25
|
+
backgroundColor: checkedBackgroundColor,
|
|
26
|
+
borderRadius: checkedSize / 2,
|
|
27
|
+
height: checkedSize,
|
|
28
|
+
width: checkedSize
|
|
29
|
+
};
|
|
30
|
+
};
|
|
28
31
|
|
|
29
|
-
const selectInputStyles =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
32
|
+
const selectInputStyles = _ref2 => {
|
|
33
|
+
let {
|
|
34
|
+
inputBackgroundColor,
|
|
35
|
+
inputBorderColor,
|
|
36
|
+
inputBorderWidth,
|
|
37
|
+
inputOutlineColor,
|
|
38
|
+
inputOutlineWidth,
|
|
39
|
+
inputSize
|
|
40
|
+
} = _ref2;
|
|
41
|
+
return {
|
|
42
|
+
borderColor: inputBorderColor,
|
|
43
|
+
borderRadius: getBorderRadius(inputSize),
|
|
44
|
+
borderWidth: inputBorderWidth,
|
|
45
|
+
backgroundColor: inputBackgroundColor,
|
|
46
|
+
height: inputSize,
|
|
47
|
+
width: inputSize,
|
|
48
|
+
...Platform.select({
|
|
49
|
+
web: {
|
|
50
|
+
outlineStyle: 'solid',
|
|
51
|
+
outlineColor: inputOutlineColor,
|
|
52
|
+
outlineWidth: inputOutlineWidth
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
};
|
|
56
|
+
};
|
|
51
57
|
|
|
52
|
-
const selectOuterBorderStyles =
|
|
53
|
-
|
|
54
|
-
outerBorderWidth,
|
|
55
|
-
outerBorderGap,
|
|
56
|
-
inputSize
|
|
57
|
-
}) => ({ ...applyOuterBorder({
|
|
58
|
+
const selectOuterBorderStyles = _ref3 => {
|
|
59
|
+
let {
|
|
58
60
|
outerBorderColor,
|
|
59
61
|
outerBorderWidth,
|
|
60
62
|
outerBorderGap,
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
63
|
+
inputSize
|
|
64
|
+
} = _ref3;
|
|
65
|
+
return { ...applyOuterBorder({
|
|
66
|
+
outerBorderColor,
|
|
67
|
+
outerBorderWidth,
|
|
68
|
+
outerBorderGap,
|
|
69
|
+
borderRadius: getBorderRadius(inputSize)
|
|
70
|
+
})
|
|
71
|
+
};
|
|
72
|
+
};
|
|
64
73
|
/**
|
|
65
74
|
* The visual toggle of a radio input. Is not interactive on its own, should be used inside
|
|
66
75
|
* an interactive parent that passes down props when interacted with.
|
|
67
76
|
*/
|
|
68
77
|
|
|
69
78
|
|
|
70
|
-
const RadioButton = /*#__PURE__*/forwardRef(({
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
const RadioButton = /*#__PURE__*/forwardRef((_ref4, ref) => {
|
|
80
|
+
let {
|
|
81
|
+
isChecked,
|
|
82
|
+
tokens,
|
|
83
|
+
inactive,
|
|
84
|
+
defaultChecked,
|
|
85
|
+
inputId,
|
|
86
|
+
isControlled,
|
|
87
|
+
handleChange,
|
|
88
|
+
name: inputName,
|
|
89
|
+
value,
|
|
90
|
+
...rest
|
|
91
|
+
} = _ref4;
|
|
82
92
|
const themeTokens = validateThemeTokens(resolveThemeTokens(tokens, {
|
|
83
93
|
checked: isChecked
|
|
84
94
|
}), getTokensSetPropType(tokenKeys), 'RadioButton');
|
|
@@ -59,25 +59,26 @@ const [selectItemProps, selectedItemPropTypes] = selectSystemProps([a11yProps, f
|
|
|
59
59
|
* ```
|
|
60
60
|
*/
|
|
61
61
|
|
|
62
|
-
const RadioGroup = /*#__PURE__*/forwardRef(({
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
62
|
+
const RadioGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
63
|
+
let {
|
|
64
|
+
copy = 'en',
|
|
65
|
+
tokens,
|
|
66
|
+
radioTokens,
|
|
67
|
+
variant,
|
|
68
|
+
items = [],
|
|
69
|
+
legend,
|
|
70
|
+
tooltip,
|
|
71
|
+
hint,
|
|
72
|
+
validation,
|
|
73
|
+
feedback,
|
|
74
|
+
initialCheckedId,
|
|
75
|
+
checkedId,
|
|
76
|
+
onChange,
|
|
77
|
+
readOnly,
|
|
78
|
+
name: inputGroupName,
|
|
79
|
+
inactive,
|
|
80
|
+
...rest
|
|
81
|
+
} = _ref;
|
|
81
82
|
const viewport = useViewport();
|
|
82
83
|
const {
|
|
83
84
|
space,
|
|
@@ -97,17 +98,18 @@ const RadioGroup = /*#__PURE__*/forwardRef(({
|
|
|
97
98
|
const uniqueFields = ['id', 'label'];
|
|
98
99
|
|
|
99
100
|
if (!containUniqueFields(items, uniqueFields)) {
|
|
100
|
-
throw new Error(
|
|
101
|
+
throw new Error("RadioGroup items must have unique ".concat(uniqueFields.join(', ')));
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
const radios = items.map(({
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
104
|
+
const radios = items.map((_ref2, index) => {
|
|
105
|
+
let {
|
|
106
|
+
label,
|
|
107
|
+
id,
|
|
108
|
+
onChange: itemOnChange,
|
|
109
|
+
ref: itemRef,
|
|
110
|
+
...itemRest
|
|
111
|
+
} = _ref2;
|
|
112
|
+
const radioId = id || "Radio[".concat(index, "]");
|
|
111
113
|
const isChecked = currentValue === radioId;
|
|
112
114
|
|
|
113
115
|
const handleChange = (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 RadioInput = /*#__PURE__*/forwardRef(({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
const RadioInput = /*#__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>
|