@telus-uds/components-base 1.49.0 → 1.51.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +27 -2
  2. package/component-docs.json +110 -14
  3. package/lib/Link/LinkBase.js +1 -1
  4. package/lib/MultiSelectFilter/ModalOverlay.js +24 -8
  5. package/lib/MultiSelectFilter/MultiSelectFilter.js +154 -21
  6. package/lib/QuickLinksFeature/QuickLinksFeatureItem.js +62 -41
  7. package/lib/StepTracker/Step.js +35 -14
  8. package/lib/StepTracker/StepTracker.js +5 -2
  9. package/lib/StepTracker/dictionary.js +24 -4
  10. package/lib/TextInput/TextInput.js +17 -15
  11. package/lib/ThemeProvider/ThemeProvider.js +7 -1
  12. package/lib-module/Link/LinkBase.js +1 -1
  13. package/lib-module/MultiSelectFilter/ModalOverlay.js +25 -9
  14. package/lib-module/MultiSelectFilter/MultiSelectFilter.js +154 -23
  15. package/lib-module/QuickLinksFeature/QuickLinksFeatureItem.js +64 -43
  16. package/lib-module/StepTracker/Step.js +35 -14
  17. package/lib-module/StepTracker/StepTracker.js +5 -2
  18. package/lib-module/StepTracker/dictionary.js +24 -4
  19. package/lib-module/TextInput/TextInput.js +19 -15
  20. package/lib-module/ThemeProvider/ThemeProvider.js +8 -2
  21. package/package.json +2 -2
  22. package/src/Card/CardBase.jsx +0 -1
  23. package/src/Link/LinkBase.jsx +3 -1
  24. package/src/MultiSelectFilter/ModalOverlay.jsx +30 -6
  25. package/src/MultiSelectFilter/MultiSelectFilter.jsx +142 -20
  26. package/src/QuickLinksFeature/QuickLinksFeatureItem.jsx +42 -35
  27. package/src/StepTracker/Step.jsx +34 -10
  28. package/src/StepTracker/StepTracker.jsx +11 -2
  29. package/src/StepTracker/dictionary.js +24 -4
  30. package/src/TextInput/TextInput.jsx +8 -5
  31. package/src/ThemeProvider/ThemeProvider.jsx +9 -2
  32. package/src/Typography/Typography.jsx +1 -0
@@ -1,8 +1,9 @@
1
- import React, { useState } from 'react';
1
+ import React, { useState, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { useThemeTokens, useThemeTokensCallback } from '../ThemeProvider';
3
+ import { useThemeTokens, useThemeTokensCallback, applyTextStyles } from '../ThemeProvider';
4
4
  import { containUniqueFields, getTokensPropType, getPressHandlersWithArgs, selectTokens, useOverlaidPosition, useCopy, useMultipleInputValues, useResponsiveProp, variantProp } from '../utils';
5
5
  import dictionary from './dictionary';
6
+ import { useViewport } from '../ViewportProvider';
6
7
  import Box from '../Box';
7
8
  import { Button, ButtonDropdown } from '../Button';
8
9
  import { CheckboxGroup } from '../Checkbox';
@@ -13,6 +14,7 @@ import StackView from '../StackView';
13
14
  import Typography from '../Typography';
14
15
  import { TextButton } from '../Link';
15
16
  import ModalOverlay from './ModalOverlay';
17
+ import Modal from '../Modal';
16
18
  import { jsx as _jsx } from "react/jsx-runtime";
17
19
  import { Fragment as _Fragment } from "react/jsx-runtime";
18
20
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -54,6 +56,7 @@ const MultiSelectFilter = _ref3 => {
54
56
  tokens,
55
57
  items = [],
56
58
  values,
59
+ maxHeight = false,
57
60
  initialValues,
58
61
  maxValues,
59
62
  onChange,
@@ -63,6 +66,7 @@ const MultiSelectFilter = _ref3 => {
63
66
  rowLimit = 12,
64
67
  ...rest
65
68
  } = _ref3;
69
+ const viewport = useViewport();
66
70
  const {
67
71
  currentValues,
68
72
  setValues
@@ -73,6 +77,9 @@ const MultiSelectFilter = _ref3 => {
73
77
  onChange,
74
78
  readOnly
75
79
  });
80
+ const [isOpen, setIsOpen] = useState(false);
81
+ const [checkedIds, setCheckedIds] = useState(currentValues ?? []);
82
+ const [maxWidth, setMaxWidth] = useState(false);
76
83
  const themeTokens = useThemeTokens('ButtonDropdown', tokens, variant);
77
84
  const getItemTokens = useThemeTokensCallback('ButtonDropdown', tokens, variant);
78
85
 
@@ -82,10 +89,34 @@ const MultiSelectFilter = _ref3 => {
82
89
  dictionary,
83
90
  copy
84
91
  });
85
- const [isOpen, setIsOpen] = useState(false);
86
- const [checkedIds, setCheckedIds] = useState(currentValues ?? []);
87
- const colSize = items.length > rowLimit ? 2 : 1;
92
+ const colSizeNotMobile = items.length > rowLimit ? 2 : 1;
93
+ const colSize = viewport !== 'xs' ? colSizeNotMobile : 1;
94
+ const itemsLengthNotMobile = items.length > 24 ? items.length / 2 : rowLimit;
88
95
  const isSelected = currentValues.length > 0;
96
+ const rowLength = viewport !== 'xs' ? itemsLengthNotMobile : items.length;
97
+ useEffect(() => {
98
+ if (colSize === 1) return setMaxWidth(false);
99
+ return colSize === 2 && setMaxWidth(true);
100
+ }, [colSize]);
101
+ const {
102
+ headerFontColor,
103
+ headerFontSize,
104
+ buttonDirection,
105
+ headerFontWeight,
106
+ headerLineHeight,
107
+ subHeaderFontWeight,
108
+ subHeaderFontSize,
109
+ maxHeightSize,
110
+ maxWidthSize,
111
+ subHeaderLineHeight,
112
+ minHeight,
113
+ minWidth
114
+ } = useThemeTokens('MultiSelectFilter', tokens, { ...variant,
115
+ maxHeight,
116
+ maxWidth
117
+ }, {
118
+ viewport
119
+ });
89
120
  const uniqueFields = ['id', 'label'];
90
121
 
91
122
  if (!containUniqueFields(items, uniqueFields)) {
@@ -109,6 +140,11 @@ const MultiSelectFilter = _ref3 => {
109
140
  setIsOpen(false);
110
141
  };
111
142
 
143
+ const onClear = () => {
144
+ setCheckedIds(() => []);
145
+ onApply([]);
146
+ };
147
+
112
148
  const {
113
149
  align,
114
150
  offsets
@@ -116,9 +152,7 @@ const MultiSelectFilter = _ref3 => {
116
152
  xs: {
117
153
  align: {
118
154
  top: 'top',
119
- left: 'left',
120
- bottom: 'bottom',
121
- right: 'right'
155
+ left: 'left'
122
156
  }
123
157
  },
124
158
  sm: {
@@ -131,6 +165,16 @@ const MultiSelectFilter = _ref3 => {
131
165
  }
132
166
  }
133
167
  });
168
+ const headerStyles = applyTextStyles({
169
+ fontSize: headerFontSize,
170
+ fontWeight: headerFontWeight,
171
+ fontColor: headerFontColor
172
+ });
173
+ const subeHeaderStyles = applyTextStyles({
174
+ fontSize: subHeaderFontSize,
175
+ fontWeight: subHeaderFontWeight,
176
+ fontColor: selectSubTitleTokens(themeTokens)
177
+ });
134
178
  const {
135
179
  overlaidPosition,
136
180
  onTargetLayout,
@@ -151,20 +195,96 @@ const MultiSelectFilter = _ref3 => {
151
195
  onChange: handleChange,
152
196
  tokens: getButtonTokens,
153
197
  inactive: inactive
154
- }, id), isOpen && /*#__PURE__*/_jsxs(ModalOverlay, {
198
+ }, id), isOpen && viewport === 'xs' && /*#__PURE__*/_jsxs(Modal, {
199
+ isOpen: isOpen,
200
+ onClose: () => setIsOpen(false),
201
+ children: [/*#__PURE__*/_jsx(Row, {
202
+ children: /*#__PURE__*/_jsx(Typography, {
203
+ tokens: { ...headerStyles,
204
+ lineHeight: headerLineHeight
205
+ },
206
+ children: getCopy('filterByLabel').replace(/%\{filterCategory\}/g, label.toLowerCase())
207
+ })
208
+ }), subtitle && /*#__PURE__*/_jsxs(_Fragment, {
209
+ children: [/*#__PURE__*/_jsx(Spacer, {
210
+ space: 5
211
+ }), /*#__PURE__*/_jsx(Row, {
212
+ children: /*#__PURE__*/_jsx(Typography, {
213
+ tokens: { ...subeHeaderStyles,
214
+ lineHeight: subHeaderLineHeight
215
+ },
216
+ children: subtitle
217
+ })
218
+ })]
219
+ }), /*#__PURE__*/_jsx(Spacer, {
220
+ space: 4
221
+ }), /*#__PURE__*/_jsx(Box, {
222
+ scroll: true,
223
+ children: /*#__PURE__*/_jsx(Row, {
224
+ distribute: "between",
225
+ children: [...Array(colSize).keys()].map(i => /*#__PURE__*/_jsxs(Col, {
226
+ xs: 12 / colSize,
227
+ children: [/*#__PURE__*/_jsx(CheckboxGroup, {
228
+ items: items.slice(i * rowLength, (i + 1) * rowLength),
229
+ checkedIds: checkedIds,
230
+ onChange: e => setCheckedIds(e, i)
231
+ }), /*#__PURE__*/_jsx(Spacer, {
232
+ size: 4
233
+ })]
234
+ }, i))
235
+ })
236
+ }), /*#__PURE__*/_jsx(Divider, {
237
+ variant: selectDividerToknes({ ...themeTokens,
238
+ width: 'full'
239
+ }),
240
+ space: 4
241
+ }), /*#__PURE__*/_jsx(Row, {
242
+ horizontalAlign: buttonDirection === 'column' ? 'center' : 'start',
243
+ children: /*#__PURE__*/_jsxs(StackView, {
244
+ direction: buttonDirection,
245
+ space: 3,
246
+ tokens: {
247
+ alignItems: 'center',
248
+ ...(viewport === 'xs' && {
249
+ flexGrow: 1
250
+ })
251
+ },
252
+ children: [/*#__PURE__*/_jsx(Button, {
253
+ onPress: () => onApply(checkedIds),
254
+ variant: {
255
+ size: 'small',
256
+ priority: 'high',
257
+ ...(viewport === 'xs' && {
258
+ width: 'full'
259
+ })
260
+ },
261
+ children: getCopy('applyButtonLabel')
262
+ }), /*#__PURE__*/_jsx(Box, {
263
+ children: /*#__PURE__*/_jsx(TextButton, {
264
+ onPress: () => onClear(),
265
+ children: getCopy('clearButtonLabel')
266
+ })
267
+ })]
268
+ })
269
+ })]
270
+ }), isOpen && viewport !== 'xs' && /*#__PURE__*/_jsxs(ModalOverlay, {
155
271
  overlaidPosition: overlaidPosition,
156
- variant: {
157
- width: colSize > 1 ? 'size576' : 's'
158
- },
159
272
  onClose: () => setIsOpen(false),
160
- tokens: tokens,
273
+ maxHeight: maxHeight,
274
+ maxHeightSize: maxHeightSize,
275
+ maxWidthSize: maxWidthSize,
276
+ minHeight: minHeight,
277
+ minWidth: minWidth,
278
+ tokens: { ...tokens,
279
+ maxWidth
280
+ },
161
281
  copy: copy,
162
282
  isReady: isReady,
163
283
  onLayout: onTargetLayout,
164
284
  children: [/*#__PURE__*/_jsx(Row, {
165
285
  children: /*#__PURE__*/_jsx(Typography, {
166
- variant: {
167
- size: 'h4'
286
+ tokens: { ...headerStyles,
287
+ lineHeight: headerLineHeight
168
288
  },
169
289
  children: getCopy('filterByLabel').replace(/%\{filterCategory\}/g, label.toLowerCase())
170
290
  })
@@ -173,10 +293,9 @@ const MultiSelectFilter = _ref3 => {
173
293
  space: 5
174
294
  }), /*#__PURE__*/_jsx(Row, {
175
295
  children: /*#__PURE__*/_jsx(Typography, {
176
- variant: {
177
- size: 'h5'
296
+ tokens: { ...subeHeaderStyles,
297
+ lineHeight: subHeaderLineHeight
178
298
  },
179
- tokens: selectSubTitleTokens(themeTokens),
180
299
  children: subtitle
181
300
  })
182
301
  })]
@@ -189,7 +308,7 @@ const MultiSelectFilter = _ref3 => {
189
308
  children: [...Array(colSize).keys()].map(i => /*#__PURE__*/_jsxs(Col, {
190
309
  xs: 12 / colSize,
191
310
  children: [/*#__PURE__*/_jsx(CheckboxGroup, {
192
- items: items.slice(i * rowLimit, (i + 1) * rowLimit),
311
+ items: items.slice(i * rowLength, (i + 1) * rowLength),
193
312
  checkedIds: checkedIds,
194
313
  onChange: e => setCheckedIds(e, i)
195
314
  }), /*#__PURE__*/_jsx(Spacer, {
@@ -203,22 +322,29 @@ const MultiSelectFilter = _ref3 => {
203
322
  }),
204
323
  space: 4
205
324
  }), /*#__PURE__*/_jsx(Row, {
325
+ horizontalAlign: buttonDirection === 'column' ? 'center' : 'start',
206
326
  children: /*#__PURE__*/_jsxs(StackView, {
207
- direction: "row",
327
+ direction: buttonDirection,
208
328
  space: 3,
209
329
  tokens: {
210
- alignItems: 'center'
330
+ alignItems: 'center',
331
+ ...(viewport === 'xs' && {
332
+ flexGrow: 1
333
+ })
211
334
  },
212
335
  children: [/*#__PURE__*/_jsx(Button, {
213
336
  onPress: () => onApply(checkedIds),
214
337
  variant: {
215
338
  size: 'small',
216
- priority: 'high'
339
+ priority: 'high',
340
+ ...(viewport === 'xs' && {
341
+ width: 'full'
342
+ })
217
343
  },
218
344
  children: getCopy('applyButtonLabel')
219
345
  }), /*#__PURE__*/_jsx(Box, {
220
346
  children: /*#__PURE__*/_jsx(TextButton, {
221
- onPress: () => setCheckedIds([]),
347
+ onPress: () => onClear(),
222
348
  children: getCopy('clearButtonLabel')
223
349
  })
224
350
  })]
@@ -292,6 +418,11 @@ MultiSelectFilter.propTypes = {
292
418
  */
293
419
  maxValues: PropTypes.number,
294
420
 
421
+ /**
422
+ * If provided sets maxHeight to be active
423
+ */
424
+ maxHeight: PropTypes.bool,
425
+
295
426
  /**
296
427
  * If provided, this function is called when the current selection is changed
297
428
  * and is passed an array of the `id`s of all currently selected `items`.
@@ -1,4 +1,4 @@
1
- import React, { forwardRef, useState } from 'react';
1
+ import React, { forwardRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import Image from "react-native-web/dist/exports/Image";
4
4
  import Platform from "react-native-web/dist/exports/Platform";
@@ -6,7 +6,7 @@ import Text from "react-native-web/dist/exports/Text";
6
6
  import View from "react-native-web/dist/exports/View";
7
7
  import { getTokensPropType, variantProp, withLinkRouter, a11yProps, linkProps, selectSystemProps } from '../utils';
8
8
  import { useViewport } from '../ViewportProvider';
9
- import { useThemeTokensCallback } from '../ThemeProvider';
9
+ import { applyTextStyles, useThemeTokensCallback } from '../ThemeProvider';
10
10
  import { Link } from '../Link';
11
11
  import { StackWrap } from '../StackView'; // pass through and type relevant system props - add more sets for interactive components
12
12
 
@@ -32,6 +32,7 @@ const selectContainerStyle = _ref => {
32
32
  } = _ref;
33
33
  return {
34
34
  textAlign,
35
+ outline: 'red',
35
36
  width: contentMaxDimension,
36
37
  overflow: 'hidden'
37
38
  };
@@ -43,6 +44,15 @@ const selectImageContainerStyle = contentMaxDimension => ({
43
44
  justifyContent: 'center',
44
45
  alignItems: 'center'
45
46
  });
47
+
48
+ const selectLinkToken = _ref2 => {
49
+ let {
50
+ outerBorderColor
51
+ } = _ref2;
52
+ return {
53
+ outerBorderColor
54
+ };
55
+ };
46
56
  /**
47
57
  * Component export along with QuickLinksFeature to be used as children
48
58
  *
@@ -50,7 +60,7 @@ const selectImageContainerStyle = contentMaxDimension => ({
50
60
  */
51
61
 
52
62
 
53
- const QuickLinksFeatureItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
63
+ const QuickLinksFeatureItem = /*#__PURE__*/forwardRef((_ref3, ref) => {
54
64
  let {
55
65
  tokens,
56
66
  variant,
@@ -58,52 +68,63 @@ const QuickLinksFeatureItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
58
68
  imageAccessibilityLabel,
59
69
  imageSource,
60
70
  ...rest
61
- } = _ref2;
71
+ } = _ref3;
62
72
  const viewport = useViewport();
63
73
  const getTokens = useThemeTokensCallback('QuickLinksFeatureItem', tokens, variant);
64
- const [hover, setHover] = useState(false);
65
- const {
66
- contentDirection,
67
- contentSpace,
68
- contentAlignItems,
69
- contentMaxDimension,
70
- imageDimension,
71
- textAlign
72
- } = getTokens({
73
- viewport,
74
- hover
75
- });
76
74
  return /*#__PURE__*/_jsx(Link, {
77
75
  ref: ref,
78
- tokens: state => {
79
- setHover(state.hover);
80
- return getTokens(state);
81
- },
82
76
  ...selectProps(rest),
83
- children: /*#__PURE__*/_jsx(View, {
84
- style: selectContainerStyle({
77
+ tokens: state => selectLinkToken(getTokens(state)),
78
+ children: _ref4 => {
79
+ let {
80
+ hovered: hover,
81
+ pressed,
82
+ focused: focus
83
+ } = _ref4;
84
+ const {
85
+ contentDirection,
86
+ contentSpace,
87
+ contentAlignItems,
85
88
  contentMaxDimension,
86
- textAlign
87
- }),
88
- children: /*#__PURE__*/_jsxs(StackWrap, {
89
- direction: contentDirection,
90
- space: contentSpace,
91
- tokens: {
92
- alignItems: contentAlignItems
93
- },
94
- children: [/*#__PURE__*/_jsx(View, {
95
- style: selectImageContainerStyle(contentMaxDimension),
96
- children: /*#__PURE__*/_jsx(Image, {
97
- accessibilityIgnoresInvertColors: true,
98
- imageAccessibilityLabel: imageAccessibilityLabel,
99
- source: imageSource,
100
- style: selectImageStyle(imageDimension)
101
- })
102
- }), /*#__PURE__*/_jsx(Text, {
103
- children: children
104
- })]
105
- })
106
- })
89
+ imageDimension,
90
+ textLine,
91
+ gap,
92
+ ...themeTokens
93
+ } = getTokens({
94
+ viewport,
95
+ hover,
96
+ pressed,
97
+ focus
98
+ });
99
+ const textStyle = { ...applyTextStyles(themeTokens),
100
+ textDecorationLine: textLine
101
+ };
102
+ return /*#__PURE__*/_jsx(View, {
103
+ style: selectContainerStyle({ ...themeTokens,
104
+ contentMaxDimension
105
+ }),
106
+ children: /*#__PURE__*/_jsxs(StackWrap, {
107
+ direction: contentDirection,
108
+ space: contentSpace,
109
+ gap: gap,
110
+ tokens: {
111
+ alignItems: contentAlignItems
112
+ },
113
+ children: [/*#__PURE__*/_jsx(View, {
114
+ style: selectImageContainerStyle(contentMaxDimension),
115
+ children: /*#__PURE__*/_jsx(Image, {
116
+ accessibilityIgnoresInvertColors: true,
117
+ imageAccessibilityLabel: imageAccessibilityLabel,
118
+ source: imageSource,
119
+ style: selectImageStyle(imageDimension)
120
+ })
121
+ }), /*#__PURE__*/_jsx(Text, {
122
+ style: textStyle,
123
+ children: children
124
+ })]
125
+ })
126
+ });
127
+ }
107
128
  });
108
129
  });
109
130
  QuickLinksFeatureItem.displayName = 'QuickLinksFeatureItem';
@@ -78,17 +78,18 @@ const selectKnobStyles = (_ref4, isCompleted, isCurrent) => {
78
78
  height: knobSize,
79
79
  width: knobSize,
80
80
  ...(isCompleted && {
81
- backgroundColor: knobCompletedBackgroundColor,
82
- borderColor: knobCompletedBorderColor,
83
- paddingLeft: knobCompletedPaddingLeft,
84
- paddingTop: knobCompletedPaddingTop
85
- }),
86
- ...(isCurrent && {
87
81
  backgroundColor: knobCurrentBackgroundColor,
88
82
  borderColor: knobCurrentBorderColor,
89
83
  borderWidth: knobCurrentBorderWidth,
90
84
  paddingLeft: knobCurrentPaddingLeft,
91
85
  paddingTop: knobCurrentPaddingTop
86
+ }),
87
+ ...(isCurrent && {
88
+ backgroundColor: knobCompletedBackgroundColor,
89
+ borderColor: knobCompletedBorderColor,
90
+ borderWidth: knobCurrentBorderWidth,
91
+ paddingLeft: knobCompletedPaddingLeft,
92
+ paddingTop: knobCompletedPaddingTop
92
93
  })
93
94
  };
94
95
  };
@@ -110,7 +111,26 @@ const selectLabelContainerStyles = _ref5 => {
110
111
  };
111
112
  };
112
113
 
113
- const selectLabelStyles = (_ref6, themeOptions, isCurrent) => {
114
+ const selectStepLabelStyles = (_ref6, themeOptions, isCurrent) => {
115
+ let {
116
+ stepLabelColor,
117
+ labelCurrentColor,
118
+ stepLabelFontWeight,
119
+ stepLabelFontSize,
120
+ stepLabelFontName,
121
+ stepLabelLineHeight
122
+ } = _ref6;
123
+ return applyTextStyles({
124
+ color: isCurrent ? labelCurrentColor : stepLabelColor,
125
+ fontSize: stepLabelFontSize,
126
+ lineHeight: stepLabelLineHeight,
127
+ fontWeight: stepLabelFontWeight,
128
+ fontName: stepLabelFontName,
129
+ themeOptions
130
+ });
131
+ };
132
+
133
+ const selectLabelStyles = (_ref7, themeOptions, isCurrent) => {
114
134
  let {
115
135
  labelColor,
116
136
  labelCurrentColor,
@@ -119,7 +139,7 @@ const selectLabelStyles = (_ref6, themeOptions, isCurrent) => {
119
139
  labelFontWeight,
120
140
  labelFontName,
121
141
  labelLineHeight
122
- } = _ref6;
142
+ } = _ref7;
123
143
  return applyTextStyles({
124
144
  color: isCurrent ? labelCurrentColor : labelColor,
125
145
  fontSize: labelFontSize,
@@ -146,7 +166,7 @@ const getStepTestID = (isCompleted, isCurrent) => {
146
166
  */
147
167
 
148
168
 
149
- const Step = _ref7 => {
169
+ const Step = _ref8 => {
150
170
  let {
151
171
  label,
152
172
  name,
@@ -155,11 +175,12 @@ const Step = _ref7 => {
155
175
  stepIndex = 0,
156
176
  tokens,
157
177
  ...rest
158
- } = _ref7;
178
+ } = _ref8;
159
179
  const {
160
180
  completedIcon,
161
181
  showStepLabel,
162
182
  showStepName,
183
+ textStepTrackerLabel,
163
184
  ...themeTokens
164
185
  } = tokens;
165
186
  const isFirst = stepIndex === 0;
@@ -193,11 +214,11 @@ const Step = _ref7 => {
193
214
  }), /*#__PURE__*/_jsxs(View, {
194
215
  style: [staticStyles.knob, selectKnobStyles(themeTokens, isCompleted, isCurrent)],
195
216
  testID: getStepTestID(isCompleted, isCurrent),
196
- children: [isCompleted && completedIcon && /*#__PURE__*/_jsx(Icon, {
217
+ children: [(isCompleted && completedIcon || isCurrent && !completedIcon) && /*#__PURE__*/_jsx(View, {
218
+ style: selectCurrentInnerStyles(themeTokens)
219
+ }), isCurrent && completedIcon && /*#__PURE__*/_jsx(Icon, {
197
220
  icon: completedIcon,
198
221
  tokens: selectCompletedIconTokens(themeTokens)
199
- }), isCurrent && /*#__PURE__*/_jsx(View, {
200
- style: selectCurrentInnerStyles(themeTokens)
201
222
  })]
202
223
  }), /*#__PURE__*/_jsx(View, {
203
224
  style: [staticStyles.connector, !isLast && selectConnectorStyles(themeTokens, isCompleted)]
@@ -205,7 +226,7 @@ const Step = _ref7 => {
205
226
  }), showStepLabel && /*#__PURE__*/_jsxs(View, {
206
227
  style: [staticStyles.stepLabelContainer, selectLabelContainerStyles(tokens)],
207
228
  children: [showStepName && /*#__PURE__*/_jsx(Text, {
208
- style: [staticStyles.centeredText, selectLabelStyles(tokens, themeOptions, isCurrent)],
229
+ style: [staticStyles.centeredText, selectStepLabelStyles(tokens, themeOptions, isCurrent)],
209
230
  children: name
210
231
  }), /*#__PURE__*/_jsx(StackView, {
211
232
  direction: "row",
@@ -106,13 +106,16 @@ const StepTracker = /*#__PURE__*/forwardRef((_ref4, ref) => {
106
106
  } = useThemeTokens('StepTracker', tokens, variant, {
107
107
  viewport
108
108
  });
109
+ const {
110
+ textStepTrackerLabel
111
+ } = themeTokens;
109
112
  const getCopy = useCopy({
110
113
  dictionary,
111
114
  copy
112
115
  });
113
- const stepTrackerLabel = showStepTrackerLabel ? getCopy('stepTrackerLabel').replace('%{stepNumber}', current < steps.length ? current + 1 : steps.length).replace('%{stepCount}', steps.length).replace('%{stepLabel}', current < steps.length ? steps[current] : steps[steps.length - 1]) : '';
116
+ const stepTrackerLabel = showStepTrackerLabel ? (typeof copy === 'string' ? getCopy(textStepTrackerLabel ?? 1).stepTrackerLabel : getCopy('stepTrackerLabel')).replace('%{stepNumber}', current < steps.length ? current + 1 : steps.length).replace('%{stepCount}', steps.length).replace('%{stepLabel}', current < steps.length ? steps[current] : steps[steps.length - 1]) : '';
114
117
 
115
- const getStepLabel = index => themeTokens.showStepLabel ? getCopy('stepLabel').replace('%{stepNumber}', index + 1) : '';
118
+ const getStepLabel = index => themeTokens.showStepLabel ? (typeof copy === 'string' ? getCopy(textStepTrackerLabel ?? 1).stepLabel : getCopy('stepLabel')).replace('%{stepNumber}', index + 1) : '';
116
119
 
117
120
  const {
118
121
  themeOptions
@@ -1,10 +1,30 @@
1
1
  export default {
2
2
  en: {
3
- stepLabel: 'Step %{stepNumber}',
4
- stepTrackerLabel: 'Step %{stepNumber} of %{stepCount}: %{stepLabel}'
3
+ 1: {
4
+ stepLabel: 'Step %{stepNumber}',
5
+ stepTrackerLabel: 'Step %{stepNumber} of %{stepCount}: %{stepLabel}'
6
+ },
7
+ 2: {
8
+ stepLabel: '%{stepNumber}.',
9
+ stepTrackerLabel: 'Step %{stepNumber} of %{stepCount}: %{stepLabel}'
10
+ },
11
+ 3: {
12
+ stepLabel: 'Step %{stepNumber}',
13
+ stepTrackerLabel: 'Step %{stepNumber} of %{stepCount}: %{stepLabel}'
14
+ }
5
15
  },
6
16
  fr: {
7
- stepLabel: 'Étape %{stepNumber}',
8
- stepTrackerLabel: 'Étape %{stepNumber} sur %{stepCount}: %{stepLabel}'
17
+ 1: {
18
+ stepLabel: 'Étape %{stepNumber}',
19
+ stepTrackerLabel: 'Étape %{stepNumber} sur %{stepCount}: %{stepLabel}'
20
+ },
21
+ 2: {
22
+ stepLabel: '%{stepNumber}.',
23
+ stepTrackerLabel: 'Étape %{stepNumber} sur %{stepCount}: %{stepLabel}'
24
+ },
25
+ 3: {
26
+ stepLabel: 'Étape %{stepNumber}',
27
+ stepTrackerLabel: 'Étape %{stepNumber} sur %{stepCount}: %{stepLabel}'
28
+ }
9
29
  }
10
30
  };
@@ -5,6 +5,8 @@ import InputSupports from '../InputSupports';
5
5
  import TextInputBase from './TextInputBase';
6
6
  import textInputPropTypes from './propTypes';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { Fragment as _Fragment } from "react/jsx-runtime";
9
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
10
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, inputSupportsProps, textInputHandlerProps, textInputProps, viewProps]);
9
11
  /**
10
12
  * A basic text input component. Use in forms or individually to receive user's input.
@@ -42,21 +44,23 @@ const TextInput = /*#__PURE__*/forwardRef((_ref, ref) => {
42
44
  validation: supportsProps.validation
43
45
  }
44
46
  };
45
- return /*#__PURE__*/_jsx(InputSupports, {
46
- nativeID: nativeID,
47
- ...supportsProps,
48
- children: _ref2 => {
49
- let {
50
- inputId,
51
- ...propsFromInputSupports
52
- } = _ref2;
53
- return /*#__PURE__*/_jsx(TextInputBase, {
54
- ref: ref,
55
- nativeID: inputId,
56
- ...propsFromInputSupports,
57
- ...inputProps
58
- });
59
- }
47
+ return /*#__PURE__*/_jsxs(_Fragment, {
48
+ children: [/*#__PURE__*/_jsx(InputSupports, {
49
+ nativeID: nativeID,
50
+ ...supportsProps,
51
+ children: _ref2 => {
52
+ let {
53
+ inputId,
54
+ ...propsFromInputSupports
55
+ } = _ref2;
56
+ return /*#__PURE__*/_jsx(TextInputBase, {
57
+ ref: ref,
58
+ nativeID: inputId,
59
+ ...propsFromInputSupports,
60
+ ...inputProps
61
+ });
62
+ }
63
+ }), rest.children]
60
64
  });
61
65
  });
62
66
  TextInput.displayName = 'TextInput';
@@ -1,4 +1,4 @@
1
- import React, { createContext, useState } from 'react';
1
+ import React, { createContext, useEffect, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { validateThemeTokensVersion } from './utils';
4
4
  import responsiveProps from '../utils/props/responsiveProps';
@@ -24,6 +24,11 @@ const ThemeProvider = _ref => {
24
24
  themeOptions = {}
25
25
  } = _ref;
26
26
  const [theme, setTheme] = useState(defaultTheme);
27
+ useEffect(() => {
28
+ if (theme.metadata.name !== defaultTheme.metadata.name) {
29
+ setTheme(defaultTheme);
30
+ }
31
+ }, [theme.metadata.name, defaultTheme]);
27
32
  const appliedThemeOptions = { ...defaultThemeOptions,
28
33
  ...themeOptions
29
34
  }; // Validate the theme tokens version on every render.
@@ -46,7 +51,8 @@ ThemeProvider.propTypes = {
46
51
  children: PropTypes.node.isRequired,
47
52
  defaultTheme: PropTypes.shape({
48
53
  metadata: PropTypes.shape({
49
- themeTokensVersion: PropTypes.string.isRequired
54
+ themeTokensVersion: PropTypes.string.isRequired,
55
+ name: PropTypes.string.isRequired
50
56
  }).isRequired
51
57
  }).isRequired,
52
58