@react-types/shared 3.19.0 → 3.21.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/collections.d.ts +2 -1
- package/src/dna.d.ts +2 -1
- package/src/dom.d.ts +22 -0
- 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.
|
|
3
|
+
"version": "3.21.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": "4122e44d1991c90507d630d35ed297f89db435d3"
|
|
18
18
|
}
|
package/src/collections.d.ts
CHANGED
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {Key, ReactElement, ReactNode} from 'react';
|
|
14
|
+
import {LinkDOMProps} from './dom';
|
|
14
15
|
|
|
15
|
-
export interface ItemProps<T> {
|
|
16
|
+
export interface ItemProps<T> extends LinkDOMProps {
|
|
16
17
|
/** Rendered contents of the item or child items. */
|
|
17
18
|
children: ReactNode,
|
|
18
19
|
/** Rendered contents of the item if `children` contains child items. */
|
package/src/dna.d.ts
CHANGED
package/src/dom.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
CompositionEventHandler,
|
|
18
18
|
CSSProperties,
|
|
19
19
|
FormEventHandler,
|
|
20
|
+
HTMLAttributeAnchorTarget,
|
|
21
|
+
HTMLAttributeReferrerPolicy,
|
|
20
22
|
DOMAttributes as ReactDOMAttributes,
|
|
21
23
|
ReactEventHandler
|
|
22
24
|
} from 'react';
|
|
@@ -167,6 +169,22 @@ export interface TextInputDOMProps extends DOMProps, InputDOMProps, TextInputDOM
|
|
|
167
169
|
inputMode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search'
|
|
168
170
|
}
|
|
169
171
|
|
|
172
|
+
// Make sure to update filterDOMProps.ts when updating this.
|
|
173
|
+
export interface LinkDOMProps {
|
|
174
|
+
/** A URL to link to. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#href). */
|
|
175
|
+
href?: string,
|
|
176
|
+
/** The target window for the link. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target). */
|
|
177
|
+
target?: HTMLAttributeAnchorTarget,
|
|
178
|
+
/** The relationship between the linked resource and the current page. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel). */
|
|
179
|
+
rel?: string,
|
|
180
|
+
/** Causes the browser to download the linked URL. A string may be provided to suggest a file name. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#download). */
|
|
181
|
+
download?: boolean | string,
|
|
182
|
+
/** A space-separated list of URLs to ping when the link is followed. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#ping). */
|
|
183
|
+
ping?: string,
|
|
184
|
+
/** How much of the referrer to send when following the link. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#referrerpolicy). */
|
|
185
|
+
referrerPolicy?: HTMLAttributeReferrerPolicy
|
|
186
|
+
}
|
|
187
|
+
|
|
170
188
|
/** Any focusable element, including both HTML and SVG elements. */
|
|
171
189
|
export interface FocusableElement extends Element, HTMLOrSVGElement {}
|
|
172
190
|
|
|
@@ -178,3 +196,7 @@ export interface DOMAttributes<T = FocusableElement> extends AriaAttributes, Rea
|
|
|
178
196
|
style?: CSSProperties | undefined,
|
|
179
197
|
className?: string | undefined
|
|
180
198
|
}
|
|
199
|
+
|
|
200
|
+
export interface GroupDOMAttributes extends Omit<DOMAttributes<HTMLElement>, 'role'> {
|
|
201
|
+
role?: 'group' | 'region' | 'presentation'
|
|
202
|
+
}
|
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
|
|
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. */
|