@pushwoosh/dumb-components 1.1.148 → 1.1.149
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/AccessForbidden/AccessForbidden.d.ts +3 -0
- package/AccessForbidden/AccessForbidden.js +3 -0
- package/Alert/Alert.d.ts +7 -0
- package/Alert/Alert.js +7 -0
- package/Alert/types.d.ts +6 -0
- package/ApplicationPreloader/ApplicationPreloader.d.ts +8 -0
- package/ApplicationPreloader/ApplicationPreloader.js +6 -0
- package/Badge/Badge.d.ts +6 -0
- package/Badge/Badge.js +6 -0
- package/Badge/types.d.ts +6 -0
- package/Banner/Banner.d.ts +7 -0
- package/Banner/Banner.js +7 -0
- package/Banner/types.d.ts +16 -0
- package/Button/Button.d.ts +19 -0
- package/Button/GhostButton.d.ts +1 -0
- package/Button/GhostButton.js +1 -0
- package/Button/RemoveButton.d.ts +6 -0
- package/Button/RemoveButton.js +6 -0
- package/Button/types.d.ts +21 -0
- package/Calendar/CalendarDropdown/CalendarDropdown.d.ts +12 -0
- package/Calendar/CalendarDropdown/CalendarDropdown.js +12 -0
- package/Calendar/CalendarDropdown/helpers.d.ts +4 -0
- package/Calendar/CalendarDropdown/helpers.js +4 -0
- package/Calendar/CalendarDropdown/types.d.ts +33 -0
- package/Calendar/CalendarSuperForm/CalendarSuperForm.d.ts +7 -0
- package/Calendar/CalendarSuperForm/CalendarSuperForm.js +7 -0
- package/Calendar/CalendarSuperForm/types.d.ts +36 -10
- package/Calendar/helpers.d.ts +10 -0
- package/Calendar/helpers.js +10 -0
- package/Calendar/types.d.ts +16 -1
- package/CardMetric/CardMetric.d.ts +7 -0
- package/CardMetric/CardMetric.js +7 -0
- package/CardMetric/types.d.ts +13 -0
- package/Checkbox/Checkbox.d.ts +6 -0
- package/Checkbox/Checkbox.js +6 -0
- package/Checkbox/types.d.ts +13 -0
- package/Chip/Chip.d.ts +7 -0
- package/Chip/Chip.js +7 -0
- package/Chip/Chip.types.d.ts +9 -0
- package/CodeEditor/CodeEditor.d.ts +7 -0
- package/CodeEditor/CodeEditor.js +7 -0
- package/CodeEditor/languages/html.d.ts +1 -0
- package/CodeEditor/languages/html.js +1 -0
- package/CodeEditor/languages/json.d.ts +1 -0
- package/CodeEditor/languages/json.js +1 -0
- package/CodeEditor/languages/liquid.d.ts +1 -0
- package/CodeEditor/languages/liquid.js +1 -0
- package/CodeEditor/types.d.ts +11 -0
- package/CrashScreen/CrashScreen.d.ts +4 -0
- package/CrashScreen/CrashScreen.js +4 -0
- package/DateTimePicker/components/DatePicker/DatePicker.d.ts +5 -0
- package/DateTimePicker/components/DatePicker/DatePicker.js +5 -0
- package/DateTimePicker/components/DatePicker/types.d.ts +9 -0
- package/DateTimePicker/components/DatePickerField/DatePickerField.d.ts +5 -0
- package/DateTimePicker/components/DatePickerField/DatePickerField.js +5 -0
- package/DateTimePicker/components/DatePickerField/types.d.ts +9 -0
- package/DateTimePicker/components/DateTimePicker/DateTimePicker.d.ts +5 -0
- package/DateTimePicker/components/DateTimePicker/DateTimePicker.js +5 -0
- package/DateTimePicker/components/DateTimePicker/types.d.ts +6 -0
- package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.d.ts +5 -0
- package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.js +5 -0
- package/DateTimePicker/components/DateTimePickerField/types.d.ts +9 -0
- package/DateTimePicker/types.d.ts +5 -0
- package/Drawer/components/Drawer/Drawer.d.ts +11 -0
- package/Drawer/components/Drawer/Drawer.js +11 -0
- package/Drawer/components/Drawer/types.d.ts +9 -0
- package/Drawer/components/DrawerContent/styles.d.ts +3 -0
- package/Drawer/components/DrawerContent/styles.js +3 -0
- package/Drawer/components/DrawerDocs/DrawerDocs.d.ts +7 -0
- package/Drawer/components/DrawerDocs/DrawerDocs.js +7 -0
- package/Drawer/components/DrawerDocs/hooks.d.ts +4 -0
- package/Drawer/components/DrawerDocs/hooks.js +4 -0
- package/Drawer/components/DrawerDocs/types.d.ts +4 -0
- package/DropdownMenu/components/DropdownMenu/DropdownMenu.d.ts +12 -0
- package/DropdownMenu/components/DropdownMenu/DropdownMenu.js +12 -0
- package/DropdownMenu/components/DropdownMenu/types.d.ts +15 -0
- package/DropdownMenu/components/DropdownMenuButton/DropdownMenuButton.d.ts +8 -0
- package/DropdownMenu/components/DropdownMenuButton/DropdownMenuButton.js +8 -0
- package/DropdownMenu/components/DropdownMenuButton/types.d.ts +16 -0
- package/DropdownMenu/components/DropdownMenuItem/DropdownMenuItem.d.ts +7 -0
- package/DropdownMenu/components/DropdownMenuItem/DropdownMenuItem.js +7 -0
- package/DropdownMenu/components/DropdownMenuItem/types.d.ts +6 -0
- package/DropdownMenu/components/DropdownMenuSection/DropdownMenuSection.d.ts +8 -0
- package/DropdownMenu/components/DropdownMenuSection/DropdownMenuSection.js +8 -0
- package/DropdownMenu/components/DropdownMenuSection/types.d.ts +3 -0
- package/DropdownMenu/components/DropdownMenuSubmenu/DropdownMenuSubmenu.d.ts +9 -0
- package/DropdownMenu/components/DropdownMenuSubmenu/DropdownMenuSubmenu.js +9 -0
- package/DropdownMenu/components/DropdownMenuSubmenu/types.d.ts +5 -0
- package/EditableField/EditableField.d.ts +9 -0
- package/EditableField/EditableField.js +9 -0
- package/EditableField/types.d.ts +12 -0
- package/EmailTemplatePreview/EmailTemplatePreview.d.ts +7 -0
- package/EmailTemplatePreview/EmailTemplatePreview.js +7 -0
- package/EmailTemplatePreview/components/NoEmailTemplatePreview/NoEmailTemplatePreview.d.ts +4 -0
- package/EmailTemplatePreview/components/NoEmailTemplatePreview/NoEmailTemplatePreview.js +4 -0
- package/EmailTemplatePreview/helpers.d.ts +8 -0
- package/EmailTemplatePreview/helpers.js +8 -0
- package/EmailTemplatePreview/types.d.ts +7 -0
- package/EnhancedInput/EnhancedInput.d.ts +7 -0
- package/EnhancedInput/EnhancedInput.js +7 -0
- package/EnhancedInput/SearchInput.d.ts +6 -0
- package/EnhancedInput/SearchInput.js +6 -0
- package/EnhancedInput/types.d.ts +5 -0
- package/ExportResult/ExportResult.d.ts +7 -0
- package/ExportResult/ExportResult.js +7 -0
- package/ExportResult/types.d.ts +7 -0
- package/ExternalImagePreview/ExternalImagePreview.d.ts +7 -0
- package/ExternalImagePreview/ExternalImagePreview.js +7 -0
- package/ExternalImagePreview/types.d.ts +7 -0
- package/FieldBox/FieldBox.d.ts +9 -0
- package/FieldBox/FieldBox.js +9 -0
- package/FieldBox/types.d.ts +10 -0
- package/FrequencyCapping/FrequencyCappingEdit.d.ts +7 -0
- package/FrequencyCapping/FrequencyCappingEdit.js +7 -0
- package/FrequencyCapping/FrequencyCappingInApps.d.ts +7 -0
- package/FrequencyCapping/FrequencyCappingInApps.js +7 -0
- package/FrequencyCapping/FrequencyCappingReadonly.d.ts +3 -0
- package/FrequencyCapping/FrequencyCappingReadonly.js +3 -0
- package/FrequencyCapping/types.d.ts +37 -0
- package/FrequencyCapping/types.js +1 -0
- package/GetStartedPage/GetStartedPage.d.ts +7 -0
- package/GetStartedPage/GetStartedPage.js +7 -0
- package/GetStartedPage/types.d.ts +7 -0
- package/InputFile/InputFile.d.ts +7 -0
- package/InputFile/InputFile.js +7 -0
- package/InputFile/types.d.ts +18 -0
- package/Link/Link.d.ts +18 -0
- package/Link/types.d.ts +17 -0
- package/Modal/components/Modal/Modal.d.ts +11 -0
- package/Modal/components/Modal/Modal.js +11 -0
- package/Modal/components/Modal/types.d.ts +6 -0
- package/Modal/components/ModalConfirm/ModalConfirm.d.ts +8 -0
- package/Modal/components/ModalConfirm/ModalConfirm.js +8 -0
- package/Modal/components/ModalConfirm/ModalConfirmProvider.d.ts +7 -0
- package/Modal/components/ModalConfirm/ModalConfirmProvider.js +7 -0
- package/Modal/components/ModalConfirm/hooks.d.ts +8 -0
- package/Modal/components/ModalConfirm/hooks.js +8 -0
- package/Modal/components/ModalConfirm/types.d.ts +16 -0
- package/Modal/components/ModalContent/styles.d.ts +5 -0
- package/Modal/components/ModalContent/styles.js +5 -0
- package/Modal/components/ModalTitle/ModalTitle.d.ts +6 -0
- package/Modal/components/ModalTitle/ModalTitle.js +6 -0
- package/Modal/components/ModalTitle/types.d.ts +3 -0
- package/NotificationInbox/NotificationBar.d.ts +7 -0
- package/NotificationInbox/NotificationBar.js +7 -0
- package/NotificationInbox/NotificationBell.d.ts +7 -0
- package/NotificationInbox/NotificationBell.js +7 -0
- package/NotificationInbox/NotificationInbox.d.ts +7 -0
- package/NotificationInbox/NotificationInbox.js +7 -0
- package/NotificationInbox/types.d.ts +31 -0
- package/NumberPicker/NumberPicker.d.ts +7 -0
- package/NumberPicker/NumberPicker.js +7 -0
- package/NumberPicker/types.d.ts +12 -0
- package/PageHeader/components/AutosizeInput/AutosizeInput.d.ts +7 -0
- package/PageHeader/components/AutosizeInput/AutosizeInput.js +7 -0
- package/PageHeader/components/AutosizeInput/types.d.ts +7 -0
- package/PageHeader/components/PageHeader/PageHeader.d.ts +7 -0
- package/PageHeader/components/PageHeader/PageHeader.js +7 -0
- package/PageHeader/components/PageHeader/types.d.ts +13 -0
- package/PageHeader/components/PageHeaderEditable/PageHeaderEditable.d.ts +7 -0
- package/PageHeader/components/PageHeaderEditable/PageHeaderEditable.js +7 -0
- package/PageHeader/components/PageHeaderEditable/types.d.ts +19 -0
- package/Pagination/Pagination.d.ts +7 -0
- package/Pagination/Pagination.js +7 -0
- package/Pagination/types.d.ts +7 -0
- package/Popover/Popover.d.ts +10 -0
- package/Popover/Popover.js +10 -0
- package/Popover/styles.d.ts +1 -0
- package/Popover/styles.js +1 -0
- package/Popover/types.d.ts +9 -0
- package/ProgressBar/ProgressBar.d.ts +6 -0
- package/ProgressBar/ProgressBar.js +6 -0
- package/ProgressBar/types.d.ts +7 -0
- package/PushPreview/PushPreview.d.ts +7 -0
- package/PushPreview/PushPreview.js +7 -0
- package/PushPreview/types.d.ts +17 -0
- package/Radio/Radio.d.ts +7 -0
- package/Radio/Radio.js +7 -0
- package/Radio/types.d.ts +14 -0
- package/RadioCard/RadioCard.d.ts +7 -0
- package/RadioCard/RadioCard.js +7 -0
- package/RadioCard/types.d.ts +7 -0
- package/ReCaptcha/ReCaptcha.d.ts +8 -0
- package/ReCaptcha/ReCaptcha.js +8 -0
- package/ReCaptcha/helpers.d.ts +4 -0
- package/ReCaptcha/helpers.js +4 -0
- package/ReCaptcha/hooks.d.ts +4 -0
- package/ReCaptcha/hooks.js +4 -0
- package/ReCaptcha/types.d.ts +5 -0
- package/RichMessageEditor/RichMessageEditor.d.ts +8 -0
- package/RichMessageEditor/RichMessageEditor.js +8 -0
- package/RichMessageEditor/RichMessageEditor.types.d.ts +10 -0
- package/RichMessageEditor/RichMessageViewer.d.ts +10 -0
- package/RichMessageEditor/RichMessageViewer.js +7 -0
- package/RichMessageEditor/slate/types.d.ts +5 -0
- package/RichMessageEditor/types.d.ts +1 -0
- package/RichmediaPreview/RichmediaPreview.d.ts +7 -0
- package/RichmediaPreview/RichmediaPreview.js +7 -0
- package/RichmediaPreview/hooks.d.ts +4 -0
- package/RichmediaPreview/hooks.js +4 -0
- package/RichmediaPreview/types.d.ts +13 -0
- package/Select/Select.d.ts +22 -0
- package/Select/Select.js +22 -0
- package/Select/constants.d.ts +1 -0
- package/Select/constants.js +1 -0
- package/Select/types.d.ts +19 -0
- package/SendRate/SendRateEdit.d.ts +7 -0
- package/SendRate/SendRateEdit.js +7 -0
- package/SendRate/SendRateReadonly.d.ts +3 -0
- package/SendRate/SendRateReadonly.js +3 -0
- package/SendRate/types.d.ts +20 -0
- package/Skeleton/TextSkeleton.d.ts +6 -0
- package/Skeleton/TextSkeleton.js +6 -0
- package/Skeleton/styles.d.ts +2 -0
- package/Skeleton/styles.js +2 -0
- package/Skeleton/types.d.ts +11 -0
- package/SortButton/SortButton.d.ts +6 -0
- package/SortButton/SortButton.js +6 -0
- package/SortButton/types.d.ts +11 -0
- package/Spinner/Spinner.d.ts +6 -0
- package/Spinner/Spinner.js +6 -0
- package/Spinner/types.d.ts +4 -0
- package/StatisticCard/StatisticCard.d.ts +7 -0
- package/StatisticCard/StatisticCard.js +7 -0
- package/StatisticCard/types.d.ts +21 -0
- package/Switch/Switch.d.ts +6 -0
- package/Switch/Switch.js +6 -0
- package/Switch/types.d.ts +8 -0
- package/Tabs/components/Tab/Tab.d.ts +4 -0
- package/Tabs/components/Tab/Tab.js +4 -0
- package/Tabs/components/Tab/types.d.ts +6 -0
- package/Tabs/components/TabBar/TabBar.d.ts +3 -0
- package/Tabs/components/TabBar/TabBar.js +3 -0
- package/Tabs/components/TabBar/types.d.ts +2 -0
- package/Tabs/components/TabPanel/TabPanel.d.ts +4 -0
- package/Tabs/components/TabPanel/TabPanel.js +4 -0
- package/Tabs/components/TabPanel/types.d.ts +3 -0
- package/Tabs/components/Tabs/Tabs.d.ts +11 -0
- package/Tabs/components/Tabs/Tabs.js +11 -0
- package/Tabs/components/Tabs/types.d.ts +4 -0
- package/Tabs/types.d.ts +4 -0
- package/Toast/Toast.d.ts +5 -0
- package/Toast/Toast.js +5 -0
- package/Toast/ToastProvider.d.ts +7 -0
- package/Toast/ToastProvider.js +7 -0
- package/Toast/hooks.d.ts +8 -0
- package/Toast/hooks.js +8 -0
- package/Toast/types.d.ts +24 -0
- package/Tooltip/Tooltip.d.ts +7 -0
- package/Tooltip/Tooltip.js +7 -0
- package/Tooltip/TooltipTrigger.d.ts +13 -0
- package/Tooltip/TooltipTrigger.js +7 -0
- package/Tooltip/types.d.ts +12 -0
- package/hooks/useElementWidth.d.ts +4 -3
- package/hooks/useElementWidth.js +4 -3
- package/hooks/useLayer.d.ts +7 -0
- package/hooks/useLayer.js +7 -0
- package/hooks/useOnClickOutside.d.ts +7 -0
- package/hooks/useOnClickOutside.js +7 -0
- package/native/Input.d.ts +3 -0
- package/native/Input.js +1 -0
- package/native/NativeTimeInput.d.ts +1 -0
- package/native/NativeTimeInput.js +1 -0
- package/native/Select.d.ts +1 -0
- package/native/Select.js +1 -0
- package/native/Textarea.d.ts +1 -0
- package/native/Textarea.js +1 -0
- package/package.json +2 -3
- package/polyglot/react.d.ts +19 -0
- package/polyglot/react.js +19 -0
- package/polyglot/types.d.ts +4 -0
- package/shared/dropdownField/FieldInput.d.ts +1 -0
- package/shared/dropdownField/FieldInput.js +1 -0
- package/shared/dropdownField/FieldShell.d.ts +4 -0
- package/shared/dropdownField/FieldShell.js +4 -0
- package/shared/dropdownField/SuggestionsDropdown.d.ts +4 -0
- package/shared/dropdownField/SuggestionsDropdown.js +4 -0
- package/shared/dropdownField/constants.d.ts +1 -0
- package/shared/dropdownField/constants.js +1 -0
- package/shared/dropdownField/shared.d.ts +7 -0
- package/shared/dropdownField/shared.js +7 -0
- package/shared/dropdownField/types.d.ts +7 -0
- package/shared/dropdownField/useActiveIndex.d.ts +4 -0
- package/shared/dropdownField/useActiveIndex.js +4 -0
- package/shared/dropdownField/useAsyncItems.d.ts +4 -0
- package/shared/dropdownField/useAsyncItems.js +4 -0
- package/shared/dropdownField/useDebouncedValue.d.ts +1 -0
- package/shared/dropdownField/useDebouncedValue.js +1 -0
- package/shared/dropdownField/useDropdownItems.d.ts +4 -0
- package/shared/dropdownField/useDropdownItems.js +4 -0
- package/shared/dropdownField/useDropdownPosition.d.ts +4 -0
- package/shared/dropdownField/useDropdownPosition.js +4 -0
- package/shared/dropdownField/useFieldOpenEffects.d.ts +4 -0
- package/shared/dropdownField/useFieldOpenEffects.js +4 -0
- package/shared/dropdownField/useListNavigation.d.ts +5 -0
- package/shared/dropdownField/useListNavigation.js +5 -0
- package/Alert/ai-documentation.md +0 -132
- package/Badge/ai-documentation.md +0 -155
- package/Banner/ai-documentation.md +0 -285
- package/Button/ai-documentation.md +0 -247
- package/CardMetric/ai-documentation.md +0 -277
- package/Checkbox/ai-documentation.md +0 -231
- package/Chip/ai-documentation.md +0 -281
- package/CodeEditor/ai-documentation.md +0 -350
- package/DateTimePicker/ai-documentation.md +0 -400
- package/Drawer/ai-documentation.md +0 -417
- package/EnhancedInput/ai-documentation.md +0 -352
- package/InputFile/ai-documentation.md +0 -420
- package/Modal/ai-documentation.md +0 -285
- package/PageHeader/ai-documentation.md +0 -511
- package/Pagination/ai-documentation.md +0 -509
- package/Popover/ai-documentation.md +0 -625
- package/ProgressBar/ai-documentation.md +0 -533
- package/Radio/ai-documentation.md +0 -243
- package/Select/ai-documentation.md +0 -374
- package/Skeleton/ai-documentation.md +0 -574
- package/Spinner/ai-documentation.md +0 -607
- package/Switch/ai-documentation.md +0 -312
- package/Tabs/ai-documentation.md +0 -475
- package/Toast/ai-documentation.md +0 -220
- package/Tooltip/ai-documentation.md +0 -340
- package/ai-documentation.md +0 -124
- package/native/ai-documentation.md +0 -485
package/Tooltip/types.d.ts
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
import type { RefObject, ReactElement, ReactNode } from 'react';
|
|
2
|
+
/** Placement of a {@link Tooltip} relative to its anchor (side + alignment). */
|
|
2
3
|
export type TooltipPosition = 'top-start' | 'top-middle' | 'top-end' | 'right-start' | 'right-middle' | 'right-end' | 'bottom-start' | 'bottom-middle' | 'bottom-end' | 'left-start' | 'left-middle' | 'left-end';
|
|
4
|
+
/** Props of {@link Tooltip}. */
|
|
3
5
|
export type TooltipProps = {
|
|
6
|
+
/** Tooltip content. */
|
|
4
7
|
readonly content: ReactNode;
|
|
8
|
+
/** Placement relative to the anchor (default `top-start`). */
|
|
5
9
|
readonly position?: TooltipPosition;
|
|
10
|
+
/** Tippy `[skidding, distance]` offset; defaults per position. */
|
|
6
11
|
readonly offset?: [number, number];
|
|
12
|
+
/** CSS offset of the arrow along its edge. */
|
|
7
13
|
readonly arrowOffset?: string;
|
|
14
|
+
/** Max width in pixels, or `'none'` (default `240`). */
|
|
8
15
|
readonly maxWidth?: number | 'none';
|
|
16
|
+
/** Stacking z-index. */
|
|
9
17
|
readonly zIndex?: number;
|
|
18
|
+
/** Disable the tooltip (never shows). */
|
|
10
19
|
readonly isDisabled?: boolean;
|
|
20
|
+
/** Controlled visibility; omit for hover/focus behavior. */
|
|
11
21
|
readonly isVisible?: boolean;
|
|
22
|
+
/** External anchor ref to attach to instead of wrapping `children`. */
|
|
12
23
|
readonly reference?: RefObject<Element>;
|
|
24
|
+
/** The anchor element the tooltip wraps. */
|
|
13
25
|
readonly children?: ReactElement<unknown>;
|
|
14
26
|
};
|
|
@@ -2,10 +2,11 @@ import { type RefObject } from 'react';
|
|
|
2
2
|
type ForceUpdate = () => void;
|
|
3
3
|
type ElementWidth = number | null;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Tracks the measured width of an element.
|
|
6
6
|
*
|
|
7
|
-
* @param
|
|
8
|
-
* @
|
|
7
|
+
* @param ref - ref to the element to measure
|
|
8
|
+
* @returns a tuple of the current width (`null` before first measure) and a
|
|
9
|
+
* `forceUpdate` callback to re-measure on demand
|
|
9
10
|
*/
|
|
10
11
|
export declare function useElementWidth(ref: RefObject<HTMLElement>): [ElementWidth, ForceUpdate];
|
|
11
12
|
export {};
|
package/hooks/useElementWidth.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Tracks the measured width of an element.
|
|
4
4
|
*
|
|
5
|
-
* @param
|
|
6
|
-
* @
|
|
5
|
+
* @param ref - ref to the element to measure
|
|
6
|
+
* @returns a tuple of the current width (`null` before first measure) and a
|
|
7
|
+
* `forceUpdate` callback to re-measure on demand
|
|
7
8
|
*/
|
|
8
9
|
export function useElementWidth(ref) {
|
|
9
10
|
const [elementWidth, setElementWidth] = useState(null);
|
package/hooks/useLayer.d.ts
CHANGED
|
@@ -6,5 +6,12 @@ type UseLayerParams = {
|
|
|
6
6
|
type UseLayerResult = {
|
|
7
7
|
zIndex: number;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* Manages a stacked overlay layer (modals, drawers, popovers): registers while
|
|
11
|
+
* `isOpen`, computes a stacking `zIndex` above lower layers, and calls `onClose` on
|
|
12
|
+
* Escape when this layer is on top.
|
|
13
|
+
*
|
|
14
|
+
* @returns the resolved `zIndex` to apply to the layer
|
|
15
|
+
*/
|
|
9
16
|
export declare function useLayer({ isOpen, onClose, zIndex }: UseLayerParams): UseLayerResult;
|
|
10
17
|
export {};
|
package/hooks/useLayer.js
CHANGED
|
@@ -81,6 +81,13 @@ function resolveZIndex(id, fallbackZIndex) {
|
|
|
81
81
|
}
|
|
82
82
|
return fallbackZIndex ?? BASE_Z_INDEX;
|
|
83
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Manages a stacked overlay layer (modals, drawers, popovers): registers while
|
|
86
|
+
* `isOpen`, computes a stacking `zIndex` above lower layers, and calls `onClose` on
|
|
87
|
+
* Escape when this layer is on top.
|
|
88
|
+
*
|
|
89
|
+
* @returns the resolved `zIndex` to apply to the layer
|
|
90
|
+
*/
|
|
84
91
|
export function useLayer({
|
|
85
92
|
isOpen,
|
|
86
93
|
onClose,
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { type RefObject } from 'react';
|
|
2
2
|
type Ref = RefObject<HTMLElement> | RefObject<HTMLElement>[];
|
|
3
|
+
/**
|
|
4
|
+
* Calls `handler` on a mousedown/touchstart outside the referenced element(s).
|
|
5
|
+
* Pass a single ref or an array of refs to treat several elements as "inside".
|
|
6
|
+
*
|
|
7
|
+
* @param ref - element ref, or array of refs, considered "inside"
|
|
8
|
+
* @param handler - called when a click/tap lands outside all refs
|
|
9
|
+
*/
|
|
3
10
|
export declare function useOnClickOutside(ref: Ref, handler: () => void): void;
|
|
4
11
|
export {};
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Calls `handler` on a mousedown/touchstart outside the referenced element(s).
|
|
4
|
+
* Pass a single ref or an array of refs to treat several elements as "inside".
|
|
5
|
+
*
|
|
6
|
+
* @param ref - element ref, or array of refs, considered "inside"
|
|
7
|
+
* @param handler - called when a click/tap lands outside all refs
|
|
8
|
+
*/
|
|
2
9
|
export function useOnClickOutside(ref, handler) {
|
|
3
10
|
useEffect(() => {
|
|
4
11
|
const references = Array.isArray(ref) ? ref : [ref];
|
package/native/Input.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
/** Style props for {@link NativeInput}. */
|
|
1
2
|
export type NativeInputProps = {
|
|
3
|
+
/** Render the error (red) border. */
|
|
2
4
|
$isErrored?: boolean;
|
|
3
5
|
};
|
|
6
|
+
/** Styled native `<input>` with the Pushwoosh form look (focus, disabled, error states). */
|
|
4
7
|
export declare const NativeInput: import("styled-components").StyledComponent<"input", any, NativeInputProps, never>;
|
package/native/Input.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
import { Color, FontSize, LineHeight, ShapeRadius, UnitSize } from '@pushwoosh/kit-constants';
|
|
3
|
+
/** Styled native `<input>` with the Pushwoosh form look (focus, disabled, error states). */
|
|
3
4
|
export const NativeInput = styled.input.withConfig({
|
|
4
5
|
displayName: "NativeInput",
|
|
5
6
|
componentId: "sc-oqkcxd-0"
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** Styled native `<input type="time">` with the Pushwoosh form look and the default picker indicator hidden. Pass `$isErrored` for the error state. */
|
|
1
2
|
export declare const NativeTimeInput: import("styled-components").StyledComponent<"input", any, {
|
|
2
3
|
type: "time";
|
|
3
4
|
} & {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
import { Color, FontSize, LineHeight, ShapeRadius, UnitSize } from '@pushwoosh/kit-constants';
|
|
3
|
+
/** Styled native `<input type="time">` with the Pushwoosh form look and the default picker indicator hidden. Pass `$isErrored` for the error state. */
|
|
3
4
|
export const NativeTimeInput = styled.input.attrs({
|
|
4
5
|
type: 'time'
|
|
5
6
|
}).withConfig({
|
package/native/Select.d.ts
CHANGED
package/native/Select.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
import { Color, FontSize, ShapeRadius, UnitSize } from '@pushwoosh/kit-constants';
|
|
3
|
+
/** Styled native `<select>` with the Pushwoosh form look and a custom dropdown arrow. Pass `$isErrored` for the error state. */
|
|
3
4
|
export const NativeSelect = styled.select.withConfig({
|
|
4
5
|
displayName: "NativeSelect",
|
|
5
6
|
componentId: "sc-1fsh619-0"
|
package/native/Textarea.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** Styled native `<textarea>` with the Pushwoosh form look. Pass `$width` to fix the width and `$isErrored` for the error state. */
|
|
1
2
|
export declare const NativeTextarea: import("styled-components").StyledComponent<"textarea", any, {
|
|
2
3
|
$width?: string;
|
|
3
4
|
$isErrored?: boolean;
|
package/native/Textarea.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
import { Color, FontSize, LineHeight, ShapeRadius } from '@pushwoosh/kit-constants';
|
|
3
|
+
/** Styled native `<textarea>` with the Pushwoosh form look. Pass `$width` to fix the width and `$isErrored` for the error state. */
|
|
3
4
|
export const NativeTextarea = styled.textarea.withConfig({
|
|
4
5
|
displayName: "NativeTextarea",
|
|
5
6
|
componentId: "sc-1xe83i4-0"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushwoosh/dumb-components",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.149",
|
|
4
4
|
"description": "React components to build Pushwoosh products",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"scripts": {
|
|
10
10
|
"start": "npm --prefix ./storybook run storybook",
|
|
11
|
-
"build": "pushwoosh-engine lib:build
|
|
12
|
-
"copy-docs": "node scripts/copy-docs.js",
|
|
11
|
+
"build": "pushwoosh-engine lib:build",
|
|
13
12
|
"check": "npm run check:lint && npm run check:types",
|
|
14
13
|
"check:lint": "echo \"Run check:lint\" && eslint src",
|
|
15
14
|
"check:lint-fix": "echo \"Run check:lint\" && eslint src --fix",
|
package/polyglot/react.d.ts
CHANGED
|
@@ -6,14 +6,33 @@ type LangProviderProps = {
|
|
|
6
6
|
language: string;
|
|
7
7
|
languages: LanguagesMap;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* Provides the active `language`/`timezone` and a base message catalogue to the
|
|
11
|
+
* polyglot context for {@link LangBase}/{@link useLangBase} and library messages.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <LangProvider language="en" timezone="UTC" languages={messages}><App /></LangProvider>
|
|
15
|
+
*/
|
|
9
16
|
export declare const LangProvider: FC<PropsWithChildren<LangProviderProps>>;
|
|
17
|
+
/** Renders a message from the provider's catalogue as React nodes; takes `{ message, ...params }`. */
|
|
10
18
|
export declare const LangBase: FC;
|
|
19
|
+
/** Returns a function that renders a message from the provider's catalogue to a plain string. */
|
|
11
20
|
export declare const useLangBase: () => (allProps: any) => string;
|
|
12
21
|
type LangLibProps = {
|
|
13
22
|
$languages: LanguagesMap;
|
|
14
23
|
} & Record<string, any>;
|
|
24
|
+
/** Renders a message from a self-supplied catalogue (`$languages`); registers it on first use. Prefer {@link createLang}. */
|
|
15
25
|
export declare const LangLib: FC<LangLibProps>;
|
|
26
|
+
/** Registers a catalogue and returns a function that renders its messages to strings. Prefer {@link createLang}. */
|
|
16
27
|
export declare const useLangLib: (languages: LanguagesMap) => (allProps: any) => string;
|
|
28
|
+
/**
|
|
29
|
+
* Builds a typed `{ Lang, useLang }` pair bound to a message catalogue — the
|
|
30
|
+
* recommended way to add i18n to a component or library.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* const { Lang, useLang } = createLang({ en: { HELLO: 'Hello {{name}}' } });
|
|
34
|
+
* <Lang message="HELLO" name="World" />;
|
|
35
|
+
*/
|
|
17
36
|
export declare const createLang: <M>(languages: Record<string, LangMessages<M>>) => {
|
|
18
37
|
Lang: FC<LangProps<M>>;
|
|
19
38
|
useLang: () => (props: LangProps<M>) => string;
|
package/polyglot/react.js
CHANGED
|
@@ -58,6 +58,13 @@ const createLangPack = (language, timezone) => {
|
|
|
58
58
|
};
|
|
59
59
|
};
|
|
60
60
|
const LangContext = createContext(createLangPack('en', 'UTC'));
|
|
61
|
+
/**
|
|
62
|
+
* Provides the active `language`/`timezone` and a base message catalogue to the
|
|
63
|
+
* polyglot context for {@link LangBase}/{@link useLangBase} and library messages.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* <LangProvider language="en" timezone="UTC" languages={messages}><App /></LangProvider>
|
|
67
|
+
*/
|
|
61
68
|
export const LangProvider = ({
|
|
62
69
|
timezone,
|
|
63
70
|
language,
|
|
@@ -74,10 +81,13 @@ export const LangProvider = ({
|
|
|
74
81
|
children: children
|
|
75
82
|
});
|
|
76
83
|
};
|
|
84
|
+
/** Renders a message from the provider's catalogue as React nodes; takes `{ message, ...params }`. */
|
|
77
85
|
export const LangBase = props => {
|
|
78
86
|
return useContext(LangContext).langReact(props);
|
|
79
87
|
};
|
|
88
|
+
/** Returns a function that renders a message from the provider's catalogue to a plain string. */
|
|
80
89
|
export const useLangBase = () => useContext(LangContext).lang;
|
|
90
|
+
/** Renders a message from a self-supplied catalogue (`$languages`); registers it on first use. Prefer {@link createLang}. */
|
|
81
91
|
export const LangLib = ({
|
|
82
92
|
$languages,
|
|
83
93
|
...props
|
|
@@ -86,11 +96,20 @@ export const LangLib = ({
|
|
|
86
96
|
useMemo(() => ctx.register($languages), [ctx, $languages]);
|
|
87
97
|
return ctx.langReact(props);
|
|
88
98
|
};
|
|
99
|
+
/** Registers a catalogue and returns a function that renders its messages to strings. Prefer {@link createLang}. */
|
|
89
100
|
export const useLangLib = languages => {
|
|
90
101
|
const ctx = useContext(LangContext);
|
|
91
102
|
useMemo(() => ctx.register(languages), [ctx, languages]);
|
|
92
103
|
return ctx.lang;
|
|
93
104
|
};
|
|
105
|
+
/**
|
|
106
|
+
* Builds a typed `{ Lang, useLang }` pair bound to a message catalogue — the
|
|
107
|
+
* recommended way to add i18n to a component or library.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* const { Lang, useLang } = createLang({ en: { HELLO: 'Hello {{name}}' } });
|
|
111
|
+
* <Lang message="HELLO" name="World" />;
|
|
112
|
+
*/
|
|
94
113
|
export const createLang = languages => ({
|
|
95
114
|
Lang: props => _jsx(LangLib, {
|
|
96
115
|
"$languages": languages,
|
package/polyglot/types.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
/** A message catalogue: maps each message key of `T` to its (Liquid) template string. */
|
|
1
2
|
export type LangMessages<T> = {
|
|
2
3
|
[K in keyof T]: string;
|
|
3
4
|
};
|
|
5
|
+
/** Props for rendering one message: `{ message: key }` plus that key's interpolation params. */
|
|
4
6
|
export type LangProps<M> = {
|
|
5
7
|
[K in keyof M]: {
|
|
6
8
|
message: K;
|
|
7
9
|
} & M[K];
|
|
8
10
|
}[keyof M];
|
|
11
|
+
/** Type of the `useLang` hook produced by {@link createLang} for a message map `M`. */
|
|
9
12
|
export type UseLangHook<M> = () => (props: LangProps<M>) => string;
|
|
13
|
+
/** Marker for a message that takes no interpolation parameters. */
|
|
10
14
|
export type NoParams = Record<never, never>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type InputHTMLAttributes } from 'react';
|
|
2
|
+
/** Internal text input shared by the Combobox family, with optional content-fit (`autosize`) width. */
|
|
2
3
|
export declare const FieldInput: import("react").ForwardRefExoticComponent<InputHTMLAttributes<HTMLInputElement> & {
|
|
3
4
|
value: string;
|
|
4
5
|
autosize?: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useLayoutEffect, useRef, useState } from 'react';
|
|
3
3
|
import { AutosizeMirror, Input } from './styles';
|
|
4
|
+
/** Internal text input shared by the Combobox family, with optional content-fit (`autosize`) width. */
|
|
4
5
|
export const FieldInput = forwardRef(({
|
|
5
6
|
autosize,
|
|
6
7
|
value,
|
|
@@ -29,5 +29,9 @@ type FieldShellProps = {
|
|
|
29
29
|
listboxId?: string;
|
|
30
30
|
createId?: string;
|
|
31
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* Internal field wrapper shared by the Combobox family: renders the input area with
|
|
34
|
+
* its border/error/loading states and hosts the {@link SuggestionsDropdown}.
|
|
35
|
+
*/
|
|
32
36
|
export declare function FieldShell({ children, isOpen, dropdownOpen, isErrored, disabled, loading, width, minWidth, autosize, tightLeft, onShellMouseDown, onClose, showClear, onClear, clearLabel, showChevron, onToggle, dropdownItems, emptyText, loadingText, loadingMore, onLoadMore, createLabel, createActive, onCreate, listboxId, createId, }: FieldShellProps): ReactElement;
|
|
33
37
|
export {};
|
|
@@ -4,6 +4,10 @@ import { IndicatorButton, Indicators, Shell, ShellInner } from './styles';
|
|
|
4
4
|
import { SuggestionsDropdown } from './SuggestionsDropdown';
|
|
5
5
|
import { useDropdownPosition } from './useDropdownPosition';
|
|
6
6
|
import { useLayer } from '../../hooks';
|
|
7
|
+
/**
|
|
8
|
+
* Internal field wrapper shared by the Combobox family: renders the input area with
|
|
9
|
+
* its border/error/loading states and hosts the {@link SuggestionsDropdown}.
|
|
10
|
+
*/
|
|
7
11
|
export function FieldShell({
|
|
8
12
|
children,
|
|
9
13
|
isOpen,
|
|
@@ -16,5 +16,9 @@ type SuggestionsDropdownProps = {
|
|
|
16
16
|
createId?: string;
|
|
17
17
|
zIndex?: number;
|
|
18
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* Internal floating option list shared by the Combobox family: renders the rows,
|
|
21
|
+
* empty/loading text, an optional "create" row and load-more support.
|
|
22
|
+
*/
|
|
19
23
|
export declare function SuggestionsDropdown({ floatingRef, floatingStyles, items, emptyText, loading, loadingText, loadingMore, onLoadMore, createLabel, createActive, onCreate, listboxId, createId, zIndex, }: SuggestionsDropdownProps): ReactElement | null;
|
|
20
24
|
export {};
|
|
@@ -5,6 +5,10 @@ import { CreateItemLabel, Dropdown, DropdownEmpty, DropdownItem, DropdownLoading
|
|
|
5
5
|
import { Spinner } from '../../Spinner';
|
|
6
6
|
const LOAD_MORE_THRESHOLD = 24;
|
|
7
7
|
const CREATE_KEY = '__create__';
|
|
8
|
+
/**
|
|
9
|
+
* Internal floating option list shared by the Combobox family: renders the rows,
|
|
10
|
+
* empty/loading text, an optional "create" row and load-more support.
|
|
11
|
+
*/
|
|
8
12
|
export function SuggestionsDropdown({
|
|
9
13
|
floatingRef,
|
|
10
14
|
floatingStyles,
|
|
@@ -3,4 +3,5 @@ export declare const LOADING_BORDER_COLORS: readonly [Color.PRIMARY, Color.BRIGH
|
|
|
3
3
|
export declare const LOADING_BORDER_ANIMATION_MS = 3000;
|
|
4
4
|
export declare const DROPDOWN_MAX_HEIGHT = 280;
|
|
5
5
|
export declare const DROPDOWN_MAX_WIDTH = 320;
|
|
6
|
+
/** Default debounce (ms) before an async `loadItems` call fires after the query changes. */
|
|
6
7
|
export declare const DEFAULT_DEBOUNCE_MS = 250;
|
|
@@ -3,4 +3,5 @@ export const LOADING_BORDER_COLORS = [Color.PRIMARY, Color.BRIGHT, Color.BRAND_G
|
|
|
3
3
|
export const LOADING_BORDER_ANIMATION_MS = 3000;
|
|
4
4
|
export const DROPDOWN_MAX_HEIGHT = 280;
|
|
5
5
|
export const DROPDOWN_MAX_WIDTH = 320;
|
|
6
|
+
/** Default debounce (ms) before an async `loadItems` call fires after the query changes. */
|
|
6
7
|
export const DEFAULT_DEBOUNCE_MS = 250;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { type MouseEvent, type ReactNode, type RefObject } from 'react';
|
|
2
2
|
import { type DropdownText } from './types';
|
|
3
|
+
/** Resolves a {@link DropdownText} slot to a node, calling it with `query` if it's a function. */
|
|
3
4
|
export declare function resolveDropdownText(text: DropdownText, query: string): ReactNode;
|
|
5
|
+
/** Default key extractor — returns the item itself (for `string`/`number` items). */
|
|
4
6
|
export declare function defaultGetKey<T>(item: T): string | number;
|
|
7
|
+
/** Default item filter — case-insensitive substring match of the item's label against the query. */
|
|
5
8
|
export declare function defaultLabelFilter<T>(item: T, query: string, getLabel: (item: T) => string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Mousedown handler for the field shell: refocuses the input and opens the dropdown,
|
|
11
|
+
* while letting clicks on the input itself or on inner buttons through.
|
|
12
|
+
*/
|
|
6
13
|
export declare function useShellMouseDown(inputRef: RefObject<HTMLInputElement>, isOpen: boolean, open: () => void): (event: MouseEvent<HTMLDivElement>) => void;
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
+
/** Resolves a {@link DropdownText} slot to a node, calling it with `query` if it's a function. */
|
|
2
3
|
export function resolveDropdownText(text, query) {
|
|
3
4
|
return typeof text === 'function' ? text(query) : text;
|
|
4
5
|
}
|
|
6
|
+
/** Default key extractor — returns the item itself (for `string`/`number` items). */
|
|
5
7
|
export function defaultGetKey(item) {
|
|
6
8
|
return item;
|
|
7
9
|
}
|
|
10
|
+
/** Default item filter — case-insensitive substring match of the item's label against the query. */
|
|
8
11
|
export function defaultLabelFilter(item, query, getLabel) {
|
|
9
12
|
return getLabel(item).toLowerCase().includes(query.toLowerCase());
|
|
10
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Mousedown handler for the field shell: refocuses the input and opens the dropdown,
|
|
16
|
+
* while letting clicks on the input itself or on inner buttons through.
|
|
17
|
+
*/
|
|
11
18
|
export function useShellMouseDown(inputRef, isOpen, open) {
|
|
12
19
|
return useCallback(event => {
|
|
13
20
|
var _inputRef$current;
|
|
@@ -54,11 +54,18 @@ export type ItemsSource<T> = {
|
|
|
54
54
|
/** Don't call `loadItems` until the query has at least this many characters. */
|
|
55
55
|
minChars?: number;
|
|
56
56
|
};
|
|
57
|
+
/** Normalized descriptor for one row rendered by {@link SuggestionsDropdown}. */
|
|
57
58
|
export type DropdownItemDescriptor = {
|
|
59
|
+
/** Stable unique key. */
|
|
58
60
|
key: string | number;
|
|
61
|
+
/** Optional DOM id (used for ARIA active-descendant). */
|
|
59
62
|
id?: string;
|
|
63
|
+
/** Rendered row content. */
|
|
60
64
|
label: ReactNode;
|
|
65
|
+
/** Row is the keyboard-highlighted one. */
|
|
61
66
|
active?: boolean;
|
|
67
|
+
/** Row is the selected value. */
|
|
62
68
|
selected?: boolean;
|
|
69
|
+
/** Called when the row is chosen. */
|
|
63
70
|
onSelect?: () => void;
|
|
64
71
|
};
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import { type Dispatch, type SetStateAction } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Holds the active (highlighted) row index, clamping it to `total` and resetting to
|
|
4
|
+
* `resetIndex` when the list changes.
|
|
5
|
+
*/
|
|
2
6
|
export declare function useActiveIndex(total: number, resetIndex: number): [number, Dispatch<SetStateAction<number>>];
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Holds the active (highlighted) row index, clamping it to `total` and resetting to
|
|
4
|
+
* `resetIndex` when the list changes.
|
|
5
|
+
*/
|
|
2
6
|
export function useActiveIndex(total, resetIndex) {
|
|
3
7
|
const [activeIndex, setActiveIndex] = useState(resetIndex);
|
|
4
8
|
useEffect(() => {
|
|
@@ -12,5 +12,9 @@ type Result<T> = {
|
|
|
12
12
|
loadingMore: boolean;
|
|
13
13
|
loadMore: () => void;
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Drives async option loading for a Combobox field: debounces the query, respects
|
|
17
|
+
* `minChars`, paginates, and accumulates results with loading/load-more state.
|
|
18
|
+
*/
|
|
15
19
|
export declare function useAsyncItems<T>({ loadItems, query, isOpen, debounceMs, minChars, }: Args<T>): Result<T>;
|
|
16
20
|
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { DEFAULT_DEBOUNCE_MS } from './constants';
|
|
3
3
|
import { useDebouncedValue } from './useDebouncedValue';
|
|
4
|
+
/**
|
|
5
|
+
* Drives async option loading for a Combobox field: debounces the query, respects
|
|
6
|
+
* `minChars`, paginates, and accumulates results with loading/load-more state.
|
|
7
|
+
*/
|
|
4
8
|
export function useAsyncItems({
|
|
5
9
|
loadItems,
|
|
6
10
|
query,
|
|
@@ -17,5 +17,9 @@ type Result<T> = {
|
|
|
17
17
|
loadingMore: boolean;
|
|
18
18
|
loadMore: () => void;
|
|
19
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Resolves the option list for a Combobox field from either static `items` or an
|
|
22
|
+
* async `loadItems` loader, applying the query filter and exposing loading/load-more state.
|
|
23
|
+
*/
|
|
20
24
|
export declare function useDropdownItems<T>({ items, loadItems, localItems, debounceMs, minChars, getLabel, filter, query, isOpen, }: Args<T>): Result<T>;
|
|
21
25
|
export {};
|
|
@@ -2,6 +2,10 @@ import { useMemo } from 'react';
|
|
|
2
2
|
import { DEFAULT_DEBOUNCE_MS } from './constants';
|
|
3
3
|
import { defaultLabelFilter } from './shared';
|
|
4
4
|
import { useAsyncItems } from './useAsyncItems';
|
|
5
|
+
/**
|
|
6
|
+
* Resolves the option list for a Combobox field from either static `items` or an
|
|
7
|
+
* async `loadItems` loader, applying the query filter and exposing loading/load-more state.
|
|
8
|
+
*/
|
|
5
9
|
export function useDropdownItems({
|
|
6
10
|
items,
|
|
7
11
|
loadItems,
|
|
@@ -2,6 +2,10 @@ type Args = {
|
|
|
2
2
|
isOpen?: boolean;
|
|
3
3
|
onClickOutside?: () => void;
|
|
4
4
|
};
|
|
5
|
+
/**
|
|
6
|
+
* Positions the dropdown relative to the field via floating-ui (flip, offset,
|
|
7
|
+
* width/height sizing) and wires click-outside to `onClickOutside`.
|
|
8
|
+
*/
|
|
5
9
|
export declare function useDropdownPosition({ isOpen, onClickOutside }: Args): {
|
|
6
10
|
setReference: (node: import("@floating-ui/react-dom").ReferenceType | null) => void;
|
|
7
11
|
setFloating: (node: HTMLElement | null) => void;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { autoUpdate, flip, offset, size, useFloating } from '@floating-ui/react-dom';
|
|
2
2
|
import { DROPDOWN_MAX_WIDTH } from './constants';
|
|
3
3
|
import { useOnClickOutside } from '../../hooks';
|
|
4
|
+
/**
|
|
5
|
+
* Positions the dropdown relative to the field via floating-ui (flip, offset,
|
|
6
|
+
* width/height sizing) and wires click-outside to `onClickOutside`.
|
|
7
|
+
*/
|
|
4
8
|
export function useDropdownPosition({
|
|
5
9
|
isOpen,
|
|
6
10
|
onClickOutside
|
|
@@ -6,5 +6,9 @@ type Args = {
|
|
|
6
6
|
autoFocus?: boolean;
|
|
7
7
|
inputRef: RefObject<HTMLInputElement>;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* Side effects tied to a Combobox field's open state: optional autofocus on mount
|
|
11
|
+
* and firing `onClose` when the field closes.
|
|
12
|
+
*/
|
|
9
13
|
export declare function useFieldOpenEffects({ isOpen, open, onClose, autoFocus, inputRef, }: Args): void;
|
|
10
14
|
export {};
|
|
@@ -14,5 +14,10 @@ type Args = {
|
|
|
14
14
|
isQueryEmpty?: boolean;
|
|
15
15
|
onBackspaceEmpty?: () => void;
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Keyboard navigation for a Combobox list: arrow up/down to move the active row,
|
|
19
|
+
* Enter to select (or submit / pick the extra "create" row), Escape to close, and
|
|
20
|
+
* Backspace-on-empty handling.
|
|
21
|
+
*/
|
|
17
22
|
export declare function useListNavigation({ isOpen, open, itemCount, activeIndex, setActiveIndex, onSelectIndex, onEscape, onSubmit, onReachEnd, hasExtraRow, onSelectExtra, isQueryEmpty, onBackspaceEmpty, }: Args): (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
18
23
|
export {};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Keyboard navigation for a Combobox list: arrow up/down to move the active row,
|
|
4
|
+
* Enter to select (or submit / pick the extra "create" row), Escape to close, and
|
|
5
|
+
* Backspace-on-empty handling.
|
|
6
|
+
*/
|
|
2
7
|
export function useListNavigation({
|
|
3
8
|
isOpen,
|
|
4
9
|
open,
|