@react-types/shared 3.14.1 → 3.16.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/package.json +2 -2
- package/src/dna.d.ts +223 -7
- package/src/dnd.d.ts +140 -29
- package/src/dom.d.ts +1 -1
- package/src/events.d.ts +3 -1
- package/src/labelable.d.ts +5 -1
- package/src/style.d.ts +27 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-types/shared",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
"publishConfig": {
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "2954307ddbefe149241685440c81f80ece6b2c83"
|
|
18
18
|
}
|
package/src/dna.d.ts
CHANGED
|
@@ -32,7 +32,9 @@ export type DimensionValue =
|
|
|
32
32
|
| 'size-200'
|
|
33
33
|
| 'size-225'
|
|
34
34
|
| 'size-250'
|
|
35
|
+
| 'size-275'
|
|
35
36
|
| 'size-300'
|
|
37
|
+
| 'size-325'
|
|
36
38
|
| 'size-350'
|
|
37
39
|
| 'size-400'
|
|
38
40
|
| 'size-450'
|
|
@@ -235,13 +237,211 @@ export type ColorValue =
|
|
|
235
237
|
| 'static-seafoam-500'
|
|
236
238
|
| 'static-seafoam-600'
|
|
237
239
|
| 'static-seafoam-700'
|
|
240
|
+
| SemanticColorValue;
|
|
241
|
+
|
|
242
|
+
export type ColorValueV6 =
|
|
243
|
+
| 'gray-50'
|
|
244
|
+
| 'gray-75'
|
|
245
|
+
| 'gray-100'
|
|
246
|
+
| 'gray-200'
|
|
247
|
+
| 'gray-300'
|
|
248
|
+
| 'gray-400'
|
|
249
|
+
| 'gray-500'
|
|
250
|
+
| 'gray-600'
|
|
251
|
+
| 'gray-700'
|
|
252
|
+
| 'gray-800'
|
|
253
|
+
| 'gray-900'
|
|
254
|
+
| 'red-100'
|
|
255
|
+
| 'red-200'
|
|
256
|
+
| 'red-300'
|
|
257
|
+
| 'red-400'
|
|
258
|
+
| 'red-500'
|
|
259
|
+
| 'red-600'
|
|
260
|
+
| 'red-700'
|
|
261
|
+
| 'red-800'
|
|
262
|
+
| 'red-900'
|
|
263
|
+
| 'red-1000'
|
|
264
|
+
| 'red-1100'
|
|
265
|
+
| 'red-1200'
|
|
266
|
+
| 'red-1300'
|
|
267
|
+
| 'red-1400'
|
|
268
|
+
| 'orange-100'
|
|
269
|
+
| 'orange-200'
|
|
270
|
+
| 'orange-300'
|
|
271
|
+
| 'orange-400'
|
|
272
|
+
| 'orange-500'
|
|
273
|
+
| 'orange-600'
|
|
274
|
+
| 'orange-700'
|
|
275
|
+
| 'orange-800'
|
|
276
|
+
| 'orange-900'
|
|
277
|
+
| 'orange-1000'
|
|
278
|
+
| 'orange-1100'
|
|
279
|
+
| 'orange-1200'
|
|
280
|
+
| 'orange-1300'
|
|
281
|
+
| 'orange-1400'
|
|
282
|
+
| 'yellow-100'
|
|
283
|
+
| 'yellow-200'
|
|
284
|
+
| 'yellow-300'
|
|
285
|
+
| 'yellow-400'
|
|
286
|
+
| 'yellow-500'
|
|
287
|
+
| 'yellow-600'
|
|
288
|
+
| 'yellow-700'
|
|
289
|
+
| 'yellow-800'
|
|
290
|
+
| 'yellow-900'
|
|
291
|
+
| 'yellow-1000'
|
|
292
|
+
| 'yellow-1100'
|
|
293
|
+
| 'yellow-1200'
|
|
294
|
+
| 'yellow-1300'
|
|
295
|
+
| 'yellow-1400'
|
|
296
|
+
| 'chartreuse-100'
|
|
297
|
+
| 'chartreuse-200'
|
|
298
|
+
| 'chartreuse-300'
|
|
299
|
+
| 'chartreuse-400'
|
|
300
|
+
| 'chartreuse-500'
|
|
301
|
+
| 'chartreuse-600'
|
|
302
|
+
| 'chartreuse-700'
|
|
303
|
+
| 'chartreuse-800'
|
|
304
|
+
| 'chartreuse-900'
|
|
305
|
+
| 'chartreuse-1000'
|
|
306
|
+
| 'chartreuse-1100'
|
|
307
|
+
| 'chartreuse-1200'
|
|
308
|
+
| 'chartreuse-1300'
|
|
309
|
+
| 'chartreuse-1400'
|
|
310
|
+
| 'celery-100'
|
|
311
|
+
| 'celery-200'
|
|
312
|
+
| 'celery-300'
|
|
313
|
+
| 'celery-400'
|
|
314
|
+
| 'celery-500'
|
|
315
|
+
| 'celery-600'
|
|
316
|
+
| 'celery-700'
|
|
317
|
+
| 'celery-800'
|
|
318
|
+
| 'celery-900'
|
|
319
|
+
| 'celery-1000'
|
|
320
|
+
| 'celery-1100'
|
|
321
|
+
| 'celery-1200'
|
|
322
|
+
| 'celery-1300'
|
|
323
|
+
| 'celery-1400'
|
|
324
|
+
| 'green-100'
|
|
325
|
+
| 'green-200'
|
|
326
|
+
| 'green-300'
|
|
327
|
+
| 'green-400'
|
|
328
|
+
| 'green-500'
|
|
329
|
+
| 'green-600'
|
|
330
|
+
| 'green-700'
|
|
331
|
+
| 'green-800'
|
|
332
|
+
| 'green-900'
|
|
333
|
+
| 'green-1000'
|
|
334
|
+
| 'green-1100'
|
|
335
|
+
| 'green-1200'
|
|
336
|
+
| 'green-1300'
|
|
337
|
+
| 'green-1400'
|
|
338
|
+
| 'seafoam-100'
|
|
339
|
+
| 'seafoam-200'
|
|
340
|
+
| 'seafoam-300'
|
|
341
|
+
| 'seafoam-400'
|
|
342
|
+
| 'seafoam-500'
|
|
343
|
+
| 'seafoam-600'
|
|
344
|
+
| 'seafoam-700'
|
|
345
|
+
| 'seafoam-800'
|
|
346
|
+
| 'seafoam-900'
|
|
347
|
+
| 'seafoam-1000'
|
|
348
|
+
| 'seafoam-1100'
|
|
349
|
+
| 'seafoam-1200'
|
|
350
|
+
| 'seafoam-1300'
|
|
351
|
+
| 'seafoam-1400'
|
|
352
|
+
| 'cyan-100'
|
|
353
|
+
| 'cyan-200'
|
|
354
|
+
| 'cyan-300'
|
|
355
|
+
| 'cyan-400'
|
|
356
|
+
| 'cyan-500'
|
|
357
|
+
| 'cyan-600'
|
|
358
|
+
| 'cyan-700'
|
|
359
|
+
| 'cyan-800'
|
|
360
|
+
| 'cyan-900'
|
|
361
|
+
| 'cyan-1000'
|
|
362
|
+
| 'cyan-1100'
|
|
363
|
+
| 'cyan-1200'
|
|
364
|
+
| 'cyan-1300'
|
|
365
|
+
| 'cyan-1400'
|
|
366
|
+
| 'blue-100'
|
|
367
|
+
| 'blue-200'
|
|
368
|
+
| 'blue-300'
|
|
369
|
+
| 'blue-400'
|
|
370
|
+
| 'blue-500'
|
|
371
|
+
| 'blue-600'
|
|
372
|
+
| 'blue-700'
|
|
373
|
+
| 'blue-800'
|
|
374
|
+
| 'blue-900'
|
|
375
|
+
| 'blue-1000'
|
|
376
|
+
| 'blue-1100'
|
|
377
|
+
| 'blue-1200'
|
|
378
|
+
| 'blue-1300'
|
|
379
|
+
| 'blue-1400'
|
|
380
|
+
| 'indigo-100'
|
|
381
|
+
| 'indigo-200'
|
|
382
|
+
| 'indigo-300'
|
|
383
|
+
| 'indigo-400'
|
|
384
|
+
| 'indigo-500'
|
|
385
|
+
| 'indigo-600'
|
|
386
|
+
| 'indigo-700'
|
|
387
|
+
| 'indigo-800'
|
|
388
|
+
| 'indigo-900'
|
|
389
|
+
| 'indigo-1000'
|
|
390
|
+
| 'indigo-1100'
|
|
391
|
+
| 'indigo-1200'
|
|
392
|
+
| 'indigo-1300'
|
|
393
|
+
| 'indigo-1400'
|
|
394
|
+
| 'purple-100'
|
|
395
|
+
| 'purple-200'
|
|
396
|
+
| 'purple-300'
|
|
397
|
+
| 'purple-400'
|
|
398
|
+
| 'purple-500'
|
|
399
|
+
| 'purple-600'
|
|
400
|
+
| 'purple-700'
|
|
401
|
+
| 'purple-800'
|
|
402
|
+
| 'purple-900'
|
|
403
|
+
| 'purple-1000'
|
|
404
|
+
| 'purple-1100'
|
|
405
|
+
| 'purple-1200'
|
|
406
|
+
| 'purple-1300'
|
|
407
|
+
| 'purple-1400'
|
|
408
|
+
| 'fuchsia-100'
|
|
409
|
+
| 'fuchsia-200'
|
|
410
|
+
| 'fuchsia-300'
|
|
411
|
+
| 'fuchsia-400'
|
|
412
|
+
| 'fuchsia-500'
|
|
413
|
+
| 'fuchsia-600'
|
|
414
|
+
| 'fuchsia-700'
|
|
415
|
+
| 'fuchsia-800'
|
|
416
|
+
| 'fuchsia-900'
|
|
417
|
+
| 'fuchsia-1000'
|
|
418
|
+
| 'fuchsia-1100'
|
|
419
|
+
| 'fuchsia-1200'
|
|
420
|
+
| 'fuchsia-1300'
|
|
421
|
+
| 'fuchsia-1400'
|
|
422
|
+
| 'magenta-100'
|
|
423
|
+
| 'magenta-200'
|
|
424
|
+
| 'magenta-300'
|
|
425
|
+
| 'magenta-400'
|
|
426
|
+
| 'magenta-500'
|
|
427
|
+
| 'magenta-600'
|
|
428
|
+
| 'magenta-700'
|
|
429
|
+
| 'magenta-800'
|
|
430
|
+
| 'magenta-900'
|
|
431
|
+
| 'magenta-1000'
|
|
432
|
+
| 'magenta-1100'
|
|
433
|
+
| 'magenta-1200'
|
|
434
|
+
| 'magenta-1300'
|
|
435
|
+
| 'magenta-1400'
|
|
436
|
+
| SemanticColorValue;
|
|
437
|
+
|
|
438
|
+
type SemanticColorValue =
|
|
238
439
|
| 'negative'
|
|
239
440
|
| 'notice'
|
|
240
441
|
| 'positive'
|
|
241
442
|
| 'informative';
|
|
242
443
|
|
|
243
|
-
|
|
244
|
-
| 'default'
|
|
444
|
+
type BorderColorAlias =
|
|
245
445
|
| 'negative'
|
|
246
446
|
| 'notice'
|
|
247
447
|
| 'positive'
|
|
@@ -257,14 +457,13 @@ export type BorderColorValue =
|
|
|
257
457
|
| 'dark'
|
|
258
458
|
| 'transparent'
|
|
259
459
|
| 'translucent-dark'
|
|
260
|
-
| 'translucent-darker'
|
|
261
|
-
| ColorValue;
|
|
460
|
+
| 'translucent-darker';
|
|
262
461
|
|
|
263
|
-
|
|
462
|
+
type BackgroundColorAlias =
|
|
264
463
|
| 'default'
|
|
464
|
+
| 'disabled'
|
|
265
465
|
| 'transparent'
|
|
266
|
-
| 'label-gray'
|
|
267
|
-
| ColorValue;
|
|
466
|
+
| 'label-gray';
|
|
268
467
|
|
|
269
468
|
export type IconColorValue =
|
|
270
469
|
| 'negative'
|
|
@@ -284,3 +483,20 @@ export type BorderRadiusValue =
|
|
|
284
483
|
| 'regular'
|
|
285
484
|
| 'medium'
|
|
286
485
|
| 'large';
|
|
486
|
+
|
|
487
|
+
export type BorderColorValue =
|
|
488
|
+
| 'default'
|
|
489
|
+
| BorderColorAlias
|
|
490
|
+
| ColorValue;
|
|
491
|
+
|
|
492
|
+
export type BorderColorValueV6 =
|
|
493
|
+
| BorderColorAlias
|
|
494
|
+
| ColorValueV6;
|
|
495
|
+
|
|
496
|
+
export type BackgroundColorValue =
|
|
497
|
+
| BackgroundColorAlias
|
|
498
|
+
| ColorValue;
|
|
499
|
+
|
|
500
|
+
export type BackgroundColorValueV6 =
|
|
501
|
+
| BackgroundColorAlias
|
|
502
|
+
| ColorValueV6;
|
package/src/dnd.d.ts
CHANGED
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
import {Key, RefObject} from 'react';
|
|
14
14
|
|
|
15
15
|
export interface DragDropEvent {
|
|
16
|
-
|
|
16
|
+
/** The x coordinate of the event, relative to the target element. */
|
|
17
17
|
x: number,
|
|
18
|
+
/** The y coordinate of the event, relative to the target element. */
|
|
18
19
|
y: number
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -25,97 +26,168 @@ export interface DragItem {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
export interface DragStartEvent extends DragDropEvent {
|
|
29
|
+
/** The event type. */
|
|
28
30
|
type: 'dragstart'
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
export interface DragMoveEvent extends DragDropEvent {
|
|
34
|
+
/** The event type. */
|
|
32
35
|
type: 'dragmove'
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
export interface DragEndEvent extends DragDropEvent {
|
|
39
|
+
/** The event type. */
|
|
36
40
|
type: 'dragend',
|
|
41
|
+
/** The drop operation that occurred. */
|
|
37
42
|
dropOperation: DropOperation
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
export interface DropEnterEvent extends DragDropEvent {
|
|
46
|
+
/** The event type. */
|
|
41
47
|
type: 'dropenter'
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
export interface DropMoveEvent extends DragDropEvent {
|
|
51
|
+
/** The event type. */
|
|
45
52
|
type: 'dropmove'
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
export interface DropActivateEvent extends DragDropEvent {
|
|
56
|
+
/** The event type. */
|
|
49
57
|
type: 'dropactivate'
|
|
50
58
|
}
|
|
51
59
|
|
|
52
60
|
export interface DropExitEvent extends DragDropEvent {
|
|
61
|
+
/** The event type. */
|
|
53
62
|
type: 'dropexit'
|
|
54
63
|
}
|
|
55
64
|
|
|
56
|
-
export interface
|
|
65
|
+
export interface TextDropItem {
|
|
66
|
+
/** The item kind. */
|
|
57
67
|
kind: 'text',
|
|
68
|
+
/**
|
|
69
|
+
* The drag types available for this item.
|
|
70
|
+
* These are often mime types, but may be custom app-specific types.
|
|
71
|
+
*/
|
|
58
72
|
types: Set<string>,
|
|
73
|
+
/** Returns the data for the given type as a string. */
|
|
59
74
|
getText(type: string): Promise<string>
|
|
60
75
|
}
|
|
61
76
|
|
|
62
|
-
export interface
|
|
77
|
+
export interface FileDropItem {
|
|
78
|
+
/** The item kind. */
|
|
63
79
|
kind: 'file',
|
|
80
|
+
/** The file type (usually a mime type). */
|
|
64
81
|
type: string,
|
|
82
|
+
/** The file name. */
|
|
65
83
|
name: string,
|
|
84
|
+
/** Returns the contents of the file as a blob. */
|
|
66
85
|
getFile(): Promise<File>,
|
|
86
|
+
/** Returns the contents of the file as a string. */
|
|
67
87
|
getText(): Promise<string>
|
|
68
88
|
}
|
|
69
89
|
|
|
70
|
-
export interface
|
|
90
|
+
export interface DirectoryDropItem {
|
|
91
|
+
/** The item kind. */
|
|
71
92
|
kind: 'directory',
|
|
93
|
+
/** The directory name. */
|
|
72
94
|
name: string,
|
|
73
|
-
|
|
95
|
+
/** Returns the entries contained within the directory. */
|
|
96
|
+
getEntries(): AsyncIterable<FileDropItem | DirectoryDropItem>
|
|
74
97
|
}
|
|
75
98
|
|
|
76
|
-
export type DropItem =
|
|
99
|
+
export type DropItem = TextDropItem | FileDropItem | DirectoryDropItem;
|
|
77
100
|
|
|
78
101
|
export interface DropEvent extends DragDropEvent {
|
|
102
|
+
/** The event type. */
|
|
79
103
|
type: 'drop',
|
|
104
|
+
/** The drop operation that should occur. */
|
|
80
105
|
dropOperation: DropOperation,
|
|
106
|
+
/** The dropped items. */
|
|
81
107
|
items: DropItem[]
|
|
82
108
|
}
|
|
83
109
|
|
|
84
110
|
export type DropPosition = 'on' | 'before' | 'after';
|
|
85
|
-
interface RootDropTarget {
|
|
111
|
+
export interface RootDropTarget {
|
|
112
|
+
/** The event type. */
|
|
86
113
|
type: 'root'
|
|
87
114
|
}
|
|
88
115
|
|
|
89
116
|
export interface ItemDropTarget {
|
|
117
|
+
/** The drop target type. */
|
|
90
118
|
type: 'item',
|
|
119
|
+
/** The item key. */
|
|
91
120
|
key: Key,
|
|
121
|
+
/** The drop position relative to the item. */
|
|
92
122
|
dropPosition: DropPosition
|
|
93
123
|
}
|
|
94
124
|
|
|
95
125
|
export type DropTarget = RootDropTarget | ItemDropTarget;
|
|
96
126
|
|
|
97
|
-
interface DroppableCollectionEnterEvent extends DropEnterEvent {
|
|
127
|
+
export interface DroppableCollectionEnterEvent extends DropEnterEvent {
|
|
128
|
+
/** The drop target. */
|
|
98
129
|
target: DropTarget
|
|
99
130
|
}
|
|
100
131
|
|
|
101
|
-
interface DroppableCollectionMoveEvent extends DropMoveEvent {
|
|
132
|
+
export interface DroppableCollectionMoveEvent extends DropMoveEvent {
|
|
133
|
+
/** The drop target. */
|
|
102
134
|
target: DropTarget
|
|
103
135
|
}
|
|
104
136
|
|
|
105
|
-
interface DroppableCollectionActivateEvent extends DropActivateEvent {
|
|
137
|
+
export interface DroppableCollectionActivateEvent extends DropActivateEvent {
|
|
138
|
+
/** The drop target. */
|
|
106
139
|
target: DropTarget
|
|
107
140
|
}
|
|
108
141
|
|
|
109
|
-
interface DroppableCollectionExitEvent extends DropExitEvent {
|
|
142
|
+
export interface DroppableCollectionExitEvent extends DropExitEvent {
|
|
143
|
+
/** The drop target. */
|
|
110
144
|
target: DropTarget
|
|
111
145
|
}
|
|
112
146
|
|
|
113
|
-
interface DroppableCollectionDropEvent extends DropEvent {
|
|
147
|
+
export interface DroppableCollectionDropEvent extends DropEvent {
|
|
148
|
+
/** The drop target. */
|
|
114
149
|
target: DropTarget
|
|
115
150
|
}
|
|
116
151
|
|
|
152
|
+
export interface DroppableCollectionInsertDropEvent {
|
|
153
|
+
/** The dropped items. */
|
|
154
|
+
items: DropItem[],
|
|
155
|
+
/** The drop operation that should occur. */
|
|
156
|
+
dropOperation: DropOperation,
|
|
157
|
+
/** The drop target. */
|
|
158
|
+
target: ItemDropTarget
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface DroppableCollectionRootDropEvent {
|
|
162
|
+
/** The dropped items. */
|
|
163
|
+
items: DropItem[],
|
|
164
|
+
/** The drop operation that should occur. */
|
|
165
|
+
dropOperation: DropOperation
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface DroppableCollectionOnItemDropEvent {
|
|
169
|
+
/** The dropped items. */
|
|
170
|
+
items: DropItem[],
|
|
171
|
+
/** The drop operation that should occur. */
|
|
172
|
+
dropOperation: DropOperation,
|
|
173
|
+
/** Whether the drag originated within the same collection as the drop. */
|
|
174
|
+
isInternal: boolean,
|
|
175
|
+
/** The drop target. */
|
|
176
|
+
target: ItemDropTarget
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface DroppableCollectionReorderEvent {
|
|
180
|
+
/** The keys of the items that were reordered. */
|
|
181
|
+
keys: Set<Key>,
|
|
182
|
+
/** The drop operation that should occur. */
|
|
183
|
+
dropOperation: DropOperation,
|
|
184
|
+
/** The drop target. */
|
|
185
|
+
target: ItemDropTarget
|
|
186
|
+
}
|
|
187
|
+
|
|
117
188
|
export interface DragTypes {
|
|
118
|
-
|
|
189
|
+
/** Returns whether the drag contains data of the given type. */
|
|
190
|
+
has(type: string | symbol): boolean
|
|
119
191
|
}
|
|
120
192
|
|
|
121
193
|
export interface DropTargetDelegate {
|
|
@@ -127,34 +199,73 @@ export interface DropTargetDelegate {
|
|
|
127
199
|
getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget | null
|
|
128
200
|
}
|
|
129
201
|
|
|
130
|
-
export interface
|
|
202
|
+
export interface DroppableCollectionUtilityOptions {
|
|
131
203
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
204
|
+
* The drag types that the droppable collection accepts. If the collection accepts directories, include `DIRECTORY_DRAG_TYPE` in your array of allowed types.
|
|
205
|
+
* @default 'all'
|
|
206
|
+
*/
|
|
207
|
+
acceptedDragTypes?: 'all' | Array<string | symbol>,
|
|
208
|
+
/**
|
|
209
|
+
* Handler that is called when external items are dropped "between" items.
|
|
210
|
+
*/
|
|
211
|
+
onInsert?: (e: DroppableCollectionInsertDropEvent) => void,
|
|
212
|
+
/**
|
|
213
|
+
* Handler that is called when external items are dropped on the droppable collection's root.
|
|
214
|
+
*/
|
|
215
|
+
onRootDrop?: (e: DroppableCollectionRootDropEvent) => void,
|
|
216
|
+
/**
|
|
217
|
+
* Handler that is called when items are dropped "on" an item.
|
|
218
|
+
*/
|
|
219
|
+
onItemDrop?: (e: DroppableCollectionOnItemDropEvent) => void,
|
|
220
|
+
/**
|
|
221
|
+
* Handler that is called when items are reordered via drag in the source collection.
|
|
134
222
|
*/
|
|
135
|
-
|
|
136
|
-
/**
|
|
223
|
+
onReorder?: (e: DroppableCollectionReorderEvent) => void,
|
|
224
|
+
/**
|
|
225
|
+
* A function returning whether a given target in the droppable collection is a valid "on" drop target for the current drag types.
|
|
226
|
+
*/
|
|
227
|
+
shouldAcceptItemDrop?: (target: ItemDropTarget, types: DragTypes) => boolean
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export interface DroppableCollectionBaseProps {
|
|
231
|
+
/** Handler that is called when a valid drag enters a drop target. */
|
|
137
232
|
onDropEnter?: (e: DroppableCollectionEnterEvent) => void,
|
|
138
|
-
/**
|
|
139
|
-
|
|
140
|
-
|
|
233
|
+
/**
|
|
234
|
+
* Handler that is called after a valid drag is held over a drop target for a period of time.
|
|
235
|
+
* @private
|
|
236
|
+
*/
|
|
141
237
|
onDropActivate?: (e: DroppableCollectionActivateEvent) => void,
|
|
142
|
-
/** Handler that is called when a valid drag exits
|
|
238
|
+
/** Handler that is called when a valid drag exits a drop target. */
|
|
143
239
|
onDropExit?: (e: DroppableCollectionExitEvent) => void,
|
|
144
|
-
/**
|
|
145
|
-
|
|
240
|
+
/**
|
|
241
|
+
* Handler that is called when a valid drag is dropped on a drop target. When defined, this overrides other
|
|
242
|
+
* drop handlers such as `onInsert`, and `onItemDrop`.
|
|
243
|
+
*/
|
|
244
|
+
onDrop?: (e: DroppableCollectionDropEvent) => void,
|
|
245
|
+
/**
|
|
246
|
+
* A function returning the drop operation to be performed when items matching the given types are dropped
|
|
247
|
+
* on the drop target.
|
|
248
|
+
*/
|
|
249
|
+
getDropOperation?: (target: DropTarget, types: DragTypes, allowedOperations: DropOperation[]) => DropOperation
|
|
146
250
|
}
|
|
147
251
|
|
|
148
|
-
interface
|
|
252
|
+
export interface DroppableCollectionProps extends DroppableCollectionUtilityOptions, DroppableCollectionBaseProps {}
|
|
253
|
+
|
|
254
|
+
export interface DraggableCollectionStartEvent extends DragStartEvent {
|
|
255
|
+
/** The keys of the items that were dragged. */
|
|
149
256
|
keys: Set<Key>
|
|
150
257
|
}
|
|
151
258
|
|
|
152
|
-
interface DraggableCollectionMoveEvent extends DragMoveEvent {
|
|
259
|
+
export interface DraggableCollectionMoveEvent extends DragMoveEvent {
|
|
260
|
+
/** The keys of the items that were dragged. */
|
|
153
261
|
keys: Set<Key>
|
|
154
262
|
}
|
|
155
263
|
|
|
156
|
-
interface DraggableCollectionEndEvent extends DragEndEvent {
|
|
157
|
-
keys
|
|
264
|
+
export interface DraggableCollectionEndEvent extends DragEndEvent {
|
|
265
|
+
/** The keys of the items that were dragged. */
|
|
266
|
+
keys: Set<Key>,
|
|
267
|
+
/** Whether the drop ended within the same collection as it originated. */
|
|
268
|
+
isInternal: boolean
|
|
158
269
|
}
|
|
159
270
|
|
|
160
271
|
export type DragPreviewRenderer = (items: DragItem[], callback: (node: HTMLElement) => void) => void;
|
|
@@ -162,7 +273,7 @@ export type DragPreviewRenderer = (items: DragItem[], callback: (node: HTMLEleme
|
|
|
162
273
|
export interface DraggableCollectionProps {
|
|
163
274
|
/** Handler that is called when a drag operation is started. */
|
|
164
275
|
onDragStart?: (e: DraggableCollectionStartEvent) => void,
|
|
165
|
-
/** Handler that is called when the
|
|
276
|
+
/** Handler that is called when the drag is moved. */
|
|
166
277
|
onDragMove?: (e: DraggableCollectionMoveEvent) => void,
|
|
167
278
|
/** Handler that is called when the drag operation is ended, either as a result of a drop or a cancellation. */
|
|
168
279
|
onDragEnd?: (e: DraggableCollectionEndEvent) => void,
|
package/src/dom.d.ts
CHANGED
|
@@ -157,7 +157,7 @@ export interface TextInputDOMProps extends DOMProps, TextInputDOMEvents {
|
|
|
157
157
|
/**
|
|
158
158
|
* The type of input to render. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdeftype).
|
|
159
159
|
*/
|
|
160
|
-
type?: 'text' | 'search' | 'url' | 'tel' | 'email' | 'password' | string,
|
|
160
|
+
type?: 'text' | 'search' | 'url' | 'tel' | 'email' | 'password' | (string & {}),
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
163
|
* Hints at the type of data that might be entered by the user while editing the element or its contents. See [MDN](https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute).
|
package/src/events.d.ts
CHANGED
|
@@ -19,7 +19,9 @@ import {
|
|
|
19
19
|
// Event bubbling can be problematic in real-world applications, so the default for React Spectrum components
|
|
20
20
|
// is not to propagate. This can be overridden by calling continuePropagation() on the event.
|
|
21
21
|
export type BaseEvent<T extends SyntheticEvent> = T & {
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Use continuePropagation.
|
|
24
|
+
* @deprecated */
|
|
23
25
|
stopPropagation(): void,
|
|
24
26
|
continuePropagation(): void
|
|
25
27
|
}
|
package/src/labelable.d.ts
CHANGED
|
@@ -40,5 +40,9 @@ export interface SpectrumLabelableProps extends LabelableProps {
|
|
|
40
40
|
/**
|
|
41
41
|
* Whether the label is labeling a required field or group.
|
|
42
42
|
*/
|
|
43
|
-
isRequired?: boolean
|
|
43
|
+
isRequired?: boolean,
|
|
44
|
+
/**
|
|
45
|
+
* A ContextualHelp element to place next to the label.
|
|
46
|
+
*/
|
|
47
|
+
contextualHelp?: ReactNode
|
|
44
48
|
}
|
package/src/style.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {BackgroundColorValue, BorderColorValue, BorderRadiusValue, BorderSizeValue, DimensionValue} from './dna';
|
|
13
|
+
import {BackgroundColorValue, BackgroundColorValueV6, BorderColorValue, BorderColorValueV6, BorderRadiusValue, BorderSizeValue, DimensionValue} from './dna';
|
|
14
14
|
import {CSSProperties} from 'react';
|
|
15
15
|
|
|
16
16
|
type ResponsiveProp<T> = {
|
|
@@ -112,11 +112,28 @@ export interface StyleProps {
|
|
|
112
112
|
isHidden?: Responsive<boolean>
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
export type ColorVersion = 5 | 6;
|
|
116
|
+
type BackgroundColor = {
|
|
117
|
+
5: BackgroundColorValue,
|
|
118
|
+
6: BackgroundColorValueV6
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
type BorderColor = {
|
|
122
|
+
5: BorderColorValue,
|
|
123
|
+
6: BorderColorValueV6
|
|
124
|
+
}
|
|
125
|
+
|
|
115
126
|
// These support more properties than specific Spectrum components
|
|
116
127
|
// but still based on spectrum global/alias variables.
|
|
117
|
-
export interface ViewStyleProps extends StyleProps {
|
|
128
|
+
export interface ViewStyleProps<C extends ColorVersion> extends StyleProps {
|
|
129
|
+
/**
|
|
130
|
+
* The Spectrum color token version number.
|
|
131
|
+
* @default 5
|
|
132
|
+
*/
|
|
133
|
+
colorVersion?: C,
|
|
134
|
+
|
|
118
135
|
/** The background color for the element. */
|
|
119
|
-
backgroundColor?: Responsive<
|
|
136
|
+
backgroundColor?: Responsive<BackgroundColor[C]>,
|
|
120
137
|
|
|
121
138
|
/** The width of the element's border on all four sides. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/border-width). */
|
|
122
139
|
borderWidth?: Responsive<BorderSizeValue>,
|
|
@@ -136,21 +153,21 @@ export interface ViewStyleProps extends StyleProps {
|
|
|
136
153
|
borderYWidth?: Responsive<BorderSizeValue>,
|
|
137
154
|
|
|
138
155
|
/** The color of the element's border on all four sides. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/border-color). */
|
|
139
|
-
borderColor?: Responsive<
|
|
156
|
+
borderColor?: Responsive<BorderColor[C]>,
|
|
140
157
|
/** The color of the border on the logical start side, depending on the layout direction. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/border-inline-start-color). */
|
|
141
|
-
borderStartColor?: Responsive<
|
|
158
|
+
borderStartColor?: Responsive<BorderColor[C]>,
|
|
142
159
|
/** The color of the border on the logical end side, depending on the layout direction. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/border-inline-end-color). */
|
|
143
|
-
borderEndColor?: Responsive<
|
|
160
|
+
borderEndColor?: Responsive<BorderColor[C]>,
|
|
144
161
|
// borderLeftColor?: BorderColorValue,
|
|
145
162
|
// borderRightColor?: BorderColorValue,
|
|
146
163
|
/** The color of the top border. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/border-top-color). */
|
|
147
|
-
borderTopColor?: Responsive<
|
|
164
|
+
borderTopColor?: Responsive<BorderColor[C]>,
|
|
148
165
|
/** The color of the bottom border. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-color). */
|
|
149
|
-
borderBottomColor?: Responsive<
|
|
166
|
+
borderBottomColor?: Responsive<BorderColor[C]>,
|
|
150
167
|
/** The color of the left and right borders. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/border-color). */
|
|
151
|
-
borderXColor?: Responsive<
|
|
168
|
+
borderXColor?: Responsive<BorderColor[C]>,
|
|
152
169
|
/** The color of the top and bottom borders. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/border-width). */
|
|
153
|
-
borderYColor?: Responsive<
|
|
170
|
+
borderYColor?: Responsive<BorderColor[C]>,
|
|
154
171
|
|
|
155
172
|
/** The border radius on all four sides of the element. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius). */
|
|
156
173
|
borderRadius?: Responsive<BorderRadiusValue>,
|