@bitrise/bitkit 13.217.0 → 13.218.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/package.json
CHANGED
|
@@ -15,9 +15,11 @@ import {
|
|
|
15
15
|
FormErrorMessage,
|
|
16
16
|
FormHelperText,
|
|
17
17
|
useControllableState,
|
|
18
|
+
useMergeRefs,
|
|
18
19
|
useMultiStyleConfig,
|
|
19
20
|
} from '@chakra-ui/react';
|
|
20
21
|
import { FloatingFocusManager } from '@floating-ui/react-dom-interactions';
|
|
22
|
+
import ProgressSpinner from '../ProgressSpinner/ProgressSpinner';
|
|
21
23
|
import SearchInput from '../SearchInput/SearchInput';
|
|
22
24
|
import FormLabel from '../Form/FormLabel';
|
|
23
25
|
import { AvatarProps } from '../Avatar/Avatar';
|
|
@@ -279,6 +281,7 @@ const Dropdown = forwardRef<Element, DropdownProps<string | null>>(
|
|
|
279
281
|
name,
|
|
280
282
|
onBlur,
|
|
281
283
|
onChange,
|
|
284
|
+
onScrolledToBottom,
|
|
282
285
|
placeholder,
|
|
283
286
|
placement,
|
|
284
287
|
readOnly,
|
|
@@ -350,6 +353,25 @@ const Dropdown = forwardRef<Element, DropdownProps<string | null>>(
|
|
|
350
353
|
);
|
|
351
354
|
const searchElement = search === false ? null : search || <DropdownSearch />;
|
|
352
355
|
const buttonId = useId();
|
|
356
|
+
|
|
357
|
+
const internalRef = useCallback((node: HTMLDivElement | null) => {
|
|
358
|
+
if (!node) return;
|
|
359
|
+
|
|
360
|
+
const handleScroll = () => {
|
|
361
|
+
const { scrollTop, scrollHeight, clientHeight } = node;
|
|
362
|
+
if (scrollTop + clientHeight >= scrollHeight) {
|
|
363
|
+
onScrolledToBottom?.();
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
node.addEventListener('scroll', handleScroll);
|
|
368
|
+
|
|
369
|
+
// Cleanup when the element is unmounted or ref changes
|
|
370
|
+
return () => node.removeEventListener('scroll', handleScroll);
|
|
371
|
+
}, []);
|
|
372
|
+
|
|
373
|
+
const mergedRef = useMergeRefs(internalRef, optionsRef);
|
|
374
|
+
|
|
353
375
|
return (
|
|
354
376
|
<>
|
|
355
377
|
{name && formValue && <input name={name} type="hidden" value={formValue} />}
|
|
@@ -391,8 +413,11 @@ const Dropdown = forwardRef<Element, DropdownProps<string | null>>(
|
|
|
391
413
|
<FloatingFocusManager context={floatingContext} initialFocus={searchRef} returnFocus={returnFocus}>
|
|
392
414
|
<chakra.div {...floatingProps} {...dataAttributes} sx={listStyles}>
|
|
393
415
|
{searchElement}
|
|
394
|
-
<chakra.div ref={
|
|
416
|
+
<chakra.div ref={mergedRef} __css={dropdownStyles.options} tabIndex={-1}>
|
|
395
417
|
{children}
|
|
418
|
+
<chakra.div display="flex" justifyContent="space-around">
|
|
419
|
+
<ProgressSpinner />
|
|
420
|
+
</chakra.div>
|
|
396
421
|
</chakra.div>
|
|
397
422
|
</chakra.div>
|
|
398
423
|
</FloatingFocusManager>
|
|
@@ -27,9 +27,11 @@ export interface DropdownProps<T> extends ChakraProps {
|
|
|
27
27
|
infoTooltipLabel?: string;
|
|
28
28
|
infoTooltipProps?: TooltipProps;
|
|
29
29
|
isError?: boolean;
|
|
30
|
+
isLoadingMore?: boolean;
|
|
30
31
|
isWarning?: boolean;
|
|
31
32
|
label?: string;
|
|
32
33
|
name?: string;
|
|
34
|
+
onScrolledToBottom?(): void;
|
|
33
35
|
onBlur?: DropdownChangeEventHandler<T>;
|
|
34
36
|
onChange?: DropdownChangeEventHandler<T>;
|
|
35
37
|
placeholder?: string;
|