@react-types/shared 3.22.0 → 3.23.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 +1 -1
- package/src/dom.d.ts +15 -2
- package/src/inputs.d.ts +1 -1
- package/src/selection.d.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-types/shared",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.23.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": "f645f29edc1322153fd60af4640cbcab1d992dbd"
|
|
18
18
|
}
|
package/src/collections.d.ts
CHANGED
|
@@ -166,7 +166,7 @@ export interface Node<T> {
|
|
|
166
166
|
key: Key,
|
|
167
167
|
/** The object value the node was created from. */
|
|
168
168
|
value: T | null,
|
|
169
|
-
/** The level of depth this node is at in the
|
|
169
|
+
/** The level of depth this node is at in the hierarchy. */
|
|
170
170
|
level: number,
|
|
171
171
|
/** Whether this item has children, even if not loaded yet. */
|
|
172
172
|
hasChildNodes: boolean,
|
package/src/dom.d.ts
CHANGED
|
@@ -169,10 +169,21 @@ export interface TextInputDOMProps extends DOMProps, InputDOMProps, TextInputDOM
|
|
|
169
169
|
inputMode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search'
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
/**
|
|
173
|
+
* This type allows configuring link props with router options and type-safe URLs via TS module augmentation.
|
|
174
|
+
* By default, this is an empty type. Extend with `href` and `routerOptions` properties to configure your router.
|
|
175
|
+
*/
|
|
176
|
+
export interface RouterConfig {}
|
|
177
|
+
|
|
178
|
+
export type Href = RouterConfig extends {href: infer H} ? H : string;
|
|
179
|
+
export type RouterOptions = RouterConfig extends {routerOptions: infer O} ? O : never;
|
|
180
|
+
|
|
172
181
|
// Make sure to update filterDOMProps.ts when updating this.
|
|
173
182
|
export interface LinkDOMProps {
|
|
174
183
|
/** A URL to link to. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#href). */
|
|
175
|
-
href?:
|
|
184
|
+
href?: Href,
|
|
185
|
+
/** Hints at the human language of the linked URL. See[MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#hreflang). */
|
|
186
|
+
hrefLang?: string,
|
|
176
187
|
/** The target window for the link. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target). */
|
|
177
188
|
target?: HTMLAttributeAnchorTarget,
|
|
178
189
|
/** The relationship between the linked resource and the current page. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel). */
|
|
@@ -182,7 +193,9 @@ export interface LinkDOMProps {
|
|
|
182
193
|
/** 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
194
|
ping?: string,
|
|
184
195
|
/** 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
|
|
196
|
+
referrerPolicy?: HTMLAttributeReferrerPolicy,
|
|
197
|
+
/** Options for the configured client side router. */
|
|
198
|
+
routerOptions?: RouterOptions
|
|
186
199
|
}
|
|
187
200
|
|
|
188
201
|
/** Any focusable element, including both HTML and SVG elements. */
|
package/src/inputs.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type ValidationError = string | string[];
|
|
|
18
18
|
export type ValidationErrors = Record<string, ValidationError>;
|
|
19
19
|
export type ValidationFunction<T> = (value: T) => ValidationError | true | null | undefined;
|
|
20
20
|
|
|
21
|
-
export interface Validation<T> {
|
|
21
|
+
export interface Validation<T = unknown> {
|
|
22
22
|
/** Whether user input is required on the input before form submission. */
|
|
23
23
|
isRequired?: boolean,
|
|
24
24
|
/** Whether the input value is invalid. */
|
package/src/selection.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface SingleSelection {
|
|
|
20
20
|
/** The initial selected key in the collection (uncontrolled). */
|
|
21
21
|
defaultSelectedKey?: Key,
|
|
22
22
|
/** Handler that is called when the selection changes. */
|
|
23
|
-
onSelectionChange?: (key: Key) =>
|
|
23
|
+
onSelectionChange?: (key: Key) => void
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export type SelectionMode = 'none' | 'single' | 'multiple';
|
|
@@ -36,7 +36,7 @@ export interface MultipleSelection {
|
|
|
36
36
|
/** The initial selected keys in the collection (uncontrolled). */
|
|
37
37
|
defaultSelectedKeys?: 'all' | Iterable<Key>,
|
|
38
38
|
/** Handler that is called when the selection changes. */
|
|
39
|
-
onSelectionChange?: (keys: Selection) =>
|
|
39
|
+
onSelectionChange?: (keys: Selection) => void,
|
|
40
40
|
/** The currently disabled keys in the collection (controlled). */
|
|
41
41
|
disabledKeys?: Iterable<Key>
|
|
42
42
|
}
|