@react-types/shared 3.33.0 → 3.34.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.33.0",
3
+ "version": "3.34.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": "66e51757606b43a89ed02c574ca24517323a2ab9"
17
+ "gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
18
18
  }
@@ -218,6 +218,10 @@ export interface Node<T> {
218
218
  prevKey?: Key | null,
219
219
  /** The key of the node after this node. */
220
220
  nextKey?: Key | null,
221
+ /** The first child key of this node. */
222
+ firstChildKey?: Key | null,
223
+ /** The last child key of this node. */
224
+ lastChildKey?: Key | null,
221
225
  /** Additional properties specific to a particular node type. */
222
226
  props?: any,
223
227
  /** @private */
package/src/dom.d.ts CHANGED
@@ -17,7 +17,9 @@ import {
17
17
  ClipboardEventHandler,
18
18
  CompositionEventHandler,
19
19
  CSSProperties,
20
+ FormEvent,
20
21
  FormEventHandler,
22
+ FormHTMLAttributes,
21
23
  HTMLAttributeAnchorTarget,
22
24
  HTMLAttributeReferrerPolicy,
23
25
  MouseEventHandler,
@@ -29,6 +31,7 @@ import {
29
31
  UIEventHandler,
30
32
  WheelEventHandler
31
33
  } from 'react';
34
+ import {ValidationErrors} from './inputs';
32
35
 
33
36
  export interface AriaLabelingProps {
34
37
  /**
@@ -341,3 +344,57 @@ export interface GlobalDOMEvents<T = Element> {
341
344
  onTransitionStart?: TransitionEventHandler<T> | undefined,
342
345
  onTransitionStartCapture?: TransitionEventHandler<T> | undefined
343
346
  }
347
+
348
+ export interface FormProps extends AriaLabelingProps {
349
+ /**
350
+ * Validation errors for the form, typically returned by a server.
351
+ * This should be set to an object mapping from input names to errors.
352
+ */
353
+ validationErrors?: ValidationErrors,
354
+ /**
355
+ * Where to send the form-data when the form is submitted.
356
+ * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#action).
357
+ */
358
+ action?: string | FormHTMLAttributes<HTMLFormElement>['action'],
359
+ /**
360
+ * The enctype attribute specifies how the form-data should be encoded when submitting it to the server.
361
+ * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#enctype).
362
+ */
363
+ encType?: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain',
364
+ /**
365
+ * The HTTP method to submit the form with.
366
+ * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#method).
367
+ */
368
+ method?: 'get' | 'post' | 'dialog',
369
+ /**
370
+ * The target attribute specifies a name or a keyword that indicates where to display the response that is received after submitting the form.
371
+ * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#target).
372
+ */
373
+ target?: '_blank' | '_self' | '_parent' | '_top',
374
+ /**
375
+ * Triggered when a user submits the form.
376
+ */
377
+ onSubmit?: (event: FormEvent<HTMLFormElement>) => void,
378
+ /**
379
+ * Triggered when a user resets the form.
380
+ */
381
+ onReset?: (event: FormEvent<HTMLFormElement>) => void,
382
+ /**
383
+ * Triggered for each invalid field when a user submits the form.
384
+ */
385
+ onInvalid?: (event: FormEvent<HTMLFormElement>) => void,
386
+ /**
387
+ * Indicates whether input elements can by default have their values automatically completed by the browser.
388
+ * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#autocomplete).
389
+ */
390
+ autoComplete?: 'off' | 'on',
391
+ /**
392
+ * Controls whether inputted text is automatically capitalized and, if so, in what manner.
393
+ * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize).
394
+ */
395
+ autoCapitalize?: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters',
396
+ /**
397
+ * An ARIA role override to apply to the form element.
398
+ */
399
+ role?: 'search' | 'presentation'
400
+ }
@@ -18,7 +18,7 @@ export interface SingleSelection {
18
18
  /** The currently selected key in the collection (controlled). */
19
19
  selectedKey?: Key | null,
20
20
  /** The initial selected key in the collection (uncontrolled). */
21
- defaultSelectedKey?: Key,
21
+ defaultSelectedKey?: Key | null,
22
22
  /** Handler that is called when the selection changes. */
23
23
  onSelectionChange?: (key: Key | null) => void
24
24
  }