@cloudwick/astral-ui 7.0.0 → 8.0.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 (69) hide show
  1. package/README.md +3 -1
  2. package/dist/components/accordion/accordion.d.ts +5 -1
  3. package/dist/components/badge/badge.d.ts +1 -1
  4. package/dist/components/breadcrumbs/breadcrumbs.d.ts +5 -6
  5. package/dist/components/card/card.d.ts +7 -8
  6. package/dist/components/card/cardVariants.d.ts +3 -3
  7. package/dist/components/dropdown/dropdown.d.ts +17 -0
  8. package/dist/components/emptyState/emptyState.d.ts +1 -4
  9. package/dist/components/modal/modal.d.ts +6 -7
  10. package/dist/components/multiSelectTransfer/index.d.ts +3 -0
  11. package/dist/components/multiSelectTransfer/multiSelectTransfer.d.ts +6 -0
  12. package/dist/components/multiSelectTransfer/multiSelectTransferDropdown.d.ts +32 -0
  13. package/dist/components/multiSelectTransfer/multiSelectTransferModal.d.ts +34 -0
  14. package/dist/components/multiSelectTransfer/multiSelectTransferPill.d.ts +28 -0
  15. package/dist/components/multiSelectTransfer/multiSelectTransferVariants.d.ts +184 -0
  16. package/dist/components/multiSelectTransfer/types.d.ts +56 -0
  17. package/dist/components/panel/panel.d.ts +1 -2
  18. package/dist/components/radioGroup/index.d.ts +1 -1
  19. package/dist/components/radioGroup/radioGroup.d.ts +76 -12
  20. package/dist/components/radioGroup/radioGroupVariants.d.ts +30 -9
  21. package/dist/components/scrollbar/scrollbar.d.ts +7 -0
  22. package/dist/components/select/index.d.ts +2 -2
  23. package/dist/components/select/select.d.ts +3 -41
  24. package/dist/components/select/selectComponents.d.ts +45 -0
  25. package/dist/components/select/selectVariants.d.ts +15 -0
  26. package/dist/components/select/types.d.ts +138 -1
  27. package/dist/components/select/utils.d.ts +2 -0
  28. package/dist/components/tabs/tabs.d.ts +4 -5
  29. package/dist/components/tabs/tabsVariants.d.ts +12 -0
  30. package/dist/components/tooltip/tooltip.d.ts +17 -6
  31. package/dist/components/tooltip/tooltipVariants.d.ts +6 -6
  32. package/dist/components/transferList/index.d.ts +3 -0
  33. package/dist/components/transferList/transferList.d.ts +12 -0
  34. package/dist/components/transferList/transferListItem.d.ts +35 -0
  35. package/dist/components/transferList/transferListPanel.d.ts +51 -0
  36. package/dist/components/transferList/transferListVariants.d.ts +202 -0
  37. package/dist/components/transferList/types.d.ts +76 -0
  38. package/dist/components/transferList/useDragAutoScroll.d.ts +13 -0
  39. package/dist/components/transferList/useTransferList.d.ts +28 -0
  40. package/dist/css/fonts.min.css +1 -1
  41. package/dist/css/index.min.css +1 -1
  42. package/dist/fonts/NotoSans-Bold.woff2 +0 -0
  43. package/dist/fonts/NotoSans-BoldItalic.woff2 +0 -0
  44. package/dist/fonts/NotoSans-Italic.woff2 +0 -0
  45. package/dist/fonts/NotoSans-Medium.woff2 +0 -0
  46. package/dist/fonts/NotoSans-MediumItalic.woff2 +0 -0
  47. package/dist/fonts/NotoSans-Regular.woff2 +0 -0
  48. package/dist/fonts/NotoSans-SemiBold.woff2 +0 -0
  49. package/dist/fonts/NotoSans-SemiBoldItalic.woff2 +0 -0
  50. package/dist/hooks/index.d.ts +4 -0
  51. package/dist/hooks/useDebouncedCallback.d.ts +10 -0
  52. package/dist/hooks/useInfiniteScroll.d.ts +24 -0
  53. package/dist/hooks/useIsTruncated.d.ts +25 -0
  54. package/dist/hooks/useListboxKeyboardNav.d.ts +47 -0
  55. package/dist/index.cjs.js +5 -5
  56. package/dist/index.d.ts +2 -0
  57. package/dist/index.esm.js +5 -5
  58. package/dist/utils/elementUtils.d.ts +18 -0
  59. package/dist/utils/index.d.ts +3 -1
  60. package/dist/utils/matchesQuery.d.ts +13 -0
  61. package/package.json +2 -2
  62. package/dist/fonts/Inter_18pt-Bold.ttf +0 -0
  63. package/dist/fonts/Inter_18pt-BoldItalic.ttf +0 -0
  64. package/dist/fonts/Inter_18pt-Italic.ttf +0 -0
  65. package/dist/fonts/Inter_18pt-Medium.ttf +0 -0
  66. package/dist/fonts/Inter_18pt-MediumItalic.ttf +0 -0
  67. package/dist/fonts/Inter_18pt-Regular.ttf +0 -0
  68. package/dist/fonts/Inter_18pt-SemiBold.ttf +0 -0
  69. package/dist/fonts/Inter_18pt-SemiBoldItalic.ttf +0 -0
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import type { ITransferListItem, TTransferPanel } from "./types";
3
+ interface ITransferListItemProps {
4
+ item: ITransferListItem;
5
+ panel: TTransferPanel;
6
+ index: number;
7
+ /** Row element id, referenced by the panel listbox's aria-activedescendant. */
8
+ id: string;
9
+ checked: boolean;
10
+ /** The row the keyboard navigation has landed on (highlighted, no DOM focus). */
11
+ active: boolean;
12
+ reorderable: boolean;
13
+ disabled: boolean;
14
+ isFirst: boolean;
15
+ isLast: boolean;
16
+ showTopIndicator: boolean;
17
+ showBottomIndicator: boolean;
18
+ onToggle: () => void;
19
+ onRemove?: () => void;
20
+ onMoveUp?: () => void;
21
+ onMoveDown?: () => void;
22
+ onDragStart: (e: React.DragEvent) => void;
23
+ onDragEnd: () => void;
24
+ onDragOver: (e: React.DragEvent) => void;
25
+ onDrop: (e: React.DragEvent) => void;
26
+ }
27
+ /**
28
+ * A single transfer list row: drag handle + position badge (selected, reorderable
29
+ * only), checkbox, label, and remove / reorder controls.
30
+ */
31
+ export declare function TransferListItem({ item, panel, index, id, checked, active, reorderable, disabled, isFirst, isLast, showTopIndicator, showBottomIndicator, onToggle, onRemove, onMoveUp, onMoveDown, onDragStart, onDragEnd, onDragOver, onDrop }: ITransferListItemProps): React.ReactElement;
32
+ export declare namespace TransferListItem {
33
+ var displayName: string;
34
+ }
35
+ export {};
@@ -0,0 +1,51 @@
1
+ import * as React from "react";
2
+ import type { ITransferListItem, TTransferListValue, TTransferPanel } from "./types";
3
+ interface ITransferListPanelProps {
4
+ panel: TTransferPanel;
5
+ title: React.ReactNode;
6
+ items: ITransferListItem[];
7
+ reorderable: boolean;
8
+ disabled: boolean;
9
+ emptyText: React.ReactNode;
10
+ searchable: boolean;
11
+ searchValue: string;
12
+ searchPlaceholder: string;
13
+ onSearchChange: (query: string) => void;
14
+ headerSlot?: React.ReactNode;
15
+ reloadTooltip?: string;
16
+ onReload?: () => void;
17
+ isReloading?: boolean;
18
+ hasMore?: boolean;
19
+ onLoadMore?: () => void;
20
+ isLoadingMore?: boolean;
21
+ selectAllChecked: boolean;
22
+ selectAllIndeterminate: boolean;
23
+ selectAllCount: number;
24
+ onToggleSelectAll: () => void;
25
+ moveLabel: string;
26
+ moveCount: number;
27
+ moveDisabled: boolean;
28
+ moveIconSide: "left" | "right";
29
+ onMove: () => void;
30
+ isChecked: (value: TTransferListValue) => boolean;
31
+ onToggle: (value: TTransferListValue) => void;
32
+ onRemove?: (value: TTransferListValue) => void;
33
+ onMoveUp?: (index: number) => void;
34
+ onMoveDown?: (index: number) => void;
35
+ dropIndex: number | null;
36
+ showDropOverlay: boolean;
37
+ onItemDragStart: (e: React.DragEvent, value: TTransferListValue) => void;
38
+ onItemDragEnd: () => void;
39
+ onItemDragOver: (e: React.DragEvent, index: number) => void;
40
+ onListDragOver: (e: React.DragEvent) => void;
41
+ onListDrop: (e: React.DragEvent) => void;
42
+ }
43
+ /**
44
+ * One panel of the transfer list: header (title, count, optional reload),
45
+ * optional search + header slot, and a scrollable list of rows or an empty state.
46
+ */
47
+ export declare function TransferListPanel({ panel, title, items, reorderable, disabled, emptyText, searchable, searchValue, searchPlaceholder, onSearchChange, headerSlot, reloadTooltip, onReload, isReloading, hasMore, onLoadMore, isLoadingMore, selectAllChecked, selectAllIndeterminate, selectAllCount, onToggleSelectAll, moveLabel, moveCount, moveDisabled, moveIconSide, onMove, isChecked, onToggle, onRemove, onMoveUp, onMoveDown, dropIndex, showDropOverlay, onItemDragStart, onItemDragEnd, onItemDragOver, onListDragOver, onListDrop }: ITransferListPanelProps): React.ReactElement;
48
+ export declare namespace TransferListPanel {
49
+ var displayName: string;
50
+ }
51
+ export {};
@@ -0,0 +1,202 @@
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
+ row: string;
58
+ dragHandle: string;
59
+ badge: string;
60
+ rowLabelWrap: string;
61
+ rowLabel: string;
62
+ rowActions: string;
63
+ removeButton: string;
64
+ reorderButton: string;
65
+ panelFooter: string;
66
+ dropIndicator: string;
67
+ dropOverlay: string;
68
+ }, undefined, {
69
+ panel: {
70
+ available: {
71
+ row: string;
72
+ };
73
+ selected: {
74
+ listRegion: string;
75
+ virtualScroll: string;
76
+ row: string;
77
+ };
78
+ };
79
+ checked: {
80
+ true: {
81
+ row: string;
82
+ };
83
+ false: {};
84
+ };
85
+ active: {
86
+ true: {
87
+ row: string;
88
+ };
89
+ false: {};
90
+ };
91
+ isDisabled: {
92
+ true: {
93
+ row: string;
94
+ };
95
+ false: {};
96
+ };
97
+ dropIndicatorPosition: {
98
+ before: {
99
+ dropIndicator: string;
100
+ };
101
+ after: {
102
+ dropIndicator: string;
103
+ };
104
+ };
105
+ }, {
106
+ base: string;
107
+ panel: string;
108
+ panelHeader: string;
109
+ panelTitle: string;
110
+ panelCount: string;
111
+ searchArea: string;
112
+ searchBox: string;
113
+ search: string;
114
+ headerSlot: string;
115
+ selectAllRow: string;
116
+ listRegion: string;
117
+ listWrap: string;
118
+ list: string;
119
+ virtualScroll: string;
120
+ virtualSizer: string;
121
+ emptyWrap: string;
122
+ emptyText: string;
123
+ loaderRow: string;
124
+ row: string;
125
+ dragHandle: string;
126
+ badge: string;
127
+ rowLabelWrap: string;
128
+ rowLabel: string;
129
+ rowActions: string;
130
+ removeButton: string;
131
+ reorderButton: string;
132
+ panelFooter: string;
133
+ dropIndicator: string;
134
+ dropOverlay: string;
135
+ }, import("tailwind-variants").TVReturnType<{
136
+ panel: {
137
+ available: {
138
+ row: string;
139
+ };
140
+ selected: {
141
+ listRegion: string;
142
+ virtualScroll: string;
143
+ row: string;
144
+ };
145
+ };
146
+ checked: {
147
+ true: {
148
+ row: string;
149
+ };
150
+ false: {};
151
+ };
152
+ active: {
153
+ true: {
154
+ row: string;
155
+ };
156
+ false: {};
157
+ };
158
+ isDisabled: {
159
+ true: {
160
+ row: string;
161
+ };
162
+ false: {};
163
+ };
164
+ dropIndicatorPosition: {
165
+ before: {
166
+ dropIndicator: string;
167
+ };
168
+ after: {
169
+ dropIndicator: string;
170
+ };
171
+ };
172
+ }, {
173
+ base: string;
174
+ panel: string;
175
+ panelHeader: string;
176
+ panelTitle: string;
177
+ panelCount: string;
178
+ searchArea: string;
179
+ searchBox: string;
180
+ search: string;
181
+ headerSlot: string;
182
+ selectAllRow: string;
183
+ listRegion: string;
184
+ listWrap: string;
185
+ list: string;
186
+ virtualScroll: string;
187
+ virtualSizer: string;
188
+ emptyWrap: string;
189
+ emptyText: string;
190
+ loaderRow: string;
191
+ row: string;
192
+ dragHandle: string;
193
+ badge: string;
194
+ rowLabelWrap: string;
195
+ rowLabel: string;
196
+ rowActions: string;
197
+ removeButton: string;
198
+ reorderButton: string;
199
+ panelFooter: string;
200
+ dropIndicator: string;
201
+ dropOverlay: string;
202
+ }, undefined, unknown, unknown, undefined>>;
@@ -0,0 +1,76 @@
1
+ import type { ReactNode } from "react";
2
+ /**
3
+ * Which of the two panels an item or action belongs to.
4
+ */
5
+ export type TTransferPanel = "available" | "selected";
6
+ /**
7
+ * Unique identifier for a transferable item. Kept intentionally permissive so
8
+ * consumers can key items off primitive ids (e.g. numeric database ids) without
9
+ * having to stringify them first. Must be unique across both panels.
10
+ */
11
+ export type TTransferListValue = string | number;
12
+ /**
13
+ * A single transferable item. MultiSelectTransfer composes TransferList and
14
+ * feeds its options straight into these props, so the two shapes are kept
15
+ * structurally compatible.
16
+ */
17
+ export interface ITransferListItem {
18
+ value: TTransferListValue;
19
+ label: ReactNode;
20
+ /** Plain-text used for searching when `label` is a ReactNode. Takes precedence over label/value. */
21
+ searchValue?: string;
22
+ isDisabled?: boolean;
23
+ }
24
+ export interface ITransferListProps {
25
+ /** Items in the available (left) panel. Controlled. */
26
+ availableItems: ITransferListItem[];
27
+ /** Items in the selected (right) panel. Order is preserved when reorderable. Controlled. */
28
+ selectedItems: ITransferListItem[];
29
+ /** Fired on every move/reorder with the next available + selected arrays. */
30
+ onChange: (availableItems: ITransferListItem[], selectedItems: ITransferListItem[]) => void;
31
+ /** Heading for the available panel. @default "Available Items" */
32
+ availablePanelTitle?: ReactNode;
33
+ /** Heading for the selected panel. @default "Selected Items" */
34
+ selectedPanelTitle?: ReactNode;
35
+ /** Show the per-panel search inputs. @default true */
36
+ searchable?: boolean;
37
+ /** Controlled search term for the available panel. */
38
+ availableSearchTerm?: string;
39
+ /** Controlled-search change handler for the available panel. */
40
+ onAvailableSearchChange?: (query: string) => void;
41
+ /** Controlled search term for the selected panel. */
42
+ selectedSearchTerm?: string;
43
+ /** Controlled-search change handler for the selected panel. */
44
+ onSelectedSearchChange?: (query: string) => void;
45
+ /** Placeholder for both search inputs. @default "Search here" */
46
+ searchPlaceholder?: string;
47
+ /** Custom content rendered under the available panel search input. */
48
+ availablePanelHeaderSlot?: ReactNode;
49
+ /** Custom content rendered under the selected panel search input. */
50
+ selectedPanelHeaderSlot?: ReactNode;
51
+ /** Label for the available panel's move button. A `(count)` suffix is appended when items are checked. @default "Add to select" */
52
+ moveToSelectedLabel?: string;
53
+ /** Label for the selected panel's move button. A `(count)` suffix is appended when items are checked. @default "Remove from selected" */
54
+ moveToAvailableLabel?: string;
55
+ /** Enable drag handles, position badges and up/down arrows on the selected panel. @default false */
56
+ reorderable?: boolean;
57
+ /** Tooltip for the transfer list reload button. */
58
+ reloadTooltip?: string;
59
+ /** Fired when the reload button is clicked. */
60
+ onReload?: () => void;
61
+ /** Spins the reload icon and disables the button. */
62
+ isReloading?: boolean;
63
+ /** More available items can be loaded (drives the infinite-scroll sentinel). */
64
+ hasMoreAvailable?: boolean;
65
+ /** Fired when the available list sentinel scrolls into view. */
66
+ onLoadMoreAvailable?: () => void;
67
+ /** Renders a loader row at the bottom of the available list. */
68
+ isLoadingMoreAvailable?: boolean;
69
+ /** Disable all interaction. */
70
+ disabled?: boolean;
71
+ /** Empty-state copy for the available panel. @default "No Data Found!" */
72
+ availableEmptyText?: ReactNode;
73
+ /** Empty-state copy for the selected panel. @default "No Data Found!" */
74
+ selectedEmptyText?: ReactNode;
75
+ className?: string;
76
+ }
@@ -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[]) => 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 {};
@@ -1 +1 @@
1
- @font-face{font-family:inter-regular;src:url(../fonts/Inter_18pt-Regular.ttf) format("truetype");font-display:swap}@font-face{font-family:inter-italic;src:url(../fonts/Inter_18pt-Italic.ttf) format("truetype");font-display:swap}@font-face{font-family:inter-medium;src:url(../fonts/Inter_18pt-Medium.ttf) format("truetype");font-display:swap}@font-face{font-family:inter-medium-italic;src:url(../fonts/Inter_18pt-MediumItalic.ttf) format("truetype");font-display:swap}@font-face{font-family:inter-semibold;src:url(../fonts/Inter_18pt-SemiBold.ttf) format("truetype");font-display:swap}@font-face{font-family:inter-semibold-italic;src:url(../fonts/Inter_18pt-SemiBoldItalic.ttf) format("truetype");font-display:swap}@font-face{font-family:inter-bold;src:url(../fonts/Inter_18pt-Bold.ttf) format("truetype");font-display:swap}@font-face{font-family:inter-bold-italic;src:url(../fonts/Inter_18pt-BoldItalic.ttf) format("truetype");font-display:swap}
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}