@react-types/shared 3.15.0 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-types/shared",
3
- "version": "3.15.0",
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": "9202ef59e8c104dd06ffe33148445ef7932a5d1b"
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
- export type BorderColorValue =
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
- export type BackgroundColorValue =
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
@@ -62,7 +62,7 @@ export interface DropExitEvent extends DragDropEvent {
62
62
  type: 'dropexit'
63
63
  }
64
64
 
65
- export interface TextItem {
65
+ export interface TextDropItem {
66
66
  /** The item kind. */
67
67
  kind: 'text',
68
68
  /**
@@ -74,7 +74,7 @@ export interface TextItem {
74
74
  getText(type: string): Promise<string>
75
75
  }
76
76
 
77
- export interface FileItem {
77
+ export interface FileDropItem {
78
78
  /** The item kind. */
79
79
  kind: 'file',
80
80
  /** The file type (usually a mime type). */
@@ -87,16 +87,16 @@ export interface FileItem {
87
87
  getText(): Promise<string>
88
88
  }
89
89
 
90
- export interface DirectoryItem {
90
+ export interface DirectoryDropItem {
91
91
  /** The item kind. */
92
92
  kind: 'directory',
93
93
  /** The directory name. */
94
94
  name: string,
95
95
  /** Returns the entries contained within the directory. */
96
- getEntries(): AsyncIterable<FileItem | DirectoryItem>
96
+ getEntries(): AsyncIterable<FileDropItem | DirectoryDropItem>
97
97
  }
98
98
 
99
- export type DropItem = TextItem | FileItem | DirectoryItem;
99
+ export type DropItem = TextDropItem | FileDropItem | DirectoryDropItem;
100
100
 
101
101
  export interface DropEvent extends DragDropEvent {
102
102
  /** The event type. */
@@ -149,7 +149,7 @@ export interface DroppableCollectionDropEvent extends DropEvent {
149
149
  target: DropTarget
150
150
  }
151
151
 
152
- interface DroppableCollectionInsertDropEvent {
152
+ export interface DroppableCollectionInsertDropEvent {
153
153
  /** The dropped items. */
154
154
  items: DropItem[],
155
155
  /** The drop operation that should occur. */
@@ -158,14 +158,14 @@ interface DroppableCollectionInsertDropEvent {
158
158
  target: ItemDropTarget
159
159
  }
160
160
 
161
- interface DroppableCollectionRootDropEvent {
161
+ export interface DroppableCollectionRootDropEvent {
162
162
  /** The dropped items. */
163
163
  items: DropItem[],
164
164
  /** The drop operation that should occur. */
165
165
  dropOperation: DropOperation
166
166
  }
167
167
 
168
- interface DroppableCollectionOnItemDropEvent {
168
+ export interface DroppableCollectionOnItemDropEvent {
169
169
  /** The dropped items. */
170
170
  items: DropItem[],
171
171
  /** The drop operation that should occur. */
@@ -176,7 +176,7 @@ interface DroppableCollectionOnItemDropEvent {
176
176
  target: ItemDropTarget
177
177
  }
178
178
 
179
- interface DroppableCollectionReorderEvent {
179
+ export interface DroppableCollectionReorderEvent {
180
180
  /** The keys of the items that were reordered. */
181
181
  keys: Set<Key>,
182
182
  /** The drop operation that should occur. */
@@ -251,17 +251,17 @@ export interface DroppableCollectionBaseProps {
251
251
 
252
252
  export interface DroppableCollectionProps extends DroppableCollectionUtilityOptions, DroppableCollectionBaseProps {}
253
253
 
254
- interface DraggableCollectionStartEvent extends DragStartEvent {
254
+ export interface DraggableCollectionStartEvent extends DragStartEvent {
255
255
  /** The keys of the items that were dragged. */
256
256
  keys: Set<Key>
257
257
  }
258
258
 
259
- interface DraggableCollectionMoveEvent extends DragMoveEvent {
259
+ export interface DraggableCollectionMoveEvent extends DragMoveEvent {
260
260
  /** The keys of the items that were dragged. */
261
261
  keys: Set<Key>
262
262
  }
263
263
 
264
- interface DraggableCollectionEndEvent extends DragEndEvent {
264
+ export interface DraggableCollectionEndEvent extends DragEndEvent {
265
265
  /** The keys of the items that were dragged. */
266
266
  keys: Set<Key>,
267
267
  /** Whether the drop ended within the same collection as it originated. */
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
- /** @deprecated Use continuePropagation. */
22
+ /**
23
+ * Use continuePropagation.
24
+ * @deprecated */
23
25
  stopPropagation(): void,
24
26
  continuePropagation(): void
25
27
  }
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<BackgroundColorValue>,
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<BorderColorValue>,
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<BorderColorValue>,
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<BorderColorValue>,
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<BorderColorValue>,
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<BorderColorValue>,
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<BorderColorValue>,
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<BorderColorValue>,
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>,