@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/src/dnd/types.d.ts
CHANGED
|
@@ -4,261 +4,274 @@
|
|
|
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;
|
|
11
11
|
}
|
|
12
12
|
/** Base event for drag/drop operations with coordinates. */
|
|
13
13
|
export interface DragDropEvent {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
/** The x coordinate of the event, relative to the target element. */
|
|
15
|
+
x: number;
|
|
16
|
+
/** The y coordinate of the event, relative to the target element. */
|
|
17
|
+
y: number;
|
|
18
18
|
}
|
|
19
19
|
/** Event fired when a drag operation starts. */
|
|
20
20
|
export interface DragStartEvent extends DragDropEvent {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
/** The event type. */
|
|
22
|
+
type: "dragstart";
|
|
23
23
|
}
|
|
24
24
|
/** Event fired as a drag moves. */
|
|
25
25
|
export interface DragMoveEvent extends DragDropEvent {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
/** The event type. */
|
|
27
|
+
type: "dragmove";
|
|
28
28
|
}
|
|
29
29
|
/** Event fired when a drag operation ends. */
|
|
30
30
|
export interface DragEndEvent extends DragDropEvent {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
/** The event type. */
|
|
32
|
+
type: "dragend";
|
|
33
|
+
/** The drop operation that occurred. */
|
|
34
|
+
dropOperation: DropOperation;
|
|
35
35
|
}
|
|
36
36
|
/** Event fired when a drag enters a drop target. */
|
|
37
37
|
export interface DropEnterEvent extends DragDropEvent {
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
/** The event 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
|
-
|
|
44
|
-
|
|
43
|
+
/** The event 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
|
-
|
|
49
|
-
|
|
48
|
+
/** The event 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
|
-
|
|
54
|
-
|
|
53
|
+
/** The event type. */
|
|
54
|
+
type: "dropexit";
|
|
55
55
|
}
|
|
56
56
|
/** A text item in a drop operation. */
|
|
57
57
|
export interface TextDropItem {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
/** The item kind. */
|
|
59
|
+
kind: "text";
|
|
60
|
+
/** The drag types available for this item. */
|
|
61
|
+
types: Set<string>;
|
|
62
|
+
/** Returns the data for the given type as a string. */
|
|
63
|
+
getText(type: string): Promise<string>;
|
|
64
64
|
}
|
|
65
65
|
/** A file item in a drop operation. */
|
|
66
66
|
export interface FileDropItem {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
/** The item kind. */
|
|
68
|
+
kind: "file";
|
|
69
|
+
/** The file type (usually a mime type). */
|
|
70
|
+
type: string;
|
|
71
|
+
/** The file name. */
|
|
72
|
+
name: string;
|
|
73
|
+
/** Returns the contents of the file as a blob. */
|
|
74
|
+
getFile(): Promise<File>;
|
|
75
|
+
/** Returns the contents of the file as a string. */
|
|
76
|
+
getText(): Promise<string>;
|
|
77
77
|
}
|
|
78
78
|
/** A directory item in a drop operation. */
|
|
79
79
|
export interface DirectoryDropItem {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
/** The item kind. */
|
|
81
|
+
kind: "directory";
|
|
82
|
+
/** The directory name. */
|
|
83
|
+
name: string;
|
|
84
|
+
/** Returns the entries contained within the directory. */
|
|
85
|
+
getEntries(): AsyncIterable<FileDropItem | DirectoryDropItem>;
|
|
86
86
|
}
|
|
87
87
|
/** Union of all drop item types. */
|
|
88
88
|
export type DropItem = TextDropItem | FileDropItem | DirectoryDropItem;
|
|
89
89
|
/** Event fired when items are dropped. */
|
|
90
90
|
export interface DropEvent extends DragDropEvent {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
/** The event type. */
|
|
92
|
+
type: "drop";
|
|
93
|
+
/** The drop operation that should occur. */
|
|
94
|
+
dropOperation: DropOperation;
|
|
95
|
+
/** The dropped items. */
|
|
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
|
-
|
|
103
|
-
|
|
102
|
+
/** The drop target type. */
|
|
103
|
+
type: "root";
|
|
104
104
|
}
|
|
105
105
|
/** Drop target representing an item in a collection. */
|
|
106
106
|
export interface ItemDropTarget {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
/** The drop target type. */
|
|
108
|
+
type: "item";
|
|
109
|
+
/** The item key. */
|
|
110
|
+
key: string | number;
|
|
111
|
+
/** The drop position relative to the item. */
|
|
112
|
+
dropPosition: DropPosition;
|
|
113
113
|
}
|
|
114
114
|
/** Union of drop target types. */
|
|
115
115
|
export type DropTarget = RootDropTarget | ItemDropTarget;
|
|
116
116
|
/** Event fired when a drag enters a droppable collection. */
|
|
117
117
|
export interface DroppableCollectionEnterEvent extends DropEnterEvent {
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
/** The drop target. */
|
|
119
|
+
target: DropTarget;
|
|
120
120
|
}
|
|
121
121
|
/** Event fired as a drag moves within a droppable collection. */
|
|
122
122
|
export interface DroppableCollectionMoveEvent extends DropMoveEvent {
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
/** The drop target. */
|
|
124
|
+
target: DropTarget;
|
|
125
125
|
}
|
|
126
126
|
/** Event fired when a drag is held over a droppable collection item. */
|
|
127
127
|
export interface DroppableCollectionActivateEvent extends DropActivateEvent {
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
/** The drop target. */
|
|
129
|
+
target: DropTarget;
|
|
130
130
|
}
|
|
131
131
|
/** Event fired when a drag exits a droppable collection. */
|
|
132
132
|
export interface DroppableCollectionExitEvent extends DropExitEvent {
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
/** The drop target. */
|
|
134
|
+
target: DropTarget;
|
|
135
135
|
}
|
|
136
136
|
/** Event fired when items are dropped on a droppable collection. */
|
|
137
137
|
export interface DroppableCollectionDropEvent extends DropEvent {
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
/** The drop target. */
|
|
139
|
+
target: DropTarget;
|
|
140
140
|
}
|
|
141
141
|
/** Event for inserting items between existing collection items. */
|
|
142
142
|
export interface DroppableCollectionInsertDropEvent {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
143
|
+
/** The dropped items. */
|
|
144
|
+
items: DropItem[];
|
|
145
|
+
/** The drop operation that should occur. */
|
|
146
|
+
dropOperation: DropOperation;
|
|
147
|
+
/** The drop target. */
|
|
148
|
+
target: ItemDropTarget;
|
|
149
149
|
}
|
|
150
150
|
/** Event for dropping on the root of a collection. */
|
|
151
151
|
export interface DroppableCollectionRootDropEvent {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
/** The dropped items. */
|
|
153
|
+
items: DropItem[];
|
|
154
|
+
/** The drop operation that should occur. */
|
|
155
|
+
dropOperation: DropOperation;
|
|
156
156
|
}
|
|
157
157
|
/** Event for dropping on a specific item. */
|
|
158
158
|
export interface DroppableCollectionOnItemDropEvent {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
159
|
+
/** The dropped items. */
|
|
160
|
+
items: DropItem[];
|
|
161
|
+
/** The drop operation that should occur. */
|
|
162
|
+
dropOperation: DropOperation;
|
|
163
|
+
/** Whether the drag originated within the same collection as the drop. */
|
|
164
|
+
isInternal: boolean;
|
|
165
|
+
/** The drop target. */
|
|
166
|
+
target: ItemDropTarget;
|
|
167
167
|
}
|
|
168
168
|
/** Event for reordering items within a collection. */
|
|
169
169
|
export interface DroppableCollectionReorderEvent {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
170
|
+
/** The keys of the items that were reordered. */
|
|
171
|
+
keys: Set<string | number>;
|
|
172
|
+
/** The drop operation that should occur. */
|
|
173
|
+
dropOperation: DropOperation;
|
|
174
|
+
/** The drop target. */
|
|
175
|
+
target: ItemDropTarget;
|
|
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
|
-
|
|
180
|
-
|
|
181
|
+
/** Returns whether the drag contains data of the given type. */
|
|
182
|
+
has(type: DragType | DragType[]): boolean;
|
|
181
183
|
}
|
|
182
184
|
/** Delegate for determining drop targets within a collection. */
|
|
183
185
|
export interface DropTargetDelegate {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
186
|
+
/**
|
|
187
|
+
* Returns a drop target within a collection for the given coordinates.
|
|
188
|
+
* @param x - X coordinate relative to the collection container
|
|
189
|
+
* @param y - Y coordinate relative to the collection container
|
|
190
|
+
* @param isValidDropTarget - Function to check if a target is valid
|
|
191
|
+
*/
|
|
192
|
+
getDropTargetFromPoint(
|
|
193
|
+
x: number,
|
|
194
|
+
y: number,
|
|
195
|
+
isValidDropTarget: (target: DropTarget) => boolean,
|
|
196
|
+
): DropTarget | null;
|
|
191
197
|
}
|
|
192
198
|
/** Event fired when a collection drag starts. */
|
|
193
199
|
export interface DraggableCollectionStartEvent extends DragStartEvent {
|
|
194
|
-
|
|
195
|
-
|
|
200
|
+
/** The keys of the items that were dragged. */
|
|
201
|
+
keys: Set<string | number>;
|
|
196
202
|
}
|
|
197
203
|
/** Event fired as a collection drag moves. */
|
|
198
204
|
export interface DraggableCollectionMoveEvent extends DragMoveEvent {
|
|
199
|
-
|
|
200
|
-
|
|
205
|
+
/** The keys of the items that were dragged. */
|
|
206
|
+
keys: Set<string | number>;
|
|
201
207
|
}
|
|
202
208
|
/** Event fired when a collection drag ends. */
|
|
203
209
|
export interface DraggableCollectionEndEvent extends DragEndEvent {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
210
|
+
/** The keys of the items that were dragged. */
|
|
211
|
+
keys: Set<string | number>;
|
|
212
|
+
/** Whether the drop ended within the same collection as it originated. */
|
|
213
|
+
isInternal: boolean;
|
|
208
214
|
}
|
|
209
215
|
/** Function to render a custom drag preview. */
|
|
210
|
-
export type DragPreviewRenderer = (
|
|
216
|
+
export type DragPreviewRenderer = (
|
|
217
|
+
items: DragItem[],
|
|
218
|
+
callback: (node: HTMLElement | null, x?: number, y?: number) => void,
|
|
219
|
+
) => void;
|
|
211
220
|
/** Props for droppable collection utility handlers. */
|
|
212
221
|
export interface DroppableCollectionUtilityOptions {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
222
|
+
/**
|
|
223
|
+
* The drag types that the droppable collection accepts.
|
|
224
|
+
* @default 'all'
|
|
225
|
+
*/
|
|
226
|
+
acceptedDragTypes?: "all" | Array<string | symbol>;
|
|
227
|
+
/** Handler that is called when external items are dropped "between" items. */
|
|
228
|
+
onInsert?: (e: DroppableCollectionInsertDropEvent) => void;
|
|
229
|
+
/** Handler that is called when external items are dropped on the collection's root. */
|
|
230
|
+
onRootDrop?: (e: DroppableCollectionRootDropEvent) => void;
|
|
231
|
+
/** Handler that is called when items are dropped "on" an item. */
|
|
232
|
+
onItemDrop?: (e: DroppableCollectionOnItemDropEvent) => void;
|
|
233
|
+
/** Handler that is called when items are reordered within the collection. */
|
|
234
|
+
onReorder?: (e: DroppableCollectionReorderEvent) => void;
|
|
235
|
+
/** Handler that is called when items are moved within the source collection. */
|
|
236
|
+
onMove?: (e: DroppableCollectionReorderEvent) => void;
|
|
237
|
+
/** A function returning whether a given target is a valid "on" drop target. */
|
|
238
|
+
shouldAcceptItemDrop?: (target: ItemDropTarget, types: DragTypes) => boolean;
|
|
230
239
|
}
|
|
231
240
|
/** Base props for droppable collections. */
|
|
232
241
|
export interface DroppableCollectionBaseProps {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
242
|
+
/** Handler that is called when a valid drag enters a drop target. */
|
|
243
|
+
onDropEnter?: (e: DroppableCollectionEnterEvent) => void;
|
|
244
|
+
/** Handler that is called after a valid drag is held over a drop target. */
|
|
245
|
+
onDropActivate?: (e: DroppableCollectionActivateEvent) => void;
|
|
246
|
+
/** Handler that is called when a valid drag exits a drop target. */
|
|
247
|
+
onDropExit?: (e: DroppableCollectionExitEvent) => void;
|
|
248
|
+
/** Handler that is called when a valid drag is dropped on a drop target. */
|
|
249
|
+
onDrop?: (e: DroppableCollectionDropEvent) => void;
|
|
250
|
+
/** A function returning the drop operation to be performed. */
|
|
251
|
+
getDropOperation?: (
|
|
252
|
+
target: DropTarget,
|
|
253
|
+
types: DragTypes,
|
|
254
|
+
allowedOperations: DropOperation[],
|
|
255
|
+
) => DropOperation;
|
|
243
256
|
}
|
|
244
257
|
/** Combined props for droppable collections. */
|
|
245
|
-
export interface DroppableCollectionProps
|
|
246
|
-
}
|
|
258
|
+
export interface DroppableCollectionProps
|
|
259
|
+
extends DroppableCollectionUtilityOptions, DroppableCollectionBaseProps {}
|
|
247
260
|
/** Props for draggable collections. */
|
|
248
261
|
export interface DraggableCollectionProps<T = object> {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
264
|
-
//# sourceMappingURL=types.d.ts.map
|
|
262
|
+
/** Handler that is called when a drag operation is started. */
|
|
263
|
+
onDragStart?: (e: DraggableCollectionStartEvent) => void;
|
|
264
|
+
/** Handler that is called when the drag is moved. */
|
|
265
|
+
onDragMove?: (e: DraggableCollectionMoveEvent) => void;
|
|
266
|
+
/** Handler that is called when the drag operation ends. */
|
|
267
|
+
onDragEnd?: (e: DraggableCollectionEndEvent) => void;
|
|
268
|
+
/** A function that returns the items being dragged. */
|
|
269
|
+
getItems: (keys: Set<string | number>, items: T[]) => DragItem[];
|
|
270
|
+
/** The ref of the element that will be rendered as the drag preview. */
|
|
271
|
+
preview?: {
|
|
272
|
+
current: DragPreviewRenderer | null;
|
|
273
|
+
};
|
|
274
|
+
/** Function that returns the allowed drop operations. */
|
|
275
|
+
getAllowedDropOperations?: () => DropOperation[];
|
|
276
|
+
}
|
|
277
|
+
//# sourceMappingURL=types.d.ts.map
|
package/src/dnd/types.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/** The type of drop operation to perform. */
|
|
8
|
-
export type DropOperation =
|
|
8
|
+
export type DropOperation = "copy" | "link" | "move" | "cancel";
|
|
9
9
|
|
|
10
10
|
/** Drag item data as key-value pairs where keys are MIME types or custom types. */
|
|
11
11
|
export interface DragItem {
|
|
@@ -23,19 +23,19 @@ export interface DragDropEvent {
|
|
|
23
23
|
/** Event fired when a drag operation starts. */
|
|
24
24
|
export interface DragStartEvent extends DragDropEvent {
|
|
25
25
|
/** The event type. */
|
|
26
|
-
type:
|
|
26
|
+
type: "dragstart";
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/** Event fired as a drag moves. */
|
|
30
30
|
export interface DragMoveEvent extends DragDropEvent {
|
|
31
31
|
/** The event type. */
|
|
32
|
-
type:
|
|
32
|
+
type: "dragmove";
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/** Event fired when a drag operation ends. */
|
|
36
36
|
export interface DragEndEvent extends DragDropEvent {
|
|
37
37
|
/** The event type. */
|
|
38
|
-
type:
|
|
38
|
+
type: "dragend";
|
|
39
39
|
/** The drop operation that occurred. */
|
|
40
40
|
dropOperation: DropOperation;
|
|
41
41
|
}
|
|
@@ -43,31 +43,31 @@ export interface DragEndEvent extends DragDropEvent {
|
|
|
43
43
|
/** Event fired when a drag enters a drop target. */
|
|
44
44
|
export interface DropEnterEvent extends DragDropEvent {
|
|
45
45
|
/** The event type. */
|
|
46
|
-
type:
|
|
46
|
+
type: "dropenter";
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/** Event fired as a drag moves within a drop target. */
|
|
50
50
|
export interface DropMoveEvent extends DragDropEvent {
|
|
51
51
|
/** The event type. */
|
|
52
|
-
type:
|
|
52
|
+
type: "dropmove";
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/** Event fired when a drag is held over a drop target. */
|
|
56
56
|
export interface DropActivateEvent extends DragDropEvent {
|
|
57
57
|
/** The event type. */
|
|
58
|
-
type:
|
|
58
|
+
type: "dropactivate";
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/** Event fired when a drag exits a drop target. */
|
|
62
62
|
export interface DropExitEvent extends DragDropEvent {
|
|
63
63
|
/** The event type. */
|
|
64
|
-
type:
|
|
64
|
+
type: "dropexit";
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/** A text item in a drop operation. */
|
|
68
68
|
export interface TextDropItem {
|
|
69
69
|
/** The item kind. */
|
|
70
|
-
kind:
|
|
70
|
+
kind: "text";
|
|
71
71
|
/** The drag types available for this item. */
|
|
72
72
|
types: Set<string>;
|
|
73
73
|
/** Returns the data for the given type as a string. */
|
|
@@ -77,7 +77,7 @@ export interface TextDropItem {
|
|
|
77
77
|
/** A file item in a drop operation. */
|
|
78
78
|
export interface FileDropItem {
|
|
79
79
|
/** The item kind. */
|
|
80
|
-
kind:
|
|
80
|
+
kind: "file";
|
|
81
81
|
/** The file type (usually a mime type). */
|
|
82
82
|
type: string;
|
|
83
83
|
/** The file name. */
|
|
@@ -91,7 +91,7 @@ export interface FileDropItem {
|
|
|
91
91
|
/** A directory item in a drop operation. */
|
|
92
92
|
export interface DirectoryDropItem {
|
|
93
93
|
/** The item kind. */
|
|
94
|
-
kind:
|
|
94
|
+
kind: "directory";
|
|
95
95
|
/** The directory name. */
|
|
96
96
|
name: string;
|
|
97
97
|
/** Returns the entries contained within the directory. */
|
|
@@ -104,7 +104,7 @@ export type DropItem = TextDropItem | FileDropItem | DirectoryDropItem;
|
|
|
104
104
|
/** Event fired when items are dropped. */
|
|
105
105
|
export interface DropEvent extends DragDropEvent {
|
|
106
106
|
/** The event type. */
|
|
107
|
-
type:
|
|
107
|
+
type: "drop";
|
|
108
108
|
/** The drop operation that should occur. */
|
|
109
109
|
dropOperation: DropOperation;
|
|
110
110
|
/** The dropped items. */
|
|
@@ -112,18 +112,18 @@ export interface DropEvent extends DragDropEvent {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
/** Position relative to an item for drop operations. */
|
|
115
|
-
export type DropPosition =
|
|
115
|
+
export type DropPosition = "on" | "before" | "after";
|
|
116
116
|
|
|
117
117
|
/** Drop target representing the root of a collection. */
|
|
118
118
|
export interface RootDropTarget {
|
|
119
119
|
/** The drop target type. */
|
|
120
|
-
type:
|
|
120
|
+
type: "root";
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
/** Drop target representing an item in a collection. */
|
|
124
124
|
export interface ItemDropTarget {
|
|
125
125
|
/** The drop target type. */
|
|
126
|
-
type:
|
|
126
|
+
type: "item";
|
|
127
127
|
/** The item key. */
|
|
128
128
|
key: string | number;
|
|
129
129
|
/** The drop position relative to the item. */
|
|
@@ -205,10 +205,13 @@ export interface DroppableCollectionReorderEvent {
|
|
|
205
205
|
target: ItemDropTarget;
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
+
/** A drag type: either a MIME type string or a symbol such as the directory drag type. */
|
|
209
|
+
export type DragType = string | symbol;
|
|
210
|
+
|
|
208
211
|
/** Interface for checking drag types. */
|
|
209
212
|
export interface DragTypes {
|
|
210
213
|
/** Returns whether the drag contains data of the given type. */
|
|
211
|
-
has(type:
|
|
214
|
+
has(type: DragType | DragType[]): boolean;
|
|
212
215
|
}
|
|
213
216
|
|
|
214
217
|
/** Delegate for determining drop targets within a collection. */
|
|
@@ -222,7 +225,7 @@ export interface DropTargetDelegate {
|
|
|
222
225
|
getDropTargetFromPoint(
|
|
223
226
|
x: number,
|
|
224
227
|
y: number,
|
|
225
|
-
isValidDropTarget: (target: DropTarget) => boolean
|
|
228
|
+
isValidDropTarget: (target: DropTarget) => boolean,
|
|
226
229
|
): DropTarget | null;
|
|
227
230
|
}
|
|
228
231
|
|
|
@@ -251,7 +254,7 @@ export interface DraggableCollectionEndEvent extends DragEndEvent {
|
|
|
251
254
|
/** Function to render a custom drag preview. */
|
|
252
255
|
export type DragPreviewRenderer = (
|
|
253
256
|
items: DragItem[],
|
|
254
|
-
callback: (node: HTMLElement | null, x?: number, y?: number) => void
|
|
257
|
+
callback: (node: HTMLElement | null, x?: number, y?: number) => void,
|
|
255
258
|
) => void;
|
|
256
259
|
|
|
257
260
|
// Props interfaces
|
|
@@ -262,7 +265,7 @@ export interface DroppableCollectionUtilityOptions {
|
|
|
262
265
|
* The drag types that the droppable collection accepts.
|
|
263
266
|
* @default 'all'
|
|
264
267
|
*/
|
|
265
|
-
acceptedDragTypes?:
|
|
268
|
+
acceptedDragTypes?: "all" | Array<string | symbol>;
|
|
266
269
|
/** Handler that is called when external items are dropped "between" items. */
|
|
267
270
|
onInsert?: (e: DroppableCollectionInsertDropEvent) => void;
|
|
268
271
|
/** Handler that is called when external items are dropped on the collection's root. */
|
|
@@ -291,14 +294,13 @@ export interface DroppableCollectionBaseProps {
|
|
|
291
294
|
getDropOperation?: (
|
|
292
295
|
target: DropTarget,
|
|
293
296
|
types: DragTypes,
|
|
294
|
-
allowedOperations: DropOperation[]
|
|
297
|
+
allowedOperations: DropOperation[],
|
|
295
298
|
) => DropOperation;
|
|
296
299
|
}
|
|
297
300
|
|
|
298
301
|
/** Combined props for droppable collections. */
|
|
299
302
|
export interface DroppableCollectionProps
|
|
300
|
-
extends DroppableCollectionUtilityOptions,
|
|
301
|
-
DroppableCollectionBaseProps {}
|
|
303
|
+
extends DroppableCollectionUtilityOptions, DroppableCollectionBaseProps {}
|
|
302
304
|
|
|
303
305
|
/** Props for draggable collections. */
|
|
304
306
|
export interface DraggableCollectionProps<T = object> {
|