@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
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
11
|
+
|
|
12
|
+
var _Pressable = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Pressable"));
|
|
13
|
+
|
|
14
|
+
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
15
|
+
|
|
16
|
+
var _Text = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Text"));
|
|
17
|
+
|
|
18
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
+
|
|
20
|
+
var _ThemeProvider = require("../ThemeProvider");
|
|
21
|
+
|
|
22
|
+
var _utils = require("../utils");
|
|
23
|
+
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
+
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
+
|
|
30
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
+
|
|
32
|
+
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.linkProps]); // ensure explicit selection of tokens
|
|
33
|
+
|
|
34
|
+
const selectStyles = _ref => {
|
|
35
|
+
let {
|
|
36
|
+
backgroundColor,
|
|
37
|
+
outlineColor,
|
|
38
|
+
outlineOffset,
|
|
39
|
+
outlineStyle,
|
|
40
|
+
outlineWidth,
|
|
41
|
+
paddingHorizontal,
|
|
42
|
+
paddingVertical,
|
|
43
|
+
borderRadius
|
|
44
|
+
} = _ref;
|
|
45
|
+
return {
|
|
46
|
+
backgroundColor,
|
|
47
|
+
outlineColor,
|
|
48
|
+
outlineOffset,
|
|
49
|
+
outlineStyle,
|
|
50
|
+
outlineWidth,
|
|
51
|
+
paddingHorizontal,
|
|
52
|
+
paddingVertical,
|
|
53
|
+
borderRadius
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const selectTextStyles = _ref2 => {
|
|
58
|
+
let {
|
|
59
|
+
color
|
|
60
|
+
} = _ref2;
|
|
61
|
+
return {
|
|
62
|
+
color
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* A generic Skip link component, unstyled by default.
|
|
67
|
+
* A Skip link component help keyboard-only users, screen reader users to skip
|
|
68
|
+
* sections and navigate to the content they want.
|
|
69
|
+
*
|
|
70
|
+
* ## Component API
|
|
71
|
+
*
|
|
72
|
+
* For common uses, pass a `href` that is a # link to a DOM id that can be skipped to (web only).
|
|
73
|
+
*
|
|
74
|
+
* The element with this ID should be focusable, e.g. `<Box nativeID="skip-target" focusable>`.
|
|
75
|
+
*
|
|
76
|
+
* Other custom behaviour may be set by passing an `onPress` function, and routers may be integrated
|
|
77
|
+
* in the same way as other navigation-related components by passing a `LinkRouter`; but a # anchor
|
|
78
|
+
* href on web and/or a `targetRef` for cross-platform applications is the recommended approach.
|
|
79
|
+
*
|
|
80
|
+
* ## Visible styling
|
|
81
|
+
*
|
|
82
|
+
* When focused, the skip link shows as a visible element similar to a simplified ButtonLink using
|
|
83
|
+
* UDS theming. The `tokens` prop may be used to override these styles.
|
|
84
|
+
*
|
|
85
|
+
* To control the background of a skip link, the following tokens can be used:
|
|
86
|
+
*
|
|
87
|
+
* - `backgroundColor`
|
|
88
|
+
* *
|
|
89
|
+
* In order to control the color of the skip link text, the following tokens can be used:
|
|
90
|
+
*
|
|
91
|
+
* - `color`
|
|
92
|
+
*
|
|
93
|
+
* ### Padding
|
|
94
|
+
*
|
|
95
|
+
* The following padding tokens can be used:
|
|
96
|
+
*
|
|
97
|
+
* - `paddingHorizontal`
|
|
98
|
+
* - `paddingVertical`
|
|
99
|
+
*
|
|
100
|
+
* ### Outline
|
|
101
|
+
*
|
|
102
|
+
* The following tokens to control the outline:
|
|
103
|
+
*
|
|
104
|
+
* - `outlineColor`
|
|
105
|
+
* - `outlineOffset`
|
|
106
|
+
* - `outlineStyle`
|
|
107
|
+
* - `outlineWidth`
|
|
108
|
+
*
|
|
109
|
+
* ## Usability and A11y guidelines
|
|
110
|
+
*
|
|
111
|
+
* - The skip link component is visually hidden until a keyboard press activates it.
|
|
112
|
+
* - Usually, you should place the skip link immediately after the opening <body> tag.
|
|
113
|
+
* - This lets users bypass top-level navigation links and jump to the main content on a page.
|
|
114
|
+
* - Also consider using SkipLink before a complex feature containing many focusable elements.
|
|
115
|
+
*
|
|
116
|
+
* ## Accessibility
|
|
117
|
+
*
|
|
118
|
+
* Skip link supports all the common a11y and link props.
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
const SkipLink = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
123
|
+
let {
|
|
124
|
+
tokens,
|
|
125
|
+
variant,
|
|
126
|
+
href,
|
|
127
|
+
children,
|
|
128
|
+
...rawRest
|
|
129
|
+
} = _ref3;
|
|
130
|
+
|
|
131
|
+
const {
|
|
132
|
+
onPress,
|
|
133
|
+
...rest
|
|
134
|
+
} = _utils.clickProps.toPressProps(rawRest);
|
|
135
|
+
|
|
136
|
+
const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('SkipLink', tokens, variant);
|
|
137
|
+
const defaultTokens = getTokens();
|
|
138
|
+
|
|
139
|
+
const resolveLinkTokens = pressState => (0, _utils.resolvePressableTokens)(defaultTokens, pressState);
|
|
140
|
+
|
|
141
|
+
const handlePress = event => {
|
|
142
|
+
if (typeof onPress === 'function') onPress(event); // TODO - support native apps with something based on refs and/or setAccessibilityFocus
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
|
|
146
|
+
ref: ref,
|
|
147
|
+
accessibilityRole: "link",
|
|
148
|
+
onPress: handlePress,
|
|
149
|
+
href: href,
|
|
150
|
+
style: _ref4 => {
|
|
151
|
+
let {
|
|
152
|
+
focused: focus
|
|
153
|
+
} = _ref4;
|
|
154
|
+
const themeTokens = getTokens({
|
|
155
|
+
focus
|
|
156
|
+
});
|
|
157
|
+
const skipLinkStyle = selectStyles(themeTokens);
|
|
158
|
+
return [staticStyles.absolute, skipLinkStyle, !focus && staticStyles.hidden];
|
|
159
|
+
},
|
|
160
|
+
...selectProps(rest),
|
|
161
|
+
children: pressState => {
|
|
162
|
+
const themeTokens = resolveLinkTokens(pressState);
|
|
163
|
+
const textStyles = selectTextStyles(themeTokens);
|
|
164
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
165
|
+
style: [textStyles, staticStyles.baseline],
|
|
166
|
+
children: children
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
SkipLink.displayName = 'SkipLink';
|
|
172
|
+
SkipLink.propTypes = { ...selectedSystemPropTypes,
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* The text content shown or read out when the SkipLink is focused, usually a string.
|
|
176
|
+
*/
|
|
177
|
+
children: _propTypes.default.node,
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The target to skip to. Usually an anchor link to a section id (e.g. href="#main-section").
|
|
181
|
+
*/
|
|
182
|
+
href: _propTypes.default.string,
|
|
183
|
+
tokens: (0, _utils.getTokensPropType)('SkipLink'),
|
|
184
|
+
variant: _utils.variantProp.propType
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const staticStyles = _StyleSheet.default.create({
|
|
188
|
+
baseline: {
|
|
189
|
+
alignSelf: 'baseline'
|
|
190
|
+
},
|
|
191
|
+
absolute: {
|
|
192
|
+
margin: 0,
|
|
193
|
+
position: 'absolute',
|
|
194
|
+
top: 0,
|
|
195
|
+
left: 0
|
|
196
|
+
},
|
|
197
|
+
hidden: {
|
|
198
|
+
overflow: 'hidden',
|
|
199
|
+
..._Platform.default.select({
|
|
200
|
+
web: {
|
|
201
|
+
clip: 'rect(0 0 0 0)',
|
|
202
|
+
clipPath: 'inset(50%)'
|
|
203
|
+
},
|
|
204
|
+
default: {
|
|
205
|
+
// width / height of 0 would make it non-focusable
|
|
206
|
+
height: 1,
|
|
207
|
+
width: 1,
|
|
208
|
+
opacity: 0
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
var _default = (0, _utils.withLinkRouter)(SkipLink);
|
|
215
|
+
|
|
216
|
+
exports.default = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _SkipLink = _interopRequireDefault(require("./SkipLink"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _SkipLink.default;
|
|
13
|
+
exports.default = _default;
|
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"));
|
|
@@ -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,9 +4,10 @@ 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
|
+
import { IconText } from '../Icon';
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, linkProps, viewProps]);
|
|
12
13
|
|
|
@@ -131,7 +132,7 @@ const selectBorderStyles = _ref5 => {
|
|
|
131
132
|
};
|
|
132
133
|
};
|
|
133
134
|
|
|
134
|
-
const selectTextStyles = _ref6 => {
|
|
135
|
+
const selectTextStyles = (_ref6, themeOptions) => {
|
|
135
136
|
let {
|
|
136
137
|
fontSize,
|
|
137
138
|
color,
|
|
@@ -146,6 +147,7 @@ const selectTextStyles = _ref6 => {
|
|
|
146
147
|
lineHeight,
|
|
147
148
|
fontName,
|
|
148
149
|
fontWeight,
|
|
150
|
+
themeOptions,
|
|
149
151
|
textAlign
|
|
150
152
|
});
|
|
151
153
|
};
|
|
@@ -166,7 +168,18 @@ const selectWebOnlyStyles = (inactive, themeTokens, _ref7) => {
|
|
|
166
168
|
});
|
|
167
169
|
};
|
|
168
170
|
|
|
169
|
-
const
|
|
171
|
+
const selectItemIconTokens = _ref8 => {
|
|
172
|
+
let {
|
|
173
|
+
color,
|
|
174
|
+
iconSize
|
|
175
|
+
} = _ref8;
|
|
176
|
+
return {
|
|
177
|
+
size: iconSize,
|
|
178
|
+
color
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const ButtonBase = /*#__PURE__*/forwardRef((_ref9, ref) => {
|
|
170
183
|
let {
|
|
171
184
|
id,
|
|
172
185
|
href,
|
|
@@ -177,8 +190,11 @@ const ButtonBase = /*#__PURE__*/forwardRef((_ref8, ref) => {
|
|
|
177
190
|
// alias for inactive
|
|
178
191
|
inactive = disabled,
|
|
179
192
|
selected = false,
|
|
193
|
+
icon,
|
|
194
|
+
iconPosition = icon ? 'left' : undefined,
|
|
195
|
+
iconProps,
|
|
180
196
|
...rawRest
|
|
181
|
-
} =
|
|
197
|
+
} = _ref9;
|
|
182
198
|
const {
|
|
183
199
|
onPress,
|
|
184
200
|
...rest
|
|
@@ -197,6 +213,9 @@ const ButtonBase = /*#__PURE__*/forwardRef((_ref8, ref) => {
|
|
|
197
213
|
return [staticStyles.row, selectWebOnlyStyles(inactive, themeTokens, systemProps), selectOuterContainerStyles(themeTokens), selectOuterWidthStyles(themeTokens)];
|
|
198
214
|
};
|
|
199
215
|
|
|
216
|
+
const {
|
|
217
|
+
themeOptions
|
|
218
|
+
} = useTheme();
|
|
200
219
|
return /*#__PURE__*/_jsx(Pressable, {
|
|
201
220
|
ref: ref,
|
|
202
221
|
href: href,
|
|
@@ -212,10 +231,15 @@ const ButtonBase = /*#__PURE__*/forwardRef((_ref8, ref) => {
|
|
|
212
231
|
const themeTokens = resolveButtonTokens(pressableState);
|
|
213
232
|
const containerStyles = selectInnerContainerStyles(themeTokens);
|
|
214
233
|
const borderStyles = selectBorderStyles(themeTokens);
|
|
215
|
-
const textStyles = [selectTextStyles(themeTokens), staticStyles.text];
|
|
234
|
+
const textStyles = [selectTextStyles(themeTokens, themeOptions), staticStyles.text];
|
|
235
|
+
const iconTokens = selectItemIconTokens(themeTokens);
|
|
236
|
+
const {
|
|
237
|
+
iconSpace
|
|
238
|
+
} = themeTokens; // If the container has a width set, fill it instead of sizing from content.
|
|
216
239
|
// If in future we support text alignments other than center, add here.
|
|
217
240
|
|
|
218
241
|
const stretchStyles = themeTokens.width ? staticStyles.stretch : staticStyles.align;
|
|
242
|
+
const IconComponent = icon || themeTokens.icon;
|
|
219
243
|
return /*#__PURE__*/_jsx(View, {
|
|
220
244
|
id: id,
|
|
221
245
|
style: [containerStyles, borderStyles, stretchStyles, staticStyles.row, Platform.select({
|
|
@@ -226,10 +250,18 @@ const ButtonBase = /*#__PURE__*/forwardRef((_ref8, ref) => {
|
|
|
226
250
|
transition: 'background-color 200ms, border-color 200ms'
|
|
227
251
|
}
|
|
228
252
|
})],
|
|
229
|
-
children:
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
253
|
+
children: /*#__PURE__*/_jsx(IconText, {
|
|
254
|
+
icon: IconComponent,
|
|
255
|
+
iconPosition: iconPosition,
|
|
256
|
+
space: iconSpace,
|
|
257
|
+
iconProps: { ...iconProps,
|
|
258
|
+
tokens: iconTokens
|
|
259
|
+
},
|
|
260
|
+
children: wrapStringsInText(typeof children === 'function' ? children({ ...resolvePressableState(pressableState, extraButtonState),
|
|
261
|
+
textStyles
|
|
262
|
+
}) : children, {
|
|
263
|
+
style: textStyles
|
|
264
|
+
})
|
|
233
265
|
})
|
|
234
266
|
});
|
|
235
267
|
}
|