@react-types/shared 3.8.0 → 3.11.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/dom.d.ts +7 -2
- package/src/events.d.ts +17 -2
- package/src/index.d.ts +0 -1
- package/src/inputs.d.ts +19 -2
- package/src/selection.d.ts +7 -1
- package/src/splitview.d.ts +0 -83
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-types/shared",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.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": "54c2366c4f31bd4bf619126131cd583c12972acc"
|
|
18
18
|
}
|
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 {
|
|
@@ -103,7 +110,15 @@ export interface FocusableProps extends FocusEvents, KeyboardEvents {
|
|
|
103
110
|
|
|
104
111
|
interface BaseMoveEvent {
|
|
105
112
|
/** The pointer type that triggered the move event. */
|
|
106
|
-
pointerType: PointerType
|
|
113
|
+
pointerType: PointerType,
|
|
114
|
+
/** Whether the shift keyboard modifier was held during the move event. */
|
|
115
|
+
shiftKey: boolean,
|
|
116
|
+
/** Whether the ctrl keyboard modifier was held during the move event. */
|
|
117
|
+
ctrlKey: boolean,
|
|
118
|
+
/** Whether the meta keyboard modifier was held during the move event. */
|
|
119
|
+
metaKey: boolean,
|
|
120
|
+
/** Whether the alt keyboard modifier was held during the move event. */
|
|
121
|
+
altKey: boolean
|
|
107
122
|
}
|
|
108
123
|
|
|
109
124
|
export interface MoveStartEvent extends BaseMoveEvent {
|
package/src/index.d.ts
CHANGED
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
|
@@ -16,7 +16,7 @@ export interface SingleSelection {
|
|
|
16
16
|
/** Whether the collection allows empty selection. */
|
|
17
17
|
disallowEmptySelection?: boolean,
|
|
18
18
|
/** The currently selected key in the collection (controlled). */
|
|
19
|
-
selectedKey?: Key,
|
|
19
|
+
selectedKey?: Key | null,
|
|
20
20
|
/** The initial selected key in the collection (uncontrolled). */
|
|
21
21
|
defaultSelectedKey?: Key,
|
|
22
22
|
/** Handler that is called when the selection changes. */
|
|
@@ -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';
|
package/src/splitview.d.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
Dispatch,
|
|
15
|
-
MutableRefObject,
|
|
16
|
-
ReactElement,
|
|
17
|
-
SetStateAction
|
|
18
|
-
} from 'react';
|
|
19
|
-
import {Orientation} from './orientation';
|
|
20
|
-
|
|
21
|
-
export interface SplitViewStatelyProps {
|
|
22
|
-
allowsCollapsing?: boolean,
|
|
23
|
-
onResize?: (primarySize: number) => void,
|
|
24
|
-
onResizeEnd?: (primarySize: number) => void,
|
|
25
|
-
primarySize?: number,
|
|
26
|
-
defaultPrimarySize?: number
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface SplitViewHandleState {
|
|
30
|
-
offset: number,
|
|
31
|
-
dragging: boolean,
|
|
32
|
-
hovered: boolean,
|
|
33
|
-
setOffset: (value: number) => void,
|
|
34
|
-
setDragging: (value: boolean) => void,
|
|
35
|
-
setHover: (value: boolean) => void,
|
|
36
|
-
increment: () => void,
|
|
37
|
-
decrement: () => void,
|
|
38
|
-
incrementToMax: () => void,
|
|
39
|
-
decrementToMin: () => void,
|
|
40
|
-
collapseToggle: () => void
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface SplitViewContainerState {
|
|
44
|
-
minPos: number,
|
|
45
|
-
maxPos: number,
|
|
46
|
-
setMinPos: Dispatch<SetStateAction<number>>,
|
|
47
|
-
setMaxPos: Dispatch<SetStateAction<number>>
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface SplitViewState {
|
|
51
|
-
handleState: SplitViewHandleState,
|
|
52
|
-
containerState: SplitViewContainerState
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface SplitViewAriaProps {
|
|
56
|
-
id?: string,
|
|
57
|
-
allowsResizing?: boolean,
|
|
58
|
-
orientation?: Orientation,
|
|
59
|
-
primaryPane?: 0 | 1,
|
|
60
|
-
primaryMinSize?: number,
|
|
61
|
-
primaryMaxSize?: number,
|
|
62
|
-
secondaryMinSize?: number,
|
|
63
|
-
secondaryMaxSize?: number,
|
|
64
|
-
'aria-label'?: string,
|
|
65
|
-
'aria-labelledby'?: string,
|
|
66
|
-
containerRef?: MutableRefObject<HTMLDivElement>
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface SplitViewProps {
|
|
70
|
-
children: [ReactElement, ReactElement],
|
|
71
|
-
orientation?: Orientation,
|
|
72
|
-
allowsResizing?: boolean,
|
|
73
|
-
allowsCollapsing?: boolean,
|
|
74
|
-
onResize?: (primarySize: number) => void,
|
|
75
|
-
onResizeEnd?: (primarySize: number) => void,
|
|
76
|
-
primaryPane?: 0 | 1,
|
|
77
|
-
primarySize?: number,
|
|
78
|
-
defaultPrimarySize?: number,
|
|
79
|
-
primaryMinSize?: number,
|
|
80
|
-
primaryMaxSize?: number,
|
|
81
|
-
secondaryMinSize?: number,
|
|
82
|
-
secondaryMaxSize?: number
|
|
83
|
-
}
|