@telus-uds/components-base 1.12.0 → 1.14.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/CHANGELOG.md +41 -2
- package/component-docs.json +933 -55
- package/lib/BaseProvider/index.js +7 -2
- package/lib/Button/ButtonBase.js +52 -19
- package/lib/Button/ButtonGroup.js +7 -0
- package/lib/Button/propTypes.js +18 -0
- package/lib/Carousel/Carousel.js +83 -58
- package/lib/Carousel/CarouselContext.js +22 -8
- package/lib/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +73 -0
- package/lib/Carousel/CarouselStepTracker/CarouselStepTracker.js +56 -0
- package/lib/Carousel/CarouselStepTracker/index.js +13 -0
- package/lib/Carousel/CarouselTabs/CarouselTabs.js +70 -0
- package/lib/Carousel/CarouselTabs/CarouselTabsPanel.js +95 -0
- package/lib/Carousel/CarouselTabs/CarouselTabsPanelItem.js +148 -0
- package/lib/Carousel/CarouselTabs/index.js +13 -0
- package/lib/Carousel/CarouselThumbnail.js +99 -0
- package/lib/Carousel/CarouselThumbnailNavigation.js +87 -0
- package/lib/Carousel/dictionary.js +4 -2
- package/lib/Carousel/index.js +10 -1
- package/lib/Checkbox/Checkbox.js +7 -3
- package/lib/Checkbox/CheckboxGroup.js +8 -1
- package/lib/Feedback/Feedback.js +18 -10
- package/lib/Icon/IconText.js +6 -1
- package/lib/InputLabel/InputLabel.js +11 -5
- package/lib/Link/InlinePressable.js +1 -8
- package/lib/Link/LinkBase.js +13 -10
- package/lib/List/ListItem.js +8 -4
- package/lib/Notification/Notification.js +44 -24
- package/lib/Pagination/Pagination.js +7 -3
- package/lib/Radio/RadioGroup.js +8 -0
- package/lib/RadioCard/RadioCard.js +6 -1
- package/lib/RadioCard/RadioCardGroup.js +7 -0
- package/lib/Select/Select.js +7 -3
- package/lib/SkipLink/SkipLink.js +216 -0
- package/lib/SkipLink/index.js +13 -0
- package/lib/StepTracker/Step.js +8 -4
- package/lib/StepTracker/StepTracker.js +7 -3
- package/lib/Tabs/TabsItem.js +4 -0
- package/lib/TextInput/TextInputBase.js +7 -3
- package/lib/ThemeProvider/ThemeProvider.js +25 -3
- package/lib/ThemeProvider/utils/styles.js +8 -1
- package/lib/ThemeProvider/utils/theme-tokens.js +1 -1
- package/lib/ToggleSwitch/ToggleSwitchGroup.js +7 -0
- package/lib/Typography/Typography.js +6 -2
- package/lib/index.js +9 -0
- package/lib-module/BaseProvider/index.js +7 -2
- package/lib-module/Button/ButtonBase.js +41 -9
- package/lib-module/Button/ButtonGroup.js +7 -0
- package/lib-module/Button/propTypes.js +17 -0
- package/lib-module/Carousel/Carousel.js +80 -57
- package/lib-module/Carousel/CarouselContext.js +21 -8
- package/lib-module/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +51 -0
- package/lib-module/Carousel/CarouselStepTracker/CarouselStepTracker.js +42 -0
- package/lib-module/Carousel/CarouselStepTracker/index.js +2 -0
- package/lib-module/Carousel/CarouselTabs/CarouselTabs.js +50 -0
- package/lib-module/Carousel/CarouselTabs/CarouselTabsPanel.js +76 -0
- package/lib-module/Carousel/CarouselTabs/CarouselTabsPanelItem.js +126 -0
- package/lib-module/Carousel/CarouselTabs/index.js +2 -0
- package/lib-module/Carousel/CarouselThumbnail.js +85 -0
- package/lib-module/Carousel/CarouselThumbnailNavigation.js +66 -0
- package/lib-module/Carousel/dictionary.js +4 -2
- package/lib-module/Carousel/index.js +2 -1
- package/lib-module/Checkbox/Checkbox.js +8 -4
- package/lib-module/Checkbox/CheckboxGroup.js +8 -1
- package/lib-module/Feedback/Feedback.js +19 -11
- package/lib-module/Icon/IconText.js +6 -1
- package/lib-module/InputLabel/InputLabel.js +12 -6
- package/lib-module/Link/InlinePressable.js +1 -8
- package/lib-module/Link/LinkBase.js +14 -11
- package/lib-module/List/ListItem.js +9 -5
- package/lib-module/Notification/Notification.js +46 -26
- package/lib-module/Pagination/Pagination.js +8 -4
- package/lib-module/Radio/RadioGroup.js +8 -0
- package/lib-module/RadioCard/RadioCard.js +7 -2
- package/lib-module/RadioCard/RadioCardGroup.js +7 -0
- package/lib-module/Select/Select.js +8 -4
- package/lib-module/SkipLink/SkipLink.js +188 -0
- package/lib-module/SkipLink/index.js +2 -0
- package/lib-module/StepTracker/Step.js +9 -5
- package/lib-module/StepTracker/StepTracker.js +8 -4
- package/lib-module/Tabs/TabsItem.js +5 -1
- package/lib-module/TextInput/TextInputBase.js +8 -4
- package/lib-module/ThemeProvider/ThemeProvider.js +24 -3
- package/lib-module/ThemeProvider/utils/styles.js +8 -1
- package/lib-module/ThemeProvider/utils/theme-tokens.js +1 -1
- package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +7 -0
- package/lib-module/Typography/Typography.js +7 -3
- package/lib-module/index.js +1 -0
- package/package.json +46 -47
- package/src/BaseProvider/index.jsx +6 -3
- package/src/Button/ButtonBase.jsx +36 -12
- package/src/Button/ButtonGroup.jsx +6 -0
- package/src/Button/propTypes.js +14 -0
- package/src/Carousel/Carousel.jsx +91 -64
- package/src/Carousel/CarouselContext.jsx +29 -5
- package/src/Carousel/CarouselFirstFocus/CarouselFirstFocus.jsx +49 -0
- package/src/Carousel/CarouselStepTracker/CarouselStepTracker.jsx +36 -0
- package/src/Carousel/CarouselStepTracker/index.js +3 -0
- package/src/Carousel/CarouselTabs/CarouselTabs.jsx +37 -0
- package/src/Carousel/CarouselTabs/CarouselTabsPanel.jsx +69 -0
- package/src/Carousel/CarouselTabs/CarouselTabsPanelItem.jsx +119 -0
- package/src/Carousel/CarouselTabs/index.js +3 -0
- package/src/Carousel/CarouselThumbnail.jsx +77 -0
- package/src/Carousel/CarouselThumbnailNavigation.jsx +53 -0
- package/src/Carousel/dictionary.js +4 -2
- package/src/Carousel/index.js +1 -0
- package/src/Checkbox/Checkbox.jsx +14 -11
- package/src/Checkbox/CheckboxGroup.jsx +8 -1
- package/src/Feedback/Feedback.jsx +14 -7
- package/src/Icon/IconText.jsx +3 -1
- package/src/InputLabel/InputLabel.jsx +13 -12
- package/src/Link/InlinePressable.jsx +2 -8
- package/src/Link/LinkBase.jsx +18 -21
- package/src/List/ListItem.jsx +10 -5
- package/src/Notification/Notification.jsx +40 -23
- package/src/Pagination/Pagination.jsx +6 -4
- package/src/Radio/RadioGroup.jsx +7 -0
- package/src/RadioCard/RadioCard.jsx +3 -2
- package/src/RadioCard/RadioCardGroup.jsx +6 -0
- package/src/Select/Select.jsx +12 -3
- package/src/SkipLink/SkipLink.jsx +179 -0
- package/src/SkipLink/index.js +3 -0
- package/src/StepTracker/Step.jsx +12 -4
- package/src/StepTracker/StepTracker.jsx +11 -10
- package/src/Tabs/TabsItem.jsx +3 -2
- package/src/TextInput/TextInputBase.jsx +11 -3
- package/src/ThemeProvider/ThemeProvider.jsx +22 -3
- package/src/ThemeProvider/utils/styles.js +9 -1
- package/src/ThemeProvider/utils/theme-tokens.js +1 -1
- package/src/ToggleSwitch/ToggleSwitchGroup.jsx +6 -0
- package/src/Typography/Typography.jsx +11 -12
- package/src/index.js +1 -0
|
@@ -69,7 +69,7 @@ const [selectItemProps, selectedItemPropTypes] = (0, _utils.selectSystemProps)([
|
|
|
69
69
|
* @example
|
|
70
70
|
* ```jsx
|
|
71
71
|
* <CheckboxGroup
|
|
72
|
-
*
|
|
72
|
+
* initialCheckedIds="check1"
|
|
73
73
|
* items={[
|
|
74
74
|
* { label: 'Checkbox 1', id: 'check1' },
|
|
75
75
|
* { label: 'Checkbox 2', id: 'check2' },
|
|
@@ -90,6 +90,7 @@ const CheckboxGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
90
90
|
legend,
|
|
91
91
|
tooltip,
|
|
92
92
|
hint,
|
|
93
|
+
hintPosition = 'inline',
|
|
93
94
|
validation,
|
|
94
95
|
feedback,
|
|
95
96
|
initialCheckedIds,
|
|
@@ -156,6 +157,7 @@ const CheckboxGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
156
157
|
legend: legend,
|
|
157
158
|
tooltip: tooltip,
|
|
158
159
|
hint: hint,
|
|
160
|
+
hintPosition: hintPosition,
|
|
159
161
|
space: fieldSpace,
|
|
160
162
|
feedback: feedback,
|
|
161
163
|
inactive: inactive,
|
|
@@ -205,6 +207,11 @@ CheckboxGroup.propTypes = { ...selectedSystemPropTypes,
|
|
|
205
207
|
*/
|
|
206
208
|
hint: _propTypes.default.string,
|
|
207
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Position of the hint relative to label. Use `below` to display a larger hint below the label.
|
|
212
|
+
*/
|
|
213
|
+
hintPosition: _propTypes.default.oneOf(['inline', 'below']),
|
|
214
|
+
|
|
208
215
|
/**
|
|
209
216
|
* Optional tooltip text content to include alongside the legend and hint.
|
|
210
217
|
*/
|
package/lib/Feedback/Feedback.js
CHANGED
|
@@ -33,24 +33,29 @@ const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_u
|
|
|
33
33
|
|
|
34
34
|
const selectStyles = tokens => (0, _utils.selectTokens)('Feedback', tokens);
|
|
35
35
|
|
|
36
|
-
const selectTitleTextStyles = _ref => {
|
|
36
|
+
const selectTitleTextStyles = (_ref, themeOptions) => {
|
|
37
37
|
let {
|
|
38
38
|
titleFontSize,
|
|
39
39
|
...tokens
|
|
40
40
|
} = _ref;
|
|
41
|
-
return (0, _ThemeProvider.applyTextStyles)((0, _utils.selectTokens)('Typography', { ...tokens,
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
return (0, _ThemeProvider.applyTextStyles)({ ...(0, _utils.selectTokens)('Typography', { ...tokens,
|
|
42
|
+
fontSize: titleFontSize,
|
|
43
|
+
themeOptions
|
|
44
|
+
}),
|
|
45
|
+
themeOptions
|
|
46
|
+
});
|
|
44
47
|
};
|
|
45
48
|
|
|
46
|
-
const selectContentTextStyles = _ref2 => {
|
|
49
|
+
const selectContentTextStyles = (_ref2, themeOptions) => {
|
|
47
50
|
let {
|
|
48
51
|
contentFontSize,
|
|
49
52
|
...tokens
|
|
50
53
|
} = _ref2;
|
|
51
|
-
return (0, _ThemeProvider.applyTextStyles)((0, _utils.selectTokens)('Typography', { ...tokens,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
return (0, _ThemeProvider.applyTextStyles)({ ...(0, _utils.selectTokens)('Typography', { ...tokens,
|
|
55
|
+
fontSize: contentFontSize
|
|
56
|
+
}),
|
|
57
|
+
themeOptions
|
|
58
|
+
});
|
|
54
59
|
};
|
|
55
60
|
|
|
56
61
|
const selectIconTokens = _ref3 => {
|
|
@@ -111,8 +116,11 @@ const Feedback = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
111
116
|
const {
|
|
112
117
|
icon: IconComponent
|
|
113
118
|
} = themeTokens;
|
|
114
|
-
const
|
|
115
|
-
|
|
119
|
+
const {
|
|
120
|
+
themeOptions
|
|
121
|
+
} = (0, _ThemeProvider.useTheme)();
|
|
122
|
+
const titleTextStyles = selectTitleTextStyles(themeTokens, themeOptions);
|
|
123
|
+
const contentTextStyles = selectContentTextStyles(themeTokens, themeOptions);
|
|
116
124
|
const content = typeof children === 'string' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
117
125
|
style: contentTextStyles,
|
|
118
126
|
children: children
|
package/lib/Icon/IconText.js
CHANGED
|
@@ -69,6 +69,9 @@ const IconText = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
69
69
|
});
|
|
70
70
|
IconText.displayName = 'IconText';
|
|
71
71
|
IconText.propTypes = {
|
|
72
|
+
/* eslint-disable react/no-unused-prop-types */
|
|
73
|
+
// eslint is having hard time seeing these props through forwardRef
|
|
74
|
+
|
|
72
75
|
/**
|
|
73
76
|
* Amount of space to separate the text content and icon. Uses the themes's spacing scale
|
|
74
77
|
* (see useSpacingScale for more info).
|
|
@@ -83,7 +86,7 @@ IconText.propTypes = {
|
|
|
83
86
|
/**
|
|
84
87
|
* A valid UDS icon component imported from a UDS palette.
|
|
85
88
|
*/
|
|
86
|
-
icon: _propTypes.default.
|
|
89
|
+
icon: _propTypes.default.elementType,
|
|
87
90
|
|
|
88
91
|
/**
|
|
89
92
|
* Props that will be passed to the icon component. By default the icon's `scalesWithText`
|
|
@@ -97,6 +100,8 @@ IconText.propTypes = {
|
|
|
97
100
|
* `<Typography>` component, or a component that renders `<Text>`.
|
|
98
101
|
*/
|
|
99
102
|
children: _propTypes.default.node
|
|
103
|
+
/* eslint-enable react/no-unused-prop-types */
|
|
104
|
+
|
|
100
105
|
};
|
|
101
106
|
var _default = IconText;
|
|
102
107
|
exports.default = _default;
|
|
@@ -33,9 +33,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
33
33
|
|
|
34
34
|
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
|
|
35
35
|
|
|
36
|
-
const selectLabelStyles = tokens => (0, _ThemeProvider.applyTextStyles)((0, _utils.selectTokens)('Typography', tokens)
|
|
36
|
+
const selectLabelStyles = (tokens, themeOptions) => (0, _ThemeProvider.applyTextStyles)({ ...(0, _utils.selectTokens)('Typography', tokens),
|
|
37
|
+
themeOptions
|
|
38
|
+
});
|
|
37
39
|
|
|
38
|
-
const selectHintStyles = _ref => {
|
|
40
|
+
const selectHintStyles = (_ref, themeOptions) => {
|
|
39
41
|
let {
|
|
40
42
|
hintColor,
|
|
41
43
|
hintFontName,
|
|
@@ -48,7 +50,8 @@ const selectHintStyles = _ref => {
|
|
|
48
50
|
fontName: hintFontName,
|
|
49
51
|
fontSize: hintFontSize,
|
|
50
52
|
fontWeight: hintFontWeight,
|
|
51
|
-
lineHeight: hintLineHeight
|
|
53
|
+
lineHeight: hintLineHeight,
|
|
54
|
+
themeOptions
|
|
52
55
|
});
|
|
53
56
|
};
|
|
54
57
|
|
|
@@ -77,19 +80,22 @@ const InputLabel = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
|
77
80
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('InputLabel', tokens, variant);
|
|
78
81
|
const hasTooltip = tooltip !== undefined;
|
|
79
82
|
const isHintInline = hintPosition === 'inline';
|
|
83
|
+
const {
|
|
84
|
+
themeOptions
|
|
85
|
+
} = (0, _ThemeProvider.useTheme)();
|
|
80
86
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
81
87
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
82
88
|
ref: ref,
|
|
83
89
|
style: staticStyles.container,
|
|
84
90
|
...selectProps(rest),
|
|
85
91
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
86
|
-
style: [selectLabelStyles(themeTokens), selectGapStyles(themeTokens), staticStyles.label],
|
|
92
|
+
style: [selectLabelStyles(themeTokens, themeOptions), selectGapStyles(themeTokens), staticStyles.label],
|
|
87
93
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_LabelContent.default, {
|
|
88
94
|
forId: forId,
|
|
89
95
|
children: label
|
|
90
96
|
})
|
|
91
97
|
}), hint && isHintInline && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
92
|
-
style: [selectHintStyles(themeTokens), hasTooltip && selectGapStyles(themeTokens), staticStyles.label],
|
|
98
|
+
style: [selectHintStyles(themeTokens, themeOptions), hasTooltip && selectGapStyles(themeTokens), staticStyles.label],
|
|
93
99
|
nativeID: hintId,
|
|
94
100
|
children: hint
|
|
95
101
|
}), hasTooltip && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
@@ -27,8 +27,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
27
27
|
* InlinePressable is an alternative to React Native's Pressable that works better when nested
|
|
28
28
|
* inline inside Text. It accepts the same props as React Native's Pressable.
|
|
29
29
|
*
|
|
30
|
-
* On Web it simply passes its props to Pressable and defaults to `inline-flex` instead of `flex`.
|
|
31
|
-
*
|
|
32
30
|
* @param {PressableProps} PressableProps
|
|
33
31
|
*/
|
|
34
32
|
// React Native exports prop Types but not propTypes, use JSDoc types here rather than duplicate RN
|
|
@@ -37,12 +35,11 @@ const InlinePressable = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
37
35
|
let {
|
|
38
36
|
children,
|
|
39
37
|
style,
|
|
40
|
-
inline = false,
|
|
41
38
|
...props
|
|
42
39
|
} = _ref;
|
|
43
40
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
|
|
44
41
|
ref: ref,
|
|
45
|
-
style: pressState => [staticStyles
|
|
42
|
+
style: pressState => [staticStyles.inline, typeof style === 'function' ? style(pressState) : style],
|
|
46
43
|
...props,
|
|
47
44
|
children: pressState => typeof children === 'function' ? children(pressState) : children
|
|
48
45
|
});
|
|
@@ -51,11 +48,7 @@ InlinePressable.displayName = 'InlinePressable';
|
|
|
51
48
|
|
|
52
49
|
const staticStyles = _StyleSheet.default.create({
|
|
53
50
|
inline: {
|
|
54
|
-
// Stop Pressable defaulting to (block) flex
|
|
55
51
|
display: 'inline'
|
|
56
|
-
},
|
|
57
|
-
inlineFlex: {
|
|
58
|
-
display: 'inline-flex'
|
|
59
52
|
}
|
|
60
53
|
});
|
|
61
54
|
|
package/lib/Link/LinkBase.js
CHANGED
|
@@ -37,7 +37,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
37
37
|
|
|
38
38
|
const [selectProps, selectedSystemPropTypes] = (0, _props.selectSystemProps)([_props.a11yProps, _props.linkProps, _props.viewProps]);
|
|
39
39
|
|
|
40
|
-
const selectOuterBorderStyles = _ref => {
|
|
40
|
+
const selectOuterBorderStyles = (_ref, hasIcon) => {
|
|
41
41
|
let {
|
|
42
42
|
outerBorderColor,
|
|
43
43
|
outerBorderWidth,
|
|
@@ -58,7 +58,8 @@ const selectOuterBorderStyles = _ref => {
|
|
|
58
58
|
}),
|
|
59
59
|
// Stops focus ring stretching horizontally if parent has display: block
|
|
60
60
|
// width: fit-content isn't supported on Firefox; can't cascade props like CSS `width: fit-content; width: --moz-fit-content;`
|
|
61
|
-
display: 'inline-flex'
|
|
61
|
+
display: hasIcon ? 'inline-flex' : 'inline' // Stop Pressable defaulting to (block) flex
|
|
62
|
+
|
|
62
63
|
} : {}
|
|
63
64
|
);
|
|
64
65
|
};
|
|
@@ -78,7 +79,7 @@ const selectTextStyles = _ref2 => {
|
|
|
78
79
|
};
|
|
79
80
|
};
|
|
80
81
|
|
|
81
|
-
const selectBlockStyles = _ref3 => {
|
|
82
|
+
const selectBlockStyles = (_ref3, themeOptions) => {
|
|
82
83
|
let {
|
|
83
84
|
blockFontWeight,
|
|
84
85
|
blockFontSize,
|
|
@@ -89,7 +90,8 @@ const selectBlockStyles = _ref3 => {
|
|
|
89
90
|
fontWeight: blockFontWeight,
|
|
90
91
|
fontSize: blockFontSize,
|
|
91
92
|
lineHeight: blockLineHeight,
|
|
92
|
-
fontName: blockFontName
|
|
93
|
+
fontName: blockFontName,
|
|
94
|
+
themeOptions
|
|
93
95
|
});
|
|
94
96
|
};
|
|
95
97
|
|
|
@@ -192,15 +194,16 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
|
192
194
|
const hasIcon = Boolean(icon || defaultThemeTokens.icon); // On web, this makes focus rings wrap only the link, not the entire block
|
|
193
195
|
|
|
194
196
|
const blockLeftStyle = _Platform.default.OS === 'web' && staticStyles.blockLeft;
|
|
197
|
+
const {
|
|
198
|
+
themeOptions
|
|
199
|
+
} = (0, _ThemeProvider.useTheme)();
|
|
195
200
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InlinePressable.default, { ...selectedProps,
|
|
196
|
-
inline: hasIcon // assuming links without icons should be inline (even if they are long)
|
|
197
|
-
,
|
|
198
201
|
ref: ref,
|
|
199
202
|
style: linkState => {
|
|
200
203
|
const themeTokens = resolveLinkTokens(linkState);
|
|
201
|
-
const outerBorderStyles = selectOuterBorderStyles(themeTokens);
|
|
204
|
+
const outerBorderStyles = selectOuterBorderStyles(themeTokens, hasIcon);
|
|
202
205
|
const decorationStyles = selectDecorationStyles(themeTokens);
|
|
203
|
-
return [outerBorderStyles, blockLeftStyle, decorationStyles,
|
|
206
|
+
return [outerBorderStyles, blockLeftStyle, decorationStyles, staticStyles.rowContainer];
|
|
204
207
|
},
|
|
205
208
|
children: linkState => {
|
|
206
209
|
const themeTokens = resolveLinkTokens(linkState);
|
|
@@ -208,7 +211,7 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
|
208
211
|
const iconTokens = selectIconTokens(themeTokens); // TODO: may need to apply some smarter text inheritance here if inline to avoid native
|
|
209
212
|
// issues like double-application of line heights breaking align-items: baseline
|
|
210
213
|
|
|
211
|
-
const blockTextStyles = selectBlockStyles(themeTokens);
|
|
214
|
+
const blockTextStyles = selectBlockStyles(themeTokens, themeOptions);
|
|
212
215
|
const IconComponent = icon || themeTokens.icon;
|
|
213
216
|
const {
|
|
214
217
|
iconSpace
|
|
@@ -242,7 +245,7 @@ LinkBase.propTypes = { ...selectedSystemPropTypes,
|
|
|
242
245
|
* A function component for an SVG icon to render inside the link. Inherits size and color from
|
|
243
246
|
* the link and any Typography the link is nested inside.
|
|
244
247
|
*/
|
|
245
|
-
icon: _propTypes.default.
|
|
248
|
+
icon: _propTypes.default.elementType,
|
|
246
249
|
|
|
247
250
|
/**
|
|
248
251
|
* When `icon` is provided, use `iconPosition` to place the Icon to the left or right side of Link.
|
package/lib/List/ListItem.js
CHANGED
|
@@ -87,7 +87,7 @@ const selectBulletPositioningStyles = _ref5 => {
|
|
|
87
87
|
};
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
-
const selectItemStyles = _ref6 => {
|
|
90
|
+
const selectItemStyles = (_ref6, themeOptions) => {
|
|
91
91
|
let {
|
|
92
92
|
itemFontWeight,
|
|
93
93
|
itemFontSize,
|
|
@@ -98,7 +98,8 @@ const selectItemStyles = _ref6 => {
|
|
|
98
98
|
fontWeight: itemFontWeight,
|
|
99
99
|
fontSize: itemFontSize,
|
|
100
100
|
lineHeight: itemLineHeight,
|
|
101
|
-
fontName: itemFontName
|
|
101
|
+
fontName: itemFontName,
|
|
102
|
+
themeOptions
|
|
102
103
|
});
|
|
103
104
|
};
|
|
104
105
|
|
|
@@ -146,7 +147,10 @@ const ListItem = /*#__PURE__*/(0, _react.forwardRef)((_ref9, ref) => {
|
|
|
146
147
|
...rest
|
|
147
148
|
} = _ref9;
|
|
148
149
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('List', tokens, variant);
|
|
149
|
-
const
|
|
150
|
+
const {
|
|
151
|
+
themeOptions
|
|
152
|
+
} = (0, _ThemeProvider.useTheme)();
|
|
153
|
+
const itemStyles = selectItemStyles(themeTokens, themeOptions);
|
|
150
154
|
const itemBlockStyles = selectItemBlockStyles(themeTokens);
|
|
151
155
|
const dividerStyles = selectDividerStyles(themeTokens);
|
|
152
156
|
const itemBulletContainerStyles = selectBulletContainerStyles(themeTokens);
|
|
@@ -242,7 +246,7 @@ ListItem.propTypes = { ...selectedSystemPropTypes,
|
|
|
242
246
|
/**
|
|
243
247
|
* Renders side item icon
|
|
244
248
|
*/
|
|
245
|
-
icon: _propTypes.default.
|
|
249
|
+
icon: _propTypes.default.elementType,
|
|
246
250
|
|
|
247
251
|
/**
|
|
248
252
|
* Will set display icon color
|
|
@@ -36,7 +36,9 @@ const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_u
|
|
|
36
36
|
const selectContainerStyles = tokens => ({ ...tokens
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
const selectTextStyles = tokens => (0, _ThemeProvider.applyTextStyles)((0, _utils.selectTokens)('Typography', tokens)
|
|
39
|
+
const selectTextStyles = (tokens, themeOptions) => (0, _ThemeProvider.applyTextStyles)({ ...(0, _utils.selectTokens)('Typography', tokens),
|
|
40
|
+
themeOptions
|
|
41
|
+
});
|
|
40
42
|
|
|
41
43
|
const selectIconProps = _ref => {
|
|
42
44
|
let {
|
|
@@ -77,6 +79,10 @@ const selectDismissButtonContainerStyles = _ref4 => {
|
|
|
77
79
|
paddingLeft: dismissButtonGap
|
|
78
80
|
};
|
|
79
81
|
};
|
|
82
|
+
|
|
83
|
+
const selectContentContainerStyle = maxWidth => ({
|
|
84
|
+
width: maxWidth || '100%'
|
|
85
|
+
});
|
|
80
86
|
/**
|
|
81
87
|
* A banner that highlights important messages:
|
|
82
88
|
* - Status message to show there is an error or outage of services
|
|
@@ -148,12 +154,16 @@ const Notification = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
148
154
|
dictionary: _dictionary.default,
|
|
149
155
|
copy
|
|
150
156
|
});
|
|
157
|
+
const {
|
|
158
|
+
themeOptions
|
|
159
|
+
} = (0, _ThemeProvider.useTheme)();
|
|
160
|
+
const contentMaxWidth = (0, _utils.useResponsiveProp)(themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.contentMaxWidth);
|
|
151
161
|
|
|
152
162
|
if (isDismissed) {
|
|
153
163
|
return null;
|
|
154
164
|
}
|
|
155
165
|
|
|
156
|
-
const textStyles = selectTextStyles(themeTokens);
|
|
166
|
+
const textStyles = selectTextStyles(themeTokens, themeOptions);
|
|
157
167
|
const content = (0, _utils.wrapStringsInText)(typeof children === 'function' ? children({
|
|
158
168
|
textStyles
|
|
159
169
|
}) : children, {
|
|
@@ -167,30 +177,33 @@ const Notification = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
167
177
|
const onDismissPress = () => setIsDismissed(true); // TODO: replace the dismiss button with IconButton when implemented (https://github.com/telus/universal-design-system/issues/281)
|
|
168
178
|
|
|
169
179
|
|
|
170
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
180
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
171
181
|
ref: ref,
|
|
172
182
|
style: [staticStyles.container, selectContainerStyles(themeTokens)],
|
|
173
183
|
...selectProps(rest),
|
|
174
|
-
children:
|
|
175
|
-
style:
|
|
176
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
184
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
185
|
+
style: [staticStyles.content, selectContentContainerStyle(contentMaxWidth)],
|
|
186
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
187
|
+
style: staticStyles.contentContainer,
|
|
188
|
+
children: [IconComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
189
|
+
style: selectIconContainerStyles(themeTokens),
|
|
190
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, { ...selectIconProps(themeTokens)
|
|
191
|
+
})
|
|
192
|
+
}), content && typeof content === 'function' ? content({
|
|
193
|
+
textStyles,
|
|
194
|
+
variant
|
|
195
|
+
}) : content]
|
|
196
|
+
}), dismissible && DismissIconComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
197
|
+
style: selectDismissButtonContainerStyles(themeTokens),
|
|
198
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
|
|
199
|
+
onPress: onDismissPress,
|
|
200
|
+
accessibilityRole: "button",
|
|
201
|
+
accessibilityLabel: getCopy('dismiss'),
|
|
202
|
+
children: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(DismissIconComponent, { ...selectDismissIconProps(themeTokens)
|
|
203
|
+
})
|
|
191
204
|
})
|
|
192
|
-
})
|
|
193
|
-
})
|
|
205
|
+
})]
|
|
206
|
+
})
|
|
194
207
|
});
|
|
195
208
|
});
|
|
196
209
|
Notification.displayName = 'Notification';
|
|
@@ -225,9 +238,16 @@ exports.default = _default;
|
|
|
225
238
|
|
|
226
239
|
const staticStyles = _StyleSheet.default.create({
|
|
227
240
|
container: {
|
|
228
|
-
flexDirection: 'row'
|
|
241
|
+
flexDirection: 'row',
|
|
242
|
+
justifyContent: 'center'
|
|
229
243
|
},
|
|
230
244
|
contentContainer: {
|
|
231
|
-
|
|
245
|
+
flexDirection: 'row',
|
|
246
|
+
flexShrink: 1
|
|
247
|
+
},
|
|
248
|
+
content: {
|
|
249
|
+
flexDirection: 'row',
|
|
250
|
+
flexShrink: 1,
|
|
251
|
+
justifyContent: 'space-between'
|
|
232
252
|
}
|
|
233
253
|
});
|
|
@@ -37,7 +37,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
37
37
|
|
|
38
38
|
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
|
|
39
39
|
|
|
40
|
-
const selectTextStyles = _ref => {
|
|
40
|
+
const selectTextStyles = (_ref, themeOptions) => {
|
|
41
41
|
let {
|
|
42
42
|
color,
|
|
43
43
|
fontName,
|
|
@@ -50,7 +50,8 @@ const selectTextStyles = _ref => {
|
|
|
50
50
|
fontName,
|
|
51
51
|
fontSize,
|
|
52
52
|
fontWeight,
|
|
53
|
-
lineHeight
|
|
53
|
+
lineHeight,
|
|
54
|
+
themeOptions
|
|
54
55
|
});
|
|
55
56
|
};
|
|
56
57
|
|
|
@@ -74,6 +75,9 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
74
75
|
} = (0, _ThemeProvider.useThemeTokens)('Pagination', tokens, variant, {
|
|
75
76
|
viewport
|
|
76
77
|
});
|
|
78
|
+
const {
|
|
79
|
+
themeOptions
|
|
80
|
+
} = (0, _ThemeProvider.useTheme)();
|
|
77
81
|
|
|
78
82
|
const items = _react.default.Children.toArray(children);
|
|
79
83
|
|
|
@@ -90,7 +94,7 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
90
94
|
items,
|
|
91
95
|
truncateAbove
|
|
92
96
|
});
|
|
93
|
-
const ellipsisTextStyles = selectTextStyles(themeTokens);
|
|
97
|
+
const ellipsisTextStyles = selectTextStyles(themeTokens, themeOptions);
|
|
94
98
|
|
|
95
99
|
if (items.length === 0) {
|
|
96
100
|
return null;
|
package/lib/Radio/RadioGroup.js
CHANGED
|
@@ -92,6 +92,7 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
92
92
|
legend,
|
|
93
93
|
tooltip,
|
|
94
94
|
hint,
|
|
95
|
+
hintPosition = 'inline',
|
|
95
96
|
validation,
|
|
96
97
|
feedback,
|
|
97
98
|
initialCheckedId,
|
|
@@ -141,6 +142,7 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
141
142
|
};
|
|
142
143
|
|
|
143
144
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Radio.default, {
|
|
145
|
+
error: validation === 'error',
|
|
144
146
|
ref: itemRef,
|
|
145
147
|
id: radioId,
|
|
146
148
|
checked: isChecked,
|
|
@@ -160,6 +162,7 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
160
162
|
legend: legend,
|
|
161
163
|
tooltip: tooltip,
|
|
162
164
|
hint: hint,
|
|
165
|
+
hintPosition: hintPosition,
|
|
163
166
|
space: fieldSpace,
|
|
164
167
|
feedback: feedback,
|
|
165
168
|
inactive: inactive,
|
|
@@ -215,6 +218,11 @@ RadioGroup.propTypes = { ...selectedSystemPropTypes,
|
|
|
215
218
|
*/
|
|
216
219
|
hint: _propTypes.default.string,
|
|
217
220
|
|
|
221
|
+
/**
|
|
222
|
+
* Position of the hint relative to label. Use `below` to display a larger hint below the label.
|
|
223
|
+
*/
|
|
224
|
+
hintPosition: _propTypes.default.oneOf(['inline', 'below']),
|
|
225
|
+
|
|
218
226
|
/**
|
|
219
227
|
* Optional tooltip text content to include alongside the legend and hint.
|
|
220
228
|
*/
|
|
@@ -107,6 +107,9 @@ const RadioCard = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
107
107
|
|
|
108
108
|
const getCardTokens = cardState => (0, _Card.selectPressableCardTokens)(getTokens(cardState));
|
|
109
109
|
|
|
110
|
+
const {
|
|
111
|
+
themeOptions
|
|
112
|
+
} = (0, _ThemeProvider.useTheme)();
|
|
110
113
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Card.PressableCardBase, {
|
|
111
114
|
ref: ref,
|
|
112
115
|
inactive: inactive,
|
|
@@ -127,7 +130,9 @@ const RadioCard = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
127
130
|
} = getTokens(cardState);
|
|
128
131
|
const radioTokens = (0, _RadioButton.selectRadioButtonTokens)(themeTokens, 'radio');
|
|
129
132
|
const titleTokens = (0, _utils.selectTokens)('Typography', themeTokens);
|
|
130
|
-
const textStyle = (0, _ThemeProvider.applyTextStyles)(titleTokens
|
|
133
|
+
const textStyle = (0, _ThemeProvider.applyTextStyles)({ ...titleTokens,
|
|
134
|
+
themeOptions
|
|
135
|
+
});
|
|
131
136
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StackView.default, {
|
|
132
137
|
direction: "row",
|
|
133
138
|
space: radioSpace,
|
|
@@ -92,6 +92,7 @@ const RadioCardGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
92
92
|
legend,
|
|
93
93
|
tooltip,
|
|
94
94
|
hint,
|
|
95
|
+
hintPosition = 'inline',
|
|
95
96
|
validation,
|
|
96
97
|
feedback,
|
|
97
98
|
initialCheckedId,
|
|
@@ -136,6 +137,7 @@ const RadioCardGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
136
137
|
legend: legend,
|
|
137
138
|
tooltip: tooltip,
|
|
138
139
|
hint: hint,
|
|
140
|
+
hintPosition: hintPosition,
|
|
139
141
|
space: fieldSpace,
|
|
140
142
|
feedback: feedback,
|
|
141
143
|
inactive: inactive || readOnly,
|
|
@@ -221,6 +223,11 @@ RadioCardGroup.propTypes = { ...selectedSystemPropTypes,
|
|
|
221
223
|
*/
|
|
222
224
|
hint: _propTypes.default.string,
|
|
223
225
|
|
|
226
|
+
/**
|
|
227
|
+
* Position of the hint relative to label. Use `below` to display a larger hint below the label.
|
|
228
|
+
*/
|
|
229
|
+
hintPosition: _propTypes.default.oneOf(['inline', 'below']),
|
|
230
|
+
|
|
224
231
|
/**
|
|
225
232
|
* Optional tooltip text content to include alongside the legend and hint.
|
|
226
233
|
*/
|
package/lib/Select/Select.js
CHANGED
|
@@ -33,7 +33,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
33
33
|
|
|
34
34
|
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.inputSupportsProps, _utils.viewProps]);
|
|
35
35
|
|
|
36
|
-
const selectInputStyles = (_ref, inactive) => {
|
|
36
|
+
const selectInputStyles = (_ref, themeOptions, inactive) => {
|
|
37
37
|
let {
|
|
38
38
|
backgroundColor,
|
|
39
39
|
color,
|
|
@@ -63,7 +63,8 @@ const selectInputStyles = (_ref, inactive) => {
|
|
|
63
63
|
fontName,
|
|
64
64
|
fontSize,
|
|
65
65
|
lineHeight,
|
|
66
|
-
fontWeight
|
|
66
|
+
fontWeight,
|
|
67
|
+
themeOptions
|
|
67
68
|
});
|
|
68
69
|
|
|
69
70
|
const webStyles = _Platform.default.select({
|
|
@@ -252,6 +253,9 @@ const Select = /*#__PURE__*/(0, _react.forwardRef)((_ref7, ref) => {
|
|
|
252
253
|
icon: IconComponent,
|
|
253
254
|
validationIcon: ValidationIconComponent
|
|
254
255
|
} = themeTokens;
|
|
256
|
+
const {
|
|
257
|
+
themeOptions
|
|
258
|
+
} = (0, _ThemeProvider.useTheme)();
|
|
255
259
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputSupports.default, { ...supportsProps,
|
|
256
260
|
...selectedProps,
|
|
257
261
|
children: _ref8 => {
|
|
@@ -263,7 +267,7 @@ const Select = /*#__PURE__*/(0, _react.forwardRef)((_ref7, ref) => {
|
|
|
263
267
|
style: selectOuterBorderStyles(themeTokens),
|
|
264
268
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Picker.default, {
|
|
265
269
|
ref: ref,
|
|
266
|
-
style: selectInputStyles(themeTokens, inactive),
|
|
270
|
+
style: selectInputStyles(themeTokens, themeOptions, inactive),
|
|
267
271
|
onFocus: handleFocus,
|
|
268
272
|
onBlur: handleBlur,
|
|
269
273
|
onMouseOver: handleMouseOver,
|