@proyecto-viviana/solid-stately 0.2.4 → 0.3.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/LICENSE +21 -0
- package/README.md +30 -283
- package/dist/autocomplete/createAutocompleteState.d.ts +3 -2
- package/dist/autocomplete/index.d.ts +1 -1
- package/dist/calendar/createCalendarState.d.ts +22 -7
- package/dist/calendar/createDateFieldState.d.ts +30 -7
- package/dist/calendar/createDatePickerState.d.ts +60 -0
- package/dist/calendar/createRangeCalendarState.d.ts +27 -8
- package/dist/calendar/createTimeFieldState.d.ts +34 -7
- package/dist/calendar/index.d.ts +7 -6
- package/dist/checkbox/createCheckboxGroupState.d.ts +12 -3
- package/dist/checkbox/index.d.ts +1 -1
- package/dist/collections/ListCollection.d.ts +1 -1
- package/dist/collections/createListState.d.ts +8 -8
- package/dist/collections/createMenuState.d.ts +7 -7
- package/dist/collections/createSelectionState.d.ts +5 -5
- package/dist/collections/index.d.ts +5 -5
- package/dist/collections/types.d.ts +23 -12
- package/dist/color/Color.d.ts +1 -1
- package/dist/color/createColorAreaState.d.ts +4 -2
- package/dist/color/createColorFieldState.d.ts +38 -12
- package/dist/color/createColorSliderState.d.ts +9 -2
- package/dist/color/createColorWheelState.d.ts +13 -2
- package/dist/color/getColorChannels.d.ts +20 -0
- package/dist/color/index.d.ts +6 -6
- package/dist/color/types.d.ts +4 -4
- package/dist/combobox/createComboBoxState.d.ts +27 -13
- package/dist/combobox/index.d.ts +1 -1
- package/dist/data/createAsyncList.d.ts +111 -0
- package/dist/data/createListData.d.ts +65 -0
- package/dist/data/createTreeData.d.ts +65 -0
- package/dist/data/index.d.ts +3 -0
- package/dist/datepicker/index.d.ts +8 -0
- package/dist/disclosure/createDisclosureState.d.ts +2 -2
- package/dist/disclosure/index.d.ts +1 -1
- package/dist/dnd/createDragState.d.ts +2 -2
- package/dist/dnd/createDraggableCollectionState.d.ts +2 -2
- package/dist/dnd/createDropState.d.ts +2 -2
- package/dist/dnd/createDroppableCollectionState.d.ts +3 -3
- package/dist/dnd/index.d.ts +5 -5
- package/dist/dnd/types.d.ts +16 -16
- package/dist/form/createFormValidationState.d.ts +3 -3
- package/dist/form/index.d.ts +1 -1
- package/dist/grid/createGridState.d.ts +2 -2
- package/dist/grid/index.d.ts +2 -2
- package/dist/grid/types.d.ts +17 -11
- package/dist/index.d.ts +31 -25
- package/dist/index.js +7990 -6264
- package/dist/index.js.map +1 -7
- package/dist/menu/index.d.ts +8 -0
- package/dist/numberfield/createNumberFieldState.d.ts +2 -2
- package/dist/numberfield/index.d.ts +1 -1
- package/dist/overlays/createOverlayTriggerState.d.ts +2 -2
- package/dist/overlays/index.d.ts +1 -1
- package/dist/radio/createRadioGroupState.d.ts +13 -4
- package/dist/radio/index.d.ts +1 -1
- package/dist/searchfield/createSearchFieldState.d.ts +2 -2
- package/dist/searchfield/index.d.ts +2 -2
- package/dist/select/createSelectState.d.ts +20 -3
- package/dist/select/index.d.ts +1 -1
- package/dist/selection/index.d.ts +11 -0
- package/dist/slider/createSliderState.d.ts +3 -3
- package/dist/slider/index.d.ts +2 -2
- package/dist/steplist/createStepListState.d.ts +48 -0
- package/dist/steplist/index.d.ts +1 -0
- package/dist/table/TableCollection.d.ts +3 -3
- package/dist/table/createTableColumnResizeState.d.ts +54 -0
- package/dist/table/createTableState.d.ts +2 -2
- package/dist/table/index.d.ts +5 -3
- package/dist/table/types.d.ts +10 -10
- package/dist/tabs/createTabListState.d.ts +5 -5
- package/dist/tabs/index.d.ts +1 -1
- package/dist/textfield/createTextFieldState.d.ts +2 -2
- package/dist/textfield/index.d.ts +1 -1
- package/dist/toast/createToastState.d.ts +15 -3
- package/dist/toast/index.d.ts +1 -1
- package/dist/toggle/createToggleGroupState.d.ts +45 -0
- package/dist/toggle/createToggleState.d.ts +2 -2
- package/dist/toggle/index.d.ts +2 -1
- package/dist/tooltip/createTooltipTriggerState.d.ts +2 -2
- package/dist/tooltip/index.d.ts +1 -1
- package/dist/tree/TreeCollection.d.ts +5 -4
- package/dist/tree/createTreeState.d.ts +2 -2
- package/dist/tree/index.d.ts +3 -3
- package/dist/tree/types.d.ts +19 -13
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/reactivity.d.ts +1 -1
- package/package.json +30 -30
- package/src/autocomplete/createAutocompleteState.d.ts +19 -17
- package/src/autocomplete/createAutocompleteState.ts +25 -32
- package/src/autocomplete/index.d.ts +6 -2
- package/src/autocomplete/index.ts +1 -1
- package/src/calendar/createCalendarState.d.ts +139 -117
- package/src/calendar/createCalendarState.ts +221 -74
- package/src/calendar/createDateFieldState.d.ts +130 -95
- package/src/calendar/createDateFieldState.ts +286 -151
- package/src/calendar/createDatePickerState.ts +347 -0
- package/src/calendar/createRangeCalendarState.d.ts +154 -129
- package/src/calendar/createRangeCalendarState.ts +293 -79
- package/src/calendar/createTimeFieldState.d.ts +81 -79
- package/src/calendar/createTimeFieldState.ts +187 -108
- package/src/calendar/index.d.ts +80 -7
- package/src/calendar/index.ts +21 -12
- package/src/checkbox/createCheckboxGroupState.d.ts +57 -55
- package/src/checkbox/createCheckboxGroupState.ts +57 -30
- package/src/checkbox/index.d.ts +6 -2
- package/src/checkbox/index.ts +1 -1
- package/src/collections/ListCollection.d.ts +25 -22
- package/src/collections/ListCollection.ts +152 -146
- package/src/collections/createListState.d.ts +73 -58
- package/src/collections/createListState.ts +267 -264
- package/src/collections/createMenuState.d.ts +36 -31
- package/src/collections/createMenuState.ts +112 -106
- package/src/collections/createSelectionState.d.ts +78 -65
- package/src/collections/createSelectionState.ts +340 -336
- package/src/collections/index.d.ts +38 -6
- package/src/collections/index.ts +41 -46
- package/src/collections/types.d.ts +101 -101
- package/src/collections/types.ts +181 -169
- package/src/color/Color.d.ts +20 -5
- package/src/color/Color.ts +1054 -951
- package/src/color/createColorAreaState.d.ts +67 -65
- package/src/color/createColorAreaState.ts +301 -293
- package/src/color/createColorFieldState.d.ts +46 -44
- package/src/color/createColorFieldState.ts +428 -292
- package/src/color/createColorSliderState.d.ts +58 -56
- package/src/color/createColorSliderState.ts +272 -241
- package/src/color/createColorWheelState.d.ts +42 -40
- package/src/color/createColorWheelState.ts +248 -211
- package/src/color/getColorChannels.ts +36 -0
- package/src/color/index.d.ts +36 -7
- package/src/color/index.ts +44 -47
- package/src/color/types.d.ts +68 -63
- package/src/color/types.ts +119 -127
- package/src/combobox/createComboBoxState.d.ts +107 -105
- package/src/combobox/createComboBoxState.ts +790 -703
- package/src/combobox/index.d.ts +10 -2
- package/src/combobox/index.ts +13 -13
- package/src/data/createAsyncList.ts +403 -0
- package/src/data/createListData.ts +298 -0
- package/src/data/createTreeData.ts +646 -0
- package/src/data/index.ts +25 -0
- package/src/datepicker/index.ts +32 -0
- package/src/disclosure/createDisclosureState.d.ts +47 -43
- package/src/disclosure/createDisclosureState.ts +9 -23
- package/src/disclosure/index.d.ts +10 -2
- package/src/disclosure/index.ts +1 -1
- package/src/dnd/createDragState.d.ts +51 -42
- package/src/dnd/createDragState.ts +151 -153
- package/src/dnd/createDraggableCollectionState.d.ts +52 -41
- package/src/dnd/createDraggableCollectionState.ts +158 -165
- package/src/dnd/createDropState.d.ts +64 -45
- package/src/dnd/createDropState.ts +202 -212
- package/src/dnd/createDroppableCollectionState.d.ts +88 -59
- package/src/dnd/createDroppableCollectionState.ts +354 -357
- package/src/dnd/index.d.ts +54 -6
- package/src/dnd/index.ts +63 -76
- package/src/dnd/types.d.ts +167 -156
- package/src/dnd/types.ts +316 -317
- package/src/form/createFormValidationState.d.ts +47 -45
- package/src/form/createFormValidationState.ts +356 -389
- package/src/form/index.d.ts +16 -2
- package/src/form/index.ts +15 -15
- package/src/grid/createGridState.d.ts +7 -4
- package/src/grid/createGridState.ts +44 -51
- package/src/grid/index.d.ts +3 -3
- package/src/grid/index.ts +2 -8
- package/src/grid/types.d.ts +136 -129
- package/src/grid/types.ts +24 -17
- package/src/index.d.ts +310 -26
- package/src/index.ts +87 -79
- package/src/menu/index.ts +17 -0
- package/src/numberfield/createNumberFieldState.d.ts +56 -54
- package/src/numberfield/createNumberFieldState.ts +422 -383
- package/src/numberfield/index.d.ts +6 -2
- package/src/numberfield/index.ts +5 -5
- package/src/overlays/createOverlayTriggerState.d.ts +22 -20
- package/src/overlays/createOverlayTriggerState.ts +66 -67
- package/src/overlays/index.d.ts +6 -2
- package/src/overlays/index.ts +5 -5
- package/src/radio/createRadioGroupState.d.ts +54 -52
- package/src/radio/createRadioGroupState.ts +66 -30
- package/src/radio/index.d.ts +7 -2
- package/src/radio/index.ts +1 -1
- package/src/searchfield/createSearchFieldState.d.ts +16 -14
- package/src/searchfield/createSearchFieldState.ts +56 -62
- package/src/searchfield/index.d.ts +3 -3
- package/src/searchfield/index.ts +2 -5
- package/src/select/createSelectState.d.ts +63 -61
- package/src/select/createSelectState.ts +290 -181
- package/src/select/index.d.ts +2 -2
- package/src/select/index.ts +1 -5
- package/src/selection/index.ts +27 -0
- package/src/slider/createSliderState.d.ts +60 -60
- package/src/slider/createSliderState.ts +233 -211
- package/src/slider/index.d.ts +3 -3
- package/src/slider/index.ts +2 -6
- package/src/ssr/index.d.ts +1 -1
- package/src/ssr/index.ts +2 -2
- package/src/steplist/createStepListState.ts +191 -0
- package/src/steplist/index.ts +5 -0
- package/src/table/TableCollection.d.ts +42 -40
- package/src/table/TableCollection.ts +61 -64
- package/src/table/createTableColumnResizeState.ts +242 -0
- package/src/table/createTableState.d.ts +7 -4
- package/src/table/createTableState.ts +10 -7
- package/src/table/index.d.ts +14 -4
- package/src/table/index.ts +10 -3
- package/src/table/types.d.ts +98 -92
- package/src/table/types.ts +17 -13
- package/src/tabs/createTabListState.d.ts +59 -57
- package/src/tabs/createTabListState.ts +58 -39
- package/src/tabs/index.d.ts +8 -2
- package/src/tabs/index.ts +1 -1
- package/src/textfield/createTextFieldState.d.ts +16 -14
- package/src/textfield/createTextFieldState.ts +7 -18
- package/src/textfield/index.d.ts +6 -2
- package/src/textfield/index.ts +1 -1
- package/src/toast/createToastState.d.ts +92 -81
- package/src/toast/createToastState.ts +56 -44
- package/src/toast/index.d.ts +12 -2
- package/src/toast/index.ts +1 -1
- package/src/toggle/createToggleGroupState.ts +117 -0
- package/src/toggle/createToggleState.d.ts +19 -19
- package/src/toggle/createToggleState.ts +2 -16
- package/src/toggle/index.d.ts +2 -2
- package/src/toggle/index.ts +6 -4
- package/src/tooltip/createTooltipTriggerState.d.ts +17 -17
- package/src/tooltip/createTooltipTriggerState.ts +184 -183
- package/src/tooltip/index.d.ts +7 -2
- package/src/tooltip/index.ts +6 -6
- package/src/tree/TreeCollection.d.ts +26 -23
- package/src/tree/TreeCollection.ts +215 -175
- package/src/tree/createTreeState.d.ts +7 -4
- package/src/tree/createTreeState.ts +390 -392
- package/src/tree/index.d.ts +10 -4
- package/src/tree/index.ts +13 -13
- package/src/tree/types.d.ts +131 -126
- package/src/tree/types.ts +183 -174
- package/src/utils/index.d.ts +2 -2
- package/src/utils/index.ts +1 -1
- package/src/utils/reactivity.d.ts +2 -2
- package/src/utils/reactivity.ts +3 -3
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
* ComboBox combines a text input with a dropdown list, allowing users to
|
|
6
6
|
* either type to filter options or select from a list.
|
|
7
7
|
*/
|
|
8
|
-
import { type Accessor } from
|
|
9
|
-
import { type MaybeAccessor } from
|
|
10
|
-
import type { Key, CollectionNode, Collection, FocusStrategy } from
|
|
11
|
-
export type MenuTriggerAction =
|
|
12
|
-
export type { FocusStrategy } from
|
|
8
|
+
import { type Accessor } from "solid-js";
|
|
9
|
+
import { type MaybeAccessor } from "../utils";
|
|
10
|
+
import type { Key, CollectionNode, Collection, FocusStrategy } from "../collections/types";
|
|
11
|
+
export type MenuTriggerAction = "focus" | "input" | "manual";
|
|
12
|
+
export type { FocusStrategy } from "../collections/types";
|
|
13
13
|
export type FilterFn = (textValue: string, inputValue: string) => boolean;
|
|
14
14
|
export interface ComboBoxStateProps<T = unknown> {
|
|
15
15
|
/** The items to display in the combobox dropdown. */
|
|
16
|
-
items
|
|
16
|
+
items?: T[];
|
|
17
17
|
/** Default items when uncontrolled. */
|
|
18
18
|
defaultItems?: T[];
|
|
19
19
|
/** Function to get the key for an item. */
|
|
@@ -24,12 +24,20 @@ export interface ComboBoxStateProps<T = unknown> {
|
|
|
24
24
|
getDisabled?: (item: T) => boolean;
|
|
25
25
|
/** Keys of disabled items. */
|
|
26
26
|
disabledKeys?: Iterable<Key>;
|
|
27
|
-
/** The
|
|
27
|
+
/** The selection mode for the combobox. */
|
|
28
|
+
selectionMode?: "single" | "multiple";
|
|
29
|
+
/** The currently selected key (controlled, single mode). */
|
|
28
30
|
selectedKey?: Key | null;
|
|
29
|
-
/** The default selected key (uncontrolled). */
|
|
31
|
+
/** The default selected key (uncontrolled, single mode). */
|
|
30
32
|
defaultSelectedKey?: Key | null;
|
|
31
|
-
/**
|
|
33
|
+
/** The currently selected keys (controlled, multiple mode). */
|
|
34
|
+
selectedKeys?: Iterable<Key>;
|
|
35
|
+
/** The default selected keys (uncontrolled, multiple mode). */
|
|
36
|
+
defaultSelectedKeys?: Iterable<Key>;
|
|
37
|
+
/** Handler called when the selection changes (single mode). */
|
|
32
38
|
onSelectionChange?: (key: Key | null) => void;
|
|
39
|
+
/** Handler called when the selection changes (multiple mode). */
|
|
40
|
+
onSelectionChangeMultiple?: (keys: Set<Key>) => void;
|
|
33
41
|
/** The current input value (controlled). */
|
|
34
42
|
inputValue?: string;
|
|
35
43
|
/** The default input value (uncontrolled). */
|
|
@@ -70,14 +78,20 @@ export interface ComboBoxState<T = unknown> {
|
|
|
70
78
|
close(): void;
|
|
71
79
|
/** Toggle the combobox dropdown. */
|
|
72
80
|
toggle(focusStrategy?: FocusStrategy | null, trigger?: MenuTriggerAction): void;
|
|
73
|
-
/** The currently selected key. */
|
|
81
|
+
/** The currently selected key (single mode). */
|
|
74
82
|
readonly selectedKey: Accessor<Key | null>;
|
|
75
83
|
/** The default selected key. */
|
|
76
84
|
readonly defaultSelectedKey: Key | null;
|
|
77
|
-
/** The currently selected item. */
|
|
85
|
+
/** The currently selected item (single mode). */
|
|
78
86
|
readonly selectedItem: Accessor<CollectionNode<T> | null>;
|
|
79
87
|
/** Set the selected key. */
|
|
80
88
|
setSelectedKey(key: Key | null): void;
|
|
89
|
+
/** The currently selected keys (multiple mode). */
|
|
90
|
+
readonly selectedKeys: Accessor<Set<Key>>;
|
|
91
|
+
/** The currently selected items (multiple mode). */
|
|
92
|
+
readonly selectedItems: Accessor<CollectionNode<T>[]>;
|
|
93
|
+
/** Remove a selected key (multiple mode). */
|
|
94
|
+
removeSelectedKey(key: Key): void;
|
|
81
95
|
/** The current input value. */
|
|
82
96
|
readonly inputValue: Accessor<string>;
|
|
83
97
|
/** The default input value. */
|
|
@@ -102,8 +116,8 @@ export interface ComboBoxState<T = unknown> {
|
|
|
102
116
|
isKeyDisabled(key: Key): boolean;
|
|
103
117
|
/** Select a key and close the menu (for ListState compatibility). */
|
|
104
118
|
select(key: Key): void;
|
|
105
|
-
/** The selection mode
|
|
106
|
-
readonly selectionMode: Accessor<
|
|
119
|
+
/** The selection mode. */
|
|
120
|
+
readonly selectionMode: Accessor<"single" | "multiple">;
|
|
107
121
|
/** Check if a key is selected. */
|
|
108
122
|
isSelected(key: Key): boolean;
|
|
109
123
|
/** Whether the combobox is disabled. */
|
package/dist/combobox/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ComboBox state management for Solid Stately.
|
|
3
3
|
*/
|
|
4
|
-
export { createComboBoxState, defaultContainsFilter, type ComboBoxState, type ComboBoxStateProps, type FilterFn, type MenuTriggerAction, type FocusStrategy, } from
|
|
4
|
+
export { createComboBoxState, defaultContainsFilter, type ComboBoxState, type ComboBoxStateProps, type FilterFn, type MenuTriggerAction, type FocusStrategy, } from "./createComboBoxState";
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createAsyncList - SolidJS port of React Spectrum's useAsyncList
|
|
3
|
+
*
|
|
4
|
+
* Manages state for an immutable async loaded list data structure, and provides
|
|
5
|
+
* convenience methods to update the data over time. Manages loading and error
|
|
6
|
+
* states, pagination, and sorting.
|
|
7
|
+
*/
|
|
8
|
+
export type Key = string | number;
|
|
9
|
+
export type Selection = "all" | Set<Key>;
|
|
10
|
+
export type LoadingState = "idle" | "loading" | "loadingMore" | "sorting" | "filtering" | "error";
|
|
11
|
+
export interface SortDescriptor {
|
|
12
|
+
/** The key of the column to sort by. */
|
|
13
|
+
column?: Key;
|
|
14
|
+
/** The direction to sort by. */
|
|
15
|
+
direction?: "ascending" | "descending";
|
|
16
|
+
}
|
|
17
|
+
export interface AsyncListLoadOptions<T, C> {
|
|
18
|
+
/** The items currently in the list. */
|
|
19
|
+
items: T[];
|
|
20
|
+
/** The keys of the currently selected items in the list. */
|
|
21
|
+
selectedKeys: Selection;
|
|
22
|
+
/** The current sort descriptor for the list. */
|
|
23
|
+
sortDescriptor?: SortDescriptor;
|
|
24
|
+
/** An abort signal used to notify the load function that the request has been aborted. */
|
|
25
|
+
signal: AbortSignal;
|
|
26
|
+
/** The pagination cursor returned from the last page load. */
|
|
27
|
+
cursor?: C;
|
|
28
|
+
/** The current filter text used to perform server side filtering. */
|
|
29
|
+
filterText?: string;
|
|
30
|
+
/** The current loading state of the list. */
|
|
31
|
+
loadingState?: LoadingState;
|
|
32
|
+
}
|
|
33
|
+
export interface AsyncListStateUpdate<T, C> {
|
|
34
|
+
/** The new items to append to the list. */
|
|
35
|
+
items: Iterable<T>;
|
|
36
|
+
/** The keys to add to the selection. */
|
|
37
|
+
selectedKeys?: Iterable<Key>;
|
|
38
|
+
/** The sort descriptor to set. */
|
|
39
|
+
sortDescriptor?: SortDescriptor;
|
|
40
|
+
/** The pagination cursor to be used for the next page load. */
|
|
41
|
+
cursor?: C;
|
|
42
|
+
/** The updated filter text for the list. */
|
|
43
|
+
filterText?: string;
|
|
44
|
+
}
|
|
45
|
+
export type AsyncListLoadFunction<T, C> = (state: AsyncListLoadOptions<T, C>) => AsyncListStateUpdate<T, C> | Promise<AsyncListStateUpdate<T, C>>;
|
|
46
|
+
export interface AsyncListOptions<T, C> {
|
|
47
|
+
/** The keys for the initially selected items. */
|
|
48
|
+
initialSelectedKeys?: "all" | Iterable<Key>;
|
|
49
|
+
/** The initial sort descriptor. */
|
|
50
|
+
initialSortDescriptor?: SortDescriptor;
|
|
51
|
+
/** The initial filter text. */
|
|
52
|
+
initialFilterText?: string;
|
|
53
|
+
/** A function that returns a unique key for an item object. */
|
|
54
|
+
getKey?: (item: T) => Key;
|
|
55
|
+
/** A function that loads the data for the items in the list. */
|
|
56
|
+
load: AsyncListLoadFunction<T, C>;
|
|
57
|
+
/** An optional function that performs sorting. */
|
|
58
|
+
sort?: AsyncListLoadFunction<T, C>;
|
|
59
|
+
}
|
|
60
|
+
export interface AsyncListData<T> {
|
|
61
|
+
/** The items in the list. */
|
|
62
|
+
readonly items: T[];
|
|
63
|
+
/** The keys of the currently selected items in the list. */
|
|
64
|
+
readonly selectedKeys: Selection;
|
|
65
|
+
/** The current sort descriptor for the list. */
|
|
66
|
+
readonly sortDescriptor: SortDescriptor | undefined;
|
|
67
|
+
/** Whether data is currently being loaded. */
|
|
68
|
+
readonly isLoading: boolean;
|
|
69
|
+
/** If loading data failed, then this contains the error that occurred. */
|
|
70
|
+
readonly error: Error | undefined;
|
|
71
|
+
/** The current filter text. */
|
|
72
|
+
readonly filterText: string;
|
|
73
|
+
/** The current loading state for the list. */
|
|
74
|
+
readonly loadingState: LoadingState;
|
|
75
|
+
/** Reloads the data in the list. */
|
|
76
|
+
reload(): void;
|
|
77
|
+
/** Loads the next page of data in the list. */
|
|
78
|
+
loadMore(): void;
|
|
79
|
+
/** Triggers sorting for the list. */
|
|
80
|
+
sort(descriptor: SortDescriptor): void;
|
|
81
|
+
/** Sets the selected keys. */
|
|
82
|
+
setSelectedKeys(keys: Selection): void;
|
|
83
|
+
/** Sets the filter text. */
|
|
84
|
+
setFilterText(filterText: string): void;
|
|
85
|
+
/** Gets an item from the list by key. */
|
|
86
|
+
getItem(key: Key): T | undefined;
|
|
87
|
+
/** Inserts items into the list at the given index. */
|
|
88
|
+
insert(index: number, ...values: T[]): void;
|
|
89
|
+
/** Inserts items before a given key. */
|
|
90
|
+
insertBefore(key: Key, ...values: T[]): void;
|
|
91
|
+
/** Inserts items after a given key. */
|
|
92
|
+
insertAfter(key: Key, ...values: T[]): void;
|
|
93
|
+
/** Appends items to the list. */
|
|
94
|
+
append(...values: T[]): void;
|
|
95
|
+
/** Prepends items to the list. */
|
|
96
|
+
prepend(...values: T[]): void;
|
|
97
|
+
/** Removes items from the list by their keys. */
|
|
98
|
+
remove(...keys: Key[]): void;
|
|
99
|
+
/** Removes all items from the list that are currently in the set of selected items. */
|
|
100
|
+
removeSelectedItems(): void;
|
|
101
|
+
/** Moves an item within the list. */
|
|
102
|
+
move(key: Key, toIndex: number): void;
|
|
103
|
+
/** Updates an item in the list. */
|
|
104
|
+
update(key: Key, newValue: T): void;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Manages state for an immutable async loaded list data structure, and provides
|
|
108
|
+
* convenience methods to update the data over time. Manages loading and error
|
|
109
|
+
* states, pagination, and sorting.
|
|
110
|
+
*/
|
|
111
|
+
export declare function createAsyncList<T, C = string>(options: AsyncListOptions<T, C>): AsyncListData<T>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createListData - SolidJS port of React Spectrum's useListData
|
|
3
|
+
*
|
|
4
|
+
* Manages state for an immutable list data structure, and provides
|
|
5
|
+
* convenience methods to update the data over time.
|
|
6
|
+
*/
|
|
7
|
+
export type Key = string | number;
|
|
8
|
+
export type Selection = "all" | Set<Key>;
|
|
9
|
+
export interface ListOptions<T> {
|
|
10
|
+
/** Initial items in the list. */
|
|
11
|
+
initialItems?: T[];
|
|
12
|
+
/** The keys for the initially selected items. */
|
|
13
|
+
initialSelectedKeys?: "all" | Iterable<Key>;
|
|
14
|
+
/** The initial text to filter the list by. */
|
|
15
|
+
initialFilterText?: string;
|
|
16
|
+
/** A function that returns a unique key for an item object. */
|
|
17
|
+
getKey?: (item: T) => Key;
|
|
18
|
+
/** A function that returns whether an item matches the current filter text. */
|
|
19
|
+
filter?: (item: T, filterText: string) => boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface ListData<T> {
|
|
22
|
+
/** The items in the list. */
|
|
23
|
+
readonly items: T[];
|
|
24
|
+
/** The keys of the currently selected items in the list. */
|
|
25
|
+
readonly selectedKeys: Selection;
|
|
26
|
+
/** The current filter text. */
|
|
27
|
+
readonly filterText: string;
|
|
28
|
+
/** Sets the selected keys. */
|
|
29
|
+
setSelectedKeys(keys: Selection): void;
|
|
30
|
+
/** Adds the given keys to the current selected keys. */
|
|
31
|
+
addKeysToSelection(keys: Selection): void;
|
|
32
|
+
/** Removes the given keys from the current selected keys. */
|
|
33
|
+
removeKeysFromSelection(keys: Selection): void;
|
|
34
|
+
/** Sets the filter text. */
|
|
35
|
+
setFilterText(filterText: string): void;
|
|
36
|
+
/** Gets an item from the list by key. */
|
|
37
|
+
getItem(key: Key): T | undefined;
|
|
38
|
+
/** Inserts items into the list at the given index. */
|
|
39
|
+
insert(index: number, ...values: T[]): void;
|
|
40
|
+
/** Inserts items into the list before the item at the given key. */
|
|
41
|
+
insertBefore(key: Key, ...values: T[]): void;
|
|
42
|
+
/** Inserts items into the list after the item at the given key. */
|
|
43
|
+
insertAfter(key: Key, ...values: T[]): void;
|
|
44
|
+
/** Appends items to the list. */
|
|
45
|
+
append(...values: T[]): void;
|
|
46
|
+
/** Prepends items to the list. */
|
|
47
|
+
prepend(...values: T[]): void;
|
|
48
|
+
/** Removes items from the list by their keys. */
|
|
49
|
+
remove(...keys: Key[]): void;
|
|
50
|
+
/** Removes all items from the list that are currently in the set of selected items. */
|
|
51
|
+
removeSelectedItems(): void;
|
|
52
|
+
/** Moves an item within the list. */
|
|
53
|
+
move(key: Key, toIndex: number): void;
|
|
54
|
+
/** Moves one or more items before a given key. */
|
|
55
|
+
moveBefore(key: Key, keys: Iterable<Key>): void;
|
|
56
|
+
/** Moves one or more items after a given key. */
|
|
57
|
+
moveAfter(key: Key, keys: Iterable<Key>): void;
|
|
58
|
+
/** Updates an item in the list. */
|
|
59
|
+
update(key: Key, newValue: T | ((prev: T) => T)): void;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Manages state for an immutable list data structure, and provides
|
|
63
|
+
* convenience methods to update the data over time.
|
|
64
|
+
*/
|
|
65
|
+
export declare function createListData<T>(options: ListOptions<T>): ListData<T>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createTreeData - SolidJS port of React Spectrum's useTreeData
|
|
3
|
+
*
|
|
4
|
+
* Manages state for an immutable tree data structure, and provides
|
|
5
|
+
* convenience methods to update the data over time.
|
|
6
|
+
*/
|
|
7
|
+
export type Key = string | number;
|
|
8
|
+
export type Selection = "all" | Set<Key>;
|
|
9
|
+
export interface TreeNode<T> {
|
|
10
|
+
/** A unique key for the tree node. */
|
|
11
|
+
key: Key;
|
|
12
|
+
/** The key of the parent node. */
|
|
13
|
+
parentKey: Key | null;
|
|
14
|
+
/** The value object for the tree node. */
|
|
15
|
+
value: T;
|
|
16
|
+
/** The children of this node. */
|
|
17
|
+
children: TreeNode<T>[] | null;
|
|
18
|
+
}
|
|
19
|
+
export interface TreeOptions<T> {
|
|
20
|
+
/** Initial items in the tree. */
|
|
21
|
+
initialItems?: T[];
|
|
22
|
+
/** The keys for the initially selected items. */
|
|
23
|
+
initialSelectedKeys?: "all" | Iterable<Key>;
|
|
24
|
+
/** A function that returns a unique key for an item object. */
|
|
25
|
+
getKey?: (item: T) => Key;
|
|
26
|
+
/** A function that returns the children of an item object. */
|
|
27
|
+
getChildren?: (item: T) => T[];
|
|
28
|
+
}
|
|
29
|
+
export interface TreeData<T> {
|
|
30
|
+
/** The root items in the tree. */
|
|
31
|
+
readonly items: TreeNode<T>[];
|
|
32
|
+
/** The keys of the currently selected items in the tree. */
|
|
33
|
+
readonly selectedKeys: Selection;
|
|
34
|
+
/** Sets the selected keys. */
|
|
35
|
+
setSelectedKeys(keys: Selection): void;
|
|
36
|
+
/** Gets an item from the tree by key. */
|
|
37
|
+
getItem(key: Key): TreeNode<T> | undefined;
|
|
38
|
+
/** Inserts items into the tree. */
|
|
39
|
+
insert(parentKey: Key | null, index: number, ...values: T[]): void;
|
|
40
|
+
/** Inserts items before a given key. */
|
|
41
|
+
insertBefore(key: Key, ...values: T[]): void;
|
|
42
|
+
/** Inserts items after a given key. */
|
|
43
|
+
insertAfter(key: Key, ...values: T[]): void;
|
|
44
|
+
/** Appends items to a parent node. */
|
|
45
|
+
append(parentKey: Key | null, ...values: T[]): void;
|
|
46
|
+
/** Prepends items to a parent node. */
|
|
47
|
+
prepend(parentKey: Key | null, ...values: T[]): void;
|
|
48
|
+
/** Removes items from the tree by their keys. */
|
|
49
|
+
remove(...keys: Key[]): void;
|
|
50
|
+
/** Removes all items from the tree that are currently in the set of selected items. */
|
|
51
|
+
removeSelectedItems(): void;
|
|
52
|
+
/** Moves an item to a new parent. */
|
|
53
|
+
move(key: Key, toParentKey: Key | null, index: number): void;
|
|
54
|
+
/** Moves items before a given key. */
|
|
55
|
+
moveBefore(key: Key, keys: Iterable<Key>): void;
|
|
56
|
+
/** Moves items after a given key. */
|
|
57
|
+
moveAfter(key: Key, keys: Iterable<Key>): void;
|
|
58
|
+
/** Updates an item in the tree. */
|
|
59
|
+
update(key: Key, newValue: T): void;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Manages state for an immutable tree data structure, and provides
|
|
63
|
+
* convenience methods to update the data over time.
|
|
64
|
+
*/
|
|
65
|
+
export declare function createTreeData<T>(options: TreeOptions<T>): TreeData<T>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { createListData, type ListOptions, type ListData, type Key as ListDataKey, type Selection as ListDataSelection, } from "./createListData";
|
|
2
|
+
export { createTreeData, type TreeOptions, type TreeData, type TreeNode as TreeDataNode, } from "./createTreeData";
|
|
3
|
+
export { createAsyncList, type AsyncListOptions, type AsyncListData, type AsyncListLoadFunction, type AsyncListLoadOptions, type AsyncListStateUpdate, type SortDescriptor, type LoadingState, } from "./createAsyncList";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Datepicker compatibility surface.
|
|
3
|
+
*
|
|
4
|
+
* This is a module-compat shim that maps React Stately datepicker hook names
|
|
5
|
+
* to existing Solid stately primitives.
|
|
6
|
+
*/
|
|
7
|
+
export { createDateFieldState, createTimeFieldState, createRangeCalendarState, createDatePickerState, type DateFieldStateProps as DateFieldStateOptions, type DateFieldState, type DateSegment, type DateSegmentType as SegmentType, type TimeFieldStateProps as TimeFieldStateOptions, type TimeFieldState, type TimeSegment, type TimeSegmentType, type RangeCalendarStateProps as DateRangePickerStateOptions, type RangeCalendarState as DateRangePickerState, type DatePickerState, type DatePickerStateOptions, } from "../calendar";
|
|
8
|
+
export { createDateFieldState as useDateFieldState, createTimeFieldState as useTimeFieldState, createRangeCalendarState as useDateRangePickerState, createDatePickerState as useDatePickerState, } from "../calendar";
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Disclosure state management for SolidJS
|
|
3
3
|
* Based on @react-stately/disclosure useDisclosureState and useDisclosureGroupState
|
|
4
4
|
*/
|
|
5
|
-
import { type Accessor } from
|
|
6
|
-
import { type MaybeAccessor } from
|
|
5
|
+
import { type Accessor } from "solid-js";
|
|
6
|
+
import { type MaybeAccessor } from "../utils";
|
|
7
7
|
export interface DisclosureStateProps {
|
|
8
8
|
/** Whether the disclosure is expanded (controlled). */
|
|
9
9
|
isExpanded?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createDisclosureState, createDisclosureGroupState, type DisclosureStateProps, type DisclosureState, type DisclosureGroupStateProps, type DisclosureGroupState, type Key, } from
|
|
1
|
+
export { createDisclosureState, createDisclosureGroupState, type DisclosureStateProps, type DisclosureState, type DisclosureGroupStateProps, type DisclosureGroupState, type Key, } from "./createDisclosureState";
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides reactive state for drag operations.
|
|
5
5
|
*/
|
|
6
|
-
import { type Accessor } from
|
|
7
|
-
import type { DragItem, DragStartEvent, DragMoveEvent, DragEndEvent, DropOperation, DragPreviewRenderer } from
|
|
6
|
+
import { type Accessor } from "solid-js";
|
|
7
|
+
import type { DragItem, DragStartEvent, DragMoveEvent, DragEndEvent, DropOperation, DragPreviewRenderer } from "./types";
|
|
8
8
|
export interface DragStateOptions {
|
|
9
9
|
/** A function that returns the items being dragged. */
|
|
10
10
|
getItems: () => DragItem[];
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides reactive state for dragging items from a collection.
|
|
5
5
|
*/
|
|
6
|
-
import { type Accessor } from
|
|
7
|
-
import type { DragItem, DraggableCollectionStartEvent, DraggableCollectionMoveEvent, DraggableCollectionEndEvent, DropOperation, DragPreviewRenderer } from
|
|
6
|
+
import { type Accessor } from "solid-js";
|
|
7
|
+
import type { DragItem, DraggableCollectionStartEvent, DraggableCollectionMoveEvent, DraggableCollectionEndEvent, DropOperation, DragPreviewRenderer } from "./types";
|
|
8
8
|
export interface DraggableCollectionStateOptions<T = object> {
|
|
9
9
|
/** A function that returns the items being dragged. */
|
|
10
10
|
getItems: (keys: Set<string | number>) => DragItem[];
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides reactive state for drop target operations.
|
|
5
5
|
*/
|
|
6
|
-
import { type Accessor } from
|
|
7
|
-
import type { DropItem, DropEnterEvent, DropMoveEvent, DropExitEvent, DropActivateEvent, DropEvent, DropOperation, DragTypes } from
|
|
6
|
+
import { type Accessor } from "solid-js";
|
|
7
|
+
import type { DropItem, DropEnterEvent, DropMoveEvent, DropExitEvent, DropActivateEvent, DropEvent, DropOperation, DragTypes } from "./types";
|
|
8
8
|
export interface DropStateOptions {
|
|
9
9
|
/**
|
|
10
10
|
* A function returning the drop operation to be performed.
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides reactive state for accepting drops onto a collection.
|
|
5
5
|
*/
|
|
6
|
-
import { type Accessor } from
|
|
7
|
-
import type { DropItem, DropTarget, DropOperation, DragTypes, DroppableCollectionEnterEvent, DroppableCollectionActivateEvent, DroppableCollectionExitEvent, DroppableCollectionDropEvent, DroppableCollectionInsertDropEvent, DroppableCollectionRootDropEvent, DroppableCollectionOnItemDropEvent, DroppableCollectionReorderEvent, ItemDropTarget } from
|
|
6
|
+
import { type Accessor } from "solid-js";
|
|
7
|
+
import type { DropItem, DropTarget, DropOperation, DragTypes, DroppableCollectionEnterEvent, DroppableCollectionActivateEvent, DroppableCollectionExitEvent, DroppableCollectionDropEvent, DroppableCollectionInsertDropEvent, DroppableCollectionRootDropEvent, DroppableCollectionOnItemDropEvent, DroppableCollectionReorderEvent, ItemDropTarget } from "./types";
|
|
8
8
|
export interface DroppableCollectionStateOptions {
|
|
9
9
|
/**
|
|
10
10
|
* The drag types that the droppable collection accepts.
|
|
11
11
|
* @default 'all'
|
|
12
12
|
*/
|
|
13
|
-
acceptedDragTypes?:
|
|
13
|
+
acceptedDragTypes?: "all" | Array<string | symbol>;
|
|
14
14
|
/**
|
|
15
15
|
* A function returning the drop operation to be performed.
|
|
16
16
|
*/
|
package/dist/dnd/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Exports for DnD functionality.
|
|
5
5
|
*/
|
|
6
|
-
export type { DropOperation, DragItem, DragDropEvent, DragStartEvent, DragMoveEvent, DragEndEvent, DropEnterEvent, DropMoveEvent, DropActivateEvent, DropExitEvent, TextDropItem, FileDropItem, DirectoryDropItem, DropItem, DropEvent, DropPosition, RootDropTarget, ItemDropTarget, DropTarget, DroppableCollectionEnterEvent, DroppableCollectionMoveEvent, DroppableCollectionActivateEvent, DroppableCollectionExitEvent, DroppableCollectionDropEvent, DroppableCollectionInsertDropEvent, DroppableCollectionRootDropEvent, DroppableCollectionOnItemDropEvent, DroppableCollectionReorderEvent, DragTypes, DropTargetDelegate, DraggableCollectionStartEvent, DraggableCollectionMoveEvent, DraggableCollectionEndEvent, DragPreviewRenderer, DroppableCollectionUtilityOptions, DroppableCollectionBaseProps, DroppableCollectionProps, DraggableCollectionProps, } from
|
|
7
|
-
export { createDragState, type DragStateOptions, type DragState
|
|
8
|
-
export { createDropState, type DropStateOptions, type DropState
|
|
9
|
-
export { createDraggableCollectionState, type DraggableCollectionStateOptions, type DraggableCollectionState, } from
|
|
10
|
-
export { createDroppableCollectionState, DIRECTORY_DRAG_TYPE, type DroppableCollectionStateOptions, type DroppableCollectionState, } from
|
|
6
|
+
export type { DropOperation, DragItem, DragDropEvent, DragStartEvent, DragMoveEvent, DragEndEvent, DropEnterEvent, DropMoveEvent, DropActivateEvent, DropExitEvent, TextDropItem, FileDropItem, DirectoryDropItem, DropItem, DropEvent, DropPosition, RootDropTarget, ItemDropTarget, DropTarget, DroppableCollectionEnterEvent, DroppableCollectionMoveEvent, DroppableCollectionActivateEvent, DroppableCollectionExitEvent, DroppableCollectionDropEvent, DroppableCollectionInsertDropEvent, DroppableCollectionRootDropEvent, DroppableCollectionOnItemDropEvent, DroppableCollectionReorderEvent, DragTypes, DropTargetDelegate, DraggableCollectionStartEvent, DraggableCollectionMoveEvent, DraggableCollectionEndEvent, DragPreviewRenderer, DroppableCollectionUtilityOptions, DroppableCollectionBaseProps, DroppableCollectionProps, DraggableCollectionProps, } from "./types";
|
|
7
|
+
export { createDragState, type DragStateOptions, type DragState } from "./createDragState";
|
|
8
|
+
export { createDropState, type DropStateOptions, type DropState } from "./createDropState";
|
|
9
|
+
export { createDraggableCollectionState, type DraggableCollectionStateOptions, type DraggableCollectionState, } from "./createDraggableCollectionState";
|
|
10
|
+
export { createDroppableCollectionState, DIRECTORY_DRAG_TYPE, type DroppableCollectionStateOptions, type DroppableCollectionState, } from "./createDroppableCollectionState";
|
package/dist/dnd/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Core types for drag and drop operations, matching React Aria's DnD API.
|
|
5
5
|
*/
|
|
6
6
|
/** The type of drop operation to perform. */
|
|
7
|
-
export type DropOperation =
|
|
7
|
+
export type DropOperation = "copy" | "link" | "move" | "cancel";
|
|
8
8
|
/** Drag item data as key-value pairs where keys are MIME types or custom types. */
|
|
9
9
|
export interface DragItem {
|
|
10
10
|
[type: string]: string;
|
|
@@ -19,44 +19,44 @@ export interface DragDropEvent {
|
|
|
19
19
|
/** Event fired when a drag operation starts. */
|
|
20
20
|
export interface DragStartEvent extends DragDropEvent {
|
|
21
21
|
/** The event type. */
|
|
22
|
-
type:
|
|
22
|
+
type: "dragstart";
|
|
23
23
|
}
|
|
24
24
|
/** Event fired as a drag moves. */
|
|
25
25
|
export interface DragMoveEvent extends DragDropEvent {
|
|
26
26
|
/** The event type. */
|
|
27
|
-
type:
|
|
27
|
+
type: "dragmove";
|
|
28
28
|
}
|
|
29
29
|
/** Event fired when a drag operation ends. */
|
|
30
30
|
export interface DragEndEvent extends DragDropEvent {
|
|
31
31
|
/** The event type. */
|
|
32
|
-
type:
|
|
32
|
+
type: "dragend";
|
|
33
33
|
/** The drop operation that occurred. */
|
|
34
34
|
dropOperation: DropOperation;
|
|
35
35
|
}
|
|
36
36
|
/** Event fired when a drag enters a drop target. */
|
|
37
37
|
export interface DropEnterEvent extends DragDropEvent {
|
|
38
38
|
/** The event type. */
|
|
39
|
-
type:
|
|
39
|
+
type: "dropenter";
|
|
40
40
|
}
|
|
41
41
|
/** Event fired as a drag moves within a drop target. */
|
|
42
42
|
export interface DropMoveEvent extends DragDropEvent {
|
|
43
43
|
/** The event type. */
|
|
44
|
-
type:
|
|
44
|
+
type: "dropmove";
|
|
45
45
|
}
|
|
46
46
|
/** Event fired when a drag is held over a drop target. */
|
|
47
47
|
export interface DropActivateEvent extends DragDropEvent {
|
|
48
48
|
/** The event type. */
|
|
49
|
-
type:
|
|
49
|
+
type: "dropactivate";
|
|
50
50
|
}
|
|
51
51
|
/** Event fired when a drag exits a drop target. */
|
|
52
52
|
export interface DropExitEvent extends DragDropEvent {
|
|
53
53
|
/** The event type. */
|
|
54
|
-
type:
|
|
54
|
+
type: "dropexit";
|
|
55
55
|
}
|
|
56
56
|
/** A text item in a drop operation. */
|
|
57
57
|
export interface TextDropItem {
|
|
58
58
|
/** The item kind. */
|
|
59
|
-
kind:
|
|
59
|
+
kind: "text";
|
|
60
60
|
/** The drag types available for this item. */
|
|
61
61
|
types: Set<string>;
|
|
62
62
|
/** Returns the data for the given type as a string. */
|
|
@@ -65,7 +65,7 @@ export interface TextDropItem {
|
|
|
65
65
|
/** A file item in a drop operation. */
|
|
66
66
|
export interface FileDropItem {
|
|
67
67
|
/** The item kind. */
|
|
68
|
-
kind:
|
|
68
|
+
kind: "file";
|
|
69
69
|
/** The file type (usually a mime type). */
|
|
70
70
|
type: string;
|
|
71
71
|
/** The file name. */
|
|
@@ -78,7 +78,7 @@ export interface FileDropItem {
|
|
|
78
78
|
/** A directory item in a drop operation. */
|
|
79
79
|
export interface DirectoryDropItem {
|
|
80
80
|
/** The item kind. */
|
|
81
|
-
kind:
|
|
81
|
+
kind: "directory";
|
|
82
82
|
/** The directory name. */
|
|
83
83
|
name: string;
|
|
84
84
|
/** Returns the entries contained within the directory. */
|
|
@@ -89,23 +89,23 @@ export type DropItem = TextDropItem | FileDropItem | DirectoryDropItem;
|
|
|
89
89
|
/** Event fired when items are dropped. */
|
|
90
90
|
export interface DropEvent extends DragDropEvent {
|
|
91
91
|
/** The event type. */
|
|
92
|
-
type:
|
|
92
|
+
type: "drop";
|
|
93
93
|
/** The drop operation that should occur. */
|
|
94
94
|
dropOperation: DropOperation;
|
|
95
95
|
/** The dropped items. */
|
|
96
96
|
items: DropItem[];
|
|
97
97
|
}
|
|
98
98
|
/** Position relative to an item for drop operations. */
|
|
99
|
-
export type DropPosition =
|
|
99
|
+
export type DropPosition = "on" | "before" | "after";
|
|
100
100
|
/** Drop target representing the root of a collection. */
|
|
101
101
|
export interface RootDropTarget {
|
|
102
102
|
/** The drop target type. */
|
|
103
|
-
type:
|
|
103
|
+
type: "root";
|
|
104
104
|
}
|
|
105
105
|
/** Drop target representing an item in a collection. */
|
|
106
106
|
export interface ItemDropTarget {
|
|
107
107
|
/** The drop target type. */
|
|
108
|
-
type:
|
|
108
|
+
type: "item";
|
|
109
109
|
/** The item key. */
|
|
110
110
|
key: string | number;
|
|
111
111
|
/** The drop position relative to the item. */
|
|
@@ -214,7 +214,7 @@ export interface DroppableCollectionUtilityOptions {
|
|
|
214
214
|
* The drag types that the droppable collection accepts.
|
|
215
215
|
* @default 'all'
|
|
216
216
|
*/
|
|
217
|
-
acceptedDragTypes?:
|
|
217
|
+
acceptedDragTypes?: "all" | Array<string | symbol>;
|
|
218
218
|
/** Handler that is called when external items are dropped "between" items. */
|
|
219
219
|
onInsert?: (e: DroppableCollectionInsertDropEvent) => void;
|
|
220
220
|
/** Handler that is called when external items are dropped on the collection's root. */
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Port of react-stately's useFormValidationState.
|
|
8
8
|
*/
|
|
9
|
-
import { type Accessor } from
|
|
9
|
+
import { type Accessor } from "solid-js";
|
|
10
10
|
/** Standard HTML ValidityState interface. */
|
|
11
11
|
export interface ValidityState {
|
|
12
12
|
badInput: boolean;
|
|
@@ -35,12 +35,12 @@ export type ValidationErrors = Record<string, string | string[]>;
|
|
|
35
35
|
/** Validation function that returns error messages or true/false. */
|
|
36
36
|
export type ValidationFunction<T> = (value: T) => boolean | string | string[] | null | undefined;
|
|
37
37
|
/** Validation behavior mode. */
|
|
38
|
-
export type ValidationBehavior =
|
|
38
|
+
export type ValidationBehavior = "aria" | "native";
|
|
39
39
|
export interface FormValidationProps<T> {
|
|
40
40
|
/** Whether the value is invalid (controlled). */
|
|
41
41
|
isInvalid?: boolean;
|
|
42
42
|
/** @deprecated Use isInvalid instead. */
|
|
43
|
-
validationState?:
|
|
43
|
+
validationState?: "valid" | "invalid";
|
|
44
44
|
/** Custom validation function. */
|
|
45
45
|
validate?: ValidationFunction<T>;
|
|
46
46
|
/** Validation behavior: 'aria' for realtime, 'native' for on submit. */
|
package/dist/form/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createFormValidationState, mergeValidation, FormValidationContext, privateValidationStateProp, VALID_VALIDITY_STATE, DEFAULT_VALIDATION_RESULT, type FormValidationState, type FormValidationProps, type ValidationResult, type ValidationErrors, type ValidationFunction, type ValidationBehavior, type ValidityState, } from
|
|
1
|
+
export { createFormValidationState, mergeValidation, FormValidationContext, privateValidationStateProp, VALID_VALIDITY_STATE, DEFAULT_VALIDATION_RESULT, type FormValidationState, type FormValidationProps, type ValidationResult, type ValidationErrors, type ValidationFunction, type ValidationBehavior, type ValidityState, } from "./createFormValidationState";
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Grid state management for Table and GridList components.
|
|
3
3
|
* Based on @react-stately/grid/useGridState.
|
|
4
4
|
*/
|
|
5
|
-
import { type Accessor } from
|
|
6
|
-
import type { GridState, GridStateOptions, GridCollection } from
|
|
5
|
+
import { type Accessor } from "solid-js";
|
|
6
|
+
import type { GridState, GridStateOptions, GridCollection } from "./types";
|
|
7
7
|
/**
|
|
8
8
|
* Creates state management for a grid component.
|
|
9
9
|
* Handles row selection, focus management, and keyboard navigation state.
|
package/dist/grid/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Grid state management module.
|
|
3
3
|
* Provides state hooks for Table and GridList components.
|
|
4
4
|
*/
|
|
5
|
-
export { createGridState } from
|
|
6
|
-
export type { GridState, GridStateOptions, GridCollection, GridNode, GridNodeType
|
|
5
|
+
export { createGridState } from "./createGridState";
|
|
6
|
+
export type { GridState, GridStateOptions, GridCollection, GridNode, GridNodeType } from "./types";
|