@telus-uds/components-base 3.28.0 → 3.28.2
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 +20 -2
- package/lib/cjs/Autocomplete/Autocomplete.js +86 -32
- package/lib/cjs/Autocomplete/constants.js +2 -1
- package/lib/cjs/Carousel/Carousel.js +17 -17
- package/lib/cjs/Carousel/CarouselItem/CarouselItem.js +3 -3
- package/lib/cjs/Listbox/ListboxOverlay.js +7 -1
- package/lib/cjs/Listbox/PressableItem.js +2 -2
- package/lib/cjs/MultiSelectFilter/MultiSelectFilter.js +5 -1
- package/lib/cjs/TextInput/TextInputBase.js +2 -2
- package/lib/esm/Autocomplete/Autocomplete.js +87 -33
- package/lib/esm/Autocomplete/constants.js +1 -0
- package/lib/esm/Carousel/Carousel.js +17 -17
- package/lib/esm/Carousel/CarouselItem/CarouselItem.js +3 -3
- package/lib/esm/Listbox/ListboxOverlay.js +7 -1
- package/lib/esm/Listbox/PressableItem.js +3 -3
- package/lib/esm/MultiSelectFilter/MultiSelectFilter.js +5 -1
- package/lib/esm/TextInput/TextInputBase.js +2 -2
- package/lib/package.json +1 -1
- package/package.json +1 -1
- package/src/Autocomplete/Autocomplete.jsx +142 -77
- package/src/Autocomplete/constants.js +1 -0
- package/src/Carousel/Carousel.jsx +17 -17
- package/src/Carousel/CarouselItem/CarouselItem.jsx +3 -3
- package/src/Listbox/ListboxOverlay.jsx +9 -1
- package/src/Listbox/PressableItem.jsx +1 -1
- package/src/MultiSelectFilter/MultiSelectFilter.jsx +6 -1
- package/src/TextInput/TextInputBase.jsx +2 -2
|
@@ -14,7 +14,7 @@ import { TextInput } from '../TextInput';
|
|
|
14
14
|
import InputSupports from '../InputSupports';
|
|
15
15
|
import Loading from './Loading';
|
|
16
16
|
import Suggestions from './Suggestions';
|
|
17
|
-
import { DEFAULT_MAX_SUGGESTIONS, DEFAULT_MIN_TO_SUGGESTION, INPUT_LEFT_PADDING, MIN_LISTBOX_WIDTH } from './constants';
|
|
17
|
+
import { DEFAULT_MAX_SUGGESTIONS, DEFAULT_MIN_TO_SUGGESTION, DEFAULT_MAX_DROPDOWN_HEIGHT, INPUT_LEFT_PADDING, MIN_LISTBOX_WIDTH } from './constants';
|
|
18
18
|
import dictionary from './dictionary';
|
|
19
19
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
20
|
const staticStyles = StyleSheet.create({
|
|
@@ -44,22 +44,36 @@ const highlightAllMatches = function (str) {
|
|
|
44
44
|
tokens: {
|
|
45
45
|
color: resultsTextColor
|
|
46
46
|
},
|
|
47
|
-
children: matchIndexes.reduce((acc, matchIndex, index) =>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
47
|
+
children: matchIndexes.reduce((acc, matchIndex, index) => {
|
|
48
|
+
const prefix = index === 0 ? str.slice(0, matchIndex) : null;
|
|
49
|
+
const match = str.slice(matchIndex, matchIndex + substring.length);
|
|
50
|
+
const suffix = str.slice(matchIndex + substring.length, matchIndexes[index + 1] ?? str.length);
|
|
51
|
+
return [...acc, prefix ? /*#__PURE__*/_jsx(Typography, {
|
|
52
|
+
variant: {
|
|
53
|
+
bold: false
|
|
54
|
+
},
|
|
55
|
+
tokens: {
|
|
56
|
+
color: resultsTextColor
|
|
57
|
+
},
|
|
58
|
+
children: prefix
|
|
59
|
+
}, `pre-${matchIndex}`) : null, /*#__PURE__*/_jsx(Typography, {
|
|
60
|
+
variant: {
|
|
61
|
+
bold: true
|
|
62
|
+
},
|
|
63
|
+
tokens: {
|
|
64
|
+
color: resultsTextColor
|
|
65
|
+
},
|
|
66
|
+
children: match
|
|
67
|
+
}, matchIndex), suffix ? /*#__PURE__*/_jsx(Typography, {
|
|
68
|
+
variant: {
|
|
69
|
+
bold: false
|
|
70
|
+
},
|
|
71
|
+
tokens: {
|
|
72
|
+
color: resultsTextColor
|
|
73
|
+
},
|
|
74
|
+
children: suffix
|
|
75
|
+
}, `post-${matchIndex}`) : null];
|
|
76
|
+
}, []).filter(Boolean)
|
|
63
77
|
})
|
|
64
78
|
);
|
|
65
79
|
};
|
|
@@ -93,12 +107,14 @@ const Autocomplete = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
93
107
|
isLoading = false,
|
|
94
108
|
items,
|
|
95
109
|
maxSuggestions = DEFAULT_MAX_SUGGESTIONS,
|
|
110
|
+
maxDropdownHeight = DEFAULT_MAX_DROPDOWN_HEIGHT,
|
|
96
111
|
minToSuggestion = DEFAULT_MIN_TO_SUGGESTION,
|
|
97
112
|
noResults,
|
|
98
113
|
onChange,
|
|
99
114
|
onClear,
|
|
100
115
|
onSelect,
|
|
101
116
|
readOnly,
|
|
117
|
+
showOptionsOnFocus = false,
|
|
102
118
|
validation,
|
|
103
119
|
value,
|
|
104
120
|
helpText = '',
|
|
@@ -147,7 +163,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
147
163
|
hint,
|
|
148
164
|
label: inputLabel
|
|
149
165
|
} = supportsProps;
|
|
150
|
-
const hintExpansionEnabled = isFocused && helpText && !currentValue;
|
|
166
|
+
const hintExpansionEnabled = isFocused && !!helpText && !currentValue;
|
|
151
167
|
const {
|
|
152
168
|
overlaidPosition,
|
|
153
169
|
sourceRef: inputRef,
|
|
@@ -201,9 +217,10 @@ const Autocomplete = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
201
217
|
}
|
|
202
218
|
};
|
|
203
219
|
const handleChange = newValue => {
|
|
204
|
-
onChange?.(newValue
|
|
220
|
+
onChange?.(newValue);
|
|
205
221
|
setCurrentValue(newValue);
|
|
206
|
-
|
|
222
|
+
const shouldExpand = newValue?.length >= minToSuggestion || showOptionsOnFocus && isFocused && newValue?.length === 0;
|
|
223
|
+
setIsExpanded(shouldExpand);
|
|
207
224
|
if (!isControlled && initialItems !== undefined) {
|
|
208
225
|
setCurrentItems(initialItems.filter(_ref3 => {
|
|
209
226
|
let {
|
|
@@ -215,25 +232,29 @@ const Autocomplete = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
215
232
|
};
|
|
216
233
|
const handleSelect = selectedId => {
|
|
217
234
|
onSelect?.(selectedId);
|
|
218
|
-
const {
|
|
219
|
-
label: newValue,
|
|
220
|
-
nested,
|
|
221
|
-
title
|
|
222
|
-
} = (isControlled ? items : currentItems)?.find(_ref4 => {
|
|
235
|
+
const selectedItem = (isControlled ? items : currentItems)?.find(_ref4 => {
|
|
223
236
|
let {
|
|
224
237
|
id
|
|
225
238
|
} = _ref4;
|
|
226
239
|
return id === selectedId;
|
|
227
240
|
});
|
|
241
|
+
const {
|
|
242
|
+
label,
|
|
243
|
+
nested,
|
|
244
|
+
title
|
|
245
|
+
} = selectedItem;
|
|
228
246
|
if (title) return;
|
|
229
247
|
if (!nested) {
|
|
230
248
|
setNestedSelectedValue(null);
|
|
231
|
-
onChange?.(
|
|
249
|
+
onChange?.(label);
|
|
232
250
|
setIsExpanded(false);
|
|
251
|
+
setCurrentValue(label);
|
|
252
|
+
}
|
|
253
|
+
if (!isControlled && inputRef?.current) inputRef.current.value = label;
|
|
254
|
+
if (nested) {
|
|
255
|
+
setNestedSelectedValue(label);
|
|
256
|
+
setCurrentValue(label);
|
|
233
257
|
}
|
|
234
|
-
setCurrentValue(newValue);
|
|
235
|
-
if (!isControlled && inputRef?.current) inputRef.current.value = newValue;
|
|
236
|
-
if (nested) setNestedSelectedValue(newValue);
|
|
237
258
|
inputRef.current.focus();
|
|
238
259
|
};
|
|
239
260
|
|
|
@@ -281,15 +302,33 @@ const Autocomplete = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
281
302
|
};
|
|
282
303
|
}, [inputRef]);
|
|
283
304
|
const handleClose = event => {
|
|
284
|
-
if (event.type === 'keydown' && (event.key === 'Escape' || event.key === '27')
|
|
305
|
+
if (event.type === 'keydown' && (event.key === 'Escape' || event.key === '27')) {
|
|
285
306
|
setIsExpanded(false);
|
|
286
307
|
setNestedSelectedValue(null);
|
|
287
|
-
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
if (event.type === 'keydown' && (event.key === 'ArrowDown' || event.key === 'Tab') && isExpanded && !isLoading && targetRef?.current) {
|
|
288
311
|
event.preventDefault();
|
|
289
312
|
targetRef.current.focus();
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
if (event.type === 'click' || event.type === 'touchstart') {
|
|
316
|
+
const clickTarget = event.type === 'click' ? event.target : event.touches[0]?.target;
|
|
317
|
+
const isOutsideOverlay = openOverlayRef?.current && !openOverlayRef.current.contains(clickTarget);
|
|
318
|
+
const isOutsideInput = inputRef?.current && !inputRef.current.contains(clickTarget);
|
|
319
|
+
if (isOutsideOverlay && isOutsideInput) {
|
|
320
|
+
setIsExpanded(false);
|
|
321
|
+
setNestedSelectedValue(null);
|
|
322
|
+
}
|
|
290
323
|
}
|
|
291
324
|
};
|
|
292
|
-
|
|
325
|
+
// Calculate items to show based on current state
|
|
326
|
+
let itemsToShow = [];
|
|
327
|
+
if (currentValue?.length > 0) {
|
|
328
|
+
itemsToShow = itemsToSuggest(highlight(isControlled ? items : currentItems, currentValue, resultsTextColor));
|
|
329
|
+
} else if (showOptionsOnFocus && isFocused) {
|
|
330
|
+
itemsToShow = itemsToSuggest(isControlled ? items : currentItems || initialItems);
|
|
331
|
+
}
|
|
293
332
|
const helpTextToShow = isFocused && !currentValue ? helpText : noResults ?? getCopy('noResults');
|
|
294
333
|
return /*#__PURE__*/_jsxs(View, {
|
|
295
334
|
style: staticStyles.container,
|
|
@@ -326,9 +365,15 @@ const Autocomplete = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
326
365
|
onChange: handleChange,
|
|
327
366
|
onFocus: () => {
|
|
328
367
|
setisFocused(true);
|
|
368
|
+
if (showOptionsOnFocus && (!currentValue || currentValue.length === 0)) {
|
|
369
|
+
setIsExpanded(true);
|
|
370
|
+
}
|
|
329
371
|
},
|
|
330
372
|
onBlur: () => {
|
|
331
373
|
setisFocused(false);
|
|
374
|
+
if (showOptionsOnFocus && (!currentValue || currentValue.length === 0)) {
|
|
375
|
+
setIsExpanded(false);
|
|
376
|
+
}
|
|
332
377
|
},
|
|
333
378
|
onClear: onClear,
|
|
334
379
|
onKeyPress: handleClose,
|
|
@@ -360,12 +405,13 @@ const Autocomplete = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
360
405
|
})
|
|
361
406
|
});
|
|
362
407
|
}
|
|
363
|
-
}), (isExpanded || hintExpansionEnabled) && isInputVisible && /*#__PURE__*/_jsxs(_Fragment, {
|
|
408
|
+
}), (isExpanded || hintExpansionEnabled) && isInputVisible && (itemsToShow.length > 0 || isExpanded || hintExpansionEnabled) && /*#__PURE__*/_jsxs(_Fragment, {
|
|
364
409
|
children: [/*#__PURE__*/_jsx(Listbox.Overlay, {
|
|
365
410
|
overlaidPosition: overlaidPosition,
|
|
366
411
|
isReady: isReady,
|
|
367
412
|
minWidth: fullWidth ? inputWidth : MIN_LISTBOX_WIDTH,
|
|
368
413
|
maxWidth: inputWidth,
|
|
414
|
+
maxHeight: maxDropdownHeight,
|
|
369
415
|
onLayout: handleMeasure,
|
|
370
416
|
tokens: restOfTokens,
|
|
371
417
|
ref: openOverlayRef,
|
|
@@ -449,6 +495,10 @@ Autocomplete.propTypes = {
|
|
|
449
495
|
* Maximum number of suggestions provided at the same time
|
|
450
496
|
*/
|
|
451
497
|
maxSuggestions: PropTypes.number,
|
|
498
|
+
/**
|
|
499
|
+
* Maximum height (in pixels) of the dropdown before scrolling is enabled
|
|
500
|
+
*/
|
|
501
|
+
maxDropdownHeight: PropTypes.number,
|
|
452
502
|
/**
|
|
453
503
|
* Text or JSX to render when no results are available
|
|
454
504
|
*/
|
|
@@ -469,6 +519,10 @@ Autocomplete.propTypes = {
|
|
|
469
519
|
* Callback function to be called when an item is selected from the list
|
|
470
520
|
*/
|
|
471
521
|
onSelect: PropTypes.func,
|
|
522
|
+
/**
|
|
523
|
+
* When true, displays all available options when the input receives focus (even without typing)
|
|
524
|
+
*/
|
|
525
|
+
showOptionsOnFocus: PropTypes.bool,
|
|
472
526
|
/**
|
|
473
527
|
* Input value for controlled usage
|
|
474
528
|
*/
|
|
@@ -84,7 +84,7 @@ const selectControlButtonPositionStyles = _ref => {
|
|
|
84
84
|
isAutoPlayEnabled,
|
|
85
85
|
viewport,
|
|
86
86
|
maxWidth,
|
|
87
|
-
|
|
87
|
+
containerWidth
|
|
88
88
|
} = _ref;
|
|
89
89
|
const styles = {};
|
|
90
90
|
let positionOffset = 0;
|
|
@@ -100,18 +100,19 @@ const selectControlButtonPositionStyles = _ref => {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
if (enablePeeking) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
const {
|
|
104
|
+
peekingMiddleSpace,
|
|
105
|
+
peekingGap
|
|
106
|
+
} = getPeekingProps(viewport);
|
|
107
|
+
const clampedMaxWidth = Math.min(maxWidth || containerWidth, containerWidth);
|
|
108
|
+
const slideRightEdge = (containerWidth + clampedMaxWidth) / 2 - peekingMiddleSpace;
|
|
109
|
+
const buttonCenter = slideRightEdge + peekingGap / 2;
|
|
110
|
+
positionOffset = containerWidth - buttonCenter - buttonWidth / 2;
|
|
110
111
|
}
|
|
111
112
|
styles[positionProperty] = positionOffset;
|
|
112
113
|
return styles;
|
|
113
114
|
};
|
|
114
|
-
const selectPreviousNextNavigationButtonStyles = (previousNextNavigationButtonWidth, previousNextNavigationPosition, spaceBetweenSlideAndPreviousNextNavigation, isFirstSlide, isLastSlide, areStylesAppliedOnPreviousButton, enablePeeking, enableDisplayMultipleItemsPerSlide, isAutoPlayEnabled, viewport, maxWidth,
|
|
115
|
+
const selectPreviousNextNavigationButtonStyles = (previousNextNavigationButtonWidth, previousNextNavigationPosition, spaceBetweenSlideAndPreviousNextNavigation, isFirstSlide, isLastSlide, areStylesAppliedOnPreviousButton, enablePeeking, enableDisplayMultipleItemsPerSlide, isAutoPlayEnabled, viewport, maxWidth, containerWidth) => {
|
|
115
116
|
const styles = {
|
|
116
117
|
zIndex: 1,
|
|
117
118
|
position: 'absolute'
|
|
@@ -135,7 +136,7 @@ const selectPreviousNextNavigationButtonStyles = (previousNextNavigationButtonWi
|
|
|
135
136
|
isAutoPlayEnabled,
|
|
136
137
|
viewport,
|
|
137
138
|
maxWidth,
|
|
138
|
-
|
|
139
|
+
containerWidth
|
|
139
140
|
})
|
|
140
141
|
};
|
|
141
142
|
};
|
|
@@ -272,7 +273,7 @@ const calculateFinalWidth = (containerWidth, enablePeeking, viewport, maxWidth)
|
|
|
272
273
|
peekingGap,
|
|
273
274
|
peekingMiddleSpace
|
|
274
275
|
} = getPeekingProps(viewport);
|
|
275
|
-
const baseWidth = maxWidth || containerWidth;
|
|
276
|
+
const baseWidth = Math.min(maxWidth || containerWidth, containerWidth);
|
|
276
277
|
finalWidth = baseWidth - peekingMiddleSpace * PEEKING_MULTIPLIER + peekingGap;
|
|
277
278
|
}
|
|
278
279
|
return finalWidth;
|
|
@@ -492,7 +493,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
492
493
|
peekingMiddleSpace
|
|
493
494
|
} = getPeekingProps(viewport);
|
|
494
495
|
let finalWidth;
|
|
495
|
-
const baseWidth = maxWidth || containerLayoutRef.current.width;
|
|
496
|
+
const baseWidth = Math.min(maxWidth || containerLayoutRef.current.width, containerLayoutRef.current.width);
|
|
496
497
|
const slideWide = baseWidth - peekingMiddleSpace * PEEKING_MULTIPLIER;
|
|
497
498
|
if (activeIndexRef.current === 0) {
|
|
498
499
|
finalWidth = 0;
|
|
@@ -916,8 +917,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
916
917
|
// Related discussion - https://github.com/telus/universal-design-system/issues/1549
|
|
917
918
|
const previousNextIconButtonVariants = {
|
|
918
919
|
size: previousNextIconSize,
|
|
919
|
-
raised:
|
|
920
|
-
inverse: variant?.inverse
|
|
920
|
+
raised: true
|
|
921
921
|
};
|
|
922
922
|
const getCopyWithPlaceholders = React.useCallback(copyKey => {
|
|
923
923
|
const copyText = getCopy(copyKey).replace(/%\{title\}/g, title).replace(/%\{itemLabel\}/g, itemLabel).replace(/%\{stepNumber\}/g, activeIndex + 1).replace(/%\{stepCount\}/g, totalItems);
|
|
@@ -1014,7 +1014,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
1014
1014
|
isAutoPlayEnabled,
|
|
1015
1015
|
viewport,
|
|
1016
1016
|
maxWidth,
|
|
1017
|
-
|
|
1017
|
+
containerWidth: containerLayout.width
|
|
1018
1018
|
})],
|
|
1019
1019
|
children: /*#__PURE__*/_jsx(IconButton, {
|
|
1020
1020
|
icon: isCarouselPlaying ? pauseIcon : playIcon,
|
|
@@ -1023,7 +1023,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
1023
1023
|
onPress: onAnimationControlButtonPress
|
|
1024
1024
|
})
|
|
1025
1025
|
}) : null, showPreviousNextNavigation && totalItems > 1 ? /*#__PURE__*/_jsx(View, {
|
|
1026
|
-
style: selectPreviousNextNavigationButtonStyles(previousNextNavigationButtonWidth, previousNextNavigationPosition, spaceBetweenSlideAndPreviousNextNavigation, isFirstSlide, isLastSlide, true, enablePeeking, enableDisplayMultipleItemsPerSlide, isAutoPlayEnabled, viewport, maxWidth,
|
|
1026
|
+
style: selectPreviousNextNavigationButtonStyles(previousNextNavigationButtonWidth, previousNextNavigationPosition, spaceBetweenSlideAndPreviousNextNavigation, isFirstSlide, isLastSlide, true, enablePeeking, enableDisplayMultipleItemsPerSlide, isAutoPlayEnabled, viewport, maxWidth, containerLayout.width),
|
|
1027
1027
|
testID: "previous-button-container",
|
|
1028
1028
|
children: /*#__PURE__*/_jsx(IconButton, {
|
|
1029
1029
|
onLayout: onPreviousNextNavigationButtonLayout,
|
|
@@ -1083,7 +1083,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
1083
1083
|
})
|
|
1084
1084
|
})
|
|
1085
1085
|
}), showPreviousNextNavigation && totalItems > 1 ? /*#__PURE__*/_jsx(View, {
|
|
1086
|
-
style: selectPreviousNextNavigationButtonStyles(previousNextNavigationButtonWidth, previousNextNavigationPosition, spaceBetweenSlideAndPreviousNextNavigation, isFirstSlide, isLastSlide, false, enablePeeking, enableDisplayMultipleItemsPerSlide, isAutoPlayEnabled, viewport, maxWidth,
|
|
1086
|
+
style: selectPreviousNextNavigationButtonStyles(previousNextNavigationButtonWidth, previousNextNavigationPosition, spaceBetweenSlideAndPreviousNextNavigation, isFirstSlide, isLastSlide, false, enablePeeking, enableDisplayMultipleItemsPerSlide, isAutoPlayEnabled, viewport, maxWidth, containerLayout.width),
|
|
1087
1087
|
testID: "next-button-container",
|
|
1088
1088
|
children: /*#__PURE__*/_jsx(IconButton, {
|
|
1089
1089
|
onLayout: onPreviousNextNavigationButtonLayout,
|
|
@@ -24,10 +24,10 @@ const selectContainerStyle = _ref => {
|
|
|
24
24
|
let marginLeft = 0;
|
|
25
25
|
if (enablePeeking) {
|
|
26
26
|
const isFirst = elementIndex === 0;
|
|
27
|
-
const
|
|
28
|
-
adjustedWidth =
|
|
27
|
+
const clampedMaxWidth = Math.min(maxWidth || width, width);
|
|
28
|
+
adjustedWidth = clampedMaxWidth - peekingMiddleSpace * 2;
|
|
29
29
|
if (isFirst) {
|
|
30
|
-
marginLeft = peekingMiddleSpace + (viewportWidth -
|
|
30
|
+
marginLeft = peekingMiddleSpace + (viewportWidth - clampedMaxWidth) / 2;
|
|
31
31
|
} else {
|
|
32
32
|
marginLeft = peekingGap;
|
|
33
33
|
}
|
|
@@ -28,6 +28,7 @@ const DropdownOverlay = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
28
28
|
isReady = false,
|
|
29
29
|
overlaidPosition,
|
|
30
30
|
maxWidth,
|
|
31
|
+
maxHeight,
|
|
31
32
|
minWidth,
|
|
32
33
|
onLayout,
|
|
33
34
|
tokens,
|
|
@@ -43,12 +44,16 @@ const DropdownOverlay = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
43
44
|
maxWidth,
|
|
44
45
|
minWidth
|
|
45
46
|
}, staticStyles.positioner, !isReady && staticStyles.hidden],
|
|
47
|
+
onMouseDown: e => {
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
},
|
|
46
50
|
children: /*#__PURE__*/_jsx(Card, {
|
|
47
51
|
tokens: {
|
|
48
52
|
shadow: systemTokens.shadow,
|
|
49
53
|
borderRadius: systemTokens.borderRadius,
|
|
50
54
|
...(Platform.OS === 'web' && {
|
|
51
|
-
|
|
55
|
+
maxHeight,
|
|
56
|
+
overflowY: 'auto'
|
|
52
57
|
}),
|
|
53
58
|
paddingBottom: paddingVertical,
|
|
54
59
|
paddingTop: paddingVertical,
|
|
@@ -78,6 +83,7 @@ DropdownOverlay.propTypes = {
|
|
|
78
83
|
width: PropTypes.number
|
|
79
84
|
}),
|
|
80
85
|
maxWidth: PropTypes.number,
|
|
86
|
+
maxHeight: PropTypes.number,
|
|
81
87
|
minWidth: PropTypes.number,
|
|
82
88
|
onLayout: PropTypes.func,
|
|
83
89
|
tokens: PropTypes.object,
|
|
@@ -4,7 +4,7 @@ import Pressable from "react-native-web/dist/exports/Pressable";
|
|
|
4
4
|
import Text from "react-native-web/dist/exports/Text";
|
|
5
5
|
import { selectSystemProps, resolvePressableTokens, htmlAttrs } from '../utils';
|
|
6
6
|
import { useListboxContext } from './ListboxContext';
|
|
7
|
-
import {
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
9
9
|
const getItemStyles = _ref => {
|
|
10
10
|
let {
|
|
@@ -122,9 +122,9 @@ const PressableItem = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
122
122
|
onPress(event);
|
|
123
123
|
},
|
|
124
124
|
children: pressableState => {
|
|
125
|
-
return /*#__PURE__*/
|
|
125
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
126
126
|
style: selectTextStyles(resolveButtonTokens(pressableState)),
|
|
127
|
-
children:
|
|
127
|
+
children: children
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
});
|
|
@@ -178,6 +178,11 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
178
178
|
setMaxWidth(items.length >= rowLimit);
|
|
179
179
|
}, [items.length, rowLimit]);
|
|
180
180
|
React.useEffect(() => setCheckedIds(currentValues ?? []), [currentValues]);
|
|
181
|
+
React.useEffect(() => {
|
|
182
|
+
if (isOpen && onOpen) {
|
|
183
|
+
onOpen();
|
|
184
|
+
}
|
|
185
|
+
}, [isOpen, onOpen]);
|
|
181
186
|
const uniqueFields = ['id', 'label'];
|
|
182
187
|
if (!containUniqueFields(items, uniqueFields)) {
|
|
183
188
|
throw new Error(`MultiSelectFilter items must have unique ${uniqueFields.join(', ')}`);
|
|
@@ -190,7 +195,6 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
190
195
|
}]);
|
|
191
196
|
const handleChange = event => {
|
|
192
197
|
if (pressHandlers.onPress) pressHandlers?.onPress(event);
|
|
193
|
-
if (isOpen) onOpen();
|
|
194
198
|
setIsOpen(!isOpen);
|
|
195
199
|
};
|
|
196
200
|
const onApply = e => {
|
|
@@ -271,8 +271,8 @@ const TextInputBase = /*#__PURE__*/React.forwardRef((_ref8, ref) => {
|
|
|
271
271
|
}
|
|
272
272
|
}, [element, pattern]);
|
|
273
273
|
const handleChangeText = event => {
|
|
274
|
-
const text = event.nativeEvent?.text
|
|
275
|
-
let filteredText = isNumeric ? text?.replace(/[^\d]/g, '') : text;
|
|
274
|
+
const text = event.nativeEvent?.text ?? event.target?.value;
|
|
275
|
+
let filteredText = isNumeric ? text?.replace(/[^\d]/g, '') || undefined : text;
|
|
276
276
|
if (type === 'card' && filteredText) {
|
|
277
277
|
const formattedValue = filteredText.replace(/[^a-zA-Z0-9]/g, '');
|
|
278
278
|
const regex = new RegExp(`([a-zA-Z0-9]{4})(?=[a-zA-Z0-9])`, 'g');
|
package/lib/package.json
CHANGED