@telus-uds/components-base 1.11.0 → 1.13.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 +36 -2
- package/component-docs.json +796 -33
- package/lib/BaseProvider/index.js +7 -2
- package/lib/Button/ButtonBase.js +18 -14
- package/lib/Button/ButtonGroup.js +7 -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 +5 -0
- package/lib/InputLabel/InputLabel.js +11 -5
- package/lib/Link/InlinePressable.js +1 -8
- package/lib/Link/LinkBase.js +12 -9
- package/lib/List/ListItem.js +7 -3
- package/lib/Notification/Notification.js +7 -2
- 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/utils/index.js +9 -0
- package/lib-module/BaseProvider/index.js +7 -2
- package/lib-module/Button/ButtonBase.js +7 -3
- package/lib-module/Button/ButtonGroup.js +7 -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 +5 -0
- package/lib-module/InputLabel/InputLabel.js +12 -6
- package/lib-module/Link/InlinePressable.js +1 -8
- package/lib-module/Link/LinkBase.js +13 -10
- 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/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/lib-module/utils/index.js +1 -0
- package/package.json +46 -47
- package/src/BaseProvider/index.jsx +6 -3
- package/src/Button/ButtonBase.jsx +8 -3
- package/src/Button/ButtonGroup.jsx +6 -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 +2 -0
- package/src/InputLabel/InputLabel.jsx +13 -12
- package/src/Link/InlinePressable.jsx +2 -8
- package/src/Link/LinkBase.jsx +17 -20
- package/src/List/ListItem.jsx +9 -4
- package/src/Notification/Notification.jsx +5 -3
- 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
- package/src/utils/index.js +1 -0
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, {
|
|
@@ -11,6 +11,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _utils = require("./utils");
|
|
13
13
|
|
|
14
|
+
var _responsiveProps = _interopRequireDefault(require("../utils/props/responsiveProps"));
|
|
15
|
+
|
|
14
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
17
|
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -29,7 +31,11 @@ exports.ThemeSetterContext = ThemeSetterContext;
|
|
|
29
31
|
const ThemeProvider = _ref => {
|
|
30
32
|
let {
|
|
31
33
|
children,
|
|
32
|
-
defaultTheme
|
|
34
|
+
defaultTheme,
|
|
35
|
+
// TODO: switch `forceAbsoluteFontSizing` to be false by default in the next major version
|
|
36
|
+
themeOptions = {
|
|
37
|
+
forceAbsoluteFontSizing: true
|
|
38
|
+
}
|
|
33
39
|
} = _ref;
|
|
34
40
|
const [theme, setTheme] = (0, _react.useState)(defaultTheme); // Validate the theme tokens version on every render.
|
|
35
41
|
// This will intentionally break the application when attempting to use an invalid theme.
|
|
@@ -39,7 +45,9 @@ const ThemeProvider = _ref => {
|
|
|
39
45
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ThemeSetterContext.Provider, {
|
|
40
46
|
value: setTheme,
|
|
41
47
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ThemeContext.Provider, {
|
|
42
|
-
value: theme,
|
|
48
|
+
value: { ...theme,
|
|
49
|
+
themeOptions
|
|
50
|
+
},
|
|
43
51
|
children: children
|
|
44
52
|
})
|
|
45
53
|
});
|
|
@@ -51,7 +59,21 @@ ThemeProvider.propTypes = {
|
|
|
51
59
|
metadata: _propTypes.default.shape({
|
|
52
60
|
themeTokensVersion: _propTypes.default.string.isRequired
|
|
53
61
|
}).isRequired
|
|
54
|
-
}).isRequired
|
|
62
|
+
}).isRequired,
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* An object containing options allowing to customize the theming experience:
|
|
66
|
+
*
|
|
67
|
+
* - `forceAbsoluteFontSizing`: available on web only; when set to true, allows
|
|
68
|
+
* using absolute font sizing (in pixels, doesn't scale) instead of the
|
|
69
|
+
* relative sizing (in `rem`, scales depending on the browser settings)
|
|
70
|
+
* - `contentMaxWidth`: allows configuration of the content max width to be used in components
|
|
71
|
+
* such as Footnote and Notification to avoid content to stretch width more then the page's width
|
|
72
|
+
*/
|
|
73
|
+
themeOptions: _propTypes.default.shape({
|
|
74
|
+
forceAbsoluteFontSizing: _propTypes.default.bool,
|
|
75
|
+
contentMaxWidth: _responsiveProps.default.getTypeOptionallyByViewport(_propTypes.default.number)
|
|
76
|
+
})
|
|
55
77
|
};
|
|
56
78
|
var _default = ThemeProvider;
|
|
57
79
|
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
|
|
|
@@ -49,6 +49,7 @@ const ToggleSwitchGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
49
49
|
inactive = false,
|
|
50
50
|
feedback,
|
|
51
51
|
hint,
|
|
52
|
+
hintPosition = 'inline',
|
|
52
53
|
tooltip,
|
|
53
54
|
legend,
|
|
54
55
|
name: inputGroupName,
|
|
@@ -134,6 +135,7 @@ const ToggleSwitchGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
134
135
|
legend: legend,
|
|
135
136
|
tooltip: tooltip,
|
|
136
137
|
hint: hint,
|
|
138
|
+
hintPosition: hintPosition,
|
|
137
139
|
space: fieldSpace,
|
|
138
140
|
feedback: feedback,
|
|
139
141
|
inactive: inactive,
|
|
@@ -216,6 +218,11 @@ ToggleSwitchGroup.propTypes = { ...selectedSystemPropTypes,
|
|
|
216
218
|
*/
|
|
217
219
|
hint: _propTypes.default.string,
|
|
218
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
|
+
|
|
219
226
|
/**
|
|
220
227
|
* Optional tooltip text content to include alongside the legend and hint.
|
|
221
228
|
*/
|
|
@@ -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
|
};
|
package/lib/index.js
CHANGED
|
@@ -34,6 +34,7 @@ var _exportNames = {
|
|
|
34
34
|
Select: true,
|
|
35
35
|
SideNav: true,
|
|
36
36
|
Skeleton: true,
|
|
37
|
+
SkipLink: true,
|
|
37
38
|
Spacer: true,
|
|
38
39
|
StackView: true,
|
|
39
40
|
StepTracker: true,
|
|
@@ -249,6 +250,12 @@ Object.defineProperty(exports, "Skeleton", {
|
|
|
249
250
|
return _Skeleton.default;
|
|
250
251
|
}
|
|
251
252
|
});
|
|
253
|
+
Object.defineProperty(exports, "SkipLink", {
|
|
254
|
+
enumerable: true,
|
|
255
|
+
get: function () {
|
|
256
|
+
return _SkipLink.default;
|
|
257
|
+
}
|
|
258
|
+
});
|
|
252
259
|
Object.defineProperty(exports, "Spacer", {
|
|
253
260
|
enumerable: true,
|
|
254
261
|
get: function () {
|
|
@@ -524,6 +531,8 @@ var _SideNav = _interopRequireDefault(require("./SideNav"));
|
|
|
524
531
|
|
|
525
532
|
var _Skeleton = _interopRequireDefault(require("./Skeleton"));
|
|
526
533
|
|
|
534
|
+
var _SkipLink = _interopRequireDefault(require("./SkipLink"));
|
|
535
|
+
|
|
527
536
|
var _Spacer = _interopRequireDefault(require("./Spacer"));
|
|
528
537
|
|
|
529
538
|
var _StackView = _interopRequireWildcard(require("./StackView"));
|
package/lib/utils/index.js
CHANGED
|
@@ -9,6 +9,7 @@ var _exportNames = {
|
|
|
9
9
|
useHash: true,
|
|
10
10
|
useSpacingScale: true,
|
|
11
11
|
useResponsiveProp: true,
|
|
12
|
+
useScrollBlocking: true,
|
|
12
13
|
useUniqueId: true,
|
|
13
14
|
withLinkRouter: true,
|
|
14
15
|
containUniqueFields: true
|
|
@@ -43,6 +44,12 @@ Object.defineProperty(exports, "useResponsiveProp", {
|
|
|
43
44
|
return _useResponsiveProp.default;
|
|
44
45
|
}
|
|
45
46
|
});
|
|
47
|
+
Object.defineProperty(exports, "useScrollBlocking", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () {
|
|
50
|
+
return _useScrollBlocking.default;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
46
53
|
Object.defineProperty(exports, "useSpacingScale", {
|
|
47
54
|
enumerable: true,
|
|
48
55
|
get: function () {
|
|
@@ -168,6 +175,8 @@ Object.keys(_useResponsiveProp).forEach(function (key) {
|
|
|
168
175
|
});
|
|
169
176
|
});
|
|
170
177
|
|
|
178
|
+
var _useScrollBlocking = _interopRequireDefault(require("./useScrollBlocking"));
|
|
179
|
+
|
|
171
180
|
var _useUniqueId = _interopRequireDefault(require("./useUniqueId"));
|
|
172
181
|
|
|
173
182
|
var _withLinkRouter = _interopRequireDefault(require("./withLinkRouter"));
|
|
@@ -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;
|
|
@@ -26,6 +26,7 @@ const ButtonGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
26
26
|
legend,
|
|
27
27
|
tooltip,
|
|
28
28
|
hint,
|
|
29
|
+
hintPosition = 'inline',
|
|
29
30
|
validation,
|
|
30
31
|
feedback,
|
|
31
32
|
name: inputGroupName,
|
|
@@ -77,6 +78,7 @@ const ButtonGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
77
78
|
legend: legend,
|
|
78
79
|
tooltip: tooltip,
|
|
79
80
|
hint: hint,
|
|
81
|
+
hintPosition: hintPosition,
|
|
80
82
|
space: fieldSpace,
|
|
81
83
|
feedback: feedback,
|
|
82
84
|
readOnly: readOnly,
|
|
@@ -208,6 +210,11 @@ ButtonGroup.propTypes = { ...selectedSystemPropTypes,
|
|
|
208
210
|
*/
|
|
209
211
|
hint: PropTypes.string,
|
|
210
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Position of the hint relative to label. Use `below` to display a larger hint below the label.
|
|
215
|
+
*/
|
|
216
|
+
hintPosition: PropTypes.oneOf(['inline', 'below']),
|
|
217
|
+
|
|
211
218
|
/**
|
|
212
219
|
* Optional tooltip text content to include alongside the legend and hint.
|
|
213
220
|
*/
|