@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,30 +10,31 @@ const MIN_SVG_LENGTH = MIN_STROKE_ANGLE / 360 * SVG_CIRCUMFERENCE;
|
|
|
10
10
|
const MAX_SVG_LENGTH = (1 - MIN_EMPTY_ANGLE / 360) * SVG_CIRCUMFERENCE;
|
|
11
11
|
const animationProps = {
|
|
12
12
|
begin: '0s',
|
|
13
|
-
dur:
|
|
13
|
+
dur: "".concat(DURATION, "ms"),
|
|
14
14
|
fill: 'freeze',
|
|
15
15
|
repeatCount: 'indefinite'
|
|
16
16
|
};
|
|
17
17
|
const bezierProps = {
|
|
18
18
|
calcMode: 'spline',
|
|
19
19
|
keyTimes: '0; 0.5; 1',
|
|
20
|
-
keySplines:
|
|
20
|
+
keySplines: "".concat(BEZIER.join(', '), " ; ").concat(BEZIER.join(', '))
|
|
21
21
|
}; // We're using svg rather than css here to define the animation to avoid needing to introduce css injection mechanism
|
|
22
22
|
// It's possible to replicate this functionality with RNW animations, but it snags on chrome at least, see https://github.com/telus/universal-design-system/pull/477 for details.
|
|
23
23
|
|
|
24
|
-
const Spinner = /*#__PURE__*/forwardRef(({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
const Spinner = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
25
|
+
let {
|
|
26
|
+
size,
|
|
27
|
+
color,
|
|
28
|
+
thickness,
|
|
29
|
+
label
|
|
30
|
+
} = _ref;
|
|
30
31
|
const {
|
|
31
32
|
reduceMotionEnabled
|
|
32
33
|
} = useA11yInfo();
|
|
33
34
|
return /*#__PURE__*/_jsx("svg", {
|
|
34
35
|
ref: ref,
|
|
35
|
-
width:
|
|
36
|
-
height:
|
|
36
|
+
width: "".concat(size, "px"),
|
|
37
|
+
height: "".concat(size, "px"),
|
|
37
38
|
viewBox: "0 0 48 48",
|
|
38
39
|
"aria-valuetext": label,
|
|
39
40
|
role: "progressbar",
|
|
@@ -42,7 +43,7 @@ const Spinner = /*#__PURE__*/forwardRef(({
|
|
|
42
43
|
children: [reduceMotionEnabled ? null : /*#__PURE__*/_jsx("animateTransform", {
|
|
43
44
|
attributeName: "transform",
|
|
44
45
|
type: "rotate",
|
|
45
|
-
values:
|
|
46
|
+
values: "-180 24 24;".concat(360 + MIN_STROKE_ANGLE - 180, " 24 24"),
|
|
46
47
|
...animationProps
|
|
47
48
|
}), /*#__PURE__*/_jsx("circle", {
|
|
48
49
|
fill: "none",
|
|
@@ -57,12 +58,12 @@ const Spinner = /*#__PURE__*/forwardRef(({
|
|
|
57
58
|
children: reduceMotionEnabled ? null : /*#__PURE__*/_jsxs(_Fragment, {
|
|
58
59
|
children: [/*#__PURE__*/_jsx("animate", {
|
|
59
60
|
attributeName: "stroke-dashoffset",
|
|
60
|
-
values:
|
|
61
|
+
values: "0;-10;".concat(MIN_SVG_LENGTH - SVG_CIRCUMFERENCE),
|
|
61
62
|
...animationProps,
|
|
62
63
|
...bezierProps
|
|
63
64
|
}), /*#__PURE__*/_jsx("animate", {
|
|
64
65
|
attributeName: "stroke-dasharray",
|
|
65
|
-
values:
|
|
66
|
+
values: "".concat(MIN_SVG_LENGTH, ", 200;").concat(MAX_SVG_LENGTH, ", 200;").concat(MIN_SVG_LENGTH, ", 200"),
|
|
66
67
|
...animationProps,
|
|
67
68
|
...bezierProps
|
|
68
69
|
})]
|
|
@@ -8,12 +8,13 @@ import { useA11yInfo } from '../A11yInfoProvider';
|
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
const ea = MIN_EMPTY_ANGLE / 2;
|
|
10
10
|
const sa = MIN_STROKE_ANGLE / 2;
|
|
11
|
-
const Spinner = /*#__PURE__*/forwardRef(({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
const Spinner = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
12
|
+
let {
|
|
13
|
+
size,
|
|
14
|
+
color,
|
|
15
|
+
thickness,
|
|
16
|
+
label
|
|
17
|
+
} = _ref;
|
|
17
18
|
const {
|
|
18
19
|
current: timer
|
|
19
20
|
} = React.useRef(new Animated.Value(0));
|
|
@@ -66,7 +67,7 @@ const Spinner = /*#__PURE__*/forwardRef(({
|
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
const direction = index ? -1 : +1;
|
|
69
|
-
return
|
|
70
|
+
return "".concat(direction * (180 - (sa + ea)) * easing(progress) + rotation, "deg");
|
|
70
71
|
});
|
|
71
72
|
const layerStyle = {
|
|
72
73
|
width: size,
|
|
@@ -81,7 +82,7 @@ const Spinner = /*#__PURE__*/forwardRef(({
|
|
|
81
82
|
layerStyle.transform = [{
|
|
82
83
|
rotate: timer.interpolate({
|
|
83
84
|
inputRange: [0, 1],
|
|
84
|
-
outputRange: [
|
|
85
|
+
outputRange: ["".concat(0 + ea + sa, "deg"), "".concat(2 * 360 + ea + sa, "deg")]
|
|
85
86
|
})
|
|
86
87
|
}];
|
|
87
88
|
viewportStyle.transform = [{
|
|
@@ -10,11 +10,12 @@ import Spinner from './Spinner';
|
|
|
10
10
|
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
|
|
13
|
-
const ActivityIndicator =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const ActivityIndicator = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
variant,
|
|
16
|
+
tokens,
|
|
17
|
+
label
|
|
18
|
+
} = _ref;
|
|
18
19
|
const {
|
|
19
20
|
size,
|
|
20
21
|
color,
|
|
@@ -7,17 +7,20 @@ import ViewportProvider from '../ViewportProvider';
|
|
|
7
7
|
import ThemeProvider from '../ThemeProvider';
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
|
|
10
|
-
const BaseProvider =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
children:
|
|
10
|
+
const BaseProvider = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
defaultTheme,
|
|
13
|
+
children
|
|
14
|
+
} = _ref;
|
|
15
|
+
return /*#__PURE__*/_jsx(A11yInfoProvider, {
|
|
16
|
+
children: /*#__PURE__*/_jsx(ViewportProvider, {
|
|
17
|
+
children: /*#__PURE__*/_jsx(ThemeProvider, {
|
|
18
|
+
defaultTheme: defaultTheme,
|
|
19
|
+
children: children
|
|
20
|
+
})
|
|
18
21
|
})
|
|
19
|
-
})
|
|
20
|
-
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
21
24
|
|
|
22
25
|
BaseProvider.propTypes = {
|
|
23
26
|
defaultTheme: (_ThemeProvider$propTy = ThemeProvider.propTypes) === null || _ThemeProvider$propTy === void 0 ? void 0 : _ThemeProvider$propTy.defaultTheme,
|
package/lib-module/Box/Box.js
CHANGED
|
@@ -93,25 +93,26 @@ const selectBoxStyles = tokens => {
|
|
|
93
93
|
*/
|
|
94
94
|
|
|
95
95
|
|
|
96
|
-
const Box = /*#__PURE__*/forwardRef(({
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
96
|
+
const Box = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
97
|
+
let {
|
|
98
|
+
space,
|
|
99
|
+
horizontal = space,
|
|
100
|
+
vertical = space,
|
|
101
|
+
top = vertical,
|
|
102
|
+
bottom = vertical,
|
|
103
|
+
left = horizontal,
|
|
104
|
+
right = horizontal,
|
|
105
|
+
flex,
|
|
106
|
+
children,
|
|
107
|
+
variant,
|
|
108
|
+
tokens,
|
|
109
|
+
scroll,
|
|
110
|
+
tag,
|
|
111
|
+
accessibilityRole,
|
|
112
|
+
testID,
|
|
113
|
+
dataSet,
|
|
114
|
+
...rest
|
|
115
|
+
} = _ref;
|
|
115
116
|
const props = { ...getA11yPropsFromHtmlTag(tag, accessibilityRole),
|
|
116
117
|
...selectProps(rest)
|
|
117
118
|
};
|
|
@@ -4,12 +4,13 @@ import buttonPropTypes, { textAndA11yText } from './propTypes';
|
|
|
4
4
|
import { useThemeTokensCallback } from '../ThemeProvider';
|
|
5
5
|
import { a11yProps } from '../utils/props';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
const Button = /*#__PURE__*/forwardRef(({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
const Button = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
8
|
+
let {
|
|
9
|
+
accessibilityRole = 'button',
|
|
10
|
+
tokens,
|
|
11
|
+
variant,
|
|
12
|
+
...props
|
|
13
|
+
} = _ref;
|
|
13
14
|
const getTokens = useThemeTokensCallback('Button', tokens, variant);
|
|
14
15
|
return /*#__PURE__*/_jsx(ButtonBase, { ...props,
|
|
15
16
|
tokens: getTokens,
|
|
@@ -10,36 +10,43 @@ import { a11yProps, clickProps, focusHandlerProps, getCursorStyle, linkProps, re
|
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, linkProps, viewProps]);
|
|
12
12
|
|
|
13
|
-
const getOuterBorderOffset =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
outerBackgroundColor
|
|
26
|
-
}) => ({
|
|
27
|
-
alignSelf,
|
|
28
|
-
backgroundColor: outerBackgroundColor,
|
|
29
|
-
opacity,
|
|
30
|
-
...applyOuterBorder({
|
|
31
|
-
outerBorderGap,
|
|
32
|
-
outerBorderWidth,
|
|
13
|
+
const getOuterBorderOffset = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
outerBorderGap = 0,
|
|
16
|
+
outerBorderWidth = 0
|
|
17
|
+
} = _ref;
|
|
18
|
+
return outerBorderGap + outerBorderWidth;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const selectOuterContainerStyles = _ref2 => {
|
|
22
|
+
let {
|
|
23
|
+
alignSelf,
|
|
24
|
+
opacity,
|
|
33
25
|
outerBorderColor,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
outerBorderWidth,
|
|
27
|
+
outerBorderGap,
|
|
28
|
+
borderRadius,
|
|
29
|
+
outerBackgroundColor
|
|
30
|
+
} = _ref2;
|
|
31
|
+
return {
|
|
32
|
+
alignSelf,
|
|
33
|
+
backgroundColor: outerBackgroundColor,
|
|
34
|
+
opacity,
|
|
35
|
+
...applyOuterBorder({
|
|
36
|
+
outerBorderGap,
|
|
37
|
+
outerBorderWidth,
|
|
38
|
+
outerBorderColor,
|
|
39
|
+
borderRadius
|
|
40
|
+
})
|
|
41
|
+
};
|
|
42
|
+
};
|
|
37
43
|
|
|
38
|
-
const selectOuterWidthStyles =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
const selectOuterWidthStyles = _ref3 => {
|
|
45
|
+
let {
|
|
46
|
+
outerBorderGap,
|
|
47
|
+
outerBorderWidth,
|
|
48
|
+
width
|
|
49
|
+
} = _ref3;
|
|
43
50
|
// The inner container's bounding box is the bounding box of the button overall
|
|
44
51
|
// so this many device pixels will sit outside of the overall bounding box
|
|
45
52
|
const outerBorderOffset = getOuterBorderOffset({
|
|
@@ -68,7 +75,7 @@ const selectOuterWidthStyles = ({
|
|
|
68
75
|
|
|
69
76
|
|
|
70
77
|
if (Platform.OS === 'web') {
|
|
71
|
-
widthStyles.width =
|
|
78
|
+
widthStyles.width = "calc(".concat(width, " + ").concat(outerBorderOffset * 2, "px)");
|
|
72
79
|
return widthStyles;
|
|
73
80
|
} // Can't use calc() on native but (unlike on web) flexGrow fills the container width here
|
|
74
81
|
|
|
@@ -84,16 +91,18 @@ const selectOuterWidthStyles = ({
|
|
|
84
91
|
return widthStyles;
|
|
85
92
|
};
|
|
86
93
|
|
|
87
|
-
const selectInnerContainerStyles =
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
const selectInnerContainerStyles = _ref4 => {
|
|
95
|
+
let {
|
|
96
|
+
backgroundColor,
|
|
97
|
+
paddingLeft,
|
|
98
|
+
paddingRight,
|
|
99
|
+
paddingTop,
|
|
100
|
+
paddingBottom,
|
|
101
|
+
shadow,
|
|
102
|
+
borderWidth,
|
|
103
|
+
minWidth
|
|
104
|
+
} = _ref4;
|
|
105
|
+
|
|
97
106
|
// Subtract border width from padding so overall button width/height doesn't
|
|
98
107
|
// jump around if the border width changes (avoiding NaN and negative padding)
|
|
99
108
|
const offsetBorder = value => typeof value === 'number' && typeof borderWidth === 'number' ? Math.max(0, value - borderWidth) : value;
|
|
@@ -109,39 +118,46 @@ const selectInnerContainerStyles = ({
|
|
|
109
118
|
};
|
|
110
119
|
};
|
|
111
120
|
|
|
112
|
-
const selectBorderStyles =
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
+
const selectBorderStyles = _ref5 => {
|
|
122
|
+
let {
|
|
123
|
+
borderColor,
|
|
124
|
+
borderWidth,
|
|
125
|
+
borderRadius
|
|
126
|
+
} = _ref5;
|
|
127
|
+
return {
|
|
128
|
+
borderColor,
|
|
129
|
+
borderWidth,
|
|
130
|
+
borderRadius
|
|
131
|
+
};
|
|
132
|
+
};
|
|
121
133
|
|
|
122
|
-
const selectTextStyles =
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
const selectTextStyles = _ref6 => {
|
|
135
|
+
let {
|
|
136
|
+
fontSize,
|
|
137
|
+
color,
|
|
138
|
+
lineHeight,
|
|
139
|
+
fontName,
|
|
140
|
+
fontWeight,
|
|
141
|
+
textAlign
|
|
142
|
+
} = _ref6;
|
|
143
|
+
return applyTextStyles({
|
|
144
|
+
fontSize,
|
|
145
|
+
color,
|
|
146
|
+
lineHeight,
|
|
147
|
+
fontName,
|
|
148
|
+
fontWeight,
|
|
149
|
+
textAlign
|
|
150
|
+
});
|
|
151
|
+
};
|
|
137
152
|
|
|
138
|
-
const selectWebOnlyStyles = (inactive, themeTokens, {
|
|
139
|
-
|
|
140
|
-
|
|
153
|
+
const selectWebOnlyStyles = (inactive, themeTokens, _ref7) => {
|
|
154
|
+
let {
|
|
155
|
+
accessibilityRole
|
|
156
|
+
} = _ref7;
|
|
141
157
|
return Platform.select({
|
|
142
158
|
web: {
|
|
143
159
|
// if it would overflow the container, wraps instead
|
|
144
|
-
maxWidth:
|
|
160
|
+
maxWidth: "calc(100% + ".concat(getOuterBorderOffset(themeTokens) * 2, "px)"),
|
|
145
161
|
outline: 'none',
|
|
146
162
|
// removes the default browser :focus outline
|
|
147
163
|
...getCursorStyle(inactive, accessibilityRole)
|
|
@@ -150,18 +166,19 @@ const selectWebOnlyStyles = (inactive, themeTokens, {
|
|
|
150
166
|
});
|
|
151
167
|
};
|
|
152
168
|
|
|
153
|
-
const ButtonBase = /*#__PURE__*/forwardRef(({
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
169
|
+
const ButtonBase = /*#__PURE__*/forwardRef((_ref8, ref) => {
|
|
170
|
+
let {
|
|
171
|
+
id,
|
|
172
|
+
href,
|
|
173
|
+
hrefAttrs,
|
|
174
|
+
children,
|
|
175
|
+
tokens = {},
|
|
176
|
+
disabled = false,
|
|
177
|
+
// alias for inactive
|
|
178
|
+
inactive = disabled,
|
|
179
|
+
selected = false,
|
|
180
|
+
...rawRest
|
|
181
|
+
} = _ref8;
|
|
165
182
|
const {
|
|
166
183
|
onPress,
|
|
167
184
|
...rest
|
|
@@ -12,30 +12,31 @@ import { getPressHandlersWithArgs } from '../utils/pressability';
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
14
14
|
const [selectItemProps, selectedItemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, pressProps, viewProps]);
|
|
15
|
-
const ButtonGroup = /*#__PURE__*/forwardRef(({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
15
|
+
const ButtonGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
16
|
+
let {
|
|
17
|
+
variant,
|
|
18
|
+
tokens,
|
|
19
|
+
items = [],
|
|
20
|
+
values,
|
|
21
|
+
initialValues,
|
|
22
|
+
maxValues = 1,
|
|
23
|
+
onChange,
|
|
24
|
+
readOnly = false,
|
|
25
|
+
inactive = false,
|
|
26
|
+
legend,
|
|
27
|
+
tooltip,
|
|
28
|
+
hint,
|
|
29
|
+
validation,
|
|
30
|
+
feedback,
|
|
31
|
+
name: inputGroupName,
|
|
32
|
+
copy,
|
|
33
|
+
accessibilityRole = maxValues === 1 ? 'radiogroup' // radiogroup is cross-platform; only web aria has generic groups
|
|
34
|
+
: Platform.select({
|
|
35
|
+
web: 'group',
|
|
36
|
+
default: 'none'
|
|
37
|
+
}),
|
|
38
|
+
...rest
|
|
39
|
+
} = _ref;
|
|
39
40
|
const viewport = useViewport();
|
|
40
41
|
const themeTokens = useThemeTokens('ButtonGroup', tokens, variant, {
|
|
41
42
|
viewport
|
|
@@ -65,7 +66,7 @@ const ButtonGroup = /*#__PURE__*/forwardRef(({
|
|
|
65
66
|
const uniqueFields = ['id', 'label'];
|
|
66
67
|
|
|
67
68
|
if (!containUniqueFields(items, uniqueFields)) {
|
|
68
|
-
throw new Error(
|
|
69
|
+
throw new Error("ButtonGroup items must have unique ".concat(uniqueFields.join(', ')));
|
|
69
70
|
} // Some web screenreaders e.g. MacOS Voiceover don't handle radiogroups properly unless radio is direct child of radiogroup
|
|
70
71
|
|
|
71
72
|
|
|
@@ -89,13 +90,14 @@ const ButtonGroup = /*#__PURE__*/forwardRef(({
|
|
|
89
90
|
direction: direction,
|
|
90
91
|
tokens: stackTokens,
|
|
91
92
|
ref: ref,
|
|
92
|
-
children: items.map(({
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
children: items.map((_ref2, index) => {
|
|
94
|
+
let {
|
|
95
|
+
label,
|
|
96
|
+
id = label,
|
|
97
|
+
accessibilityLabel,
|
|
98
|
+
ref: itemRef,
|
|
99
|
+
...itemRest
|
|
100
|
+
} = _ref2;
|
|
99
101
|
const isSelected = currentValues.includes(id); // Pass an object of relevant component state as first argument for any passed-in press handlers
|
|
100
102
|
|
|
101
103
|
const pressHandlers = getPressHandlersWithArgs(rest, [{
|
|
@@ -9,13 +9,14 @@ import { useThemeTokensCallback } from '../ThemeProvider';
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
const ButtonLink = /*#__PURE__*/forwardRef(({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
const ButtonLink = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
13
|
+
let {
|
|
14
|
+
accessibilityRole = 'link',
|
|
15
|
+
tokens,
|
|
16
|
+
variant,
|
|
17
|
+
dataSet,
|
|
18
|
+
...props
|
|
19
|
+
} = _ref;
|
|
19
20
|
const {
|
|
20
21
|
hrefAttrs,
|
|
21
22
|
rest
|
package/lib-module/Card/Card.js
CHANGED
|
@@ -56,13 +56,14 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
|
|
|
56
56
|
* depending on what you are trying to achieve.
|
|
57
57
|
*/
|
|
58
58
|
|
|
59
|
-
const Card =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
const Card = _ref => {
|
|
60
|
+
let {
|
|
61
|
+
children,
|
|
62
|
+
tokens,
|
|
63
|
+
variant,
|
|
64
|
+
dataSet,
|
|
65
|
+
...rest
|
|
66
|
+
} = _ref;
|
|
66
67
|
const viewport = useViewport();
|
|
67
68
|
const themeTokens = useThemeTokens('Card', tokens, variant, {
|
|
68
69
|
viewport
|
|
@@ -7,43 +7,47 @@ import { a11yProps, viewProps, selectSystemProps } from '../utils/props';
|
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]); // Ensure explicit selection of tokens
|
|
9
9
|
|
|
10
|
-
const selectStyles =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
10
|
+
const selectStyles = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
flex,
|
|
13
|
+
backgroundColor,
|
|
14
|
+
borderColor,
|
|
15
|
+
borderRadius,
|
|
16
|
+
borderWidth,
|
|
17
|
+
paddingBottom,
|
|
18
|
+
paddingLeft,
|
|
19
|
+
paddingRight,
|
|
20
|
+
paddingTop,
|
|
21
|
+
minWidth,
|
|
22
|
+
shadow
|
|
23
|
+
} = _ref;
|
|
24
|
+
return {
|
|
25
|
+
flex,
|
|
26
|
+
backgroundColor,
|
|
27
|
+
borderColor,
|
|
28
|
+
borderRadius,
|
|
29
|
+
borderWidth,
|
|
30
|
+
paddingBottom,
|
|
31
|
+
paddingLeft,
|
|
32
|
+
paddingRight,
|
|
33
|
+
paddingTop,
|
|
34
|
+
minWidth,
|
|
35
|
+
...applyShadowToken(shadow)
|
|
36
|
+
};
|
|
37
|
+
};
|
|
35
38
|
/**
|
|
36
39
|
* A themeless base component for Card which components can apply theme tokens to. Not
|
|
37
40
|
* intended to be used in apps or sites directly: build themed components on top of this.
|
|
38
41
|
*/
|
|
39
42
|
|
|
40
43
|
|
|
41
|
-
const CardBase = /*#__PURE__*/forwardRef(({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
const CardBase = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
45
|
+
let {
|
|
46
|
+
children,
|
|
47
|
+
tokens,
|
|
48
|
+
dataSet,
|
|
49
|
+
...rest
|
|
50
|
+
} = _ref2;
|
|
47
51
|
const cardStyle = selectStyles(typeof tokens === 'function' ? tokens() : tokens);
|
|
48
52
|
const props = selectProps(rest);
|
|
49
53
|
return /*#__PURE__*/_jsx(View, {
|