@proyecto-viviana/solid-stately 0.1.2 → 0.1.4
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/dist/index.d.ts +3363 -25
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -7
- package/package.json +4 -3
- package/dist/autocomplete/createAutocompleteState.d.ts +0 -45
- package/dist/autocomplete/index.d.ts +0 -1
- package/dist/calendar/createCalendarState.d.ts +0 -129
- package/dist/calendar/createDateFieldState.d.ts +0 -109
- package/dist/calendar/createRangeCalendarState.d.ts +0 -145
- package/dist/calendar/createTimeFieldState.d.ts +0 -94
- package/dist/calendar/index.d.ts +0 -6
- package/dist/checkbox/createCheckboxGroupState.d.ts +0 -70
- package/dist/checkbox/index.d.ts +0 -1
- package/dist/collections/ListCollection.d.ts +0 -36
- package/dist/collections/createListState.d.ts +0 -78
- package/dist/collections/createMenuState.d.ts +0 -49
- package/dist/collections/createSelectionState.d.ts +0 -75
- package/dist/collections/index.d.ts +0 -5
- package/dist/collections/types.d.ts +0 -146
- package/dist/color/Color.d.ts +0 -27
- package/dist/color/createColorAreaState.d.ts +0 -75
- package/dist/color/createColorFieldState.d.ts +0 -54
- package/dist/color/createColorSliderState.d.ts +0 -66
- package/dist/color/createColorWheelState.d.ts +0 -50
- package/dist/color/index.d.ts +0 -9
- package/dist/color/types.d.ts +0 -105
- package/dist/combobox/createComboBoxState.d.ts +0 -124
- package/dist/combobox/index.d.ts +0 -4
- package/dist/disclosure/createDisclosureState.d.ts +0 -63
- package/dist/disclosure/index.d.ts +0 -1
- package/dist/dnd/createDragState.d.ts +0 -58
- package/dist/dnd/createDraggableCollectionState.d.ts +0 -56
- package/dist/dnd/createDropState.d.ts +0 -60
- package/dist/dnd/createDroppableCollectionState.d.ts +0 -77
- package/dist/dnd/index.d.ts +0 -10
- package/dist/dnd/types.d.ts +0 -263
- package/dist/form/createFormValidationState.d.ts +0 -99
- package/dist/form/index.d.ts +0 -1
- package/dist/grid/createGridState.d.ts +0 -11
- package/dist/grid/index.d.ts +0 -6
- package/dist/grid/types.d.ts +0 -155
- package/dist/numberfield/createNumberFieldState.d.ts +0 -64
- package/dist/numberfield/index.d.ts +0 -1
- package/dist/overlays/createOverlayTriggerState.d.ts +0 -31
- package/dist/overlays/index.d.ts +0 -1
- package/dist/radio/createRadioGroupState.d.ts +0 -76
- package/dist/radio/index.d.ts +0 -1
- package/dist/searchfield/createSearchFieldState.d.ts +0 -24
- package/dist/searchfield/index.d.ts +0 -2
- package/dist/select/createSelectState.d.ts +0 -72
- package/dist/select/index.d.ts +0 -1
- package/dist/slider/createSliderState.d.ts +0 -71
- package/dist/slider/index.d.ts +0 -2
- package/dist/ssr/index.d.ts +0 -27
- package/dist/table/TableCollection.d.ts +0 -51
- package/dist/table/createTableState.d.ts +0 -11
- package/dist/table/index.d.ts +0 -7
- package/dist/table/types.d.ts +0 -138
- package/dist/tabs/createTabListState.d.ts +0 -67
- package/dist/tabs/index.d.ts +0 -1
- package/dist/textfield/createTextFieldState.d.ts +0 -29
- package/dist/textfield/index.d.ts +0 -1
- package/dist/toast/createToastState.d.ts +0 -117
- package/dist/toast/index.d.ts +0 -1
- package/dist/toggle/createToggleState.d.ts +0 -33
- package/dist/toggle/index.d.ts +0 -1
- package/dist/tooltip/createTooltipTriggerState.d.ts +0 -38
- package/dist/tooltip/index.d.ts +0 -1
- package/dist/tree/TreeCollection.d.ts +0 -39
- package/dist/tree/createTreeState.d.ts +0 -13
- package/dist/tree/index.d.ts +0 -6
- package/dist/tree/types.d.ts +0 -156
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/reactivity.d.ts +0 -27
package/dist/dnd/types.d.ts
DELETED
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Drag and Drop types for solid-stately.
|
|
3
|
-
*
|
|
4
|
-
* Core types for drag and drop operations, matching React Aria's DnD API.
|
|
5
|
-
*/
|
|
6
|
-
/** The type of drop operation to perform. */
|
|
7
|
-
export type DropOperation = 'copy' | 'link' | 'move' | 'cancel';
|
|
8
|
-
/** Drag item data as key-value pairs where keys are MIME types or custom types. */
|
|
9
|
-
export interface DragItem {
|
|
10
|
-
[type: string]: string;
|
|
11
|
-
}
|
|
12
|
-
/** Base event for drag/drop operations with coordinates. */
|
|
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;
|
|
18
|
-
}
|
|
19
|
-
/** Event fired when a drag operation starts. */
|
|
20
|
-
export interface DragStartEvent extends DragDropEvent {
|
|
21
|
-
/** The event type. */
|
|
22
|
-
type: 'dragstart';
|
|
23
|
-
}
|
|
24
|
-
/** Event fired as a drag moves. */
|
|
25
|
-
export interface DragMoveEvent extends DragDropEvent {
|
|
26
|
-
/** The event type. */
|
|
27
|
-
type: 'dragmove';
|
|
28
|
-
}
|
|
29
|
-
/** Event fired when a drag operation ends. */
|
|
30
|
-
export interface DragEndEvent extends DragDropEvent {
|
|
31
|
-
/** The event type. */
|
|
32
|
-
type: 'dragend';
|
|
33
|
-
/** The drop operation that occurred. */
|
|
34
|
-
dropOperation: DropOperation;
|
|
35
|
-
}
|
|
36
|
-
/** Event fired when a drag enters a drop target. */
|
|
37
|
-
export interface DropEnterEvent extends DragDropEvent {
|
|
38
|
-
/** The event type. */
|
|
39
|
-
type: 'dropenter';
|
|
40
|
-
}
|
|
41
|
-
/** Event fired as a drag moves within a drop target. */
|
|
42
|
-
export interface DropMoveEvent extends DragDropEvent {
|
|
43
|
-
/** The event type. */
|
|
44
|
-
type: 'dropmove';
|
|
45
|
-
}
|
|
46
|
-
/** Event fired when a drag is held over a drop target. */
|
|
47
|
-
export interface DropActivateEvent extends DragDropEvent {
|
|
48
|
-
/** The event type. */
|
|
49
|
-
type: 'dropactivate';
|
|
50
|
-
}
|
|
51
|
-
/** Event fired when a drag exits a drop target. */
|
|
52
|
-
export interface DropExitEvent extends DragDropEvent {
|
|
53
|
-
/** The event type. */
|
|
54
|
-
type: 'dropexit';
|
|
55
|
-
}
|
|
56
|
-
/** A text item in a drop operation. */
|
|
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>;
|
|
64
|
-
}
|
|
65
|
-
/** A file item in a drop operation. */
|
|
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>;
|
|
77
|
-
}
|
|
78
|
-
/** A directory item in a drop operation. */
|
|
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>;
|
|
86
|
-
}
|
|
87
|
-
/** Union of all drop item types. */
|
|
88
|
-
export type DropItem = TextDropItem | FileDropItem | DirectoryDropItem;
|
|
89
|
-
/** Event fired when items are dropped. */
|
|
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[];
|
|
97
|
-
}
|
|
98
|
-
/** Position relative to an item for drop operations. */
|
|
99
|
-
export type DropPosition = 'on' | 'before' | 'after';
|
|
100
|
-
/** Drop target representing the root of a collection. */
|
|
101
|
-
export interface RootDropTarget {
|
|
102
|
-
/** The drop target type. */
|
|
103
|
-
type: 'root';
|
|
104
|
-
}
|
|
105
|
-
/** Drop target representing an item in a collection. */
|
|
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;
|
|
113
|
-
}
|
|
114
|
-
/** Union of drop target types. */
|
|
115
|
-
export type DropTarget = RootDropTarget | ItemDropTarget;
|
|
116
|
-
/** Event fired when a drag enters a droppable collection. */
|
|
117
|
-
export interface DroppableCollectionEnterEvent extends DropEnterEvent {
|
|
118
|
-
/** The drop target. */
|
|
119
|
-
target: DropTarget;
|
|
120
|
-
}
|
|
121
|
-
/** Event fired as a drag moves within a droppable collection. */
|
|
122
|
-
export interface DroppableCollectionMoveEvent extends DropMoveEvent {
|
|
123
|
-
/** The drop target. */
|
|
124
|
-
target: DropTarget;
|
|
125
|
-
}
|
|
126
|
-
/** Event fired when a drag is held over a droppable collection item. */
|
|
127
|
-
export interface DroppableCollectionActivateEvent extends DropActivateEvent {
|
|
128
|
-
/** The drop target. */
|
|
129
|
-
target: DropTarget;
|
|
130
|
-
}
|
|
131
|
-
/** Event fired when a drag exits a droppable collection. */
|
|
132
|
-
export interface DroppableCollectionExitEvent extends DropExitEvent {
|
|
133
|
-
/** The drop target. */
|
|
134
|
-
target: DropTarget;
|
|
135
|
-
}
|
|
136
|
-
/** Event fired when items are dropped on a droppable collection. */
|
|
137
|
-
export interface DroppableCollectionDropEvent extends DropEvent {
|
|
138
|
-
/** The drop target. */
|
|
139
|
-
target: DropTarget;
|
|
140
|
-
}
|
|
141
|
-
/** Event for inserting items between existing collection items. */
|
|
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;
|
|
149
|
-
}
|
|
150
|
-
/** Event for dropping on the root of a collection. */
|
|
151
|
-
export interface DroppableCollectionRootDropEvent {
|
|
152
|
-
/** The dropped items. */
|
|
153
|
-
items: DropItem[];
|
|
154
|
-
/** The drop operation that should occur. */
|
|
155
|
-
dropOperation: DropOperation;
|
|
156
|
-
}
|
|
157
|
-
/** Event for dropping on a specific item. */
|
|
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;
|
|
167
|
-
}
|
|
168
|
-
/** Event for reordering items within a collection. */
|
|
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;
|
|
176
|
-
}
|
|
177
|
-
/** Interface for checking drag types. */
|
|
178
|
-
export interface DragTypes {
|
|
179
|
-
/** Returns whether the drag contains data of the given type. */
|
|
180
|
-
has(type: string | symbol): boolean;
|
|
181
|
-
}
|
|
182
|
-
/** Delegate for determining drop targets within a collection. */
|
|
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;
|
|
191
|
-
}
|
|
192
|
-
/** Event fired when a collection drag starts. */
|
|
193
|
-
export interface DraggableCollectionStartEvent extends DragStartEvent {
|
|
194
|
-
/** The keys of the items that were dragged. */
|
|
195
|
-
keys: Set<string | number>;
|
|
196
|
-
}
|
|
197
|
-
/** Event fired as a collection drag moves. */
|
|
198
|
-
export interface DraggableCollectionMoveEvent extends DragMoveEvent {
|
|
199
|
-
/** The keys of the items that were dragged. */
|
|
200
|
-
keys: Set<string | number>;
|
|
201
|
-
}
|
|
202
|
-
/** Event fired when a collection drag ends. */
|
|
203
|
-
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
|
-
}
|
|
209
|
-
/** Function to render a custom drag preview. */
|
|
210
|
-
export type DragPreviewRenderer = (items: DragItem[], callback: (node: HTMLElement | null, x?: number, y?: number) => void) => void;
|
|
211
|
-
/** Props for droppable collection utility handlers. */
|
|
212
|
-
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;
|
|
230
|
-
}
|
|
231
|
-
/** Base props for droppable collections. */
|
|
232
|
-
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;
|
|
243
|
-
}
|
|
244
|
-
/** Combined props for droppable collections. */
|
|
245
|
-
export interface DroppableCollectionProps extends DroppableCollectionUtilityOptions, DroppableCollectionBaseProps {
|
|
246
|
-
}
|
|
247
|
-
/** Props for draggable collections. */
|
|
248
|
-
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
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* createFormValidationState for solid-stately
|
|
3
|
-
*
|
|
4
|
-
* Manages form validation state including realtime and displayed validation results.
|
|
5
|
-
* Supports both ARIA (live) and native (on submit) validation behaviors.
|
|
6
|
-
*
|
|
7
|
-
* Port of react-stately's useFormValidationState.
|
|
8
|
-
*/
|
|
9
|
-
import { type Accessor } from 'solid-js';
|
|
10
|
-
/** Standard HTML ValidityState interface. */
|
|
11
|
-
export interface ValidityState {
|
|
12
|
-
badInput: boolean;
|
|
13
|
-
customError: boolean;
|
|
14
|
-
patternMismatch: boolean;
|
|
15
|
-
rangeOverflow: boolean;
|
|
16
|
-
rangeUnderflow: boolean;
|
|
17
|
-
stepMismatch: boolean;
|
|
18
|
-
tooLong: boolean;
|
|
19
|
-
tooShort: boolean;
|
|
20
|
-
typeMismatch: boolean;
|
|
21
|
-
valueMissing: boolean;
|
|
22
|
-
valid: boolean;
|
|
23
|
-
}
|
|
24
|
-
/** Result of validation. */
|
|
25
|
-
export interface ValidationResult {
|
|
26
|
-
/** Whether the value is invalid. */
|
|
27
|
-
isInvalid: boolean;
|
|
28
|
-
/** Details about which validation constraints failed. */
|
|
29
|
-
validationDetails: ValidityState;
|
|
30
|
-
/** Error messages to display. */
|
|
31
|
-
validationErrors: string[];
|
|
32
|
-
}
|
|
33
|
-
/** Map of field names to their validation errors. */
|
|
34
|
-
export type ValidationErrors = Record<string, string | string[]>;
|
|
35
|
-
/** Validation function that returns error messages or true/false. */
|
|
36
|
-
export type ValidationFunction<T> = (value: T) => boolean | string | string[] | null | undefined;
|
|
37
|
-
/** Validation behavior mode. */
|
|
38
|
-
export type ValidationBehavior = 'aria' | 'native';
|
|
39
|
-
export interface FormValidationProps<T> {
|
|
40
|
-
/** Whether the value is invalid (controlled). */
|
|
41
|
-
isInvalid?: boolean;
|
|
42
|
-
/** @deprecated Use isInvalid instead. */
|
|
43
|
-
validationState?: 'valid' | 'invalid';
|
|
44
|
-
/** Custom validation function. */
|
|
45
|
-
validate?: ValidationFunction<T>;
|
|
46
|
-
/** Validation behavior: 'aria' for realtime, 'native' for on submit. */
|
|
47
|
-
validationBehavior?: ValidationBehavior;
|
|
48
|
-
/** Built-in validation result from native input. */
|
|
49
|
-
builtinValidation?: ValidationResult;
|
|
50
|
-
/** Field name(s) for server error lookup. */
|
|
51
|
-
name?: string | string[];
|
|
52
|
-
/** Current field value. */
|
|
53
|
-
value: T | null;
|
|
54
|
-
}
|
|
55
|
-
export interface FormValidationState {
|
|
56
|
-
/** Realtime validation results, updated as the user edits the value. */
|
|
57
|
-
realtimeValidation: Accessor<ValidationResult>;
|
|
58
|
-
/** Currently displayed validation results, updated when the user commits their changes. */
|
|
59
|
-
displayValidation: Accessor<ValidationResult>;
|
|
60
|
-
/** Updates the current validation result. Not displayed to the user until `commitValidation` is called. */
|
|
61
|
-
updateValidation(result: ValidationResult): void;
|
|
62
|
-
/** Resets the displayed validation state to valid when the user resets the form. */
|
|
63
|
-
resetValidation(): void;
|
|
64
|
-
/** Commits the realtime validation so it is displayed to the user. */
|
|
65
|
-
commitValidation(): void;
|
|
66
|
-
}
|
|
67
|
-
/** A valid validity state. */
|
|
68
|
-
export declare const VALID_VALIDITY_STATE: ValidityState;
|
|
69
|
-
/** Default validation result (valid). */
|
|
70
|
-
export declare const DEFAULT_VALIDATION_RESULT: ValidationResult;
|
|
71
|
-
/** Context for server-side validation errors. */
|
|
72
|
-
export declare const FormValidationContext: import("solid-js").Context<ValidationErrors>;
|
|
73
|
-
/** Private prop key for passing validation state to children. */
|
|
74
|
-
export declare const privateValidationStateProp: string;
|
|
75
|
-
/**
|
|
76
|
-
* Creates form validation state for a field.
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```tsx
|
|
80
|
-
* const validationState = createFormValidationState({
|
|
81
|
-
* value: inputValue(),
|
|
82
|
-
* validate: (value) => {
|
|
83
|
-
* if (!value) return 'This field is required';
|
|
84
|
-
* if (value.length < 3) return 'Must be at least 3 characters';
|
|
85
|
-
* return null;
|
|
86
|
-
* },
|
|
87
|
-
* validationBehavior: 'aria',
|
|
88
|
-
* });
|
|
89
|
-
*
|
|
90
|
-
* // Access validation state
|
|
91
|
-
* const isInvalid = () => validationState.displayValidation().isInvalid;
|
|
92
|
-
* const errors = () => validationState.displayValidation().validationErrors;
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
export declare function createFormValidationState<T>(props: FormValidationProps<T>): FormValidationState;
|
|
96
|
-
/**
|
|
97
|
-
* Merges multiple validation results into one.
|
|
98
|
-
*/
|
|
99
|
-
export declare function mergeValidation(...results: ValidationResult[]): ValidationResult;
|
package/dist/form/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
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';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Grid state management for Table and GridList components.
|
|
3
|
-
* Based on @react-stately/grid/useGridState.
|
|
4
|
-
*/
|
|
5
|
-
import { type Accessor } from 'solid-js';
|
|
6
|
-
import type { GridState, GridStateOptions, GridCollection } from './types';
|
|
7
|
-
/**
|
|
8
|
-
* Creates state management for a grid component.
|
|
9
|
-
* Handles row selection, focus management, and keyboard navigation state.
|
|
10
|
-
*/
|
|
11
|
-
export declare function createGridState<T extends object, C extends GridCollection<T> = GridCollection<T>>(options: Accessor<GridStateOptions<T, C>>): GridState<T, C>;
|
package/dist/grid/index.d.ts
DELETED
package/dist/grid/types.d.ts
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Grid collection types for Table and GridList components.
|
|
3
|
-
* Based on @react-types/grid.
|
|
4
|
-
*/
|
|
5
|
-
import type { Key, FocusStrategy } from '../collections/types';
|
|
6
|
-
/**
|
|
7
|
-
* Represents the type of a grid node.
|
|
8
|
-
*/
|
|
9
|
-
export type GridNodeType = 'item' | 'cell' | 'column' | 'rowheader' | 'headerrow' | 'section' | 'placeholder';
|
|
10
|
-
/**
|
|
11
|
-
* Represents a node in a grid collection.
|
|
12
|
-
*/
|
|
13
|
-
export interface GridNode<T = unknown> {
|
|
14
|
-
/** The type of grid node. */
|
|
15
|
-
type: GridNodeType;
|
|
16
|
-
/** A unique key for the node. */
|
|
17
|
-
key: Key;
|
|
18
|
-
/** The original value/data for this node. */
|
|
19
|
-
value: T | null;
|
|
20
|
-
/** The text content for accessibility and typeahead. */
|
|
21
|
-
textValue: string;
|
|
22
|
-
/** The rendered content (JSX) - optional for programmatic nodes. */
|
|
23
|
-
rendered?: unknown;
|
|
24
|
-
/** The level of nesting (0 for top-level). */
|
|
25
|
-
level: number;
|
|
26
|
-
/** The index within the parent. */
|
|
27
|
-
index: number;
|
|
28
|
-
/** The key of the parent node, if any. */
|
|
29
|
-
parentKey?: Key | null;
|
|
30
|
-
/** Whether this node has child nodes. */
|
|
31
|
-
hasChildNodes: boolean;
|
|
32
|
-
/** Child nodes (cells for rows, rows for sections). */
|
|
33
|
-
childNodes: GridNode<T>[];
|
|
34
|
-
/** Whether this item is disabled. */
|
|
35
|
-
isDisabled?: boolean;
|
|
36
|
-
/** ARIA label for this node. */
|
|
37
|
-
'aria-label'?: string;
|
|
38
|
-
/** Additional props for the node. */
|
|
39
|
-
props?: Record<string, unknown>;
|
|
40
|
-
/** Column index for cells. */
|
|
41
|
-
column?: number;
|
|
42
|
-
/** Column span for cells. */
|
|
43
|
-
colspan?: number;
|
|
44
|
-
/** Row index. */
|
|
45
|
-
rowIndex?: number;
|
|
46
|
-
/** Whether this row can be expanded (for tree grids). */
|
|
47
|
-
isExpandable?: boolean;
|
|
48
|
-
/** Whether this row is expanded. */
|
|
49
|
-
isExpanded?: boolean;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* A collection of grid nodes with grid-specific navigation.
|
|
53
|
-
*/
|
|
54
|
-
export interface GridCollection<T = unknown> {
|
|
55
|
-
/** The number of items in the collection. */
|
|
56
|
-
readonly size: number;
|
|
57
|
-
/** All rows in the grid (including header rows). */
|
|
58
|
-
readonly rows: GridNode<T>[];
|
|
59
|
-
/** All column definitions. */
|
|
60
|
-
readonly columns: GridNode<T>[];
|
|
61
|
-
/** Number of header rows. */
|
|
62
|
-
readonly headerRows: GridNode<T>[];
|
|
63
|
-
/** Number of body rows (excluding headers). */
|
|
64
|
-
readonly rowCount: number;
|
|
65
|
-
/** Number of columns. */
|
|
66
|
-
readonly columnCount: number;
|
|
67
|
-
/** Get all keys in the collection. */
|
|
68
|
-
getKeys(): Iterable<Key>;
|
|
69
|
-
/** Get a node by its key. */
|
|
70
|
-
getItem(key: Key): GridNode<T> | null;
|
|
71
|
-
/** Get a node by index. */
|
|
72
|
-
at(index: number): GridNode<T> | null;
|
|
73
|
-
/** Get the key before the given key. */
|
|
74
|
-
getKeyBefore(key: Key): Key | null;
|
|
75
|
-
/** Get the key after the given key. */
|
|
76
|
-
getKeyAfter(key: Key): Key | null;
|
|
77
|
-
/** Get the first key in the collection. */
|
|
78
|
-
getFirstKey(): Key | null;
|
|
79
|
-
/** Get the last key in the collection. */
|
|
80
|
-
getLastKey(): Key | null;
|
|
81
|
-
/** Get the children of a node. */
|
|
82
|
-
getChildren(key: Key): Iterable<GridNode<T>>;
|
|
83
|
-
/** Get the text value for a key. */
|
|
84
|
-
getTextValue(key: Key): string;
|
|
85
|
-
/** Get a cell by row and column key. */
|
|
86
|
-
getCell(rowKey: Key, columnKey: Key): GridNode<T> | null;
|
|
87
|
-
/** Iterator over all nodes. */
|
|
88
|
-
[Symbol.iterator](): Iterator<GridNode<T>>;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* State for a grid component.
|
|
92
|
-
*/
|
|
93
|
-
export interface GridState<T, C extends GridCollection<T> = GridCollection<T>> {
|
|
94
|
-
/** The grid collection. */
|
|
95
|
-
readonly collection: C;
|
|
96
|
-
/** Keys of disabled rows. */
|
|
97
|
-
readonly disabledKeys: Set<Key>;
|
|
98
|
-
/** Whether keyboard navigation is disabled. */
|
|
99
|
-
readonly isKeyboardNavigationDisabled: boolean;
|
|
100
|
-
/** Currently focused key. */
|
|
101
|
-
readonly focusedKey: Key | null;
|
|
102
|
-
/** Focus strategy for child focus. */
|
|
103
|
-
readonly childFocusStrategy: FocusStrategy | null;
|
|
104
|
-
/** Whether the grid is focused. */
|
|
105
|
-
readonly isFocused: boolean;
|
|
106
|
-
/** The selection mode. */
|
|
107
|
-
readonly selectionMode: 'none' | 'single' | 'multiple';
|
|
108
|
-
/** The currently selected keys. */
|
|
109
|
-
readonly selectedKeys: 'all' | Set<Key>;
|
|
110
|
-
/** Check if a key is selected. */
|
|
111
|
-
isSelected(key: Key): boolean;
|
|
112
|
-
/** Check if a key is disabled. */
|
|
113
|
-
isDisabled(key: Key): boolean;
|
|
114
|
-
/** Set the focused key. */
|
|
115
|
-
setFocusedKey(key: Key | null, childFocusStrategy?: FocusStrategy): void;
|
|
116
|
-
/** Set focused state. */
|
|
117
|
-
setFocused(isFocused: boolean): void;
|
|
118
|
-
/** Toggle selection for a key. */
|
|
119
|
-
toggleSelection(key: Key): void;
|
|
120
|
-
/** Replace selection with a key. */
|
|
121
|
-
replaceSelection(key: Key): void;
|
|
122
|
-
/** Extend selection to a key (shift-click). */
|
|
123
|
-
extendSelection(toKey: Key): void;
|
|
124
|
-
/** Select all rows. */
|
|
125
|
-
selectAll(): void;
|
|
126
|
-
/** Clear selection. */
|
|
127
|
-
clearSelection(): void;
|
|
128
|
-
/** Toggle select all. */
|
|
129
|
-
toggleSelectAll(): void;
|
|
130
|
-
/** Set keyboard navigation disabled. */
|
|
131
|
-
setKeyboardNavigationDisabled(isDisabled: boolean): void;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Options for creating grid state.
|
|
135
|
-
*/
|
|
136
|
-
export interface GridStateOptions<T, C extends GridCollection<T> = GridCollection<T>> {
|
|
137
|
-
/** The grid collection. */
|
|
138
|
-
collection: C;
|
|
139
|
-
/** Keys of disabled rows. */
|
|
140
|
-
disabledKeys?: Iterable<Key>;
|
|
141
|
-
/** Focus mode: 'row' or 'cell'. */
|
|
142
|
-
focusMode?: 'row' | 'cell';
|
|
143
|
-
/** Selection mode. */
|
|
144
|
-
selectionMode?: 'none' | 'single' | 'multiple';
|
|
145
|
-
/** Selection behavior. */
|
|
146
|
-
selectionBehavior?: 'toggle' | 'replace';
|
|
147
|
-
/** Whether empty selection is disallowed. */
|
|
148
|
-
disallowEmptySelection?: boolean;
|
|
149
|
-
/** Currently selected keys (controlled). */
|
|
150
|
-
selectedKeys?: 'all' | Iterable<Key>;
|
|
151
|
-
/** Default selected keys (uncontrolled). */
|
|
152
|
-
defaultSelectedKeys?: 'all' | Iterable<Key>;
|
|
153
|
-
/** Handler for selection changes. */
|
|
154
|
-
onSelectionChange?: (keys: 'all' | Set<Key>) => void;
|
|
155
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* State management for NumberField.
|
|
3
|
-
* Based on @react-stately/numberfield useNumberFieldState.
|
|
4
|
-
*/
|
|
5
|
-
import { type Accessor } from 'solid-js';
|
|
6
|
-
import { type MaybeAccessor } from '../utils';
|
|
7
|
-
export interface NumberFieldStateProps {
|
|
8
|
-
/** The current value (controlled). */
|
|
9
|
-
value?: number;
|
|
10
|
-
/** The default value (uncontrolled). */
|
|
11
|
-
defaultValue?: number;
|
|
12
|
-
/** Handler called when the value changes. */
|
|
13
|
-
onChange?: (value: number) => void;
|
|
14
|
-
/** The minimum value. */
|
|
15
|
-
minValue?: number;
|
|
16
|
-
/** The maximum value. */
|
|
17
|
-
maxValue?: number;
|
|
18
|
-
/** The step value for increment/decrement. */
|
|
19
|
-
step?: number;
|
|
20
|
-
/** Whether the field is disabled. */
|
|
21
|
-
isDisabled?: boolean;
|
|
22
|
-
/** Whether the field is read-only. */
|
|
23
|
-
isReadOnly?: boolean;
|
|
24
|
-
/** The locale for number formatting. */
|
|
25
|
-
locale?: string;
|
|
26
|
-
/** Number format options. */
|
|
27
|
-
formatOptions?: Intl.NumberFormatOptions;
|
|
28
|
-
}
|
|
29
|
-
export interface NumberFieldState {
|
|
30
|
-
/** The current input value as a string. */
|
|
31
|
-
inputValue: Accessor<string>;
|
|
32
|
-
/** The current numeric value. */
|
|
33
|
-
numberValue: Accessor<number>;
|
|
34
|
-
/** Whether the value can be incremented. */
|
|
35
|
-
canIncrement: Accessor<boolean>;
|
|
36
|
-
/** Whether the value can be decremented. */
|
|
37
|
-
canDecrement: Accessor<boolean>;
|
|
38
|
-
/** Whether the field is disabled. */
|
|
39
|
-
isDisabled: Accessor<boolean>;
|
|
40
|
-
/** Whether the field is read-only. */
|
|
41
|
-
isReadOnly: Accessor<boolean>;
|
|
42
|
-
/** The minimum value. */
|
|
43
|
-
minValue: Accessor<number | undefined>;
|
|
44
|
-
/** The maximum value. */
|
|
45
|
-
maxValue: Accessor<number | undefined>;
|
|
46
|
-
/** Set the input value. */
|
|
47
|
-
setInputValue: (value: string) => void;
|
|
48
|
-
/** Validate a partial input value. */
|
|
49
|
-
validate: (value: string) => boolean;
|
|
50
|
-
/** Commit the current input value. */
|
|
51
|
-
commit: () => void;
|
|
52
|
-
/** Increment the value by step. */
|
|
53
|
-
increment: () => void;
|
|
54
|
-
/** Decrement the value by step. */
|
|
55
|
-
decrement: () => void;
|
|
56
|
-
/** Set to maximum value. */
|
|
57
|
-
incrementToMax: () => void;
|
|
58
|
-
/** Set to minimum value. */
|
|
59
|
-
decrementToMin: () => void;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Creates state for a number field.
|
|
63
|
-
*/
|
|
64
|
-
export declare function createNumberFieldState(props: MaybeAccessor<NumberFieldStateProps>): NumberFieldState;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createNumberFieldState, type NumberFieldStateProps, type NumberFieldState, } from './createNumberFieldState';
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Manages state for an overlay trigger.
|
|
3
|
-
* Based on @react-stately/overlays useOverlayTriggerState.
|
|
4
|
-
*/
|
|
5
|
-
import { type Accessor } from 'solid-js';
|
|
6
|
-
import { type MaybeAccessor } from '../utils';
|
|
7
|
-
export interface OverlayTriggerProps {
|
|
8
|
-
/** Whether the overlay is open by default (uncontrolled). */
|
|
9
|
-
defaultOpen?: boolean;
|
|
10
|
-
/** Whether the overlay is open (controlled). */
|
|
11
|
-
isOpen?: boolean;
|
|
12
|
-
/** Handler that is called when the overlay's open state changes. */
|
|
13
|
-
onOpenChange?: (isOpen: boolean) => void;
|
|
14
|
-
}
|
|
15
|
-
export interface OverlayTriggerState {
|
|
16
|
-
/** Whether the overlay is currently open. */
|
|
17
|
-
readonly isOpen: Accessor<boolean>;
|
|
18
|
-
/** Sets whether the overlay is open. */
|
|
19
|
-
setOpen(isOpen: boolean): void;
|
|
20
|
-
/** Opens the overlay. */
|
|
21
|
-
open(): void;
|
|
22
|
-
/** Closes the overlay. */
|
|
23
|
-
close(): void;
|
|
24
|
-
/** Toggles the overlay's visibility. */
|
|
25
|
-
toggle(): void;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Manages state for an overlay trigger. Tracks whether the overlay is open, and provides
|
|
29
|
-
* methods to toggle this state.
|
|
30
|
-
*/
|
|
31
|
-
export declare function createOverlayTriggerState(props?: MaybeAccessor<OverlayTriggerProps>): OverlayTriggerState;
|
package/dist/overlays/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createOverlayTriggerState, type OverlayTriggerProps, type OverlayTriggerState, } from './createOverlayTriggerState';
|