@pingux/astro 2.33.0-alpha.1 → 2.33.0-alpha.10
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/lib/cjs/components/ButtonBar/ButtonBar.stories.js +61 -5
- package/lib/cjs/components/Tabs/Tabs.stories.js +2 -2
- package/lib/cjs/components/Tabs/Tabs.style.js +0 -1
- package/lib/cjs/hooks/useComponentToggle/useComponentToggle.js +1 -3
- package/lib/cjs/hooks/useField/useField.d.ts +33 -35
- package/lib/cjs/hooks/useField/useField.js +1 -1
- package/lib/cjs/hooks/useProgressiveState/index.d.ts +1 -0
- package/lib/cjs/hooks/useProgressiveState/useProgressiveState.d.ts +11 -0
- package/lib/cjs/hooks/useProgressiveState/useProgressiveState.js +3 -6
- package/lib/cjs/hooks/useProgressiveState/useProgressiveState.test.d.ts +1 -0
- package/lib/cjs/hooks/useProgressiveState/useProgressiveState.test.js +7 -16
- package/lib/cjs/hooks/usePropWarning/index.d.ts +1 -0
- package/lib/cjs/hooks/usePropWarning/usePropWarning.d.ts +13 -0
- package/lib/cjs/hooks/usePropWarning/usePropWarning.js +0 -8
- package/lib/cjs/hooks/usePropWarning/usePropWarning.test.d.ts +1 -0
- package/lib/cjs/hooks/usePropWarning/usePropWarning.test.js +13 -9
- package/lib/cjs/hooks/useRockerButton/index.d.ts +1 -0
- package/lib/cjs/hooks/useRockerButton/useRockerButton.d.ts +241 -0
- package/lib/cjs/hooks/useSelectField/index.d.ts +1 -0
- package/lib/cjs/hooks/useSelectField/useSelectField.d.ts +55 -0
- package/lib/cjs/hooks/useSelectField/useSelectField.js +10 -10
- package/lib/cjs/types/item.d.ts +4 -7
- package/lib/cjs/types/popoverContainer.d.ts +1 -0
- package/lib/cjs/types/shared/style.d.ts +6 -0
- package/lib/cjs/utils/designUtils/figmaLinks.js +4 -2
- package/lib/components/ButtonBar/ButtonBar.stories.js +57 -3
- package/lib/components/Tabs/Tabs.stories.js +3 -3
- package/lib/components/Tabs/Tabs.style.js +0 -1
- package/lib/hooks/useComponentToggle/useComponentToggle.js +1 -3
- package/lib/hooks/useField/useField.js +2 -0
- package/lib/hooks/useProgressiveState/useProgressiveState.js +3 -7
- package/lib/hooks/useProgressiveState/useProgressiveState.test.js +7 -16
- package/lib/hooks/usePropWarning/usePropWarning.js +0 -8
- package/lib/hooks/usePropWarning/usePropWarning.test.js +13 -9
- package/lib/hooks/useSelectField/useSelectField.js +11 -9
- package/lib/utils/designUtils/figmaLinks.js +4 -2
- package/package.json +1 -1
@@ -0,0 +1,241 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { MultipleSelectionManager } from 'react-stately';
|
3
|
+
import { FocusableElement } from '../../types';
|
4
|
+
interface RockerButtonProps {
|
5
|
+
item: {
|
6
|
+
key: string;
|
7
|
+
};
|
8
|
+
isDisabled: boolean;
|
9
|
+
isSelected: boolean;
|
10
|
+
}
|
11
|
+
declare const useRockerButton: (props: RockerButtonProps, state: {
|
12
|
+
selectionManager: MultipleSelectionManager;
|
13
|
+
}, ref: React.RefObject<FocusableElement>) => {
|
14
|
+
rockerButtonProps: {
|
15
|
+
id: string;
|
16
|
+
'aria-pressed': boolean;
|
17
|
+
'aria-disabled': true | undefined;
|
18
|
+
role?: React.AriaRole | undefined;
|
19
|
+
tabIndex?: number | undefined;
|
20
|
+
style?: React.CSSProperties | undefined;
|
21
|
+
className?: string | undefined;
|
22
|
+
'aria-activedescendant'?: string | undefined;
|
23
|
+
'aria-atomic'?: (boolean | "false" | "true") | undefined;
|
24
|
+
'aria-autocomplete'?: "list" | "none" | "both" | "inline" | undefined;
|
25
|
+
'aria-braillelabel'?: string | undefined;
|
26
|
+
'aria-brailleroledescription'?: string | undefined;
|
27
|
+
'aria-busy'?: (boolean | "false" | "true") | undefined;
|
28
|
+
'aria-checked'?: boolean | "mixed" | "false" | "true" | undefined;
|
29
|
+
'aria-colcount'?: number | undefined;
|
30
|
+
'aria-colindex'?: number | undefined;
|
31
|
+
'aria-colindextext'?: string | undefined;
|
32
|
+
'aria-colspan'?: number | undefined;
|
33
|
+
'aria-controls'?: string | undefined;
|
34
|
+
'aria-current'?: boolean | "time" | "page" | "false" | "true" | "step" | "location" | "date" | undefined;
|
35
|
+
'aria-describedby'?: string | undefined;
|
36
|
+
'aria-description'?: string | undefined;
|
37
|
+
'aria-details'?: string | undefined;
|
38
|
+
'aria-dropeffect'?: "link" | "copy" | "none" | "move" | "execute" | "popup" | undefined;
|
39
|
+
'aria-errormessage'?: string | undefined;
|
40
|
+
'aria-expanded'?: (boolean | "false" | "true") | undefined;
|
41
|
+
'aria-flowto'?: string | undefined;
|
42
|
+
'aria-grabbed'?: (boolean | "false" | "true") | undefined;
|
43
|
+
'aria-haspopup'?: boolean | "dialog" | "menu" | "grid" | "listbox" | "tree" | "false" | "true" | undefined;
|
44
|
+
'aria-hidden'?: (boolean | "false" | "true") | undefined;
|
45
|
+
'aria-invalid'?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
|
46
|
+
'aria-keyshortcuts'?: string | undefined;
|
47
|
+
'aria-label'?: string | undefined;
|
48
|
+
'aria-labelledby'?: string | undefined;
|
49
|
+
'aria-level'?: number | undefined;
|
50
|
+
'aria-live'?: "off" | "assertive" | "polite" | undefined;
|
51
|
+
'aria-modal'?: (boolean | "false" | "true") | undefined;
|
52
|
+
'aria-multiline'?: (boolean | "false" | "true") | undefined;
|
53
|
+
'aria-multiselectable'?: (boolean | "false" | "true") | undefined;
|
54
|
+
'aria-orientation'?: "horizontal" | "vertical" | undefined;
|
55
|
+
'aria-owns'?: string | undefined;
|
56
|
+
'aria-placeholder'?: string | undefined;
|
57
|
+
'aria-posinset'?: number | undefined;
|
58
|
+
'aria-readonly'?: (boolean | "false" | "true") | undefined;
|
59
|
+
'aria-relevant'?: "all" | "text" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
|
60
|
+
'aria-required'?: (boolean | "false" | "true") | undefined;
|
61
|
+
'aria-roledescription'?: string | undefined;
|
62
|
+
'aria-rowcount'?: number | undefined;
|
63
|
+
'aria-rowindex'?: number | undefined;
|
64
|
+
'aria-rowindextext'?: string | undefined;
|
65
|
+
'aria-rowspan'?: number | undefined;
|
66
|
+
'aria-selected'?: (boolean | "false" | "true") | undefined;
|
67
|
+
'aria-setsize'?: number | undefined;
|
68
|
+
'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined;
|
69
|
+
'aria-valuemax'?: number | undefined;
|
70
|
+
'aria-valuemin'?: number | undefined;
|
71
|
+
'aria-valuenow'?: number | undefined;
|
72
|
+
'aria-valuetext'?: string | undefined;
|
73
|
+
children?: React.ReactNode;
|
74
|
+
dangerouslySetInnerHTML?: {
|
75
|
+
__html: string | TrustedHTML;
|
76
|
+
} | undefined;
|
77
|
+
onCopy?: React.ClipboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
78
|
+
onCopyCapture?: React.ClipboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
79
|
+
onCut?: React.ClipboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
80
|
+
onCutCapture?: React.ClipboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
81
|
+
onPaste?: React.ClipboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
82
|
+
onPasteCapture?: React.ClipboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
83
|
+
onCompositionEnd?: React.CompositionEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
84
|
+
onCompositionEndCapture?: React.CompositionEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
85
|
+
onCompositionStart?: React.CompositionEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
86
|
+
onCompositionStartCapture?: React.CompositionEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
87
|
+
onCompositionUpdate?: React.CompositionEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
88
|
+
onCompositionUpdateCapture?: React.CompositionEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
89
|
+
onFocus?: React.FocusEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
90
|
+
onFocusCapture?: React.FocusEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
91
|
+
onBlur?: React.FocusEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
92
|
+
onBlurCapture?: React.FocusEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
93
|
+
onChange?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
94
|
+
onChangeCapture?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
95
|
+
onBeforeInput?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
96
|
+
onBeforeInputCapture?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
97
|
+
onInput?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
98
|
+
onInputCapture?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
99
|
+
onReset?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
100
|
+
onResetCapture?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
101
|
+
onSubmit?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
102
|
+
onSubmitCapture?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
103
|
+
onInvalid?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
104
|
+
onInvalidCapture?: React.FormEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
105
|
+
onLoad?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
106
|
+
onLoadCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
107
|
+
onError?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
108
|
+
onErrorCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
109
|
+
onKeyDown?: React.KeyboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
110
|
+
onKeyDownCapture?: React.KeyboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
111
|
+
onKeyPress?: React.KeyboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
112
|
+
onKeyPressCapture?: React.KeyboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
113
|
+
onKeyUp?: React.KeyboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
114
|
+
onKeyUpCapture?: React.KeyboardEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
115
|
+
onAbort?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
116
|
+
onAbortCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
117
|
+
onCanPlay?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
118
|
+
onCanPlayCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
119
|
+
onCanPlayThrough?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
120
|
+
onCanPlayThroughCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
121
|
+
onDurationChange?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
122
|
+
onDurationChangeCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
123
|
+
onEmptied?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
124
|
+
onEmptiedCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
125
|
+
onEncrypted?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
126
|
+
onEncryptedCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
127
|
+
onEnded?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
128
|
+
onEndedCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
129
|
+
onLoadedData?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
130
|
+
onLoadedDataCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
131
|
+
onLoadedMetadata?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
132
|
+
onLoadedMetadataCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
133
|
+
onLoadStart?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
134
|
+
onLoadStartCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
135
|
+
onPause?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
136
|
+
onPauseCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
137
|
+
onPlay?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
138
|
+
onPlayCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
139
|
+
onPlaying?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
140
|
+
onPlayingCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
141
|
+
onProgress?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
142
|
+
onProgressCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
143
|
+
onRateChange?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
144
|
+
onRateChangeCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
145
|
+
onResize?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
146
|
+
onResizeCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
147
|
+
onSeeked?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
148
|
+
onSeekedCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
149
|
+
onSeeking?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
150
|
+
onSeekingCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
151
|
+
onStalled?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
152
|
+
onStalledCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
153
|
+
onSuspend?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
154
|
+
onSuspendCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
155
|
+
onTimeUpdate?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
156
|
+
onTimeUpdateCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
157
|
+
onVolumeChange?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
158
|
+
onVolumeChangeCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
159
|
+
onWaiting?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
160
|
+
onWaitingCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
161
|
+
onAuxClick?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
162
|
+
onAuxClickCapture?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
163
|
+
onClick?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
164
|
+
onClickCapture?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
165
|
+
onContextMenu?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
166
|
+
onContextMenuCapture?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
167
|
+
onDoubleClick?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
168
|
+
onDoubleClickCapture?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
169
|
+
onDrag?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
170
|
+
onDragCapture?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
171
|
+
onDragEnd?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
172
|
+
onDragEndCapture?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
173
|
+
onDragEnter?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
174
|
+
onDragEnterCapture?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
175
|
+
onDragExit?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
176
|
+
onDragExitCapture?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
177
|
+
onDragLeave?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
178
|
+
onDragLeaveCapture?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
179
|
+
onDragOver?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
180
|
+
onDragOverCapture?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
181
|
+
onDragStart?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
182
|
+
onDragStartCapture?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
183
|
+
onDrop?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
184
|
+
onDropCapture?: React.DragEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
185
|
+
onMouseDown?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
186
|
+
onMouseDownCapture?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
187
|
+
onMouseEnter?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
188
|
+
onMouseLeave?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
189
|
+
onMouseMove?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
190
|
+
onMouseMoveCapture?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
191
|
+
onMouseOut?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
192
|
+
onMouseOutCapture?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
193
|
+
onMouseOver?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
194
|
+
onMouseOverCapture?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
195
|
+
onMouseUp?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
196
|
+
onMouseUpCapture?: React.MouseEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
197
|
+
onSelect?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
198
|
+
onSelectCapture?: React.ReactEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
199
|
+
onTouchCancel?: React.TouchEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
200
|
+
onTouchCancelCapture?: React.TouchEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
201
|
+
onTouchEnd?: React.TouchEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
202
|
+
onTouchEndCapture?: React.TouchEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
203
|
+
onTouchMove?: React.TouchEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
204
|
+
onTouchMoveCapture?: React.TouchEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
205
|
+
onTouchStart?: React.TouchEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
206
|
+
onTouchStartCapture?: React.TouchEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
207
|
+
onPointerDown?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
208
|
+
onPointerDownCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
209
|
+
onPointerMove?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
210
|
+
onPointerMoveCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
211
|
+
onPointerUp?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
212
|
+
onPointerUpCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
213
|
+
onPointerCancel?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
214
|
+
onPointerCancelCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
215
|
+
onPointerEnter?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
216
|
+
onPointerEnterCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
217
|
+
onPointerLeave?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
218
|
+
onPointerLeaveCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
219
|
+
onPointerOver?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
220
|
+
onPointerOverCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
221
|
+
onPointerOut?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
222
|
+
onPointerOutCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
223
|
+
onGotPointerCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
224
|
+
onGotPointerCaptureCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
225
|
+
onLostPointerCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
226
|
+
onLostPointerCaptureCapture?: React.PointerEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
227
|
+
onScroll?: React.UIEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
228
|
+
onScrollCapture?: React.UIEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
229
|
+
onWheel?: React.WheelEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
230
|
+
onWheelCapture?: React.WheelEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
231
|
+
onAnimationStart?: React.AnimationEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
232
|
+
onAnimationStartCapture?: React.AnimationEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
233
|
+
onAnimationEnd?: React.AnimationEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
234
|
+
onAnimationEndCapture?: React.AnimationEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
235
|
+
onAnimationIteration?: React.AnimationEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
236
|
+
onAnimationIterationCapture?: React.AnimationEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
237
|
+
onTransitionEnd?: React.TransitionEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
238
|
+
onTransitionEndCapture?: React.TransitionEventHandler<import("@react-types/shared").FocusableElement> | undefined;
|
239
|
+
};
|
240
|
+
};
|
241
|
+
export default useRockerButton;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './useSelectField';
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import React, { DOMAttributes, Key } from 'react';
|
2
|
+
import { AriaButtonProps } from 'react-aria';
|
3
|
+
import { SelectState } from 'react-stately';
|
4
|
+
import { CollectionChildren } from '@react-types/shared';
|
5
|
+
import { LabelProps as ThemeUILabelProps } from 'theme-ui';
|
6
|
+
import { Axis, BoxProps, FocusableElement, PlacementAxis, ReactRef, StyleProps } from '../../types';
|
7
|
+
import { FieldControlInputProps } from '../useField/useField';
|
8
|
+
interface UseSelectFieldProps<T> {
|
9
|
+
children: CollectionChildren<T>;
|
10
|
+
align?: PlacementAxis;
|
11
|
+
defaultSelectedKey?: string;
|
12
|
+
defaultText?: string;
|
13
|
+
direction?: Axis;
|
14
|
+
disabledKeys?: Iterable<Key>;
|
15
|
+
hasNoEmptySelection?: boolean;
|
16
|
+
isDefaultOpen?: boolean;
|
17
|
+
isDisabled?: boolean;
|
18
|
+
isLoading?: boolean;
|
19
|
+
isNotFlippable?: boolean;
|
20
|
+
isOpen?: boolean;
|
21
|
+
isReadOnly?: boolean;
|
22
|
+
isRequired?: boolean;
|
23
|
+
items?: Iterable<T>;
|
24
|
+
label?: string;
|
25
|
+
listboxStyle?: React.CSSProperties;
|
26
|
+
name?: string;
|
27
|
+
placeholder?: string;
|
28
|
+
selectedKey?: string;
|
29
|
+
onLoadMore?: () => unknown;
|
30
|
+
onOpenChange?: (isOpen: boolean) => unknown;
|
31
|
+
onSelectionChange?: (key: Key) => unknown;
|
32
|
+
controlProps?: React.HTMLAttributes<Element>;
|
33
|
+
scrollBoxProps?: BoxProps;
|
34
|
+
listBoxProps?: BoxProps;
|
35
|
+
labelProps?: ThemeUILabelProps;
|
36
|
+
containerProps?: BoxProps;
|
37
|
+
labelMode: 'default' | 'float' | 'left';
|
38
|
+
}
|
39
|
+
interface UseSelectFieldReturnProps {
|
40
|
+
columnStyleProps: StyleProps;
|
41
|
+
fieldContainerProps: BoxProps;
|
42
|
+
fieldControlInputProps: FieldControlInputProps;
|
43
|
+
fieldControlWrapperProps: BoxProps;
|
44
|
+
fieldLabelProps: ThemeUILabelProps;
|
45
|
+
isLoadingInitial?: boolean;
|
46
|
+
listBoxRef: ReactRef;
|
47
|
+
overlay: React.ReactNode;
|
48
|
+
popoverRef: ReactRef;
|
49
|
+
state: SelectState<object>;
|
50
|
+
triggerProps: AriaButtonProps<'button'>;
|
51
|
+
triggerRef: ReactRef;
|
52
|
+
valueProps: DOMAttributes<FocusableElement>;
|
53
|
+
}
|
54
|
+
declare const useSelectField: <T extends object>(props: UseSelectFieldProps<T>, ref: ReactRef) => UseSelectFieldReturnProps;
|
55
|
+
export default useSelectField;
|
@@ -24,7 +24,7 @@ var _reactAria = require("react-aria");
|
|
24
24
|
var _reactStately = require("react-stately");
|
25
25
|
var _utils = require("@react-aria/utils");
|
26
26
|
var _constants = require("../../components/Label/constants");
|
27
|
-
var _ListBox = _interopRequireDefault(require("../../components/ListBox"));
|
27
|
+
var _ListBox = _interopRequireDefault(require("../../components/ListBox/ListBox"));
|
28
28
|
var _PopoverContainer = _interopRequireDefault(require("../../components/PopoverContainer"));
|
29
29
|
var _ScrollBox = _interopRequireDefault(require("../../components/ScrollBox"));
|
30
30
|
var _ = require("..");
|
@@ -32,7 +32,7 @@ var _react2 = require("@emotion/react");
|
|
32
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
33
33
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
34
34
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
35
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
35
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; } // eslint-disable-next-line import/no-unresolved
|
36
36
|
var useSelectField = function useSelectField(props, ref) {
|
37
37
|
var _context;
|
38
38
|
var align = props.align,
|
@@ -64,8 +64,7 @@ var useSelectField = function useSelectField(props, ref) {
|
|
64
64
|
// We use falsy booleans as defaults, but React Aria has this as true by default so we need to
|
65
65
|
// negate this.
|
66
66
|
var shouldFlip = !isNotFlippable;
|
67
|
-
var selectProps = _objectSpread({
|
68
|
-
children: children,
|
67
|
+
var selectProps = _objectSpread(_objectSpread({
|
69
68
|
defaultSelectedKey: defaultSelectedKey,
|
70
69
|
defaultText: defaultText,
|
71
70
|
disabledKeys: disabledKeys,
|
@@ -87,13 +86,14 @@ var useSelectField = function useSelectField(props, ref) {
|
|
87
86
|
disallowEmptySelection: disallowEmptySelection,
|
88
87
|
// must match React Aria API
|
89
88
|
shouldFlip: shouldFlip
|
90
|
-
}, controlProps)
|
89
|
+
}, controlProps), {}, {
|
90
|
+
children: children
|
91
|
+
});
|
91
92
|
// Create state based on the incoming props
|
92
93
|
var state = (0, _reactStately.useSelectState)(selectProps);
|
93
94
|
var popoverRef = (0, _react.useRef)();
|
94
|
-
var triggerRef = (0, _react.useRef)();
|
95
95
|
var listBoxRef = (0, _react.useRef)();
|
96
|
-
|
96
|
+
var triggerRef = (0, _react.useRef)();
|
97
97
|
/* istanbul ignore next */
|
98
98
|
(0, _react.useImperativeHandle)(ref, function () {
|
99
99
|
return triggerRef.current;
|
@@ -120,7 +120,7 @@ var useSelectField = function useSelectField(props, ref) {
|
|
120
120
|
placeholder: props.labelMode === _constants.modes.FLOAT ? '' : placeholder,
|
121
121
|
labelProps: _objectSpread(_objectSpread({}, props.labelProps), labelProps),
|
122
122
|
containerProps: _objectSpread({
|
123
|
-
isFloatLabelActive: state.selectedItem
|
123
|
+
isFloatLabelActive: !!state.selectedItem
|
124
124
|
}, props.containerProps)
|
125
125
|
})),
|
126
126
|
fieldContainerProps = _useField.fieldContainerProps,
|
@@ -152,7 +152,7 @@ var useSelectField = function useSelectField(props, ref) {
|
|
152
152
|
}, [state.isOpen, updatePosition]);
|
153
153
|
|
154
154
|
// Measure the width of the input to inform the width of the listbox (below).
|
155
|
-
var _useState = (0, _react.useState)(
|
155
|
+
var _useState = (0, _react.useState)(0),
|
156
156
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
157
157
|
buttonWidth = _useState2[0],
|
158
158
|
setButtonWidth = _useState2[1];
|
@@ -161,7 +161,7 @@ var useSelectField = function useSelectField(props, ref) {
|
|
161
161
|
if (triggerRef.current) {
|
162
162
|
setButtonWidth(triggerRef.current.offsetWidth);
|
163
163
|
}
|
164
|
-
}, [triggerRef, setButtonWidth
|
164
|
+
}, [triggerRef, setButtonWidth]);
|
165
165
|
(0, _utils.useResizeObserver)({
|
166
166
|
ref: triggerRef,
|
167
167
|
onResize: onResize
|
package/lib/cjs/types/item.d.ts
CHANGED
@@ -1,17 +1,14 @@
|
|
1
|
-
import {
|
1
|
+
import { ElementType } from 'react';
|
2
2
|
import type { ItemProps } from '@react-types/shared';
|
3
3
|
import { DOMAttributes, StyleProps } from './shared';
|
4
|
-
export interface StylingProps extends DOMAttributes, StyleProps {
|
5
|
-
style?: CSSProperties | string;
|
6
|
-
}
|
7
4
|
declare module '@react-types/shared' {
|
8
5
|
interface ItemProps<T> extends StyleProps, DOMAttributes {
|
9
6
|
/** The rendered label for the item. */
|
10
7
|
label?: string;
|
11
8
|
/** Props for the accordion item content element. */
|
12
|
-
regionProps?:
|
9
|
+
regionProps?: StyleProps;
|
13
10
|
/** Props for the accordion item content element. */
|
14
|
-
containerProps?:
|
11
|
+
containerProps?: StyleProps;
|
15
12
|
/** Whether the item has a separator */
|
16
13
|
isSeparator?: boolean;
|
17
14
|
/** Whether the item is pressed */
|
@@ -23,7 +20,7 @@ declare module '@react-types/shared' {
|
|
23
20
|
/** A URL to link to if elementType="a". */
|
24
21
|
href?: string;
|
25
22
|
/** Inline styling prop for item */
|
26
|
-
sx?:
|
23
|
+
sx?: StyleProps;
|
27
24
|
}
|
28
25
|
}
|
29
26
|
export default ItemProps;
|
@@ -16,6 +16,7 @@ export interface PopoverContainerProps extends StylePropsExtended, DOMAttributes
|
|
16
16
|
isKeyboardDismissDisabled?: boolean;
|
17
17
|
isNonModal?: boolean;
|
18
18
|
isDismissable?: boolean;
|
19
|
+
isOpen?: boolean;
|
19
20
|
}
|
20
21
|
export interface PopoverWrapperProps extends PopoverContainerProps {
|
21
22
|
isOpen?: boolean;
|
@@ -8,4 +8,10 @@ export interface StyleProps extends ThemeUICSSProperties, SxProp {
|
|
8
8
|
variant?: string;
|
9
9
|
/** The base HTML tag name or React component type to render */
|
10
10
|
as?: string | React.ReactNode | React.ElementType;
|
11
|
+
/** Inline style object that allows you to directly apply CSS styles to the element. */
|
12
|
+
style?: React.CSSProperties | string;
|
11
13
|
}
|
14
|
+
export type Placement = 'bottom' | 'bottom left' | 'bottom right' | 'bottom start' | 'bottom end' | 'top' | 'top left' | 'top right' | 'top start' | 'top end' | 'left' | 'left top' | 'left bottom' | 'start' | 'start top' | 'start bottom' | 'right' | 'right top' | 'right bottom' | 'end' | 'end top' | 'end bottom';
|
15
|
+
export type Axis = 'top' | 'bottom' | 'left' | 'right';
|
16
|
+
export type SizeAxis = 'width' | 'height';
|
17
|
+
export type PlacementAxis = Axis | 'center';
|
@@ -36,8 +36,10 @@ var FIGMA_LINKS = {
|
|
36
36
|
"default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?type=design&node-id=0-1&t=8Wwd3tIBh3GEjCJB-0'
|
37
37
|
},
|
38
38
|
buttonBar: {
|
39
|
-
"default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=
|
40
|
-
rightAligned: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=
|
39
|
+
"default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=46080%3A753&mode=dev',
|
40
|
+
rightAligned: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=46080%3A770&mode=dev',
|
41
|
+
secondary: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=46080%3A778&mode=dev',
|
42
|
+
secondaryRightAligned: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=46080%3A788&mode=dev'
|
41
43
|
},
|
42
44
|
calendar: {
|
43
45
|
"default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?type=design&node-id=6373%3A25490&t=BoHXzVpQq9Lf7MaU-1'
|
@@ -50,12 +50,38 @@ export var RightAligned = function RightAligned() {
|
|
50
50
|
return ___EmotionJSX(ButtonBar, {
|
51
51
|
align: "right"
|
52
52
|
}, ___EmotionJSX(Button, {
|
53
|
+
variant: "link",
|
54
|
+
"data-id": "cancel-button",
|
55
|
+
onPress: function onPress() {
|
56
|
+
return alert('Cancel button pressed');
|
57
|
+
}
|
58
|
+
}, "Cancel"), ___EmotionJSX(Button, {
|
53
59
|
variant: "primary",
|
54
60
|
"data-id": "next-button",
|
55
61
|
onPress: function onPress() {
|
56
62
|
return alert('Next button pressed');
|
57
63
|
}
|
58
|
-
}, "Next")
|
64
|
+
}, "Next"));
|
65
|
+
};
|
66
|
+
RightAligned.parameters = {
|
67
|
+
design: {
|
68
|
+
type: 'figma',
|
69
|
+
url: FIGMA_LINKS.buttonBar.rightAligned
|
70
|
+
}
|
71
|
+
};
|
72
|
+
export var Secondary = function Secondary() {
|
73
|
+
return ___EmotionJSX(ButtonBar, null, ___EmotionJSX(Button, {
|
74
|
+
variant: "primary",
|
75
|
+
"data-id": "save-button",
|
76
|
+
onPress: function onPress() {
|
77
|
+
return alert('Save button pressed');
|
78
|
+
}
|
79
|
+
}, "Save"), ___EmotionJSX(Button, {
|
80
|
+
"data-id": "close-button",
|
81
|
+
onPress: function onPress() {
|
82
|
+
return alert('Close button pressed');
|
83
|
+
}
|
84
|
+
}, "Close"), ___EmotionJSX(Button, {
|
59
85
|
variant: "link",
|
60
86
|
"data-id": "cancel-button",
|
61
87
|
onPress: function onPress() {
|
@@ -63,9 +89,37 @@ export var RightAligned = function RightAligned() {
|
|
63
89
|
}
|
64
90
|
}, "Cancel"));
|
65
91
|
};
|
66
|
-
|
92
|
+
Secondary.parameters = {
|
67
93
|
design: {
|
68
94
|
type: 'figma',
|
69
|
-
url: FIGMA_LINKS.buttonBar.
|
95
|
+
url: FIGMA_LINKS.buttonBar.secondary
|
96
|
+
}
|
97
|
+
};
|
98
|
+
export var SecondaryRightAligned = function SecondaryRightAligned() {
|
99
|
+
return ___EmotionJSX(ButtonBar, {
|
100
|
+
align: "right"
|
101
|
+
}, ___EmotionJSX(Button, {
|
102
|
+
variant: "link",
|
103
|
+
"data-id": "cancel-button",
|
104
|
+
onPress: function onPress() {
|
105
|
+
return alert('Cancel button pressed');
|
106
|
+
}
|
107
|
+
}, "Cancel"), ___EmotionJSX(Button, {
|
108
|
+
"data-id": "close-button",
|
109
|
+
onPress: function onPress() {
|
110
|
+
return alert('Close button pressed');
|
111
|
+
}
|
112
|
+
}, "Close"), ___EmotionJSX(Button, {
|
113
|
+
variant: "primary",
|
114
|
+
"data-id": "next-button",
|
115
|
+
onPress: function onPress() {
|
116
|
+
return alert('Next button pressed');
|
117
|
+
}
|
118
|
+
}, "Next"));
|
119
|
+
};
|
120
|
+
SecondaryRightAligned.parameters = {
|
121
|
+
design: {
|
122
|
+
type: 'figma',
|
123
|
+
url: FIGMA_LINKS.buttonBar.secondaryRightAligned
|
70
124
|
}
|
71
125
|
};
|
@@ -4,7 +4,7 @@ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
|
|
4
4
|
import React, { useState } from 'react';
|
5
5
|
import LockIcon from '@pingux/mdi-react/LockIcon';
|
6
6
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
7
|
-
import { Badge, Icon, Tab, Tabs, Text } from '../../index';
|
7
|
+
import { Badge, Box, Icon, Tab, Tabs, Text } from '../../index';
|
8
8
|
import TabsReadme from './Tabs.mdx';
|
9
9
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
10
|
export default {
|
@@ -174,11 +174,11 @@ export var ContentSlots = function ContentSlots() {
|
|
174
174
|
marginLeft: 6,
|
175
175
|
marginTop: 10
|
176
176
|
};
|
177
|
-
var afterTabNode = ___EmotionJSX(Badge, {
|
177
|
+
var afterTabNode = ___EmotionJSX(Box, null, ___EmotionJSX(Badge, {
|
178
178
|
variant: "countNeutral",
|
179
179
|
sx: nodeSx,
|
180
180
|
label: "14"
|
181
|
-
});
|
181
|
+
}));
|
182
182
|
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Tabs, {
|
183
183
|
items: tabs,
|
184
184
|
mb: 50
|
@@ -6,9 +6,7 @@ var useComponentToggle = function useComponentToggle(props) {
|
|
6
6
|
ComponentToRenderIfFalse = props.ComponentToRenderIfFalse,
|
7
7
|
condition = props.condition,
|
8
8
|
onConditionChange = props.onConditionChange;
|
9
|
-
var _useProgressiveState = useProgressiveState(condition,
|
10
|
-
return null;
|
11
|
-
}),
|
9
|
+
var _useProgressiveState = useProgressiveState(condition, false),
|
12
10
|
_useProgressiveState2 = _slicedToArray(_useProgressiveState, 2),
|
13
11
|
isToggled = _useProgressiveState2[0],
|
14
12
|
setIsToggled = _useProgressiveState2[1];
|
@@ -15,6 +15,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
15
15
|
import { useEffect, useState } from 'react';
|
16
16
|
import { mergeProps, useFocusRing, useLabel } from 'react-aria';
|
17
17
|
import { useFocusWithin } from '@react-aria/interactions';
|
18
|
+
// eslint-disable-next-line import/no-unresolved
|
19
|
+
|
18
20
|
import noop from 'lodash/noop';
|
19
21
|
import omit from 'lodash/omit';
|
20
22
|
import { modes as labelModes } from '../../components/Label/constants';
|
@@ -1,15 +1,11 @@
|
|
1
1
|
import { useState } from 'react';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* A custom hook that provides stateful capabilities when the associated prop is not supplied
|
5
|
-
* @param {*} prop The intended prop to be controlled by state
|
6
|
-
* @param {*} initial The initial state value, used only if the given prop is undefined
|
7
|
-
*/
|
8
2
|
var useProgressiveState = function useProgressiveState(prop, initial) {
|
9
3
|
var controlledState = useState(initial);
|
10
4
|
if (prop === undefined) {
|
11
5
|
return controlledState;
|
12
6
|
}
|
13
|
-
return [prop, function () {
|
7
|
+
return [prop, function () {
|
8
|
+
return undefined;
|
9
|
+
}];
|
14
10
|
};
|
15
11
|
export default useProgressiveState;
|