@cloudwick/astral-ui 8.3.0 → 8.5.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 +2 -2
- package/dist/components/adpIcon/adpIcon.d.ts +7 -2
- package/dist/components/button/button.d.ts +9 -7
- package/dist/components/card/card.d.ts +5 -0
- package/dist/components/card/cardVariants.d.ts +3 -0
- package/dist/components/dataTable/dataTable.d.ts +1 -137
- package/dist/components/dataTable/deriveConfiguredColumns.d.ts +7 -0
- package/dist/components/dataTable/index.d.ts +2 -2
- package/dist/components/dataTable/types.d.ts +135 -2
- package/dist/components/emptyState/emptyStateContent.d.ts +6 -0
- package/dist/components/modal/index.d.ts +1 -1
- package/dist/components/modal/modal.d.ts +29 -6
- package/dist/components/modal/modalContext.d.ts +22 -0
- package/dist/components/modal/modalTitle.d.ts +21 -0
- package/dist/components/modal/modalVariants.d.ts +18 -3
- package/dist/components/multiSelectTransfer/multiSelectTransferDropdown.d.ts +8 -6
- package/dist/components/multiSelectTransfer/multiSelectTransferModal.d.ts +4 -1
- package/dist/components/multiSelectTransfer/multiSelectTransferOptionRow.d.ts +5 -4
- package/dist/components/multiSelectTransfer/multiSelectTransferVariants.d.ts +18 -0
- package/dist/components/multiSelectTransfer/types.d.ts +16 -0
- package/dist/components/multiSelectTransfer/useMultiSelectTransferDropdownDraft.d.ts +34 -0
- package/dist/components/panel/panelContext.d.ts +7 -0
- package/dist/components/scrollbar/index.d.ts +2 -1
- package/dist/components/scrollbar/scrollbar.d.ts +1 -51
- package/dist/components/scrollbar/types.d.ts +52 -0
- package/dist/components/scrollbar/utils.d.ts +28 -0
- package/dist/components/select/selectComponents.d.ts +2 -3
- package/dist/components/select/selectKeyboard.d.ts +1 -1
- package/dist/components/select/types.d.ts +48 -9
- package/dist/components/select/useSelectComponents.d.ts +18 -0
- package/dist/components/select/useSelectDraft.d.ts +53 -0
- package/dist/components/select/useSelectOptionPool.d.ts +27 -0
- package/dist/components/select/utils.d.ts +9 -1
- package/dist/components/textField/textField.d.ts +5 -7
- package/dist/components/toggle/toggle.d.ts +1 -1
- package/dist/components/tooltip/tooltip.d.ts +8 -0
- package/dist/components/transferList/transferListItem.d.ts +6 -1
- package/dist/components/transferList/transferListPanel.d.ts +2 -58
- package/dist/components/transferList/types.d.ts +76 -1
- package/dist/components/transferList/useTransferList.d.ts +14 -5
- package/dist/components/transferList/useTransferListLimit.d.ts +24 -0
- package/dist/components/transferList/useTransferListPanelKeys.d.ts +7 -1
- package/dist/css/index.min.css +1 -1
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/useDeprecationWarning.d.ts +4 -0
- package/dist/hooks/useLiveAnnouncement.d.ts +13 -0
- package/dist/hooks/usePartRegistration.d.ts +10 -0
- package/dist/hooks/useSelectionLimit.d.ts +37 -0
- package/dist/index.cjs.js +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +5 -5
- package/dist/utils/devWarn.d.ts +8 -2
- package/dist/utils/elementUtils.d.ts +9 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/optionText.d.ts +10 -0
- package/dist/utils/stringUtils/index.d.ts +2 -0
- package/dist/utils/stringUtils/optionToggled.d.ts +12 -0
- package/dist/utils/stringUtils/selectionLimitReached.d.ts +8 -0
- package/package.json +4 -3
|
@@ -11,6 +11,9 @@ interface IMultiSelectTransferModalProps {
|
|
|
11
11
|
title?: React.ReactNode;
|
|
12
12
|
subtitle?: React.ReactNode;
|
|
13
13
|
reorderable?: boolean;
|
|
14
|
+
showSelectAll?: boolean;
|
|
15
|
+
maxSelected?: number;
|
|
16
|
+
maxSelectedMessage?: string;
|
|
14
17
|
reloadTooltip?: string;
|
|
15
18
|
onReload?: () => void;
|
|
16
19
|
isReloading?: boolean;
|
|
@@ -41,7 +44,7 @@ interface IMultiSelectTransferModalProps {
|
|
|
41
44
|
* The transfer-list modal surface for MultiSelectTransfer: full-screen on mobile, a widened
|
|
42
45
|
* centered dialog from sm up. Hosts the two-panel TransferList plus a pinned footer bar.
|
|
43
46
|
*/
|
|
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;
|
|
47
|
+
export declare function MultiSelectTransferModal({ showModal, availableItems, selectedItems, onChange, onCancel, onDone, header, title, subtitle, reorderable, showSelectAll, maxSelected, maxSelectedMessage, reloadTooltip, onReload, isReloading, searchable, searchPlaceholder, availablePanelHeaderSlot, selectedPanelHeaderSlot, hasMoreAvailable, onLoadMoreAvailable, isLoadingAvailable, isLoadingMoreAvailable, availableLoadError, availableLoadMoreError, onRetryLoadMoreAvailable, retryLabel, availableTotalCount, availableSearchTerm, onAvailableSearchChange, cancelLabel, doneLabel }: IMultiSelectTransferModalProps): React.ReactElement;
|
|
45
48
|
export declare namespace MultiSelectTransferModal {
|
|
46
49
|
var displayName: string;
|
|
47
50
|
}
|
|
@@ -11,7 +11,8 @@ interface IOptionRowProps {
|
|
|
11
11
|
/** Escape has hidden the label reveal (see useLabelPeekDismissal). */
|
|
12
12
|
isPeekDismissed: boolean;
|
|
13
13
|
onToggle: () => void;
|
|
14
|
-
|
|
14
|
+
/** Pointer movement over the row; it hands the keyboard highlight back to the hover tint. */
|
|
15
|
+
onPointerMove: () => void;
|
|
15
16
|
onMouseEnter: () => void;
|
|
16
17
|
optionItemClass: string | undefined;
|
|
17
18
|
optionLabelWrapClass: string;
|
|
@@ -26,8 +27,8 @@ interface IOptionRowProps {
|
|
|
26
27
|
* Rows are not individually tabbable: focus sits on the single tab stop above them — the filter input
|
|
27
28
|
* (a combobox) where the search is shown, otherwise the listbox itself — and keyboard navigation is
|
|
28
29
|
* driven from there by `aria-activedescendant` / arrow keys. `active` marks the row the arrow keys
|
|
29
|
-
* have landed on so it can be highlighted
|
|
30
|
-
* click
|
|
30
|
+
* have landed on, while the keyboard is in use, so it can be highlighted; the pointer path toggles on
|
|
31
|
+
* click and reports its movement. The keyboard-active row reveals a truncated label just as a hovered one does.
|
|
31
32
|
*/
|
|
32
|
-
export declare function OptionRow({ id, posInSet, setSize, label, checked, active, disabled, isPeekDismissed, onToggle,
|
|
33
|
+
export declare function OptionRow({ id, posInSet, setSize, label, checked, active, disabled, isPeekDismissed, onToggle, onPointerMove, onMouseEnter, optionItemClass, optionLabelWrapClass, optionLabelClass }: IOptionRowProps): React.ReactElement;
|
|
33
34
|
export {};
|
|
@@ -53,6 +53,12 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
|
|
|
53
53
|
};
|
|
54
54
|
false: {};
|
|
55
55
|
};
|
|
56
|
+
pointerNav: {
|
|
57
|
+
true: {
|
|
58
|
+
optionItem: string;
|
|
59
|
+
};
|
|
60
|
+
false: {};
|
|
61
|
+
};
|
|
56
62
|
searchable: {
|
|
57
63
|
false: {
|
|
58
64
|
dropdownHeader: string;
|
|
@@ -138,6 +144,12 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
|
|
|
138
144
|
};
|
|
139
145
|
false: {};
|
|
140
146
|
};
|
|
147
|
+
pointerNav: {
|
|
148
|
+
true: {
|
|
149
|
+
optionItem: string;
|
|
150
|
+
};
|
|
151
|
+
false: {};
|
|
152
|
+
};
|
|
141
153
|
searchable: {
|
|
142
154
|
false: {
|
|
143
155
|
dropdownHeader: string;
|
|
@@ -223,6 +235,12 @@ export declare const multiSelectTransferVariants: import("tailwind-variants").TV
|
|
|
223
235
|
};
|
|
224
236
|
false: {};
|
|
225
237
|
};
|
|
238
|
+
pointerNav: {
|
|
239
|
+
true: {
|
|
240
|
+
optionItem: string;
|
|
241
|
+
};
|
|
242
|
+
false: {};
|
|
243
|
+
};
|
|
226
244
|
searchable: {
|
|
227
245
|
false: {
|
|
228
246
|
dropdownHeader: string;
|
|
@@ -71,6 +71,22 @@ export interface IMultiSelectTransferProps {
|
|
|
71
71
|
isLoading?: boolean;
|
|
72
72
|
/** Max pills shown in the trigger before showing "+N More". @default 3 */
|
|
73
73
|
maxVisiblePills?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Renders the dropdown's "Select All" row and the transfer list modal's "Select all" checkboxes.
|
|
76
|
+
* While `maxSelected` is set the dropdown's row and the modal's Available-panel checkbox are always
|
|
77
|
+
* hidden, since selecting everything could exceed the limit.
|
|
78
|
+
* @default true
|
|
79
|
+
*/
|
|
80
|
+
showSelectAll?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* The most options the selection may hold, on both surfaces. Once the dropdown draft (or the modal's
|
|
83
|
+
* Selected panel plus its checked rows) reaches it, every unchecked option is disabled until one is
|
|
84
|
+
* removed. A `value` already over the limit is left as it is. Must be a positive integer — anything
|
|
85
|
+
* else is ignored with a dev warning.
|
|
86
|
+
*/
|
|
87
|
+
maxSelected?: number;
|
|
88
|
+
/** Screen-reader announcement when `maxSelected` is reached. @default "Selection limit of {maxSelected} reached" */
|
|
89
|
+
maxSelectedMessage?: string;
|
|
74
90
|
/** Title rendered in the transfer list modal header. */
|
|
75
91
|
transferListTitle?: ReactNode;
|
|
76
92
|
/** Subtitle rendered under the modal title. */
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { TMultiSelectTransferOption } from "./types";
|
|
2
|
+
interface IUseMultiSelectTransferDropdownDraftArgs {
|
|
3
|
+
/** The loaded option pool. */
|
|
4
|
+
options: readonly TMultiSelectTransferOption[];
|
|
5
|
+
/** The pool is already the answer to the query, so no local filtering applies. */
|
|
6
|
+
isServerFiltered: boolean;
|
|
7
|
+
filterQuery: string;
|
|
8
|
+
/** The committed selection the draft starts from. */
|
|
9
|
+
value: TMultiSelectTransferOption[];
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
maxSelected?: number;
|
|
12
|
+
maxSelectedMessage?: string;
|
|
13
|
+
showSelectAll: boolean;
|
|
14
|
+
/** Speaks a draft change through the dropdown's polite region. */
|
|
15
|
+
announce: (message: string) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The dropdown's draft selection: ticks collect here while the dropdown is open and are committed by
|
|
19
|
+
* its caller. Also owns the rows the dropdown shows, `maxSelected` counted against the draft, Select
|
|
20
|
+
* All, and the announcement of every tick.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useMultiSelectTransferDropdownDraft({ options, isServerFiltered, filterQuery, value, isOpen, maxSelected, maxSelectedMessage, showSelectAll, announce }: IUseMultiSelectTransferDropdownDraftArgs): {
|
|
23
|
+
pendingSelectedRef: import("react").MutableRefObject<import("../transferList").ITransferListItem[]>;
|
|
24
|
+
setPendingSelected: import("react").Dispatch<import("react").SetStateAction<import("../transferList").ITransferListItem[]>>;
|
|
25
|
+
displayedOptions: readonly import("../transferList").ITransferListItem[];
|
|
26
|
+
pendingValues: Set<import("../transferList").TTransferListValue>;
|
|
27
|
+
maxSelectable: number | undefined;
|
|
28
|
+
hasSelectAll: boolean;
|
|
29
|
+
areAllSelected: boolean;
|
|
30
|
+
handleOptionToggle: (option: TMultiSelectTransferOption) => void;
|
|
31
|
+
isOptionDisabled: (option: TMultiSelectTransferOption) => boolean;
|
|
32
|
+
handleSelectAll: () => void;
|
|
33
|
+
};
|
|
34
|
+
export {};
|
|
@@ -1,57 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
type
|
|
3
|
-
/**
|
|
4
|
-
* Props for the Scrollbar component
|
|
5
|
-
*/
|
|
6
|
-
export interface IScrollbarProps extends Omit<React.HTMLAttributes<HTMLElement>, "as"> {
|
|
7
|
-
/**
|
|
8
|
-
* children to render inside the scroll container
|
|
9
|
-
*/
|
|
10
|
-
children: React.ReactNode;
|
|
11
|
-
/**
|
|
12
|
-
* The type of tag to render for the scroll container, the default value is "div".
|
|
13
|
-
* @default div
|
|
14
|
-
*/
|
|
15
|
-
as?: keyof Omit<JSX.IntrinsicElements, TVoidElements>;
|
|
16
|
-
/**
|
|
17
|
-
* Overwrite the children container styles by passing space separated class names.
|
|
18
|
-
* @optional
|
|
19
|
-
*/
|
|
20
|
-
className?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Pass a boolean value to set the visibility of the scroller, by default the scrollbar will be visible on content hover.
|
|
23
|
-
* @optional
|
|
24
|
-
* @default false
|
|
25
|
-
*/
|
|
26
|
-
alwaysVisible?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Set it to true if you want to directly scroll to the click position,
|
|
29
|
-
* by default the scroller will move in the direction of the click
|
|
30
|
-
* @default false
|
|
31
|
-
*/
|
|
32
|
-
scrollToClickPosition?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Optional ID for the scrollbar container
|
|
35
|
-
*/
|
|
36
|
-
id?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Optional accessible name for the scroll area. When the content overflows the
|
|
39
|
-
* container becomes keyboard-scrollable; providing this label also promotes it
|
|
40
|
-
* to a discoverable `region` landmark. Leave it unset for incidental scroll
|
|
41
|
-
* areas so they don't clutter landmark navigation.
|
|
42
|
-
*/
|
|
43
|
-
"aria-label"?: string;
|
|
44
|
-
/**
|
|
45
|
-
* Whether overflowing content makes the scroll area a Tab stop. Set it to false when an ancestor
|
|
46
|
-
* already scrolls this content from the keyboard - a listbox moving `aria-activedescendant`, for
|
|
47
|
-
* example - so the area does not add a second, inert stop inside that widget.
|
|
48
|
-
* @default true
|
|
49
|
-
*/
|
|
50
|
-
focusable?: boolean;
|
|
51
|
-
}
|
|
2
|
+
import type { IScrollbarProps } from "./types";
|
|
52
3
|
/**
|
|
53
4
|
* Scrollbar component provides a custom scrollbar with support for both vertical and horizontal scrolling.
|
|
54
5
|
* It includes features like custom styling, touch support, RTL support, and keyboard navigation.
|
|
55
6
|
*/
|
|
56
7
|
export declare const Scrollbar: React.ForwardRefExoticComponent<IScrollbarProps & React.RefAttributes<HTMLElement>>;
|
|
57
|
-
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
type TVoidElements = "area" | "base" | "br" | "col" | "embed" | "hr" | "img" | "input" | "link" | "meta" | "param" | "source" | "track" | "wbr" | "audio" | "video" | "canvas" | "iframe" | "embed" | "object" | "param" | "picture" | "portal" | "svg" | "math" | "svg";
|
|
3
|
+
/**
|
|
4
|
+
* Props for the Scrollbar component
|
|
5
|
+
*/
|
|
6
|
+
export interface IScrollbarProps extends Omit<HTMLAttributes<HTMLElement>, "as"> {
|
|
7
|
+
/**
|
|
8
|
+
* children to render inside the scroll container
|
|
9
|
+
*/
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* The type of tag to render for the scroll container, the default value is "div".
|
|
13
|
+
* @default div
|
|
14
|
+
*/
|
|
15
|
+
as?: keyof Omit<JSX.IntrinsicElements, TVoidElements>;
|
|
16
|
+
/**
|
|
17
|
+
* Overwrite the children container styles by passing space separated class names.
|
|
18
|
+
* @optional
|
|
19
|
+
*/
|
|
20
|
+
className?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Pass a boolean value to set the visibility of the scroller, by default the scrollbar will be visible on content hover.
|
|
23
|
+
* @optional
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
alwaysVisible?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Set it to true if you want to directly scroll to the click position,
|
|
29
|
+
* by default the scroller will move in the direction of the click
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
scrollToClickPosition?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Optional ID for the scrollbar container
|
|
35
|
+
*/
|
|
36
|
+
id?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Optional accessible name for the scroll area. When the content overflows the
|
|
39
|
+
* container becomes keyboard-scrollable; providing this label also promotes it
|
|
40
|
+
* to a discoverable `region` landmark. Leave it unset for incidental scroll
|
|
41
|
+
* areas so they don't clutter landmark navigation.
|
|
42
|
+
*/
|
|
43
|
+
"aria-label"?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Whether overflowing content makes the scroll area a Tab stop. Set it to false when an ancestor
|
|
46
|
+
* already scrolls this content from the keyboard - a listbox moving `aria-activedescendant`, for
|
|
47
|
+
* example - so the area does not add a second, inert stop inside that widget.
|
|
48
|
+
* @default true
|
|
49
|
+
*/
|
|
50
|
+
focusable?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -14,3 +14,31 @@ export declare const resetCursor: () => void;
|
|
|
14
14
|
* @param scrollProp - The axis to scroll along, either "top" or "left".
|
|
15
15
|
*/
|
|
16
16
|
export declare const handleScrollToHelper: (element: HTMLDivElement, scrollToOffset: number, scrollProp: "top" | "left") => void;
|
|
17
|
+
type TScrollAxis = "X" | "Y";
|
|
18
|
+
interface IPoint {
|
|
19
|
+
clientX: number;
|
|
20
|
+
clientY: number;
|
|
21
|
+
}
|
|
22
|
+
/** Where a thumb drag started: the content's scroll offsets and the pointer position. */
|
|
23
|
+
export interface IThumbDragStart {
|
|
24
|
+
top: number;
|
|
25
|
+
left: number;
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Scrolls the content so the thumb follows a drag from `start` to `point`. The pointer distance is
|
|
31
|
+
* scaled by the content-to-viewport ratio, since the thumb moves along a track the viewport's size.
|
|
32
|
+
*/
|
|
33
|
+
export declare const scrollWithThumbDrag: (content: HTMLDivElement, start: IThumbDragStart, point: IPoint, axis: TScrollAxis) => void;
|
|
34
|
+
interface ITrackClickOptions {
|
|
35
|
+
axis: TScrollAxis;
|
|
36
|
+
isRtl: boolean;
|
|
37
|
+
/** Jump to the clicked position instead of paging half a viewport toward it. */
|
|
38
|
+
toClickPosition: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** Scrolls the content for a click on a scrollbar track: to the clicked position, or half a viewport toward it. */
|
|
41
|
+
export declare const scrollForTrackClick: (content: HTMLDivElement, track: HTMLDivElement, thumb: HTMLDivElement, point: IPoint, { axis, isRtl, toClickPosition }: ITrackClickOptions) => void;
|
|
42
|
+
/** Scrolls the content for an arrow, Page Up/Down, Home or End key. Other keys are ignored. */
|
|
43
|
+
export declare const scrollForKey: (content: HTMLDivElement, key: string) => void;
|
|
44
|
+
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type ReactElement } from "react";
|
|
3
3
|
import { type GroupBase, type OptionProps, type MultiValueProps, type MultiValueRemoveProps, type DropdownIndicatorProps, type ValueContainerProps, type InputProps } from "react-select";
|
|
4
|
-
import { type IOption, type ISelectOptionContext, type ISelectComponentsConfig } from "./types";
|
|
4
|
+
import { type IOption, type ISelectOptionContext, type ISelectComponentsConfig, type ISelectIcons } from "./types";
|
|
5
|
+
export declare const SelectIconsContext: React.Context<ISelectIcons>;
|
|
5
6
|
export declare const SelectOptionContext: React.Context<ISelectOptionContext>;
|
|
6
7
|
/**
|
|
7
8
|
* A single dropdown option (handles Select All, multi-select checkboxes, and the selected
|
|
@@ -34,8 +35,6 @@ export declare function createSelectComponents<IsMulti extends boolean = false,
|
|
|
34
35
|
*
|
|
35
36
|
* Built apart from the components above, on `maxVisibleValues` alone: react-select unmounts and
|
|
36
37
|
* 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
38
|
*/
|
|
40
39
|
export declare function createSelectInput<IsMulti extends boolean = false, Group extends GroupBase<IOption> = GroupBase<IOption>>(maxVisibleValues: number): (props: InputProps<IOption, IsMulti, Group>) => ReactElement;
|
|
41
40
|
/** react-select renders a separator between the indicators; this component has none. */
|
|
@@ -3,7 +3,7 @@ import { type ISelectMenuContext } from "./types";
|
|
|
3
3
|
/** What the shared handler leaves for its caller to do. */
|
|
4
4
|
export type TSelectKeyOutcome = "handled" | "navigate" | "ignored";
|
|
5
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" | "menuNodeRef" | "searchable" | "searchInputRef" | "isLoading" | "loadError" | "
|
|
6
|
+
export type TSelectKeyContext = Pick<ISelectMenuContext, "closeMenu" | "commitAndClose" | "containerRef" | "menuNodeRef" | "searchable" | "searchInputRef" | "isLoading" | "loadError" | "onLimitBlockedPick">;
|
|
7
7
|
/** The refs that locate the two inputs focus can live in. */
|
|
8
8
|
export type TSelectFocusRefs = Pick<ISelectMenuContext, "searchInputRef" | "containerRef">;
|
|
9
9
|
/**
|
|
@@ -65,9 +65,29 @@ export interface ISelectProps<IsMulti extends boolean = false, Group extends Gro
|
|
|
65
65
|
maxVisibleValuesMsg?: string;
|
|
66
66
|
/** Custom footer in menu */
|
|
67
67
|
menuFooter?: ReactNode;
|
|
68
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Renders the "Select All" row in a multi-select menu. Always hidden while `maxSelected` is set, since
|
|
70
|
+
* selecting everything could not be honoured. Multi-select only.
|
|
71
|
+
* @default true
|
|
72
|
+
*/
|
|
73
|
+
showSelectAll?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The most options a multi-select draft may hold. Once reached, every unchecked option is disabled
|
|
76
|
+
* (and the Create row withheld) until one is unchecked; a value already over the limit is left as it
|
|
77
|
+
* is. Must be a positive integer — anything else is ignored with a dev warning. Multi-select only.
|
|
78
|
+
*/
|
|
79
|
+
maxSelected?: number;
|
|
80
|
+
/** Screen-reader announcement when `maxSelected` is reached. @default "Selection limit of {maxSelected} reached" */
|
|
81
|
+
maxSelectedMessage?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Prefix icon for the control. Pass an icon from `@cloudwick/icons`; a string icon name (`TIconType`)
|
|
84
|
+
* is deprecated and will be removed in the next major.
|
|
85
|
+
*/
|
|
69
86
|
prefixIcon?: TIconType | ReactNode;
|
|
70
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* Suffix icon for the control. Pass an icon from `@cloudwick/icons`; a string icon name (`TIconType`)
|
|
89
|
+
* is deprecated and will be removed in the next major.
|
|
90
|
+
*/
|
|
71
91
|
suffixIcon?: TIconType | ReactNode;
|
|
72
92
|
/**
|
|
73
93
|
* Renders the search input inside the dropdown. With `false` the menu opens straight onto the option
|
|
@@ -187,6 +207,11 @@ export interface ISelectOptionContext {
|
|
|
187
207
|
* even with every visible row ticked.
|
|
188
208
|
*/
|
|
189
209
|
areAllSelected?: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Whether the option is disabled by `maxSelected` alone (the draft is at the limit and does not hold
|
|
212
|
+
* it), rather than by its own `isDisabled` or the consumer's `isOptionDisabled`.
|
|
213
|
+
*/
|
|
214
|
+
isLimitBlocked?: (option: IOption) => boolean;
|
|
190
215
|
/** Toggle a single option in the multi-select draft. */
|
|
191
216
|
onToggleDraftOption?: (option: IOption) => void;
|
|
192
217
|
/** Toggle Select All / Deselect All on the multi-select draft (shared with the keyboard path). */
|
|
@@ -198,11 +223,12 @@ export interface ISelectOptionContext {
|
|
|
198
223
|
/** tv() class for the hover/focus full-text overlay. */
|
|
199
224
|
optionOverlayClass: string;
|
|
200
225
|
/**
|
|
201
|
-
* Latest input modality, shared across every option. The
|
|
202
|
-
* (local `isHovered`) while the user is using the mouse, and
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
226
|
+
* Latest input modality, shared across every option. The highlighted row (its tint and full-text
|
|
227
|
+
* overlay) follows the pointer (local `isHovered`) while the user is using the mouse, and
|
|
228
|
+
* react-select's `isFocused` while they're using the keyboard, which alone also draws the focus
|
|
229
|
+
* glow. Without this, react-select's `isFocused` - which lingers on the last-focused option after
|
|
230
|
+
* the pointer leaves, and is also set by mouse hover - keeps a row highlighted after the mouse
|
|
231
|
+
* has moved away (and shows two at once mid-transition).
|
|
206
232
|
*
|
|
207
233
|
* State on the Select, not a shared ref: this decides what an option renders, and writing a ref
|
|
208
234
|
* schedules no re-render. Setting the mode it already holds is a no-op React bails out of, so
|
|
@@ -232,10 +258,17 @@ export interface ISelectMenuContext {
|
|
|
232
258
|
searchPlaceholder: string;
|
|
233
259
|
/** Optional custom footer rendered below the option list. */
|
|
234
260
|
menuFooter?: ReactNode;
|
|
261
|
+
/**
|
|
262
|
+
* Polite announcement of the last multi-select draft change (a tick, an untick, "Select All", or the
|
|
263
|
+
* limit refusing a tick). `undefined` for a single-select, which leaves its live region out of the menu.
|
|
264
|
+
*/
|
|
265
|
+
draftAnnouncement?: string;
|
|
235
266
|
/** Close the menu, discarding the multi-select draft. */
|
|
236
267
|
closeMenu: () => void;
|
|
237
268
|
/** Commit the multi-select draft, then close. */
|
|
238
269
|
commitAndClose: () => void;
|
|
270
|
+
/** Announces the limit; called for Enter on a row the limit alone has disabled, which react-select ignores. */
|
|
271
|
+
onLimitBlockedPick?: () => void;
|
|
239
272
|
/** tv() class for the search container. */
|
|
240
273
|
searchContainerClass: string;
|
|
241
274
|
/** tv() class for the search input. */
|
|
@@ -260,7 +293,7 @@ export interface ISelectMenuContext {
|
|
|
260
293
|
isReloading?: boolean;
|
|
261
294
|
/** Reload-button tooltip / aria-label. */
|
|
262
295
|
reloadTooltip?: string;
|
|
263
|
-
/** Records the input modality (see {@link ISelectOptionContext.interactionMode}); set to "keyboard"
|
|
296
|
+
/** Records the input modality (see {@link ISelectOptionContext.interactionMode}); set to "keyboard" by any menu key. */
|
|
264
297
|
onInteractionMode: (mode: TSelectInteractionMode) => void;
|
|
265
298
|
}
|
|
266
299
|
/** What the in-menu search box exposes about the rendered list, read from react-select's DOM. */
|
|
@@ -283,9 +316,15 @@ export interface ITruncatedMultiValueProps {
|
|
|
283
316
|
/** react-select's rendered chip (MultiValueContainer + label + remove). */
|
|
284
317
|
chip: ReactElement;
|
|
285
318
|
}
|
|
286
|
-
|
|
319
|
+
/**
|
|
320
|
+
* The control's prefix/suffix icons, read by ValueContainer through context so a fresh icon element
|
|
321
|
+
* re-renders it in place: react-select remounts a custom component whose reference changed.
|
|
322
|
+
*/
|
|
323
|
+
export interface ISelectIcons {
|
|
287
324
|
prefixIcon?: TIconType | ReactNode;
|
|
288
325
|
suffixIcon?: TIconType | ReactNode;
|
|
326
|
+
}
|
|
327
|
+
export interface ISelectComponentsConfig {
|
|
289
328
|
maxVisibleValues: number;
|
|
290
329
|
maxVisibleValuesMsg?: string;
|
|
291
330
|
disabled: boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { GroupBase } from "react-select";
|
|
2
|
+
import { SelectOption } from "./selectComponents";
|
|
3
|
+
import { SelectMenu } from "./selectMenu";
|
|
4
|
+
import type { IOption, ISelectComponentsConfig } from "./types";
|
|
5
|
+
/**
|
|
6
|
+
* The custom components handed to react-select. Each keeps a stable identity across renders, because
|
|
7
|
+
* react-select remounts a custom component whose identity changed.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useSelectComponents<IsMulti extends boolean, Group extends GroupBase<IOption>>({ maxVisibleValues, maxVisibleValuesMsg, disabled }: ISelectComponentsConfig): {
|
|
10
|
+
IndicatorSeparator: () => null;
|
|
11
|
+
Option: typeof SelectOption;
|
|
12
|
+
Input: (props: import("react-select").InputProps<IOption, IsMulti, Group>) => import("react").ReactElement;
|
|
13
|
+
Menu: typeof SelectMenu;
|
|
14
|
+
DropdownIndicator: (props: import("react-select").DropdownIndicatorProps<IOption, IsMulti, Group>) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
ValueContainer: ({ children, ...props }: import("react-select").ValueContainerProps<IOption, IsMulti, Group>) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
MultiValue: (props: import("react-select").MultiValueProps<IOption>) => import("react/jsx-runtime").JSX.Element | null;
|
|
17
|
+
MultiValueRemove: (props: import("react-select").MultiValueRemoveProps<IOption, IsMulti, Group>) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
import type { GroupBase, PropsValue } from "react-select";
|
|
3
|
+
import type { IOption, TSelectOptions } from "./types";
|
|
4
|
+
type TSelectValue = PropsValue<IOption> | undefined;
|
|
5
|
+
type TOnChange = (...args: unknown[]) => void;
|
|
6
|
+
export declare const SELECT_ALL_OPTION: IOption;
|
|
7
|
+
interface IUseSelectDraftArgs<Group extends GroupBase<IOption>> {
|
|
8
|
+
isMulti: boolean;
|
|
9
|
+
/** The consumer's `value`; the Select is controlled while it is defined. */
|
|
10
|
+
value: TSelectValue;
|
|
11
|
+
defaultValue: TSelectValue;
|
|
12
|
+
menuOpen: boolean;
|
|
13
|
+
maxSelected?: number;
|
|
14
|
+
maxSelectedMessage?: string;
|
|
15
|
+
/** The consumer's `showSelectAll`, undefined when not passed. */
|
|
16
|
+
showSelectAll?: boolean;
|
|
17
|
+
onChange?: TOnChange;
|
|
18
|
+
/** Every row the Select offers, before the Select-All row is added. */
|
|
19
|
+
pooledOptions: TSelectOptions<Group>;
|
|
20
|
+
/** The enabled rows on screen, which Select All acts on. */
|
|
21
|
+
visibleSelectable: IOption[];
|
|
22
|
+
/** The consumer's `isOptionDisabled`. */
|
|
23
|
+
isOptionDisabled?: (option: IOption, selectValue: readonly IOption[]) => boolean;
|
|
24
|
+
rememberCreatedOption: (option: IOption) => void;
|
|
25
|
+
/** Speaks a draft change through the menu's polite region. */
|
|
26
|
+
announce: (message: string) => void;
|
|
27
|
+
closeMenu: () => void;
|
|
28
|
+
resetFilter: () => void;
|
|
29
|
+
containerRef: RefObject<HTMLDivElement>;
|
|
30
|
+
/** Puts focus back on the input the menu is driven from. */
|
|
31
|
+
refocusMenuInput: () => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The multi-select draft: while the menu is open, ticks update a draft instead of calling `onChange`,
|
|
35
|
+
* and the draft is committed when the menu closes with the selection intact (an outside click or Tab).
|
|
36
|
+
* Escape discards it. Also owns `maxSelected`, the polite announcement of every tick, and the routing
|
|
37
|
+
* of react-select's `onChange` for both modes.
|
|
38
|
+
*/
|
|
39
|
+
export declare function useSelectDraft<Group extends GroupBase<IOption>>({ isMulti, value, defaultValue, menuOpen, maxSelected, maxSelectedMessage, showSelectAll, onChange: externalOnChange, pooledOptions, visibleSelectable, isOptionDisabled: externalIsOptionDisabled, rememberCreatedOption, announce, closeMenu, resetFilter, containerRef, refocusMenuInput }: IUseSelectDraftArgs<Group>): {
|
|
40
|
+
multiControlValue: PropsValue<IOption> | undefined;
|
|
41
|
+
draftValues: Set<any> | undefined;
|
|
42
|
+
areAllSelected: boolean;
|
|
43
|
+
isCapped: boolean;
|
|
44
|
+
isLimitBlocked: (option: IOption) => boolean;
|
|
45
|
+
selectOptions: TSelectOptions<Group>;
|
|
46
|
+
isOptionDisabled: (option: IOption, selectValue: readonly IOption[]) => boolean;
|
|
47
|
+
announceLimitBlocked: () => void;
|
|
48
|
+
commitDraft: () => void;
|
|
49
|
+
toggleDraftOption: (option: IOption) => void;
|
|
50
|
+
handleSelectAllDraft: () => void;
|
|
51
|
+
handleChange: (newValue: unknown, actionMeta: unknown) => void;
|
|
52
|
+
};
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { FilterOptionOption, GroupBase } from "react-select";
|
|
2
|
+
import type { IOption, ISelectProps, TSelectOptions } from "./types";
|
|
3
|
+
interface IUseSelectOptionPoolArgs<Group extends GroupBase<IOption>> {
|
|
4
|
+
/** The options the source resolved (consumer `options` or the async loader's). */
|
|
5
|
+
options: TSelectOptions<Group>;
|
|
6
|
+
isServerFiltered: boolean;
|
|
7
|
+
/** The debounced query the list is narrowed by. */
|
|
8
|
+
filterQuery: string;
|
|
9
|
+
filterOption: ISelectProps<boolean, Group>["filterOption"];
|
|
10
|
+
getOptionLabel?: (option: IOption) => string;
|
|
11
|
+
getOptionValue?: (option: IOption) => string;
|
|
12
|
+
searchable: boolean;
|
|
13
|
+
filterValue?: string;
|
|
14
|
+
onFilterChange?: (query: string) => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The rows a Select offers and which of them the query leaves visible: the consumer's options plus the
|
|
18
|
+
* ones the user created, the resolved row predicate, and the enabled rows on screen that Select All
|
|
19
|
+
* acts on.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useSelectOptionPool<Group extends GroupBase<IOption>>({ options, isServerFiltered, filterQuery, filterOption: externalFilterOption, getOptionLabel, getOptionValue, searchable, filterValue, onFilterChange }: IUseSelectOptionPoolArgs<Group>): {
|
|
22
|
+
pooledOptions: TSelectOptions<Group>;
|
|
23
|
+
rememberCreatedOption: (option: IOption) => void;
|
|
24
|
+
filterOption: (candidate: FilterOptionOption<IOption>, input: string) => boolean;
|
|
25
|
+
visibleSelectable: IOption[];
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type StylesConfig, type GroupBase } from "react-select";
|
|
1
|
+
import { type AriaOnChangeProps, 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
4
|
export declare const isCreateOption: (option: IOption) => boolean;
|
|
@@ -7,3 +7,11 @@ export declare const getSelectableOptions: (options: readonly (IOption | GroupBa
|
|
|
7
7
|
export declare const getPooledValues: (options: readonly (IOption | GroupBase<IOption>)[]) => Set<IOption["value"]>;
|
|
8
8
|
export declare const areAllSelectableSelected: (selectable: readonly IOption[], draftValues: ReadonlySet<IOption["value"]>) => boolean;
|
|
9
9
|
export declare const reactSelectCustomStyles: <IsMulti extends boolean, Group extends GroupBase<IOption>>(error: boolean, size: TSelectSize, multiSelect: boolean) => StylesConfig<IOption, IsMulti, Group>;
|
|
10
|
+
/**
|
|
11
|
+
* The multi-select's spoken message for a react-select value change. Ticking or unticking an option edits
|
|
12
|
+
* the menu's draft, not the value react-select holds, so react-select's own "selected"/"deselected" would
|
|
13
|
+
* describe the wrong list; those are left silent and Select announces the draft's outcome itself. Every
|
|
14
|
+
* other action keeps react-select's default wording, except Enter on an option disabled by the limit alone
|
|
15
|
+
* (`isLimitBlocked`): Select speaks the limit for that one, so the "disabled" wording is left silent.
|
|
16
|
+
*/
|
|
17
|
+
export declare function multiSelectChangeMessage(props: AriaOnChangeProps<IOption, boolean>, isLimitBlocked?: (option: IOption) => boolean): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
|
-
import { type TIconType } from "../adpIcon";
|
|
3
|
+
import { type TIconType } from "../adpIcon/adpIcon";
|
|
4
4
|
type TSize = "md" | "lg";
|
|
5
5
|
export interface ITextFieldProps extends Omit<React.ComponentPropsWithoutRef<"input">, "css" | "size"> {
|
|
6
6
|
/**
|
|
@@ -27,17 +27,15 @@ export interface ITextFieldProps extends Omit<React.ComponentPropsWithoutRef<"in
|
|
|
27
27
|
/**
|
|
28
28
|
* Icon to be displayed before the input.
|
|
29
29
|
* @description
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* - If a ReactNode is provided, it will be rendered as-is.
|
|
30
|
+
* Pass an icon from `@cloudwick/icons`; the node is rendered as-is. A string icon name
|
|
31
|
+
* (`TIconType`) still renders an ADPIcon but is deprecated and will be removed in the next major.
|
|
33
32
|
*/
|
|
34
33
|
prefixIcon?: TIconType | ReactNode;
|
|
35
34
|
/**
|
|
36
35
|
* Icon to be displayed after the input.
|
|
37
36
|
* @description
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* - If a ReactNode is provided, it will be rendered as-is.
|
|
37
|
+
* Pass an icon from `@cloudwick/icons`; the node is rendered as-is. A string icon name
|
|
38
|
+
* (`TIconType`) still renders an ADPIcon but is deprecated and will be removed in the next major.
|
|
41
39
|
*/
|
|
42
40
|
suffixIcon?: TIconType | ReactNode;
|
|
43
41
|
}
|
|
@@ -53,6 +53,14 @@ export interface ITooltipProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
53
53
|
* describe its trigger is also hidden from assistive technology and stays a purely visual hint.
|
|
54
54
|
*/
|
|
55
55
|
describeTrigger?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Accessible name for a non-interactive trigger such as a bare icon. When set, the synthesized
|
|
58
|
+
* wrapper becomes a native `<button>` named by this label, and activating it (keyboard, mouse or
|
|
59
|
+
* screen reader) opens the tooltip without toggling it closed. Ignored when the trigger is
|
|
60
|
+
* interactive (it names itself), when `canOpen` is `false`, and on a hover tooltip with
|
|
61
|
+
* `focusable={false}`, whose wrapper is not a tab stop.
|
|
62
|
+
*/
|
|
63
|
+
triggerLabel?: string;
|
|
56
64
|
}
|
|
57
65
|
export declare const Tooltip: React.ForwardRefExoticComponent<ITooltipProps & React.RefAttributes<HTMLDivElement>>;
|
|
58
66
|
export {};
|
|
@@ -13,6 +13,11 @@ interface ITransferListItemProps {
|
|
|
13
13
|
active: boolean;
|
|
14
14
|
reorderable: boolean;
|
|
15
15
|
disabled: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Disabled only for now, by the selection limit: the drag handle keeps its space (hidden) so the row
|
|
18
|
+
* does not shift each time the limit is reached or cleared.
|
|
19
|
+
*/
|
|
20
|
+
isLimitBlocked?: boolean;
|
|
16
21
|
isFirst: boolean;
|
|
17
22
|
isLast: boolean;
|
|
18
23
|
showTopIndicator: boolean;
|
|
@@ -33,7 +38,7 @@ interface ITransferListItemProps {
|
|
|
33
38
|
* A single transfer list row: drag handle + position badge (selected, reorderable
|
|
34
39
|
* only), checkbox, label, and remove / reorder controls.
|
|
35
40
|
*/
|
|
36
|
-
export declare function TransferListItem({ item, panel, index, setSize, id, checked, active, reorderable, disabled, isFirst, isLast, showTopIndicator, showBottomIndicator, isPeekDismissed, onToggle, onRemove, onMoveUp, onMoveDown, onDragStart, onDragEnd, onDragOver, onDrop, onMouseEnter }: ITransferListItemProps): React.ReactElement;
|
|
41
|
+
export declare function TransferListItem({ item, panel, index, setSize, id, checked, active, reorderable, disabled, isLimitBlocked, isFirst, isLast, showTopIndicator, showBottomIndicator, isPeekDismissed, onToggle, onRemove, onMoveUp, onMoveDown, onDragStart, onDragEnd, onDragOver, onDrop, onMouseEnter }: ITransferListItemProps): React.ReactElement;
|
|
37
42
|
export declare namespace TransferListItem {
|
|
38
43
|
var displayName: string;
|
|
39
44
|
}
|