@telus-uds/components-base 1.6.1 → 1.8.0
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/.storybook/main.js +7 -0
- package/.turbo/turbo-build.log +3 -3
- package/.turbo/turbo-lint.log +3 -13
- package/CHANGELOG.json +112 -1
- package/CHANGELOG.md +41 -2
- package/__fixtures__/Accessible.js +1 -2
- package/__fixtures__/Accessible.native.js +1 -2
- package/__tests__/FlexGrid/Col.test.jsx +5 -0
- package/__tests__/InputLabel/InputLabel.test.jsx +28 -0
- package/__tests__/InputLabel/__snapshots__/InputLabel.test.jsx.snap +3 -0
- package/__tests__/InputSupports/InputSupports.test.jsx +10 -0
- package/component-docs.json +278 -40
- package/lib/Button/ButtonGroup.js +118 -45
- package/lib/Checkbox/CheckboxGroup.js +3 -3
- package/lib/ExpandCollapse/Panel.js +2 -1
- package/lib/Fieldset/Fieldset.js +7 -0
- package/lib/InputLabel/InputLabel.js +8 -1
- package/lib/InputSupports/InputSupports.js +7 -0
- package/lib/List/ListItem.js +22 -12
- package/lib/Notification/Notification.js +1 -1
- package/lib/Radio/RadioGroup.js +12 -5
- package/lib/RadioCard/RadioCardGroup.js +7 -0
- package/lib/Search/Search.js +28 -20
- package/lib/Skeleton/Skeleton.js +48 -2
- package/lib/TextInput/TextArea.js +1 -1
- package/lib/TextInput/TextInput.js +1 -1
- package/lib/TextInput/TextInputBase.js +1 -1
- package/lib/ToggleSwitch/ToggleSwitch.js +7 -0
- package/lib/ToggleSwitch/ToggleSwitchGroup.js +7 -0
- package/lib/Tooltip/Tooltip.js +1 -1
- package/lib/Typography/Typography.js +12 -10
- package/lib/index.js +22 -1
- package/lib/utils/animation/useVerticalExpandAnimation.js +26 -13
- package/lib/utils/input.js +5 -6
- package/lib/utils/props/index.js +18 -0
- package/lib/utils/props/inputSupportsProps.js +7 -0
- package/lib/utils/props/textInputProps.js +207 -0
- package/lib/utils/props/textProps.js +72 -0
- package/lib-module/Button/ButtonGroup.js +117 -45
- package/lib-module/Checkbox/CheckboxGroup.js +3 -3
- package/lib-module/ExpandCollapse/Panel.js +2 -1
- package/lib-module/Fieldset/Fieldset.js +7 -0
- package/lib-module/InputLabel/InputLabel.js +8 -1
- package/lib-module/InputSupports/InputSupports.js +7 -0
- package/lib-module/List/ListItem.js +22 -12
- package/lib-module/Notification/Notification.js +1 -1
- package/lib-module/Radio/RadioGroup.js +12 -5
- package/lib-module/RadioCard/RadioCardGroup.js +7 -0
- package/lib-module/Search/Search.js +30 -22
- package/lib-module/Skeleton/Skeleton.js +49 -3
- package/lib-module/TextInput/TextArea.js +2 -2
- package/lib-module/TextInput/TextInput.js +2 -2
- package/lib-module/TextInput/TextInputBase.js +2 -2
- package/lib-module/ToggleSwitch/ToggleSwitch.js +7 -0
- package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +7 -0
- package/lib-module/Tooltip/Tooltip.js +1 -1
- package/lib-module/Typography/Typography.js +13 -11
- package/lib-module/index.js +1 -1
- package/lib-module/utils/animation/useVerticalExpandAnimation.js +26 -14
- package/lib-module/utils/input.js +6 -6
- package/lib-module/utils/props/index.js +2 -0
- package/lib-module/utils/props/inputSupportsProps.js +7 -0
- package/lib-module/utils/props/textInputProps.js +194 -0
- package/lib-module/utils/props/textProps.js +59 -0
- package/package.json +9 -4
- package/src/Button/ButtonGroup.jsx +106 -41
- package/src/Checkbox/Checkbox.jsx +7 -4
- package/src/Checkbox/CheckboxGroup.jsx +3 -3
- package/src/ExpandCollapse/Panel.jsx +3 -1
- package/src/Fieldset/Fieldset.jsx +6 -0
- package/src/InputLabel/InputLabel.jsx +17 -2
- package/src/InputSupports/InputSupports.jsx +9 -1
- package/src/List/ListItem.jsx +17 -9
- package/src/Notification/Notification.jsx +1 -1
- package/src/Radio/Radio.jsx +5 -1
- package/src/Radio/RadioGroup.jsx +11 -5
- package/src/RadioCard/RadioCard.jsx +5 -1
- package/src/RadioCard/RadioCardGroup.jsx +6 -0
- package/src/Search/Search.jsx +34 -22
- package/src/Skeleton/Skeleton.jsx +56 -3
- package/src/TextInput/TextArea.jsx +2 -0
- package/src/TextInput/TextInput.jsx +2 -0
- package/src/TextInput/TextInputBase.jsx +2 -0
- package/src/ToggleSwitch/ToggleSwitch.jsx +6 -0
- package/src/ToggleSwitch/ToggleSwitchGroup.jsx +6 -0
- package/src/Tooltip/Tooltip.jsx +1 -1
- package/src/Typography/Typography.jsx +13 -9
- package/src/index.js +4 -1
- package/src/utils/animation/useVerticalExpandAnimation.js +25 -12
- package/src/utils/input.js +5 -7
- package/src/utils/props/index.js +2 -0
- package/src/utils/props/inputSupportsProps.js +6 -1
- package/src/utils/props/textInputProps.js +178 -0
- package/src/utils/props/textProps.js +58 -0
- package/src/utils/props/tokens.js +21 -19
- package/stories/Search/Search.stories.jsx +49 -2
- package/stories/Tabs/Tabs.stories.jsx +4 -3
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
11
|
+
|
|
12
|
+
var _getPropSelector = _interopRequireDefault(require("./getPropSelector"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
// These are the props accepted specifically on React Native (Web) `Text` elements.
|
|
17
|
+
// They are generally concerned with the behaviour of multiline text.
|
|
18
|
+
const crossPlatform = {
|
|
19
|
+
/**
|
|
20
|
+
* Truncates text after this many lines with an ellipsis at the end.
|
|
21
|
+
* On native, ellipsis behaviour may be changed with `ellipsizeMode` prop.
|
|
22
|
+
*/
|
|
23
|
+
numberOfLines: _propTypes.default.number,
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Default is true on web and false on native
|
|
27
|
+
*/
|
|
28
|
+
selectable: _propTypes.default.bool
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* See React Native docs for latest details on these.
|
|
32
|
+
* https://reactnative.dev/docs/text
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
const nativeOnly = {
|
|
36
|
+
ellipsizeMode: _propTypes.default.string,
|
|
37
|
+
maxFontSizeMultiplier: _propTypes.default.number,
|
|
38
|
+
minimumFontScale: _propTypes.default.number,
|
|
39
|
+
onTextLayout: _propTypes.default.func,
|
|
40
|
+
suppressHighlighting: _propTypes.default.bool,
|
|
41
|
+
textBreakStrategy: _propTypes.default.string
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* These set HTML attributes of the same name.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
const webOnly = {
|
|
48
|
+
dir: _propTypes.default.oneOf(['auto', 'ltr', 'rtl']),
|
|
49
|
+
lang: _propTypes.default.string
|
|
50
|
+
};
|
|
51
|
+
var _default = {
|
|
52
|
+
/**
|
|
53
|
+
* Set of prop types specific to React Native and React Native Web `Text`,
|
|
54
|
+
* which largely revolve around the behaviour of multiline non-pressable text.
|
|
55
|
+
*/
|
|
56
|
+
types: { ...crossPlatform,
|
|
57
|
+
...webOnly,
|
|
58
|
+
...nativeOnly
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Filters a props object, returning only props specific to `Text` elements
|
|
63
|
+
* on the current platform. Does not include props applicable to `Text` and `View`.
|
|
64
|
+
*/
|
|
65
|
+
select: (0, _getPropSelector.default)({ ...crossPlatform,
|
|
66
|
+
..._Platform.default.select({
|
|
67
|
+
web: webOnly,
|
|
68
|
+
default: nativeOnly
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
};
|
|
72
|
+
exports.default = _default;
|
|
@@ -4,6 +4,7 @@ import ABBPropTypes from 'airbnb-prop-types';
|
|
|
4
4
|
import Platform from "react-native-web/dist/exports/Platform";
|
|
5
5
|
import ButtonBase from './ButtonBase';
|
|
6
6
|
import { StackWrap } from '../StackView';
|
|
7
|
+
import Fieldset from '../Fieldset';
|
|
7
8
|
import { useViewport } from '../ViewportProvider';
|
|
8
9
|
import { useThemeTokens, useThemeTokensCallback } from '../ThemeProvider';
|
|
9
10
|
import { a11yProps, containUniqueFields, focusHandlerProps, pressProps, getTokensPropType, selectSystemProps, selectTokens, useMultipleInputValues, variantProp, viewProps } from '../utils';
|
|
@@ -21,6 +22,13 @@ const ButtonGroup = /*#__PURE__*/forwardRef(({
|
|
|
21
22
|
onChange,
|
|
22
23
|
readOnly = false,
|
|
23
24
|
inactive = false,
|
|
25
|
+
legend,
|
|
26
|
+
tooltip,
|
|
27
|
+
hint,
|
|
28
|
+
validation,
|
|
29
|
+
feedback,
|
|
30
|
+
name: inputGroupName,
|
|
31
|
+
copy,
|
|
24
32
|
accessibilityRole = maxValues === 1 ? 'radiogroup' // radiogroup is cross-platform; only web aria has generic groups
|
|
25
33
|
: Platform.select({
|
|
26
34
|
web: 'group',
|
|
@@ -35,7 +43,8 @@ const ButtonGroup = /*#__PURE__*/forwardRef(({
|
|
|
35
43
|
const stackTokens = selectTokens('StackView', themeTokens);
|
|
36
44
|
const {
|
|
37
45
|
direction,
|
|
38
|
-
space
|
|
46
|
+
space,
|
|
47
|
+
fieldSpace
|
|
39
48
|
} = themeTokens;
|
|
40
49
|
const getButtonTokens = useThemeTokensCallback('ButtonGroupItem', tokens, variant);
|
|
41
50
|
const {
|
|
@@ -57,54 +66,71 @@ const ButtonGroup = /*#__PURE__*/forwardRef(({
|
|
|
57
66
|
|
|
58
67
|
if (!containUniqueFields(items, uniqueFields)) {
|
|
59
68
|
throw new Error(`ButtonGroup items must have unique ${uniqueFields.join(', ')}`);
|
|
60
|
-
}
|
|
69
|
+
} // Some web screenreaders e.g. MacOS Voiceover don't handle radiogroups properly unless radio is direct child of radiogroup
|
|
61
70
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
tokens: stackTokens,
|
|
71
|
+
|
|
72
|
+
const innerRole = Platform.OS === 'web' && accessibilityRole === 'radiogroup' ? accessibilityRole : undefined;
|
|
73
|
+
return /*#__PURE__*/_jsx(Fieldset, { ...systemProps,
|
|
66
74
|
ref: ref,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
name: inputGroupName,
|
|
76
|
+
legend: legend,
|
|
77
|
+
tooltip: tooltip,
|
|
78
|
+
hint: hint,
|
|
79
|
+
space: fieldSpace,
|
|
80
|
+
feedback: feedback,
|
|
81
|
+
readOnly: readOnly,
|
|
82
|
+
inactive: inactive,
|
|
83
|
+
validation: validation,
|
|
84
|
+
accessibilityRole: accessibilityRole,
|
|
85
|
+
...selectProps(rest),
|
|
86
|
+
children: /*#__PURE__*/_jsx(StackWrap, {
|
|
87
|
+
accessibilityRole: innerRole,
|
|
88
|
+
space: space,
|
|
89
|
+
direction: direction,
|
|
90
|
+
tokens: stackTokens,
|
|
91
|
+
ref: ref,
|
|
92
|
+
children: items.map(({
|
|
78
93
|
label,
|
|
79
|
-
|
|
80
|
-
}]);
|
|
81
|
-
|
|
82
|
-
const handlePress = event => {
|
|
83
|
-
if (pressHandlers.onPress) pressHandlers.onPress(event);
|
|
84
|
-
toggleOneValue(id, event);
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const itemA11y = {
|
|
88
|
-
accessibilityState: {
|
|
89
|
-
checked: isSelected
|
|
90
|
-
},
|
|
91
|
-
accessibilityRole: itemA11yRole,
|
|
94
|
+
id = label,
|
|
92
95
|
accessibilityLabel,
|
|
93
|
-
...a11yProps.getPositionInSet(items.length, index)
|
|
94
|
-
}; // Ensure button is direct child of group as MacOS voiceover only applies "X of Y" to
|
|
95
|
-
// "radio" if it's a direct child of "radiogroup", even if aria-posinset etc exists
|
|
96
|
-
|
|
97
|
-
return /*#__PURE__*/_jsx(ButtonBase, {
|
|
98
96
|
ref: itemRef,
|
|
99
|
-
...
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
97
|
+
...itemRest
|
|
98
|
+
}, index) => {
|
|
99
|
+
const isSelected = currentValues.includes(id); // Pass an object of relevant component state as first argument for any passed-in press handlers
|
|
100
|
+
|
|
101
|
+
const pressHandlers = getPressHandlersWithArgs(rest, [{
|
|
102
|
+
id,
|
|
103
|
+
label,
|
|
104
|
+
currentValues
|
|
105
|
+
}]);
|
|
106
|
+
|
|
107
|
+
const handlePress = event => {
|
|
108
|
+
if (pressHandlers.onPress) pressHandlers.onPress(event);
|
|
109
|
+
toggleOneValue(id, event);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const itemA11y = {
|
|
113
|
+
accessibilityState: {
|
|
114
|
+
checked: isSelected
|
|
115
|
+
},
|
|
116
|
+
accessibilityRole: itemA11yRole,
|
|
117
|
+
accessibilityLabel,
|
|
118
|
+
...a11yProps.getPositionInSet(items.length, index)
|
|
119
|
+
}; // Ensure button is direct child of group as MacOS voiceover only applies "X of Y" to
|
|
120
|
+
// "radio" if it's a direct child of "radiogroup", even if aria-posinset etc exists
|
|
121
|
+
|
|
122
|
+
return /*#__PURE__*/_jsx(ButtonBase, {
|
|
123
|
+
ref: itemRef,
|
|
124
|
+
...pressHandlers,
|
|
125
|
+
onPress: handlePress,
|
|
126
|
+
tokens: getButtonTokens,
|
|
127
|
+
selected: isSelected,
|
|
128
|
+
inactive: inactive,
|
|
129
|
+
...itemA11y,
|
|
130
|
+
...selectItemProps(itemRest),
|
|
131
|
+
children: label
|
|
132
|
+
}, id);
|
|
133
|
+
})
|
|
108
134
|
})
|
|
109
135
|
});
|
|
110
136
|
});
|
|
@@ -168,6 +194,52 @@ ButtonGroup.propTypes = { ...selectedSystemPropTypes,
|
|
|
168
194
|
* managing its own selected state, a default set of selections may be provided.
|
|
169
195
|
* Changing the `initialValues` does not change the user's selections.
|
|
170
196
|
*/
|
|
171
|
-
initialValues: PropTypes.arrayOf(PropTypes.string)
|
|
197
|
+
initialValues: PropTypes.arrayOf(PropTypes.string),
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Main text used to describe this group, used in Fieldset's Legend element.
|
|
201
|
+
*/
|
|
202
|
+
legend: PropTypes.string,
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Optional additional text giving more detail to help a user make a choice.
|
|
206
|
+
*/
|
|
207
|
+
hint: PropTypes.string,
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Optional tooltip text content to include alongside the legend and hint.
|
|
211
|
+
*/
|
|
212
|
+
tooltip: PropTypes.string,
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Current validation status of the group, passed to the feedback element if there is one.
|
|
216
|
+
*/
|
|
217
|
+
validation: PropTypes.oneOf(['error', 'success']),
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* If provided, a Feedback element is rendered containing this text.
|
|
221
|
+
*/
|
|
222
|
+
feedback: PropTypes.string,
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* If true, the buttons cannot be selected by the user and simply show their current state.
|
|
226
|
+
*/
|
|
227
|
+
readOnly: PropTypes.bool,
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* If true, the buttons cannot be interacted with, elements are set as `disabled` and if the
|
|
231
|
+
* theme supports `inactive` appearances rules, these are applied.
|
|
232
|
+
*/
|
|
233
|
+
inactive: PropTypes.bool,
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* On Web, this is passed to the `name` attribute of the fieldset.
|
|
237
|
+
*/
|
|
238
|
+
name: PropTypes.string,
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Sets the language of microcopy in subcomponents (e.g. Tooltip's default accessibility label).
|
|
242
|
+
*/
|
|
243
|
+
copy: PropTypes.oneOf(['en', 'fr'])
|
|
172
244
|
};
|
|
173
245
|
export default ButtonGroup;
|
|
@@ -213,18 +213,18 @@ CheckboxGroup.propTypes = { ...selectedSystemPropTypes,
|
|
|
213
213
|
onChange: PropTypes.func,
|
|
214
214
|
|
|
215
215
|
/**
|
|
216
|
-
* If true, the
|
|
216
|
+
* If true, the checkboxes cannot be selected by the user and simply show their current state.
|
|
217
217
|
*/
|
|
218
218
|
readOnly: PropTypes.bool,
|
|
219
219
|
|
|
220
220
|
/**
|
|
221
|
-
* If true, the
|
|
221
|
+
* If true, the checkboxes cannot be interacted with, elements are set as `disabled` and if the
|
|
222
222
|
* theme supports `inactive` appearances rules, these are applied.
|
|
223
223
|
*/
|
|
224
224
|
inactive: PropTypes.bool,
|
|
225
225
|
|
|
226
226
|
/**
|
|
227
|
-
* On Web, this is passed to the `name` attribute of the fieldset and each
|
|
227
|
+
* On Web, this is passed to the `name` attribute of the fieldset and each checkbox input.
|
|
228
228
|
*/
|
|
229
229
|
name: PropTypes.string
|
|
230
230
|
};
|
|
@@ -75,7 +75,7 @@ const ExpandCollapsePanel = /*#__PURE__*/forwardRef(({
|
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
const animatedStyles = useVerticalExpandAnimation({
|
|
78
|
+
const [animatedStyles, animatedRef] = useVerticalExpandAnimation({
|
|
79
79
|
containerHeight,
|
|
80
80
|
isExpanded,
|
|
81
81
|
tokens: themeTokens
|
|
@@ -96,6 +96,7 @@ const ExpandCollapsePanel = /*#__PURE__*/forwardRef(({
|
|
|
96
96
|
onPress: handleControlPress,
|
|
97
97
|
children: control
|
|
98
98
|
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
99
|
+
ref: animatedRef,
|
|
99
100
|
style: [overflowContainerStyles, animatedStyles, staticStyles.itemsContainer],
|
|
100
101
|
...focusabilityProps,
|
|
101
102
|
children: /*#__PURE__*/_jsx(View, {
|
|
@@ -17,6 +17,7 @@ import Legend from './Legend';
|
|
|
17
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
18
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
19
|
const Fieldset = /*#__PURE__*/forwardRef(({
|
|
20
|
+
copy = 'en',
|
|
20
21
|
space,
|
|
21
22
|
feedback,
|
|
22
23
|
feedbackPosition = 'top',
|
|
@@ -44,6 +45,7 @@ const Fieldset = /*#__PURE__*/forwardRef(({
|
|
|
44
45
|
|
|
45
46
|
const legendContent = legend && /*#__PURE__*/_jsx(Legend, {
|
|
46
47
|
children: /*#__PURE__*/_jsx(InputLabel, {
|
|
48
|
+
copy: copy,
|
|
47
49
|
label: legend,
|
|
48
50
|
hint: hint,
|
|
49
51
|
hintPosition: hintPosition,
|
|
@@ -83,6 +85,11 @@ Fieldset.displayName = 'Fieldset';
|
|
|
83
85
|
Fieldset.propTypes = {
|
|
84
86
|
children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
85
87
|
|
|
88
|
+
/**
|
|
89
|
+
* Whether the English or French copy will be used (e.g. for accessibility labels).
|
|
90
|
+
*/
|
|
91
|
+
copy: PropTypes.oneOf(['en', 'fr']),
|
|
92
|
+
|
|
86
93
|
/**
|
|
87
94
|
* The accessibility role of the `<fieldset>` element itself. Other React Native accessibility
|
|
88
95
|
* props are not supported because there is not an appropriate counterpart for Fieldsets.
|
|
@@ -35,6 +35,7 @@ const selectGapStyles = ({
|
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
const InputLabel = /*#__PURE__*/forwardRef(({
|
|
38
|
+
copy = 'en',
|
|
38
39
|
label,
|
|
39
40
|
forId,
|
|
40
41
|
hint,
|
|
@@ -68,7 +69,8 @@ const InputLabel = /*#__PURE__*/forwardRef(({
|
|
|
68
69
|
height: themeTokens.fontSize * themeTokens.lineHeight
|
|
69
70
|
}],
|
|
70
71
|
children: /*#__PURE__*/_jsx(Tooltip, {
|
|
71
|
-
content: tooltip
|
|
72
|
+
content: tooltip,
|
|
73
|
+
copy: copy
|
|
72
74
|
})
|
|
73
75
|
})]
|
|
74
76
|
}), hint && !isHintInline && /*#__PURE__*/_jsx(Text, {
|
|
@@ -81,6 +83,11 @@ const InputLabel = /*#__PURE__*/forwardRef(({
|
|
|
81
83
|
InputLabel.displayName = 'InputLabel';
|
|
82
84
|
InputLabel.propTypes = { ...selectedSystemPropTypes,
|
|
83
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Whether the English or French copy will be used (e.g. for accessibility labels).
|
|
88
|
+
*/
|
|
89
|
+
copy: PropTypes.oneOf(['en', 'fr']),
|
|
90
|
+
|
|
84
91
|
/**
|
|
85
92
|
* The input label.
|
|
86
93
|
*/
|
|
@@ -9,6 +9,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
const InputSupports = /*#__PURE__*/forwardRef(({
|
|
11
11
|
children,
|
|
12
|
+
copy = 'en',
|
|
12
13
|
label,
|
|
13
14
|
hint,
|
|
14
15
|
hintPosition = 'inline',
|
|
@@ -34,6 +35,7 @@ const InputSupports = /*#__PURE__*/forwardRef(({
|
|
|
34
35
|
space: space,
|
|
35
36
|
ref: ref,
|
|
36
37
|
children: [label && /*#__PURE__*/_jsx(InputLabel, {
|
|
38
|
+
copy: copy,
|
|
37
39
|
label: label,
|
|
38
40
|
hint: hint,
|
|
39
41
|
hintPosition: hintPosition,
|
|
@@ -54,6 +56,11 @@ InputSupports.displayName = 'InputSupports';
|
|
|
54
56
|
InputSupports.propTypes = {
|
|
55
57
|
children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
56
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Whether the English or French copy will be used (e.g. for accessibility labels).
|
|
61
|
+
*/
|
|
62
|
+
copy: PropTypes.oneOf(['en', 'fr']),
|
|
63
|
+
|
|
57
64
|
/**
|
|
58
65
|
* The input label.
|
|
59
66
|
*/
|
|
@@ -26,8 +26,7 @@ const selectBulletContainerStyles = ({
|
|
|
26
26
|
itemBulletContainerAlign
|
|
27
27
|
}) => ({
|
|
28
28
|
width: itemBulletContainerWidth,
|
|
29
|
-
alignItems: itemBulletContainerAlign
|
|
30
|
-
justifyContent: itemBulletContainerAlign
|
|
29
|
+
alignItems: itemBulletContainerAlign
|
|
31
30
|
});
|
|
32
31
|
|
|
33
32
|
const selectItemIconTokens = ({
|
|
@@ -38,16 +37,20 @@ const selectItemIconTokens = ({
|
|
|
38
37
|
color: itemIconColor
|
|
39
38
|
});
|
|
40
39
|
|
|
41
|
-
const
|
|
40
|
+
const selectSideItemContainerStyles = ({
|
|
41
|
+
listGutter,
|
|
42
42
|
iconMarginTop
|
|
43
43
|
}) => ({
|
|
44
|
-
marginTop: iconMarginTop
|
|
45
|
-
|
|
44
|
+
marginTop: iconMarginTop,
|
|
45
|
+
marginRight: listGutter
|
|
46
|
+
}); // Align bullets with the top line of text the same way icons are aligned
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
|
|
49
|
+
const selectBulletPositioningStyles = ({
|
|
50
|
+
itemIconSize
|
|
49
51
|
}) => ({
|
|
50
|
-
|
|
52
|
+
width: itemIconSize,
|
|
53
|
+
height: itemIconSize
|
|
51
54
|
});
|
|
52
55
|
|
|
53
56
|
const selectItemStyles = ({
|
|
@@ -100,8 +103,8 @@ const ListItem = /*#__PURE__*/forwardRef(({
|
|
|
100
103
|
const dividerStyles = selectDividerStyles(themeTokens);
|
|
101
104
|
const itemBulletContainerStyles = selectBulletContainerStyles(themeTokens);
|
|
102
105
|
const itemBulletStyles = selectBulletStyles(themeTokens);
|
|
106
|
+
const itemBulletPositioningStyles = selectBulletPositioningStyles(themeTokens);
|
|
103
107
|
const iconTokens = selectItemIconTokens(themeTokens);
|
|
104
|
-
const commonIconStyles = selectCommonIconStyles(themeTokens);
|
|
105
108
|
const sideItemContainerStyles = selectSideItemContainerStyles(themeTokens);
|
|
106
109
|
const accessibilityRole = Platform.select({
|
|
107
110
|
web: 'listitem',
|
|
@@ -144,7 +147,7 @@ const ListItem = /*#__PURE__*/forwardRef(({
|
|
|
144
147
|
|
|
145
148
|
if (icon) {
|
|
146
149
|
return /*#__PURE__*/_jsx(View, {
|
|
147
|
-
style:
|
|
150
|
+
style: sideItemContainerStyles,
|
|
148
151
|
children: /*#__PURE__*/_jsx(IconComponent, {
|
|
149
152
|
size: iconSize || iconTokens.size,
|
|
150
153
|
color: iconColor || iconTokens.color
|
|
@@ -155,8 +158,11 @@ const ListItem = /*#__PURE__*/forwardRef(({
|
|
|
155
158
|
return /*#__PURE__*/_jsx(View, {
|
|
156
159
|
style: [sideItemContainerStyles, itemBulletContainerStyles],
|
|
157
160
|
children: /*#__PURE__*/_jsx(View, {
|
|
158
|
-
style:
|
|
159
|
-
|
|
161
|
+
style: [staticStyles.bulletPositioning, itemBulletPositioningStyles],
|
|
162
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
163
|
+
style: itemBulletStyles,
|
|
164
|
+
testID: "unordered-item-bullet"
|
|
165
|
+
})
|
|
160
166
|
})
|
|
161
167
|
});
|
|
162
168
|
};
|
|
@@ -176,6 +182,10 @@ const staticStyles = StyleSheet.create({
|
|
|
176
182
|
},
|
|
177
183
|
wrap: {
|
|
178
184
|
flex: 1
|
|
185
|
+
},
|
|
186
|
+
bulletPositioning: {
|
|
187
|
+
alignItems: 'center',
|
|
188
|
+
justifyContent: 'center'
|
|
179
189
|
}
|
|
180
190
|
});
|
|
181
191
|
ListItem.propTypes = { ...selectedSystemPropTypes,
|
|
@@ -177,7 +177,7 @@ Notification.propTypes = { ...selectedSystemPropTypes,
|
|
|
177
177
|
dismissible: PropTypes.bool,
|
|
178
178
|
|
|
179
179
|
/**
|
|
180
|
-
* Select
|
|
180
|
+
* Select English or French copy for the accessible label of the dismiss button.
|
|
181
181
|
*/
|
|
182
182
|
copy: PropTypes.oneOfType([PropTypes.oneOf(['en', 'fr']), PropTypes.shape({
|
|
183
183
|
dismiss: PropTypes.string
|
|
@@ -29,7 +29,7 @@ const [selectItemProps, selectedItemPropTypes] = selectSystemProps([a11yProps, f
|
|
|
29
29
|
* ### Uncontrolled version
|
|
30
30
|
*
|
|
31
31
|
* If the RadioGroup manages its own state, you can use `initialCheckedId` prop to provide the initial value.
|
|
32
|
-
* Whenever the radio
|
|
32
|
+
* Whenever the radio gets toggled, it calls the `onChange` callback with the new value (string).
|
|
33
33
|
*
|
|
34
34
|
* ### Use in forms
|
|
35
35
|
*
|
|
@@ -60,6 +60,7 @@ const [selectItemProps, selectedItemPropTypes] = selectSystemProps([a11yProps, f
|
|
|
60
60
|
*/
|
|
61
61
|
|
|
62
62
|
const RadioGroup = /*#__PURE__*/forwardRef(({
|
|
63
|
+
copy = 'en',
|
|
63
64
|
tokens,
|
|
64
65
|
radioTokens,
|
|
65
66
|
variant,
|
|
@@ -128,6 +129,7 @@ const RadioGroup = /*#__PURE__*/forwardRef(({
|
|
|
128
129
|
}, radioId);
|
|
129
130
|
});
|
|
130
131
|
return /*#__PURE__*/_jsx(Fieldset, {
|
|
132
|
+
copy: copy,
|
|
131
133
|
ref: ref,
|
|
132
134
|
name: inputGroupName,
|
|
133
135
|
legend: legend,
|
|
@@ -148,6 +150,11 @@ const RadioGroup = /*#__PURE__*/forwardRef(({
|
|
|
148
150
|
RadioGroup.displayName = 'RadioGroup';
|
|
149
151
|
RadioGroup.propTypes = { ...selectedSystemPropTypes,
|
|
150
152
|
|
|
153
|
+
/**
|
|
154
|
+
* Whether the English or French copy will be used (e.g. for accessibility labels).
|
|
155
|
+
*/
|
|
156
|
+
copy: PropTypes.oneOf(['en', 'fr']),
|
|
157
|
+
|
|
151
158
|
/**
|
|
152
159
|
* Optional theme token overrides for the outer RadioGroup component
|
|
153
160
|
*/
|
|
@@ -199,12 +206,12 @@ RadioGroup.propTypes = { ...selectedSystemPropTypes,
|
|
|
199
206
|
feedback: PropTypes.string,
|
|
200
207
|
|
|
201
208
|
/**
|
|
202
|
-
* If provided, the radio
|
|
209
|
+
* If provided, the radio with this id is selected on first render.
|
|
203
210
|
*/
|
|
204
211
|
initialCheckedId: PropTypes.string,
|
|
205
212
|
|
|
206
213
|
/**
|
|
207
|
-
* If not undefined, the radio
|
|
214
|
+
* If not undefined, the radio with this id is selected (or none is selected if `null`), and the
|
|
208
215
|
* element's selection state will be controlled by its parent using the `onChange` function.
|
|
209
216
|
*/
|
|
210
217
|
checkedId: PropTypes.string,
|
|
@@ -216,12 +223,12 @@ RadioGroup.propTypes = { ...selectedSystemPropTypes,
|
|
|
216
223
|
onChange: PropTypes.func,
|
|
217
224
|
|
|
218
225
|
/**
|
|
219
|
-
* If true, the
|
|
226
|
+
* If true, the radios cannot be selected by the user and simply show their current state.
|
|
220
227
|
*/
|
|
221
228
|
readOnly: PropTypes.bool,
|
|
222
229
|
|
|
223
230
|
/**
|
|
224
|
-
* If true, the
|
|
231
|
+
* If true, the radios cannot be interacted with, elements are set as `disabled` and if the
|
|
225
232
|
* theme supports `inactive` appearances rules, these are applied.
|
|
226
233
|
*/
|
|
227
234
|
inactive: PropTypes.bool,
|
|
@@ -61,6 +61,7 @@ const [selectItemProps, selectedItemPropTypes] = selectSystemProps([a11yProps, f
|
|
|
61
61
|
*/
|
|
62
62
|
|
|
63
63
|
const RadioCardGroup = /*#__PURE__*/forwardRef(({
|
|
64
|
+
copy = 'en',
|
|
64
65
|
tokens,
|
|
65
66
|
radioCardTokens,
|
|
66
67
|
variant,
|
|
@@ -106,6 +107,7 @@ const RadioCardGroup = /*#__PURE__*/forwardRef(({
|
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
return /*#__PURE__*/_jsx(Fieldset, {
|
|
110
|
+
copy: copy,
|
|
109
111
|
ref: ref,
|
|
110
112
|
name: inputGroupName,
|
|
111
113
|
legend: legend,
|
|
@@ -155,6 +157,11 @@ const RadioCardGroup = /*#__PURE__*/forwardRef(({
|
|
|
155
157
|
RadioCardGroup.displayName = 'RadioCardGroup';
|
|
156
158
|
RadioCardGroup.propTypes = { ...selectedSystemPropTypes,
|
|
157
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Whether the English or French copy will be used (e.g. for accessibility labels).
|
|
162
|
+
*/
|
|
163
|
+
copy: PropTypes.oneOf(['en', 'fr']),
|
|
164
|
+
|
|
158
165
|
/**
|
|
159
166
|
* Optional theme token overrides for the outer RadioCardGroup component
|
|
160
167
|
*/
|