@cloudwick/astral-ui 8.0.0 → 8.2.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.
Files changed (52) hide show
  1. package/README.md +1 -1
  2. package/dist/components/button/reloadButton.d.ts +20 -0
  3. package/dist/components/emptyState/emptyStateVariants.d.ts +3 -3
  4. package/dist/components/multiSelectTransfer/index.d.ts +1 -1
  5. package/dist/components/multiSelectTransfer/multiSelectTransfer.d.ts +5 -4
  6. package/dist/components/multiSelectTransfer/multiSelectTransferDropdown.d.ts +25 -5
  7. package/dist/components/multiSelectTransfer/multiSelectTransferDropdownHeader.d.ts +31 -0
  8. package/dist/components/multiSelectTransfer/multiSelectTransferModal.d.ts +18 -4
  9. package/dist/components/multiSelectTransfer/multiSelectTransferOptionRow.d.ts +27 -0
  10. package/dist/components/multiSelectTransfer/multiSelectTransferTrigger.d.ts +26 -0
  11. package/dist/components/multiSelectTransfer/multiSelectTransferVariants.d.ts +36 -0
  12. package/dist/components/multiSelectTransfer/types.d.ts +93 -2
  13. package/dist/components/multiSelectTransfer/useMultiSelectTransferDraft.d.ts +24 -0
  14. package/dist/components/multiSelectTransfer/useMultiSelectTransferOptionSource.d.ts +56 -0
  15. package/dist/components/select/index.d.ts +1 -1
  16. package/dist/components/select/select.d.ts +5 -6
  17. package/dist/components/select/selectComponents.d.ts +16 -19
  18. package/dist/components/select/selectKeyboard.d.ts +22 -0
  19. package/dist/components/select/selectMenu.d.ts +12 -0
  20. package/dist/components/select/selectVariants.d.ts +21 -0
  21. package/dist/components/select/types.d.ts +142 -16
  22. package/dist/components/select/useSelectOptionSource.d.ts +39 -0
  23. package/dist/components/select/useSelectOutsideClose.d.ts +16 -0
  24. package/dist/components/select/utils.d.ts +5 -1
  25. package/dist/components/transferList/index.d.ts +1 -1
  26. package/dist/components/transferList/transferList.d.ts +2 -5
  27. package/dist/components/transferList/transferListPanel.d.ts +14 -1
  28. package/dist/components/transferList/transferListPanelHeader.d.ts +29 -0
  29. package/dist/components/transferList/transferListVariants.d.ts +9 -0
  30. package/dist/components/transferList/types.d.ts +86 -10
  31. package/dist/components/transferList/useTransferList.d.ts +1 -1
  32. package/dist/components/transferList/useTransferListPanelKeys.d.ts +28 -0
  33. package/dist/components/transferList/useTransferListSource.d.ts +49 -0
  34. package/dist/css/index.min.css +1 -1
  35. package/dist/hooks/index.d.ts +7 -1
  36. package/dist/hooks/useAsyncOptions.d.ts +85 -0
  37. package/dist/hooks/useAsyncOptionsReducer.d.ts +75 -0
  38. package/dist/hooks/useAvailableProjection.d.ts +20 -0
  39. package/dist/hooks/useFilterQuery.d.ts +28 -0
  40. package/dist/hooks/useIgnoredPropWarning.d.ts +5 -0
  41. package/dist/hooks/useInfiniteScroll.d.ts +11 -2
  42. package/dist/hooks/useOnValueChange.d.ts +6 -0
  43. package/dist/hooks/usePrefetchBaseline.d.ts +22 -0
  44. package/dist/index.cjs.js +5 -5
  45. package/dist/index.d.ts +1 -0
  46. package/dist/index.esm.js +5 -5
  47. package/dist/utils/devWarn.d.ts +5 -0
  48. package/dist/utils/index.d.ts +4 -0
  49. package/dist/utils/mergeUnique.d.ts +6 -0
  50. package/dist/utils/resolveLoadErrors.d.ts +20 -0
  51. package/dist/utils/resolveReloadControls.d.ts +23 -0
  52. package/package.json +2 -2
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  UI Library for Cloudwick
4
4
 
5
- Version - 8.0.0
5
+ Version - 8.2.0
6
6
 
7
7
  ## Installation
8
8
 
@@ -0,0 +1,20 @@
1
+ import * as React from "react";
2
+ export interface IReloadButtonProps {
3
+ /** Absent means the surface has no reload affordance, and nothing renders. */
4
+ onReload?: () => void;
5
+ /** Spins the icon and blocks a second click while the refetch is in flight. */
6
+ isReloading?: boolean;
7
+ /** OR-ed with `isReloading` — a disabled surface has nothing to reload. */
8
+ disabled?: boolean;
9
+ /** Doubles as the accessible name; the button is icon-only. */
10
+ tooltip?: string;
11
+ className?: string;
12
+ }
13
+ /**
14
+ * The icon-only refetch affordance for any surface backed by an async option source. One component
15
+ * so the icon, the in-flight disable and the tooltip/aria-label pairing cannot drift between them.
16
+ */
17
+ export declare function ReloadButton({ onReload, isReloading, disabled, tooltip, className }: IReloadButtonProps): React.ReactElement | null;
18
+ export declare namespace ReloadButton {
19
+ var displayName: string;
20
+ }
@@ -1,9 +1,9 @@
1
1
  export declare const emptyStateVariants: import("tailwind-variants").TVReturnType<{
2
2
  [key: string]: {
3
3
  [key: string]: import("tailwind-merge").ClassNameValue | {
4
+ base?: import("tailwind-merge").ClassNameValue;
4
5
  title?: import("tailwind-merge").ClassNameValue;
5
6
  content?: import("tailwind-merge").ClassNameValue;
6
- base?: import("tailwind-merge").ClassNameValue;
7
7
  cta?: import("tailwind-merge").ClassNameValue;
8
8
  contentWrapper?: import("tailwind-merge").ClassNameValue;
9
9
  };
@@ -11,9 +11,9 @@ export declare const emptyStateVariants: import("tailwind-variants").TVReturnTyp
11
11
  } | {
12
12
  [x: string]: {
13
13
  [x: string]: import("tailwind-merge").ClassNameValue | {
14
+ base?: import("tailwind-merge").ClassNameValue;
14
15
  title?: import("tailwind-merge").ClassNameValue;
15
16
  content?: import("tailwind-merge").ClassNameValue;
16
- base?: import("tailwind-merge").ClassNameValue;
17
17
  cta?: import("tailwind-merge").ClassNameValue;
18
18
  contentWrapper?: import("tailwind-merge").ClassNameValue;
19
19
  };
@@ -27,9 +27,9 @@ export declare const emptyStateVariants: import("tailwind-variants").TVReturnTyp
27
27
  }, undefined, {
28
28
  [key: string]: {
29
29
  [key: string]: import("tailwind-merge").ClassNameValue | {
30
+ base?: import("tailwind-merge").ClassNameValue;
30
31
  title?: import("tailwind-merge").ClassNameValue;
31
32
  content?: import("tailwind-merge").ClassNameValue;
32
- base?: import("tailwind-merge").ClassNameValue;
33
33
  cta?: import("tailwind-merge").ClassNameValue;
34
34
  contentWrapper?: import("tailwind-merge").ClassNameValue;
35
35
  };
@@ -1,3 +1,3 @@
1
1
  export { MultiSelectTransfer } from "./multiSelectTransfer";
2
2
  export { multiSelectTransferVariants } from "./multiSelectTransferVariants";
3
- export type { IMultiSelectTransferProps, TMultiSelectTransferOption, TMultiSelectTransferSize } from "./types";
3
+ export type { IMultiSelectTransferProps, TMultiSelectTransferOption, TMultiSelectTransferSize, TMultiSelectTransferLoadOptions } from "./types";
@@ -1,6 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { type IMultiSelectTransferProps } from "./types";
3
- export declare function MultiSelectTransfer({ id, className, label, placeholder, helperText, error, disabled, size, options, value, onChange, filterValue, onFilterChange, searchPlaceholder, filterDebounceMs, hasMore, onLoadMore, isLoading, maxVisiblePills, transferListTitle, transferListSubtitle, transferListHeader, onOpenTransferList, reorderable, reloadTooltip, onReload, isReloading, availablePanelHeaderSlot, selectedPanelHeaderSlot, cancelLabel, doneLabel }: IMultiSelectTransferProps): React.ReactElement;
4
- export declare namespace MultiSelectTransfer {
5
- var displayName: string;
6
- }
3
+ /**
4
+ * A pill trigger over a dropdown option list, with a two-panel transfer-list modal as its second
5
+ * surface. The forwarded ref lands on the wrapper `<div>`.
6
+ */
7
+ export declare const MultiSelectTransfer: React.ForwardRefExoticComponent<IMultiSelectTransferProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,31 +1,51 @@
1
1
  import * as React from "react";
2
+ import { type TSentinelRef } from "@hooks";
2
3
  import type { TTransferListValue } from "../transferList/types";
3
4
  import type { TMultiSelectTransferOption, TMultiSelectTransferSize } from "./types";
4
5
  interface IMultiSelectTransferDropdownProps {
5
6
  error?: boolean;
6
7
  size: TMultiSelectTransferSize;
7
8
  disabled?: boolean;
9
+ /** Renders the in-dropdown search input. With `false` the option list itself owns focus. */
10
+ searchable: boolean;
8
11
  filterQuery: string;
9
12
  onFilterInput: (e: React.ChangeEvent<HTMLInputElement>) => void;
10
- onFilterKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
13
+ onFilterKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;
14
+ onFilterKeyUp: (e: React.KeyboardEvent<HTMLElement>) => void;
15
+ onFilterBlur: (e: React.FocusEvent<HTMLInputElement>) => void;
11
16
  searchPlaceholder: string;
12
- options: TMultiSelectTransferOption[];
17
+ /** Readonly so the option source's pool can be passed through without a defensive copy. */
18
+ options: readonly TMultiSelectTransferOption[];
13
19
  selectedValues: Set<TTransferListValue>;
14
20
  onOptionToggle: (option: TMultiSelectTransferOption) => void;
15
21
  hasSelectAll: boolean;
16
22
  areAllSelected: boolean;
17
23
  onSelectAll: () => void;
24
+ /** Any load in flight; renders the loader row below the list. */
18
25
  isLoading?: boolean;
19
- sentinelRef: React.RefObject<HTMLDivElement>;
26
+ /**
27
+ * Loader (or error) takes the rows' place rather than appending below them. Required, and supplied
28
+ * by the option source rather than re-derived here, so the hook is the single source of this
29
+ * predicate — two components deriving it differently is how they drifted.
30
+ */
31
+ isSearchFetch: boolean;
32
+ sentinelRef: TSentinelRef;
33
+ /** Replaces the rows when set: the whole list failed to load. */
34
+ loadError?: React.ReactNode;
35
+ /** Shown below the loaded rows when a page append failed. */
36
+ loadMoreError?: React.ReactNode;
37
+ /** Fired by the retry button beside `loadMoreError`. */
38
+ onRetryLoadMore?: () => void;
39
+ retryLabel?: string;
20
40
  reloadTooltip?: string;
21
41
  onReload?: () => void;
22
42
  isReloading?: boolean;
23
43
  }
24
44
  /**
25
- * The open-state dropdown for MultiSelectTransfer: a search input, an optional "Select All"
45
+ * The open-state dropdown for MultiSelectTransfer: an optional search input, an optional "Select All"
26
46
  * row, the (draft-checked) option list, and the infinite-scroll sentinel.
27
47
  */
28
- export declare function MultiSelectTransferDropdown({ error, size, disabled, filterQuery, onFilterInput, onFilterKeyDown, searchPlaceholder, options, selectedValues, onOptionToggle, hasSelectAll, areAllSelected, onSelectAll, isLoading, sentinelRef, reloadTooltip, onReload, isReloading }: IMultiSelectTransferDropdownProps): React.ReactElement;
48
+ export declare function MultiSelectTransferDropdown({ error, size, disabled, searchable, filterQuery, onFilterInput, onFilterKeyDown, onFilterKeyUp, onFilterBlur, searchPlaceholder, options, selectedValues, onOptionToggle, hasSelectAll, areAllSelected, onSelectAll, isLoading, isSearchFetch, sentinelRef, loadError, loadMoreError, onRetryLoadMore, retryLabel, reloadTooltip, onReload, isReloading }: IMultiSelectTransferDropdownProps): React.ReactElement;
29
49
  export declare namespace MultiSelectTransferDropdown {
30
50
  var displayName: string;
31
51
  }
@@ -0,0 +1,31 @@
1
+ import * as React from "react";
2
+ interface IMultiSelectTransferDropdownHeaderProps {
3
+ /** tv() class for the strip itself, resolved by the dropdown that owns the variant config. */
4
+ headerClass: string;
5
+ /** tv() class for the search input. */
6
+ filterInputClass: string;
7
+ /** Renders the search input. With `false` the header holds only the reload affordance. */
8
+ searchable: boolean;
9
+ filterQuery: string;
10
+ onFilterInput: (e: React.ChangeEvent<HTMLInputElement>) => void;
11
+ onFilterKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;
12
+ onFilterKeyUp: (e: React.KeyboardEvent<HTMLElement>) => void;
13
+ onFilterBlur: (e: React.FocusEvent<HTMLInputElement>) => void;
14
+ searchPlaceholder: string;
15
+ /** The listbox this combobox drives, and the row its activedescendant points at. */
16
+ listboxId: string;
17
+ activeDescendant?: string;
18
+ reloadTooltip?: string;
19
+ onReload?: () => void;
20
+ isReloading?: boolean;
21
+ }
22
+ /**
23
+ * The chrome above the dropdown's option list: the search input — a combobox driving the listbox
24
+ * below it through `aria-activedescendant` — and the optional reload button. With neither on screen
25
+ * it renders nothing, so the rows start at the top of the dropdown rather than under an empty bar.
26
+ */
27
+ export declare function MultiSelectTransferDropdownHeader({ headerClass, filterInputClass, searchable, filterQuery, onFilterInput, onFilterKeyDown, onFilterKeyUp, onFilterBlur, searchPlaceholder, listboxId, activeDescendant, reloadTooltip, onReload, isReloading }: IMultiSelectTransferDropdownHeaderProps): React.ReactElement | null;
28
+ export declare namespace MultiSelectTransferDropdownHeader {
29
+ var displayName: string;
30
+ }
31
+ export {};
@@ -14,12 +14,26 @@ interface IMultiSelectTransferModalProps {
14
14
  reloadTooltip?: string;
15
15
  onReload?: () => void;
16
16
  isReloading?: boolean;
17
+ /** Renders both panels' search inputs; forwarded straight to TransferList. */
18
+ searchable?: boolean;
17
19
  searchPlaceholder?: string;
18
20
  availablePanelHeaderSlot?: React.ReactNode;
19
21
  selectedPanelHeaderSlot?: React.ReactNode;
20
- hasMore?: boolean;
21
- onLoadMore?: () => void;
22
- isLoading?: boolean;
22
+ hasMoreAvailable?: boolean;
23
+ onLoadMoreAvailable?: () => void;
24
+ /** Loader (or error) REPLACES the available rows rather than appending below them. */
25
+ isLoadingAvailable?: boolean;
26
+ /** Loader appends below the available rows (a page fetch). */
27
+ isLoadingMoreAvailable: boolean;
28
+ availableLoadError?: React.ReactNode;
29
+ availableLoadMoreError?: React.ReactNode;
30
+ onRetryLoadMoreAvailable?: () => void;
31
+ retryLabel?: string;
32
+ /** Server-side total for the available panel. */
33
+ availableTotalCount?: number;
34
+ /** Set (async mode only) to drive the available panel's search server-side. */
35
+ availableSearchTerm?: string;
36
+ onAvailableSearchChange?: (query: string) => void;
23
37
  cancelLabel: React.ReactNode;
24
38
  doneLabel: React.ReactNode;
25
39
  }
@@ -27,7 +41,7 @@ interface IMultiSelectTransferModalProps {
27
41
  * The transfer-list modal surface for MultiSelectTransfer: full-screen on mobile, a widened
28
42
  * centered dialog from sm up. Hosts the two-panel TransferList plus a pinned footer bar.
29
43
  */
30
- export declare function MultiSelectTransferModal({ showModal, availableItems, selectedItems, onChange, onCancel, onDone, header, title, subtitle, reorderable, reloadTooltip, onReload, isReloading, searchPlaceholder, availablePanelHeaderSlot, selectedPanelHeaderSlot, hasMore, onLoadMore, isLoading, cancelLabel, doneLabel }: IMultiSelectTransferModalProps): React.ReactElement;
44
+ export declare function MultiSelectTransferModal({ showModal, availableItems, selectedItems, onChange, onCancel, onDone, header, title, subtitle, reorderable, reloadTooltip, onReload, isReloading, searchable, searchPlaceholder, availablePanelHeaderSlot, selectedPanelHeaderSlot, hasMoreAvailable, onLoadMoreAvailable, isLoadingAvailable, isLoadingMoreAvailable, availableLoadError, availableLoadMoreError, onRetryLoadMoreAvailable, retryLabel, availableTotalCount, availableSearchTerm, onAvailableSearchChange, cancelLabel, doneLabel }: IMultiSelectTransferModalProps): React.ReactElement;
31
45
  export declare namespace MultiSelectTransferModal {
32
46
  var displayName: string;
33
47
  }
@@ -0,0 +1,27 @@
1
+ import * as React from "react";
2
+ interface IOptionRowProps {
3
+ id: string;
4
+ label: React.ReactNode;
5
+ checked: boolean;
6
+ active: boolean;
7
+ disabled?: boolean;
8
+ onToggle: () => void;
9
+ onActivate: () => void;
10
+ optionItemClass: string | undefined;
11
+ optionLabelWrapClass: string;
12
+ optionLabelClass: string;
13
+ }
14
+ /**
15
+ * A single dropdown row (both "Select All" and regular options): checkbox + label. Measures
16
+ * its own label via `useIsTruncated` so the hover/focus expand affordance (see
17
+ * multiSelectTransferVariants' optionLabel) only ever shows up on rows whose text is actually
18
+ * clipped.
19
+ *
20
+ * Rows are not individually tabbable: focus sits on the single tab stop above them — the filter input
21
+ * (a combobox) where the search is shown, otherwise the listbox itself — and keyboard navigation is
22
+ * driven from there by `aria-activedescendant` / arrow keys. `active` marks the row the arrow keys
23
+ * have landed on so it can be highlighted and scrolled into view; the pointer path still toggles on
24
+ * click / activates on hover.
25
+ */
26
+ export declare function OptionRow({ id, label, checked, active, disabled, onToggle, onActivate, optionItemClass, optionLabelWrapClass, optionLabelClass }: IOptionRowProps): React.ReactElement;
27
+ export {};
@@ -0,0 +1,26 @@
1
+ import * as React from "react";
2
+ import type { TMultiSelectTransferOption, TMultiSelectTransferSize } from "./types";
3
+ interface IMultiSelectTransferTriggerProps {
4
+ id: string;
5
+ error?: boolean;
6
+ size: TMultiSelectTransferSize;
7
+ disabled: boolean;
8
+ isOpen: boolean;
9
+ /** The committed selection — the trigger shows pills for this, never for the in-progress draft. */
10
+ value: TMultiSelectTransferOption[];
11
+ placeholder: string;
12
+ maxVisiblePills: number;
13
+ onClick: () => void;
14
+ onKeyDown: (e: React.KeyboardEvent<HTMLDivElement>) => void;
15
+ onRemovePill: (option: TMultiSelectTransferOption, e: React.MouseEvent) => void;
16
+ onOpenTransferList: (e: React.MouseEvent) => void;
17
+ }
18
+ /**
19
+ * The read-only control for MultiSelectTransfer: committed pills (capped by `maxVisiblePills` with a
20
+ * "+N More" overflow), the transfer-list CTA and the open/close chevron. It owns no state.
21
+ *
22
+ * The trigger comes back through `forwardRef`, not a `triggerRef` prop: a ref taken as an ordinary
23
+ * prop cannot be merged with a caller's own, and is invisible to anything composing over `ref`.
24
+ */
25
+ export declare const MultiSelectTransferTrigger: React.ForwardRefExoticComponent<IMultiSelectTransferTriggerProps & React.RefAttributes<HTMLDivElement>>;
26
+ export {};
@@ -17,6 +17,7 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
17
17
  pillMore: string;
18
18
  placeholder: string;
19
19
  optionLabel: string;
20
+ noOptionsMessage: string;
20
21
  };
21
22
  lg: {
22
23
  trigger: string;
@@ -25,6 +26,7 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
25
26
  pillMore: string;
26
27
  placeholder: string;
27
28
  optionLabel: string;
29
+ noOptionsMessage: string;
28
30
  };
29
31
  };
30
32
  disabled: {
@@ -39,6 +41,11 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
39
41
  };
40
42
  false: {};
41
43
  };
44
+ searchable: {
45
+ false: {
46
+ dropdownHeader: string;
47
+ };
48
+ };
42
49
  }, {
43
50
  base: string;
44
51
  label: string;
@@ -48,6 +55,11 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
48
55
  dropdownHeader: string;
49
56
  filterInput: string;
50
57
  optionsList: string;
58
+ optionsListbox: string;
59
+ noOptionsMessage: string;
60
+ loaderRow: string;
61
+ errorMessage: string;
62
+ loadMoreErrorRow: string;
51
63
  optionItem: string;
52
64
  optionLabelWrap: string;
53
65
  optionLabel: string;
@@ -78,6 +90,7 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
78
90
  pillMore: string;
79
91
  placeholder: string;
80
92
  optionLabel: string;
93
+ noOptionsMessage: string;
81
94
  };
82
95
  lg: {
83
96
  trigger: string;
@@ -86,6 +99,7 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
86
99
  pillMore: string;
87
100
  placeholder: string;
88
101
  optionLabel: string;
102
+ noOptionsMessage: string;
89
103
  };
90
104
  };
91
105
  disabled: {
@@ -100,6 +114,11 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
100
114
  };
101
115
  false: {};
102
116
  };
117
+ searchable: {
118
+ false: {
119
+ dropdownHeader: string;
120
+ };
121
+ };
103
122
  }, {
104
123
  base: string;
105
124
  label: string;
@@ -109,6 +128,11 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
109
128
  dropdownHeader: string;
110
129
  filterInput: string;
111
130
  optionsList: string;
131
+ optionsListbox: string;
132
+ noOptionsMessage: string;
133
+ loaderRow: string;
134
+ errorMessage: string;
135
+ loadMoreErrorRow: string;
112
136
  optionItem: string;
113
137
  optionLabelWrap: string;
114
138
  optionLabel: string;
@@ -139,6 +163,7 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
139
163
  pillMore: string;
140
164
  placeholder: string;
141
165
  optionLabel: string;
166
+ noOptionsMessage: string;
142
167
  };
143
168
  lg: {
144
169
  trigger: string;
@@ -147,6 +172,7 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
147
172
  pillMore: string;
148
173
  placeholder: string;
149
174
  optionLabel: string;
175
+ noOptionsMessage: string;
150
176
  };
151
177
  };
152
178
  disabled: {
@@ -161,6 +187,11 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
161
187
  };
162
188
  false: {};
163
189
  };
190
+ searchable: {
191
+ false: {
192
+ dropdownHeader: string;
193
+ };
194
+ };
164
195
  }, {
165
196
  base: string;
166
197
  label: string;
@@ -170,6 +201,11 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
170
201
  dropdownHeader: string;
171
202
  filterInput: string;
172
203
  optionsList: string;
204
+ optionsListbox: string;
205
+ noOptionsMessage: string;
206
+ loaderRow: string;
207
+ errorMessage: string;
208
+ loadMoreErrorRow: string;
173
209
  optionItem: string;
174
210
  optionLabelWrap: string;
175
211
  optionLabel: string;
@@ -1,4 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
+ import type { TLoadOptions, TPrefetch } from "@hooks";
2
3
  import type { ITransferListItem } from "../transferList/types";
3
4
  export declare enum EMultiSelectTransferSizes {
4
5
  MD = "md",
@@ -6,26 +7,67 @@ export declare enum EMultiSelectTransferSizes {
6
7
  }
7
8
  export type TMultiSelectTransferSize = `${EMultiSelectTransferSizes}`;
8
9
  export type TMultiSelectTransferOption = ITransferListItem;
10
+ /**
11
+ * Async option source. Paged: `cursor`, `hasMore` and `total` on the resolved page are all honoured.
12
+ */
13
+ export type TMultiSelectTransferLoadOptions = TLoadOptions<TMultiSelectTransferOption>;
9
14
  export interface IMultiSelectTransferProps {
15
+ /** Unique id for the trigger. A generated id is used when omitted. */
10
16
  id?: string;
17
+ /** Custom className for the wrapper. */
11
18
  className?: string;
19
+ /** Label displayed above the trigger. */
12
20
  label?: ReactNode;
21
+ /** Text shown in the trigger while nothing is selected. @default "Select..." */
13
22
  placeholder?: string;
23
+ /** Helper text displayed below the trigger. */
14
24
  helperText?: ReactNode;
25
+ /** Display error styling. @default false */
15
26
  error?: boolean;
27
+ /** Disable all interaction. @default false */
16
28
  disabled?: boolean;
29
+ /** Trigger size variant. @default "md" */
17
30
  size?: TMultiSelectTransferSize;
18
- options: TMultiSelectTransferOption[];
31
+ /**
32
+ * Options to choose from; treated as the result for the current query in server mode. Ignored (with
33
+ * a dev warning) when `loadOptions` is set — pass `initialOptions` to seed the list instead.
34
+ */
35
+ options?: TMultiSelectTransferOption[];
36
+ /** Selected options. Passing this makes the component controlled. */
19
37
  value?: TMultiSelectTransferOption[];
38
+ /** Fired with the next selection when the dropdown or modal commits. */
20
39
  onChange?: (selected: TMultiSelectTransferOption[]) => void;
40
+ /** Seeds/re-syncs dropdown search; semi-controlled — pair with onFilterChange. */
21
41
  filterValue?: string;
42
+ /**
43
+ * Debounced search-query callback; also called with "" when the component clears search (dropdown
44
+ * commit/cancel, or opening the transfer list modal).
45
+ *
46
+ * Without `loadOptions`: switches off local filtering — `options` is treated as already filtered
47
+ * for the query — and the fetch, loading state, paging, and response ordering are the consumer's
48
+ * responsibility.
49
+ *
50
+ * With `loadOptions`: notification-only, for analytics or `filterValue` syncing.
51
+ */
22
52
  onFilterChange?: (query: string) => void;
53
+ /**
54
+ * Renders the dropdown's search input and the transfer list modal's two panel search inputs. With
55
+ * `false` the dropdown's option list becomes the focused widget on open and owns the keyboard
56
+ * (`role="listbox"` plus `aria-activedescendant`), so Escape, Tab, the arrows, Home/End and Enter
57
+ * behave as they do with the input present, and Space activates the active row. Only the ability to
58
+ * narrow the list is gone, which suits short, fixed option sets. The reload button is unaffected.
59
+ * @default true
60
+ */
61
+ searchable?: boolean;
23
62
  /** Placeholder for the dropdown filter input and the transfer list modal's panel search inputs. @default "Search..." */
24
63
  searchPlaceholder?: string;
25
- /** Debounce delay in ms for onFilterChange. Set to 0 to disable. @default 300 */
64
+ /** Debounce for the search query, in both sync and `loadOptions` mode. Set to 0 to disable. @default 300 */
26
65
  filterDebounceMs?: number;
66
+ /** Whether more options can be loaded; arms the dropdown's infinite-scroll sentinel. Ignored when `loadOptions` is set. @default false */
27
67
  hasMore?: boolean;
68
+ /** Fired when the infinite-scroll sentinel at the bottom of the option list scrolls into view. Ignored when `loadOptions` is set. */
28
69
  onLoadMore?: () => void;
70
+ /** Loader replaces rows on search fetch, appends on load-more. OR-ed with the loader's own state, so it still applies in async mode. @default false */
29
71
  isLoading?: boolean;
30
72
  /** Max pills shown in the trigger before showing "+N More". @default 3 */
31
73
  maxVisiblePills?: number;
@@ -53,4 +95,53 @@ export interface IMultiSelectTransferProps {
53
95
  cancelLabel?: ReactNode;
54
96
  /** Label for the modal commit button. @default "Done" */
55
97
  doneLabel?: ReactNode;
98
+ /**
99
+ * Server-side option source. When provided, the component owns the option list, paging, the request
100
+ * lifecycle and the loading state; `options` / `hasMore` / `onLoadMore` / `isLoading` are ignored and
101
+ * `onFilterChange` becomes notification-only. Responsible for mapping the payload to
102
+ * `TMultiSelectTransferOption` — envelopes and domain filtering are the consumer's business. Options
103
+ * are stored exactly as returned, so extra fields survive. A fresh inline arrow is fine: the loader
104
+ * is read through a ref.
105
+ */
106
+ loadOptions?: TMultiSelectTransferLoadOptions;
107
+ /**
108
+ * Seed rows for a list you already have — an SSR payload, a route loader, a warm cache. They paint on the
109
+ * first frame of both surfaces instead of a loader, and stay put while the baseline fetch revalidates over
110
+ * them (the dropdown's spinner appends below the rows, as it does for any load in flight). They do not
111
+ * suppress that fetch: pair with `prefetch="never"` if the seed is the whole list until the user types.
112
+ * Seed rows carry no cursor, so nothing pages until a real page lands.
113
+ * A *search* replaces them, since seed rows are not results for a query; clearing it brings them back until
114
+ * a fetched baseline does. Async mode only — ignored (dev warning) without `loadOptions`, where the rows
115
+ * belong in `options`.
116
+ */
117
+ initialOptions?: readonly TMultiSelectTransferOption[];
118
+ /**
119
+ * When to fetch the unfiltered first page.
120
+ * - `"open"` — when the dropdown or the transfer-list modal first opens, whichever comes first.
121
+ * - `"mount"` — at render, so the first open shows rows instead of a loader. The trigger renders its
122
+ * committed chips either way, so this buys latency rather than fixing an empty-looking control.
123
+ * - `"never"` — no baseline at all; fetch only once the user types. For heavy lists.
124
+ *
125
+ * Async mode only — ignored (dev warning) without `loadOptions`, where `options` are already on screen
126
+ * and there is nothing to fetch.
127
+ * @default "open"
128
+ */
129
+ prefetch?: TPrefetch;
130
+ /** Clearing the search revalidates the cached baseline instead of just restoring it. @default false */
131
+ refetchOnClear?: boolean;
132
+ /**
133
+ * Identity of the option set, for dependent pickers. When it changes, cached pages are dropped and the
134
+ * list is repopulated. Compose several parents into one scalar. Does NOT clear the selection.
135
+ */
136
+ optionsKey?: string | number;
137
+ /** Shown in place of the rows when `loadOptions` rejects. @default "Couldn't load options." */
138
+ loadErrorMessage?: ReactNode;
139
+ /** Shown under the loaded rows when a page append rejects; a failed page never blanks the list. @default "Couldn't load more." */
140
+ loadMoreErrorMessage?: ReactNode;
141
+ /** Label for the retry button beside `loadMoreErrorMessage`. @default "Retry" */
142
+ retryLabel?: string;
143
+ /** Shows the reload button in async mode, wired to re-run the current query from page one. @default false */
144
+ showReloadButton?: boolean;
145
+ /** Notified when a load rejects (the component renders the message and swallows it). */
146
+ onLoadError?: (error: unknown) => void;
56
147
  }
@@ -0,0 +1,24 @@
1
+ import type { TMultiSelectTransferOption } from "./types";
2
+ interface IMultiSelectTransferDraft {
3
+ /** Derived: the loaded pool plus the opening snapshot, minus whatever is in the draft selection. */
4
+ draftAvailable: TMultiSelectTransferOption[];
5
+ /** Owned: the ordered draft selection. Order matters when `reorderable`. */
6
+ draftSelected: TMultiSelectTransferOption[];
7
+ /** Wire to `TransferList`'s onChange; only its second argument is needed. */
8
+ onDraftChange: (nextAvailable: TMultiSelectTransferOption[], nextSelected: TMultiSelectTransferOption[]) => void;
9
+ /** Seed the draft from the committed selection. Call when opening the modal. */
10
+ seedDraft: (committed: TMultiSelectTransferOption[]) => void;
11
+ }
12
+ /**
13
+ * The transfer-list modal's draft, as a **projection** of the loaded option pool rather than a second
14
+ * array kept in sync with it. A paged-in option appears in Available automatically; an option the
15
+ * user moved right is never re-offered; and an `optionsKey` change re-seeds by construction. An
16
+ * option that left Selected but is not in the pool is covered by the opening snapshot, since the
17
+ * only way into the draft is the pool or the committed value.
18
+ *
19
+ * `searchQuery` is the panel's active server query (empty when the search is client-side, where
20
+ * TransferList filters for us); it keeps the snapshot from surfacing an option the server's answer
21
+ * for that query would not have returned.
22
+ */
23
+ export declare function useMultiSelectTransferDraft(pool: readonly TMultiSelectTransferOption[], isOpen: boolean, searchQuery?: string): IMultiSelectTransferDraft;
24
+ export {};
@@ -0,0 +1,56 @@
1
+ import { type ReactNode } from "react";
2
+ import { type TPrefetch } from "@hooks";
3
+ import type { TMultiSelectTransferLoadOptions, TMultiSelectTransferOption } from "./types";
4
+ interface IUseMultiSelectTransferOptionSourceArgs {
5
+ options?: TMultiSelectTransferOption[];
6
+ loadOptions?: TMultiSelectTransferLoadOptions;
7
+ initialOptions?: readonly TMultiSelectTransferOption[];
8
+ prefetch?: TPrefetch;
9
+ refetchOnClear?: boolean;
10
+ optionsKey?: string | number;
11
+ loadErrorMessage?: ReactNode;
12
+ loadMoreErrorMessage?: ReactNode;
13
+ showReloadButton?: boolean;
14
+ onLoadError?: (error: unknown) => void;
15
+ /** Legacy (consumer-driven) paging and loading. Ignored in async mode. */
16
+ hasMore?: boolean;
17
+ onLoadMore?: () => void;
18
+ isLoading?: boolean;
19
+ onReload?: () => void;
20
+ isReloading?: boolean;
21
+ onFilterChange?: (query: string) => void;
22
+ }
23
+ interface IMultiSelectTransferOptionSource {
24
+ options: readonly TMultiSelectTransferOption[];
25
+ /** The mode decision, made once here — the component must never re-test `loadOptions` itself. */
26
+ isAsync: boolean;
27
+ isServerFiltered: boolean;
28
+ /** Any load in flight — feeds aria-busy on the option list. */
29
+ isLoading: boolean;
30
+ /** Loader INSTEAD of rows: a search/reload fetch, not a page append. */
31
+ isSearchFetch: boolean;
32
+ /** Loader BELOW the rows, and the infinite-scroll observer's in-flight gate. */
33
+ isLoadingMore: boolean;
34
+ hasMore: boolean;
35
+ total: number | undefined;
36
+ onLoadMore?: () => void;
37
+ onRetryLoadMore?: () => void;
38
+ isReloading?: boolean;
39
+ onReload?: () => void;
40
+ onFilterQueryChange: (query: string) => void;
41
+ ensureDefaults: () => void;
42
+ /** Set when the whole list failed. Mutually exclusive with `loadMoreError`. */
43
+ loadError?: ReactNode;
44
+ /** Set when a page append failed. The rows the user was reading stay on screen. */
45
+ loadMoreError?: ReactNode;
46
+ /** Ends legacy load-more mode: typing or clearing means the next fetch replaces rows, not appends. */
47
+ clearLoadMoreMode: () => void;
48
+ }
49
+ /**
50
+ * MultiSelectTransfer's option-source policy: async vs legacy `options` / `isLoading` / `hasMore` /
51
+ * `onLoadMore`, the replace-vs-append loader question, and the paging trio. In async mode the hook
52
+ * knows the request *kind* directly; the legacy path still needs a ref latch, since `isLoading` is a
53
+ * bare boolean there and the kind has to be inferred from its edges.
54
+ */
55
+ export declare function useMultiSelectTransferOptionSource({ options, loadOptions, initialOptions, prefetch, refetchOnClear, optionsKey, loadErrorMessage, loadMoreErrorMessage, showReloadButton, onLoadError, hasMore, onLoadMore, isLoading, onReload, isReloading, onFilterChange }: IUseMultiSelectTransferOptionSourceArgs): IMultiSelectTransferOptionSource;
56
+ export {};
@@ -1,3 +1,3 @@
1
1
  export { Select } from "./select";
2
2
  export { selectVariants } from "./selectVariants";
3
- export type { IOption, ISelectProps } from "./types";
3
+ export type { IOption, ISelectProps, TSelectLoadOptions } from "./types";
@@ -1,10 +1,9 @@
1
- import { type ReactElement } from "react";
1
+ import { type ReactElement, type RefAttributes } from "react";
2
2
  import { type GroupBase } from "react-select";
3
3
  import { type IOption, type ISelectProps } from "./types";
4
4
  /**
5
- * Select component for single or multi selection
5
+ * Select component for single or multi selection. The forwarded ref lands on the wrapper `<div>`; the
6
+ * cast is what stops `forwardRef` — whose own signature is not generic — from collapsing `IsMulti` /
7
+ * `Group` to their defaults.
6
8
  */
7
- export declare function Select<IsMulti extends boolean = false, Group extends GroupBase<IOption> = GroupBase<IOption>>(selectProps: ISelectProps<IsMulti, Group>): ReactElement;
8
- export declare namespace Select {
9
- var displayName: string;
10
- }
9
+ export declare const Select: <IsMulti extends boolean = false, Group extends GroupBase<IOption> = GroupBase<IOption>>(props: ISelectProps<IsMulti, Group> & RefAttributes<HTMLDivElement>) => ReactElement;