@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
|
@@ -17,56 +17,65 @@ const {
|
|
|
17
17
|
getItemPositionLayoutHandler
|
|
18
18
|
} = horizontalScrollUtils;
|
|
19
19
|
|
|
20
|
-
const selectHighlightBarStyles =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
const selectHighlightBarStyles = _ref => {
|
|
21
|
+
let {
|
|
22
|
+
highlightColor,
|
|
23
|
+
highlightBarBorderRadius = 0,
|
|
24
|
+
highlightBarBorderWidth = 0,
|
|
25
|
+
highlightBarHeight = 0
|
|
26
|
+
} = _ref;
|
|
27
|
+
return {
|
|
28
|
+
backgroundColor: highlightColor,
|
|
29
|
+
borderColor: highlightColor,
|
|
30
|
+
height: highlightBarHeight + highlightBarBorderWidth * 2,
|
|
31
|
+
borderRadius: highlightBarBorderRadius,
|
|
32
|
+
borderWidth: highlightBarBorderWidth,
|
|
33
|
+
bottom: -1 * (highlightBarHeight + highlightBarBorderWidth),
|
|
34
|
+
left: -1 * highlightBarBorderWidth,
|
|
35
|
+
right: -1 * highlightBarBorderWidth,
|
|
36
|
+
zIndex: 1 + highlightBarBorderWidth
|
|
37
|
+
};
|
|
38
|
+
};
|
|
36
39
|
|
|
37
|
-
const selectHighlightTriangleStyles =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
40
|
+
const selectHighlightTriangleStyles = _ref2 => {
|
|
41
|
+
let {
|
|
42
|
+
highlightColor,
|
|
43
|
+
highlightTriangleSize
|
|
44
|
+
} = _ref2;
|
|
45
|
+
return {
|
|
46
|
+
container: {
|
|
47
|
+
bottom: 0 - highlightTriangleSize * 2
|
|
48
|
+
},
|
|
49
|
+
triangle: {
|
|
50
|
+
height: 0,
|
|
51
|
+
width: 0,
|
|
52
|
+
borderWidth: highlightTriangleSize,
|
|
53
|
+
borderTopColor: highlightColor,
|
|
54
|
+
borderBottomColor: 'transparent',
|
|
55
|
+
borderLeftColor: 'transparent',
|
|
56
|
+
borderRightColor: 'transparent'
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
};
|
|
54
60
|
|
|
55
|
-
const selectContainerStyles =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
const selectContainerStyles = _ref3 => {
|
|
62
|
+
let {
|
|
63
|
+
backgroundColor,
|
|
64
|
+
borderColor,
|
|
65
|
+
borderWidth = 0,
|
|
66
|
+
borderRadius,
|
|
67
|
+
paddingHorizontal = 0,
|
|
68
|
+
paddingVertical = 0
|
|
69
|
+
} = _ref3;
|
|
70
|
+
return {
|
|
71
|
+
backgroundColor,
|
|
72
|
+
borderColor,
|
|
73
|
+
borderWidth,
|
|
74
|
+
borderRadius,
|
|
75
|
+
paddingHorizontal: paddingHorizontal - borderWidth,
|
|
76
|
+
paddingVertical: paddingVertical - borderWidth
|
|
77
|
+
};
|
|
78
|
+
};
|
|
70
79
|
/**
|
|
71
80
|
* Item within a Tabs component representing one tab of content. May be rendered as a link
|
|
72
81
|
* or as a "menuitem" button depending on whether 'href' is passed.
|
|
@@ -75,23 +84,22 @@ const selectContainerStyles = ({
|
|
|
75
84
|
*/
|
|
76
85
|
|
|
77
86
|
|
|
78
|
-
const TabsItem = /*#__PURE__*/forwardRef(({
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}, ref) => {
|
|
87
|
+
const TabsItem = /*#__PURE__*/forwardRef((_ref4, ref) => {
|
|
88
|
+
let {
|
|
89
|
+
href,
|
|
90
|
+
variant,
|
|
91
|
+
tokens,
|
|
92
|
+
selected,
|
|
93
|
+
itemPositions,
|
|
94
|
+
index,
|
|
95
|
+
children,
|
|
96
|
+
accessibilityRole,
|
|
97
|
+
accessibilityCurrent = Platform.OS === 'web' && accessibilityRole === 'link' && selected ? 'page' : undefined,
|
|
98
|
+
accessibilityState = accessibilityRole === 'tab' ? {
|
|
99
|
+
selected
|
|
100
|
+
} : undefined,
|
|
101
|
+
...rawRest
|
|
102
|
+
} = _ref4;
|
|
95
103
|
// Convert onClick etc to onPress etc if used in an integration
|
|
96
104
|
const {
|
|
97
105
|
onPress,
|
|
@@ -119,12 +127,13 @@ const TabsItem = /*#__PURE__*/forwardRef(({
|
|
|
119
127
|
const openHref = href && linkProps.handleHref({
|
|
120
128
|
href
|
|
121
129
|
});
|
|
122
|
-
const handlePress = onPress || openHref ? (
|
|
123
|
-
if (onPress) onPress(...
|
|
124
|
-
if (openHref) openHref(...
|
|
130
|
+
const handlePress = onPress || openHref ? function () {
|
|
131
|
+
if (onPress) onPress(...arguments);
|
|
132
|
+
if (openHref) openHref(...arguments);
|
|
125
133
|
} : undefined;
|
|
126
134
|
const selectedProps = selectProps({
|
|
127
135
|
accessibilityRole,
|
|
136
|
+
accessibilityCurrent,
|
|
128
137
|
accessibilityState,
|
|
129
138
|
...rest
|
|
130
139
|
});
|
package/lib-module/Tags/Tags.js
CHANGED
|
@@ -15,58 +15,62 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
15
15
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
16
16
|
const [selectItemProps, selectedItemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, pressProps, viewProps]);
|
|
17
17
|
|
|
18
|
-
const selectIconTextTokens =
|
|
19
|
-
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
18
|
+
const selectIconTextTokens = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
icon,
|
|
21
|
+
iconPosition,
|
|
22
|
+
iconSpace,
|
|
23
|
+
iconSize,
|
|
24
|
+
iconColor,
|
|
25
|
+
iconBackground,
|
|
26
|
+
iconBorderRadius,
|
|
27
|
+
iconAlignSelf,
|
|
28
|
+
iconPadding,
|
|
29
|
+
iconTranslateX,
|
|
30
|
+
iconTranslateY
|
|
31
|
+
} = _ref;
|
|
32
|
+
return {
|
|
33
|
+
icon,
|
|
34
|
+
iconPosition,
|
|
35
|
+
iconSpace,
|
|
36
|
+
iconWrapperStyle: {
|
|
37
|
+
backgroundColor: iconBackground,
|
|
38
|
+
borderRadius: iconBorderRadius,
|
|
39
|
+
alignSelf: iconAlignSelf,
|
|
40
|
+
padding: iconPadding,
|
|
41
|
+
...Platform.select({
|
|
42
|
+
// TODO: https://github.com/telus/universal-design-system/issues/487
|
|
43
|
+
web: {
|
|
44
|
+
transition: 'color 200ms, background 200ms'
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
},
|
|
48
|
+
iconTokens: {
|
|
49
|
+
size: iconSize,
|
|
50
|
+
color: iconColor,
|
|
51
|
+
translateX: iconTranslateX,
|
|
52
|
+
translateY: iconTranslateY
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
};
|
|
53
56
|
|
|
54
|
-
const Tags = /*#__PURE__*/forwardRef(({
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
const Tags = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
58
|
+
let {
|
|
59
|
+
variant,
|
|
60
|
+
tokens,
|
|
61
|
+
items = [],
|
|
62
|
+
values,
|
|
63
|
+
initialValues,
|
|
64
|
+
maxValues,
|
|
65
|
+
onChange,
|
|
66
|
+
readOnly = false,
|
|
67
|
+
inactive = false,
|
|
68
|
+
accessibilityRole = Platform.select({
|
|
69
|
+
web: 'group',
|
|
70
|
+
default: 'none'
|
|
71
|
+
}),
|
|
72
|
+
...rest
|
|
73
|
+
} = _ref2;
|
|
70
74
|
const viewport = useViewport();
|
|
71
75
|
const themeTokens = useThemeTokens('Tags', tokens, variant, {
|
|
72
76
|
viewport
|
|
@@ -98,7 +102,7 @@ const Tags = /*#__PURE__*/forwardRef(({
|
|
|
98
102
|
const uniqueFields = ['id', 'label'];
|
|
99
103
|
|
|
100
104
|
if (!containUniqueFields(items, uniqueFields)) {
|
|
101
|
-
throw new Error(
|
|
105
|
+
throw new Error("Tags items must have unique ".concat(uniqueFields.join(', ')));
|
|
102
106
|
}
|
|
103
107
|
|
|
104
108
|
return /*#__PURE__*/_jsx(StackWrap, {
|
|
@@ -107,12 +111,13 @@ const Tags = /*#__PURE__*/forwardRef(({
|
|
|
107
111
|
space: space,
|
|
108
112
|
direction: direction,
|
|
109
113
|
tokens: stackTokens,
|
|
110
|
-
children: items.map(({
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
children: items.map((_ref3, index) => {
|
|
115
|
+
let {
|
|
116
|
+
label,
|
|
117
|
+
id = label,
|
|
118
|
+
ref: itemRef,
|
|
119
|
+
...itemRest
|
|
120
|
+
} = _ref3;
|
|
116
121
|
const isSelected = currentValues.includes(id); // Pass an object of relevant component state as first argument for any passed-in press handlers
|
|
117
122
|
|
|
118
123
|
const pressHandlers = getPressHandlersWithArgs(rest, [{
|
|
@@ -142,10 +147,11 @@ const Tags = /*#__PURE__*/forwardRef(({
|
|
|
142
147
|
selected: isSelected,
|
|
143
148
|
inactive: inactive,
|
|
144
149
|
...itemProps,
|
|
145
|
-
children:
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
150
|
+
children: _ref4 => {
|
|
151
|
+
let {
|
|
152
|
+
textStyles,
|
|
153
|
+
...buttonState
|
|
154
|
+
} = _ref4;
|
|
149
155
|
// TODO: once Icon/IconButton designs are stable, see if this sort of styling around
|
|
150
156
|
// an icon should go in Icon itself, or possibly via an IconText token set. Related issues:
|
|
151
157
|
// - Icon: https://github.com/telus/universal-design-system/issues/327
|
|
@@ -32,21 +32,24 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, foc
|
|
|
32
32
|
* It is a more usable and accessible option than the HTML `placeholder` attribute.
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
|
-
const TextArea = /*#__PURE__*/forwardRef(({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
const TextArea = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
36
|
+
let {
|
|
37
|
+
tokens,
|
|
38
|
+
variant = {},
|
|
39
|
+
...rest
|
|
40
|
+
} = _ref;
|
|
40
41
|
const themeTokens = useThemeTokens('TextArea', tokens, variant);
|
|
41
42
|
const [inputHeight, setInputHeight] = useState(); // adjust the text area's height as new lines are added to the content
|
|
42
43
|
|
|
43
|
-
const onHeightChange =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
const onHeightChange = _ref2 => {
|
|
45
|
+
let {
|
|
46
|
+
nativeEvent: {
|
|
47
|
+
contentSize: {
|
|
48
|
+
height
|
|
49
|
+
}
|
|
47
50
|
}
|
|
48
|
-
}
|
|
49
|
-
|
|
51
|
+
} = _ref2;
|
|
52
|
+
|
|
50
53
|
// on native this is happens out of the box
|
|
51
54
|
if (Platform.OS === 'web') {
|
|
52
55
|
setInputHeight(height);
|
|
@@ -67,15 +70,18 @@ const TextArea = /*#__PURE__*/forwardRef(({
|
|
|
67
70
|
tokens: themeTokens
|
|
68
71
|
};
|
|
69
72
|
return /*#__PURE__*/_jsx(InputSupports, { ...supportsProps,
|
|
70
|
-
children:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
children: _ref3 => {
|
|
74
|
+
let {
|
|
75
|
+
inputId,
|
|
76
|
+
...props
|
|
77
|
+
} = _ref3;
|
|
78
|
+
return /*#__PURE__*/_jsx(TextInputBase, {
|
|
79
|
+
ref: ref,
|
|
80
|
+
...inputProps,
|
|
81
|
+
nativeID: inputId,
|
|
82
|
+
...props
|
|
83
|
+
});
|
|
84
|
+
}
|
|
79
85
|
});
|
|
80
86
|
});
|
|
81
87
|
TextArea.displayName = 'TextArea';
|
|
@@ -25,12 +25,13 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, foc
|
|
|
25
25
|
* their implementation on the web.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
const TextInput = /*#__PURE__*/forwardRef(({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
const TextInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
29
|
+
let {
|
|
30
|
+
tokens,
|
|
31
|
+
variant = {},
|
|
32
|
+
pattern,
|
|
33
|
+
...rest
|
|
34
|
+
} = _ref;
|
|
34
35
|
React.useEffect(() => {
|
|
35
36
|
if (Platform.OS === 'web' && pattern && ref.current) {
|
|
36
37
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -48,15 +49,18 @@ const TextInput = /*#__PURE__*/forwardRef(({
|
|
|
48
49
|
}
|
|
49
50
|
};
|
|
50
51
|
return /*#__PURE__*/_jsx(InputSupports, { ...supportsProps,
|
|
51
|
-
children:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
children: _ref2 => {
|
|
53
|
+
let {
|
|
54
|
+
inputId,
|
|
55
|
+
...props
|
|
56
|
+
} = _ref2;
|
|
57
|
+
return /*#__PURE__*/_jsx(TextInputBase, {
|
|
58
|
+
ref: ref,
|
|
59
|
+
...inputProps,
|
|
60
|
+
nativeID: inputId,
|
|
61
|
+
...props
|
|
62
|
+
});
|
|
63
|
+
}
|
|
60
64
|
});
|
|
61
65
|
});
|
|
62
66
|
TextInput.displayName = 'TextInput';
|
|
@@ -10,27 +10,29 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
10
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, textInputHandlerProps, textInputProps, viewProps]);
|
|
12
12
|
|
|
13
|
-
const selectInputStyles = ({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
13
|
+
const selectInputStyles = (_ref, inactive) => {
|
|
14
|
+
let {
|
|
15
|
+
backgroundColor,
|
|
16
|
+
color,
|
|
17
|
+
borderWidth = 0,
|
|
18
|
+
borderColor,
|
|
19
|
+
borderRadius,
|
|
20
|
+
paddingTop = 0,
|
|
21
|
+
paddingBottom = 0,
|
|
22
|
+
paddingLeft,
|
|
23
|
+
paddingRight = 0,
|
|
24
|
+
fontName,
|
|
25
|
+
fontSize,
|
|
26
|
+
fontWeight,
|
|
27
|
+
lineHeight,
|
|
28
|
+
icon,
|
|
29
|
+
iconSize = 0,
|
|
30
|
+
minLines,
|
|
31
|
+
maxLines,
|
|
32
|
+
width,
|
|
33
|
+
height
|
|
34
|
+
} = _ref;
|
|
35
|
+
|
|
34
36
|
// Subtract border width from padding so overall input width/height doesn't
|
|
35
37
|
// jump around if the border width changes (avoiding NaN and negative padding)
|
|
36
38
|
const offsetBorder = value => typeof value === 'number' ? Math.max(0, value - borderWidth) : value;
|
|
@@ -79,52 +81,62 @@ const selectInputStyles = ({
|
|
|
79
81
|
};
|
|
80
82
|
};
|
|
81
83
|
|
|
82
|
-
const selectOuterBorderStyles =
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
outerBorderColor,
|
|
86
|
-
borderRadius
|
|
87
|
-
}) => ({
|
|
88
|
-
background: outerBackgroundColor,
|
|
89
|
-
...applyOuterBorder({
|
|
90
|
-
outerBorderColor,
|
|
84
|
+
const selectOuterBorderStyles = _ref2 => {
|
|
85
|
+
let {
|
|
86
|
+
outerBackgroundColor,
|
|
91
87
|
outerBorderWidth,
|
|
88
|
+
outerBorderColor,
|
|
92
89
|
borderRadius
|
|
93
|
-
}
|
|
94
|
-
|
|
90
|
+
} = _ref2;
|
|
91
|
+
return {
|
|
92
|
+
background: outerBackgroundColor,
|
|
93
|
+
...applyOuterBorder({
|
|
94
|
+
outerBorderColor,
|
|
95
|
+
outerBorderWidth,
|
|
96
|
+
borderRadius
|
|
97
|
+
})
|
|
98
|
+
};
|
|
99
|
+
};
|
|
95
100
|
|
|
96
|
-
const selectIconTokens =
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
const selectIconTokens = _ref3 => {
|
|
102
|
+
let {
|
|
103
|
+
iconSize,
|
|
104
|
+
iconColor
|
|
105
|
+
} = _ref3;
|
|
106
|
+
return {
|
|
107
|
+
size: iconSize,
|
|
108
|
+
color: iconColor
|
|
109
|
+
};
|
|
110
|
+
};
|
|
103
111
|
|
|
104
|
-
const selectIconContainerStyles =
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
112
|
+
const selectIconContainerStyles = _ref4 => {
|
|
113
|
+
let {
|
|
114
|
+
paddingRight,
|
|
115
|
+
paddingBottom
|
|
116
|
+
} = _ref4;
|
|
117
|
+
return {
|
|
118
|
+
paddingRight,
|
|
119
|
+
paddingBottom
|
|
120
|
+
};
|
|
121
|
+
};
|
|
111
122
|
|
|
112
|
-
const TextInputBase = /*#__PURE__*/forwardRef(({
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
123
|
+
const TextInputBase = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
124
|
+
let {
|
|
125
|
+
value,
|
|
126
|
+
height,
|
|
127
|
+
initialValue,
|
|
128
|
+
inactive,
|
|
129
|
+
readOnly,
|
|
130
|
+
onChange,
|
|
131
|
+
onChangeText,
|
|
132
|
+
onFocus,
|
|
133
|
+
onBlur,
|
|
134
|
+
onMouseOver,
|
|
135
|
+
onMouseOut,
|
|
136
|
+
tokens,
|
|
137
|
+
variant = {},
|
|
138
|
+
...rest
|
|
139
|
+
} = _ref5;
|
|
128
140
|
const [isFocused, setIsFocused] = useState(false);
|
|
129
141
|
|
|
130
142
|
const handleFocus = event => {
|
|
@@ -6,10 +6,11 @@ export const uninitialisedError = new Error('Theme context used outside of Theme
|
|
|
6
6
|
export const ThemeContext = /*#__PURE__*/createContext(uninitialisedError);
|
|
7
7
|
export const ThemeSetterContext = /*#__PURE__*/createContext(uninitialisedError);
|
|
8
8
|
|
|
9
|
-
const ThemeProvider =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const ThemeProvider = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
children,
|
|
12
|
+
defaultTheme
|
|
13
|
+
} = _ref;
|
|
13
14
|
const [theme, setTheme] = useState(defaultTheme); // Validate the theme tokens version on every render.
|
|
14
15
|
// This will intentionally break the application when attempting to use an invalid theme.
|
|
15
16
|
// This will surface an incompatibility quickly rather than allowing the potential for strange bugs due to missing or incompatible tokens.
|
|
@@ -10,9 +10,12 @@ const useSetTheme = () => {
|
|
|
10
10
|
} // Merge provided object into current theme
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
const editTheme = useCallback(newTheme => setTheme((
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const editTheme = useCallback(newTheme => setTheme(function () {
|
|
14
|
+
let oldTheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
15
|
+
return { ...oldTheme,
|
|
16
|
+
...newTheme
|
|
17
|
+
};
|
|
18
|
+
}), [setTheme]);
|
|
16
19
|
return {
|
|
17
20
|
setTheme,
|
|
18
21
|
editTheme
|
|
@@ -34,7 +34,10 @@ import { getComponentTheme, getThemeTokens, resolveThemeTokens, mergeAppearances
|
|
|
34
34
|
* @returns {TokensSet} - the currently-applicable resolved set of theme tokens to apply
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
|
-
export const useThemeTokens = (componentName
|
|
37
|
+
export const useThemeTokens = function (componentName) {
|
|
38
|
+
let tokens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
39
|
+
let variants = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
40
|
+
let states = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
38
41
|
const theme = useTheme();
|
|
39
42
|
const componentTheme = getComponentTheme(theme, componentName);
|
|
40
43
|
const themeTokens = getThemeTokens(componentTheme, tokens, variants, states);
|
|
@@ -93,7 +96,9 @@ export const useThemeTokens = (componentName, tokens = {}, variants = {}, states
|
|
|
93
96
|
* e.g. if one theme tokens callback needs to pass certain token overrides to another.
|
|
94
97
|
*/
|
|
95
98
|
|
|
96
|
-
export const useThemeTokensCallback = (componentName
|
|
99
|
+
export const useThemeTokensCallback = function (componentName) {
|
|
100
|
+
let tokens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
101
|
+
let variants = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
97
102
|
const theme = useTheme();
|
|
98
103
|
const componentTheme = getComponentTheme(theme, componentName);
|
|
99
104
|
const getThemeTokensCallback = useCallback((states, tokenOverrides) => {
|