@react-types/shared 3.19.0 → 3.20.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 (2) hide show
  1. package/package.json +2 -2
  2. package/src/inputs.d.ts +11 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-types/shared",
3
- "version": "3.19.0",
3
+ "version": "3.20.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": "d4dfe4bb842a914f10045ee63fc6b92f034c5b30"
17
+ "gitHead": "54fbaa67cc56867506811819fef765546d403253"
18
18
  }
package/src/inputs.d.ts CHANGED
@@ -15,13 +15,17 @@ import {ReactNode} from 'react';
15
15
  export type ValidationState = 'valid' | 'invalid';
16
16
 
17
17
  export interface Validation {
18
+ /** Whether user input is required on the input before form submission. */
19
+ isRequired?: boolean,
20
+ /** Whether the input value is invalid. */
21
+ isInvalid?: boolean,
22
+ /** @deprecated Use `isInvalid` instead. */
23
+ validationState?: ValidationState
24
+ }
25
+
26
+ export interface SpectrumFieldValidation extends Omit<Validation, 'isInvalid' | 'validationState'> {
18
27
  /** Whether the input should display its "valid" or "invalid" visual styling. */
19
- validationState?: ValidationState,
20
- /**
21
- * Whether user input is required on the input before form submission.
22
- * Often paired with the `necessityIndicator` prop to add a visual indicator to the input.
23
- */
24
- isRequired?: boolean
28
+ validationState?: ValidationState
25
29
  }
26
30
 
27
31
  export interface InputBase {
@@ -78,7 +82,7 @@ export interface HelpTextProps {
78
82
  }
79
83
 
80
84
  // Spectrum specific types. Extends `Validation` so that the `validationState` prop is available.
81
- export interface SpectrumHelpTextProps extends HelpTextProps, Validation {
85
+ export interface SpectrumHelpTextProps extends HelpTextProps {
82
86
  /** Whether the description is displayed with lighter text. */
83
87
  isDisabled?: boolean,
84
88
  /** Whether an error icon is rendered. */