@cloudwick/astral-ui 7.0.1 → 8.1.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 +3 -1
- package/dist/components/accordion/accordion.d.ts +5 -1
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +5 -6
- package/dist/components/button/reloadButton.d.ts +20 -0
- package/dist/components/card/card.d.ts +7 -8
- package/dist/components/card/cardVariants.d.ts +3 -3
- package/dist/components/dropdown/dropdown.d.ts +17 -0
- package/dist/components/emptyState/emptyState.d.ts +1 -4
- package/dist/components/emptyState/emptyStateVariants.d.ts +3 -3
- package/dist/components/modal/modal.d.ts +6 -7
- package/dist/components/multiSelectTransfer/index.d.ts +3 -0
- package/dist/components/multiSelectTransfer/multiSelectTransfer.d.ts +7 -0
- package/dist/components/multiSelectTransfer/multiSelectTransferDropdown.d.ts +50 -0
- package/dist/components/multiSelectTransfer/multiSelectTransferModal.d.ts +46 -0
- package/dist/components/multiSelectTransfer/multiSelectTransferPill.d.ts +28 -0
- package/dist/components/multiSelectTransfer/multiSelectTransferTrigger.d.ts +26 -0
- package/dist/components/multiSelectTransfer/multiSelectTransferVariants.d.ts +202 -0
- package/dist/components/multiSelectTransfer/types.d.ts +138 -0
- package/dist/components/multiSelectTransfer/useMultiSelectTransferDraft.d.ts +24 -0
- package/dist/components/multiSelectTransfer/useMultiSelectTransferOptionSource.d.ts +56 -0
- package/dist/components/panel/panel.d.ts +1 -2
- package/dist/components/radioGroup/index.d.ts +1 -1
- package/dist/components/radioGroup/radioGroup.d.ts +76 -12
- package/dist/components/radioGroup/radioGroupVariants.d.ts +30 -9
- package/dist/components/scrollbar/scrollbar.d.ts +7 -0
- package/dist/components/select/index.d.ts +2 -2
- package/dist/components/select/select.d.ts +7 -46
- package/dist/components/select/selectComponents.d.ts +29 -0
- package/dist/components/select/selectMenu.d.ts +12 -0
- package/dist/components/select/selectVariants.d.ts +21 -0
- package/dist/components/select/types.d.ts +252 -1
- package/dist/components/select/useSelectOptionSource.d.ts +39 -0
- package/dist/components/select/useSelectOutsideClose.d.ts +16 -0
- package/dist/components/select/utils.d.ts +3 -0
- package/dist/components/tabs/tabs.d.ts +4 -5
- package/dist/components/tabs/tabsVariants.d.ts +12 -0
- package/dist/components/tooltip/tooltip.d.ts +17 -6
- package/dist/components/tooltip/tooltipVariants.d.ts +6 -6
- package/dist/components/transferList/index.d.ts +3 -0
- package/dist/components/transferList/transferList.d.ts +9 -0
- package/dist/components/transferList/transferListItem.d.ts +35 -0
- package/dist/components/transferList/transferListPanel.d.ts +64 -0
- package/dist/components/transferList/transferListPanelHeader.d.ts +29 -0
- package/dist/components/transferList/transferListVariants.d.ts +211 -0
- package/dist/components/transferList/types.d.ts +152 -0
- package/dist/components/transferList/useDragAutoScroll.d.ts +13 -0
- package/dist/components/transferList/useTransferList.d.ts +28 -0
- package/dist/components/transferList/useTransferListPanelKeys.d.ts +28 -0
- package/dist/components/transferList/useTransferListSource.d.ts +49 -0
- package/dist/css/fonts.min.css +1 -1
- package/dist/css/index.min.css +1 -1
- package/dist/fonts/NotoSans-Bold.woff2 +0 -0
- package/dist/fonts/NotoSans-BoldItalic.woff2 +0 -0
- package/dist/fonts/NotoSans-Italic.woff2 +0 -0
- package/dist/fonts/NotoSans-Medium.woff2 +0 -0
- package/dist/fonts/NotoSans-MediumItalic.woff2 +0 -0
- package/dist/fonts/NotoSans-Regular.woff2 +0 -0
- package/dist/fonts/NotoSans-SemiBold.woff2 +0 -0
- package/dist/fonts/NotoSans-SemiBoldItalic.woff2 +0 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/useAsyncOptions.d.ts +85 -0
- package/dist/hooks/useAsyncOptionsReducer.d.ts +75 -0
- package/dist/hooks/useAvailableProjection.d.ts +20 -0
- package/dist/hooks/useDebouncedCallback.d.ts +10 -0
- package/dist/hooks/useFilterQuery.d.ts +28 -0
- package/dist/hooks/useIgnoredPropWarning.d.ts +5 -0
- package/dist/hooks/useInfiniteScroll.d.ts +33 -0
- package/dist/hooks/useIsTruncated.d.ts +25 -0
- package/dist/hooks/useListboxKeyboardNav.d.ts +47 -0
- package/dist/hooks/useOnValueChange.d.ts +6 -0
- package/dist/hooks/usePrefetchBaseline.d.ts +22 -0
- package/dist/index.cjs.js +5 -5
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.js +5 -5
- package/dist/utils/devWarn.d.ts +5 -0
- package/dist/utils/elementUtils.d.ts +18 -0
- package/dist/utils/index.d.ts +7 -1
- package/dist/utils/matchesQuery.d.ts +13 -0
- package/dist/utils/mergeUnique.d.ts +6 -0
- package/dist/utils/resolveLoadErrors.d.ts +20 -0
- package/dist/utils/resolveReloadControls.d.ts +23 -0
- package/package.json +3 -3
- package/dist/fonts/Inter_18pt-Bold.ttf +0 -0
- package/dist/fonts/Inter_18pt-BoldItalic.ttf +0 -0
- package/dist/fonts/Inter_18pt-Italic.ttf +0 -0
- package/dist/fonts/Inter_18pt-Medium.ttf +0 -0
- package/dist/fonts/Inter_18pt-MediumItalic.ttf +0 -0
- package/dist/fonts/Inter_18pt-Regular.ttf +0 -0
- package/dist/fonts/Inter_18pt-SemiBold.ttf +0 -0
- package/dist/fonts/Inter_18pt-SemiBoldItalic.ttf +0 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
export declare const transferListVariants: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
panel: {
|
|
3
|
+
available: {
|
|
4
|
+
row: string;
|
|
5
|
+
};
|
|
6
|
+
selected: {
|
|
7
|
+
listRegion: string;
|
|
8
|
+
virtualScroll: string;
|
|
9
|
+
row: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
checked: {
|
|
13
|
+
true: {
|
|
14
|
+
row: string;
|
|
15
|
+
};
|
|
16
|
+
false: {};
|
|
17
|
+
};
|
|
18
|
+
active: {
|
|
19
|
+
true: {
|
|
20
|
+
row: string;
|
|
21
|
+
};
|
|
22
|
+
false: {};
|
|
23
|
+
};
|
|
24
|
+
isDisabled: {
|
|
25
|
+
true: {
|
|
26
|
+
row: string;
|
|
27
|
+
};
|
|
28
|
+
false: {};
|
|
29
|
+
};
|
|
30
|
+
dropIndicatorPosition: {
|
|
31
|
+
before: {
|
|
32
|
+
dropIndicator: string;
|
|
33
|
+
};
|
|
34
|
+
after: {
|
|
35
|
+
dropIndicator: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
}, {
|
|
39
|
+
base: string;
|
|
40
|
+
panel: string;
|
|
41
|
+
panelHeader: string;
|
|
42
|
+
panelTitle: string;
|
|
43
|
+
panelCount: string;
|
|
44
|
+
searchArea: string;
|
|
45
|
+
searchBox: string;
|
|
46
|
+
search: string;
|
|
47
|
+
headerSlot: string;
|
|
48
|
+
selectAllRow: string;
|
|
49
|
+
listRegion: string;
|
|
50
|
+
listWrap: string;
|
|
51
|
+
list: string;
|
|
52
|
+
virtualScroll: string;
|
|
53
|
+
virtualSizer: string;
|
|
54
|
+
emptyWrap: string;
|
|
55
|
+
emptyText: string;
|
|
56
|
+
loaderRow: string;
|
|
57
|
+
replaceLoader: string;
|
|
58
|
+
panelError: string;
|
|
59
|
+
loadMoreErrorRow: string;
|
|
60
|
+
row: string;
|
|
61
|
+
dragHandle: string;
|
|
62
|
+
badge: string;
|
|
63
|
+
rowLabelWrap: string;
|
|
64
|
+
rowLabel: string;
|
|
65
|
+
rowActions: string;
|
|
66
|
+
removeButton: string;
|
|
67
|
+
reorderButton: string;
|
|
68
|
+
panelFooter: string;
|
|
69
|
+
dropIndicator: string;
|
|
70
|
+
dropOverlay: string;
|
|
71
|
+
}, undefined, {
|
|
72
|
+
panel: {
|
|
73
|
+
available: {
|
|
74
|
+
row: string;
|
|
75
|
+
};
|
|
76
|
+
selected: {
|
|
77
|
+
listRegion: string;
|
|
78
|
+
virtualScroll: string;
|
|
79
|
+
row: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
checked: {
|
|
83
|
+
true: {
|
|
84
|
+
row: string;
|
|
85
|
+
};
|
|
86
|
+
false: {};
|
|
87
|
+
};
|
|
88
|
+
active: {
|
|
89
|
+
true: {
|
|
90
|
+
row: string;
|
|
91
|
+
};
|
|
92
|
+
false: {};
|
|
93
|
+
};
|
|
94
|
+
isDisabled: {
|
|
95
|
+
true: {
|
|
96
|
+
row: string;
|
|
97
|
+
};
|
|
98
|
+
false: {};
|
|
99
|
+
};
|
|
100
|
+
dropIndicatorPosition: {
|
|
101
|
+
before: {
|
|
102
|
+
dropIndicator: string;
|
|
103
|
+
};
|
|
104
|
+
after: {
|
|
105
|
+
dropIndicator: string;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
}, {
|
|
109
|
+
base: string;
|
|
110
|
+
panel: string;
|
|
111
|
+
panelHeader: string;
|
|
112
|
+
panelTitle: string;
|
|
113
|
+
panelCount: string;
|
|
114
|
+
searchArea: string;
|
|
115
|
+
searchBox: string;
|
|
116
|
+
search: string;
|
|
117
|
+
headerSlot: string;
|
|
118
|
+
selectAllRow: string;
|
|
119
|
+
listRegion: string;
|
|
120
|
+
listWrap: string;
|
|
121
|
+
list: string;
|
|
122
|
+
virtualScroll: string;
|
|
123
|
+
virtualSizer: string;
|
|
124
|
+
emptyWrap: string;
|
|
125
|
+
emptyText: string;
|
|
126
|
+
loaderRow: string;
|
|
127
|
+
replaceLoader: string;
|
|
128
|
+
panelError: string;
|
|
129
|
+
loadMoreErrorRow: string;
|
|
130
|
+
row: string;
|
|
131
|
+
dragHandle: string;
|
|
132
|
+
badge: string;
|
|
133
|
+
rowLabelWrap: string;
|
|
134
|
+
rowLabel: string;
|
|
135
|
+
rowActions: string;
|
|
136
|
+
removeButton: string;
|
|
137
|
+
reorderButton: string;
|
|
138
|
+
panelFooter: string;
|
|
139
|
+
dropIndicator: string;
|
|
140
|
+
dropOverlay: string;
|
|
141
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
142
|
+
panel: {
|
|
143
|
+
available: {
|
|
144
|
+
row: string;
|
|
145
|
+
};
|
|
146
|
+
selected: {
|
|
147
|
+
listRegion: string;
|
|
148
|
+
virtualScroll: string;
|
|
149
|
+
row: string;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
checked: {
|
|
153
|
+
true: {
|
|
154
|
+
row: string;
|
|
155
|
+
};
|
|
156
|
+
false: {};
|
|
157
|
+
};
|
|
158
|
+
active: {
|
|
159
|
+
true: {
|
|
160
|
+
row: string;
|
|
161
|
+
};
|
|
162
|
+
false: {};
|
|
163
|
+
};
|
|
164
|
+
isDisabled: {
|
|
165
|
+
true: {
|
|
166
|
+
row: string;
|
|
167
|
+
};
|
|
168
|
+
false: {};
|
|
169
|
+
};
|
|
170
|
+
dropIndicatorPosition: {
|
|
171
|
+
before: {
|
|
172
|
+
dropIndicator: string;
|
|
173
|
+
};
|
|
174
|
+
after: {
|
|
175
|
+
dropIndicator: string;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
}, {
|
|
179
|
+
base: string;
|
|
180
|
+
panel: string;
|
|
181
|
+
panelHeader: string;
|
|
182
|
+
panelTitle: string;
|
|
183
|
+
panelCount: string;
|
|
184
|
+
searchArea: string;
|
|
185
|
+
searchBox: string;
|
|
186
|
+
search: string;
|
|
187
|
+
headerSlot: string;
|
|
188
|
+
selectAllRow: string;
|
|
189
|
+
listRegion: string;
|
|
190
|
+
listWrap: string;
|
|
191
|
+
list: string;
|
|
192
|
+
virtualScroll: string;
|
|
193
|
+
virtualSizer: string;
|
|
194
|
+
emptyWrap: string;
|
|
195
|
+
emptyText: string;
|
|
196
|
+
loaderRow: string;
|
|
197
|
+
replaceLoader: string;
|
|
198
|
+
panelError: string;
|
|
199
|
+
loadMoreErrorRow: string;
|
|
200
|
+
row: string;
|
|
201
|
+
dragHandle: string;
|
|
202
|
+
badge: string;
|
|
203
|
+
rowLabelWrap: string;
|
|
204
|
+
rowLabel: string;
|
|
205
|
+
rowActions: string;
|
|
206
|
+
removeButton: string;
|
|
207
|
+
reorderButton: string;
|
|
208
|
+
panelFooter: string;
|
|
209
|
+
dropIndicator: string;
|
|
210
|
+
dropOverlay: string;
|
|
211
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { TLoadOptions, TPrefetch } from "@hooks";
|
|
3
|
+
/**
|
|
4
|
+
* `TPrefetch` minus `"open"`: the panel's list is always visible, so it has no open event to hang a
|
|
5
|
+
* fetch on. Narrowed rather than redefined, so the family shares one vocabulary.
|
|
6
|
+
*/
|
|
7
|
+
export type TTransferListPrefetch = Exclude<TPrefetch, "open">;
|
|
8
|
+
/**
|
|
9
|
+
* Which of the two panels an item or action belongs to.
|
|
10
|
+
*/
|
|
11
|
+
export type TTransferPanel = "available" | "selected";
|
|
12
|
+
/**
|
|
13
|
+
* Unique identifier for a transferable item. Kept intentionally permissive so
|
|
14
|
+
* consumers can key items off primitive ids (e.g. numeric database ids) without
|
|
15
|
+
* having to stringify them first. Must be unique across both panels.
|
|
16
|
+
*/
|
|
17
|
+
export type TTransferListValue = string | number;
|
|
18
|
+
/**
|
|
19
|
+
* A single transferable item. The shape composing components alias rather than redeclare, so an
|
|
20
|
+
* option and a transfer-list item stay structurally identical.
|
|
21
|
+
*/
|
|
22
|
+
export interface ITransferListItem {
|
|
23
|
+
value: TTransferListValue;
|
|
24
|
+
label: ReactNode;
|
|
25
|
+
/** Plain-text used for searching when `label` is a ReactNode. Takes precedence over label/value. */
|
|
26
|
+
searchValue?: string;
|
|
27
|
+
isDisabled?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/** Async source for the available panel. Paged: `cursor`, `hasMore` and `total` are all honoured. */
|
|
30
|
+
export type TTransferListLoadOptions = TLoadOptions<ITransferListItem>;
|
|
31
|
+
export interface ITransferListProps {
|
|
32
|
+
/**
|
|
33
|
+
* Items in the available (left) panel. Controlled. Optional and **ignored** (with a dev warning)
|
|
34
|
+
* when `loadAvailableOptions` is set — in that mode the component owns the available pool.
|
|
35
|
+
*/
|
|
36
|
+
availableItems?: ITransferListItem[];
|
|
37
|
+
/** Items in the selected (right) panel. Order is preserved when reorderable. Controlled. */
|
|
38
|
+
selectedItems: ITransferListItem[];
|
|
39
|
+
/** Fired on every move/reorder with the next available + selected arrays. */
|
|
40
|
+
onChange: (availableItems: ITransferListItem[], selectedItems: ITransferListItem[]) => void;
|
|
41
|
+
/** Heading for the available panel. @default "Available Items" */
|
|
42
|
+
availablePanelTitle?: ReactNode;
|
|
43
|
+
/** Heading for the selected panel. @default "Selected Items" */
|
|
44
|
+
selectedPanelTitle?: ReactNode;
|
|
45
|
+
/** Show the per-panel search inputs. @default true */
|
|
46
|
+
searchable?: boolean;
|
|
47
|
+
/** Controlled search term for the available panel. Overridden when `loadAvailableOptions` is set. */
|
|
48
|
+
availableSearchTerm?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Controlled-search change handler for the available panel. Fires on every keystroke (no built-in
|
|
51
|
+
* debounce).
|
|
52
|
+
*
|
|
53
|
+
* Without `loadAvailableOptions`: switches off the panel's local filtering — `availableItems` is
|
|
54
|
+
* treated as already filtered for the query — so the debounce, the fetch, the loading state, the
|
|
55
|
+
* response ordering, and subtracting `selectedItems` from the result are the consumer's
|
|
56
|
+
* responsibility.
|
|
57
|
+
*
|
|
58
|
+
* With `loadAvailableOptions`: notification-only, for analytics.
|
|
59
|
+
*/
|
|
60
|
+
onAvailableSearchChange?: (query: string) => void;
|
|
61
|
+
/** Controlled search term for the selected panel. */
|
|
62
|
+
selectedSearchTerm?: string;
|
|
63
|
+
/** Controlled-search change handler for the selected panel. */
|
|
64
|
+
onSelectedSearchChange?: (query: string) => void;
|
|
65
|
+
/** Placeholder for both search inputs. @default "Search here" */
|
|
66
|
+
searchPlaceholder?: string;
|
|
67
|
+
/** Custom content rendered under the available panel search input. */
|
|
68
|
+
availablePanelHeaderSlot?: ReactNode;
|
|
69
|
+
/** Custom content rendered under the selected panel search input. */
|
|
70
|
+
selectedPanelHeaderSlot?: ReactNode;
|
|
71
|
+
/** Label for the available panel's move button. A `(count)` suffix is appended when items are checked. @default "Add to select" */
|
|
72
|
+
moveToSelectedLabel?: string;
|
|
73
|
+
/** Label for the selected panel's move button. A `(count)` suffix is appended when items are checked. @default "Remove from selected" */
|
|
74
|
+
moveToAvailableLabel?: string;
|
|
75
|
+
/** Enable drag handles, position badges and up/down arrows on the selected panel. @default false */
|
|
76
|
+
reorderable?: boolean;
|
|
77
|
+
/** Tooltip for the transfer list reload button. */
|
|
78
|
+
reloadTooltip?: string;
|
|
79
|
+
/** Fired when the reload button is clicked. */
|
|
80
|
+
onReload?: () => void;
|
|
81
|
+
/** Spins the reload icon and disables the button. */
|
|
82
|
+
isReloading?: boolean;
|
|
83
|
+
/** More available items can be loaded (drives the infinite-scroll sentinel). Ignored when `loadAvailableOptions` is set. */
|
|
84
|
+
hasMoreAvailable?: boolean;
|
|
85
|
+
/** Fired when the available list sentinel scrolls into view. Ignored when `loadAvailableOptions` is set. */
|
|
86
|
+
onLoadMoreAvailable?: () => void;
|
|
87
|
+
/** Renders a loader row at the bottom of the available list. Ignored when `loadAvailableOptions` is set. */
|
|
88
|
+
isLoadingMoreAvailable?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Loader REPLACES the available rows (a search/refresh fetch, not a page append). OR-ed with the
|
|
91
|
+
* loader's own state, so it still applies in async mode. @default false
|
|
92
|
+
*/
|
|
93
|
+
isLoadingAvailable?: boolean;
|
|
94
|
+
/** Replaces the available rows when set: the available source failed to load. Ignored in async mode — use `loadErrorMessage`. */
|
|
95
|
+
availableLoadError?: ReactNode;
|
|
96
|
+
/**
|
|
97
|
+
* Shown under the loaded rows when a page append failed; renders a retry button. Ignored in async
|
|
98
|
+
* mode — use `loadMoreErrorMessage`.
|
|
99
|
+
*/
|
|
100
|
+
availableLoadMoreError?: ReactNode;
|
|
101
|
+
/** Fired by the retry button under `availableLoadMoreError`. Ignored when `loadAvailableOptions` is set. */
|
|
102
|
+
onRetryLoadMoreAvailable?: () => void;
|
|
103
|
+
/** Label for that retry button. @default "Retry" */
|
|
104
|
+
retryLabel?: string;
|
|
105
|
+
/** Server-side total for the available panel; the header count becomes "(loaded of total)". Takes precedence over the loader's own total. */
|
|
106
|
+
availableTotalCount?: number;
|
|
107
|
+
/**
|
|
108
|
+
* Async source for the available panel. When provided, the component owns that panel's pool, paging,
|
|
109
|
+
* request lifecycle and loading/error state; `availableItems` is ignored (dev warning) and the
|
|
110
|
+
* panel's search becomes server-driven. `selectedItems` stays controlled — the consumer owns the
|
|
111
|
+
* selection — and `onChange` still fires with both arrays.
|
|
112
|
+
*/
|
|
113
|
+
loadAvailableOptions?: TTransferListLoadOptions;
|
|
114
|
+
/**
|
|
115
|
+
* Seed rows for a pool you already have — an SSR payload, a route loader, a warm cache. They paint on the
|
|
116
|
+
* first frame, so the panel is never briefly empty, and they stay put while the mount fetch revalidates over
|
|
117
|
+
* them. They go through the same pool-minus-`selectedItems` projection as fetched rows. They do not suppress
|
|
118
|
+
* that fetch: pair with `prefetch="never"` if the seed is the whole pool until the user searches. Seed rows
|
|
119
|
+
* carry no cursor, so nothing pages until a real page lands. A *search* replaces them, since seed rows are
|
|
120
|
+
* not results for a query. Async mode only — ignored (dev warning) without `loadAvailableOptions`, where the
|
|
121
|
+
* rows belong in `availableItems`.
|
|
122
|
+
*/
|
|
123
|
+
initialAvailableOptions?: readonly ITransferListItem[];
|
|
124
|
+
/**
|
|
125
|
+
* When to fetch the unfiltered available list. `"mount"` fires at render — the panel has no
|
|
126
|
+
* open/close, so mount is the only trigger it has. `"never"` defers everything until the user
|
|
127
|
+
* searches, for a heavy list that should stay untouched otherwise.
|
|
128
|
+
*
|
|
129
|
+
* Async mode only — ignored (dev warning) without `loadAvailableOptions`, where `availableItems` are
|
|
130
|
+
* already on screen and there is nothing to fetch. @default "mount"
|
|
131
|
+
*/
|
|
132
|
+
prefetch?: TTransferListPrefetch;
|
|
133
|
+
/** Clearing the available search revalidates the cached baseline instead of just restoring it. @default false */
|
|
134
|
+
refetchOnClear?: boolean;
|
|
135
|
+
/** Identity of the available option set. A change drops cached pages and repopulates. Does NOT clear the selection. */
|
|
136
|
+
optionsKey?: string | number;
|
|
137
|
+
/** Debounce for the available panel's search when it is server-driven. @default 300 */
|
|
138
|
+
availableFilterDebounceMs?: number;
|
|
139
|
+
/** Shown in place of the available rows when the loader rejects. @default "Couldn't load options." */
|
|
140
|
+
loadErrorMessage?: ReactNode;
|
|
141
|
+
/** Shown under the loaded rows when a page append rejects. @default "Couldn't load more." */
|
|
142
|
+
loadMoreErrorMessage?: ReactNode;
|
|
143
|
+
/** Notified when a load rejects (the component renders the message and swallows it). */
|
|
144
|
+
onLoadError?: (error: unknown) => void;
|
|
145
|
+
/** Disable all interaction. */
|
|
146
|
+
disabled?: boolean;
|
|
147
|
+
/** Empty-state copy for the available panel. @default "No Data Found!" */
|
|
148
|
+
availableEmptyText?: ReactNode;
|
|
149
|
+
/** Empty-state copy for the selected panel. @default "No Data Found!" */
|
|
150
|
+
selectedEmptyText?: ReactNode;
|
|
151
|
+
className?: string;
|
|
152
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-scrolls a container while a native drag hovers near its top/bottom edge. This is what
|
|
3
|
+
* makes drag-to-reorder usable once the list is virtualized: only the rows near the pointer are
|
|
4
|
+
* in the DOM, so without auto-scroll a far-off insertion point can never be reached.
|
|
5
|
+
*
|
|
6
|
+
* Attach `onDragOver` to the scrollable element. The scroll speed ramps up the closer the
|
|
7
|
+
* pointer gets to an edge and is driven by a `requestAnimationFrame` loop so it keeps scrolling
|
|
8
|
+
* even while the pointer is held still (native `dragover` only fires on movement). A window-level
|
|
9
|
+
* `dragend`/`drop` listener guarantees the loop stops even when the drag ends over another panel.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useDragAutoScroll(scrollRef: React.RefObject<HTMLElement>, edgeSize?: number, maxSpeed?: number): {
|
|
12
|
+
onDragOver: (e: React.DragEvent) => void;
|
|
13
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ITransferListItem, TTransferListValue, TTransferPanel } from "./types";
|
|
2
|
+
interface IUseTransferListArgs {
|
|
3
|
+
availableItems: ITransferListItem[];
|
|
4
|
+
selectedItems: ITransferListItem[];
|
|
5
|
+
onChange: (availableItems: ITransferListItem[], selectedItems: ITransferListItem[]) => void;
|
|
6
|
+
}
|
|
7
|
+
interface IDragState {
|
|
8
|
+
value: TTransferListValue;
|
|
9
|
+
panel: TTransferPanel;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Holds the transient UI state for a TransferList: per-panel checkbox sets and
|
|
13
|
+
* the active drag descriptor. The item arrays themselves stay controlled by the
|
|
14
|
+
* parent — every mutation here is forwarded through `onChange`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useTransferList({ availableItems, selectedItems, onChange }: IUseTransferListArgs): {
|
|
17
|
+
isChecked: (panel: TTransferPanel, value: TTransferListValue) => boolean;
|
|
18
|
+
toggleCheck: (panel: TTransferPanel, value: TTransferListValue) => void;
|
|
19
|
+
setPanelChecked: (panel: TTransferPanel, values: TTransferListValue[], checked: boolean) => void;
|
|
20
|
+
moveRight: (values: TTransferListValue[]) => void;
|
|
21
|
+
moveLeft: (values: TTransferListValue[]) => void;
|
|
22
|
+
transferToSelected: (value: TTransferListValue, insertIndex?: number) => void;
|
|
23
|
+
transferToAvailable: (value: TTransferListValue) => void;
|
|
24
|
+
reorderSelected: (from: number, to: number) => void;
|
|
25
|
+
drag: IDragState | null;
|
|
26
|
+
setDrag: import("react").Dispatch<import("react").SetStateAction<IDragState | null>>;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { KeyboardEvent } from "react";
|
|
2
|
+
import type { ITransferListItem, TTransferListValue } from "./types";
|
|
3
|
+
interface IUseTransferListPanelKeysArgs {
|
|
4
|
+
items: ITransferListItem[];
|
|
5
|
+
activeIndex: number;
|
|
6
|
+
setActiveIndex: (index: number) => void;
|
|
7
|
+
moveActive: (direction: 1 | -1) => void;
|
|
8
|
+
firstEnabledIndex: (from: number, direction: 1 | -1) => number;
|
|
9
|
+
reorderable: boolean;
|
|
10
|
+
onToggle: (value: TTransferListValue) => void;
|
|
11
|
+
onRemove?: (value: TTransferListValue) => void;
|
|
12
|
+
onMoveUp?: (index: number) => void;
|
|
13
|
+
onMoveDown?: (index: number) => void;
|
|
14
|
+
setIsFocused: (focused: boolean) => void;
|
|
15
|
+
/**
|
|
16
|
+
* The rows the arrow keys are addressing are about to be replaced (a search fetch is in flight, or
|
|
17
|
+
* an error has taken the list's place), so every key is swallowed. The single place this gate is
|
|
18
|
+
* expressed.
|
|
19
|
+
*/
|
|
20
|
+
isBlocked: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The listbox key handler for one transfer-list panel: arrow/Home/End navigation over
|
|
24
|
+
* `aria-activedescendant`, Enter/Space to toggle, Delete/Backspace to remove, and Alt+Arrow to
|
|
25
|
+
* reorder.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useTransferListPanelKeys({ items, activeIndex, setActiveIndex, moveActive, firstEnabledIndex, reorderable, onToggle, onRemove, onMoveUp, onMoveDown, setIsFocused, isBlocked }: IUseTransferListPanelKeysArgs): (e: KeyboardEvent<HTMLDivElement>) => void;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { ITransferListItem, TTransferListLoadOptions, TTransferListPrefetch } from "./types";
|
|
3
|
+
interface IUseTransferListSourceArgs {
|
|
4
|
+
availableItems?: ITransferListItem[];
|
|
5
|
+
/** Controlled by the consumer in every mode — the selection is the whole point of the component. */
|
|
6
|
+
selectedItems: ITransferListItem[];
|
|
7
|
+
loadAvailableOptions?: TTransferListLoadOptions;
|
|
8
|
+
initialAvailableOptions?: readonly ITransferListItem[];
|
|
9
|
+
prefetch?: TTransferListPrefetch;
|
|
10
|
+
refetchOnClear?: boolean;
|
|
11
|
+
optionsKey?: string | number;
|
|
12
|
+
availableFilterDebounceMs?: number;
|
|
13
|
+
loadErrorMessage?: ReactNode;
|
|
14
|
+
loadMoreErrorMessage?: ReactNode;
|
|
15
|
+
onLoadError?: (error: unknown) => void;
|
|
16
|
+
hasMoreAvailable?: boolean;
|
|
17
|
+
onLoadMoreAvailable?: () => void;
|
|
18
|
+
isLoadingMoreAvailable?: boolean;
|
|
19
|
+
isLoadingAvailable?: boolean;
|
|
20
|
+
availableLoadError?: ReactNode;
|
|
21
|
+
availableLoadMoreError?: ReactNode;
|
|
22
|
+
onRetryLoadMoreAvailable?: () => void;
|
|
23
|
+
availableTotalCount?: number;
|
|
24
|
+
availableSearchTerm?: string;
|
|
25
|
+
onAvailableSearchChange?: (query: string) => void;
|
|
26
|
+
}
|
|
27
|
+
interface ITransferListSource {
|
|
28
|
+
/** The available pool: derived from the loaded pages in async mode, the prop otherwise. */
|
|
29
|
+
availableItems: ITransferListItem[];
|
|
30
|
+
hasMoreAvailable: boolean;
|
|
31
|
+
onLoadMoreAvailable?: () => void;
|
|
32
|
+
isLoadingMoreAvailable: boolean;
|
|
33
|
+
isLoadingAvailable: boolean;
|
|
34
|
+
availableLoadError?: ReactNode;
|
|
35
|
+
availableLoadMoreError?: ReactNode;
|
|
36
|
+
onRetryLoadMoreAvailable?: () => void;
|
|
37
|
+
availableTotalCount?: number;
|
|
38
|
+
/** In async mode these make the panel's search controlled and server-driven. */
|
|
39
|
+
availableSearchTerm?: string;
|
|
40
|
+
onAvailableSearchChange?: (query: string) => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* `TransferList`'s available-panel source. In async mode it owns a `useAsyncOptions` instance, a
|
|
44
|
+
* debounced `useFilterQuery` for the panel's search (which is a raw `onChange` otherwise), the
|
|
45
|
+
* mount/`optionsKey` prefetch, and the pool → available projection. Without a loader every value is
|
|
46
|
+
* the corresponding prop, unchanged.
|
|
47
|
+
*/
|
|
48
|
+
export declare function useTransferListSource({ availableItems, selectedItems, loadAvailableOptions, initialAvailableOptions, prefetch, refetchOnClear, optionsKey, availableFilterDebounceMs, loadErrorMessage, loadMoreErrorMessage, onLoadError, hasMoreAvailable, onLoadMoreAvailable, isLoadingMoreAvailable, isLoadingAvailable, availableLoadError, availableLoadMoreError, onRetryLoadMoreAvailable, availableTotalCount, availableSearchTerm, onAvailableSearchChange }: IUseTransferListSourceArgs): ITransferListSource;
|
|
49
|
+
export {};
|
package/dist/css/fonts.min.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@font-face{font-family:
|
|
1
|
+
@font-face{font-family:noto-sans-regular;src:url(../fonts/NotoSans-Regular.woff2) format("woff2");font-display:swap}@font-face{font-family:noto-sans-italic;src:url(../fonts/NotoSans-Italic.woff2) format("woff2");font-display:swap}@font-face{font-family:noto-sans-medium;src:url(../fonts/NotoSans-Medium.woff2) format("woff2");font-display:swap}@font-face{font-family:noto-sans-medium-italic;src:url(../fonts/NotoSans-MediumItalic.woff2) format("woff2");font-display:swap}@font-face{font-family:noto-sans-semibold;src:url(../fonts/NotoSans-SemiBold.woff2) format("woff2");font-display:swap}@font-face{font-family:noto-sans-semibold-italic;src:url(../fonts/NotoSans-SemiBoldItalic.woff2) format("woff2");font-display:swap}@font-face{font-family:noto-sans-bold;src:url(../fonts/NotoSans-Bold.woff2) format("woff2");font-display:swap}@font-face{font-family:noto-sans-bold-italic;src:url(../fonts/NotoSans-BoldItalic.woff2) format("woff2");font-display:swap}
|