@astryxdesign/core 0.7.8-canary.ffd29c5 → 0.7.8
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/CHANGELOG.md +132 -0
- package/dist/BottomSheet/BottomSheetPanel.d.ts +1 -1
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +30 -14
- package/dist/BottomSheet/bottomSheetStack.js +1 -1
- package/dist/BottomSheet/useSheetGestures.d.ts +3 -1
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +4 -0
- package/dist/CheckboxList/CheckboxList.d.ts +13 -2
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +10 -4
- package/dist/CheckboxList/CheckboxListContext.d.ts +7 -0
- package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListContext.js +2 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +14 -2
- package/dist/CheckboxList/requiredGroup.d.ts +22 -0
- package/dist/CheckboxList/requiredGroup.d.ts.map +1 -0
- package/dist/CheckboxList/requiredGroup.js +52 -0
- package/dist/DateInput/PickerWheel.d.ts +1 -1
- package/dist/DateInput/PickerWheel.d.ts.map +1 -1
- package/dist/DateInput/PickerWheel.js +27 -6
- package/dist/DateInput/Wheel.d.ts +2 -2
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +20 -6
- package/dist/DateInput/datePickerTouch.d.ts +13 -0
- package/dist/DateInput/datePickerTouch.d.ts.map +1 -0
- package/dist/DateInput/datePickerTouch.js +14 -0
- package/dist/DateInput/wheelOptions.d.ts +22 -2
- package/dist/DateInput/wheelOptions.d.ts.map +1 -1
- package/dist/DateInput/wheelOptions.js +14 -2
- package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.js +62 -119
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +6 -1
- package/dist/Overlay/Overlay.d.ts.map +1 -1
- package/dist/Overlay/Overlay.js +7 -2
- package/dist/PowerSearch/PowerSearch.d.ts +4 -2
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +24 -1
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchBottomSheet.js +172 -50
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +15 -15
- package/dist/Resizable/createResizable.d.ts +70 -16
- package/dist/Resizable/createResizable.d.ts.map +1 -1
- package/dist/Resizable/createResizable.js +180 -22
- package/dist/Resizable/separatorAttributes.d.ts +45 -0
- package/dist/Resizable/separatorAttributes.d.ts.map +1 -0
- package/dist/Resizable/separatorAttributes.js +35 -0
- package/dist/Resizable/useResizable.js +2 -2
- package/dist/TimeInput/TimeWheels.d.ts +32 -0
- package/dist/TimeInput/TimeWheels.d.ts.map +1 -0
- package/dist/TimeInput/TimeWheels.js +144 -0
- package/dist/TimeInput/TouchTimeField.d.ts.map +1 -1
- package/dist/TimeInput/TouchTimeField.js +63 -118
- package/dist/TimeInput/timeWheelRules.d.ts +124 -0
- package/dist/TimeInput/timeWheelRules.d.ts.map +1 -0
- package/dist/TimeInput/timeWheelRules.js +277 -0
- package/dist/Tokenizer/TokenizerBottomSheet.js +8 -12
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +6 -0
- package/dist/astryx.css +3 -1
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +3 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.js +5 -2
- package/dist/i18n/generated-english/Resizable/createResizable.generated.d.ts +8 -0
- package/dist/i18n/generated-english/Resizable/createResizable.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/Resizable/createResizable.generated.js +13 -0
- package/dist/i18n/generated-english/TimeInput/TimeWheels.generated.d.ts +8 -0
- package/dist/i18n/generated-english/TimeInput/TimeWheels.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/TimeInput/TimeWheels.generated.js +17 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +5 -2
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +5 -2
- package/dist/keyboard/index.d.ts +17 -0
- package/dist/keyboard/index.d.ts.map +1 -0
- package/dist/keyboard/index.js +19 -0
- package/dist/keyboard/keyboardHeight.d.ts +149 -0
- package/dist/keyboard/keyboardHeight.d.ts.map +1 -0
- package/dist/keyboard/keyboardHeight.js +432 -0
- package/dist/keyboard/keyboardLayoutGuide.d.ts +59 -0
- package/dist/keyboard/keyboardLayoutGuide.d.ts.map +1 -0
- package/dist/keyboard/keyboardLayoutGuide.js +207 -0
- package/dist/keyboard/keyboardModel.d.ts +93 -0
- package/dist/keyboard/keyboardModel.d.ts.map +1 -0
- package/dist/keyboard/keyboardModel.js +220 -0
- package/dist/keyboard/rideKeyboard.d.ts +42 -0
- package/dist/keyboard/rideKeyboard.d.ts.map +1 -0
- package/dist/keyboard/rideKeyboard.js +77 -0
- package/dist/keyboard/useMobileKeyboard.d.ts +61 -0
- package/dist/keyboard/useMobileKeyboard.d.ts.map +1 -0
- package/dist/keyboard/useMobileKeyboard.js +699 -0
- package/dist/motion/android/index.d.ts +16 -0
- package/dist/motion/android/index.d.ts.map +1 -0
- package/dist/motion/android/index.js +18 -0
- package/dist/motion/android/keyboard.d.ts +83 -0
- package/dist/motion/android/keyboard.d.ts.map +1 -0
- package/dist/motion/android/keyboard.js +96 -0
- package/dist/motion/uikit/datePicker.d.ts +58 -0
- package/dist/motion/uikit/datePicker.d.ts.map +1 -0
- package/dist/motion/uikit/datePicker.js +60 -0
- package/dist/motion/uikit/index.d.ts +4 -3
- package/dist/motion/uikit/index.d.ts.map +1 -1
- package/dist/motion/uikit/index.js +4 -3
- package/dist/utils/interactionOverlay.stylex.d.ts +3 -2
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +3 -2
- package/dist/utils/layoutViewport.d.ts +25 -0
- package/dist/utils/layoutViewport.d.ts.map +1 -0
- package/dist/utils/layoutViewport.js +102 -0
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +74 -9
- package/dist/utils/pressGesture.d.ts +4 -2
- package/dist/utils/pressGesture.d.ts.map +1 -1
- package/dist/utils/pressGesture.js +3 -1
- package/dist/utils/selectionLock.d.ts +10 -1
- package/dist/utils/selectionLock.d.ts.map +1 -1
- package/dist/utils/selectionLock.js +31 -5
- package/dist/utils/sharedMutationObserver.d.ts +2 -1
- package/dist/utils/sharedMutationObserver.d.ts.map +1 -1
- package/dist/utils/sharedMutationObserver.js +2 -1
- package/dist/utils/timeParser.d.ts +2 -1
- package/dist/utils/timeParser.d.ts.map +1 -1
- package/dist/utils/timeParser.js +29 -3
- package/locales/en.json +21 -9
- package/locales/pseudo.json +15 -6
- package/package.json +5 -5
- package/src/BottomSheet/BottomSheet.doc.mjs +1 -1
- package/src/BottomSheet/BottomSheetPanel.tsx +41 -13
- package/src/BottomSheet/BottomSheetSwitcher.doc.mjs +5 -0
- package/src/BottomSheet/bottomSheetStack.ts +1 -1
- package/src/BottomSheet/useSheetGestures.ts +6 -0
- package/src/CheckboxList/CheckboxList.doc.mjs +7 -0
- package/src/CheckboxList/CheckboxList.tsx +34 -2
- package/src/CheckboxList/CheckboxListContext.tsx +9 -1
- package/src/CheckboxList/CheckboxListItem.tsx +23 -2
- package/src/CheckboxList/requiredGroup.ts +77 -0
- package/src/DateInput/PickerWheel.tsx +37 -4
- package/src/DateInput/Wheel.tsx +30 -3
- package/src/DateInput/datePickerTouch.ts +15 -0
- package/src/DateInput/wheelOptions.ts +31 -2
- package/src/DateTimeInput/TouchDateTimeField.tsx +94 -178
- package/src/HoverCard/useHoverCard.tsx +6 -1
- package/src/Overlay/Overlay.tsx +7 -2
- package/src/PowerSearch/PowerSearch.doc.mjs +2 -2
- package/src/PowerSearch/PowerSearch.tsx +4 -2
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +237 -62
- package/src/Resizable/ResizeHandle.tsx +18 -26
- package/src/Resizable/createResizable.ts +242 -27
- package/src/Resizable/separatorAttributes.ts +73 -0
- package/src/Resizable/useResizable.ts +2 -2
- package/src/TimeInput/TimeWheels.tsx +218 -0
- package/src/TimeInput/TouchTimeField.tsx +93 -157
- package/src/TimeInput/timeWheelRules.ts +352 -0
- package/src/Tokenizer/TokenizerBottomSheet.tsx +8 -12
- package/src/Tooltip/useTooltip.tsx +6 -0
- package/src/gestures/GestureHost.ts +5 -4
- package/src/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.ts +5 -2
- package/src/i18n/generated-english/Resizable/createResizable.generated.ts +14 -0
- package/src/i18n/generated-english/TimeInput/TimeWheels.generated.ts +18 -0
- package/src/i18n/generated-locales/en.generated.ts +6 -4
- package/src/i18n/generated-locales/pseudo.generated.ts +6 -4
- package/src/keyboard/README.md +197 -0
- package/src/keyboard/index.ts +48 -0
- package/src/keyboard/keyboardHeight.ts +543 -0
- package/src/keyboard/keyboardLayoutGuide.ts +266 -0
- package/src/keyboard/keyboardModel.ts +301 -0
- package/src/keyboard/rideKeyboard.ts +100 -0
- package/src/keyboard/useMobileKeyboard.ts +866 -0
- package/src/motion/MEASUREMENTS.md +10 -0
- package/src/motion/README.md +2 -0
- package/src/motion/android/index.ts +18 -0
- package/src/motion/android/keyboard.ts +96 -0
- package/src/motion/uikit/datePicker.ts +60 -0
- package/src/motion/uikit/index.ts +4 -3
- package/src/utils/interactionOverlay.stylex.ts +3 -2
- package/src/utils/layoutViewport.ts +104 -0
- package/src/utils/pressFeedback.ts +99 -21
- package/src/utils/pressGesture.ts +4 -2
- package/src/utils/selectionLock.ts +40 -6
- package/src/utils/sharedMutationObserver.ts +2 -1
- package/src/utils/timeParser.ts +40 -3
- package/dist/BottomSheet/useMobileKeyboard.d.ts +0 -21
- package/dist/BottomSheet/useMobileKeyboard.d.ts.map +0 -1
- package/dist/BottomSheet/useMobileKeyboard.js +0 -413
- package/src/BottomSheet/useMobileKeyboard.ts +0 -542
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SizeValue } from '../utils/types.js';
|
|
2
2
|
import { type ResizableDirection } from './resizableModel.js';
|
|
3
|
-
import type
|
|
3
|
+
import { type ResizeGestureModel } from './resizeGesture.js';
|
|
4
4
|
import type { ResizableSize } from './utils.js';
|
|
5
5
|
export interface CreateResizableOptions {
|
|
6
6
|
/**
|
|
@@ -44,6 +44,31 @@ export interface CreateResizableOptions {
|
|
|
44
44
|
onSizeChange?: (size: number) => void;
|
|
45
45
|
/** Called when an interaction collapses or expands the region. */
|
|
46
46
|
onCollapseChange?: (isCollapsed: boolean) => void;
|
|
47
|
+
/**
|
|
48
|
+
* The handle sits before the panel it resizes (the panel is at the end), so
|
|
49
|
+
* a drag toward the start grows it.
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
isReversed?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Ignores pointer and keyboard input and says so; a plain element keeps its
|
|
55
|
+
* tab stop.
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
isDisabled?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* A plain element's accessible name, when it has none of its own. Without
|
|
61
|
+
* it, the factory uses the message catalog's English message.
|
|
62
|
+
* @default 'Resize handle'
|
|
63
|
+
*/
|
|
64
|
+
label?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Replaces the catalog's "Collapsed" that the handle announces as its
|
|
67
|
+
* `aria-valuetext` while the region is collapsed. Absent, the factory
|
|
68
|
+
* announces the shipped English message.
|
|
69
|
+
* @default 'Collapsed'
|
|
70
|
+
*/
|
|
71
|
+
collapsedLabel?: string;
|
|
47
72
|
}
|
|
48
73
|
export interface ResizableController {
|
|
49
74
|
/** The region's size in px, 0 while collapsed. */
|
|
@@ -67,12 +92,15 @@ export interface ResizableController {
|
|
|
67
92
|
* that stops it.
|
|
68
93
|
*/
|
|
69
94
|
subscribe(listener: () => void): () => void;
|
|
70
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* Removes every listener, observer and attribute the factory added and the
|
|
97
|
+
* body's drag cursor; a drag in flight ends as cancelled.
|
|
98
|
+
*/
|
|
71
99
|
destroy(): void;
|
|
72
100
|
}
|
|
73
101
|
/**
|
|
74
|
-
* The state a region with `options` starts in
|
|
75
|
-
* hook's first render. A container is not measured
|
|
102
|
+
* The state a region with `options` starts in, before its handle exists: the
|
|
103
|
+
* server's render and a hook's first render. A container is not measured
|
|
76
104
|
* yet, so a percentage of it resolves against the deterministic 1200px basis
|
|
77
105
|
* until the factory measures it. `'server'` reads the state the server
|
|
78
106
|
* rendered, for a render that hydrates it: the 1200px basis for a viewport
|
|
@@ -108,28 +136,54 @@ interface ResizableInternals {
|
|
|
108
136
|
syncContainer(): void;
|
|
109
137
|
/**
|
|
110
138
|
* Lets go of the page and keeps the region. A gesture in flight ends as
|
|
111
|
-
* cancelled, and the
|
|
112
|
-
* and report. For a React caller
|
|
113
|
-
* `<Activity>` hides.
|
|
139
|
+
* cancelled, and the handle's listeners, its attributes and the observers
|
|
140
|
+
* go. Collapse, expand and resize still apply and report. For a React caller
|
|
141
|
+
* whose component unmounts or an `<Activity>` hides.
|
|
114
142
|
*/
|
|
115
143
|
suspend(): void;
|
|
116
|
-
/** Takes the page back after `suspend`: the observers. */
|
|
144
|
+
/** Takes the page back after `suspend`: the handle, and the observers. */
|
|
117
145
|
resume(): void;
|
|
118
146
|
/**
|
|
119
|
-
* The region's side of a
|
|
120
|
-
* ResizeHandle given the configuration object's props.
|
|
147
|
+
* The region's side of a gesture the factory does not own: the drag and
|
|
148
|
+
* keys of a ResizeHandle given the configuration object's props.
|
|
121
149
|
*/
|
|
122
150
|
model: ResizeGestureModel;
|
|
123
151
|
}
|
|
124
152
|
/** The factory's internal channel, or undefined for anything else. */
|
|
125
153
|
export declare function readResizableInternals(controller: ResizableController): ResizableInternals | undefined;
|
|
126
154
|
/**
|
|
127
|
-
*
|
|
128
|
-
* reports the size, and the caller applies it.
|
|
129
|
-
*
|
|
130
|
-
* `
|
|
155
|
+
* Make `handle` a window splitter that resizes a region. The factory never
|
|
156
|
+
* sizes the panel: it reports the size, and the caller applies it.
|
|
157
|
+
*
|
|
158
|
+
* It gives the handle `role="separator"`, its orientation and its value. It
|
|
159
|
+
* adds a tab stop and an accessible name when the handle has none. It answers
|
|
160
|
+
* a pointer drag, the arrow keys, Home and End, and holds the pointer for a
|
|
161
|
+
* whole drag. Enter and a double-click collapse and restore. A horizontal
|
|
162
|
+
* region resizes along the inline axis, and under right-to-left the drag
|
|
163
|
+
* follows the pointer. `destroy` takes all of it away. With a null handle the
|
|
164
|
+
* region still answers collapse, expand, resize and subscribe, and touches no
|
|
165
|
+
* element. Outside a provider, its name and its collapsed text are the
|
|
166
|
+
* shipped English messages. `label` names it, and `collapsedLabel` replaces
|
|
167
|
+
* its collapsed text in another language.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```
|
|
171
|
+
* const sidebar = document.querySelector('#sidebar');
|
|
172
|
+
* const resizable = createResizable(document.querySelector('#divider'), {
|
|
173
|
+
* defaultSize: 260,
|
|
174
|
+
* minSize: 180,
|
|
175
|
+
* maxSize: 480,
|
|
176
|
+
* collapsible: true,
|
|
177
|
+
* autoSaveId: 'sidebar',
|
|
178
|
+
* });
|
|
179
|
+
* const paint = () => {
|
|
180
|
+
* sidebar.style.width = `${resizable.size}px`;
|
|
181
|
+
* };
|
|
182
|
+
* paint();
|
|
183
|
+
* resizable.subscribe(paint);
|
|
184
|
+
* ```
|
|
131
185
|
*/
|
|
132
|
-
export declare function createResizable(options?: CreateResizableOptions): ResizableController;
|
|
186
|
+
export declare function createResizable(handle: HTMLElement | null, options?: CreateResizableOptions): ResizableController;
|
|
133
187
|
/**
|
|
134
188
|
* Who a factory's development warnings speak for: the bare factory, or the
|
|
135
189
|
* configuration-object useResizable built on it, whose warnings keep the
|
|
@@ -140,6 +194,6 @@ export type ResizableWarningSource = 'createResizable' | 'useResizable';
|
|
|
140
194
|
* createResizable, with its development warnings in the words of `source`:
|
|
141
195
|
* the package's own entry, for useResizable.
|
|
142
196
|
*/
|
|
143
|
-
export declare function createResizableAs(source: ResizableWarningSource, options?: CreateResizableOptions): ResizableController;
|
|
197
|
+
export declare function createResizableAs(source: ResizableWarningSource, handle: HTMLElement | null, options?: CreateResizableOptions): ResizableController;
|
|
144
198
|
export {};
|
|
145
199
|
//# sourceMappingURL=createResizable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createResizable.d.ts","sourceRoot":"","sources":["../../src/Resizable/createResizable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createResizable.d.ts","sourceRoot":"","sources":["../../src/Resizable/createResizable.ts"],"names":[],"mappings":"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"}
|
|
@@ -2,17 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @file createResizable.ts
|
|
5
|
-
* @input A region
|
|
5
|
+
* @input A handle element, or null for a region with no handle yet, and the
|
|
6
|
+
* region's options
|
|
6
7
|
* @output createResizable; readInitialResizableState for the hook's first
|
|
7
|
-
* render; createResizableAs and the internal channel for the
|
|
8
|
-
* @position The Resizable family's
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* render; createResizableAs and the internal channel for the hooks
|
|
9
|
+
* @position The Resizable family's factory, internal to the package. Its
|
|
10
|
+
* input is resizeGesture.ts: it listens with it on a plain handle, and
|
|
11
|
+
* ResizeHandle drives the region through its model. The
|
|
12
|
+
* configuration-object useResizable builds on it. No DOM work on import
|
|
11
13
|
*/
|
|
12
14
|
|
|
15
|
+
import { registerEnglishFallback } from "../i18n/englishFallback.js";
|
|
16
|
+
import english from "../i18n/generated-english/Resizable/createResizable.generated.js";
|
|
13
17
|
import { observeResize } from "../utils/sharedResizeObserver.js";
|
|
14
18
|
import { devWarn } from "../utils/devWarning.js";
|
|
15
19
|
import { DEFAULT_COLLAPSED_SIZE, DEFAULT_MIN, DEFAULT_SIZE_FALLBACK, RESIZABLE_SIZE_GUIDANCE, SERVER_BASIS, clampSize, dependsOnBasis, loadPersistedState, measureContentBox, parseSize, persistState, resolveBound } from "./resizableModel.js";
|
|
20
|
+
import { createResizeGesture } from "./resizeGesture.js";
|
|
21
|
+
import { separatorAttributes } from "./separatorAttributes.js";
|
|
22
|
+
// The English for the two messages it names, and nothing more of the catalog.
|
|
23
|
+
registerEnglishFallback(english);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The catalog's messages for a plain handle: its name and what it announces
|
|
27
|
+
* while collapsed, when the options give neither `label` nor
|
|
28
|
+
* `collapsedLabel`. The factory uses the shipped English messages.
|
|
29
|
+
*/
|
|
30
|
+
const LABEL_KEY = '@astryx.resizable.handle.label';
|
|
31
|
+
const COLLAPSED_LABEL_KEY = '@astryx.resizable.collapsed';
|
|
16
32
|
/** The viewport width, the basis without a container. */
|
|
17
33
|
function readViewportBasis() {
|
|
18
34
|
return typeof window === 'undefined' ? SERVER_BASIS : window.innerWidth;
|
|
@@ -26,14 +42,14 @@ function readWindowExtent(direction) {
|
|
|
26
42
|
return direction === 'vertical' ? window.innerHeight : window.innerWidth;
|
|
27
43
|
}
|
|
28
44
|
|
|
29
|
-
/**
|
|
45
|
+
/** Starts as warned: the factory warns, and this first-render read does not. */
|
|
30
46
|
const QUIET = {
|
|
31
47
|
current: true
|
|
32
48
|
};
|
|
33
49
|
|
|
34
50
|
/**
|
|
35
|
-
* The state a region with `options` starts in
|
|
36
|
-
* hook's first render. A container is not measured
|
|
51
|
+
* The state a region with `options` starts in, before its handle exists: the
|
|
52
|
+
* server's render and a hook's first render. A container is not measured
|
|
37
53
|
* yet, so a percentage of it resolves against the deterministic 1200px basis
|
|
38
54
|
* until the factory measures it. `'server'` reads the state the server
|
|
39
55
|
* rendered, for a render that hydrates it: the 1200px basis for a viewport
|
|
@@ -96,14 +112,48 @@ export function readResizableInternals(controller) {
|
|
|
96
112
|
return internals.get(controller);
|
|
97
113
|
}
|
|
98
114
|
|
|
115
|
+
/** An attribute's value as the DOM takes it; undefined removes it. */
|
|
116
|
+
function toAttribute(value) {
|
|
117
|
+
return value == null ? null : String(value);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** The attributes the factory writes on a handle, restored by `destroy`. */
|
|
121
|
+
const MANAGED_ATTRIBUTES = ['role', 'tabindex', 'aria-label', 'aria-orientation', 'aria-valuenow', 'aria-valuemin', 'aria-valuemax', 'aria-valuetext', 'aria-disabled', 'data-resizing'];
|
|
122
|
+
|
|
99
123
|
/**
|
|
100
|
-
*
|
|
101
|
-
* reports the size, and the caller applies it.
|
|
102
|
-
*
|
|
103
|
-
* `
|
|
124
|
+
* Make `handle` a window splitter that resizes a region. The factory never
|
|
125
|
+
* sizes the panel: it reports the size, and the caller applies it.
|
|
126
|
+
*
|
|
127
|
+
* It gives the handle `role="separator"`, its orientation and its value. It
|
|
128
|
+
* adds a tab stop and an accessible name when the handle has none. It answers
|
|
129
|
+
* a pointer drag, the arrow keys, Home and End, and holds the pointer for a
|
|
130
|
+
* whole drag. Enter and a double-click collapse and restore. A horizontal
|
|
131
|
+
* region resizes along the inline axis, and under right-to-left the drag
|
|
132
|
+
* follows the pointer. `destroy` takes all of it away. With a null handle the
|
|
133
|
+
* region still answers collapse, expand, resize and subscribe, and touches no
|
|
134
|
+
* element. Outside a provider, its name and its collapsed text are the
|
|
135
|
+
* shipped English messages. `label` names it, and `collapsedLabel` replaces
|
|
136
|
+
* its collapsed text in another language.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```
|
|
140
|
+
* const sidebar = document.querySelector('#sidebar');
|
|
141
|
+
* const resizable = createResizable(document.querySelector('#divider'), {
|
|
142
|
+
* defaultSize: 260,
|
|
143
|
+
* minSize: 180,
|
|
144
|
+
* maxSize: 480,
|
|
145
|
+
* collapsible: true,
|
|
146
|
+
* autoSaveId: 'sidebar',
|
|
147
|
+
* });
|
|
148
|
+
* const paint = () => {
|
|
149
|
+
* sidebar.style.width = `${resizable.size}px`;
|
|
150
|
+
* };
|
|
151
|
+
* paint();
|
|
152
|
+
* resizable.subscribe(paint);
|
|
153
|
+
* ```
|
|
104
154
|
*/
|
|
105
|
-
export function createResizable(options = {}) {
|
|
106
|
-
return createResizableAs('createResizable', options);
|
|
155
|
+
export function createResizable(handle, options = {}) {
|
|
156
|
+
return createResizableAs('createResizable', handle, options);
|
|
107
157
|
}
|
|
108
158
|
|
|
109
159
|
/**
|
|
@@ -116,7 +166,7 @@ export function createResizable(options = {}) {
|
|
|
116
166
|
* createResizable, with its development warnings in the words of `source`:
|
|
117
167
|
* the package's own entry, for useResizable.
|
|
118
168
|
*/
|
|
119
|
-
export function createResizableAs(source, options = {}) {
|
|
169
|
+
export function createResizableAs(source, handle, options = {}) {
|
|
120
170
|
// The configuration-object useResizable keeps its warnings word for word.
|
|
121
171
|
const isHook = source === 'useResizable';
|
|
122
172
|
let opts = options;
|
|
@@ -124,6 +174,8 @@ export function createResizableAs(source, options = {}) {
|
|
|
124
174
|
// Let go of the page by `suspend`, with the region kept.
|
|
125
175
|
let isSuspended = false;
|
|
126
176
|
const listeners = new Set();
|
|
177
|
+
const isReversed = () => opts.isReversed ?? false;
|
|
178
|
+
const isDisabled = () => opts.isDisabled ?? false;
|
|
127
179
|
const didWarn = {
|
|
128
180
|
min: {
|
|
129
181
|
current: false
|
|
@@ -158,8 +210,6 @@ export function createResizableAs(source, options = {}) {
|
|
|
158
210
|
let chosenSize;
|
|
159
211
|
let committedBounds = null;
|
|
160
212
|
let uncontrolledIsCollapsed = persisted?.isCollapsed ?? opts.defaultIsCollapsed ?? false;
|
|
161
|
-
|
|
162
|
-
// What the region last computed, notified and wrote.
|
|
163
213
|
let derived = {
|
|
164
214
|
size: 0,
|
|
165
215
|
isCollapsed: false,
|
|
@@ -290,13 +340,13 @@ export function createResizableAs(source, options = {}) {
|
|
|
290
340
|
};
|
|
291
341
|
}
|
|
292
342
|
|
|
293
|
-
/** Recompute, then bring the observers, storage and subscribers along. */
|
|
343
|
+
/** Recompute, then bring the observers, the handle, storage and subscribers along. */
|
|
294
344
|
function commit() {
|
|
295
345
|
if (isDestroyed) {
|
|
296
346
|
return;
|
|
297
347
|
}
|
|
298
348
|
if (isSuspended) {
|
|
299
|
-
// No observers: the last measured basis stands.
|
|
349
|
+
// No observers and no handle: the last measured basis stands.
|
|
300
350
|
compute();
|
|
301
351
|
} else {
|
|
302
352
|
// The observation a computation needs can change with it (a default
|
|
@@ -311,6 +361,9 @@ export function createResizableAs(source, options = {}) {
|
|
|
311
361
|
}
|
|
312
362
|
}
|
|
313
363
|
}
|
|
364
|
+
if (handle != null && !isSuspended) {
|
|
365
|
+
announce();
|
|
366
|
+
}
|
|
314
367
|
persist();
|
|
315
368
|
const reported = {
|
|
316
369
|
size: derived.isCollapsed ? 0 : derived.size,
|
|
@@ -367,6 +420,58 @@ export function createResizableAs(source, options = {}) {
|
|
|
367
420
|
});
|
|
368
421
|
}
|
|
369
422
|
}
|
|
423
|
+
const original = new Map();
|
|
424
|
+
if (handle != null) {
|
|
425
|
+
for (const name of MANAGED_ATTRIBUTES) {
|
|
426
|
+
original.set(name, handle.getAttribute(name));
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
const hasOwnName = handle != null && (handle.hasAttribute('aria-label') || handle.hasAttribute('aria-labelledby'));
|
|
430
|
+
const setAttribute = (name, value) => {
|
|
431
|
+
if (handle == null) {
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
if (value == null) {
|
|
435
|
+
handle.removeAttribute(name);
|
|
436
|
+
} else if (handle.getAttribute(name) !== value) {
|
|
437
|
+
handle.setAttribute(name, value);
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
function announce() {
|
|
441
|
+
if (original.get('role') == null) {
|
|
442
|
+
setAttribute('role', 'separator');
|
|
443
|
+
}
|
|
444
|
+
if (!hasOwnName) {
|
|
445
|
+
setAttribute('aria-label', opts.label ?? english[LABEL_KEY]);
|
|
446
|
+
}
|
|
447
|
+
const {
|
|
448
|
+
size,
|
|
449
|
+
isCollapsed,
|
|
450
|
+
min,
|
|
451
|
+
effectiveMax
|
|
452
|
+
} = derived;
|
|
453
|
+
// The attributes ResizeHandle renders, from the same derivation.
|
|
454
|
+
const aria = separatorAttributes({
|
|
455
|
+
direction: direction(),
|
|
456
|
+
isDisabled: isDisabled(),
|
|
457
|
+
value: {
|
|
458
|
+
size: isCollapsed ? 0 : size,
|
|
459
|
+
minPx: min,
|
|
460
|
+
maxPx: effectiveMax,
|
|
461
|
+
isCollapsed,
|
|
462
|
+
collapsedText: opts.collapsedLabel ?? english[COLLAPSED_LABEL_KEY]
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
if (original.get('tabindex') == null) {
|
|
466
|
+
setAttribute('tabindex', String(aria.tabIndex));
|
|
467
|
+
}
|
|
468
|
+
setAttribute('aria-orientation', aria['aria-orientation']);
|
|
469
|
+
setAttribute('aria-valuenow', toAttribute(aria['aria-valuenow']));
|
|
470
|
+
setAttribute('aria-valuemin', toAttribute(aria['aria-valuemin']));
|
|
471
|
+
setAttribute('aria-valuemax', toAttribute(aria['aria-valuemax']));
|
|
472
|
+
setAttribute('aria-valuetext', toAttribute(aria['aria-valuetext']));
|
|
473
|
+
setAttribute('aria-disabled', toAttribute(aria['aria-disabled']));
|
|
474
|
+
}
|
|
370
475
|
const setCollapsed = value => {
|
|
371
476
|
if (!isControlled()) {
|
|
372
477
|
uncontrolledIsCollapsed = value;
|
|
@@ -483,9 +588,53 @@ export function createResizableAs(source, options = {}) {
|
|
|
483
588
|
mustWrite = true;
|
|
484
589
|
commit();
|
|
485
590
|
}
|
|
591
|
+
const gesture = createResizeGesture(() => handle, model, () => ({
|
|
592
|
+
direction: direction(),
|
|
593
|
+
isReversed: isReversed(),
|
|
594
|
+
isDisabled: isDisabled()
|
|
595
|
+
}), dragging => {
|
|
596
|
+
setAttribute('data-resizing', dragging ? '' : null);
|
|
597
|
+
});
|
|
598
|
+
const onPointerDown = event => {
|
|
599
|
+
gesture.pointerDown(event);
|
|
600
|
+
};
|
|
601
|
+
const onPointerMove = event => {
|
|
602
|
+
gesture.pointerMove(event);
|
|
603
|
+
};
|
|
604
|
+
const onPointerUp = event => {
|
|
605
|
+
gesture.pointerUp(event);
|
|
606
|
+
};
|
|
607
|
+
const onPointerCancel = event => {
|
|
608
|
+
gesture.pointerCancel(event);
|
|
609
|
+
};
|
|
610
|
+
const onKeyDown = event => {
|
|
611
|
+
gesture.keyDown(event);
|
|
612
|
+
};
|
|
613
|
+
const onDoubleClick = () => {
|
|
614
|
+
gesture.doubleClick();
|
|
615
|
+
};
|
|
616
|
+
function bindHandle() {
|
|
617
|
+
handle?.addEventListener('pointerdown', onPointerDown);
|
|
618
|
+
handle?.addEventListener('pointermove', onPointerMove);
|
|
619
|
+
handle?.addEventListener('pointerup', onPointerUp);
|
|
620
|
+
handle?.addEventListener('pointercancel', onPointerCancel);
|
|
621
|
+
handle?.addEventListener('lostpointercapture', onPointerCancel);
|
|
622
|
+
handle?.addEventListener('keydown', onKeyDown);
|
|
623
|
+
handle?.addEventListener('dblclick', onDoubleClick);
|
|
624
|
+
}
|
|
486
625
|
|
|
487
|
-
/**
|
|
626
|
+
/**
|
|
627
|
+
* The handle's listeners and the observers go, and the handle gets its own
|
|
628
|
+
* attributes back; a gesture in flight has ended first.
|
|
629
|
+
*/
|
|
488
630
|
function letGoOfPage() {
|
|
631
|
+
handle?.removeEventListener('pointerdown', onPointerDown);
|
|
632
|
+
handle?.removeEventListener('pointermove', onPointerMove);
|
|
633
|
+
handle?.removeEventListener('pointerup', onPointerUp);
|
|
634
|
+
handle?.removeEventListener('pointercancel', onPointerCancel);
|
|
635
|
+
handle?.removeEventListener('lostpointercapture', onPointerCancel);
|
|
636
|
+
handle?.removeEventListener('keydown', onKeyDown);
|
|
637
|
+
handle?.removeEventListener('dblclick', onDoubleClick);
|
|
489
638
|
stopObservingContainer?.();
|
|
490
639
|
stopObservingContainer = null;
|
|
491
640
|
containerElement = null;
|
|
@@ -493,7 +642,11 @@ export function createResizableAs(source, options = {}) {
|
|
|
493
642
|
window.removeEventListener('resize', onViewportResize);
|
|
494
643
|
isObservingViewport = false;
|
|
495
644
|
}
|
|
645
|
+
for (const [name, value] of original) {
|
|
646
|
+
setAttribute(name, value);
|
|
647
|
+
}
|
|
496
648
|
}
|
|
649
|
+
bindHandle();
|
|
497
650
|
commit();
|
|
498
651
|
const controller = {
|
|
499
652
|
get size() {
|
|
@@ -526,8 +679,11 @@ export function createResizableAs(source, options = {}) {
|
|
|
526
679
|
if (isDestroyed) {
|
|
527
680
|
return;
|
|
528
681
|
}
|
|
529
|
-
// A
|
|
530
|
-
//
|
|
682
|
+
// A drag in flight ends first, as cancelled, so the size it reached is
|
|
683
|
+
// saved and the pointer and the body's cursor are released.
|
|
684
|
+
gesture.interrupt();
|
|
685
|
+
// A gesture a ResizeHandle drove through the region's model, rather
|
|
686
|
+
// than the factory's own, ends the same way.
|
|
531
687
|
endGesture();
|
|
532
688
|
isDestroyed = true;
|
|
533
689
|
if (!isSuspended) {
|
|
@@ -550,6 +706,7 @@ export function createResizableAs(source, options = {}) {
|
|
|
550
706
|
if (isDestroyed || isSuspended) {
|
|
551
707
|
return;
|
|
552
708
|
}
|
|
709
|
+
gesture.interrupt();
|
|
553
710
|
endGesture();
|
|
554
711
|
isSuspended = true;
|
|
555
712
|
letGoOfPage();
|
|
@@ -559,6 +716,7 @@ export function createResizableAs(source, options = {}) {
|
|
|
559
716
|
return;
|
|
560
717
|
}
|
|
561
718
|
isSuspended = false;
|
|
719
|
+
bindHandle();
|
|
562
720
|
commit();
|
|
563
721
|
},
|
|
564
722
|
syncContainer() {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file separatorAttributes.ts
|
|
3
|
+
* @input A window splitter's axis and disabled state, and its region's size,
|
|
4
|
+
* bounds, collapse state and collapsed text
|
|
5
|
+
* @output separatorAttributes: the separator's ARIA attributes and tab stop,
|
|
6
|
+
* which ResizeHandle renders and createResizable writes on a plain element
|
|
7
|
+
* @position Internal to the Resizable family. No React, and no DOM work on
|
|
8
|
+
* import
|
|
9
|
+
*/
|
|
10
|
+
import type { ResizableDirection } from './resizableModel.js';
|
|
11
|
+
/** The region a separator resizes, as it announces it. */
|
|
12
|
+
export interface SeparatorValue {
|
|
13
|
+
/** The region's size in px, 0 while it is collapsed. */
|
|
14
|
+
readonly size: number;
|
|
15
|
+
readonly minPx: number;
|
|
16
|
+
/** The maximum to announce, or undefined when the region has none. */
|
|
17
|
+
readonly maxPx: number | undefined;
|
|
18
|
+
readonly isCollapsed: boolean;
|
|
19
|
+
/** The value text a collapsed separator announces. */
|
|
20
|
+
readonly collapsedText: string;
|
|
21
|
+
}
|
|
22
|
+
export interface SeparatorState {
|
|
23
|
+
readonly direction: ResizableDirection;
|
|
24
|
+
readonly isDisabled: boolean;
|
|
25
|
+
/** The region's value; a separator with no region has none. */
|
|
26
|
+
readonly value?: SeparatorValue;
|
|
27
|
+
}
|
|
28
|
+
export interface SeparatorAttributes {
|
|
29
|
+
readonly 'aria-orientation': 'horizontal' | 'vertical';
|
|
30
|
+
readonly 'aria-valuenow': number | undefined;
|
|
31
|
+
readonly 'aria-valuemin': number | undefined;
|
|
32
|
+
readonly 'aria-valuemax': number | undefined;
|
|
33
|
+
readonly 'aria-valuetext': string | undefined;
|
|
34
|
+
readonly 'aria-disabled': true | undefined;
|
|
35
|
+
readonly tabIndex: 0;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The separator's ARIA attributes and tab stop. A collapsed region's real
|
|
39
|
+
* size, 0, sits below aria-valuemin, which is invalid. So a collapsed
|
|
40
|
+
* separator announces its minimum, and its value text says it is collapsed.
|
|
41
|
+
* A disabled separator keeps its tab stop, so keyboard users can reach it and
|
|
42
|
+
* hear that it is disabled.
|
|
43
|
+
*/
|
|
44
|
+
export declare function separatorAttributes(state: SeparatorState): SeparatorAttributes;
|
|
45
|
+
//# sourceMappingURL=separatorAttributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"separatorAttributes.d.ts","sourceRoot":"","sources":["../../src/Resizable/separatorAttributes.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAEzD,0DAA0D;AAC1D,MAAM,WAAW,cAAc;IAC7B,wDAAwD;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,sDAAsD;IACtD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,+DAA+D;IAC/D,QAAQ,CAAC,KAAK,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,kBAAkB,EAAE,YAAY,GAAG,UAAU,CAAC;IACvD,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7C,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7C,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,eAAe,EAAE,IAAI,GAAG,SAAS,CAAC;IAC3C,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,cAAc,GACpB,mBAAmB,CAoBrB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file separatorAttributes.ts
|
|
5
|
+
* @input A window splitter's axis and disabled state, and its region's size,
|
|
6
|
+
* bounds, collapse state and collapsed text
|
|
7
|
+
* @output separatorAttributes: the separator's ARIA attributes and tab stop,
|
|
8
|
+
* which ResizeHandle renders and createResizable writes on a plain element
|
|
9
|
+
* @position Internal to the Resizable family. No React, and no DOM work on
|
|
10
|
+
* import
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** The region a separator resizes, as it announces it. */
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The separator's ARIA attributes and tab stop. A collapsed region's real
|
|
17
|
+
* size, 0, sits below aria-valuemin, which is invalid. So a collapsed
|
|
18
|
+
* separator announces its minimum, and its value text says it is collapsed.
|
|
19
|
+
* A disabled separator keeps its tab stop, so keyboard users can reach it and
|
|
20
|
+
* hear that it is disabled.
|
|
21
|
+
*/
|
|
22
|
+
export function separatorAttributes(state) {
|
|
23
|
+
const {
|
|
24
|
+
value
|
|
25
|
+
} = state;
|
|
26
|
+
return {
|
|
27
|
+
'aria-orientation': state.direction === 'horizontal' ? 'vertical' : 'horizontal',
|
|
28
|
+
'aria-valuenow': value == null ? undefined : value.isCollapsed ? Math.max(value.size, value.minPx) : value.size,
|
|
29
|
+
'aria-valuemin': value?.minPx,
|
|
30
|
+
'aria-valuemax': value?.maxPx != null && Number.isFinite(value.maxPx) ? value.maxPx : undefined,
|
|
31
|
+
'aria-valuetext': value?.isCollapsed ? value.collapsedText : undefined,
|
|
32
|
+
'aria-disabled': state.isDisabled || undefined,
|
|
33
|
+
tabIndex: 0
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -302,7 +302,7 @@ function useResizableController(options) {
|
|
|
302
302
|
return;
|
|
303
303
|
}
|
|
304
304
|
const passed = optionsRef.current;
|
|
305
|
-
const resizable = createResizableAs('useResizable', passed);
|
|
305
|
+
const resizable = createResizableAs('useResizable', null, passed);
|
|
306
306
|
slot.set({
|
|
307
307
|
resizable,
|
|
308
308
|
passed
|
|
@@ -367,7 +367,7 @@ function useResizableController(options) {
|
|
|
367
367
|
return entry.resizable;
|
|
368
368
|
}
|
|
369
369
|
const passed = optionsRef.current;
|
|
370
|
-
const resizable = createResizableAs('useResizable', passed);
|
|
370
|
+
const resizable = createResizableAs('useResizable', null, passed);
|
|
371
371
|
readResizableInternals(resizable)?.suspend();
|
|
372
372
|
slot.set({
|
|
373
373
|
resizable,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ISOTimeString } from '../utils/timeParser.js';
|
|
2
|
+
import { type TimeParts } from './timeWheelRules.js';
|
|
3
|
+
export interface TimeWheelsProps {
|
|
4
|
+
/** The time the wheels show. */
|
|
5
|
+
time: TimeParts;
|
|
6
|
+
/** 12-hour (with an AM/PM column) or 24-hour time. */
|
|
7
|
+
hourFormat: '12h' | '24h';
|
|
8
|
+
/** Whether a seconds column shows. */
|
|
9
|
+
hasSeconds: boolean;
|
|
10
|
+
/** Earliest time that may commit. */
|
|
11
|
+
min?: ISOTimeString;
|
|
12
|
+
/** Latest time that may commit. */
|
|
13
|
+
max?: ISOTimeString;
|
|
14
|
+
/** False while the wheels are hidden. */
|
|
15
|
+
isActive: boolean;
|
|
16
|
+
/** Called with the committed time, already inside the bounds. */
|
|
17
|
+
onCommit: (time: TimeParts) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* UIDatePicker's time wheels.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```
|
|
24
|
+
* <TimeWheels time={{hour: 11, minute: 58, second: 0}} hourFormat="12h"
|
|
25
|
+
* hasSeconds={false} isActive onCommit={setTime} />
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function TimeWheels({ time, hourFormat, hasSeconds, min, max, isActive, onCommit, }: TimeWheelsProps): import("react").JSX.Element;
|
|
29
|
+
export declare namespace TimeWheels {
|
|
30
|
+
var displayName: string;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=TimeWheels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeWheels.d.ts","sourceRoot":"","sources":["../../src/TimeInput/TimeWheels.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAaL,KAAK,SAAS,EAEf,MAAM,kBAAkB,CAAC;AAS1B,MAAM,WAAW,eAAe;IAC9B,gCAAgC;IAChC,IAAI,EAAE,SAAS,CAAC;IAChB,sDAAsD;IACtD,UAAU,EAAE,KAAK,GAAG,KAAK,CAAC;IAC1B,sCAAsC;IACtC,UAAU,EAAE,OAAO,CAAC;IACpB,qCAAqC;IACrC,GAAG,CAAC,EAAE,aAAa,CAAC;IACpB,mCAAmC;IACnC,GAAG,CAAC,EAAE,aAAa,CAAC;IACpB,yCAAyC;IACzC,QAAQ,EAAE,OAAO,CAAC;IAClB,iEAAiE;IACjE,QAAQ,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACrC;AAMD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,UAAU,EACV,UAAU,EACV,GAAG,EACH,GAAG,EACH,QAAQ,EACR,QAAQ,GACT,EAAE,eAAe,+BAoIjB;yBA5Ie,UAAU"}
|