@cloudwick/astral-ui 8.1.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.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  UI Library for Cloudwick
4
4
 
5
- Version - 8.1.0
5
+ Version - 8.2.0
6
6
 
7
7
  ## Installation
8
8
 
@@ -6,10 +6,12 @@ interface IMultiSelectTransferDropdownProps {
6
6
  error?: boolean;
7
7
  size: TMultiSelectTransferSize;
8
8
  disabled?: boolean;
9
+ /** Renders the in-dropdown search input. With `false` the option list itself owns focus. */
10
+ searchable: boolean;
9
11
  filterQuery: string;
10
12
  onFilterInput: (e: React.ChangeEvent<HTMLInputElement>) => void;
11
- onFilterKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
12
- onFilterKeyUp: (e: React.KeyboardEvent<HTMLInputElement>) => void;
13
+ onFilterKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;
14
+ onFilterKeyUp: (e: React.KeyboardEvent<HTMLElement>) => void;
13
15
  onFilterBlur: (e: React.FocusEvent<HTMLInputElement>) => void;
14
16
  searchPlaceholder: string;
15
17
  /** Readonly so the option source's pool can be passed through without a defensive copy. */
@@ -40,10 +42,10 @@ interface IMultiSelectTransferDropdownProps {
40
42
  isReloading?: boolean;
41
43
  }
42
44
  /**
43
- * 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"
44
46
  * row, the (draft-checked) option list, and the infinite-scroll sentinel.
45
47
  */
46
- export declare function MultiSelectTransferDropdown({ error, size, disabled, 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;
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;
47
49
  export declare namespace MultiSelectTransferDropdown {
48
50
  var displayName: string;
49
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,6 +14,8 @@ 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;
@@ -39,7 +41,7 @@ interface IMultiSelectTransferModalProps {
39
41
  * The transfer-list modal surface for MultiSelectTransfer: full-screen on mobile, a widened
40
42
  * centered dialog from sm up. Hosts the two-panel TransferList plus a pinned footer bar.
41
43
  */
42
- export declare function MultiSelectTransferModal({ showModal, availableItems, selectedItems, onChange, onCancel, onDone, header, title, subtitle, reorderable, reloadTooltip, onReload, isReloading, searchPlaceholder, availablePanelHeaderSlot, selectedPanelHeaderSlot, hasMoreAvailable, onLoadMoreAvailable, isLoadingAvailable, isLoadingMoreAvailable, availableLoadError, availableLoadMoreError, onRetryLoadMoreAvailable, retryLabel, availableTotalCount, availableSearchTerm, onAvailableSearchChange, 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;
43
45
  export declare namespace MultiSelectTransferModal {
44
46
  var displayName: string;
45
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 {};
@@ -41,6 +41,11 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
41
41
  };
42
42
  false: {};
43
43
  };
44
+ searchable: {
45
+ false: {
46
+ dropdownHeader: string;
47
+ };
48
+ };
44
49
  }, {
45
50
  base: string;
46
51
  label: string;
@@ -50,6 +55,7 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
50
55
  dropdownHeader: string;
51
56
  filterInput: string;
52
57
  optionsList: string;
58
+ optionsListbox: string;
53
59
  noOptionsMessage: string;
54
60
  loaderRow: string;
55
61
  errorMessage: string;
@@ -108,6 +114,11 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
108
114
  };
109
115
  false: {};
110
116
  };
117
+ searchable: {
118
+ false: {
119
+ dropdownHeader: string;
120
+ };
121
+ };
111
122
  }, {
112
123
  base: string;
113
124
  label: string;
@@ -117,6 +128,7 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
117
128
  dropdownHeader: string;
118
129
  filterInput: string;
119
130
  optionsList: string;
131
+ optionsListbox: string;
120
132
  noOptionsMessage: string;
121
133
  loaderRow: string;
122
134
  errorMessage: string;
@@ -175,6 +187,11 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
175
187
  };
176
188
  false: {};
177
189
  };
190
+ searchable: {
191
+ false: {
192
+ dropdownHeader: string;
193
+ };
194
+ };
178
195
  }, {
179
196
  base: string;
180
197
  label: string;
@@ -184,6 +201,7 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
184
201
  dropdownHeader: string;
185
202
  filterInput: string;
186
203
  optionsList: string;
204
+ optionsListbox: string;
187
205
  noOptionsMessage: string;
188
206
  loaderRow: string;
189
207
  errorMessage: string;
@@ -50,6 +50,15 @@ export interface IMultiSelectTransferProps {
50
50
  * With `loadOptions`: notification-only, for analytics or `filterValue` syncing.
51
51
  */
52
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;
53
62
  /** Placeholder for the dropdown filter input and the transfer list modal's panel search inputs. @default "Search..." */
54
63
  searchPlaceholder?: string;
55
64
  /** Debounce for the search query, in both sync and `loadOptions` mode. Set to 0 to disable. @default 300 */
@@ -25,5 +25,18 @@ export declare function createSelectComponents<IsMulti extends boolean = false,
25
25
  ValueContainer: ({ children, ...props }: ValueContainerProps<IOption, IsMulti, Group>) => import("react/jsx-runtime").JSX.Element;
26
26
  MultiValue: (props: MultiValueProps<IOption>) => import("react/jsx-runtime").JSX.Element | null;
27
27
  MultiValueRemove: (props: MultiValueRemoveProps<IOption, IsMulti, Group>) => import("react/jsx-runtime").JSX.Element;
28
- Input: (props: InputProps<IOption, IsMulti, Group>) => import("react/jsx-runtime").JSX.Element;
29
28
  };
29
+ /**
30
+ * The control input, which must remain present and focusable so react-select's click-to-open flow
31
+ * works (onControlMouseDown → focusInput → onInputFocus → openMenu). It is read-only and visually
32
+ * hidden, so all actual typing happens in the dropdown search input — and with no search input on
33
+ * screen it is where focus lives for as long as the menu is open.
34
+ *
35
+ * Built apart from the components above, on `maxVisibleValues` alone: react-select unmounts and
36
+ * remounts a custom component whose identity changed, and remounting this one destroys that focus.
37
+ * Sharing the icon props' identity would put the focus at the mercy of a consumer passing a fresh
38
+ * `prefixIcon` element on every render.
39
+ */
40
+ export declare function createSelectInput<IsMulti extends boolean = false, Group extends GroupBase<IOption> = GroupBase<IOption>>(maxVisibleValues: number): (props: InputProps<IOption, IsMulti, Group>) => ReactElement;
41
+ /** react-select renders a separator between the indicators; this component has none. */
42
+ export declare const NoIndicatorSeparator: () => null;
@@ -0,0 +1,22 @@
1
+ import { type KeyboardEvent, type RefObject } from "react";
2
+ import { type ISelectMenuContext } from "./types";
3
+ /** What the shared handler leaves for its caller to do. */
4
+ export type TSelectKeyOutcome = "handled" | "navigate" | "ignored";
5
+ /** The slice of the menu context the shared handler reads, so callers can pass the context whole. */
6
+ export type TSelectKeyContext = Pick<ISelectMenuContext, "closeMenu" | "commitAndClose" | "containerRef" | "searchable" | "searchInputRef" | "isLoading" | "loadError" | "onInteractionMode">;
7
+ /** The refs that locate the two inputs focus can live in. */
8
+ export type TSelectFocusRefs = Pick<ISelectMenuContext, "searchInputRef" | "containerRef">;
9
+ /**
10
+ * react-select's hidden control input — the focus holder whenever the search box is absent. Queried
11
+ * fresh every time: react-select rebuilds this node whenever the custom Input's identity changes.
12
+ */
13
+ export declare function getControlInput(containerRef: RefObject<HTMLDivElement>): HTMLInputElement | null;
14
+ /** Focus follows the search box while it exists, and the control input otherwise. */
15
+ export declare function focusMenuInput({ searchInputRef, containerRef }: TSelectFocusRefs): void;
16
+ /**
17
+ * The open menu's keyboard model, shared by the search box and by the control. Escape discards the
18
+ * draft and closes, Tab commits it and closes, and navigation keys are refused while the loader or
19
+ * the error notice stands in for the list. "navigate" means react-select's own option navigation
20
+ * still has to see the key.
21
+ */
22
+ export declare function handleMenuKey(e: KeyboardEvent<Element>, ctx: TSelectKeyContext): TSelectKeyOutcome;
@@ -7,6 +7,11 @@ export declare const selectVariants: import("tailwind-variants").TVReturnType<{
7
7
  helperText: string;
8
8
  };
9
9
  };
10
+ searchable: {
11
+ false: {
12
+ menuSearchContainer: string;
13
+ };
14
+ };
10
15
  }, {
11
16
  base: string;
12
17
  label: string;
@@ -27,6 +32,11 @@ export declare const selectVariants: import("tailwind-variants").TVReturnType<{
27
32
  helperText: string;
28
33
  };
29
34
  };
35
+ searchable: {
36
+ false: {
37
+ menuSearchContainer: string;
38
+ };
39
+ };
30
40
  }, {
31
41
  base: string;
32
42
  label: string;
@@ -47,6 +57,11 @@ export declare const selectVariants: import("tailwind-variants").TVReturnType<{
47
57
  helperText: string;
48
58
  };
49
59
  };
60
+ searchable: {
61
+ false: {
62
+ menuSearchContainer: string;
63
+ };
64
+ };
50
65
  }, {
51
66
  base: string;
52
67
  label: string;
@@ -36,7 +36,7 @@ export type TSelectOptions<Group extends GroupBase<IOption> = GroupBase<IOption>
36
36
  /**
37
37
  * Props for the Select component
38
38
  */
39
- export interface ISelectProps<IsMulti extends boolean = false, Group extends GroupBase<IOption> = GroupBase<IOption>> extends Omit<ReactSelectProps<IOption, IsMulti, Group>, "options" | "value" | "className" | "inputValue" | "onInputChange" | "isSearchable" | "isLoading" | "filterOption"> {
39
+ export interface ISelectProps<IsMulti extends boolean = false, Group extends GroupBase<IOption> = GroupBase<IOption>> extends Omit<ReactSelectProps<IOption, IsMulti, Group>, "options" | "value" | "className" | "inputValue" | "onInputChange" | "isSearchable" | "isLoading" | "filterOption" | "tabSelectsValue"> {
40
40
  /** Unique id for the select input */
41
41
  id?: string;
42
42
  /** Custom className for wrapper */
@@ -69,7 +69,17 @@ export interface ISelectProps<IsMulti extends boolean = false, Group extends Gro
69
69
  prefixIcon?: TIconType | ReactNode;
70
70
  /** Suffix icon for the control */
71
71
  suffixIcon?: TIconType | ReactNode;
72
- /** Placeholder text for the search input inside the dropdown */
72
+ /**
73
+ * Renders the search input inside the dropdown. With `false` the menu opens straight onto the option
74
+ * list and the control keeps the whole keyboard model: arrows and PageUp/PageDown move the focused
75
+ * option, Home/End jump to its ends, Enter or Space selects, Escape closes and discards the
76
+ * multi-select draft, Tab commits it. Space and Home/End work only in this mode — with a search input
77
+ * on screen they belong to the text field. The reload button is independent of this and still renders
78
+ * when `onReload` / `showReloadButton` is set.
79
+ * @default true
80
+ */
81
+ searchable?: boolean;
82
+ /** Placeholder text for the search input inside the dropdown. Ignored when `searchable={false}`. */
73
83
  searchPlaceholder?: string;
74
84
  /** Tooltip for the select reload button. */
75
85
  reloadTooltip?: string;
@@ -216,6 +226,8 @@ export interface ISelectMenuContext {
216
226
  onFilterKeyUp: (e: KeyboardEvent<HTMLInputElement>) => void;
217
227
  /** On blur during hold, flush deferred debounce. */
218
228
  onFilterBlur: (e: FocusEvent<HTMLInputElement>) => void;
229
+ /** Renders the in-dropdown search input; the reload button is independent of it. */
230
+ searchable: boolean;
219
231
  /** Placeholder for the search input. */
220
232
  searchPlaceholder: string;
221
233
  /** Optional custom footer rendered below the option list. */
@@ -1,6 +1,9 @@
1
1
  import { type StylesConfig, type GroupBase } from "react-select";
2
2
  import { type TSelectSize, type IOption } from "./types";
3
3
  export declare const SELECT_ALL_VALUE = "select-all";
4
+ export declare const isCreateOption: (option: IOption) => boolean;
5
+ export declare const toPoolOption: (option: IOption) => IOption;
4
6
  export declare const getSelectableOptions: (options: readonly (IOption | GroupBase<IOption>)[]) => IOption[];
7
+ export declare const getPooledValues: (options: readonly (IOption | GroupBase<IOption>)[]) => Set<IOption["value"]>;
5
8
  export declare const areAllSelectableSelected: (selectable: readonly IOption[], draftValues: ReadonlySet<IOption["value"]>) => boolean;
6
9
  export declare const reactSelectCustomStyles: <IsMulti extends boolean, Group extends GroupBase<IOption>>(error: boolean, size: TSelectSize, multiSelect: boolean) => StylesConfig<IOption, IsMulti, Group>;