@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
|
@@ -47,20 +47,21 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, foc
|
|
|
47
47
|
* or the internal state in case of uncontrolled radio button.
|
|
48
48
|
*/
|
|
49
49
|
|
|
50
|
-
const RadioCard = /*#__PURE__*/forwardRef(({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
const RadioCard = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
51
|
+
let {
|
|
52
|
+
tokens,
|
|
53
|
+
variant,
|
|
54
|
+
title,
|
|
55
|
+
children,
|
|
56
|
+
inactive,
|
|
57
|
+
defaultChecked,
|
|
58
|
+
checked,
|
|
59
|
+
name: inputName,
|
|
60
|
+
value,
|
|
61
|
+
id,
|
|
62
|
+
onChange,
|
|
63
|
+
...rest
|
|
64
|
+
} = _ref;
|
|
64
65
|
const {
|
|
65
66
|
currentValue: isChecked,
|
|
66
67
|
setValue: setIsChecked,
|
|
@@ -78,7 +79,7 @@ const RadioCard = /*#__PURE__*/forwardRef(({
|
|
|
78
79
|
};
|
|
79
80
|
|
|
80
81
|
const uniqueId = useUniqueId('RadioCard');
|
|
81
|
-
const inputId = id
|
|
82
|
+
const inputId = id !== null && id !== void 0 ? id : uniqueId;
|
|
82
83
|
const getTokens = useThemeTokensCallback('RadioCard', tokens, variant);
|
|
83
84
|
|
|
84
85
|
const getCardTokens = cardState => selectPressableCardTokens(getTokens(cardState));
|
|
@@ -60,25 +60,26 @@ const [selectItemProps, selectedItemPropTypes] = selectSystemProps([a11yProps, f
|
|
|
60
60
|
* ```
|
|
61
61
|
*/
|
|
62
62
|
|
|
63
|
-
const RadioCardGroup = /*#__PURE__*/forwardRef(({
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
63
|
+
const RadioCardGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
64
|
+
let {
|
|
65
|
+
copy = 'en',
|
|
66
|
+
tokens,
|
|
67
|
+
radioCardTokens,
|
|
68
|
+
variant,
|
|
69
|
+
items = [],
|
|
70
|
+
legend,
|
|
71
|
+
tooltip,
|
|
72
|
+
hint,
|
|
73
|
+
validation,
|
|
74
|
+
feedback,
|
|
75
|
+
initialCheckedId,
|
|
76
|
+
checkedId,
|
|
77
|
+
onChange,
|
|
78
|
+
readOnly,
|
|
79
|
+
name: inputGroupName,
|
|
80
|
+
inactive,
|
|
81
|
+
...rest
|
|
82
|
+
} = _ref;
|
|
82
83
|
const viewport = useViewport();
|
|
83
84
|
const {
|
|
84
85
|
space,
|
|
@@ -103,7 +104,7 @@ const RadioCardGroup = /*#__PURE__*/forwardRef(({
|
|
|
103
104
|
const uniqueFields = ['id'];
|
|
104
105
|
|
|
105
106
|
if (!containUniqueFields(items, uniqueFields)) {
|
|
106
|
-
throw new Error(
|
|
107
|
+
throw new Error("RadioCardGroup items must have unique ".concat(uniqueFields.join(', ')));
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
return /*#__PURE__*/_jsx(Fieldset, {
|
|
@@ -122,14 +123,15 @@ const RadioCardGroup = /*#__PURE__*/forwardRef(({
|
|
|
122
123
|
children: props => /*#__PURE__*/_jsx(StackContainer, {
|
|
123
124
|
space: space,
|
|
124
125
|
accessibilityRole: "radiogroup",
|
|
125
|
-
children: items.map(({
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
126
|
+
children: items.map((_ref2, index) => {
|
|
127
|
+
let {
|
|
128
|
+
title,
|
|
129
|
+
content,
|
|
130
|
+
id,
|
|
131
|
+
onChange: itemOnChange,
|
|
132
|
+
...itemRest
|
|
133
|
+
} = _ref2;
|
|
134
|
+
const cardId = id || "RadioCard[".concat(index, "]");
|
|
133
135
|
|
|
134
136
|
const handleChange = (newCheckedState, event) => {
|
|
135
137
|
if (typeof itemOnChange === 'function') itemOnChange(newCheckedState, event);
|
|
@@ -14,11 +14,12 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
14
14
|
const [selectContainerProps, selectedContainerPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
15
15
|
const [selectInputProps, selectedInputPropTypes] = selectSystemProps([textInputHandlerProps, textInputProps]);
|
|
16
16
|
|
|
17
|
-
const selectInputTokens =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
const selectInputTokens = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
searchTokens,
|
|
20
|
+
buttonTokens,
|
|
21
|
+
buttonsGapSize
|
|
22
|
+
} = _ref;
|
|
22
23
|
const {
|
|
23
24
|
paddingRight: inputPaddingRight,
|
|
24
25
|
clearButtonIcon,
|
|
@@ -38,19 +39,25 @@ const selectInputTokens = ({
|
|
|
38
39
|
|
|
39
40
|
const selectButtonTokens = tokens => selectTokens('Button', tokens);
|
|
40
41
|
|
|
41
|
-
const selectIconsContainerStyle =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
const selectIconsContainerStyle = _ref2 => {
|
|
43
|
+
let {
|
|
44
|
+
paddingRight
|
|
45
|
+
} = _ref2;
|
|
46
|
+
return {
|
|
47
|
+
paddingRight
|
|
48
|
+
};
|
|
49
|
+
};
|
|
46
50
|
|
|
47
|
-
const selectIconTokens =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
const selectIconTokens = _ref3 => {
|
|
52
|
+
let {
|
|
53
|
+
iconSize,
|
|
54
|
+
iconColor
|
|
55
|
+
} = _ref3;
|
|
56
|
+
return {
|
|
57
|
+
color: iconColor,
|
|
58
|
+
size: iconSize
|
|
59
|
+
};
|
|
60
|
+
};
|
|
54
61
|
/**
|
|
55
62
|
* The `Search` component is a combination of a `TextInput` and 2 different kinds of custom buttons.
|
|
56
63
|
* Use `Search` to feature autocomplete interactions.
|
|
@@ -66,20 +73,22 @@ const selectIconTokens = ({
|
|
|
66
73
|
*/
|
|
67
74
|
|
|
68
75
|
|
|
69
|
-
const Search = /*#__PURE__*/forwardRef(({
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
76
|
+
const Search = /*#__PURE__*/forwardRef((_ref4, ref) => {
|
|
77
|
+
let {
|
|
78
|
+
initialValue,
|
|
79
|
+
value,
|
|
80
|
+
placeholder,
|
|
81
|
+
inactive,
|
|
82
|
+
onChange,
|
|
83
|
+
onSubmit,
|
|
84
|
+
onClear,
|
|
85
|
+
onFocus,
|
|
86
|
+
accessibilityLabel,
|
|
87
|
+
copy = 'en',
|
|
88
|
+
tokens,
|
|
89
|
+
variant,
|
|
90
|
+
...rest
|
|
91
|
+
} = _ref4;
|
|
83
92
|
const {
|
|
84
93
|
currentValue = '',
|
|
85
94
|
setValue
|
|
@@ -117,11 +126,15 @@ const Search = /*#__PURE__*/forwardRef(({
|
|
|
117
126
|
if (onClear !== undefined) onClear('', event);
|
|
118
127
|
};
|
|
119
128
|
|
|
129
|
+
const handleFocus = event => {
|
|
130
|
+
if (onFocus !== undefined) onFocus(event);
|
|
131
|
+
};
|
|
132
|
+
|
|
120
133
|
const isEmpty = currentValue === ''; // Accessibility label should always be present and correctly localised
|
|
121
134
|
|
|
122
135
|
const a11yLabelText = accessibilityLabel || getCopy('accessibilityLabel'); // Placeholder is optional and may be unset by passing an empty string
|
|
123
136
|
|
|
124
|
-
const placeholderText = placeholder
|
|
137
|
+
const placeholderText = placeholder !== null && placeholder !== void 0 ? placeholder : a11yLabelText;
|
|
125
138
|
return /*#__PURE__*/_jsxs(View, {
|
|
126
139
|
style: staticStyles.container,
|
|
127
140
|
...selectContainerProps(rest),
|
|
@@ -141,6 +154,7 @@ const Search = /*#__PURE__*/forwardRef(({
|
|
|
141
154
|
value: currentValue,
|
|
142
155
|
onChange: setValue,
|
|
143
156
|
onSubmitEditing: handleSubmit,
|
|
157
|
+
onFocus: handleFocus,
|
|
144
158
|
accessibilityLabel: a11yLabelText
|
|
145
159
|
}), /*#__PURE__*/_jsx(View, {
|
|
146
160
|
style: [staticStyles.iconsContainer, selectIconsContainerStyle(themeTokens)],
|
|
@@ -211,6 +225,12 @@ Search.propTypes = { ...selectedContainerPropTypes,
|
|
|
211
225
|
onClear: PropTypes.func,
|
|
212
226
|
|
|
213
227
|
/**
|
|
228
|
+
* Triggered when the search input is focused.
|
|
229
|
+
*/
|
|
230
|
+
onFocus: PropTypes.func,
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
*
|
|
214
234
|
* Use to provide an accessible label for the input (visually hidden).
|
|
215
235
|
*/
|
|
216
236
|
accessibilityLabel: PropTypes.string,
|
|
@@ -3,10 +3,11 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { componentPropType } from '../utils';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
|
|
6
|
-
const Group =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const Group = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
children,
|
|
9
|
+
label
|
|
10
|
+
} = _ref;
|
|
10
11
|
return /*#__PURE__*/_jsx("optgroup", {
|
|
11
12
|
label: label,
|
|
12
13
|
children: children
|
|
@@ -2,13 +2,16 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
|
-
const Item =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
const Item = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
value
|
|
9
|
+
} = _ref;
|
|
10
|
+
return /*#__PURE__*/_jsx("option", {
|
|
11
|
+
value: value,
|
|
12
|
+
children: children
|
|
13
|
+
});
|
|
14
|
+
};
|
|
12
15
|
|
|
13
16
|
export default Item;
|
|
14
17
|
Item.propTypes = {
|
|
@@ -3,21 +3,22 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { componentPropType } from '../utils';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
-
const Picker = /*#__PURE__*/forwardRef(({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
const Picker = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
7
|
+
let {
|
|
8
|
+
value,
|
|
9
|
+
onChange,
|
|
10
|
+
onFocus,
|
|
11
|
+
onBlur,
|
|
12
|
+
onMouseOver,
|
|
13
|
+
onMouseOut,
|
|
14
|
+
style,
|
|
15
|
+
inactive,
|
|
16
|
+
children,
|
|
17
|
+
placeholder,
|
|
18
|
+
nativeID,
|
|
19
|
+
testID,
|
|
20
|
+
...rest
|
|
21
|
+
} = _ref;
|
|
21
22
|
const {
|
|
22
23
|
accessibilityLabel,
|
|
23
24
|
accessibilityDescribedBy,
|
|
@@ -9,39 +9,46 @@ import Group from './Group'; // styling of the native input is very limited, mos
|
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
11
|
|
|
12
|
-
const selectAndroidInputStyles =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
const selectAndroidInputStyles = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
height = 0,
|
|
15
|
+
paddingBottom = 0,
|
|
16
|
+
paddingTop = 0,
|
|
17
|
+
borderWidth = 0,
|
|
18
|
+
color
|
|
19
|
+
} = _ref;
|
|
20
|
+
return {
|
|
21
|
+
height: height - paddingTop - paddingBottom - 2 * borderWidth,
|
|
22
|
+
color
|
|
23
|
+
};
|
|
24
|
+
}; // the native input has a side padding of 8px, which can't be adjusted, so we have to account for that in the container
|
|
22
25
|
|
|
23
26
|
|
|
24
|
-
const selectAndroidContainerStyles =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
const selectAndroidContainerStyles = _ref2 => {
|
|
28
|
+
let {
|
|
29
|
+
paddingLeft = 0,
|
|
30
|
+
paddingRight = 0,
|
|
31
|
+
...rest
|
|
32
|
+
} = _ref2;
|
|
33
|
+
return {
|
|
34
|
+
paddingLeft: paddingLeft > 8 ? paddingLeft - 8 : 0,
|
|
35
|
+
paddingRight: paddingRight > 8 ? paddingRight - 8 : 0,
|
|
36
|
+
...rest
|
|
37
|
+
};
|
|
38
|
+
};
|
|
33
39
|
|
|
34
|
-
const Picker = /*#__PURE__*/forwardRef(({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
const Picker = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
41
|
+
let {
|
|
42
|
+
value,
|
|
43
|
+
onChange,
|
|
44
|
+
onFocus,
|
|
45
|
+
onBlur,
|
|
46
|
+
style,
|
|
47
|
+
inactive,
|
|
48
|
+
children,
|
|
49
|
+
placeholder,
|
|
50
|
+
...rest
|
|
51
|
+
} = _ref3;
|
|
45
52
|
// ungroup items, since there's no way to support groups on native
|
|
46
53
|
const flatChildren = Children.toArray(children).flatMap(child => {
|
|
47
54
|
if (child.type === Group) {
|
|
@@ -50,12 +57,15 @@ const Picker = /*#__PURE__*/forwardRef(({
|
|
|
50
57
|
|
|
51
58
|
return child;
|
|
52
59
|
});
|
|
53
|
-
const items = flatChildren.map(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
const items = flatChildren.map(_ref4 => {
|
|
61
|
+
let {
|
|
62
|
+
props
|
|
63
|
+
} = _ref4;
|
|
64
|
+
return {
|
|
65
|
+
label: props.children,
|
|
66
|
+
value: props.value
|
|
67
|
+
};
|
|
68
|
+
}); // Unlike other input components, react-native-picker-select doesn't pass an event to its change fn.
|
|
59
69
|
|
|
60
70
|
const handleChange = (newValue, index) => {
|
|
61
71
|
if (onChange) onChange(newValue, {
|