@telus-uds/components-base 1.44.0 → 1.46.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,34 @@
1
1
  # Change Log - @telus-uds/components-base
2
2
 
3
- This log was last generated on Wed, 24 May 2023 23:40:09 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 30 May 2023 02:42:51 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.46.0
8
+
9
+ Tue, 30 May 2023 02:42:51 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - Standardized RadioCardGroup (wlsdud194@hotmail.com)
14
+ - Button outer width is no longer set to 0 if token width = 0 (wlsdud194@hotmail.com)
15
+ - fix:list overflowing (samuraix221@hotmail.com)
16
+
17
+ ## 1.45.0
18
+
19
+ Sat, 27 May 2023 00:44:50 GMT
20
+
21
+ ### Minor changes
22
+
23
+ - Add in button group stories how looks icon right (mauricio.batresmontejo@telus.com)
24
+ - link component modified to anchor the icon to the top of the line (35577399+JoshHC@users.noreply.github.com)
25
+ - add "numeric" variant to 'TextInput' component (kyle.king2@telus.com)
26
+ - feature:fieldset tokenization (samuraix221@hotmail.com)
27
+ - Bump @telus-uds/system-theme-tokens to v2.28.0
28
+
7
29
  ## 1.44.0
8
30
 
9
- Wed, 24 May 2023 23:40:09 GMT
31
+ Wed, 24 May 2023 23:46:34 GMT
10
32
 
11
33
  ### Minor changes
12
34
 
@@ -631,6 +631,19 @@
631
631
  "iconColor": "color",
632
632
  "iconGap": "size"
633
633
  },
634
+ "Fieldset": {
635
+ "outlineWidth": "border",
636
+ "outlineColor": "color",
637
+ "borderTopLeftRadius": "radius",
638
+ "borderTopRightRadius": "radius",
639
+ "borderBottomLeftRadius": "radius",
640
+ "borderBottomRightRadius": "radius",
641
+ "paddingBottom": "size",
642
+ "paddingTop": "size",
643
+ "paddingLeft": "size",
644
+ "paddingRight": "size",
645
+ "outlineOffset": "size"
646
+ },
634
647
  "HorizontalScrollButton": {
635
648
  "backgroundColor": "color",
636
649
  "borderRadius": "radius",
@@ -1112,7 +1125,14 @@
1112
1125
  },
1113
1126
  "RadioGroup": {
1114
1127
  "space": "integer",
1115
- "fieldSpace": "integer"
1128
+ "fieldSpace": "integer",
1129
+ "showIcon": "show",
1130
+ "outlineWidth": "border",
1131
+ "borderBottomLeftRadius": "radius",
1132
+ "borderBottomRightRadius": "radius",
1133
+ "borderTopLeftRadius": "radius",
1134
+ "borderTopRightRadius": "radius",
1135
+ "outlineOffset": "size"
1116
1136
  },
1117
1137
  "Ribbon": {
1118
1138
  "paddingLeft": "size",
@@ -4533,6 +4553,55 @@
4533
4553
  "required": false,
4534
4554
  "description": "Use to show border in case of error for a group of components"
4535
4555
  },
4556
+ "variant": {
4557
+ "defaultValue": {
4558
+ "value": "{}",
4559
+ "computed": false
4560
+ },
4561
+ "type": {
4562
+ "name": "objectOf",
4563
+ "value": {
4564
+ "name": "union",
4565
+ "value": [
4566
+ {
4567
+ "name": "string"
4568
+ },
4569
+ {
4570
+ "name": "number"
4571
+ },
4572
+ {
4573
+ "name": "bool"
4574
+ }
4575
+ ]
4576
+ }
4577
+ },
4578
+ "required": false,
4579
+ "description": ""
4580
+ },
4581
+ "tokens": {
4582
+ "defaultValue": {
4583
+ "value": "{}",
4584
+ "computed": false
4585
+ },
4586
+ "type": {
4587
+ "name": "custom",
4588
+ "raw": {
4589
+ "outlineWidth": "border",
4590
+ "outlineColor": "color",
4591
+ "borderTopLeftRadius": "radius",
4592
+ "borderTopRightRadius": "radius",
4593
+ "borderBottomLeftRadius": "radius",
4594
+ "borderBottomRightRadius": "radius",
4595
+ "paddingBottom": "size",
4596
+ "paddingTop": "size",
4597
+ "paddingLeft": "size",
4598
+ "paddingRight": "size",
4599
+ "outlineOffset": "size"
4600
+ }
4601
+ },
4602
+ "required": false,
4603
+ "description": ""
4604
+ },
4536
4605
  "children": {
4537
4606
  "type": {
4538
4607
  "name": "union",
@@ -13452,7 +13521,14 @@
13452
13521
  "name": "custom",
13453
13522
  "raw": {
13454
13523
  "space": "integer",
13455
- "fieldSpace": "integer"
13524
+ "fieldSpace": "integer",
13525
+ "showIcon": "show",
13526
+ "outlineWidth": "border",
13527
+ "borderBottomLeftRadius": "radius",
13528
+ "borderBottomRightRadius": "radius",
13529
+ "borderTopLeftRadius": "radius",
13530
+ "borderTopRightRadius": "radius",
13531
+ "outlineOffset": "size"
13456
13532
  }
13457
13533
  },
13458
13534
  "required": false,
@@ -81,7 +81,7 @@ const selectOuterSizeStyles = _ref3 => {
81
81
  });
82
82
  const sizeStyles = {}; // Apply width/height tokens: number === pixels, string === explicit units e.g. %
83
83
 
84
- if (typeof width === 'number' || typeof height === 'number') {
84
+ if (typeof width === 'number' && width > 0 || typeof height === 'number' && height > 0) {
85
85
  sizeStyles.width = width ? width + outerBorderOffset * 2 : width;
86
86
  sizeStyles.height = height ? height + outerBorderOffset * 2 : height;
87
87
  return sizeStyles;
@@ -9,12 +9,12 @@ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
- var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
13
-
14
12
  var _Feedback = _interopRequireDefault(require("../Feedback"));
15
13
 
16
14
  var _utils = require("../utils");
17
15
 
16
+ var _ThemeProvider = require("../ThemeProvider");
17
+
18
18
  var _FieldsetContainer = _interopRequireDefault(require("./FieldsetContainer"));
19
19
 
20
20
  var _StackView = require("../StackView");
@@ -53,9 +53,19 @@ const Fieldset = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
53
53
  inactive,
54
54
  accessibilityRole,
55
55
  name: fieldsetName,
56
- children
56
+ children,
57
+ variant = {},
58
+ tokens = {}
57
59
  } = _ref;
58
- // Skips `inputId` because a fieldset' legend describes multiple inputs
60
+
61
+ /* Fieldset tokenization:
62
+ - error variant can only be activated by passing showErrorBorder and also having validaton as 'error'
63
+ */
64
+ const themeTokens = (0, _ThemeProvider.useThemeTokens)('Fieldset', tokens, {
65
+ error: validation === 'error' && showErrorBorder,
66
+ ...variant
67
+ }); // Skips `inputId` because a fieldset' legend describes multiple inputs
68
+
59
69
  const {
60
70
  hintId,
61
71
  feedbackId,
@@ -81,11 +91,43 @@ const Fieldset = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
81
91
  variant: {
82
92
  icon: showIcon
83
93
  }
84
- }); // Some accessibility patterns depend on elements being direct children, e.g. fieldset -> legend,
94
+ });
95
+
96
+ const borderStyles = _ref2 => {
97
+ let {
98
+ outlineWidth,
99
+ outlineColor,
100
+ borderTopLeftRadius,
101
+ borderTopRightRadius,
102
+ borderBottomLeftRadius,
103
+ borderBottomRightRadius,
104
+ paddingBottom,
105
+ paddingRight,
106
+ paddingTop,
107
+ paddingLeft,
108
+ outlineOffset
109
+ } = _ref2;
110
+ return {
111
+ outlineWidth,
112
+ outlineColor,
113
+ borderTopLeftRadius: borderTopLeftRadius * 0.1,
114
+ borderTopRightRadius: borderTopRightRadius * 0.1,
115
+ borderBottomLeftRadius: borderBottomLeftRadius * 0.1,
116
+ borderBottomRightRadius: borderBottomRightRadius * 0.1,
117
+ paddingBottom,
118
+ paddingRight,
119
+ paddingTop,
120
+ paddingLeft,
121
+ outlineOffset,
122
+ borderWidth: 0,
123
+ outlineStyle: validation === 'error' && showErrorBorder ? 'solid' : 'none'
124
+ };
125
+ }; // Some accessibility patterns depend on elements being direct children, e.g. fieldset -> legend,
85
126
  // and on MacOS voiceover, radiogroup -> radio. To allow elements to be direct children of the
86
127
  // fieldset as much as possible, but also allow different spacing within content and between
87
128
  // fieldset / feedback / etc, wrap resolved children in a fragment, and stack with `preserveFragments`.
88
129
 
130
+
89
131
  const childContent = /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
90
132
  children: typeof children === 'function' ? children(a11yProps) : children
91
133
  });
@@ -94,30 +136,20 @@ const Fieldset = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
94
136
  space,
95
137
  preserveFragments: true
96
138
  });
97
- const borderStyle = validation === 'error' && showErrorBorder ? staticStyles.errorBorder : null;
98
139
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_FieldsetContainer.default, {
99
140
  ref: ref,
100
141
  inactive: inactive,
101
142
  accessibilityRole: accessibilityRole,
102
143
  name: fieldsetName,
103
- borderStyle: borderStyle,
144
+ borderStyle: borderStyles(themeTokens),
104
145
  showBorderStyle: showErrorBorder,
105
146
  children: stackedContent
106
147
  });
107
148
  });
108
-
109
- const staticStyles = _StyleSheet.default.create({
110
- errorBorder: {
111
- border: true,
112
- borderWidth: 1,
113
- borderColor: 'red',
114
- borderRadius: 10,
115
- padding: 8
116
- }
117
- });
118
-
119
149
  Fieldset.displayName = 'Fieldset';
120
150
  Fieldset.propTypes = {
151
+ variant: _utils.variantProp.propType,
152
+ tokens: (0, _utils.getTokensPropType)('Fieldset'),
121
153
  children: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node]),
122
154
 
123
155
  /**
@@ -271,7 +271,6 @@ const staticStyles = _StyleSheet.default.create({
271
271
  },
272
272
  rowContainer: {
273
273
  flexDirection: 'row',
274
- alignItems: 'center',
275
274
  justifyContent: 'flex-start'
276
275
  },
277
276
  baseline: {
package/lib/List/List.js CHANGED
@@ -68,6 +68,10 @@ const List = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
68
68
 
69
69
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
70
70
  ref: ref,
71
+ style: {
72
+ flexShrink: 1,
73
+ flex: 1
74
+ },
71
75
  accessibilityRole: accessibilityRole,
72
76
  ...selectProps(rest),
73
77
  children: items
@@ -104,12 +104,30 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
104
104
  ...rest
105
105
  } = _ref;
106
106
  const viewport = (0, _ViewportProvider.useViewport)();
107
+ /* showIcon passes a boolean to displayIcon
108
+ */
109
+
107
110
  const {
108
111
  space,
109
- fieldSpace
112
+ fieldSpace,
113
+ showIcon,
114
+ outlineWidth,
115
+ borderTopLeftRadius,
116
+ borderTopRightRadius,
117
+ borderBottomLeftRadius,
118
+ borderBottomRightRadius,
119
+ outlineOffset
110
120
  } = (0, _ThemeProvider.useThemeTokens)('RadioGroup', tokens, variant, {
111
121
  viewport
112
122
  });
123
+ const borderTokens = {
124
+ outlineWidth,
125
+ borderTopLeftRadius,
126
+ borderTopRightRadius,
127
+ borderBottomLeftRadius,
128
+ borderBottomRightRadius,
129
+ outlineOffset
130
+ };
113
131
  const {
114
132
  currentValue,
115
133
  setValue
@@ -169,7 +187,8 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
169
187
  inactive: inactive,
170
188
  validation: validation,
171
189
  showErrorBorder: true,
172
- showIcon: true,
190
+ tokens: borderTokens,
191
+ showIcon: showIcon,
173
192
  accessibilityRole: "radiogroup",
174
193
  ...selectProps(rest),
175
194
  children: (0, _StackView.getStackedContent)(radios, {
@@ -234,9 +234,13 @@ const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
234
234
  const handleChangeText = event => {
235
235
  var _event$nativeEvent, _event$target;
236
236
 
237
+ const {
238
+ numeric
239
+ } = variant;
237
240
  const text = ((_event$nativeEvent = event.nativeEvent) === null || _event$nativeEvent === void 0 ? void 0 : _event$nativeEvent.text) || ((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value);
238
- setValue(text, event);
239
- if (typeof onChangeText === 'function') onChangeText(text, event);
241
+ const filteredText = numeric ? text.replace(/[^\d]/g, '') : text;
242
+ setValue(filteredText, event);
243
+ if (typeof onChangeText === 'function') onChangeText(filteredText, event);
240
244
  };
241
245
 
242
246
  const states = {
@@ -304,8 +308,6 @@ const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
304
308
  onMouseOut: handleMouseOut,
305
309
  onChange: handleChangeText,
306
310
  defaultValue: initialValue,
307
- // currentValue is being updated even if the input is not controlled, passing it down to the
308
- // Input could lead to changing its state from uncontrolled to controlled
309
311
  value: isControlled ? currentValue : undefined
310
312
  };
311
313
  const {
@@ -318,6 +320,8 @@ const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
318
320
  style: selectOuterBorderStyles(themeTokens),
319
321
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextInput.default, {
320
322
  ref: inputRef,
323
+ keyboardType: variant.numeric && 'numeric',
324
+ inputMode: variant.numeric && 'numeric',
321
325
  style: nativeInputStyle,
322
326
  secureTextEntry: variant.password && !showPassword,
323
327
  ...inputProps
@@ -57,7 +57,7 @@ const selectOuterSizeStyles = _ref3 => {
57
57
  });
58
58
  const sizeStyles = {}; // Apply width/height tokens: number === pixels, string === explicit units e.g. %
59
59
 
60
- if (typeof width === 'number' || typeof height === 'number') {
60
+ if (typeof width === 'number' && width > 0 || typeof height === 'number' && height > 0) {
61
61
  sizeStyles.width = width ? width + outerBorderOffset * 2 : width;
62
62
  sizeStyles.height = height ? height + outerBorderOffset * 2 : height;
63
63
  return sizeStyles;
@@ -1,8 +1,8 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import StyleSheet from "react-native-web/dist/exports/StyleSheet";
4
3
  import Feedback from '../Feedback';
5
- import { spacingProps } from '../utils';
4
+ import { getTokensPropType, spacingProps, variantProp } from '../utils';
5
+ import { useThemeTokens } from '../ThemeProvider';
6
6
  import FieldsetContainer from './FieldsetContainer';
7
7
  import { getStackedContent } from '../StackView';
8
8
  import InputLabel from '../InputLabel';
@@ -32,9 +32,19 @@ const Fieldset = /*#__PURE__*/forwardRef((_ref, ref) => {
32
32
  inactive,
33
33
  accessibilityRole,
34
34
  name: fieldsetName,
35
- children
35
+ children,
36
+ variant = {},
37
+ tokens = {}
36
38
  } = _ref;
37
- // Skips `inputId` because a fieldset' legend describes multiple inputs
39
+
40
+ /* Fieldset tokenization:
41
+ - error variant can only be activated by passing showErrorBorder and also having validaton as 'error'
42
+ */
43
+ const themeTokens = useThemeTokens('Fieldset', tokens, {
44
+ error: validation === 'error' && showErrorBorder,
45
+ ...variant
46
+ }); // Skips `inputId` because a fieldset' legend describes multiple inputs
47
+
38
48
  const {
39
49
  hintId,
40
50
  feedbackId,
@@ -62,7 +72,38 @@ const Fieldset = /*#__PURE__*/forwardRef((_ref, ref) => {
62
72
  variant: {
63
73
  icon: showIcon
64
74
  }
65
- }); // Some accessibility patterns depend on elements being direct children, e.g. fieldset -> legend,
75
+ });
76
+
77
+ const borderStyles = _ref2 => {
78
+ let {
79
+ outlineWidth,
80
+ outlineColor,
81
+ borderTopLeftRadius,
82
+ borderTopRightRadius,
83
+ borderBottomLeftRadius,
84
+ borderBottomRightRadius,
85
+ paddingBottom,
86
+ paddingRight,
87
+ paddingTop,
88
+ paddingLeft,
89
+ outlineOffset
90
+ } = _ref2;
91
+ return {
92
+ outlineWidth,
93
+ outlineColor,
94
+ borderTopLeftRadius: borderTopLeftRadius * 0.1,
95
+ borderTopRightRadius: borderTopRightRadius * 0.1,
96
+ borderBottomLeftRadius: borderBottomLeftRadius * 0.1,
97
+ borderBottomRightRadius: borderBottomRightRadius * 0.1,
98
+ paddingBottom,
99
+ paddingRight,
100
+ paddingTop,
101
+ paddingLeft,
102
+ outlineOffset,
103
+ borderWidth: 0,
104
+ outlineStyle: validation === 'error' && showErrorBorder ? 'solid' : 'none'
105
+ };
106
+ }; // Some accessibility patterns depend on elements being direct children, e.g. fieldset -> legend,
66
107
  // and on MacOS voiceover, radiogroup -> radio. To allow elements to be direct children of the
67
108
  // fieldset as much as possible, but also allow different spacing within content and between
68
109
  // fieldset / feedback / etc, wrap resolved children in a fragment, and stack with `preserveFragments`.
@@ -77,28 +118,20 @@ const Fieldset = /*#__PURE__*/forwardRef((_ref, ref) => {
77
118
  space,
78
119
  preserveFragments: true
79
120
  });
80
- const borderStyle = validation === 'error' && showErrorBorder ? staticStyles.errorBorder : null;
81
121
  return /*#__PURE__*/_jsx(FieldsetContainer, {
82
122
  ref: ref,
83
123
  inactive: inactive,
84
124
  accessibilityRole: accessibilityRole,
85
125
  name: fieldsetName,
86
- borderStyle: borderStyle,
126
+ borderStyle: borderStyles(themeTokens),
87
127
  showBorderStyle: showErrorBorder,
88
128
  children: stackedContent
89
129
  });
90
130
  });
91
- const staticStyles = StyleSheet.create({
92
- errorBorder: {
93
- border: true,
94
- borderWidth: 1,
95
- borderColor: 'red',
96
- borderRadius: 10,
97
- padding: 8
98
- }
99
- });
100
131
  Fieldset.displayName = 'Fieldset';
101
132
  Fieldset.propTypes = {
133
+ variant: variantProp.propType,
134
+ tokens: getTokensPropType('Fieldset'),
102
135
  children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
103
136
 
104
137
  /**
@@ -242,7 +242,6 @@ const staticStyles = StyleSheet.create({
242
242
  },
243
243
  rowContainer: {
244
244
  flexDirection: 'row',
245
- alignItems: 'center',
246
245
  justifyContent: 'flex-start'
247
246
  },
248
247
  baseline: {
@@ -47,6 +47,10 @@ const List = /*#__PURE__*/forwardRef((_ref, ref) => {
47
47
  });
48
48
  return /*#__PURE__*/_jsx(View, {
49
49
  ref: ref,
50
+ style: {
51
+ flexShrink: 1,
52
+ flex: 1
53
+ },
50
54
  accessibilityRole: accessibilityRole,
51
55
  ...selectProps(rest),
52
56
  children: items
@@ -81,12 +81,30 @@ const RadioGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
81
81
  ...rest
82
82
  } = _ref;
83
83
  const viewport = useViewport();
84
+ /* showIcon passes a boolean to displayIcon
85
+ */
86
+
84
87
  const {
85
88
  space,
86
- fieldSpace
89
+ fieldSpace,
90
+ showIcon,
91
+ outlineWidth,
92
+ borderTopLeftRadius,
93
+ borderTopRightRadius,
94
+ borderBottomLeftRadius,
95
+ borderBottomRightRadius,
96
+ outlineOffset
87
97
  } = useThemeTokens('RadioGroup', tokens, variant, {
88
98
  viewport
89
99
  });
100
+ const borderTokens = {
101
+ outlineWidth,
102
+ borderTopLeftRadius,
103
+ borderTopRightRadius,
104
+ borderBottomLeftRadius,
105
+ borderBottomRightRadius,
106
+ outlineOffset
107
+ };
90
108
  const {
91
109
  currentValue,
92
110
  setValue
@@ -146,7 +164,8 @@ const RadioGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
146
164
  inactive: inactive,
147
165
  validation: validation,
148
166
  showErrorBorder: true,
149
- showIcon: true,
167
+ tokens: borderTokens,
168
+ showIcon: showIcon,
150
169
  accessibilityRole: "radiogroup",
151
170
  ...selectProps(rest),
152
171
  children: getStackedContent(radios, {
@@ -208,9 +208,13 @@ const TextInputBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
208
208
  const handleChangeText = event => {
209
209
  var _event$nativeEvent, _event$target;
210
210
 
211
+ const {
212
+ numeric
213
+ } = variant;
211
214
  const text = ((_event$nativeEvent = event.nativeEvent) === null || _event$nativeEvent === void 0 ? void 0 : _event$nativeEvent.text) || ((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value);
212
- setValue(text, event);
213
- if (typeof onChangeText === 'function') onChangeText(text, event);
215
+ const filteredText = numeric ? text.replace(/[^\d]/g, '') : text;
216
+ setValue(filteredText, event);
217
+ if (typeof onChangeText === 'function') onChangeText(filteredText, event);
214
218
  };
215
219
 
216
220
  const states = {
@@ -278,8 +282,6 @@ const TextInputBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
278
282
  onMouseOut: handleMouseOut,
279
283
  onChange: handleChangeText,
280
284
  defaultValue: initialValue,
281
- // currentValue is being updated even if the input is not controlled, passing it down to the
282
- // Input could lead to changing its state from uncontrolled to controlled
283
285
  value: isControlled ? currentValue : undefined
284
286
  };
285
287
  const {
@@ -292,6 +294,8 @@ const TextInputBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
292
294
  style: selectOuterBorderStyles(themeTokens),
293
295
  children: [/*#__PURE__*/_jsx(NativeTextInput, {
294
296
  ref: inputRef,
297
+ keyboardType: variant.numeric && 'numeric',
298
+ inputMode: variant.numeric && 'numeric',
295
299
  style: nativeInputStyle,
296
300
  secureTextEntry: variant.password && !showPassword,
297
301
  ...inputProps
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.2.1",
14
- "@telus-uds/system-theme-tokens": "^2.27.0",
14
+ "@telus-uds/system-theme-tokens": "^2.28.0",
15
15
  "airbnb-prop-types": "^2.16.0",
16
16
  "lodash.debounce": "^4.0.8",
17
17
  "lodash.merge": "^4.6.2",
@@ -72,5 +72,5 @@
72
72
  "standard-engine": {
73
73
  "skip": true
74
74
  },
75
- "version": "1.44.0"
75
+ "version": "1.46.0"
76
76
  }
@@ -55,7 +55,7 @@ const selectOuterSizeStyles = ({ outerBorderGap, outerBorderWidth, width, height
55
55
  const outerBorderOffset = getOuterBorderOffset({ outerBorderGap, outerBorderWidth })
56
56
  const sizeStyles = {}
57
57
  // Apply width/height tokens: number === pixels, string === explicit units e.g. %
58
- if (typeof width === 'number' || typeof height === 'number') {
58
+ if ((typeof width === 'number' && width > 0) || (typeof height === 'number' && height > 0)) {
59
59
  sizeStyles.width = width ? width + outerBorderOffset * 2 : width
60
60
  sizeStyles.height = height ? height + outerBorderOffset * 2 : height
61
61
  return sizeStyles
@@ -1,9 +1,9 @@
1
1
  import React, { forwardRef } from 'react'
2
2
  import PropTypes from 'prop-types'
3
- import { StyleSheet } from 'react-native'
4
3
 
5
4
  import Feedback from '../Feedback'
6
- import { spacingProps } from '../utils'
5
+ import { getTokensPropType, spacingProps, variantProp } from '../utils'
6
+ import { useThemeTokens } from '../ThemeProvider'
7
7
  import FieldsetContainer from './FieldsetContainer'
8
8
  import { getStackedContent } from '../StackView'
9
9
  import InputLabel from '../InputLabel'
@@ -32,10 +32,19 @@ const Fieldset = forwardRef(
32
32
  inactive,
33
33
  accessibilityRole,
34
34
  name: fieldsetName,
35
- children
35
+ children,
36
+ variant = {},
37
+ tokens = {}
36
38
  },
37
39
  ref
38
40
  ) => {
41
+ /* Fieldset tokenization:
42
+ - error variant can only be activated by passing showErrorBorder and also having validaton as 'error'
43
+ */
44
+ const themeTokens = useThemeTokens('Fieldset', tokens, {
45
+ error: validation === 'error' && showErrorBorder,
46
+ ...variant
47
+ })
39
48
  // Skips `inputId` because a fieldset' legend describes multiple inputs
40
49
  const { hintId, feedbackId, a11yProps } = useInputSupports({
41
50
  feedback,
@@ -63,6 +72,34 @@ const Fieldset = forwardRef(
63
72
  />
64
73
  )
65
74
 
75
+ const borderStyles = ({
76
+ outlineWidth,
77
+ outlineColor,
78
+ borderTopLeftRadius,
79
+ borderTopRightRadius,
80
+ borderBottomLeftRadius,
81
+ borderBottomRightRadius,
82
+ paddingBottom,
83
+ paddingRight,
84
+ paddingTop,
85
+ paddingLeft,
86
+ outlineOffset
87
+ }) => ({
88
+ outlineWidth,
89
+ outlineColor,
90
+ borderTopLeftRadius: borderTopLeftRadius * 0.1,
91
+ borderTopRightRadius: borderTopRightRadius * 0.1,
92
+ borderBottomLeftRadius: borderBottomLeftRadius * 0.1,
93
+ borderBottomRightRadius: borderBottomRightRadius * 0.1,
94
+ paddingBottom,
95
+ paddingRight,
96
+ paddingTop,
97
+ paddingLeft,
98
+ outlineOffset,
99
+ borderWidth: 0,
100
+ outlineStyle: validation === 'error' && showErrorBorder ? 'solid' : 'none'
101
+ })
102
+
66
103
  // Some accessibility patterns depend on elements being direct children, e.g. fieldset -> legend,
67
104
  // and on MacOS voiceover, radiogroup -> radio. To allow elements to be direct children of the
68
105
  // fieldset as much as possible, but also allow different spacing within content and between
@@ -73,15 +110,13 @@ const Fieldset = forwardRef(
73
110
  ? [legendContent, feedbackContent, childContent]
74
111
  : [legendContent, childContent, feedbackContent]
75
112
  const stackedContent = getStackedContent(orderedContent, { space, preserveFragments: true })
76
- const borderStyle = validation === 'error' && showErrorBorder ? staticStyles.errorBorder : null
77
-
78
113
  return (
79
114
  <FieldsetContainer
80
115
  ref={ref}
81
116
  inactive={inactive}
82
117
  accessibilityRole={accessibilityRole}
83
118
  name={fieldsetName}
84
- borderStyle={borderStyle}
119
+ borderStyle={borderStyles(themeTokens)}
85
120
  showBorderStyle={showErrorBorder}
86
121
  >
87
122
  {stackedContent}
@@ -89,19 +124,12 @@ const Fieldset = forwardRef(
89
124
  )
90
125
  }
91
126
  )
92
- const staticStyles = StyleSheet.create({
93
- errorBorder: {
94
- border: true,
95
- borderWidth: 1,
96
- borderColor: 'red',
97
- borderRadius: 10,
98
- padding: 8
99
- }
100
- })
101
127
 
102
128
  Fieldset.displayName = 'Fieldset'
103
129
 
104
130
  Fieldset.propTypes = {
131
+ variant: variantProp.propType,
132
+ tokens: getTokensPropType('Fieldset'),
105
133
  children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
106
134
  /**
107
135
  * Whether the English or French copy will be used (e.g. for accessibility labels).
@@ -223,7 +223,6 @@ const staticStyles = StyleSheet.create({
223
223
  },
224
224
  rowContainer: {
225
225
  flexDirection: 'row',
226
- alignItems: 'center',
227
226
  justifyContent: 'flex-start'
228
227
  },
229
228
  baseline: {
package/src/List/List.jsx CHANGED
@@ -42,7 +42,12 @@ const List = forwardRef(
42
42
  })
43
43
 
44
44
  return (
45
- <View ref={ref} accessibilityRole={accessibilityRole} {...selectProps(rest)}>
45
+ <View
46
+ ref={ref}
47
+ style={{ flexShrink: 1, flex: 1 }}
48
+ accessibilityRole={accessibilityRole}
49
+ {...selectProps(rest)}
50
+ >
46
51
  {items}
47
52
  </View>
48
53
  )
@@ -99,10 +99,31 @@ const RadioGroup = forwardRef(
99
99
  ) => {
100
100
  const viewport = useViewport()
101
101
 
102
- const { space, fieldSpace } = useThemeTokens('RadioGroup', tokens, variant, {
102
+ /* showIcon passes a boolean to displayIcon
103
+ */
104
+ const {
105
+ space,
106
+ fieldSpace,
107
+ showIcon,
108
+ outlineWidth,
109
+ borderTopLeftRadius,
110
+ borderTopRightRadius,
111
+ borderBottomLeftRadius,
112
+ borderBottomRightRadius,
113
+ outlineOffset
114
+ } = useThemeTokens('RadioGroup', tokens, variant, {
103
115
  viewport
104
116
  })
105
117
 
118
+ const borderTokens = {
119
+ outlineWidth,
120
+ borderTopLeftRadius,
121
+ borderTopRightRadius,
122
+ borderBottomLeftRadius,
123
+ borderBottomRightRadius,
124
+ outlineOffset
125
+ }
126
+
106
127
  const { currentValue, setValue } = useInputValue({
107
128
  value: checkedId,
108
129
  initialValue: initialCheckedId,
@@ -156,7 +177,8 @@ const RadioGroup = forwardRef(
156
177
  inactive={inactive}
157
178
  validation={validation}
158
179
  showErrorBorder
159
- showIcon
180
+ tokens={borderTokens}
181
+ showIcon={showIcon}
160
182
  accessibilityRole="radiogroup"
161
183
  {...selectProps(rest)}
162
184
  >
@@ -198,9 +198,11 @@ const TextInputBase = forwardRef(
198
198
  }, [element, pattern])
199
199
 
200
200
  const handleChangeText = (event) => {
201
+ const { numeric } = variant
201
202
  const text = event.nativeEvent?.text || event.target?.value
202
- setValue(text, event)
203
- if (typeof onChangeText === 'function') onChangeText(text, event)
203
+ const filteredText = numeric ? text.replace(/[^\d]/g, '') : text
204
+ setValue(filteredText, event)
205
+ if (typeof onChangeText === 'function') onChangeText(filteredText, event)
204
206
  }
205
207
 
206
208
  const states = { focus: isFocused, hover: isHovered, inactive }
@@ -265,8 +267,6 @@ const TextInputBase = forwardRef(
265
267
  onMouseOut: handleMouseOut,
266
268
  onChange: handleChangeText,
267
269
  defaultValue: initialValue,
268
- // currentValue is being updated even if the input is not controlled, passing it down to the
269
- // Input could lead to changing its state from uncontrolled to controlled
270
270
  value: isControlled ? currentValue : undefined
271
271
  }
272
272
 
@@ -277,6 +277,8 @@ const TextInputBase = forwardRef(
277
277
  <View style={selectOuterBorderStyles(themeTokens)}>
278
278
  <NativeTextInput
279
279
  ref={inputRef}
280
+ keyboardType={variant.numeric && 'numeric'}
281
+ inputMode={variant.numeric && 'numeric'}
280
282
  style={nativeInputStyle}
281
283
  secureTextEntry={variant.password && !showPassword}
282
284
  {...inputProps}