@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,43 +10,49 @@ import Icon from '../Icon';
|
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
12
12
|
|
|
13
|
-
const selectOuterStyle =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
outerBorderWidth,
|
|
17
|
-
outerBorderColor,
|
|
18
|
-
outerBorderGap,
|
|
19
|
-
shadow
|
|
20
|
-
}) => [{
|
|
21
|
-
backgroundColor,
|
|
22
|
-
...applyShadowToken(shadow),
|
|
23
|
-
...applyOuterBorder({
|
|
13
|
+
const selectOuterStyle = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
backgroundColor,
|
|
24
16
|
borderRadius,
|
|
25
17
|
outerBorderWidth,
|
|
26
18
|
outerBorderColor,
|
|
27
|
-
outerBorderGap
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
19
|
+
outerBorderGap,
|
|
20
|
+
shadow
|
|
21
|
+
} = _ref;
|
|
22
|
+
return [{
|
|
23
|
+
backgroundColor,
|
|
24
|
+
...applyShadowToken(shadow),
|
|
25
|
+
...applyOuterBorder({
|
|
26
|
+
borderRadius,
|
|
27
|
+
outerBorderWidth,
|
|
28
|
+
outerBorderColor,
|
|
29
|
+
outerBorderGap
|
|
30
|
+
}),
|
|
31
|
+
...Platform.select({
|
|
32
|
+
web: {
|
|
33
|
+
outline: 'none',
|
|
34
|
+
display: 'inline-flex'
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
}, staticStyles.outer];
|
|
38
|
+
};
|
|
36
39
|
|
|
37
|
-
const selectInnerStyle =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
const selectInnerStyle = _ref2 => {
|
|
41
|
+
let {
|
|
42
|
+
borderColor,
|
|
43
|
+
borderWidth = 0,
|
|
44
|
+
borderRadius,
|
|
45
|
+
padding = 0
|
|
46
|
+
} = _ref2;
|
|
47
|
+
return {
|
|
48
|
+
// Inner borders animate with the icon and should be treated like a themable feature of the icon
|
|
49
|
+
borderColor,
|
|
50
|
+
borderRadius,
|
|
51
|
+
borderWidth,
|
|
52
|
+
padding: Math.max(0, padding - borderWidth) // Stable size as border changes
|
|
48
53
|
|
|
49
|
-
}
|
|
54
|
+
};
|
|
55
|
+
};
|
|
50
56
|
/**
|
|
51
57
|
* A pressable themeless base component that handles pressable states and passes tokens
|
|
52
58
|
* based on these to an outer border and a base Card component. Not intended to be used in
|
|
@@ -54,15 +60,16 @@ const selectInnerStyle = ({
|
|
|
54
60
|
*/
|
|
55
61
|
|
|
56
62
|
|
|
57
|
-
const IconButton = /*#__PURE__*/forwardRef(({
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
const IconButton = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
64
|
+
let {
|
|
65
|
+
tokens,
|
|
66
|
+
variant,
|
|
67
|
+
icon: IconComponent,
|
|
68
|
+
href,
|
|
69
|
+
hrefAttrs,
|
|
70
|
+
accessibilityRole = href ? 'link' : 'button',
|
|
71
|
+
...rawRest
|
|
72
|
+
} = _ref3;
|
|
66
73
|
const {
|
|
67
74
|
onPress,
|
|
68
75
|
...rest
|
|
@@ -14,38 +14,45 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
|
|
|
14
14
|
|
|
15
15
|
const selectLabelStyles = tokens => applyTextStyles(selectTokens('Typography', tokens));
|
|
16
16
|
|
|
17
|
-
const selectHintStyles =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
const selectHintStyles = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
hintColor,
|
|
20
|
+
hintFontName,
|
|
21
|
+
hintFontSize,
|
|
22
|
+
hintFontWeight,
|
|
23
|
+
hintLineHeight
|
|
24
|
+
} = _ref;
|
|
25
|
+
return applyTextStyles({
|
|
26
|
+
color: hintColor,
|
|
27
|
+
fontName: hintFontName,
|
|
28
|
+
fontSize: hintFontSize,
|
|
29
|
+
fontWeight: hintFontWeight,
|
|
30
|
+
lineHeight: hintLineHeight
|
|
31
|
+
});
|
|
32
|
+
};
|
|
30
33
|
|
|
31
|
-
const selectGapStyles =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const selectGapStyles = _ref2 => {
|
|
35
|
+
let {
|
|
36
|
+
gap
|
|
37
|
+
} = _ref2;
|
|
38
|
+
return {
|
|
39
|
+
marginRight: gap
|
|
40
|
+
};
|
|
41
|
+
};
|
|
36
42
|
|
|
37
|
-
const InputLabel = /*#__PURE__*/forwardRef(({
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
const InputLabel = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
44
|
+
let {
|
|
45
|
+
copy = 'en',
|
|
46
|
+
label,
|
|
47
|
+
forId,
|
|
48
|
+
hint,
|
|
49
|
+
hintPosition = 'inline',
|
|
50
|
+
hintId,
|
|
51
|
+
tooltip,
|
|
52
|
+
tokens,
|
|
53
|
+
variant,
|
|
54
|
+
...rest
|
|
55
|
+
} = _ref3;
|
|
49
56
|
const themeTokens = useThemeTokens('InputLabel', tokens, variant);
|
|
50
57
|
const hasTooltip = tooltip !== undefined;
|
|
51
58
|
const isHintInline = hintPosition === 'inline';
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
const LabelContent = /*#__PURE__*/forwardRef(({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
const LabelContent = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
5
|
+
let {
|
|
6
|
+
children,
|
|
7
|
+
forId
|
|
8
|
+
} = _ref;
|
|
9
|
+
return /*#__PURE__*/_jsx("label", {
|
|
10
|
+
ref: ref,
|
|
11
|
+
htmlFor: forId,
|
|
12
|
+
style: staticStyles.inheritCursor,
|
|
13
|
+
children: children
|
|
14
|
+
});
|
|
15
|
+
});
|
|
13
16
|
LabelContent.displayName = 'LabelContent';
|
|
14
17
|
LabelContent.propTypes = {
|
|
15
18
|
children: PropTypes.string,
|
|
@@ -3,12 +3,15 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import View from "react-native-web/dist/exports/View"; // Since there's no equivalent for web's <label> element we're simply rendering whatever is passed to this component.
|
|
4
4
|
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
const LabelContent = /*#__PURE__*/forwardRef(({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
const LabelContent = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
7
|
+
let {
|
|
8
|
+
children
|
|
9
|
+
} = _ref;
|
|
10
|
+
return ref ? /*#__PURE__*/_jsx(View, {
|
|
11
|
+
ref: ref,
|
|
12
|
+
children: children
|
|
13
|
+
}) : children;
|
|
14
|
+
});
|
|
12
15
|
LabelContent.displayName = 'LabelContent';
|
|
13
16
|
LabelContent.propTypes = {
|
|
14
17
|
children: PropTypes.node
|
|
@@ -7,16 +7,17 @@ import { useThemeTokens } from '../ThemeProvider';
|
|
|
7
7
|
import useInputSupports from './useInputSupports';
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
const InputSupports = /*#__PURE__*/forwardRef(({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
const InputSupports = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
11
|
+
let {
|
|
12
|
+
children,
|
|
13
|
+
copy = 'en',
|
|
14
|
+
label,
|
|
15
|
+
hint,
|
|
16
|
+
hintPosition = 'inline',
|
|
17
|
+
feedback,
|
|
18
|
+
tooltip,
|
|
19
|
+
validation
|
|
20
|
+
} = _ref;
|
|
20
21
|
const {
|
|
21
22
|
space
|
|
22
23
|
} = useThemeTokens('InputSupports');
|
|
@@ -2,12 +2,13 @@ import useUniqueId from '../utils/useUniqueId';
|
|
|
2
2
|
|
|
3
3
|
const joinDefined = array => array.filter(item => item !== undefined).join(' ');
|
|
4
4
|
|
|
5
|
-
const useInputSupports =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
const useInputSupports = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
label,
|
|
8
|
+
feedback,
|
|
9
|
+
validation,
|
|
10
|
+
hint
|
|
11
|
+
} = _ref;
|
|
11
12
|
const hasValidationError = validation === 'error';
|
|
12
13
|
const inputId = useUniqueId('input');
|
|
13
14
|
const hintId = useUniqueId('input-hint');
|
|
@@ -11,14 +11,15 @@ import LinkBase from './LinkBase';
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
const ChevronLink = /*#__PURE__*/forwardRef(({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
const ChevronLink = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
15
|
+
let {
|
|
16
|
+
direction = 'right',
|
|
17
|
+
children,
|
|
18
|
+
tokens,
|
|
19
|
+
variant,
|
|
20
|
+
dataSet,
|
|
21
|
+
...linkProps
|
|
22
|
+
} = _ref;
|
|
22
23
|
const getChevronTokens = useThemeTokensCallback('ChevronLink', tokens, variant);
|
|
23
24
|
|
|
24
25
|
const applyChevronTokens = linkState => {
|
|
@@ -17,16 +17,19 @@ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
|
17
17
|
// eslint-disable-next-line react/prop-types
|
|
18
18
|
|
|
19
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
-
const InlinePressable = /*#__PURE__*/forwardRef(({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
const InlinePressable = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
21
|
+
let {
|
|
22
|
+
children,
|
|
23
|
+
style,
|
|
24
|
+
...props
|
|
25
|
+
} = _ref;
|
|
26
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
27
|
+
ref: ref,
|
|
28
|
+
style: pressState => [staticStyles.inline, typeof style === 'function' ? style(pressState) : style],
|
|
29
|
+
...props,
|
|
30
|
+
children: pressState => typeof children === 'function' ? children(pressState) : children
|
|
31
|
+
});
|
|
32
|
+
});
|
|
30
33
|
InlinePressable.displayName = 'InlinePressable';
|
|
31
34
|
const staticStyles = StyleSheet.create({
|
|
32
35
|
inline: {
|
|
@@ -9,16 +9,19 @@ import TouchableWithoutFeedback from "react-native-web/dist/exports/TouchableWit
|
|
|
9
9
|
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
|
|
12
|
-
const pressablePropsToTouchable =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
const pressablePropsToTouchable = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
unstable_pressDelay,
|
|
15
|
+
android_disableSound,
|
|
16
|
+
android_ripple,
|
|
17
|
+
// Unsupported, discard it
|
|
18
|
+
...props
|
|
19
|
+
} = _ref;
|
|
20
|
+
return { ...props,
|
|
21
|
+
touchSoundDisabled: android_disableSound,
|
|
22
|
+
delayPressIn: unstable_pressDelay
|
|
23
|
+
};
|
|
24
|
+
};
|
|
22
25
|
/**
|
|
23
26
|
* InlinePressable is an alternative to React Native's Pressable that works better when nested
|
|
24
27
|
* inline inside Text. It accepts the same props as React Native's Pressable.
|
|
@@ -41,12 +44,13 @@ const pressablePropsToTouchable = ({
|
|
|
41
44
|
// eslint-disable-next-line react/prop-types
|
|
42
45
|
|
|
43
46
|
|
|
44
|
-
const InlinePressable = /*#__PURE__*/forwardRef(({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
const InlinePressable = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
48
|
+
let {
|
|
49
|
+
onPress,
|
|
50
|
+
children,
|
|
51
|
+
style,
|
|
52
|
+
...rest
|
|
53
|
+
} = _ref2;
|
|
50
54
|
const [isFocused, setIsFocused] = useState(false);
|
|
51
55
|
|
|
52
56
|
const handleFocus = () => setIsFocused(true);
|
package/lib-module/Link/Link.js
CHANGED
|
@@ -2,15 +2,16 @@ import React, { forwardRef } from 'react';
|
|
|
2
2
|
import { useThemeTokensCallback } from '../ThemeProvider';
|
|
3
3
|
import LinkBase from './LinkBase';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
const Link = /*#__PURE__*/forwardRef(({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
const Link = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
6
|
+
let {
|
|
7
|
+
href,
|
|
8
|
+
children,
|
|
9
|
+
accessibilityRole = 'link',
|
|
10
|
+
variant = {},
|
|
11
|
+
tokens,
|
|
12
|
+
dataSet,
|
|
13
|
+
...linkProps
|
|
14
|
+
} = _ref;
|
|
14
15
|
const getTokens = useThemeTokensCallback('Link', tokens, variant);
|
|
15
16
|
return /*#__PURE__*/_jsx(LinkBase, {
|
|
16
17
|
href: href,
|
|
@@ -12,79 +12,95 @@ import { IconText, iconComponentPropTypes } from '../Icon';
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, linkProps, viewProps]);
|
|
14
14
|
|
|
15
|
-
const selectOuterBorderStyles =
|
|
16
|
-
|
|
17
|
-
outerBorderWidth,
|
|
18
|
-
outerBorderGap,
|
|
19
|
-
borderRadius,
|
|
20
|
-
outerBorderOutline
|
|
21
|
-
}) => // A view wrapper with a border on native messes up inline text alignment
|
|
22
|
-
// so for now make focus styles strictly web-only
|
|
23
|
-
Platform.OS === 'web' ? {
|
|
24
|
-
// Allow theme to define outline, or, turn off outline and use border if rounded corners required
|
|
25
|
-
outline: outerBorderOutline,
|
|
26
|
-
...applyOuterBorder({
|
|
15
|
+
const selectOuterBorderStyles = _ref => {
|
|
16
|
+
let {
|
|
27
17
|
outerBorderColor,
|
|
28
18
|
outerBorderWidth,
|
|
29
19
|
outerBorderGap,
|
|
30
|
-
borderRadius
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
//
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
borderRadius,
|
|
21
|
+
outerBorderOutline
|
|
22
|
+
} = _ref;
|
|
23
|
+
return (// A view wrapper with a border on native messes up inline text alignment
|
|
24
|
+
// so for now make focus styles strictly web-only
|
|
25
|
+
Platform.OS === 'web' ? {
|
|
26
|
+
// Allow theme to define outline, or, turn off outline and use border if rounded corners required
|
|
27
|
+
outline: outerBorderOutline,
|
|
28
|
+
...applyOuterBorder({
|
|
29
|
+
outerBorderColor,
|
|
30
|
+
outerBorderWidth,
|
|
31
|
+
outerBorderGap,
|
|
32
|
+
borderRadius
|
|
33
|
+
}),
|
|
34
|
+
// Stops focus ring stretching horizontally if parent has display: block
|
|
35
|
+
// width: fit-content isn't supported on Firefox; can't cascade props like CSS `width: fit-content; width: --moz-fit-content;`
|
|
36
|
+
display: 'inline-flex'
|
|
37
|
+
} : {}
|
|
38
|
+
);
|
|
39
|
+
};
|
|
36
40
|
|
|
37
|
-
const selectTextStyles =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
41
|
+
const selectTextStyles = _ref2 => {
|
|
42
|
+
let {
|
|
43
|
+
color
|
|
44
|
+
} = _ref2;
|
|
45
|
+
return {
|
|
46
|
+
color,
|
|
47
|
+
...Platform.select({
|
|
48
|
+
web: {
|
|
49
|
+
// TODO: https://github.com/telus/universal-design-system/issues/487
|
|
50
|
+
transition: 'color 200ms'
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
};
|
|
48
55
|
|
|
49
|
-
const selectBlockStyles =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
const selectBlockStyles = _ref3 => {
|
|
57
|
+
let {
|
|
58
|
+
blockFontWeight,
|
|
59
|
+
blockFontSize,
|
|
60
|
+
blockLineHeight,
|
|
61
|
+
blockFontName
|
|
62
|
+
} = _ref3;
|
|
63
|
+
return applyTextStyles({
|
|
64
|
+
fontWeight: blockFontWeight,
|
|
65
|
+
fontSize: blockFontSize,
|
|
66
|
+
lineHeight: blockLineHeight,
|
|
67
|
+
fontName: blockFontName
|
|
68
|
+
});
|
|
69
|
+
};
|
|
60
70
|
|
|
61
|
-
const selectDecorationStyles =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
71
|
+
const selectDecorationStyles = _ref4 => {
|
|
72
|
+
let {
|
|
73
|
+
color,
|
|
74
|
+
textLine,
|
|
75
|
+
textLineStyle
|
|
76
|
+
} = _ref4;
|
|
77
|
+
return {
|
|
78
|
+
color,
|
|
79
|
+
textDecorationLine: textLine,
|
|
80
|
+
textDecorationStyle: textLineStyle,
|
|
81
|
+
...Platform.select({
|
|
82
|
+
web: {
|
|
83
|
+
// TODO: https://github.com/telus/universal-design-system/issues/487
|
|
84
|
+
transition: 'color 200ms'
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
};
|
|
88
|
+
};
|
|
76
89
|
|
|
77
|
-
const selectIconTokens =
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
const selectIconTokens = _ref5 => {
|
|
91
|
+
let {
|
|
92
|
+
color,
|
|
93
|
+
iconSize,
|
|
94
|
+
iconTranslateX,
|
|
95
|
+
iconTranslateY
|
|
96
|
+
} = _ref5;
|
|
97
|
+
return {
|
|
98
|
+
color,
|
|
99
|
+
translateX: iconTranslateX,
|
|
100
|
+
translateY: iconTranslateY,
|
|
101
|
+
size: iconSize
|
|
102
|
+
};
|
|
103
|
+
};
|
|
88
104
|
/**
|
|
89
105
|
* Renders a pressable text link, with optional icon. This is rendered as a block element
|
|
90
106
|
* only (see 'Current Limitations'). On Web, renders an `<a>` anchor tag if `href` is provided.
|
|
@@ -109,17 +125,18 @@ const selectIconTokens = ({
|
|
|
109
125
|
*/
|
|
110
126
|
|
|
111
127
|
|
|
112
|
-
const LinkBase = /*#__PURE__*/forwardRef(({
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
128
|
+
const LinkBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
129
|
+
let {
|
|
130
|
+
href,
|
|
131
|
+
icon,
|
|
132
|
+
iconPosition = icon ? 'left' : undefined,
|
|
133
|
+
iconProps,
|
|
134
|
+
variant,
|
|
135
|
+
tokens = {},
|
|
136
|
+
children,
|
|
137
|
+
accessibilityRole = 'link',
|
|
138
|
+
...rawRest
|
|
139
|
+
} = _ref6;
|
|
123
140
|
const {
|
|
124
141
|
onPress,
|
|
125
142
|
...props
|
|
@@ -9,14 +9,15 @@ import LinkBase from './LinkBase';
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
const TextButton = /*#__PURE__*/forwardRef(({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
const TextButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
13
|
+
let {
|
|
14
|
+
onPress,
|
|
15
|
+
children,
|
|
16
|
+
variant,
|
|
17
|
+
tokens,
|
|
18
|
+
accessibilityRole = 'button',
|
|
19
|
+
...linkProps
|
|
20
|
+
} = _ref;
|
|
20
21
|
const getTokens = useThemeTokensCallback('Link', tokens, variant);
|
|
21
22
|
return /*#__PURE__*/_jsx(LinkBase, {
|
|
22
23
|
onPress: onPress,
|