@telus-uds/components-base 1.12.0 → 1.12.1
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 +10 -2
- package/component-docs.json +67 -11
- package/lib/BaseProvider/index.js +7 -2
- package/lib/Button/ButtonBase.js +18 -14
- package/lib/Carousel/Carousel.js +19 -51
- package/lib/Carousel/CarouselContext.js +12 -4
- package/lib/Carousel/CarouselStepTracker/CarouselStepTracker.js +56 -0
- package/lib/Carousel/CarouselStepTracker/index.js +13 -0
- package/lib/Checkbox/Checkbox.js +7 -3
- package/lib/Checkbox/CheckboxGroup.js +1 -1
- package/lib/Feedback/Feedback.js +18 -10
- package/lib/Icon/IconText.js +5 -0
- package/lib/InputLabel/InputLabel.js +11 -5
- package/lib/Link/LinkBase.js +7 -3
- package/lib/List/ListItem.js +7 -3
- package/lib/Notification/Notification.js +7 -2
- package/lib/Pagination/Pagination.js +7 -3
- package/lib/RadioCard/RadioCard.js +6 -1
- package/lib/Select/Select.js +7 -3
- 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 +20 -3
- package/lib/ThemeProvider/utils/styles.js +8 -1
- package/lib/ThemeProvider/utils/theme-tokens.js +1 -1
- package/lib/Typography/Typography.js +6 -2
- package/lib-module/BaseProvider/index.js +7 -2
- package/lib-module/Button/ButtonBase.js +7 -3
- package/lib-module/Carousel/Carousel.js +18 -50
- package/lib-module/Carousel/CarouselContext.js +11 -4
- package/lib-module/Carousel/CarouselStepTracker/CarouselStepTracker.js +42 -0
- package/lib-module/Carousel/CarouselStepTracker/index.js +2 -0
- package/lib-module/Checkbox/Checkbox.js +8 -4
- package/lib-module/Checkbox/CheckboxGroup.js +1 -1
- package/lib-module/Feedback/Feedback.js +19 -11
- package/lib-module/Icon/IconText.js +5 -0
- package/lib-module/InputLabel/InputLabel.js +12 -6
- package/lib-module/Link/LinkBase.js +8 -4
- package/lib-module/List/ListItem.js +8 -4
- package/lib-module/Notification/Notification.js +8 -3
- package/lib-module/Pagination/Pagination.js +8 -4
- package/lib-module/RadioCard/RadioCard.js +7 -2
- package/lib-module/Select/Select.js +8 -4
- 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 +20 -3
- package/lib-module/ThemeProvider/utils/styles.js +8 -1
- package/lib-module/ThemeProvider/utils/theme-tokens.js +1 -1
- package/lib-module/Typography/Typography.js +7 -3
- package/package.json +1 -1
- package/src/BaseProvider/index.jsx +6 -3
- package/src/Button/ButtonBase.jsx +8 -3
- package/src/Carousel/Carousel.jsx +27 -58
- package/src/Carousel/CarouselContext.jsx +15 -4
- package/src/Carousel/CarouselStepTracker/CarouselStepTracker.jsx +36 -0
- package/src/Carousel/CarouselStepTracker/index.js +3 -0
- package/src/Checkbox/Checkbox.jsx +14 -11
- package/src/Checkbox/CheckboxGroup.jsx +1 -1
- package/src/Feedback/Feedback.jsx +14 -7
- package/src/Icon/IconText.jsx +2 -0
- package/src/InputLabel/InputLabel.jsx +13 -12
- package/src/Link/LinkBase.jsx +10 -4
- package/src/List/ListItem.jsx +9 -4
- package/src/Notification/Notification.jsx +5 -3
- package/src/Pagination/Pagination.jsx +6 -4
- package/src/RadioCard/RadioCard.jsx +3 -2
- package/src/Select/Select.jsx +12 -3
- 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 +16 -3
- package/src/ThemeProvider/utils/styles.js +9 -1
- package/src/ThemeProvider/utils/theme-tokens.js +1 -1
- package/src/Typography/Typography.jsx +11 -12
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).
|
|
@@ -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, {
|
package/lib/Link/LinkBase.js
CHANGED
|
@@ -78,7 +78,7 @@ const selectTextStyles = _ref2 => {
|
|
|
78
78
|
};
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
-
const selectBlockStyles = _ref3 => {
|
|
81
|
+
const selectBlockStyles = (_ref3, themeOptions) => {
|
|
82
82
|
let {
|
|
83
83
|
blockFontWeight,
|
|
84
84
|
blockFontSize,
|
|
@@ -89,7 +89,8 @@ const selectBlockStyles = _ref3 => {
|
|
|
89
89
|
fontWeight: blockFontWeight,
|
|
90
90
|
fontSize: blockFontSize,
|
|
91
91
|
lineHeight: blockLineHeight,
|
|
92
|
-
fontName: blockFontName
|
|
92
|
+
fontName: blockFontName,
|
|
93
|
+
themeOptions
|
|
93
94
|
});
|
|
94
95
|
};
|
|
95
96
|
|
|
@@ -192,6 +193,9 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
|
192
193
|
const hasIcon = Boolean(icon || defaultThemeTokens.icon); // On web, this makes focus rings wrap only the link, not the entire block
|
|
193
194
|
|
|
194
195
|
const blockLeftStyle = _Platform.default.OS === 'web' && staticStyles.blockLeft;
|
|
196
|
+
const {
|
|
197
|
+
themeOptions
|
|
198
|
+
} = (0, _ThemeProvider.useTheme)();
|
|
195
199
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InlinePressable.default, { ...selectedProps,
|
|
196
200
|
inline: hasIcon // assuming links without icons should be inline (even if they are long)
|
|
197
201
|
,
|
|
@@ -208,7 +212,7 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
|
208
212
|
const iconTokens = selectIconTokens(themeTokens); // TODO: may need to apply some smarter text inheritance here if inline to avoid native
|
|
209
213
|
// issues like double-application of line heights breaking align-items: baseline
|
|
210
214
|
|
|
211
|
-
const blockTextStyles = selectBlockStyles(themeTokens);
|
|
215
|
+
const blockTextStyles = selectBlockStyles(themeTokens, themeOptions);
|
|
212
216
|
const IconComponent = icon || themeTokens.icon;
|
|
213
217
|
const {
|
|
214
218
|
iconSpace
|
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);
|
|
@@ -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 {
|
|
@@ -148,12 +150,15 @@ const Notification = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
148
150
|
dictionary: _dictionary.default,
|
|
149
151
|
copy
|
|
150
152
|
});
|
|
153
|
+
const {
|
|
154
|
+
themeOptions
|
|
155
|
+
} = (0, _ThemeProvider.useTheme)();
|
|
151
156
|
|
|
152
157
|
if (isDismissed) {
|
|
153
158
|
return null;
|
|
154
159
|
}
|
|
155
160
|
|
|
156
|
-
const textStyles = selectTextStyles(themeTokens);
|
|
161
|
+
const textStyles = selectTextStyles(themeTokens, themeOptions);
|
|
157
162
|
const content = (0, _utils.wrapStringsInText)(typeof children === 'function' ? children({
|
|
158
163
|
textStyles
|
|
159
164
|
}) : children, {
|
|
@@ -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;
|
|
@@ -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,
|
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,
|
package/lib/StepTracker/Step.js
CHANGED
|
@@ -128,7 +128,7 @@ const selectLabelContainerStyles = _ref5 => {
|
|
|
128
128
|
};
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
-
const selectLabelStyles = (_ref6, isCurrent) => {
|
|
131
|
+
const selectLabelStyles = (_ref6, themeOptions, isCurrent) => {
|
|
132
132
|
let {
|
|
133
133
|
labelColor,
|
|
134
134
|
labelCurrentColor,
|
|
@@ -143,7 +143,8 @@ const selectLabelStyles = (_ref6, isCurrent) => {
|
|
|
143
143
|
fontSize: labelFontSize,
|
|
144
144
|
lineHeight: labelLineHeight,
|
|
145
145
|
fontWeight: isCurrent ? labelCurrentFontWeight : labelFontWeight,
|
|
146
|
-
fontName: labelFontName
|
|
146
|
+
fontName: labelFontName,
|
|
147
|
+
themeOptions
|
|
147
148
|
});
|
|
148
149
|
};
|
|
149
150
|
|
|
@@ -184,6 +185,9 @@ const Step = _ref7 => {
|
|
|
184
185
|
const isCompleted = status > stepIndex;
|
|
185
186
|
const isCurrent = status === stepIndex;
|
|
186
187
|
const isActive = isCompleted || isCurrent;
|
|
188
|
+
const {
|
|
189
|
+
themeOptions
|
|
190
|
+
} = (0, _ThemeProvider.useTheme)();
|
|
187
191
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StackView.default, {
|
|
188
192
|
space: 0,
|
|
189
193
|
tokens: {
|
|
@@ -218,12 +222,12 @@ const Step = _ref7 => {
|
|
|
218
222
|
}), showStepLabel && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
219
223
|
style: [staticStyles.stepLabelContainer, selectLabelContainerStyles(tokens)],
|
|
220
224
|
children: [showStepName && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
221
|
-
style: [staticStyles.centeredText, selectLabelStyles(tokens, isCurrent)],
|
|
225
|
+
style: [staticStyles.centeredText, selectLabelStyles(tokens, themeOptions, isCurrent)],
|
|
222
226
|
children: name
|
|
223
227
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.default, {
|
|
224
228
|
direction: "row",
|
|
225
229
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
226
|
-
style: [staticStyles.centeredText, tokens.labelDirection === 'column' && staticStyles.wrappingLabel, selectLabelStyles(tokens, isCurrent)],
|
|
230
|
+
style: [staticStyles.centeredText, tokens.labelDirection === 'column' && staticStyles.wrappingLabel, selectLabelStyles(tokens, themeOptions, isCurrent)],
|
|
227
231
|
children: label
|
|
228
232
|
})
|
|
229
233
|
})]
|
|
@@ -63,7 +63,7 @@ const selectStepTrackerLabelContainerStyles = _ref2 => {
|
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
const selectStepTrackerLabelStyles = _ref3 => {
|
|
66
|
+
const selectStepTrackerLabelStyles = (_ref3, themeOptions) => {
|
|
67
67
|
let {
|
|
68
68
|
labelColor,
|
|
69
69
|
labelFontSize,
|
|
@@ -76,7 +76,8 @@ const selectStepTrackerLabelStyles = _ref3 => {
|
|
|
76
76
|
fontSize: labelFontSize,
|
|
77
77
|
lineHeight: labelLineHeight,
|
|
78
78
|
fontWeight: labelFontWeight,
|
|
79
|
-
fontName: labelFontName
|
|
79
|
+
fontName: labelFontName,
|
|
80
|
+
themeOptions
|
|
80
81
|
});
|
|
81
82
|
};
|
|
82
83
|
/**
|
|
@@ -138,6 +139,9 @@ const StepTracker = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
|
138
139
|
|
|
139
140
|
const getStepLabel = index => themeTokens.showStepLabel ? getCopy('stepLabel').replace('%{stepNumber}', index + 1) : '';
|
|
140
141
|
|
|
142
|
+
const {
|
|
143
|
+
themeOptions
|
|
144
|
+
} = (0, _ThemeProvider.useTheme)();
|
|
141
145
|
if (!steps.length) return null;
|
|
142
146
|
const selectedProps = selectProps({
|
|
143
147
|
accessibilityLabel: stepTrackerLabel,
|
|
@@ -172,7 +176,7 @@ const StepTracker = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
|
172
176
|
}), showStepTrackerLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
173
177
|
style: [staticStyles.stepTrackerLabelContainer, selectStepTrackerLabelContainerStyles(themeTokens)],
|
|
174
178
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
175
|
-
style: selectStepTrackerLabelStyles(themeTokens),
|
|
179
|
+
style: selectStepTrackerLabelStyles(themeTokens, themeOptions),
|
|
176
180
|
children: stepTrackerLabel
|
|
177
181
|
})
|
|
178
182
|
})]
|
package/lib/Tabs/TabsItem.js
CHANGED
|
@@ -131,6 +131,9 @@ const TabsItem = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
|
131
131
|
...rest
|
|
132
132
|
} = _utils.clickProps.toPressProps(rawRest);
|
|
133
133
|
|
|
134
|
+
const {
|
|
135
|
+
themeOptions
|
|
136
|
+
} = (0, _ThemeProvider.useTheme)();
|
|
134
137
|
const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('TabsItem', tokens, variant);
|
|
135
138
|
|
|
136
139
|
const resolveTokens = pressableState => (0, _utils.resolvePressableTokens)(getTokens, pressableState, {
|
|
@@ -197,6 +200,7 @@ const TabsItem = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
|
197
200
|
const highlightTriangleStyle = hasHighlightTriangle && selectHighlightTriangleStyles(themeTokens);
|
|
198
201
|
const containerStyles = selectContainerStyles(themeTokens);
|
|
199
202
|
const textStyles = (0, _ThemeProvider.applyTextStyles)({ ...(0, _utils.selectTokens)('Typography', themeTokens),
|
|
203
|
+
themeOptions,
|
|
200
204
|
textAlign
|
|
201
205
|
});
|
|
202
206
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
@@ -31,7 +31,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
31
31
|
|
|
32
32
|
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.textInputHandlerProps, _utils.textInputProps, _utils.viewProps]);
|
|
33
33
|
|
|
34
|
-
const selectInputStyles = (_ref, inactive) => {
|
|
34
|
+
const selectInputStyles = (_ref, themeOptions, inactive) => {
|
|
35
35
|
let {
|
|
36
36
|
backgroundColor,
|
|
37
37
|
color,
|
|
@@ -62,7 +62,8 @@ const selectInputStyles = (_ref, inactive) => {
|
|
|
62
62
|
fontName,
|
|
63
63
|
fontSize,
|
|
64
64
|
lineHeight,
|
|
65
|
-
fontWeight
|
|
65
|
+
fontWeight,
|
|
66
|
+
themeOptions
|
|
66
67
|
});
|
|
67
68
|
|
|
68
69
|
function linesToHeight(lines) {
|
|
@@ -233,9 +234,12 @@ const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
233
234
|
// Input could lead to changing its state from uncontrolled to controlled
|
|
234
235
|
value: isControlled ? currentValue : undefined
|
|
235
236
|
};
|
|
237
|
+
const {
|
|
238
|
+
themeOptions
|
|
239
|
+
} = (0, _ThemeProvider.useTheme)();
|
|
236
240
|
const nativeInputStyle = selectInputStyles({ ...themeTokens,
|
|
237
241
|
height
|
|
238
|
-
}, inactive);
|
|
242
|
+
}, themeOptions, inactive);
|
|
239
243
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
240
244
|
style: selectOuterBorderStyles(themeTokens),
|
|
241
245
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextInput.default, {
|
|
@@ -29,7 +29,11 @@ exports.ThemeSetterContext = ThemeSetterContext;
|
|
|
29
29
|
const ThemeProvider = _ref => {
|
|
30
30
|
let {
|
|
31
31
|
children,
|
|
32
|
-
defaultTheme
|
|
32
|
+
defaultTheme,
|
|
33
|
+
// TODO: switch `forceAbsoluteFontSizing` to be false by default in the next major version
|
|
34
|
+
themeOptions = {
|
|
35
|
+
forceAbsoluteFontSizing: true
|
|
36
|
+
}
|
|
33
37
|
} = _ref;
|
|
34
38
|
const [theme, setTheme] = (0, _react.useState)(defaultTheme); // Validate the theme tokens version on every render.
|
|
35
39
|
// This will intentionally break the application when attempting to use an invalid theme.
|
|
@@ -39,7 +43,9 @@ const ThemeProvider = _ref => {
|
|
|
39
43
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ThemeSetterContext.Provider, {
|
|
40
44
|
value: setTheme,
|
|
41
45
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ThemeContext.Provider, {
|
|
42
|
-
value: theme,
|
|
46
|
+
value: { ...theme,
|
|
47
|
+
themeOptions
|
|
48
|
+
},
|
|
43
49
|
children: children
|
|
44
50
|
})
|
|
45
51
|
});
|
|
@@ -51,7 +57,18 @@ ThemeProvider.propTypes = {
|
|
|
51
57
|
metadata: _propTypes.default.shape({
|
|
52
58
|
themeTokensVersion: _propTypes.default.string.isRequired
|
|
53
59
|
}).isRequired
|
|
54
|
-
}).isRequired
|
|
60
|
+
}).isRequired,
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* An object containing options allowing to customize the theming experience:
|
|
64
|
+
*
|
|
65
|
+
* - `forceAbsoluteFontSizing`: available on web only; when set to true, allows
|
|
66
|
+
* using absolute font sizing (in pixels, doesn't scale) instead of the
|
|
67
|
+
* relative sizing (in `rem`, scales depending on the browser settings)
|
|
68
|
+
*/
|
|
69
|
+
themeOptions: _propTypes.default.shape({
|
|
70
|
+
forceAbsoluteFontSizing: _propTypes.default.bool
|
|
71
|
+
})
|
|
55
72
|
};
|
|
56
73
|
var _default = ThemeProvider;
|
|
57
74
|
exports.default = _default;
|
|
@@ -28,14 +28,21 @@ function applyTextStyles(_ref) {
|
|
|
28
28
|
fontWeight = '400',
|
|
29
29
|
fontName,
|
|
30
30
|
fontStyle = 'normal',
|
|
31
|
+
themeOptions = {
|
|
32
|
+
// TODO: switch `forceAbsoluteFontSizing` to be false by default in the next major version
|
|
33
|
+
forceAbsoluteFontSizing: true
|
|
34
|
+
},
|
|
31
35
|
...rest
|
|
32
36
|
} = _ref;
|
|
33
37
|
const styles = { ...rest
|
|
34
38
|
};
|
|
39
|
+
const {
|
|
40
|
+
forceAbsoluteFontSizing
|
|
41
|
+
} = themeOptions;
|
|
35
42
|
|
|
36
43
|
if (fontSize) {
|
|
37
44
|
// If relative font sizes are needed, catch and calculate them here
|
|
38
|
-
styles.fontSize = fontSize;
|
|
45
|
+
styles.fontSize = _Platform.default.OS === 'web' && !forceAbsoluteFontSizing ? "".concat(fontSize / _systemConstants.fontBasePixels, "rem") : fontSize;
|
|
39
46
|
}
|
|
40
47
|
|
|
41
48
|
if (typeof lineHeight === 'number') {
|
|
@@ -194,7 +194,7 @@ const validateThemeTokensVersion = theme => {
|
|
|
194
194
|
const actualThemeTokensVersion = theme === null || theme === void 0 ? void 0 : (_theme$metadata2 = theme.metadata) === null || _theme$metadata2 === void 0 ? void 0 : _theme$metadata2.themeTokensVersion;
|
|
195
195
|
|
|
196
196
|
if (!(0, _satisfies.default)(actualThemeTokensVersion, expectedThemeTokensVersion)) {
|
|
197
|
-
throw new Error("Invalid UDS token schema version detected.\n\nThe UDS base components ".concat(_package.default.name, " v").concat(_package.default.version, " are only compatible with UDS themes that are built with @telus-uds/system-theme-tokens version that is semver compatible with ").concat(expectedThemeTokensVersion, ". The current theme was built with @telus-uds/system-theme-tokens v").concat(actualThemeTokensVersion, ".\n\nIf you see this error than most likely you have attempted to install ").concat(_package.default.name, " and a UDS theme manually because you are building a multi-brand application. If you are building a single brand application, consider installing the brand specific design system package such as @telus-uds/ds-allium. For more information, see https://github.com/telus/universal-design-system/blob/main/
|
|
197
|
+
throw new Error("Invalid UDS token schema version detected.\n\nThe UDS base components ".concat(_package.default.name, " v").concat(_package.default.version, " are only compatible with UDS themes that are built with @telus-uds/system-theme-tokens version that is semver compatible with ").concat(expectedThemeTokensVersion, ". The current theme was built with @telus-uds/system-theme-tokens v").concat(actualThemeTokensVersion, ".\n\nIf you see this error than most likely you have attempted to install ").concat(_package.default.name, " and a UDS theme manually because you are building a multi-brand application. If you are building a single brand application, consider installing the brand specific design system package such as @telus-uds/ds-allium. For more information, see https://github.com/telus/universal-design-system/blob/main/docs/docs/multi-brand-usage.md"));
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
200
|
|
|
@@ -35,7 +35,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
35
35
|
const [selectContainerProps, selectedContainerPropTypes] = (0, _utils2.selectSystemProps)([_utils2.a11yProps, _utils2.viewProps]);
|
|
36
36
|
const [selectTextProps, selectedTextPropTypes] = (0, _utils2.selectSystemProps)([_utils2.textProps]);
|
|
37
37
|
|
|
38
|
-
const selectTextStyles = _ref => {
|
|
38
|
+
const selectTextStyles = (_ref, themeOptions) => {
|
|
39
39
|
let {
|
|
40
40
|
fontWeight,
|
|
41
41
|
fontSize,
|
|
@@ -52,6 +52,7 @@ const selectTextStyles = _ref => {
|
|
|
52
52
|
color,
|
|
53
53
|
lineHeight,
|
|
54
54
|
fontName,
|
|
55
|
+
themeOptions,
|
|
55
56
|
textAlign,
|
|
56
57
|
textTransform,
|
|
57
58
|
letterSpacing
|
|
@@ -76,10 +77,13 @@ const Typography = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
76
77
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('Typography', tokens, variant, {
|
|
77
78
|
viewport
|
|
78
79
|
});
|
|
80
|
+
const {
|
|
81
|
+
themeOptions
|
|
82
|
+
} = (0, _ThemeProvider.useTheme)();
|
|
79
83
|
const resolvedTextProps = { ...selectTextProps(rest),
|
|
80
84
|
style: selectTextStyles(align ? { ...themeTokens,
|
|
81
85
|
textAlign: align
|
|
82
|
-
} : themeTokens),
|
|
86
|
+
} : themeTokens, themeOptions),
|
|
83
87
|
dataSet,
|
|
84
88
|
maxFontSizeMultiplier: (0, _utils2.getMaxFontMultiplier)(themeTokens)
|
|
85
89
|
};
|
|
@@ -10,12 +10,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
10
10
|
const BaseProvider = _ref => {
|
|
11
11
|
let {
|
|
12
12
|
defaultTheme,
|
|
13
|
-
children
|
|
13
|
+
children,
|
|
14
|
+
themeOptions
|
|
14
15
|
} = _ref;
|
|
15
16
|
return /*#__PURE__*/_jsx(A11yInfoProvider, {
|
|
16
17
|
children: /*#__PURE__*/_jsx(ViewportProvider, {
|
|
17
18
|
children: /*#__PURE__*/_jsx(ThemeProvider, {
|
|
18
19
|
defaultTheme: defaultTheme,
|
|
20
|
+
themeOptions: themeOptions,
|
|
19
21
|
children: children
|
|
20
22
|
})
|
|
21
23
|
})
|
|
@@ -23,7 +25,10 @@ const BaseProvider = _ref => {
|
|
|
23
25
|
};
|
|
24
26
|
|
|
25
27
|
BaseProvider.propTypes = {
|
|
28
|
+
children: PropTypes.node.isRequired,
|
|
26
29
|
defaultTheme: (_ThemeProvider$propTy = ThemeProvider.propTypes) === null || _ThemeProvider$propTy === void 0 ? void 0 : _ThemeProvider$propTy.defaultTheme,
|
|
27
|
-
|
|
30
|
+
themeOptions: PropTypes.shape({
|
|
31
|
+
forceAbsoluteFontSizing: PropTypes.bool
|
|
32
|
+
})
|
|
28
33
|
};
|
|
29
34
|
export default BaseProvider;
|
|
@@ -4,7 +4,7 @@ import Pressable from "react-native-web/dist/exports/Pressable";
|
|
|
4
4
|
import View from "react-native-web/dist/exports/View";
|
|
5
5
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
6
6
|
import Platform from "react-native-web/dist/exports/Platform";
|
|
7
|
-
import { applyTextStyles, applyShadowToken, applyOuterBorder } from '../ThemeProvider
|
|
7
|
+
import { applyTextStyles, applyShadowToken, applyOuterBorder, useTheme } from '../ThemeProvider';
|
|
8
8
|
import buttonPropTypes from './propTypes';
|
|
9
9
|
import { a11yProps, clickProps, focusHandlerProps, getCursorStyle, linkProps, resolvePressableState, resolvePressableTokens, selectSystemProps, viewProps, wrapStringsInText, withLinkRouter } from '../utils';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -131,7 +131,7 @@ const selectBorderStyles = _ref5 => {
|
|
|
131
131
|
};
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
-
const selectTextStyles = _ref6 => {
|
|
134
|
+
const selectTextStyles = (_ref6, themeOptions) => {
|
|
135
135
|
let {
|
|
136
136
|
fontSize,
|
|
137
137
|
color,
|
|
@@ -146,6 +146,7 @@ const selectTextStyles = _ref6 => {
|
|
|
146
146
|
lineHeight,
|
|
147
147
|
fontName,
|
|
148
148
|
fontWeight,
|
|
149
|
+
themeOptions,
|
|
149
150
|
textAlign
|
|
150
151
|
});
|
|
151
152
|
};
|
|
@@ -197,6 +198,9 @@ const ButtonBase = /*#__PURE__*/forwardRef((_ref8, ref) => {
|
|
|
197
198
|
return [staticStyles.row, selectWebOnlyStyles(inactive, themeTokens, systemProps), selectOuterContainerStyles(themeTokens), selectOuterWidthStyles(themeTokens)];
|
|
198
199
|
};
|
|
199
200
|
|
|
201
|
+
const {
|
|
202
|
+
themeOptions
|
|
203
|
+
} = useTheme();
|
|
200
204
|
return /*#__PURE__*/_jsx(Pressable, {
|
|
201
205
|
ref: ref,
|
|
202
206
|
href: href,
|
|
@@ -212,7 +216,7 @@ const ButtonBase = /*#__PURE__*/forwardRef((_ref8, ref) => {
|
|
|
212
216
|
const themeTokens = resolveButtonTokens(pressableState);
|
|
213
217
|
const containerStyles = selectInnerContainerStyles(themeTokens);
|
|
214
218
|
const borderStyles = selectBorderStyles(themeTokens);
|
|
215
|
-
const textStyles = [selectTextStyles(themeTokens), staticStyles.text]; // If the container has a width set, fill it instead of sizing from content.
|
|
219
|
+
const textStyles = [selectTextStyles(themeTokens, themeOptions), staticStyles.text]; // If the container has a width set, fill it instead of sizing from content.
|
|
216
220
|
// If in future we support text alignments other than center, add here.
|
|
217
221
|
|
|
218
222
|
const stretchStyles = themeTokens.width ? staticStyles.stretch : staticStyles.align;
|