@react-types/shared 3.7.0 → 3.10.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 +3 -0
- package/src/dom.d.ts +7 -2
- package/src/events.d.ts +8 -1
- package/src/inputs.d.ts +19 -2
- package/src/selection.d.ts +6 -0
- package/src/style.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-types/shared",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.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": "896eabe5521a0349a675c4773ed7629addd4b8c4"
|
|
18
18
|
}
|
package/src/collections.d.ts
CHANGED
|
@@ -130,6 +130,9 @@ export interface Collection<T> extends Iterable<T> {
|
|
|
130
130
|
/** Get an item by its key. */
|
|
131
131
|
getItem(key: Key): T,
|
|
132
132
|
|
|
133
|
+
/** Get an item by the index of its key. */
|
|
134
|
+
at(idx: number): T,
|
|
135
|
+
|
|
133
136
|
/** Get the key that comes before the given key in the collection. */
|
|
134
137
|
getKeyBefore(key: Key): Key | null,
|
|
135
138
|
|
package/src/dom.d.ts
CHANGED
|
@@ -10,7 +10,12 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
ClipboardEventHandler,
|
|
15
|
+
CompositionEventHandler,
|
|
16
|
+
FormEventHandler,
|
|
17
|
+
ReactEventHandler
|
|
18
|
+
} from 'react';
|
|
14
19
|
|
|
15
20
|
export interface AriaLabelingProps {
|
|
16
21
|
/**
|
|
@@ -125,7 +130,7 @@ export interface TextInputDOMProps extends DOMProps {
|
|
|
125
130
|
* Handler that is called when a text composition system starts a new text composition session. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionstart_event).
|
|
126
131
|
*/
|
|
127
132
|
onCompositionStart?: CompositionEventHandler<HTMLInputElement>,
|
|
128
|
-
|
|
133
|
+
|
|
129
134
|
/**
|
|
130
135
|
* Handler that is called when a text composition system completes or cancels the current text composition session. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionend_event).
|
|
131
136
|
*/
|
package/src/events.d.ts
CHANGED
|
@@ -40,7 +40,14 @@ export interface PressEvent {
|
|
|
40
40
|
/** Whether the ctrl keyboard modifier was held during the press event. */
|
|
41
41
|
ctrlKey: boolean,
|
|
42
42
|
/** Whether the meta keyboard modifier was held during the press event. */
|
|
43
|
-
metaKey: boolean
|
|
43
|
+
metaKey: boolean,
|
|
44
|
+
/** Whether the alt keyboard modifier was held during the press event. */
|
|
45
|
+
altKey: boolean
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface LongPressEvent extends Omit<PressEvent, 'type'> {
|
|
49
|
+
/** The type of long press event being fired. */
|
|
50
|
+
type: 'longpressstart' | 'longpressend' | 'longpress'
|
|
44
51
|
}
|
|
45
52
|
|
|
46
53
|
export interface HoverEvent {
|
package/src/inputs.d.ts
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
import {ReactNode} from 'react';
|
|
14
|
+
|
|
13
15
|
export type ValidationState = 'valid' | 'invalid';
|
|
14
16
|
|
|
15
17
|
export interface Validation {
|
|
@@ -29,13 +31,13 @@ export interface InputBase {
|
|
|
29
31
|
isReadOnly?: boolean
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
export interface ValueBase<T> {
|
|
34
|
+
export interface ValueBase<T, C = T> {
|
|
33
35
|
/** The current value (controlled). */
|
|
34
36
|
value?: T,
|
|
35
37
|
/** The default value (uncontrolled). */
|
|
36
38
|
defaultValue?: T,
|
|
37
39
|
/** Handler that is called when the value changes. */
|
|
38
|
-
onChange?: (value:
|
|
40
|
+
onChange?: (value: C) => void
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
export interface TextInputBase {
|
|
@@ -58,3 +60,18 @@ export interface RangeInputBase<T> {
|
|
|
58
60
|
/** The amount that the input value changes with each increment or decrement "tick". */
|
|
59
61
|
step?: T // ??
|
|
60
62
|
}
|
|
63
|
+
|
|
64
|
+
export interface HelpTextProps {
|
|
65
|
+
/** A description for the field. Provides a hint such as specific requirements for what to choose. */
|
|
66
|
+
description?: ReactNode,
|
|
67
|
+
/** An error message for the field. */
|
|
68
|
+
errorMessage?: ReactNode
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Spectrum specific types. Extends `Validation` so that the `validationState` prop is available.
|
|
72
|
+
export interface SpectrumHelpTextProps extends HelpTextProps, Validation {
|
|
73
|
+
/** Whether the description is displayed with lighter text. */
|
|
74
|
+
isDisabled?: boolean,
|
|
75
|
+
/** Whether an error icon is rendered. */
|
|
76
|
+
showErrorIcon?: boolean
|
|
77
|
+
}
|
package/src/selection.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export interface SingleSelection {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export type SelectionMode = 'none' | 'single' | 'multiple';
|
|
27
|
+
export type SelectionBehavior = 'toggle' | 'replace';
|
|
27
28
|
export type Selection = 'all' | Set<Key>;
|
|
28
29
|
export interface MultipleSelection {
|
|
29
30
|
/** The type of selection that is allowed in the collection. */
|
|
@@ -40,4 +41,9 @@ export interface MultipleSelection {
|
|
|
40
41
|
disabledKeys?: Iterable<Key>
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
export interface SpectrumSelectionProps {
|
|
45
|
+
/** How selection should be displayed. */
|
|
46
|
+
selectionStyle?: 'checkbox' | 'highlight'
|
|
47
|
+
}
|
|
48
|
+
|
|
43
49
|
export type FocusStrategy = 'first' | 'last';
|