@telus-uds/components-base 1.87.0 → 1.89.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 CHANGED
@@ -1,12 +1,41 @@
1
1
  # Change Log - @telus-uds/components-base
2
2
 
3
- This log was last generated on Mon, 24 Jun 2024 16:19:28 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 19 Jul 2024 18:14:09 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.89.0
8
+
9
+ Fri, 19 Jul 2024 18:14:09 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - `PriceLockup`: Add `micro` option to `size` variant (tim.hysniu@telus.com)
14
+ - Add type definitions for `Checkbox` and `CheckboxCardGroup` (evander.owusu@telus.com)
15
+
16
+ ### Patches
17
+
18
+ - `Carousel`: add accessibilityLabel to autoplay button to resolve accessibility issue (<tony.eng@telus.com>)
19
+ - `TextInput`: make feedback tokens and props work (guillermo.peitzner@telus.com)
20
+ - `CarouselTabsPanel`: add accessibilityRole to resolve accessibility issue (<tony.eng@telus.com>)
21
+
22
+ ## 1.88.0
23
+
24
+ Thu, 04 Jul 2024 19:35:15 GMT
25
+
26
+ ### Minor changes
27
+
28
+ - Add data masking to validator component (Mauricio.BatresMontejo@telus.com)
29
+ - Bump @telus-uds/system-theme-tokens to v2.59.0
30
+
31
+ ### Patches
32
+
33
+ - Remove label like unique field in RadioGroup component (Mauricio.BatresMontejo@telus.com)
34
+ - `OrderedList`: fix numbered text alignment (guillermo.peitzner@telus.com)
35
+
7
36
  ## 1.87.0
8
37
 
9
- Mon, 24 Jun 2024 16:19:28 GMT
38
+ Mon, 24 Jun 2024 16:28:34 GMT
10
39
 
11
40
  ### Minor changes
12
41
 
@@ -610,6 +610,7 @@ const Carousel = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
610
610
  })],
611
611
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
612
612
  icon: isCarouselPlaying ? pauseIcon : playIcon,
613
+ accessibilityLabel: isCarouselPlaying ? getCopy('pauseButtonLabel') : getCopy('playButtonLabel'),
613
614
  variant: previousNextIconButtonVariants,
614
615
  onPress: onAnimationControlButtonPress
615
616
  })
@@ -50,6 +50,7 @@ const CarouselTabsPanel = /*#__PURE__*/_react.default.forwardRef((_ref, ref) =>
50
50
  variant: dividerVariant
51
51
  },
52
52
  ref: ref,
53
+ accessibilityRole: "tablist",
53
54
  children: items.map((_ref2, index) => {
54
55
  let {
55
56
  title,
@@ -11,7 +11,9 @@ var _default = {
11
11
  iconButtonLabel: 'Show %{itemLabel} %{targetStep} of %{stepCount}',
12
12
  stepLabel: '%{itemLabel} %{stepNumber}',
13
13
  stepTrackerLabel: '%{itemLabel} %{stepNumber} of %{stepCount}',
14
- skipLink: 'Skip %{title}'
14
+ skipLink: 'Skip %{title}',
15
+ playButtonLabel: 'Play',
16
+ pauseButtonLabel: 'Pause'
15
17
  },
16
18
  fr: {
17
19
  // French translations
@@ -19,7 +21,9 @@ var _default = {
19
21
  iconButtonLabel: 'Montrer %{itemLabel} %{targetStep} de %{stepCount}',
20
22
  stepLabel: '%{itemLabel} %{stepNumber}',
21
23
  stepTrackerLabel: '%{itemLabel} %{stepNumber} de %{stepCount}',
22
- skipLink: 'Passer %{title}'
24
+ skipLink: 'Passer %{title}',
25
+ playButtonLabel: 'Lancer',
26
+ pauseButtonLabel: 'Pauser'
23
27
  }
24
28
  };
25
29
  exports.default = _default;
@@ -23,6 +23,7 @@ const InputSupports = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
23
23
  hintPosition = 'inline',
24
24
  feedback,
25
25
  feedbackTokens = {},
26
+ feedbackProps = {},
26
27
  tooltip,
27
28
  validation,
28
29
  nativeID
@@ -60,7 +61,8 @@ const InputSupports = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
60
61
  id: feedbackId,
61
62
  title: feedback,
62
63
  validation: validation,
63
- tokens: feedbackTokens
64
+ tokens: feedbackTokens,
65
+ ...feedbackProps
64
66
  }) : null]
65
67
  });
66
68
  });
@@ -92,6 +94,10 @@ InputSupports.propTypes = {
92
94
  * Additional tokens to override the default feedback tokens.
93
95
  */
94
96
  feedbackTokens: (0, _utils.getTokensPropType)('Feedback'),
97
+ /**
98
+ * Additional props to pass to the `Feedback` component.
99
+ */
100
+ feedbackProps: _propTypes.default.object,
95
101
  /**
96
102
  * Content of an optional `Tooltip`. If set, a tooltip button will be shown next to the label.
97
103
  */
@@ -10,7 +10,6 @@ var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Vi
10
10
  var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
11
11
  var _utils = require("../utils");
12
12
  var _ThemeProvider = require("../ThemeProvider");
13
- var _StackView = _interopRequireDefault(require("../StackView"));
14
13
  var _Typography = _interopRequireDefault(require("../Typography"));
15
14
  var _ItemBase = _interopRequireDefault(require("./ItemBase"));
16
15
  var _jsxRuntime = require("react/jsx-runtime");
@@ -36,20 +35,18 @@ const selectItemTextStyles = (_ref, themeOptions) => {
36
35
  const selectItemCounterStyles = _ref2 => {
37
36
  let {
38
37
  itemBulletContainerWidth,
39
- itemBulletContainerAlign,
38
+ itemBulletTextAlign,
40
39
  itemFontWeight,
41
40
  itemFontSize,
42
41
  itemFontName,
43
42
  itemLineHeight,
44
43
  themeOptions,
45
- listGutter,
46
44
  itemColor
47
45
  } = _ref2;
48
46
  return {
49
47
  color: itemColor,
50
48
  width: itemBulletContainerWidth,
51
- paddingRight: listGutter,
52
- textAlign: itemBulletContainerAlign,
49
+ textAlign: itemBulletTextAlign,
53
50
  ...(0, _ThemeProvider.applyTextStyles)({
54
51
  fontWeight: itemFontWeight,
55
52
  fontSize: itemFontSize,
@@ -62,10 +59,12 @@ const selectItemCounterStyles = _ref2 => {
62
59
  const selectItemContentStyles = (_ref3, isLastChild) => {
63
60
  let {
64
61
  interItemMargin,
62
+ listGutter,
65
63
  ...themeTokens
66
64
  } = _ref3;
67
65
  return {
68
66
  ...themeTokens,
67
+ marginLeft: listGutter,
69
68
  marginBottom: !isLastChild ? interItemMargin : 0
70
69
  };
71
70
  };
@@ -106,27 +105,19 @@ const Item = /*#__PURE__*/_react.default.forwardRef((_ref4, ref) => {
106
105
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
107
106
  style: [staticStyles.itemCounter, selectItemCounterStyles(themeTokens)],
108
107
  children: itemCounter
109
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
110
- style: staticStyles.itemContent,
111
- children: title ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StackView.default, {
112
- tokens: {
113
- flexShrink: 1
114
- },
115
- space: 0,
116
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
108
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
109
+ style: [staticStyles.itemContent, selectItemContentStyles(themeTokens, isLastChild)],
110
+ children: [title && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
111
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
117
112
  variant: {
118
113
  size: 'h4'
119
114
  },
120
115
  tokens: headingTokens,
121
116
  children: title
122
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
123
- style: selectItemContentStyles(themeTokens, isLastChild),
124
- children: itemContent
125
- })]
126
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
127
- style: selectItemContentStyles(themeTokens, isLastChild),
117
+ })
118
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
128
119
  children: itemContent
129
- })
120
+ })]
130
121
  })]
131
122
  });
132
123
  });
@@ -162,13 +153,13 @@ var _default = Item;
162
153
  exports.default = _default;
163
154
  const staticStyles = _StyleSheet.default.create({
164
155
  container: {
156
+ flex: 1,
165
157
  flexDirection: 'row'
166
158
  },
167
159
  itemCounter: {
168
- flexWrap: 'wrap'
160
+ alignItems: 'flex-end'
169
161
  },
170
162
  itemContent: {
171
- flexDirection: 'column',
172
- marginLeft: 8
163
+ flexShrink: 1
173
164
  }
174
165
  });
@@ -121,7 +121,7 @@ const RadioGroup = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
121
121
  onChange,
122
122
  readOnly: readOnly || inactive
123
123
  });
124
- const uniqueFields = ['id', 'label'];
124
+ const uniqueFields = ['id'];
125
125
  if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
126
126
  throw new Error(`RadioGroup items must have unique ${uniqueFields.join(', ')}`);
127
127
  }
@@ -32,6 +32,7 @@ const Validator = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
32
32
  let {
33
33
  value = '',
34
34
  inactive,
35
+ mask = '',
35
36
  onChange,
36
37
  tokens = {},
37
38
  variant = {},
@@ -77,32 +78,36 @@ const Validator = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
77
78
  [codeId]: val
78
79
  });
79
80
  };
81
+ const changeDataMasking = boxElement => {
82
+ let charMasking = '';
83
+ const element = boxElement;
84
+ if (mask && mask.length === 1) charMasking = mask;else if (mask && mask.length > 1) charMasking = mask.substring(0, 1);
85
+ if (charMasking) element.value = charMasking;
86
+ };
80
87
  const handleChangeCode = () => {
81
88
  let code = '';
82
89
  for (let i = 0; i < validatorsLength; i += 1) code += singleCodes[prefix + i];
83
90
  if (typeof onChange === 'function') onChange(code, singleCodes);
84
91
  };
85
92
  const handleChangeCodeValues = (event, codeId, nextIndex) => {
86
- var _codeReferences$codeI, _event$nativeEvent, _event$target, _codeElement$value, _codeElement$value2;
93
+ var _codeReferences$codeI, _event$nativeEvent, _event$target, _codeElement$value;
87
94
  const codeElement = (_codeReferences$codeI = codeReferences[codeId]) === null || _codeReferences$codeI === void 0 ? void 0 : _codeReferences$codeI.current;
88
95
  const val = ((_event$nativeEvent = event.nativeEvent) === null || _event$nativeEvent === void 0 ? void 0 : _event$nativeEvent.value) || ((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value);
89
96
  if (Number(val).toString() === 'NaN') {
90
97
  codeElement.value = singleCodes[codeId] ?? '';
91
98
  return;
92
99
  }
93
- if ((codeElement === null || codeElement === void 0 ? void 0 : (_codeElement$value = codeElement.value) === null || _codeElement$value === void 0 ? void 0 : _codeElement$value.length) > 1) {
94
- const oldValue = singleCodes[codeId];
95
- const newValue = codeElement.value.replace(oldValue, '');
96
- codeElement.value = newValue;
97
- handleSingleCodes(codeId, codeElement.value, 'success');
98
- }
99
100
  handleSingleCodes(codeId, (codeElement === null || codeElement === void 0 ? void 0 : codeElement.value) ?? singleCodes[codeId], 'success');
100
101
  handleChangeCode();
101
102
  if (nextIndex === validatorsLength) {
102
103
  codeElement.blur();
104
+ changeDataMasking(codeElement);
103
105
  return;
104
106
  }
105
- if ((codeElement === null || codeElement === void 0 ? void 0 : (_codeElement$value2 = codeElement.value) === null || _codeElement$value2 === void 0 ? void 0 : _codeElement$value2.length) > 0) codeReferences[prefix + nextIndex].current.focus();
107
+ if ((codeElement === null || codeElement === void 0 ? void 0 : (_codeElement$value = codeElement.value) === null || _codeElement$value === void 0 ? void 0 : _codeElement$value.length) > 0) {
108
+ codeReferences[prefix + nextIndex].current.focus();
109
+ changeDataMasking(codeElement);
110
+ }
106
111
  };
107
112
  const handleKeyPress = (event, currentIndex, previousIndex) => {
108
113
  if (!(event.keyCode === 8 || event.code === 'Backspace')) return;
@@ -150,7 +155,7 @@ const Validator = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
150
155
  /* eslint-disable react-hooks/exhaustive-deps */
151
156
  _react.default.useEffect(() => {
152
157
  for (let i = 0; i < validatorsLength; i += 1) {
153
- codeReferences[prefix + i].current.value = text[i] ?? '';
158
+ if (mask && text[i]) codeReferences[prefix + i].current.value = mask;else codeReferences[prefix + i].current.value = text[i] ?? '';
154
159
  handleSingleCodes(prefix + i, text[i] ?? '', text[i] ? 'success' : '');
155
160
  }
156
161
  }, [text]);
@@ -207,6 +212,10 @@ Validator.propTypes = {
207
212
  * If true, the component is inactive and non editable.
208
213
  */
209
214
  inactive: _propTypes.default.bool,
215
+ /**
216
+ * Show masked characters and obscure the actual input. For example: '*'
217
+ */
218
+ mask: _propTypes.default.string,
210
219
  /**
211
220
  * Use to react upon input's value changes. Required when the `value` prop is set. Will receive the input's value as an argument.
212
221
  */
@@ -29,6 +29,14 @@ var _default = {
29
29
  * Visual variant is determined based on the `validation` prop.
30
30
  */
31
31
  feedback: _propTypes.default.string,
32
+ /**
33
+ * Tokens to be passed to the feedback component.
34
+ */
35
+ feedbackTokens: _propTypes.default.object,
36
+ /**
37
+ * Props to be passed to the feedback component.
38
+ */
39
+ feedbackProps: _propTypes.default.object,
32
40
  /**
33
41
  * Content of an optional `Tooltip`. If set, a tooltip button will be shown next to the label.
34
42
  */
@@ -45,6 +53,8 @@ var _default = {
45
53
  hint,
46
54
  hintPosition,
47
55
  feedback,
56
+ feedbackTokens,
57
+ feedbackProps,
48
58
  tooltip,
49
59
  validation
50
60
  } = _ref;
@@ -55,6 +65,8 @@ var _default = {
55
65
  hint,
56
66
  hintPosition,
57
67
  feedback,
68
+ feedbackTokens,
69
+ feedbackProps,
58
70
  tooltip,
59
71
  validation
60
72
  }
@@ -604,6 +604,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
604
604
  })],
605
605
  children: /*#__PURE__*/_jsx(IconButton, {
606
606
  icon: isCarouselPlaying ? pauseIcon : playIcon,
607
+ accessibilityLabel: isCarouselPlaying ? getCopy('pauseButtonLabel') : getCopy('playButtonLabel'),
607
608
  variant: previousNextIconButtonVariants,
608
609
  onPress: onAnimationControlButtonPress
609
610
  })
@@ -44,6 +44,7 @@ const CarouselTabsPanel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
44
44
  variant: dividerVariant
45
45
  },
46
46
  ref: ref,
47
+ accessibilityRole: "tablist",
47
48
  children: items.map((_ref2, index) => {
48
49
  let {
49
50
  title,
@@ -5,7 +5,9 @@ export default {
5
5
  iconButtonLabel: 'Show %{itemLabel} %{targetStep} of %{stepCount}',
6
6
  stepLabel: '%{itemLabel} %{stepNumber}',
7
7
  stepTrackerLabel: '%{itemLabel} %{stepNumber} of %{stepCount}',
8
- skipLink: 'Skip %{title}'
8
+ skipLink: 'Skip %{title}',
9
+ playButtonLabel: 'Play',
10
+ pauseButtonLabel: 'Pause'
9
11
  },
10
12
  fr: {
11
13
  // French translations
@@ -13,6 +15,8 @@ export default {
13
15
  iconButtonLabel: 'Montrer %{itemLabel} %{targetStep} de %{stepCount}',
14
16
  stepLabel: '%{itemLabel} %{stepNumber}',
15
17
  stepTrackerLabel: '%{itemLabel} %{stepNumber} de %{stepCount}',
16
- skipLink: 'Passer %{title}'
18
+ skipLink: 'Passer %{title}',
19
+ playButtonLabel: 'Lancer',
20
+ pauseButtonLabel: 'Pauser'
17
21
  }
18
22
  };
@@ -17,6 +17,7 @@ const InputSupports = /*#__PURE__*/React.forwardRef((_ref, ref) => {
17
17
  hintPosition = 'inline',
18
18
  feedback,
19
19
  feedbackTokens = {},
20
+ feedbackProps = {},
20
21
  tooltip,
21
22
  validation,
22
23
  nativeID
@@ -54,7 +55,8 @@ const InputSupports = /*#__PURE__*/React.forwardRef((_ref, ref) => {
54
55
  id: feedbackId,
55
56
  title: feedback,
56
57
  validation: validation,
57
- tokens: feedbackTokens
58
+ tokens: feedbackTokens,
59
+ ...feedbackProps
58
60
  }) : null]
59
61
  });
60
62
  });
@@ -86,6 +88,10 @@ InputSupports.propTypes = {
86
88
  * Additional tokens to override the default feedback tokens.
87
89
  */
88
90
  feedbackTokens: getTokensPropType('Feedback'),
91
+ /**
92
+ * Additional props to pass to the `Feedback` component.
93
+ */
94
+ feedbackProps: PropTypes.object,
89
95
  /**
90
96
  * Content of an optional `Tooltip`. If set, a tooltip button will be shown next to the label.
91
97
  */
@@ -4,7 +4,6 @@ import View from "react-native-web/dist/exports/View";
4
4
  import StyleSheet from "react-native-web/dist/exports/StyleSheet";
5
5
  import { getTokensPropType, htmlAttrs, selectSystemProps, variantProp, viewProps, wrapStringsInText } from '../utils';
6
6
  import { applyTextStyles, useTheme, useThemeTokens } from '../ThemeProvider';
7
- import StackView from '../StackView';
8
7
  import Typography from '../Typography';
9
8
  import ItemBase from './ItemBase';
10
9
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -30,20 +29,18 @@ const selectItemTextStyles = (_ref, themeOptions) => {
30
29
  const selectItemCounterStyles = _ref2 => {
31
30
  let {
32
31
  itemBulletContainerWidth,
33
- itemBulletContainerAlign,
32
+ itemBulletTextAlign,
34
33
  itemFontWeight,
35
34
  itemFontSize,
36
35
  itemFontName,
37
36
  itemLineHeight,
38
37
  themeOptions,
39
- listGutter,
40
38
  itemColor
41
39
  } = _ref2;
42
40
  return {
43
41
  color: itemColor,
44
42
  width: itemBulletContainerWidth,
45
- paddingRight: listGutter,
46
- textAlign: itemBulletContainerAlign,
43
+ textAlign: itemBulletTextAlign,
47
44
  ...applyTextStyles({
48
45
  fontWeight: itemFontWeight,
49
46
  fontSize: itemFontSize,
@@ -56,10 +53,12 @@ const selectItemCounterStyles = _ref2 => {
56
53
  const selectItemContentStyles = (_ref3, isLastChild) => {
57
54
  let {
58
55
  interItemMargin,
56
+ listGutter,
59
57
  ...themeTokens
60
58
  } = _ref3;
61
59
  return {
62
60
  ...themeTokens,
61
+ marginLeft: listGutter,
63
62
  marginBottom: !isLastChild ? interItemMargin : 0
64
63
  };
65
64
  };
@@ -100,27 +99,19 @@ const Item = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
100
99
  children: [/*#__PURE__*/_jsx(View, {
101
100
  style: [staticStyles.itemCounter, selectItemCounterStyles(themeTokens)],
102
101
  children: itemCounter
103
- }), /*#__PURE__*/_jsx(View, {
104
- style: staticStyles.itemContent,
105
- children: title ? /*#__PURE__*/_jsxs(StackView, {
106
- tokens: {
107
- flexShrink: 1
108
- },
109
- space: 0,
110
- children: [/*#__PURE__*/_jsx(Typography, {
102
+ }), /*#__PURE__*/_jsxs(View, {
103
+ style: [staticStyles.itemContent, selectItemContentStyles(themeTokens, isLastChild)],
104
+ children: [title && /*#__PURE__*/_jsx(View, {
105
+ children: /*#__PURE__*/_jsx(Typography, {
111
106
  variant: {
112
107
  size: 'h4'
113
108
  },
114
109
  tokens: headingTokens,
115
110
  children: title
116
- }), /*#__PURE__*/_jsx(View, {
117
- style: selectItemContentStyles(themeTokens, isLastChild),
118
- children: itemContent
119
- })]
120
- }) : /*#__PURE__*/_jsx(View, {
121
- style: selectItemContentStyles(themeTokens, isLastChild),
111
+ })
112
+ }), /*#__PURE__*/_jsx(View, {
122
113
  children: itemContent
123
- })
114
+ })]
124
115
  })]
125
116
  });
126
117
  });
@@ -155,13 +146,13 @@ Item.displayName = 'OrderedListItem';
155
146
  export default Item;
156
147
  const staticStyles = StyleSheet.create({
157
148
  container: {
149
+ flex: 1,
158
150
  flexDirection: 'row'
159
151
  },
160
152
  itemCounter: {
161
- flexWrap: 'wrap'
153
+ alignItems: 'flex-end'
162
154
  },
163
155
  itemContent: {
164
- flexDirection: 'column',
165
- marginLeft: 8
156
+ flexShrink: 1
166
157
  }
167
158
  });
@@ -114,7 +114,7 @@ const RadioGroup = /*#__PURE__*/React.forwardRef((_ref, ref) => {
114
114
  onChange,
115
115
  readOnly: readOnly || inactive
116
116
  });
117
- const uniqueFields = ['id', 'label'];
117
+ const uniqueFields = ['id'];
118
118
  if (!containUniqueFields(items, uniqueFields)) {
119
119
  throw new Error(`RadioGroup items must have unique ${uniqueFields.join(', ')}`);
120
120
  }
@@ -25,6 +25,7 @@ const Validator = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
25
25
  let {
26
26
  value = '',
27
27
  inactive,
28
+ mask = '',
28
29
  onChange,
29
30
  tokens = {},
30
31
  variant = {},
@@ -70,32 +71,36 @@ const Validator = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
70
71
  [codeId]: val
71
72
  });
72
73
  };
74
+ const changeDataMasking = boxElement => {
75
+ let charMasking = '';
76
+ const element = boxElement;
77
+ if (mask && mask.length === 1) charMasking = mask;else if (mask && mask.length > 1) charMasking = mask.substring(0, 1);
78
+ if (charMasking) element.value = charMasking;
79
+ };
73
80
  const handleChangeCode = () => {
74
81
  let code = '';
75
82
  for (let i = 0; i < validatorsLength; i += 1) code += singleCodes[prefix + i];
76
83
  if (typeof onChange === 'function') onChange(code, singleCodes);
77
84
  };
78
85
  const handleChangeCodeValues = (event, codeId, nextIndex) => {
79
- var _codeReferences$codeI, _event$nativeEvent, _event$target, _codeElement$value, _codeElement$value2;
86
+ var _codeReferences$codeI, _event$nativeEvent, _event$target, _codeElement$value;
80
87
  const codeElement = (_codeReferences$codeI = codeReferences[codeId]) === null || _codeReferences$codeI === void 0 ? void 0 : _codeReferences$codeI.current;
81
88
  const val = ((_event$nativeEvent = event.nativeEvent) === null || _event$nativeEvent === void 0 ? void 0 : _event$nativeEvent.value) || ((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value);
82
89
  if (Number(val).toString() === 'NaN') {
83
90
  codeElement.value = singleCodes[codeId] ?? '';
84
91
  return;
85
92
  }
86
- if ((codeElement === null || codeElement === void 0 ? void 0 : (_codeElement$value = codeElement.value) === null || _codeElement$value === void 0 ? void 0 : _codeElement$value.length) > 1) {
87
- const oldValue = singleCodes[codeId];
88
- const newValue = codeElement.value.replace(oldValue, '');
89
- codeElement.value = newValue;
90
- handleSingleCodes(codeId, codeElement.value, 'success');
91
- }
92
93
  handleSingleCodes(codeId, (codeElement === null || codeElement === void 0 ? void 0 : codeElement.value) ?? singleCodes[codeId], 'success');
93
94
  handleChangeCode();
94
95
  if (nextIndex === validatorsLength) {
95
96
  codeElement.blur();
97
+ changeDataMasking(codeElement);
96
98
  return;
97
99
  }
98
- if ((codeElement === null || codeElement === void 0 ? void 0 : (_codeElement$value2 = codeElement.value) === null || _codeElement$value2 === void 0 ? void 0 : _codeElement$value2.length) > 0) codeReferences[prefix + nextIndex].current.focus();
100
+ if ((codeElement === null || codeElement === void 0 ? void 0 : (_codeElement$value = codeElement.value) === null || _codeElement$value === void 0 ? void 0 : _codeElement$value.length) > 0) {
101
+ codeReferences[prefix + nextIndex].current.focus();
102
+ changeDataMasking(codeElement);
103
+ }
99
104
  };
100
105
  const handleKeyPress = (event, currentIndex, previousIndex) => {
101
106
  if (!(event.keyCode === 8 || event.code === 'Backspace')) return;
@@ -143,7 +148,7 @@ const Validator = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
143
148
  /* eslint-disable react-hooks/exhaustive-deps */
144
149
  React.useEffect(() => {
145
150
  for (let i = 0; i < validatorsLength; i += 1) {
146
- codeReferences[prefix + i].current.value = text[i] ?? '';
151
+ if (mask && text[i]) codeReferences[prefix + i].current.value = mask;else codeReferences[prefix + i].current.value = text[i] ?? '';
147
152
  handleSingleCodes(prefix + i, text[i] ?? '', text[i] ? 'success' : '');
148
153
  }
149
154
  }, [text]);
@@ -200,6 +205,10 @@ Validator.propTypes = {
200
205
  * If true, the component is inactive and non editable.
201
206
  */
202
207
  inactive: PropTypes.bool,
208
+ /**
209
+ * Show masked characters and obscure the actual input. For example: '*'
210
+ */
211
+ mask: PropTypes.string,
203
212
  /**
204
213
  * Use to react upon input's value changes. Required when the `value` prop is set. Will receive the input's value as an argument.
205
214
  */
@@ -22,6 +22,14 @@ export default {
22
22
  * Visual variant is determined based on the `validation` prop.
23
23
  */
24
24
  feedback: PropTypes.string,
25
+ /**
26
+ * Tokens to be passed to the feedback component.
27
+ */
28
+ feedbackTokens: PropTypes.object,
29
+ /**
30
+ * Props to be passed to the feedback component.
31
+ */
32
+ feedbackProps: PropTypes.object,
25
33
  /**
26
34
  * Content of an optional `Tooltip`. If set, a tooltip button will be shown next to the label.
27
35
  */
@@ -38,6 +46,8 @@ export default {
38
46
  hint,
39
47
  hintPosition,
40
48
  feedback,
49
+ feedbackTokens,
50
+ feedbackProps,
41
51
  tooltip,
42
52
  validation
43
53
  } = _ref;
@@ -48,6 +58,8 @@ export default {
48
58
  hint,
49
59
  hintPosition,
50
60
  feedback,
61
+ feedbackTokens,
62
+ feedbackProps,
51
63
  tooltip,
52
64
  validation
53
65
  }
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "@floating-ui/react-native": "^0.8.1",
12
12
  "@gorhom/portal": "^1.0.14",
13
13
  "@telus-uds/system-constants": "^1.3.0",
14
- "@telus-uds/system-theme-tokens": "^2.58.0",
14
+ "@telus-uds/system-theme-tokens": "^2.59.0",
15
15
  "airbnb-prop-types": "^2.16.0",
16
16
  "css-mediaquery": "^0.1.2",
17
17
  "expo-linear-gradient": "^12.5.0",
@@ -85,6 +85,6 @@
85
85
  "standard-engine": {
86
86
  "skip": true
87
87
  },
88
- "version": "1.87.0",
88
+ "version": "1.89.0",
89
89
  "types": "types/index.d.ts"
90
90
  }
@@ -687,6 +687,9 @@ const Carousel = React.forwardRef(
687
687
  >
688
688
  <IconButton
689
689
  icon={isCarouselPlaying ? pauseIcon : playIcon}
690
+ accessibilityLabel={
691
+ isCarouselPlaying ? getCopy('pauseButtonLabel') : getCopy('playButtonLabel')
692
+ }
690
693
  variant={previousNextIconButtonVariants}
691
694
  onPress={onAnimationControlButtonPress}
692
695
  />
@@ -32,7 +32,13 @@ const CarouselTabsPanel = React.forwardRef(({ items }, ref) => {
32
32
 
33
33
  return (
34
34
  <View style={selectTabPanelStyle()}>
35
- <StackView direction="row" space={3} divider={{ variant: dividerVariant }} ref={ref}>
35
+ <StackView
36
+ direction="row"
37
+ space={3}
38
+ divider={{ variant: dividerVariant }}
39
+ ref={ref}
40
+ accessibilityRole="tablist"
41
+ >
36
42
  {items.map(({ title, onPress, inverse, ...panelItemProps }, index) => {
37
43
  const selected = index === activeIndex
38
44
  const isNext = index === activeIndex + 1
@@ -5,7 +5,9 @@ export default {
5
5
  iconButtonLabel: 'Show %{itemLabel} %{targetStep} of %{stepCount}',
6
6
  stepLabel: '%{itemLabel} %{stepNumber}',
7
7
  stepTrackerLabel: '%{itemLabel} %{stepNumber} of %{stepCount}',
8
- skipLink: 'Skip %{title}'
8
+ skipLink: 'Skip %{title}',
9
+ playButtonLabel: 'Play',
10
+ pauseButtonLabel: 'Pause'
9
11
  },
10
12
  fr: {
11
13
  // French translations
@@ -13,6 +15,8 @@ export default {
13
15
  iconButtonLabel: 'Montrer %{itemLabel} %{targetStep} de %{stepCount}',
14
16
  stepLabel: '%{itemLabel} %{stepNumber}',
15
17
  stepTrackerLabel: '%{itemLabel} %{stepNumber} de %{stepCount}',
16
- skipLink: 'Passer %{title}'
18
+ skipLink: 'Passer %{title}',
19
+ playButtonLabel: 'Lancer',
20
+ pauseButtonLabel: 'Pauser'
17
21
  }
18
22
  }
@@ -18,6 +18,7 @@ const InputSupports = React.forwardRef(
18
18
  hintPosition = 'inline',
19
19
  feedback,
20
20
  feedbackTokens = {},
21
+ feedbackProps = {},
21
22
  tooltip,
22
23
  validation,
23
24
  nativeID
@@ -54,6 +55,7 @@ const InputSupports = React.forwardRef(
54
55
  title={feedback}
55
56
  validation={validation}
56
57
  tokens={feedbackTokens}
58
+ {...feedbackProps}
57
59
  />
58
60
  ) : null}
59
61
  </StackView>
@@ -89,6 +91,10 @@ InputSupports.propTypes = {
89
91
  * Additional tokens to override the default feedback tokens.
90
92
  */
91
93
  feedbackTokens: getTokensPropType('Feedback'),
94
+ /**
95
+ * Additional props to pass to the `Feedback` component.
96
+ */
97
+ feedbackProps: PropTypes.object,
92
98
  /**
93
99
  * Content of an optional `Tooltip`. If set, a tooltip button will be shown next to the label.
94
100
  */
@@ -11,7 +11,6 @@ import {
11
11
  wrapStringsInText
12
12
  } from '../utils'
13
13
  import { applyTextStyles, useTheme, useThemeTokens } from '../ThemeProvider'
14
- import StackView from '../StackView'
15
14
  import Typography from '../Typography'
16
15
  import ItemBase from './ItemBase'
17
16
 
@@ -32,19 +31,17 @@ const selectItemTextStyles = (
32
31
 
33
32
  const selectItemCounterStyles = ({
34
33
  itemBulletContainerWidth,
35
- itemBulletContainerAlign,
34
+ itemBulletTextAlign,
36
35
  itemFontWeight,
37
36
  itemFontSize,
38
37
  itemFontName,
39
38
  itemLineHeight,
40
39
  themeOptions,
41
- listGutter,
42
40
  itemColor
43
41
  }) => ({
44
42
  color: itemColor,
45
43
  width: itemBulletContainerWidth,
46
- paddingRight: listGutter,
47
- textAlign: itemBulletContainerAlign,
44
+ textAlign: itemBulletTextAlign,
48
45
  ...applyTextStyles({
49
46
  fontWeight: itemFontWeight,
50
47
  fontSize: itemFontSize,
@@ -54,8 +51,9 @@ const selectItemCounterStyles = ({
54
51
  lineHeight: itemLineHeight * itemFontSize
55
52
  })
56
53
 
57
- const selectItemContentStyles = ({ interItemMargin, ...themeTokens }, isLastChild) => ({
54
+ const selectItemContentStyles = ({ interItemMargin, listGutter, ...themeTokens }, isLastChild) => ({
58
55
  ...themeTokens,
56
+ marginLeft: listGutter,
59
57
  marginBottom: !isLastChild ? interItemMargin : 0
60
58
  })
61
59
 
@@ -87,17 +85,15 @@ const Item = React.forwardRef(
87
85
  <View style={[staticStyles.itemCounter, selectItemCounterStyles(themeTokens)]}>
88
86
  {itemCounter}
89
87
  </View>
90
- <View style={staticStyles.itemContent}>
91
- {title ? (
92
- <StackView tokens={{ flexShrink: 1 }} space={0}>
88
+ <View style={[staticStyles.itemContent, selectItemContentStyles(themeTokens, isLastChild)]}>
89
+ {title && (
90
+ <View>
93
91
  <Typography variant={{ size: 'h4' }} tokens={headingTokens}>
94
92
  {title}
95
93
  </Typography>
96
- <View style={selectItemContentStyles(themeTokens, isLastChild)}>{itemContent}</View>
97
- </StackView>
98
- ) : (
99
- <View style={selectItemContentStyles(themeTokens, isLastChild)}>{itemContent}</View>
94
+ </View>
100
95
  )}
96
+ <View>{itemContent}</View>
101
97
  </View>
102
98
  </ItemBase>
103
99
  )
@@ -138,13 +134,13 @@ export default Item
138
134
 
139
135
  const staticStyles = StyleSheet.create({
140
136
  container: {
137
+ flex: 1,
141
138
  flexDirection: 'row'
142
139
  },
143
140
  itemCounter: {
144
- flexWrap: 'wrap'
141
+ alignItems: 'flex-end'
145
142
  },
146
143
  itemContent: {
147
- flexDirection: 'column',
148
- marginLeft: 8
144
+ flexShrink: 1
149
145
  }
150
146
  })
@@ -131,7 +131,7 @@ const RadioGroup = React.forwardRef(
131
131
  readOnly: readOnly || inactive
132
132
  })
133
133
 
134
- const uniqueFields = ['id', 'label']
134
+ const uniqueFields = ['id']
135
135
  if (!containUniqueFields(items, uniqueFields)) {
136
136
  throw new Error(`RadioGroup items must have unique ${uniqueFields.join(', ')}`)
137
137
  }
@@ -18,7 +18,7 @@ const selectCodeTextInputTokens = ({ outerBorderColor, outerBackgroundColor }) =
18
18
  }
19
19
 
20
20
  const Validator = React.forwardRef(
21
- ({ value = '', inactive, onChange, tokens = {}, variant = {}, ...rest }, ref) => {
21
+ ({ value = '', inactive, mask = '', onChange, tokens = {}, variant = {}, ...rest }, ref) => {
22
22
  const defaultRef = React.useRef()
23
23
  const codeRef = ref ?? defaultRef
24
24
 
@@ -62,6 +62,15 @@ const Validator = React.forwardRef(
62
62
  })
63
63
  }
64
64
 
65
+ const changeDataMasking = (boxElement) => {
66
+ let charMasking = ''
67
+ const element = boxElement
68
+ if (mask && mask.length === 1) charMasking = mask
69
+ else if (mask && mask.length > 1) charMasking = mask.substring(0, 1)
70
+
71
+ if (charMasking) element.value = charMasking
72
+ }
73
+
65
74
  const handleChangeCode = () => {
66
75
  let code = ''
67
76
  for (let i = 0; i < validatorsLength; i += 1) code += singleCodes[prefix + i]
@@ -76,20 +85,18 @@ const Validator = React.forwardRef(
76
85
  codeElement.value = singleCodes[codeId] ?? ''
77
86
  return
78
87
  }
79
- if (codeElement?.value?.length > 1) {
80
- const oldValue = singleCodes[codeId]
81
- const newValue = codeElement.value.replace(oldValue, '')
82
- codeElement.value = newValue
83
- handleSingleCodes(codeId, codeElement.value, 'success')
84
- }
85
88
 
86
89
  handleSingleCodes(codeId, codeElement?.value ?? singleCodes[codeId], 'success')
87
90
  handleChangeCode()
88
91
  if (nextIndex === validatorsLength) {
89
92
  codeElement.blur()
93
+ changeDataMasking(codeElement)
90
94
  return
91
95
  }
92
- if (codeElement?.value?.length > 0) codeReferences[prefix + nextIndex].current.focus()
96
+ if (codeElement?.value?.length > 0) {
97
+ codeReferences[prefix + nextIndex].current.focus()
98
+ changeDataMasking(codeElement)
99
+ }
93
100
  }
94
101
 
95
102
  const handleKeyPress = (event, currentIndex, previousIndex) => {
@@ -138,7 +145,8 @@ const Validator = React.forwardRef(
138
145
  /* eslint-disable react-hooks/exhaustive-deps */
139
146
  React.useEffect(() => {
140
147
  for (let i = 0; i < validatorsLength; i += 1) {
141
- codeReferences[prefix + i].current.value = text[i] ?? ''
148
+ if (mask && text[i]) codeReferences[prefix + i].current.value = mask
149
+ else codeReferences[prefix + i].current.value = text[i] ?? ''
142
150
  handleSingleCodes(prefix + i, text[i] ?? '', text[i] ? 'success' : '')
143
151
  }
144
152
  }, [text])
@@ -203,6 +211,10 @@ Validator.propTypes = {
203
211
  * If true, the component is inactive and non editable.
204
212
  */
205
213
  inactive: PropTypes.bool,
214
+ /**
215
+ * Show masked characters and obscure the actual input. For example: '*'
216
+ */
217
+ mask: PropTypes.string,
206
218
  /**
207
219
  * Use to react upon input's value changes. Required when the `value` prop is set. Will receive the input's value as an argument.
208
220
  */
@@ -23,6 +23,14 @@ export default {
23
23
  * Visual variant is determined based on the `validation` prop.
24
24
  */
25
25
  feedback: PropTypes.string,
26
+ /**
27
+ * Tokens to be passed to the feedback component.
28
+ */
29
+ feedbackTokens: PropTypes.object,
30
+ /**
31
+ * Props to be passed to the feedback component.
32
+ */
33
+ feedbackProps: PropTypes.object,
26
34
  /**
27
35
  * Content of an optional `Tooltip`. If set, a tooltip button will be shown next to the label.
28
36
  */
@@ -32,13 +40,25 @@ export default {
32
40
  */
33
41
  validation: PropTypes.oneOf(['error', 'success'])
34
42
  },
35
- select: ({ copy, label, hint, hintPosition, feedback, tooltip, validation }) => ({
43
+ select: ({
44
+ copy,
45
+ label,
46
+ hint,
47
+ hintPosition,
48
+ feedback,
49
+ feedbackTokens,
50
+ feedbackProps,
51
+ tooltip,
52
+ validation
53
+ }) => ({
36
54
  supportsProps: {
37
55
  copy,
38
56
  label,
39
57
  hint,
40
58
  hintPosition,
41
59
  feedback,
60
+ feedbackTokens,
61
+ feedbackProps,
42
62
  tooltip,
43
63
  validation
44
64
  }
@@ -0,0 +1,47 @@
1
+ import { StyleProp, ViewStyle, TextStyle } from 'react-native'
2
+ import { Tokens, Variant } from '../ThemeProvider'
3
+
4
+ type CheckboxProps = {
5
+ checked?: boolean
6
+ defaultChecked?: boolean
7
+ error?: boolean
8
+ feedback?: string
9
+ id?: string
10
+ inactive?: boolean
11
+ label?: string
12
+ name?: string
13
+ onChange?: (value: boolean, event: any) => void
14
+ tokens?: Tokens
15
+ value?: string | number | boolean
16
+ variant?: Variant
17
+ style?: StyleProp<ViewStyle>
18
+ labelStyle?: StyleProp<TextStyle>
19
+ containerStyle?: StyleProp<ViewStyle>
20
+ }
21
+
22
+ type CheckboxTokens = {
23
+ containerBackgroundColor?: string
24
+ feedbackMarginBottom?: number
25
+ feedbackMarginTop?: number
26
+ feedbackPosition?: string
27
+ icon?: string
28
+ iconBackgroundColor?: string
29
+ iconColor?: string
30
+ iconSize?: number
31
+ inputBackgroundColor?: string
32
+ inputBorderColor?: string
33
+ inputBorderRadius?: number | string
34
+ inputBorderWidth?: number | string
35
+ inputHeight?: number
36
+ inputOutlineColor?: string
37
+ inputOutlineOffset?: number
38
+ inputOutlineWidth?: number | string
39
+ inputShadow?: string
40
+ inputWidth?: number
41
+ labelColor?: string
42
+ labelFontName?: string
43
+ labelFontSize?: number
44
+ labelFontWeight?: number
45
+ labelLineHeight?: number
46
+ labelMarginLeft?: number
47
+ }
@@ -0,0 +1,72 @@
1
+ import * as React from 'react'
2
+ import { Direction, ResponsiveDirection } from './Common'
3
+
4
+ type CheckboxCardGroupProps = {
5
+ copy?: 'en' | 'fr'
6
+ variant?: 'fullWidth'
7
+ legend?: string
8
+ tooltip?: string
9
+ hint?: string
10
+ hintPosition?: 'inline' | 'below'
11
+ validation?: 'error' | 'success'
12
+ feedback?: string
13
+ initialCheckedIds?: string[]
14
+ checkedIds?: string[]
15
+ onChange?: (checkedIds: string[]) => void
16
+ readOnly?: boolean
17
+ inactive?: boolean
18
+ }
19
+
20
+ type CheckboxCardGroupTokens = {
21
+ borderBottomLeftRadius?: number
22
+ borderBottomRightRadius?: number
23
+ borderTopLeftRadius?: number
24
+ borderTopRightRadius?: number
25
+ direction?: Direction | ResponsiveDirection
26
+ fieldSpace?: number
27
+ outlineOffset?: number
28
+ outlineWidth?: number
29
+ showIcon?: boolean
30
+ space?: number
31
+ }
32
+
33
+ type checkboxCardTokens = {
34
+ outerBorderColer?: string
35
+ outerBorderWidth?: number
36
+ outerBorderGap?: number
37
+ flex?: number
38
+ backgroundColor?: string
39
+ borderColor?: string
40
+ borderRadius?: number
41
+ borderWidth?: number
42
+ paddingBottom?: number
43
+ paddingLeft?: number
44
+ paddingRight?: number
45
+ paddingTop?: number
46
+ minWidth?: number
47
+ shadow?: string
48
+ contentAlignItems?: string
49
+ contentJustifyContent?: string
50
+ contentFlexGrow?: number
51
+ contentFlexShrink?: number
52
+ checkboxCheckedBackgroundColor?: string
53
+ checkboxCheckedSize?: number
54
+ checkboxInputBackgroundColor?: string
55
+ checkboxInputBorderColor?: string
56
+ checkboxInputBorderWidth?: number
57
+ checkboxInputOutlineColor?: string
58
+ checkboxInputOutlineWidth?: number
59
+ checkboxInputSize?: number
60
+ checkboxOuterBorderColor?: string
61
+ checkboxOuterBorderWidth?: number
62
+ checkboxOuterBorderGap?: number
63
+ fontSize?: number
64
+ fontName?: string
65
+ lineHeight?: number
66
+ color?: string
67
+ letterSpacing?: string
68
+ textTransform?: string
69
+ fontWeight?: number
70
+ checkboxSpace?: number
71
+ contentSpace?: number
72
+ }
package/types/index.d.ts CHANGED
@@ -7,6 +7,16 @@ export type { BoxVariants, BoxTokens, BoxProps } from './Box'
7
7
  export { default as ChevronLink } from './ChevronLink'
8
8
  export { ChevronLinkTokens, ChevronLinkProps, HrefProps } from './ChevronLink'
9
9
 
10
+ export { default as Checkbox } from './Checkbox'
11
+ export { CheckboxProps, CheckboxTokens } from './Checkbox'
12
+
13
+ export { default as CheckboxCardGroup } from './CheckboxCardGroup'
14
+ export {
15
+ CheckboxCardGroupProps,
16
+ CheckboxCardGroupTokens,
17
+ checkboxCardTokens
18
+ } from './CheckboxCardGroup'
19
+
10
20
  export { default as Divider } from './Divider'
11
21
  export { DividerVariants, DividerProps, DividerTokens } from './Divider'
12
22