@proyecto-viviana/solid-stately 0.2.7 → 0.4.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 +30 -283
- package/dist/autocomplete/createAutocompleteState.d.ts +2 -2
- package/dist/autocomplete/index.d.ts +1 -1
- package/dist/calendar/IncompleteDate.d.ts +61 -0
- package/dist/calendar/createCalendarState.d.ts +41 -16
- package/dist/calendar/createDateFieldState.d.ts +39 -9
- package/dist/calendar/createDatePickerState.d.ts +60 -0
- package/dist/calendar/createRangeCalendarState.d.ts +37 -10
- package/dist/calendar/createTimeFieldState.d.ts +34 -7
- package/dist/calendar/index.d.ts +7 -6
- package/dist/checkbox/createCheckboxGroupState.d.ts +6 -6
- package/dist/checkbox/index.d.ts +1 -1
- package/dist/collections/ListCollection.d.ts +1 -1
- package/dist/collections/createListState.d.ts +11 -8
- package/dist/collections/createMenuState.d.ts +7 -7
- package/dist/collections/createSelectionState.d.ts +22 -10
- package/dist/collections/getChildNodes.d.ts +11 -0
- package/dist/collections/index.d.ts +6 -5
- package/dist/collections/types.d.ts +12 -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 +1 -1
- package/dist/color/index.d.ts +6 -6
- package/dist/color/types.d.ts +4 -4
- package/dist/combobox/createComboBoxState.d.ts +34 -13
- package/dist/combobox/index.d.ts +1 -1
- package/dist/data/createAsyncList.d.ts +4 -4
- package/dist/data/createListData.d.ts +2 -2
- package/dist/data/createTreeData.d.ts +6 -2
- package/dist/data/index.d.ts +3 -3
- package/dist/datepicker/index.d.ts +2 -4
- 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 +19 -17
- 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 +27 -11
- package/dist/index.d.ts +31 -30
- package/dist/index.js +9077 -7246
- package/dist/index.js.map +1 -1
- package/dist/menu/index.d.ts +2 -2
- 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 +7 -7
- 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 +14 -8
- package/dist/select/index.d.ts +1 -1
- package/dist/selection/Selection.d.ts +16 -0
- package/dist/selection/SelectionManager.d.ts +110 -0
- package/dist/selection/createMultipleSelectionState.d.ts +59 -0
- package/dist/selection/index.d.ts +6 -5
- 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 +33 -3
- package/dist/table/createTableColumnResizeState.d.ts +54 -0
- package/dist/table/createTableState.d.ts +2 -2
- package/dist/table/createTreeGridState.d.ts +15 -0
- package/dist/table/index.d.ts +6 -3
- package/dist/table/types.d.ts +68 -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 +24 -2
- package/dist/toast/index.d.ts +1 -1
- package/dist/toggle/createToggleGroupState.d.ts +4 -4
- package/dist/toggle/createToggleState.d.ts +2 -2
- package/dist/toggle/index.d.ts +2 -2
- package/dist/tooltip/createTooltipTriggerState.d.ts +2 -2
- package/dist/tooltip/index.d.ts +1 -1
- package/dist/tree/TreeCollection.d.ts +2 -2
- package/dist/tree/createTreeState.d.ts +2 -2
- package/dist/tree/index.d.ts +3 -3
- package/dist/tree/types.d.ts +27 -13
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/reactivity.d.ts +1 -1
- package/package.json +29 -30
- package/src/autocomplete/createAutocompleteState.d.ts +19 -17
- package/src/autocomplete/createAutocompleteState.ts +24 -30
- package/src/autocomplete/index.d.ts +6 -2
- package/src/autocomplete/index.ts +1 -1
- package/src/calendar/IncompleteDate.ts +430 -0
- package/src/calendar/createCalendarState.d.ts +139 -117
- package/src/calendar/createCalendarState.ts +308 -94
- package/src/calendar/createDateFieldState.d.ts +130 -95
- package/src/calendar/createDateFieldState.ts +447 -334
- package/src/calendar/createDatePickerState.ts +347 -0
- package/src/calendar/createRangeCalendarState.d.ts +154 -129
- package/src/calendar/createRangeCalendarState.ts +411 -85
- 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 +23 -12
- package/src/checkbox/createCheckboxGroupState.d.ts +57 -55
- package/src/checkbox/createCheckboxGroupState.ts +20 -29
- 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 +6 -6
- package/src/collections/createListState.d.ts +73 -58
- package/src/collections/createListState.ts +67 -35
- package/src/collections/createMenuState.d.ts +36 -31
- package/src/collections/createMenuState.ts +21 -12
- package/src/collections/createSelectionState.d.ts +78 -65
- package/src/collections/createSelectionState.ts +66 -52
- package/src/collections/getChildNodes.ts +98 -0
- package/src/collections/index.d.ts +38 -6
- package/src/collections/index.ts +14 -10
- package/src/collections/types.d.ts +101 -101
- package/src/collections/types.ts +12 -12
- package/src/color/Color.d.ts +20 -5
- package/src/color/Color.ts +357 -254
- package/src/color/createColorAreaState.d.ts +67 -65
- package/src/color/createColorAreaState.ts +21 -13
- package/src/color/createColorFieldState.d.ts +46 -44
- package/src/color/createColorFieldState.ts +285 -149
- package/src/color/createColorSliderState.d.ts +58 -56
- package/src/color/createColorSliderState.ts +45 -14
- package/src/color/createColorWheelState.d.ts +42 -40
- package/src/color/createColorWheelState.ts +101 -64
- package/src/color/getColorChannels.ts +7 -5
- package/src/color/index.d.ts +36 -7
- package/src/color/index.ts +6 -9
- package/src/color/types.d.ts +68 -63
- package/src/color/types.ts +11 -19
- package/src/combobox/createComboBoxState.d.ts +107 -105
- package/src/combobox/createComboBoxState.ts +184 -89
- package/src/combobox/index.d.ts +10 -2
- package/src/combobox/index.ts +1 -1
- package/src/data/createAsyncList.ts +89 -63
- package/src/data/createListData.ts +67 -67
- package/src/data/createTreeData.ts +304 -91
- package/src/data/index.ts +3 -3
- package/src/datepicker/index.ts +6 -10
- package/src/disclosure/createDisclosureState.d.ts +47 -43
- package/src/disclosure/createDisclosureState.ts +7 -21
- 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 +12 -14
- package/src/dnd/createDraggableCollectionState.d.ts +52 -41
- package/src/dnd/createDraggableCollectionState.ts +14 -21
- package/src/dnd/createDropState.d.ts +64 -45
- package/src/dnd/createDropState.ts +22 -32
- package/src/dnd/createDroppableCollectionState.d.ts +88 -59
- package/src/dnd/createDroppableCollectionState.ts +40 -43
- package/src/dnd/index.d.ts +55 -6
- package/src/dnd/index.ts +6 -18
- package/src/dnd/types.d.ts +170 -157
- package/src/dnd/types.ts +24 -22
- package/src/form/createFormValidationState.d.ts +47 -45
- package/src/form/createFormValidationState.ts +30 -63
- package/src/form/index.d.ts +16 -2
- package/src/form/index.ts +1 -1
- package/src/grid/createGridState.d.ts +7 -4
- package/src/grid/createGridState.ts +78 -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 +34 -18
- package/src/index.d.ts +311 -26
- package/src/index.ts +59 -89
- package/src/menu/index.ts +2 -4
- package/src/numberfield/createNumberFieldState.d.ts +56 -54
- package/src/numberfield/createNumberFieldState.ts +26 -31
- package/src/numberfield/index.d.ts +6 -2
- package/src/numberfield/index.ts +1 -1
- package/src/overlays/createOverlayTriggerState.d.ts +22 -20
- package/src/overlays/createOverlayTriggerState.ts +3 -4
- package/src/overlays/index.d.ts +6 -2
- package/src/overlays/index.ts +1 -1
- package/src/radio/createRadioGroupState.d.ts +54 -52
- package/src/radio/createRadioGroupState.ts +27 -29
- 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 +5 -11
- 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 +42 -29
- package/src/select/index.d.ts +2 -2
- package/src/select/index.ts +1 -5
- package/src/selection/Selection.ts +28 -0
- package/src/selection/SelectionManager.ts +526 -0
- package/src/selection/createMultipleSelectionState.ts +247 -0
- package/src/selection/index.ts +12 -7
- package/src/slider/createSliderState.d.ts +60 -60
- package/src/slider/createSliderState.ts +55 -33
- 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 +266 -99
- package/src/table/createTableColumnResizeState.ts +242 -0
- package/src/table/createTableState.d.ts +7 -4
- package/src/table/createTableState.ts +30 -7
- package/src/table/createTreeGridState.ts +146 -0
- package/src/table/index.d.ts +14 -4
- package/src/table/index.ts +13 -3
- package/src/table/types.d.ts +98 -92
- package/src/table/types.ts +83 -13
- package/src/tabs/createTabListState.d.ts +59 -57
- package/src/tabs/createTabListState.ts +34 -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 -86
- package/src/toast/createToastState.ts +90 -52
- package/src/toast/index.d.ts +12 -2
- package/src/toast/index.ts +2 -1
- package/src/toggle/createToggleGroupState.ts +11 -21
- 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 +2 -6
- package/src/tooltip/createTooltipTriggerState.d.ts +17 -17
- package/src/tooltip/createTooltipTriggerState.ts +12 -11
- package/src/tooltip/index.d.ts +7 -2
- package/src/tooltip/index.ts +1 -1
- package/src/tree/TreeCollection.d.ts +26 -23
- package/src/tree/TreeCollection.ts +29 -22
- package/src/tree/createTreeState.d.ts +7 -4
- package/src/tree/createTreeState.ts +70 -41
- package/src/tree/index.d.ts +10 -4
- package/src/tree/index.ts +3 -3
- package/src/tree/types.d.ts +131 -126
- package/src/tree/types.ts +30 -13
- 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
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. */
|
|
@@ -174,10 +174,12 @@ export interface DroppableCollectionReorderEvent {
|
|
|
174
174
|
/** The drop target. */
|
|
175
175
|
target: ItemDropTarget;
|
|
176
176
|
}
|
|
177
|
+
/** A drag type: either a MIME type string or a symbol such as the directory drag type. */
|
|
178
|
+
export type DragType = string | symbol;
|
|
177
179
|
/** Interface for checking drag types. */
|
|
178
180
|
export interface DragTypes {
|
|
179
181
|
/** Returns whether the drag contains data of the given type. */
|
|
180
|
-
has(type:
|
|
182
|
+
has(type: DragType | DragType[]): boolean;
|
|
181
183
|
}
|
|
182
184
|
/** Delegate for determining drop targets within a collection. */
|
|
183
185
|
export interface DropTargetDelegate {
|
|
@@ -214,7 +216,7 @@ export interface DroppableCollectionUtilityOptions {
|
|
|
214
216
|
* The drag types that the droppable collection accepts.
|
|
215
217
|
* @default 'all'
|
|
216
218
|
*/
|
|
217
|
-
acceptedDragTypes?:
|
|
219
|
+
acceptedDragTypes?: "all" | Array<string | symbol>;
|
|
218
220
|
/** Handler that is called when external items are dropped "between" items. */
|
|
219
221
|
onInsert?: (e: DroppableCollectionInsertDropEvent) => void;
|
|
220
222
|
/** 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";
|
package/dist/grid/types.d.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Grid collection types for Table and GridList components.
|
|
3
3
|
* Based on @react-types/grid.
|
|
4
4
|
*/
|
|
5
|
-
import type { Key, FocusStrategy } from
|
|
5
|
+
import type { Key, FocusStrategy, Selection, SelectionBehavior } from "../collections/types";
|
|
6
6
|
/**
|
|
7
7
|
* Represents the type of a grid node.
|
|
8
8
|
*/
|
|
9
|
-
export type GridNodeType =
|
|
9
|
+
export type GridNodeType = "item" | "cell" | "column" | "rowheader" | "headerrow" | "section" | "content" | "placeholder";
|
|
10
10
|
/**
|
|
11
11
|
* Represents a node in a grid collection.
|
|
12
12
|
*/
|
|
@@ -31,6 +31,10 @@ export interface GridNode<T = unknown> {
|
|
|
31
31
|
prevKey?: Key | null;
|
|
32
32
|
/** Next sibling key (visible order). */
|
|
33
33
|
nextKey?: Key | null;
|
|
34
|
+
/** Key of the first child node, if any (used by tree grids). */
|
|
35
|
+
firstChildKey?: Key | null;
|
|
36
|
+
/** Key of the last child node, if any (used by tree grids). */
|
|
37
|
+
lastChildKey?: Key | null;
|
|
34
38
|
/** Whether this node has child nodes. */
|
|
35
39
|
hasChildNodes: boolean;
|
|
36
40
|
/** Child nodes (cells for rows, rows for sections). */
|
|
@@ -38,7 +42,7 @@ export interface GridNode<T = unknown> {
|
|
|
38
42
|
/** Whether this item is disabled. */
|
|
39
43
|
isDisabled?: boolean;
|
|
40
44
|
/** ARIA label for this node. */
|
|
41
|
-
|
|
45
|
+
"aria-label"?: string;
|
|
42
46
|
/** Additional props for the node. */
|
|
43
47
|
props?: Record<string, unknown>;
|
|
44
48
|
/** Column index for cells. */
|
|
@@ -99,6 +103,8 @@ export interface GridState<T, C extends GridCollection<T> = GridCollection<T>> {
|
|
|
99
103
|
readonly collection: C;
|
|
100
104
|
/** Keys of disabled rows. */
|
|
101
105
|
readonly disabledKeys: Set<Key>;
|
|
106
|
+
/** Whether `disabledKeys` applies to all interactions, or only selection. */
|
|
107
|
+
readonly disabledBehavior: "selection" | "all";
|
|
102
108
|
/** Whether keyboard navigation is disabled. */
|
|
103
109
|
readonly isKeyboardNavigationDisabled: boolean;
|
|
104
110
|
/** Currently focused key. */
|
|
@@ -108,9 +114,13 @@ export interface GridState<T, C extends GridCollection<T> = GridCollection<T>> {
|
|
|
108
114
|
/** Whether the grid is focused. */
|
|
109
115
|
readonly isFocused: boolean;
|
|
110
116
|
/** The selection mode. */
|
|
111
|
-
readonly selectionMode:
|
|
117
|
+
readonly selectionMode: "none" | "single" | "multiple";
|
|
118
|
+
/** The selection behavior. */
|
|
119
|
+
readonly selectionBehavior: SelectionBehavior;
|
|
120
|
+
/** Whether empty selection is disallowed. */
|
|
121
|
+
readonly disallowEmptySelection: boolean;
|
|
112
122
|
/** The currently selected keys. */
|
|
113
|
-
readonly selectedKeys:
|
|
123
|
+
readonly selectedKeys: "all" | Set<Key>;
|
|
114
124
|
/** Check if a key is selected. */
|
|
115
125
|
isSelected(key: Key): boolean;
|
|
116
126
|
/** Check if a key is disabled. */
|
|
@@ -119,10 +129,14 @@ export interface GridState<T, C extends GridCollection<T> = GridCollection<T>> {
|
|
|
119
129
|
setFocusedKey(key: Key | null, childFocusStrategy?: FocusStrategy): void;
|
|
120
130
|
/** Set focused state. */
|
|
121
131
|
setFocused(isFocused: boolean): void;
|
|
132
|
+
/** Set the selection behavior. */
|
|
133
|
+
setSelectionBehavior(behavior: SelectionBehavior): void;
|
|
122
134
|
/** Toggle selection for a key. */
|
|
123
135
|
toggleSelection(key: Key): void;
|
|
124
136
|
/** Replace selection with a key. */
|
|
125
137
|
replaceSelection(key: Key): void;
|
|
138
|
+
/** Set multiple selected keys. */
|
|
139
|
+
setSelectedKeys(keys: Selection | Iterable<Key>): void;
|
|
126
140
|
/** Extend selection to a key (shift-click). */
|
|
127
141
|
extendSelection(toKey: Key): void;
|
|
128
142
|
/** Select all rows. */
|
|
@@ -142,18 +156,20 @@ export interface GridStateOptions<T, C extends GridCollection<T> = GridCollectio
|
|
|
142
156
|
collection: C;
|
|
143
157
|
/** Keys of disabled rows. */
|
|
144
158
|
disabledKeys?: Iterable<Key>;
|
|
159
|
+
/** Whether `disabledKeys` applies to all interactions, or only selection. @default "all" */
|
|
160
|
+
disabledBehavior?: "selection" | "all";
|
|
145
161
|
/** Focus mode: 'row' or 'cell'. */
|
|
146
|
-
focusMode?:
|
|
162
|
+
focusMode?: "row" | "cell";
|
|
147
163
|
/** Selection mode. */
|
|
148
|
-
selectionMode?:
|
|
164
|
+
selectionMode?: "none" | "single" | "multiple";
|
|
149
165
|
/** Selection behavior. */
|
|
150
|
-
selectionBehavior?:
|
|
166
|
+
selectionBehavior?: SelectionBehavior;
|
|
151
167
|
/** Whether empty selection is disallowed. */
|
|
152
168
|
disallowEmptySelection?: boolean;
|
|
153
169
|
/** Currently selected keys (controlled). */
|
|
154
|
-
selectedKeys?:
|
|
170
|
+
selectedKeys?: "all" | Iterable<Key>;
|
|
155
171
|
/** Default selected keys (uncontrolled). */
|
|
156
|
-
defaultSelectedKeys?:
|
|
172
|
+
defaultSelectedKeys?: "all" | Iterable<Key>;
|
|
157
173
|
/** Handler for selection changes. */
|
|
158
|
-
onSelectionChange?: (keys:
|
|
174
|
+
onSelectionChange?: (keys: "all" | Set<Key>) => void;
|
|
159
175
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
export { createToggleState, createToggleGroupState, type ToggleStateOptions, type ToggleState, type ToggleGroupProps, type ToggleGroupState, } from
|
|
2
|
-
export { createAutocompleteState, type AutocompleteState, type AutocompleteStateOptions, } from
|
|
3
|
-
export { createTextFieldState, type TextFieldStateOptions, type TextFieldState
|
|
4
|
-
export { createCheckboxGroupState, type CheckboxGroupProps, type CheckboxGroupState, } from
|
|
5
|
-
export { createRadioGroupState, radioGroupSyncVersion, type RadioGroupProps, type RadioGroupState, } from
|
|
6
|
-
export { createOverlayTriggerState, type OverlayTriggerProps, type OverlayTriggerState, } from
|
|
7
|
-
export { type Key, type SelectionMode, type SelectionBehavior, type Selection, type FocusStrategy, type DisabledBehavior, type CollectionNode, type Collection, type ItemProps, type SectionProps, type CollectionBase, type SingleSelection, type MultipleSelection, ListCollection, createListCollection, createSelectionState, type SelectionStateProps, type SelectionState, createListState, createSingleSelectListState, type ListStateProps, type ListState, type SingleSelectListStateProps, type SingleSelectListState, createMenuState, createMenuTriggerState, type MenuStateProps, type MenuState, type MenuTriggerStateProps, type MenuTriggerState, } from
|
|
8
|
-
export { useMultipleSelectionState, type MultipleSelectionStateProps, type MultipleSelectionState, } from
|
|
9
|
-
export { useMenuTriggerState
|
|
10
|
-
export { useDateFieldState, useDatePickerState, useDateRangePickerState, useTimeFieldState, type DateFieldStateOptions, type DatePickerStateOptions, type DateRangePickerStateOptions, type TimeFieldStateOptions, type SegmentType, } from
|
|
11
|
-
export { createSelectState, type SelectStateProps, type SelectState
|
|
12
|
-
export { createComboBoxState, defaultContainsFilter, type ComboBoxState, type ComboBoxStateProps, type FilterFn, type MenuTriggerAction, } from
|
|
13
|
-
export { createTabListState, type TabListStateProps, type TabListState, type KeyboardActivation, type TabOrientation, } from
|
|
14
|
-
export { createNumberFieldState, type NumberFieldStateProps, type NumberFieldState, } from
|
|
15
|
-
export { createSearchFieldState, type SearchFieldStateProps, type SearchFieldState, } from
|
|
16
|
-
export { createSliderState, type SliderStateProps, type SliderState, type SliderOrientation, } from
|
|
17
|
-
export { createTooltipTriggerState, resetTooltipState, type TooltipTriggerProps, type TooltipTriggerState, } from
|
|
18
|
-
export { createToastState, createToastQueue, ToastQueue, Timer, type ToastOptions, type QueuedToast, type ToastQueueOptions, type ToastStateProps, type ToastState, } from
|
|
19
|
-
export { createDisclosureState, createDisclosureGroupState, type DisclosureStateProps, type DisclosureState, type DisclosureGroupStateProps, type DisclosureGroupState, type Key as DisclosureKey, } from
|
|
20
|
-
export { createCalendarState, type CalendarStateProps, type CalendarState, type ValidationState, createRangeCalendarState, type RangeCalendarStateProps, type RangeCalendarState, type DateRange, type RangeValue, createDateFieldState, type DateFieldStateProps, type DateFieldState, type DateSegment, type DateSegmentType, createTimeFieldState, type TimeFieldStateProps, type TimeFieldState, type TimeSegment, type TimeSegmentType, type TimeValue, type CalendarDate, type CalendarDateTime, type ZonedDateTime, type DateValue, type Time, today, now, getLocalTimeZone, parseDate, parseDateTime, parseTime, parseAbsolute, parseAbsoluteToLocal, parseZonedDateTime, toCalendarDate, toCalendarDateTime, toZoned, toTime, CalendarDateClass, CalendarDateTimeClass, ZonedDateTimeClass, TimeClass, DateFormatter, isSameDay, isSameMonth, isSameYear, isToday, isWeekend, startOfMonth, endOfMonth, startOfWeek, endOfWeek, startOfYear, endOfYear, getWeeksInMonth, getDayOfWeek, minDate, maxDate, } from
|
|
21
|
-
export { createGridState, type GridState, type GridStateOptions, type GridCollection, type GridNode, type GridNodeType, } from
|
|
22
|
-
export { createTableState, TableCollection, createTableCollection, type TableState, type TableStateOptions, type ITableCollection, type SortDescriptor, type SortDirection, type Sortable, type ColumnDefinition, type RowDefinition, type TableCollectionOptions, } from
|
|
23
|
-
export { createTreeState, TreeCollection, createTreeCollection, type TreeState, type TreeStateOptions, type TreeCollectionInterface, type TreeNode, type TreeItemData, } from
|
|
24
|
-
export { type Color, type ColorFormat, type ColorSpace, type ColorChannel, type ColorChannelRange, type ColorAxes, parseColor, normalizeColor, createRGBColor, createHSLColor, createHSBColor, createColorSliderState, type ColorSliderStateOptions, type ColorSliderState, createColorAreaState, type ColorAreaStateOptions, type ColorAreaState, createColorWheelState, type ColorWheelStateOptions, type ColorWheelState, createColorFieldState, type ColorFieldStateOptions, type ColorFieldState, } from
|
|
25
|
-
export { type DropOperation, type DragItem, type DragDropEvent, type DragStartEvent, type DragMoveEvent, type DragEndEvent, type DropEnterEvent, type DropMoveEvent, type DropActivateEvent, type DropExitEvent, type TextDropItem, type FileDropItem, type DirectoryDropItem, type DropItem, type DropEvent, type DropPosition, type RootDropTarget, type ItemDropTarget, type DropTarget, type DroppableCollectionEnterEvent, type DroppableCollectionMoveEvent, type DroppableCollectionActivateEvent, type DroppableCollectionExitEvent, type DroppableCollectionDropEvent, type DroppableCollectionInsertDropEvent, type DroppableCollectionRootDropEvent, type DroppableCollectionOnItemDropEvent, type DroppableCollectionReorderEvent, type DragTypes, type DropTargetDelegate, type DraggableCollectionStartEvent, type DraggableCollectionMoveEvent, type DraggableCollectionEndEvent, type DragPreviewRenderer, type DroppableCollectionUtilityOptions, type DroppableCollectionBaseProps, type DroppableCollectionProps, type DraggableCollectionProps, createDragState, type DragStateOptions, type DragState, createDropState, type DropStateOptions, type DropState, createDraggableCollectionState, type DraggableCollectionStateOptions, type DraggableCollectionState, createDroppableCollectionState, DIRECTORY_DRAG_TYPE, type DroppableCollectionStateOptions, type DroppableCollectionState, } from
|
|
26
|
-
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
|
|
27
|
-
export { createIsSSR, createId, canUseDOM, isServer } from
|
|
28
|
-
export { createListData, type ListOptions, type ListData, createTreeData, type TreeOptions, type TreeData, type TreeDataNode, createAsyncList, type AsyncListOptions, type AsyncListData, type AsyncListLoadFunction, type AsyncListLoadOptions, type AsyncListStateUpdate, type LoadingState, } from
|
|
29
|
-
export { getColorChannels } from
|
|
30
|
-
export {
|
|
1
|
+
export { createToggleState, createToggleGroupState, type ToggleStateOptions, type ToggleState, type ToggleGroupProps, type ToggleGroupState, } from "./toggle";
|
|
2
|
+
export { createAutocompleteState, type AutocompleteState, type AutocompleteStateOptions, } from "./autocomplete";
|
|
3
|
+
export { createTextFieldState, type TextFieldStateOptions, type TextFieldState } from "./textfield";
|
|
4
|
+
export { createCheckboxGroupState, type CheckboxGroupProps, type CheckboxGroupState, } from "./checkbox";
|
|
5
|
+
export { createRadioGroupState, radioGroupSyncVersion, type RadioGroupProps, type RadioGroupState, } from "./radio";
|
|
6
|
+
export { createOverlayTriggerState, type OverlayTriggerProps, type OverlayTriggerState, } from "./overlays";
|
|
7
|
+
export { type Key, type SelectionMode, type SelectionBehavior, type Selection, type FocusStrategy, type DisabledBehavior, type CollectionNode, type Collection, type ItemProps, type SectionProps, type CollectionBase, type SingleSelection, type MultipleSelection, ListCollection, createListCollection, createSelectionState, type SelectionStateProps, type SelectionState, type SelectionPressEvent, createListState, createSingleSelectListState, type ListStateProps, type ListState, type SingleSelectListStateProps, type SingleSelectListState, createMenuState, createMenuTriggerState, type MenuStateProps, type MenuState, type MenuTriggerStateProps, type MenuTriggerState, } from "./collections";
|
|
8
|
+
export { useMultipleSelectionState, type MultipleSelectionStateProps, type MultipleSelectionState, SelectionManager, type SelectionManagerOptions, type LayoutDelegate, } from "./selection";
|
|
9
|
+
export { useMenuTriggerState } from "./menu";
|
|
10
|
+
export { useDateFieldState, useDatePickerState, useDateRangePickerState, useTimeFieldState, type DateFieldStateOptions, type DatePickerStateOptions, type DateRangePickerStateOptions, type TimeFieldStateOptions, type SegmentType, } from "./datepicker";
|
|
11
|
+
export { createSelectState, type SelectStateProps, type SelectState } from "./select";
|
|
12
|
+
export { createComboBoxState, defaultContainsFilter, type ComboBoxState, type ComboBoxStateProps, type FilterFn, type MenuTriggerAction, } from "./combobox";
|
|
13
|
+
export { createTabListState, type TabListStateProps, type TabListState, type KeyboardActivation, type TabOrientation, } from "./tabs";
|
|
14
|
+
export { createNumberFieldState, type NumberFieldStateProps, type NumberFieldState, } from "./numberfield";
|
|
15
|
+
export { createSearchFieldState, type SearchFieldStateProps, type SearchFieldState, } from "./searchfield";
|
|
16
|
+
export { createSliderState, type SliderStateProps, type SliderState, type SliderOrientation, } from "./slider";
|
|
17
|
+
export { createTooltipTriggerState, resetTooltipState, type TooltipTriggerProps, type TooltipTriggerState, } from "./tooltip";
|
|
18
|
+
export { createToastState, createToastQueue, ToastQueue, Timer, type ToastOptions, type QueuedToast, type ToastQueueOptions, type ToastAction, type ToastStateProps, type ToastState, } from "./toast";
|
|
19
|
+
export { createDisclosureState, createDisclosureGroupState, type DisclosureStateProps, type DisclosureState, type DisclosureGroupStateProps, type DisclosureGroupState, type Key as DisclosureKey, } from "./disclosure";
|
|
20
|
+
export { createCalendarState, type CalendarStateProps, type CalendarState, type CalendarSelectionMode, type CalendarValueType, type ValidationState, type CalendarPageBehavior, type CalendarSelectionAlignment, type CalendarDayOfWeek, createRangeCalendarState, type RangeCalendarStateProps, type RangeCalendarState, type DateRange, type RangeValue, createDateFieldState, type DateFieldStateProps, type DateFieldState, type DateSegment, type DateSegmentType, createTimeFieldState, type TimeFieldStateProps, type TimeFieldState, type TimeSegment, type TimeSegmentType, type TimeValue, createDatePickerState, type DatePickerState, type CalendarDate, type CalendarDateTime, type ZonedDateTime, type DateValue, type Time, type Calendar, type CalendarIdentifier, type AnyCalendarDate, createCalendar, GregorianCalendar, today, now, getLocalTimeZone, parseDate, parseDateTime, parseTime, parseAbsolute, parseAbsoluteToLocal, parseZonedDateTime, toCalendarDate, toCalendarDateTime, toZoned, toTime, CalendarDateClass, CalendarDateTimeClass, ZonedDateTimeClass, TimeClass, DateFormatter, isSameDay, isSameMonth, isSameYear, isToday, isWeekend, startOfMonth, endOfMonth, startOfWeek, endOfWeek, startOfYear, endOfYear, getWeeksInMonth, getDayOfWeek, toCalendar, minDate, maxDate, } from "./calendar";
|
|
21
|
+
export { createGridState, type GridState, type GridStateOptions, type GridCollection, type GridNode, type GridNodeType, } from "./grid";
|
|
22
|
+
export { createTableState, createTreeGridState, createTableColumnResizeState, TableCollection, createTableCollection, type TableState, type TableStateOptions, type ITableCollection, type TreeGridState, type TreeGridStateOptions, type SortDescriptor, type SortDirection, type Sortable, type ColumnDefinition, type RowDefinition, type TableCollectionOptions, type ColumnSize, type ColumnResizeDefinition, type TableColumnResizeStateProps, type TableColumnResizeState, } from "./table";
|
|
23
|
+
export { createTreeState, TreeCollection, createTreeCollection, type TreeState, type TreeStateOptions, type TreeCollectionInterface, type TreeNode, type TreeItemData, } from "./tree";
|
|
24
|
+
export { type Color, type ColorFormat, type ColorSpace, type ColorChannel, type ColorChannelRange, type ColorAxes, parseColor, normalizeColor, createRGBColor, createHSLColor, createHSBColor, createColorSliderState, type ColorSliderStateOptions, type ColorSliderState, createColorAreaState, type ColorAreaStateOptions, type ColorAreaState, createColorWheelState, type ColorWheelStateOptions, type ColorWheelState, createColorFieldState, type ColorFieldStateOptions, type ColorFieldState, } from "./color";
|
|
25
|
+
export { type DropOperation, type DragItem, type DragDropEvent, type DragStartEvent, type DragMoveEvent, type DragEndEvent, type DropEnterEvent, type DropMoveEvent, type DropActivateEvent, type DropExitEvent, type TextDropItem, type FileDropItem, type DirectoryDropItem, type DropItem, type DropEvent, type DropPosition, type RootDropTarget, type ItemDropTarget, type DropTarget, type DroppableCollectionEnterEvent, type DroppableCollectionMoveEvent, type DroppableCollectionActivateEvent, type DroppableCollectionExitEvent, type DroppableCollectionDropEvent, type DroppableCollectionInsertDropEvent, type DroppableCollectionRootDropEvent, type DroppableCollectionOnItemDropEvent, type DroppableCollectionReorderEvent, type DragType, type DragTypes, type DropTargetDelegate, type DraggableCollectionStartEvent, type DraggableCollectionMoveEvent, type DraggableCollectionEndEvent, type DragPreviewRenderer, type DroppableCollectionUtilityOptions, type DroppableCollectionBaseProps, type DroppableCollectionProps, type DraggableCollectionProps, createDragState, type DragStateOptions, type DragState, createDropState, type DropStateOptions, type DropState, createDraggableCollectionState, type DraggableCollectionStateOptions, type DraggableCollectionState, createDroppableCollectionState, DIRECTORY_DRAG_TYPE, type DroppableCollectionStateOptions, type DroppableCollectionState, } from "./dnd";
|
|
26
|
+
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 "./form";
|
|
27
|
+
export { createIsSSR, createId, canUseDOM, isServer } from "./ssr";
|
|
28
|
+
export { createListData, type ListOptions, type ListData, createTreeData, type TreeOptions, type TreeData, type TreeDataNode, createAsyncList, type AsyncListOptions, type AsyncListData, type AsyncListLoadFunction, type AsyncListLoadOptions, type AsyncListStateUpdate, type LoadingState, } from "./data";
|
|
29
|
+
export { getColorChannels } from "./color/getColorChannels";
|
|
30
|
+
export { createStepListState, type StepListStateProps, type StepListState } from "./steplist";
|
|
31
|
+
export { access, isAccessor, type MaybeAccessor, type MaybeAccessorValue } from "./utils";
|