@telus-uds/components-base 3.8.0 → 3.9.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 +18 -3
- package/lib/cjs/MultiSelectFilter/ModalOverlay.js +7 -2
- package/lib/cjs/MultiSelectFilter/MultiSelectFilter.js +13 -7
- package/lib/cjs/ToggleSwitch/ToggleSwitch.js +13 -2
- package/lib/cjs/Validator/Validator.js +135 -64
- package/lib/esm/MultiSelectFilter/ModalOverlay.js +7 -2
- package/lib/esm/MultiSelectFilter/MultiSelectFilter.js +13 -7
- package/lib/esm/ToggleSwitch/ToggleSwitch.js +13 -2
- package/lib/esm/Validator/Validator.js +135 -64
- package/lib/package.json +2 -2
- package/package.json +2 -2
- package/src/MultiSelectFilter/ModalOverlay.jsx +3 -2
- package/src/MultiSelectFilter/MultiSelectFilter.jsx +12 -8
- package/src/ToggleSwitch/ToggleSwitch.jsx +17 -2
- package/src/Validator/Validator.jsx +172 -85
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,32 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 10 Jun 2025 20:18:03 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 3.9.0
|
|
8
|
+
|
|
9
|
+
Tue, 10 Jun 2025 20:18:03 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- `ToggleSwitch`: update UI for mobile devices (guillermo.peitzner@telus.com)
|
|
14
|
+
- `MultiSelectFilter`: preservation of original case (uppercase/lowercase) for label when using custom dictionary prop enabled" (35577399+JoshHC@users.noreply.github.com)
|
|
15
|
+
- Bump @telus-uds/system-theme-tokens to v4.7.0
|
|
16
|
+
|
|
17
|
+
### Patches
|
|
18
|
+
|
|
19
|
+
- `MultiSelectFilter`: add containerBorderColor token (sergio.ramirez@telus.com)
|
|
20
|
+
- `Validator`: concatenation and 6-digit limit bugs fixed (35577399+JoshHC@users.noreply.github.com)
|
|
21
|
+
|
|
7
22
|
## 3.8.0
|
|
8
23
|
|
|
9
|
-
Fri, 23 May 2025 15:
|
|
24
|
+
Fri, 23 May 2025 15:15:58 GMT
|
|
10
25
|
|
|
11
26
|
### Minor changes
|
|
12
27
|
|
|
13
28
|
- `ActivityIndicator`: new `Spinner` functionalities added because it will be deprecated soon (35577399+JoshHC@users.noreply.github.com)
|
|
14
|
-
- `MultiSelectFilter`: close the overlay box when we click outside
|
|
29
|
+
- `MultiSelectFilter`: close the overlay box when we click outside (sergio.ramirez@telus.com)
|
|
15
30
|
- `Notification`: feature variant added for allium, koodo and pm (35577399+JoshHC@users.noreply.github.com)
|
|
16
31
|
- Bump @telus-uds/system-theme-tokens to v4.6.0
|
|
17
32
|
|
|
@@ -63,6 +63,7 @@ const staticStyles = _StyleSheet.default.create({
|
|
|
63
63
|
});
|
|
64
64
|
const selectContainerStyle = (enableFullscreen, themeTokens) => ({
|
|
65
65
|
borderColor: themeTokens.borderColor,
|
|
66
|
+
backgroundColor: themeTokens.backgroundColor,
|
|
66
67
|
..._Platform.default.select({
|
|
67
68
|
web: {
|
|
68
69
|
position: enableFullscreen ? 'fixed' : 'absolute'
|
|
@@ -114,7 +115,8 @@ const ModalOverlay = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
114
115
|
maxHeight: maxHeightSize
|
|
115
116
|
};
|
|
116
117
|
const {
|
|
117
|
-
closeIcon: CloseIconComponent
|
|
118
|
+
closeIcon: CloseIconComponent,
|
|
119
|
+
backgroundColor
|
|
118
120
|
} = themeTokens;
|
|
119
121
|
const getCopy = (0, _utils.useCopy)({
|
|
120
122
|
dictionary: _dictionary.default,
|
|
@@ -127,7 +129,10 @@ const ModalOverlay = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
127
129
|
onLayout: onLayout,
|
|
128
130
|
style: [overlaidPosition, containerWidthHeight, staticStyles.positioner, !isReady && staticStyles.hidden, selectContainerStyle(enableFullscreen, themeTokens)],
|
|
129
131
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Card.default, {
|
|
130
|
-
tokens:
|
|
132
|
+
tokens: {
|
|
133
|
+
...staticStyles.card,
|
|
134
|
+
backgroundColor
|
|
135
|
+
},
|
|
131
136
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
132
137
|
style: [staticStyles.closeButtonContainer, selectCloseButtonContainerStyles(themeTokens)],
|
|
133
138
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
@@ -142,6 +142,7 @@ const MultiSelectFilter = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) =>
|
|
|
142
142
|
buttonBackgroundColor,
|
|
143
143
|
iconColorSelected,
|
|
144
144
|
buttonBackgroundColorSelected,
|
|
145
|
+
containerBorderColor,
|
|
145
146
|
...restTokens
|
|
146
147
|
} = (0, _ThemeProvider.useThemeTokens)('MultiSelectFilter', tokens, {
|
|
147
148
|
...variant,
|
|
@@ -287,7 +288,7 @@ const MultiSelectFilter = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) =>
|
|
|
287
288
|
...headerStyles,
|
|
288
289
|
lineHeight: headerLineHeight
|
|
289
290
|
},
|
|
290
|
-
children: getCopy('filterByLabel').replace(/%\{filterCategory\}/g, label
|
|
291
|
+
children: getCopy('filterByLabel').replace(/%\{filterCategory\}/g, label)
|
|
291
292
|
})
|
|
292
293
|
})
|
|
293
294
|
}), subtitle && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
@@ -308,6 +309,7 @@ const MultiSelectFilter = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) =>
|
|
|
308
309
|
style: styles.options,
|
|
309
310
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScrollView.default, {
|
|
310
311
|
onLayout: handleScrollViewLayout,
|
|
312
|
+
style: styles.scrollContainer,
|
|
311
313
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
312
314
|
distribute: "between",
|
|
313
315
|
onLayout: handleRowLayout,
|
|
@@ -326,12 +328,11 @@ const MultiSelectFilter = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) =>
|
|
|
326
328
|
})]
|
|
327
329
|
});
|
|
328
330
|
const controlsContent = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
329
|
-
children: [isScrolling
|
|
331
|
+
children: [isScrolling && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {
|
|
330
332
|
tokens: {
|
|
331
333
|
color: dividerColor
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spacer.default, {
|
|
334
|
+
}
|
|
335
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spacer.default, {
|
|
335
336
|
space: 4
|
|
336
337
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
337
338
|
style: selectControlsTokens(restTokens),
|
|
@@ -388,7 +389,8 @@ const MultiSelectFilter = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) =>
|
|
|
388
389
|
minWidth: windowWidth,
|
|
389
390
|
tokens: {
|
|
390
391
|
...tokens,
|
|
391
|
-
maxWidth: true
|
|
392
|
+
maxWidth: true,
|
|
393
|
+
borderColor: containerBorderColor
|
|
392
394
|
},
|
|
393
395
|
copy: copy,
|
|
394
396
|
isReady: isReady,
|
|
@@ -414,7 +416,8 @@ const MultiSelectFilter = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) =>
|
|
|
414
416
|
minWidth: minWidth,
|
|
415
417
|
tokens: {
|
|
416
418
|
...tokens,
|
|
417
|
-
maxWidth: items.length > MAX_ITEMS_THRESHOLD ? true : maxWidth
|
|
419
|
+
maxWidth: items.length > MAX_ITEMS_THRESHOLD ? true : maxWidth,
|
|
420
|
+
borderColor: containerBorderColor
|
|
418
421
|
},
|
|
419
422
|
copy: copy,
|
|
420
423
|
isReady: isReady,
|
|
@@ -442,6 +445,9 @@ const styles = _StyleSheet.default.create({
|
|
|
442
445
|
},
|
|
443
446
|
options: {
|
|
444
447
|
flex: 1
|
|
448
|
+
},
|
|
449
|
+
scrollContainer: {
|
|
450
|
+
padding: 1
|
|
445
451
|
}
|
|
446
452
|
});
|
|
447
453
|
|
|
@@ -101,6 +101,17 @@ const selectSwitchStyles = _ref6 => {
|
|
|
101
101
|
})
|
|
102
102
|
};
|
|
103
103
|
};
|
|
104
|
+
const selectMobileTokens = tokens => ({
|
|
105
|
+
..._Platform.default.select({
|
|
106
|
+
web: {},
|
|
107
|
+
default: {
|
|
108
|
+
switchSize: tokens?.mobileSwitchSize,
|
|
109
|
+
trackHeight: tokens?.mobileTrackHeight,
|
|
110
|
+
width: tokens?.mobileWidth,
|
|
111
|
+
trackBorderWidth: tokens?.mobileTrackBorderWidth
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
});
|
|
104
115
|
const selectLabelStyles = _ref7 => {
|
|
105
116
|
let {
|
|
106
117
|
labelMarginLeft
|
|
@@ -153,7 +164,7 @@ const ToggleSwitch = /*#__PURE__*/_react.default.forwardRef((_ref9, ref) => {
|
|
|
153
164
|
onChange
|
|
154
165
|
});
|
|
155
166
|
const handlePress = event => setValue(!currentValue, event);
|
|
156
|
-
const getButtonTokens = buttonState => selectButtonTokens(getTokens(buttonState), getTokens(themeTokens));
|
|
167
|
+
const getButtonTokens = buttonState => selectButtonTokens(getTokens(buttonState, selectMobileTokens(themeTokens)), getTokens(themeTokens, selectMobileTokens(themeTokens)));
|
|
157
168
|
const uniqueId = (0, _utils.useUniqueId)('toggleSwitch');
|
|
158
169
|
const inputId = id ?? uniqueId;
|
|
159
170
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StackView.default, {
|
|
@@ -186,7 +197,7 @@ const ToggleSwitch = /*#__PURE__*/_react.default.forwardRef((_ref9, ref) => {
|
|
|
186
197
|
onPress: handlePress,
|
|
187
198
|
...selectProps(rest),
|
|
188
199
|
children: buttonState => {
|
|
189
|
-
const stateTokens = getTokens(buttonState);
|
|
200
|
+
const stateTokens = getTokens(buttonState, selectMobileTokens(themeTokens));
|
|
190
201
|
const IconComponent = stateTokens.icon;
|
|
191
202
|
const switchStyles = selectSwitchStyles(stateTokens);
|
|
192
203
|
const trackStyles = selectTrackStyles(stateTokens);
|
|
@@ -44,7 +44,7 @@ const Validator = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
44
44
|
supportsProps
|
|
45
45
|
} = selectProps(rest);
|
|
46
46
|
const strValidation = supportsProps.validation;
|
|
47
|
-
const [
|
|
47
|
+
const [, setIndividualCodes] = _react.default.useState({});
|
|
48
48
|
const [text, setText] = _react.default.useState(value);
|
|
49
49
|
const validatorsLength = 6;
|
|
50
50
|
const prefix = 'code';
|
|
@@ -62,64 +62,85 @@ const Validator = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
62
62
|
const [codeReferences, singleCodes] = _react.default.useMemo(() => {
|
|
63
63
|
const codes = [];
|
|
64
64
|
const valueCodes = {};
|
|
65
|
-
|
|
65
|
+
Array.from({
|
|
66
|
+
length: validatorsLength
|
|
67
|
+
}, (_, i) => {
|
|
66
68
|
codes[prefix + i] = /*#__PURE__*/_react.default.createRef();
|
|
67
69
|
valueCodes[prefix + i] = '';
|
|
68
70
|
valueCodes[prefix + i + sufixValidation] = '';
|
|
69
|
-
|
|
71
|
+
return null;
|
|
72
|
+
});
|
|
70
73
|
return [codes, valueCodes];
|
|
71
|
-
}, []);
|
|
72
|
-
const handleSingleCodes = (codeId, val, validation) => {
|
|
74
|
+
}, [validatorsLength, prefix, sufixValidation]);
|
|
75
|
+
const handleSingleCodes = _react.default.useCallback((codeId, val, validation) => {
|
|
73
76
|
singleCodes[codeId] = val;
|
|
74
77
|
singleCodes[codeId + sufixValidation] = validation;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
...individualCodes,
|
|
78
|
+
setIndividualCodes(prev => ({
|
|
79
|
+
...prev,
|
|
78
80
|
[codeId]: val
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
const changeDataMasking = boxElement => {
|
|
81
|
+
}));
|
|
82
|
+
}, [singleCodes, sufixValidation]);
|
|
83
|
+
const changeDataMasking = _react.default.useCallback(boxElement => {
|
|
82
84
|
let charMasking = '';
|
|
83
85
|
const element = boxElement;
|
|
84
|
-
if (mask && mask.length === 1)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
if (mask && mask.length === 1) {
|
|
87
|
+
charMasking = mask;
|
|
88
|
+
} else if (mask && mask.length > 1) {
|
|
89
|
+
charMasking = mask.substring(0, 1);
|
|
90
|
+
}
|
|
91
|
+
if (charMasking && element) {
|
|
92
|
+
element.value = charMasking;
|
|
93
|
+
}
|
|
94
|
+
}, [mask]);
|
|
95
|
+
const handleChangeCode = _react.default.useCallback(() => {
|
|
96
|
+
const code = Array.from({
|
|
97
|
+
length: validatorsLength
|
|
98
|
+
}, (_, i) => singleCodes[prefix + i] || '').join('');
|
|
99
|
+
if (typeof onChange === 'function') {
|
|
100
|
+
onChange(code, singleCodes);
|
|
101
|
+
}
|
|
102
|
+
}, [validatorsLength, singleCodes, prefix, onChange]);
|
|
103
|
+
const handleChangeCodeValues = _react.default.useCallback((event, codeId, nextIndex) => {
|
|
93
104
|
const codeElement = codeReferences[codeId]?.current;
|
|
94
105
|
const val = event.nativeEvent?.value || event.target?.value;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
106
|
+
|
|
107
|
+
// Only allow numeric characters and limit to single digit
|
|
108
|
+
const numericOnly = val.replace(/\D/g, '').substring(0, 1);
|
|
109
|
+
if (codeElement && codeElement.value) {
|
|
110
|
+
codeElement.value = numericOnly;
|
|
98
111
|
}
|
|
99
|
-
handleSingleCodes(codeId,
|
|
112
|
+
handleSingleCodes(codeId, numericOnly, numericOnly ? 'success' : '');
|
|
100
113
|
handleChangeCode();
|
|
101
114
|
if (nextIndex === validatorsLength) {
|
|
102
|
-
codeElement
|
|
115
|
+
codeElement?.blur();
|
|
103
116
|
changeDataMasking(codeElement);
|
|
104
117
|
return;
|
|
105
118
|
}
|
|
106
|
-
if (
|
|
107
|
-
codeReferences[prefix + nextIndex]
|
|
119
|
+
if (numericOnly.length > 0) {
|
|
120
|
+
const nextElement = codeReferences[prefix + nextIndex]?.current;
|
|
121
|
+
nextElement?.focus();
|
|
108
122
|
changeDataMasking(codeElement);
|
|
109
123
|
}
|
|
110
|
-
};
|
|
124
|
+
}, [codeReferences, handleSingleCodes, handleChangeCode, validatorsLength, changeDataMasking, prefix]);
|
|
111
125
|
const handleKeyPress = (event, currentIndex, previousIndex) => {
|
|
112
|
-
if (!(event.keyCode === 8 || event.code === 'Backspace'))
|
|
126
|
+
if (!(event.keyCode === 8 || event.code === 'Backspace')) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
113
129
|
if (currentIndex > 0) {
|
|
114
|
-
codeReferences[prefix + currentIndex]
|
|
115
|
-
codeReferences[prefix + previousIndex]
|
|
130
|
+
const currentElement = codeReferences[prefix + currentIndex]?.current;
|
|
131
|
+
const previousElement = codeReferences[prefix + previousIndex]?.current;
|
|
132
|
+
if (currentElement && currentElement.value) {
|
|
133
|
+
currentElement.value = '';
|
|
134
|
+
}
|
|
135
|
+
previousElement?.focus();
|
|
116
136
|
}
|
|
117
137
|
handleSingleCodes(prefix + currentIndex, '', '');
|
|
118
138
|
handleChangeCode();
|
|
119
139
|
};
|
|
120
140
|
const getCodeComponents = () => {
|
|
121
|
-
|
|
122
|
-
|
|
141
|
+
return Array.from({
|
|
142
|
+
length: validatorsLength
|
|
143
|
+
}, (_, i) => {
|
|
123
144
|
const codeId = prefix + i;
|
|
124
145
|
const codeInputProps = {
|
|
125
146
|
nativeID: codeId,
|
|
@@ -127,65 +148,115 @@ const Validator = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
127
148
|
ref: codeReferences[codeId] ?? null,
|
|
128
149
|
validation: strValidation || singleCodes[codeId + sufixValidation],
|
|
129
150
|
tokens: selectCodeTextInputTokens(themeTokens),
|
|
130
|
-
onFocus: () =>
|
|
151
|
+
onFocus: () => {
|
|
152
|
+
const element = codeReferences[codeId]?.current;
|
|
153
|
+
if (_Platform.default.OS === 'web' && element?.select) {
|
|
154
|
+
return element.select() ?? null;
|
|
155
|
+
}
|
|
156
|
+
if (element?.focus) {
|
|
157
|
+
return element.focus() ?? null;
|
|
158
|
+
}
|
|
159
|
+
return null;
|
|
160
|
+
},
|
|
131
161
|
onKeyPress: event => handleKeyPress(event, i, i - 1),
|
|
132
162
|
onMouseOver: handleMouseOver,
|
|
133
163
|
onMouseOut: handleMouseOut,
|
|
134
164
|
inactive
|
|
135
165
|
};
|
|
136
|
-
codeInputProps.validation
|
|
137
|
-
|
|
166
|
+
if (!codeInputProps.validation) {
|
|
167
|
+
delete codeInputProps.validation;
|
|
168
|
+
}
|
|
169
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
138
170
|
style: staticStyles.codeInputWidth,
|
|
139
171
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextInput.TextInput, {
|
|
140
172
|
...codeInputProps
|
|
141
173
|
})
|
|
142
|
-
}, codeId)
|
|
143
|
-
}
|
|
144
|
-
return components;
|
|
174
|
+
}, codeId);
|
|
175
|
+
});
|
|
145
176
|
};
|
|
146
177
|
_react.default.useEffect(() => {
|
|
147
|
-
|
|
148
|
-
|
|
178
|
+
if (Number(value).toString() !== 'NaN') {
|
|
179
|
+
setText(value);
|
|
180
|
+
}
|
|
149
181
|
}, [value]);
|
|
150
|
-
|
|
151
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
152
182
|
_react.default.useEffect(() => {
|
|
153
|
-
|
|
154
|
-
|
|
183
|
+
Array.from({
|
|
184
|
+
length: validatorsLength
|
|
185
|
+
}, (_, i) => {
|
|
186
|
+
const element = codeReferences[prefix + i]?.current;
|
|
187
|
+
if (element && element.value !== undefined) {
|
|
188
|
+
if (mask && text[i]) {
|
|
189
|
+
element.value = mask;
|
|
190
|
+
} else {
|
|
191
|
+
element.value = text[i] ?? '';
|
|
192
|
+
}
|
|
193
|
+
}
|
|
155
194
|
handleSingleCodes(prefix + i, text[i] ?? '', text[i] ? 'success' : '');
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
195
|
+
return null;
|
|
196
|
+
});
|
|
197
|
+
}, [text, mask, validatorsLength, prefix, codeReferences, handleSingleCodes]);
|
|
160
198
|
_react.default.useEffect(() => {
|
|
161
199
|
const handlePasteCode = event => {
|
|
200
|
+
event.preventDefault();
|
|
201
|
+
|
|
202
|
+
// Clear current state first
|
|
162
203
|
setText('');
|
|
204
|
+
|
|
205
|
+
// Clear all individual input fields and their state
|
|
206
|
+
Array.from({
|
|
207
|
+
length: validatorsLength
|
|
208
|
+
}, (_, i) => {
|
|
209
|
+
const element = codeReferences[prefix + i]?.current;
|
|
210
|
+
if (element && element.value !== undefined) {
|
|
211
|
+
element.value = '';
|
|
212
|
+
}
|
|
213
|
+
handleSingleCodes(prefix + i, '', '');
|
|
214
|
+
return null;
|
|
215
|
+
});
|
|
163
216
|
const clipBoardText = event.clipboardData.getData('text');
|
|
164
|
-
|
|
217
|
+
|
|
218
|
+
// Validate that input contains only digits and truncate to 6 characters
|
|
219
|
+
const numericOnly = clipBoardText.replace(/\D/g, '').substring(0, validatorsLength);
|
|
220
|
+
if (numericOnly.length > 0) {
|
|
221
|
+
setText(numericOnly);
|
|
222
|
+
}
|
|
165
223
|
};
|
|
166
224
|
const handleCopy = event => {
|
|
167
|
-
|
|
168
|
-
|
|
225
|
+
const clipBoardText = Array.from({
|
|
226
|
+
length: validatorsLength
|
|
227
|
+
}, (_, i) => singleCodes[prefix + i] || '').join('');
|
|
169
228
|
event.clipboardData.setData('text/plain', clipBoardText);
|
|
170
229
|
event.preventDefault();
|
|
171
230
|
};
|
|
172
231
|
if (_Platform.default.OS === 'web') {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
codeReferences[prefix + i]
|
|
177
|
-
|
|
232
|
+
Array.from({
|
|
233
|
+
length: validatorsLength
|
|
234
|
+
}, (_, i) => {
|
|
235
|
+
const element = codeReferences[prefix + i]?.current;
|
|
236
|
+
if (element && typeof element.addEventListener === 'function') {
|
|
237
|
+
element.addEventListener('paste', handlePasteCode);
|
|
238
|
+
element.addEventListener('copy', handleCopy);
|
|
239
|
+
element.addEventListener('input', event => handleChangeCodeValues(event, prefix + i, i + 1));
|
|
240
|
+
}
|
|
241
|
+
return null;
|
|
242
|
+
});
|
|
178
243
|
}
|
|
179
244
|
return () => {
|
|
180
|
-
if (_Platform.default.
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
codeReferences[prefix + i]?.current
|
|
185
|
-
|
|
245
|
+
if (_Platform.default.OS === 'web') {
|
|
246
|
+
Array.from({
|
|
247
|
+
length: validatorsLength
|
|
248
|
+
}, (_, i) => {
|
|
249
|
+
const element = codeReferences[prefix + i]?.current;
|
|
250
|
+
if (element && typeof element.removeEventListener === 'function') {
|
|
251
|
+
element.removeEventListener('paste', handlePasteCode);
|
|
252
|
+
element.removeEventListener('copy', handleCopy);
|
|
253
|
+
element.removeEventListener('input', event => handleChangeCodeValues(event, prefix + i, i + 1));
|
|
254
|
+
}
|
|
255
|
+
return null;
|
|
256
|
+
});
|
|
186
257
|
}
|
|
187
258
|
};
|
|
188
|
-
}, []);
|
|
259
|
+
}, [validatorsLength, prefix, codeReferences, handleChangeCodeValues, handleSingleCodes, singleCodes]);
|
|
189
260
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputSupports.default, {
|
|
190
261
|
...supportsProps,
|
|
191
262
|
feedbackProps: {
|
|
@@ -56,6 +56,7 @@ const staticStyles = StyleSheet.create({
|
|
|
56
56
|
});
|
|
57
57
|
const selectContainerStyle = (enableFullscreen, themeTokens) => ({
|
|
58
58
|
borderColor: themeTokens.borderColor,
|
|
59
|
+
backgroundColor: themeTokens.backgroundColor,
|
|
59
60
|
...Platform.select({
|
|
60
61
|
web: {
|
|
61
62
|
position: enableFullscreen ? 'fixed' : 'absolute'
|
|
@@ -107,7 +108,8 @@ const ModalOverlay = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
107
108
|
maxHeight: maxHeightSize
|
|
108
109
|
};
|
|
109
110
|
const {
|
|
110
|
-
closeIcon: CloseIconComponent
|
|
111
|
+
closeIcon: CloseIconComponent,
|
|
112
|
+
backgroundColor
|
|
111
113
|
} = themeTokens;
|
|
112
114
|
const getCopy = useCopy({
|
|
113
115
|
dictionary,
|
|
@@ -120,7 +122,10 @@ const ModalOverlay = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
120
122
|
onLayout: onLayout,
|
|
121
123
|
style: [overlaidPosition, containerWidthHeight, staticStyles.positioner, !isReady && staticStyles.hidden, selectContainerStyle(enableFullscreen, themeTokens)],
|
|
122
124
|
children: /*#__PURE__*/_jsxs(Card, {
|
|
123
|
-
tokens:
|
|
125
|
+
tokens: {
|
|
126
|
+
...staticStyles.card,
|
|
127
|
+
backgroundColor
|
|
128
|
+
},
|
|
124
129
|
children: [/*#__PURE__*/_jsx(View, {
|
|
125
130
|
style: [staticStyles.closeButtonContainer, selectCloseButtonContainerStyles(themeTokens)],
|
|
126
131
|
children: /*#__PURE__*/_jsx(IconButton, {
|
|
@@ -135,6 +135,7 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
135
135
|
buttonBackgroundColor,
|
|
136
136
|
iconColorSelected,
|
|
137
137
|
buttonBackgroundColorSelected,
|
|
138
|
+
containerBorderColor,
|
|
138
139
|
...restTokens
|
|
139
140
|
} = useThemeTokens('MultiSelectFilter', tokens, {
|
|
140
141
|
...variant,
|
|
@@ -280,7 +281,7 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
280
281
|
...headerStyles,
|
|
281
282
|
lineHeight: headerLineHeight
|
|
282
283
|
},
|
|
283
|
-
children: getCopy('filterByLabel').replace(/%\{filterCategory\}/g, label
|
|
284
|
+
children: getCopy('filterByLabel').replace(/%\{filterCategory\}/g, label)
|
|
284
285
|
})
|
|
285
286
|
})
|
|
286
287
|
}), subtitle && /*#__PURE__*/_jsxs(_Fragment, {
|
|
@@ -301,6 +302,7 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
301
302
|
style: styles.options,
|
|
302
303
|
children: /*#__PURE__*/_jsx(ScrollView, {
|
|
303
304
|
onLayout: handleScrollViewLayout,
|
|
305
|
+
style: styles.scrollContainer,
|
|
304
306
|
children: /*#__PURE__*/_jsx(Row, {
|
|
305
307
|
distribute: "between",
|
|
306
308
|
onLayout: handleRowLayout,
|
|
@@ -319,12 +321,11 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
319
321
|
})]
|
|
320
322
|
});
|
|
321
323
|
const controlsContent = /*#__PURE__*/_jsxs(_Fragment, {
|
|
322
|
-
children: [isScrolling
|
|
324
|
+
children: [isScrolling && /*#__PURE__*/_jsx(Divider, {
|
|
323
325
|
tokens: {
|
|
324
326
|
color: dividerColor
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
}) : /*#__PURE__*/_jsx(Spacer, {
|
|
327
|
+
}
|
|
328
|
+
}), /*#__PURE__*/_jsx(Spacer, {
|
|
328
329
|
space: 4
|
|
329
330
|
}), /*#__PURE__*/_jsx(View, {
|
|
330
331
|
style: selectControlsTokens(restTokens),
|
|
@@ -381,7 +382,8 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
381
382
|
minWidth: windowWidth,
|
|
382
383
|
tokens: {
|
|
383
384
|
...tokens,
|
|
384
|
-
maxWidth: true
|
|
385
|
+
maxWidth: true,
|
|
386
|
+
borderColor: containerBorderColor
|
|
385
387
|
},
|
|
386
388
|
copy: copy,
|
|
387
389
|
isReady: isReady,
|
|
@@ -407,7 +409,8 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
407
409
|
minWidth: minWidth,
|
|
408
410
|
tokens: {
|
|
409
411
|
...tokens,
|
|
410
|
-
maxWidth: items.length > MAX_ITEMS_THRESHOLD ? true : maxWidth
|
|
412
|
+
maxWidth: items.length > MAX_ITEMS_THRESHOLD ? true : maxWidth,
|
|
413
|
+
borderColor: containerBorderColor
|
|
411
414
|
},
|
|
412
415
|
copy: copy,
|
|
413
416
|
isReady: isReady,
|
|
@@ -435,6 +438,9 @@ const styles = StyleSheet.create({
|
|
|
435
438
|
},
|
|
436
439
|
options: {
|
|
437
440
|
flex: 1
|
|
441
|
+
},
|
|
442
|
+
scrollContainer: {
|
|
443
|
+
padding: 1
|
|
438
444
|
}
|
|
439
445
|
});
|
|
440
446
|
|
|
@@ -94,6 +94,17 @@ const selectSwitchStyles = _ref6 => {
|
|
|
94
94
|
})
|
|
95
95
|
};
|
|
96
96
|
};
|
|
97
|
+
const selectMobileTokens = tokens => ({
|
|
98
|
+
...Platform.select({
|
|
99
|
+
web: {},
|
|
100
|
+
default: {
|
|
101
|
+
switchSize: tokens?.mobileSwitchSize,
|
|
102
|
+
trackHeight: tokens?.mobileTrackHeight,
|
|
103
|
+
width: tokens?.mobileWidth,
|
|
104
|
+
trackBorderWidth: tokens?.mobileTrackBorderWidth
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
});
|
|
97
108
|
const selectLabelStyles = _ref7 => {
|
|
98
109
|
let {
|
|
99
110
|
labelMarginLeft
|
|
@@ -146,7 +157,7 @@ const ToggleSwitch = /*#__PURE__*/React.forwardRef((_ref9, ref) => {
|
|
|
146
157
|
onChange
|
|
147
158
|
});
|
|
148
159
|
const handlePress = event => setValue(!currentValue, event);
|
|
149
|
-
const getButtonTokens = buttonState => selectButtonTokens(getTokens(buttonState), getTokens(themeTokens));
|
|
160
|
+
const getButtonTokens = buttonState => selectButtonTokens(getTokens(buttonState, selectMobileTokens(themeTokens)), getTokens(themeTokens, selectMobileTokens(themeTokens)));
|
|
150
161
|
const uniqueId = useUniqueId('toggleSwitch');
|
|
151
162
|
const inputId = id ?? uniqueId;
|
|
152
163
|
return /*#__PURE__*/_jsxs(StackView, {
|
|
@@ -179,7 +190,7 @@ const ToggleSwitch = /*#__PURE__*/React.forwardRef((_ref9, ref) => {
|
|
|
179
190
|
onPress: handlePress,
|
|
180
191
|
...selectProps(rest),
|
|
181
192
|
children: buttonState => {
|
|
182
|
-
const stateTokens = getTokens(buttonState);
|
|
193
|
+
const stateTokens = getTokens(buttonState, selectMobileTokens(themeTokens));
|
|
183
194
|
const IconComponent = stateTokens.icon;
|
|
184
195
|
const switchStyles = selectSwitchStyles(stateTokens);
|
|
185
196
|
const trackStyles = selectTrackStyles(stateTokens);
|