@proyecto-viviana/solid-stately 0.2.7 → 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.
Files changed (242) hide show
  1. package/README.md +30 -283
  2. package/dist/autocomplete/createAutocompleteState.d.ts +2 -2
  3. package/dist/autocomplete/index.d.ts +1 -1
  4. package/dist/calendar/createCalendarState.d.ts +22 -7
  5. package/dist/calendar/createDateFieldState.d.ts +30 -7
  6. package/dist/calendar/createDatePickerState.d.ts +60 -0
  7. package/dist/calendar/createRangeCalendarState.d.ts +27 -8
  8. package/dist/calendar/createTimeFieldState.d.ts +34 -7
  9. package/dist/calendar/index.d.ts +7 -6
  10. package/dist/checkbox/createCheckboxGroupState.d.ts +6 -6
  11. package/dist/checkbox/index.d.ts +1 -1
  12. package/dist/collections/ListCollection.d.ts +1 -1
  13. package/dist/collections/createListState.d.ts +8 -8
  14. package/dist/collections/createMenuState.d.ts +7 -7
  15. package/dist/collections/createSelectionState.d.ts +5 -5
  16. package/dist/collections/index.d.ts +5 -5
  17. package/dist/collections/types.d.ts +12 -12
  18. package/dist/color/Color.d.ts +1 -1
  19. package/dist/color/createColorAreaState.d.ts +4 -2
  20. package/dist/color/createColorFieldState.d.ts +38 -12
  21. package/dist/color/createColorSliderState.d.ts +9 -2
  22. package/dist/color/createColorWheelState.d.ts +13 -2
  23. package/dist/color/getColorChannels.d.ts +1 -1
  24. package/dist/color/index.d.ts +6 -6
  25. package/dist/color/types.d.ts +4 -4
  26. package/dist/combobox/createComboBoxState.d.ts +27 -13
  27. package/dist/combobox/index.d.ts +1 -1
  28. package/dist/data/createAsyncList.d.ts +4 -4
  29. package/dist/data/createListData.d.ts +2 -2
  30. package/dist/data/createTreeData.d.ts +6 -2
  31. package/dist/data/index.d.ts +3 -3
  32. package/dist/datepicker/index.d.ts +2 -4
  33. package/dist/disclosure/createDisclosureState.d.ts +2 -2
  34. package/dist/disclosure/index.d.ts +1 -1
  35. package/dist/dnd/createDragState.d.ts +2 -2
  36. package/dist/dnd/createDraggableCollectionState.d.ts +2 -2
  37. package/dist/dnd/createDropState.d.ts +2 -2
  38. package/dist/dnd/createDroppableCollectionState.d.ts +3 -3
  39. package/dist/dnd/index.d.ts +5 -5
  40. package/dist/dnd/types.d.ts +16 -16
  41. package/dist/form/createFormValidationState.d.ts +3 -3
  42. package/dist/form/index.d.ts +1 -1
  43. package/dist/grid/createGridState.d.ts +2 -2
  44. package/dist/grid/index.d.ts +2 -2
  45. package/dist/grid/types.d.ts +13 -11
  46. package/dist/index.d.ts +31 -30
  47. package/dist/index.js +7924 -7238
  48. package/dist/index.js.map +1 -1
  49. package/dist/menu/index.d.ts +2 -2
  50. package/dist/numberfield/createNumberFieldState.d.ts +2 -2
  51. package/dist/numberfield/index.d.ts +1 -1
  52. package/dist/overlays/createOverlayTriggerState.d.ts +2 -2
  53. package/dist/overlays/index.d.ts +1 -1
  54. package/dist/radio/createRadioGroupState.d.ts +7 -7
  55. package/dist/radio/index.d.ts +1 -1
  56. package/dist/searchfield/createSearchFieldState.d.ts +2 -2
  57. package/dist/searchfield/index.d.ts +2 -2
  58. package/dist/select/createSelectState.d.ts +8 -8
  59. package/dist/select/index.d.ts +1 -1
  60. package/dist/selection/index.d.ts +5 -5
  61. package/dist/slider/createSliderState.d.ts +3 -3
  62. package/dist/slider/index.d.ts +2 -2
  63. package/dist/steplist/createStepListState.d.ts +48 -0
  64. package/dist/steplist/index.d.ts +1 -0
  65. package/dist/table/TableCollection.d.ts +3 -3
  66. package/dist/table/createTableColumnResizeState.d.ts +54 -0
  67. package/dist/table/createTableState.d.ts +2 -2
  68. package/dist/table/index.d.ts +5 -3
  69. package/dist/table/types.d.ts +10 -10
  70. package/dist/tabs/createTabListState.d.ts +5 -5
  71. package/dist/tabs/index.d.ts +1 -1
  72. package/dist/textfield/createTextFieldState.d.ts +2 -2
  73. package/dist/textfield/index.d.ts +1 -1
  74. package/dist/toast/createToastState.d.ts +8 -2
  75. package/dist/toast/index.d.ts +1 -1
  76. package/dist/toggle/createToggleGroupState.d.ts +4 -4
  77. package/dist/toggle/createToggleState.d.ts +2 -2
  78. package/dist/toggle/index.d.ts +2 -2
  79. package/dist/tooltip/createTooltipTriggerState.d.ts +2 -2
  80. package/dist/tooltip/index.d.ts +1 -1
  81. package/dist/tree/TreeCollection.d.ts +2 -2
  82. package/dist/tree/createTreeState.d.ts +2 -2
  83. package/dist/tree/index.d.ts +3 -3
  84. package/dist/tree/types.d.ts +19 -13
  85. package/dist/utils/index.d.ts +1 -1
  86. package/dist/utils/reactivity.d.ts +1 -1
  87. package/package.json +29 -30
  88. package/src/autocomplete/createAutocompleteState.d.ts +19 -17
  89. package/src/autocomplete/createAutocompleteState.ts +24 -30
  90. package/src/autocomplete/index.d.ts +6 -2
  91. package/src/autocomplete/index.ts +1 -1
  92. package/src/calendar/createCalendarState.d.ts +139 -117
  93. package/src/calendar/createCalendarState.ts +221 -74
  94. package/src/calendar/createDateFieldState.d.ts +130 -95
  95. package/src/calendar/createDateFieldState.ts +263 -151
  96. package/src/calendar/createDatePickerState.ts +347 -0
  97. package/src/calendar/createRangeCalendarState.d.ts +154 -129
  98. package/src/calendar/createRangeCalendarState.ts +293 -79
  99. package/src/calendar/createTimeFieldState.d.ts +81 -79
  100. package/src/calendar/createTimeFieldState.ts +187 -108
  101. package/src/calendar/index.d.ts +80 -7
  102. package/src/calendar/index.ts +21 -12
  103. package/src/checkbox/createCheckboxGroupState.d.ts +57 -55
  104. package/src/checkbox/createCheckboxGroupState.ts +20 -29
  105. package/src/checkbox/index.d.ts +6 -2
  106. package/src/checkbox/index.ts +1 -1
  107. package/src/collections/ListCollection.d.ts +25 -22
  108. package/src/collections/ListCollection.ts +6 -6
  109. package/src/collections/createListState.d.ts +73 -58
  110. package/src/collections/createListState.ts +19 -18
  111. package/src/collections/createMenuState.d.ts +36 -31
  112. package/src/collections/createMenuState.ts +18 -12
  113. package/src/collections/createSelectionState.d.ts +78 -65
  114. package/src/collections/createSelectionState.ts +36 -32
  115. package/src/collections/index.d.ts +38 -6
  116. package/src/collections/index.ts +5 -10
  117. package/src/collections/types.d.ts +101 -101
  118. package/src/collections/types.ts +12 -12
  119. package/src/color/Color.d.ts +20 -5
  120. package/src/color/Color.ts +357 -254
  121. package/src/color/createColorAreaState.d.ts +67 -65
  122. package/src/color/createColorAreaState.ts +21 -13
  123. package/src/color/createColorFieldState.d.ts +46 -44
  124. package/src/color/createColorFieldState.ts +285 -149
  125. package/src/color/createColorSliderState.d.ts +58 -56
  126. package/src/color/createColorSliderState.ts +45 -14
  127. package/src/color/createColorWheelState.d.ts +42 -40
  128. package/src/color/createColorWheelState.ts +101 -64
  129. package/src/color/getColorChannels.ts +7 -5
  130. package/src/color/index.d.ts +36 -7
  131. package/src/color/index.ts +6 -9
  132. package/src/color/types.d.ts +68 -63
  133. package/src/color/types.ts +11 -19
  134. package/src/combobox/createComboBoxState.d.ts +107 -105
  135. package/src/combobox/createComboBoxState.ts +176 -89
  136. package/src/combobox/index.d.ts +10 -2
  137. package/src/combobox/index.ts +1 -1
  138. package/src/data/createAsyncList.ts +89 -63
  139. package/src/data/createListData.ts +67 -67
  140. package/src/data/createTreeData.ts +304 -91
  141. package/src/data/index.ts +3 -3
  142. package/src/datepicker/index.ts +6 -10
  143. package/src/disclosure/createDisclosureState.d.ts +47 -43
  144. package/src/disclosure/createDisclosureState.ts +7 -21
  145. package/src/disclosure/index.d.ts +10 -2
  146. package/src/disclosure/index.ts +1 -1
  147. package/src/dnd/createDragState.d.ts +51 -42
  148. package/src/dnd/createDragState.ts +12 -14
  149. package/src/dnd/createDraggableCollectionState.d.ts +52 -41
  150. package/src/dnd/createDraggableCollectionState.ts +14 -21
  151. package/src/dnd/createDropState.d.ts +64 -45
  152. package/src/dnd/createDropState.ts +22 -32
  153. package/src/dnd/createDroppableCollectionState.d.ts +88 -59
  154. package/src/dnd/createDroppableCollectionState.ts +40 -43
  155. package/src/dnd/index.d.ts +54 -6
  156. package/src/dnd/index.ts +5 -18
  157. package/src/dnd/types.d.ts +167 -156
  158. package/src/dnd/types.ts +20 -21
  159. package/src/form/createFormValidationState.d.ts +47 -45
  160. package/src/form/createFormValidationState.ts +30 -63
  161. package/src/form/index.d.ts +16 -2
  162. package/src/form/index.ts +1 -1
  163. package/src/grid/createGridState.d.ts +7 -4
  164. package/src/grid/createGridState.ts +44 -51
  165. package/src/grid/index.d.ts +3 -3
  166. package/src/grid/index.ts +2 -8
  167. package/src/grid/types.d.ts +136 -129
  168. package/src/grid/types.ts +20 -18
  169. package/src/index.d.ts +310 -26
  170. package/src/index.ts +48 -89
  171. package/src/menu/index.ts +2 -4
  172. package/src/numberfield/createNumberFieldState.d.ts +56 -54
  173. package/src/numberfield/createNumberFieldState.ts +26 -31
  174. package/src/numberfield/index.d.ts +6 -2
  175. package/src/numberfield/index.ts +1 -1
  176. package/src/overlays/createOverlayTriggerState.d.ts +22 -20
  177. package/src/overlays/createOverlayTriggerState.ts +3 -4
  178. package/src/overlays/index.d.ts +6 -2
  179. package/src/overlays/index.ts +1 -1
  180. package/src/radio/createRadioGroupState.d.ts +54 -52
  181. package/src/radio/createRadioGroupState.ts +27 -29
  182. package/src/radio/index.d.ts +7 -2
  183. package/src/radio/index.ts +1 -1
  184. package/src/searchfield/createSearchFieldState.d.ts +16 -14
  185. package/src/searchfield/createSearchFieldState.ts +5 -11
  186. package/src/searchfield/index.d.ts +3 -3
  187. package/src/searchfield/index.ts +2 -5
  188. package/src/select/createSelectState.d.ts +63 -61
  189. package/src/select/createSelectState.ts +27 -27
  190. package/src/select/index.d.ts +2 -2
  191. package/src/select/index.ts +1 -5
  192. package/src/selection/index.ts +6 -7
  193. package/src/slider/createSliderState.d.ts +60 -60
  194. package/src/slider/createSliderState.ts +55 -33
  195. package/src/slider/index.d.ts +3 -3
  196. package/src/slider/index.ts +2 -6
  197. package/src/ssr/index.d.ts +1 -1
  198. package/src/ssr/index.ts +2 -2
  199. package/src/steplist/createStepListState.ts +191 -0
  200. package/src/steplist/index.ts +5 -0
  201. package/src/table/TableCollection.d.ts +42 -40
  202. package/src/table/TableCollection.ts +61 -64
  203. package/src/table/createTableColumnResizeState.ts +242 -0
  204. package/src/table/createTableState.d.ts +7 -4
  205. package/src/table/createTableState.ts +10 -7
  206. package/src/table/index.d.ts +14 -4
  207. package/src/table/index.ts +10 -3
  208. package/src/table/types.d.ts +98 -92
  209. package/src/table/types.ts +17 -13
  210. package/src/tabs/createTabListState.d.ts +59 -57
  211. package/src/tabs/createTabListState.ts +24 -31
  212. package/src/tabs/index.d.ts +8 -2
  213. package/src/tabs/index.ts +1 -1
  214. package/src/textfield/createTextFieldState.d.ts +16 -14
  215. package/src/textfield/createTextFieldState.ts +7 -18
  216. package/src/textfield/index.d.ts +6 -2
  217. package/src/textfield/index.ts +1 -1
  218. package/src/toast/createToastState.d.ts +92 -86
  219. package/src/toast/createToastState.ts +48 -43
  220. package/src/toast/index.d.ts +12 -2
  221. package/src/toast/index.ts +1 -1
  222. package/src/toggle/createToggleGroupState.ts +11 -21
  223. package/src/toggle/createToggleState.d.ts +19 -19
  224. package/src/toggle/createToggleState.ts +2 -16
  225. package/src/toggle/index.d.ts +2 -2
  226. package/src/toggle/index.ts +2 -6
  227. package/src/tooltip/createTooltipTriggerState.d.ts +17 -17
  228. package/src/tooltip/createTooltipTriggerState.ts +12 -11
  229. package/src/tooltip/index.d.ts +7 -2
  230. package/src/tooltip/index.ts +1 -1
  231. package/src/tree/TreeCollection.d.ts +26 -23
  232. package/src/tree/TreeCollection.ts +29 -22
  233. package/src/tree/createTreeState.d.ts +7 -4
  234. package/src/tree/createTreeState.ts +39 -41
  235. package/src/tree/index.d.ts +10 -4
  236. package/src/tree/index.ts +3 -3
  237. package/src/tree/types.d.ts +131 -126
  238. package/src/tree/types.ts +22 -13
  239. package/src/utils/index.d.ts +2 -2
  240. package/src/utils/index.ts +1 -1
  241. package/src/utils/reactivity.d.ts +2 -2
  242. package/src/utils/reactivity.ts +3 -3
@@ -4,261 +4,272 @@
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 = 'copy' | 'link' | 'move' | 'cancel';
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
- [type: string]: string;
10
+ [type: string]: string;
11
11
  }
12
12
  /** Base event for drag/drop operations with coordinates. */
13
13
  export interface DragDropEvent {
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;
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
- /** The event type. */
22
- type: 'dragstart';
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
- /** The event type. */
27
- type: 'dragmove';
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
- /** The event type. */
32
- type: 'dragend';
33
- /** The drop operation that occurred. */
34
- dropOperation: DropOperation;
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
- /** The event type. */
39
- type: 'dropenter';
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
- /** The event type. */
44
- type: 'dropmove';
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
- /** The event type. */
49
- type: 'dropactivate';
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
- /** The event type. */
54
- type: 'dropexit';
53
+ /** The event type. */
54
+ type: "dropexit";
55
55
  }
56
56
  /** A text item in a drop operation. */
57
57
  export interface TextDropItem {
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>;
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
- /** 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>;
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
- /** 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>;
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
- /** The event type. */
92
- type: 'drop';
93
- /** The drop operation that should occur. */
94
- dropOperation: DropOperation;
95
- /** The dropped items. */
96
- items: DropItem[];
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 = 'on' | 'before' | 'after';
99
+ export type DropPosition = "on" | "before" | "after";
100
100
  /** Drop target representing the root of a collection. */
101
101
  export interface RootDropTarget {
102
- /** The drop target type. */
103
- type: 'root';
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
- /** 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;
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
- /** The drop target. */
119
- target: DropTarget;
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
- /** The drop target. */
124
- target: DropTarget;
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
- /** The drop target. */
129
- target: DropTarget;
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
- /** The drop target. */
134
- target: DropTarget;
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
- /** The drop target. */
139
- target: DropTarget;
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
- /** The dropped items. */
144
- items: DropItem[];
145
- /** The drop operation that should occur. */
146
- dropOperation: DropOperation;
147
- /** The drop target. */
148
- target: ItemDropTarget;
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
- /** The dropped items. */
153
- items: DropItem[];
154
- /** The drop operation that should occur. */
155
- dropOperation: DropOperation;
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
- /** 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;
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
- /** 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;
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
176
  }
177
177
  /** Interface for checking drag types. */
178
178
  export interface DragTypes {
179
- /** Returns whether the drag contains data of the given type. */
180
- has(type: string | symbol): boolean;
179
+ /** Returns whether the drag contains data of the given type. */
180
+ has(type: string | symbol): boolean;
181
181
  }
182
182
  /** Delegate for determining drop targets within a collection. */
183
183
  export interface DropTargetDelegate {
184
- /**
185
- * Returns a drop target within a collection for the given coordinates.
186
- * @param x - X coordinate relative to the collection container
187
- * @param y - Y coordinate relative to the collection container
188
- * @param isValidDropTarget - Function to check if a target is valid
189
- */
190
- getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget | null;
184
+ /**
185
+ * Returns a drop target within a collection for the given coordinates.
186
+ * @param x - X coordinate relative to the collection container
187
+ * @param y - Y coordinate relative to the collection container
188
+ * @param isValidDropTarget - Function to check if a target is valid
189
+ */
190
+ getDropTargetFromPoint(
191
+ x: number,
192
+ y: number,
193
+ isValidDropTarget: (target: DropTarget) => boolean,
194
+ ): DropTarget | null;
191
195
  }
192
196
  /** Event fired when a collection drag starts. */
193
197
  export interface DraggableCollectionStartEvent extends DragStartEvent {
194
- /** The keys of the items that were dragged. */
195
- keys: Set<string | number>;
198
+ /** The keys of the items that were dragged. */
199
+ keys: Set<string | number>;
196
200
  }
197
201
  /** Event fired as a collection drag moves. */
198
202
  export interface DraggableCollectionMoveEvent extends DragMoveEvent {
199
- /** The keys of the items that were dragged. */
200
- keys: Set<string | number>;
203
+ /** The keys of the items that were dragged. */
204
+ keys: Set<string | number>;
201
205
  }
202
206
  /** Event fired when a collection drag ends. */
203
207
  export interface DraggableCollectionEndEvent extends DragEndEvent {
204
- /** The keys of the items that were dragged. */
205
- keys: Set<string | number>;
206
- /** Whether the drop ended within the same collection as it originated. */
207
- isInternal: boolean;
208
+ /** The keys of the items that were dragged. */
209
+ keys: Set<string | number>;
210
+ /** Whether the drop ended within the same collection as it originated. */
211
+ isInternal: boolean;
208
212
  }
209
213
  /** Function to render a custom drag preview. */
210
- export type DragPreviewRenderer = (items: DragItem[], callback: (node: HTMLElement | null, x?: number, y?: number) => void) => void;
214
+ export type DragPreviewRenderer = (
215
+ items: DragItem[],
216
+ callback: (node: HTMLElement | null, x?: number, y?: number) => void,
217
+ ) => void;
211
218
  /** Props for droppable collection utility handlers. */
212
219
  export interface DroppableCollectionUtilityOptions {
213
- /**
214
- * The drag types that the droppable collection accepts.
215
- * @default 'all'
216
- */
217
- acceptedDragTypes?: 'all' | Array<string | symbol>;
218
- /** Handler that is called when external items are dropped "between" items. */
219
- onInsert?: (e: DroppableCollectionInsertDropEvent) => void;
220
- /** Handler that is called when external items are dropped on the collection's root. */
221
- onRootDrop?: (e: DroppableCollectionRootDropEvent) => void;
222
- /** Handler that is called when items are dropped "on" an item. */
223
- onItemDrop?: (e: DroppableCollectionOnItemDropEvent) => void;
224
- /** Handler that is called when items are reordered within the collection. */
225
- onReorder?: (e: DroppableCollectionReorderEvent) => void;
226
- /** Handler that is called when items are moved within the source collection. */
227
- onMove?: (e: DroppableCollectionReorderEvent) => void;
228
- /** A function returning whether a given target is a valid "on" drop target. */
229
- shouldAcceptItemDrop?: (target: ItemDropTarget, types: DragTypes) => boolean;
220
+ /**
221
+ * The drag types that the droppable collection accepts.
222
+ * @default 'all'
223
+ */
224
+ acceptedDragTypes?: "all" | Array<string | symbol>;
225
+ /** Handler that is called when external items are dropped "between" items. */
226
+ onInsert?: (e: DroppableCollectionInsertDropEvent) => void;
227
+ /** Handler that is called when external items are dropped on the collection's root. */
228
+ onRootDrop?: (e: DroppableCollectionRootDropEvent) => void;
229
+ /** Handler that is called when items are dropped "on" an item. */
230
+ onItemDrop?: (e: DroppableCollectionOnItemDropEvent) => void;
231
+ /** Handler that is called when items are reordered within the collection. */
232
+ onReorder?: (e: DroppableCollectionReorderEvent) => void;
233
+ /** Handler that is called when items are moved within the source collection. */
234
+ onMove?: (e: DroppableCollectionReorderEvent) => void;
235
+ /** A function returning whether a given target is a valid "on" drop target. */
236
+ shouldAcceptItemDrop?: (target: ItemDropTarget, types: DragTypes) => boolean;
230
237
  }
231
238
  /** Base props for droppable collections. */
232
239
  export interface DroppableCollectionBaseProps {
233
- /** Handler that is called when a valid drag enters a drop target. */
234
- onDropEnter?: (e: DroppableCollectionEnterEvent) => void;
235
- /** Handler that is called after a valid drag is held over a drop target. */
236
- onDropActivate?: (e: DroppableCollectionActivateEvent) => void;
237
- /** Handler that is called when a valid drag exits a drop target. */
238
- onDropExit?: (e: DroppableCollectionExitEvent) => void;
239
- /** Handler that is called when a valid drag is dropped on a drop target. */
240
- onDrop?: (e: DroppableCollectionDropEvent) => void;
241
- /** A function returning the drop operation to be performed. */
242
- getDropOperation?: (target: DropTarget, types: DragTypes, allowedOperations: DropOperation[]) => DropOperation;
240
+ /** Handler that is called when a valid drag enters a drop target. */
241
+ onDropEnter?: (e: DroppableCollectionEnterEvent) => void;
242
+ /** Handler that is called after a valid drag is held over a drop target. */
243
+ onDropActivate?: (e: DroppableCollectionActivateEvent) => void;
244
+ /** Handler that is called when a valid drag exits a drop target. */
245
+ onDropExit?: (e: DroppableCollectionExitEvent) => void;
246
+ /** Handler that is called when a valid drag is dropped on a drop target. */
247
+ onDrop?: (e: DroppableCollectionDropEvent) => void;
248
+ /** A function returning the drop operation to be performed. */
249
+ getDropOperation?: (
250
+ target: DropTarget,
251
+ types: DragTypes,
252
+ allowedOperations: DropOperation[],
253
+ ) => DropOperation;
243
254
  }
244
255
  /** Combined props for droppable collections. */
245
- export interface DroppableCollectionProps extends DroppableCollectionUtilityOptions, DroppableCollectionBaseProps {
246
- }
256
+ export interface DroppableCollectionProps
257
+ extends DroppableCollectionUtilityOptions, DroppableCollectionBaseProps {}
247
258
  /** Props for draggable collections. */
248
259
  export interface DraggableCollectionProps<T = object> {
249
- /** Handler that is called when a drag operation is started. */
250
- onDragStart?: (e: DraggableCollectionStartEvent) => void;
251
- /** Handler that is called when the drag is moved. */
252
- onDragMove?: (e: DraggableCollectionMoveEvent) => void;
253
- /** Handler that is called when the drag operation ends. */
254
- onDragEnd?: (e: DraggableCollectionEndEvent) => void;
255
- /** A function that returns the items being dragged. */
256
- getItems: (keys: Set<string | number>, items: T[]) => DragItem[];
257
- /** The ref of the element that will be rendered as the drag preview. */
258
- preview?: {
259
- current: DragPreviewRenderer | null;
260
- };
261
- /** Function that returns the allowed drop operations. */
262
- getAllowedDropOperations?: () => DropOperation[];
263
- }
264
- //# sourceMappingURL=types.d.ts.map
260
+ /** Handler that is called when a drag operation is started. */
261
+ onDragStart?: (e: DraggableCollectionStartEvent) => void;
262
+ /** Handler that is called when the drag is moved. */
263
+ onDragMove?: (e: DraggableCollectionMoveEvent) => void;
264
+ /** Handler that is called when the drag operation ends. */
265
+ onDragEnd?: (e: DraggableCollectionEndEvent) => void;
266
+ /** A function that returns the items being dragged. */
267
+ getItems: (keys: Set<string | number>, items: T[]) => DragItem[];
268
+ /** The ref of the element that will be rendered as the drag preview. */
269
+ preview?: {
270
+ current: DragPreviewRenderer | null;
271
+ };
272
+ /** Function that returns the allowed drop operations. */
273
+ getAllowedDropOperations?: () => DropOperation[];
274
+ }
275
+ //# 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 = 'copy' | 'link' | 'move' | 'cancel';
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: 'dragstart';
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: 'dragmove';
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: 'dragend';
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: 'dropenter';
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: 'dropmove';
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: 'dropactivate';
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: 'dropexit';
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: 'text';
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: 'file';
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: 'directory';
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: 'drop';
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 = 'on' | 'before' | 'after';
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: 'root';
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: 'item';
126
+ type: "item";
127
127
  /** The item key. */
128
128
  key: string | number;
129
129
  /** The drop position relative to the item. */
@@ -222,7 +222,7 @@ export interface DropTargetDelegate {
222
222
  getDropTargetFromPoint(
223
223
  x: number,
224
224
  y: number,
225
- isValidDropTarget: (target: DropTarget) => boolean
225
+ isValidDropTarget: (target: DropTarget) => boolean,
226
226
  ): DropTarget | null;
227
227
  }
228
228
 
@@ -251,7 +251,7 @@ export interface DraggableCollectionEndEvent extends DragEndEvent {
251
251
  /** Function to render a custom drag preview. */
252
252
  export type DragPreviewRenderer = (
253
253
  items: DragItem[],
254
- callback: (node: HTMLElement | null, x?: number, y?: number) => void
254
+ callback: (node: HTMLElement | null, x?: number, y?: number) => void,
255
255
  ) => void;
256
256
 
257
257
  // Props interfaces
@@ -262,7 +262,7 @@ export interface DroppableCollectionUtilityOptions {
262
262
  * The drag types that the droppable collection accepts.
263
263
  * @default 'all'
264
264
  */
265
- acceptedDragTypes?: 'all' | Array<string | symbol>;
265
+ acceptedDragTypes?: "all" | Array<string | symbol>;
266
266
  /** Handler that is called when external items are dropped "between" items. */
267
267
  onInsert?: (e: DroppableCollectionInsertDropEvent) => void;
268
268
  /** Handler that is called when external items are dropped on the collection's root. */
@@ -291,14 +291,13 @@ export interface DroppableCollectionBaseProps {
291
291
  getDropOperation?: (
292
292
  target: DropTarget,
293
293
  types: DragTypes,
294
- allowedOperations: DropOperation[]
294
+ allowedOperations: DropOperation[],
295
295
  ) => DropOperation;
296
296
  }
297
297
 
298
298
  /** Combined props for droppable collections. */
299
299
  export interface DroppableCollectionProps
300
- extends DroppableCollectionUtilityOptions,
301
- DroppableCollectionBaseProps {}
300
+ extends DroppableCollectionUtilityOptions, DroppableCollectionBaseProps {}
302
301
 
303
302
  /** Props for draggable collections. */
304
303
  export interface DraggableCollectionProps<T = object> {