@ufoui/core 0.0.4 → 0.0.12
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/README.md +9 -3
- package/assets/icons.d.ts +11 -0
- package/assets/index.d.ts +1 -0
- package/components/accordion/accordion.d.ts +52 -0
- package/components/accordion/accordionItem.d.ts +65 -0
- package/components/accordion/accordionItem.guards.d.ts +15 -0
- package/components/accordion/index.d.ts +2 -0
- package/components/avatar/avatar.d.ts +26 -29
- package/components/avatar/avatar.guards.d.ts +15 -0
- package/components/avatar/avatarGroup.d.ts +29 -0
- package/components/avatar/index.d.ts +2 -0
- package/components/badge/badge.d.ts +1 -1
- package/components/base/{boxBase/boxBase.d.ts → boxBase.d.ts} +18 -11
- package/components/base/{buttonBase/buttonBase.d.ts → buttonBase.d.ts} +2 -3
- package/components/base/{checkboxBase/checkboxBase.d.ts → checkboxBase.d.ts} +2 -3
- package/components/base/dialogBase.d.ts +34 -0
- package/components/base/{fieldBase/fieldBase.d.ts → fieldBase.d.ts} +2 -3
- package/components/base/index.d.ts +6 -0
- package/components/base/textBase.d.ts +44 -0
- package/components/breadcrumbs/breadcrumbs.d.ts +48 -0
- package/components/button/button.d.ts +1 -1
- package/components/calendar/calendar.d.ts +23 -0
- package/components/calendar/calendarUtils.d.ts +18 -0
- package/components/checkbox/checkbox.d.ts +1 -1
- package/components/chip/chip.d.ts +1 -1
- package/components/collapse/collapse.d.ts +33 -0
- package/components/dialogs/bottomSheet.d.ts +23 -0
- package/components/dialogs/dialog.d.ts +21 -0
- package/components/{dialog → dialogs}/dialogActions.d.ts +1 -2
- package/components/{dialog → dialogs}/dialogTitle.d.ts +2 -3
- package/components/dialogs/drawer.d.ts +23 -0
- package/components/dialogs/index.d.ts +6 -0
- package/components/divider/divider.d.ts +1 -1
- package/components/divider/divider.guards.d.ts +1 -1
- package/components/fab/fab.d.ts +1 -1
- package/components/fields/dateField.d.ts +24 -0
- package/components/fields/dateTimeField.d.ts +24 -0
- package/components/fields/emailField.d.ts +24 -0
- package/components/fields/index.d.ts +11 -0
- package/components/fields/monthField.d.ts +24 -0
- package/components/fields/numberField.d.ts +24 -0
- package/components/fields/passwordField.d.ts +24 -0
- package/components/fields/phoneField.d.ts +24 -0
- package/components/fields/textField.d.ts +24 -0
- package/components/fields/timeField.d.ts +24 -0
- package/components/fields/urlField.d.ts +24 -0
- package/components/fields/weekField.d.ts +24 -0
- package/components/fieldset/fieldset.d.ts +2 -1
- package/components/iconButton/iconButton.d.ts +1 -1
- package/components/{article → layout}/article.d.ts +1 -1
- package/components/{aside → layout}/aside.d.ts +1 -1
- package/components/{content → layout}/content.d.ts +1 -1
- package/components/{div → layout}/div.d.ts +1 -1
- package/components/{flex → layout}/flex.d.ts +1 -1
- package/components/{footer → layout}/footer.d.ts +1 -1
- package/components/{grid → layout}/grid.d.ts +1 -1
- package/components/{header → layout}/header.d.ts +1 -1
- package/components/layout/index.d.ts +11 -0
- package/components/{main → layout}/main.d.ts +1 -1
- package/components/{nav → layout}/nav.d.ts +1 -1
- package/components/{section → layout}/section.d.ts +1 -1
- package/components/link/link.d.ts +58 -0
- package/components/list/list.d.ts +8 -0
- package/components/{listItem → list}/listItem.d.ts +2 -3
- package/components/{listItem → list}/listItem.guards.d.ts +1 -1
- package/components/menu/menu.d.ts +2 -4
- package/components/menu/menu.guards.d.ts +1 -1
- package/components/menuItem/menuItem.d.ts +2 -3
- package/components/menuItem/menuItem.guards.d.ts +1 -1
- package/components/option/option.d.ts +1 -1
- package/components/option/option.guards.d.ts +1 -1
- package/components/progress/progress.d.ts +27 -0
- package/components/radio/radio.d.ts +1 -1
- package/components/radiogroup/radioGroup.d.ts +1 -1
- package/components/rating/rating.d.ts +68 -0
- package/components/select/select.d.ts +1 -1
- package/components/slider/slider.d.ts +11 -0
- package/components/switch/switch.d.ts +1 -10
- package/components/tabs/index.d.ts +2 -0
- package/components/tabs/tab.d.ts +37 -0
- package/components/tabs/tab.guards.d.ts +15 -0
- package/components/tabs/tabs.d.ts +7 -0
- package/components/toast/index.d.ts +2 -0
- package/components/toast/toast.d.ts +52 -0
- package/components/toast/toastViewport.d.ts +7 -0
- package/components/toggleButton/toggleButton.d.ts +1 -1
- package/components/toolbar/toolbar.d.ts +51 -0
- package/components/tooltip/tooltip.d.ts +1 -1
- package/components/typography/h1.d.ts +18 -0
- package/components/typography/h2.d.ts +18 -0
- package/components/typography/h3.d.ts +18 -0
- package/components/typography/h4.d.ts +18 -0
- package/components/typography/h5.d.ts +18 -0
- package/components/typography/h6.d.ts +18 -0
- package/components/typography/index.d.ts +9 -0
- package/components/typography/label.d.ts +18 -0
- package/components/typography/p.d.ts +18 -0
- package/components/typography/span.d.ts +18 -0
- package/context/index.d.ts +4 -0
- package/context/selectionContext.d.ts +32 -0
- package/context/themeContext.d.ts +2 -2
- package/hooks/index.d.ts +10 -0
- package/hooks/useAnimate.d.ts +38 -18
- package/hooks/useFocusTrap.d.ts +32 -0
- package/hooks/useFocusVisible.d.ts +16 -14
- package/hooks/useResizeObserver.d.ts +30 -0
- package/hooks/useRovingFocus.d.ts +30 -0
- package/hooks/useSelection.d.ts +16 -0
- package/hooks/useSelectionState.d.ts +29 -0
- package/hooks/useSliderKeys.d.ts +41 -0
- package/index.css +1 -1
- package/index.d.ts +22 -36
- package/index.js +4881 -0
- package/internal/controlGrid/controlGrid.d.ts +32 -0
- package/internal/controlLabel/controlLabel.d.ts +31 -0
- package/internal/description/description.d.ts +18 -0
- package/internal/index.d.ts +6 -0
- package/internal/inlineTooltip/index.d.ts +1 -0
- package/internal/inlineTooltip/inlineTooltipManager.d.ts +2 -2
- package/internal/slots/slot.d.ts +44 -0
- package/internal/stateLayer/stateLayer.d.ts +33 -0
- package/package.json +12 -3
- package/utils/calculateFloatingPosition.d.ts +1 -1
- package/utils/color.d.ts +2 -194
- package/utils/controlStyle.d.ts +67 -0
- package/utils/generateMaterialColors.d.ts +1 -1
- package/utils/generateSchemes.d.ts +1 -1
- package/utils/getWrapperStyle.d.ts +53 -0
- package/utils/index.d.ts +10 -0
- package/utils/{inputhMethod.d.ts → interactionMode.d.ts} +1 -1
- package/utils/toasts/ensureViewport.d.ts +7 -0
- package/utils/toasts/index.d.ts +1 -0
- package/utils/toasts/toast.d.ts +85 -0
- package/utils/toasts/toastStore.d.ts +65 -0
- package/utils/uniqueID.d.ts +14 -0
- package/utils/utils.d.ts +81 -81
- package/components/base/dialogBase/dialog.d.ts +0 -35
- package/components/base/inlineBase/inlineBase.d.ts +0 -62
- package/components/dateInput/dateInput.d.ts +0 -2
- package/components/dateTimeInput/dateTimeInput.d.ts +0 -2
- package/components/emailInput/emailInput.d.ts +0 -2
- package/components/numberInput/numberInput.d.ts +0 -2
- package/components/telInput/telInput.d.ts +0 -2
- package/components/textField/textField.d.ts +0 -9
- package/components/timeInput/timeInput.d.ts +0 -2
- package/components/urlInput/urlInput.d.ts +0 -2
- package/hooks/useFocusState.d.ts +0 -16
- package/index.mjs +0 -3832
- package/internal/inlineTooltip/inlineTooltip.d.ts +0 -11
- package/internal/inlineTooltip/inlineTooltip2.d.ts +0 -10
- /package/components/{dialog → dialogs}/dialogContent.d.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Theme } from '../types
|
|
2
|
-
import { ThemeColor } from '../
|
|
1
|
+
import { Theme } from '../types';
|
|
2
|
+
import { ThemeColor } from '../utils';
|
|
3
3
|
/**
|
|
4
4
|
* Provides shape for the theme context shared across the application.
|
|
5
5
|
* Allows reading and updating theme configuration and resolving token values.
|
package/hooks/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './useAnimate';
|
|
2
|
+
export * from './useClickOutside';
|
|
3
|
+
export * from './useEscapeHandler';
|
|
4
|
+
export * from './useFocusVisible';
|
|
5
|
+
export * from './useResizeObserver';
|
|
6
|
+
export * from './useSelection';
|
|
7
|
+
export * from './useTheme';
|
|
8
|
+
export * from './useSliderKeys';
|
|
9
|
+
export * from './useSelectionState';
|
|
10
|
+
export * from './useFocusTrap';
|
package/hooks/useAnimate.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ export interface UseAnimateOptions {
|
|
|
10
10
|
t2?: number;
|
|
11
11
|
/** Enables one-shot animation behavior. */
|
|
12
12
|
oneShot?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
/** Initial phase on mount. */
|
|
14
|
+
initial?: 'idle' | 'open' | 'closed';
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Result returned by the useAnimate hook.
|
|
@@ -19,36 +19,56 @@ export interface UseAnimateOptions {
|
|
|
19
19
|
* @category Hooks
|
|
20
20
|
*/
|
|
21
21
|
export interface UseAnimateResult {
|
|
22
|
-
/** True
|
|
22
|
+
/** True during the opening phase. */
|
|
23
23
|
opening: boolean;
|
|
24
|
-
/** True
|
|
24
|
+
/** True during the closing phase. */
|
|
25
25
|
closing: boolean;
|
|
26
|
-
/** True
|
|
26
|
+
/** True when animation is running and not temporarily suppressed. */
|
|
27
27
|
animating: boolean;
|
|
28
|
-
/** True
|
|
28
|
+
/** True while animation is in progress (opening or closing). */
|
|
29
|
+
active: boolean;
|
|
30
|
+
/** True only before any animation has started. */
|
|
29
31
|
idle: boolean;
|
|
30
32
|
/** CSS variables controlling animation timing and direction. */
|
|
31
33
|
animationVars: Record<string, string>;
|
|
32
|
-
/** Triggers
|
|
34
|
+
/** Triggers animation towards open or closed state. */
|
|
33
35
|
animate(next?: 'open' | 'closed'): void;
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
|
-
*
|
|
38
|
+
* Handles open/close animation with interrupt support.
|
|
37
39
|
*
|
|
38
|
-
*
|
|
39
|
-
* -
|
|
40
|
-
* -
|
|
41
|
-
* -
|
|
40
|
+
* Flow:
|
|
41
|
+
* - animate('open') → sets phase to "opening" and starts a timer
|
|
42
|
+
* - after t1 → phase becomes "open" and timer is cleared
|
|
43
|
+
* - animate('closed') → sets phase to "closing" and starts a timer
|
|
44
|
+
* - after t2 → phase becomes "closed" and timer is cleared
|
|
42
45
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
46
|
+
* Interrupt:
|
|
47
|
+
* - calling animate() during an active transition clears the current timer
|
|
48
|
+
* - a new transition starts immediately
|
|
49
|
+
* - for one render animating = false (reset frame)
|
|
45
50
|
*
|
|
46
|
-
*
|
|
47
|
-
* -
|
|
48
|
-
* -
|
|
51
|
+
* State usage:
|
|
52
|
+
* - opening / closing → current transition phase
|
|
53
|
+
* - active → true while transition is in progress (used for mount/visibility)
|
|
54
|
+
* - animating → same as active, but disabled during reset frame (used for CSS classes)
|
|
55
|
+
* - idle → true only before the first animation
|
|
56
|
+
*
|
|
57
|
+
* Important:
|
|
58
|
+
* - use `active` to control visibility (mount/unmount)
|
|
59
|
+
* - use `animating` to apply or remove animation classes
|
|
60
|
+
*
|
|
61
|
+
* Timer:
|
|
62
|
+
* - created when transition starts
|
|
63
|
+
* - cleared on completion or interrupt
|
|
64
|
+
*
|
|
65
|
+
* Modes:
|
|
66
|
+
* - t1 defined → automatic timed transitions
|
|
67
|
+
* - t1 undefined → manual stepper (each call advances phase)
|
|
68
|
+
* - oneShot → only opening transition is executed
|
|
49
69
|
*
|
|
50
70
|
* @function
|
|
51
|
-
* @param options Hook configuration options
|
|
71
|
+
* @param options Hook configuration options
|
|
52
72
|
*
|
|
53
73
|
* @category Hooks
|
|
54
74
|
*/
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Options for the useFocusTrap hook.
|
|
4
|
+
*
|
|
5
|
+
* @category Hooks
|
|
6
|
+
*/
|
|
7
|
+
export interface UseFocusTrapOptions {
|
|
8
|
+
/** Root element used as focus boundary. */
|
|
9
|
+
ref: RefObject<HTMLElement | null>;
|
|
10
|
+
/** Enables or disables the focus trap. */
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
/** Moves focus inside on mount when not already inside. */
|
|
13
|
+
autoFocus?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Focus trap for modal containers.
|
|
17
|
+
*
|
|
18
|
+
* Keeps keyboard focus inside the given element.
|
|
19
|
+
* Handles Tab loop and restores focus on unmount.
|
|
20
|
+
* Also redirects focus back when returning from outside the document.
|
|
21
|
+
*
|
|
22
|
+
* Behavior:
|
|
23
|
+
* - traps Tab navigation within the root element
|
|
24
|
+
* - moves focus to element with data-autofocus or first focusable on mount
|
|
25
|
+
* - restores previous focus on cleanup
|
|
26
|
+
*
|
|
27
|
+
* @function
|
|
28
|
+
* @param options
|
|
29
|
+
*
|
|
30
|
+
* @category Hooks
|
|
31
|
+
*/
|
|
32
|
+
export declare const useFocusTrap: ({ ref, enabled, autoFocus }: UseFocusTrapOptions) => void;
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
+
import { FocusEventHandler } from 'react';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* Tracks focus state and determines whether focus indicators
|
|
4
|
+
* should be visibly rendered.
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
* for pointer-based interactions (mouse, touch, pen).
|
|
6
|
+
* Automatically merges external focus handlers.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @returns
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* const focusVisible = useFocusVisible();
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* <button className={focusVisible ? 'uui-focus-visible' : undefined} />
|
|
8
|
+
* @function useFocusVisible
|
|
9
|
+
* @param onFocus External onFocus handler
|
|
10
|
+
* @param onBlur External onBlur handler
|
|
11
|
+
* @returns Object containing focus flags and merged handlers
|
|
17
12
|
*
|
|
18
13
|
* @category Hooks
|
|
19
14
|
*/
|
|
20
|
-
export declare function useFocusVisible():
|
|
15
|
+
export declare function useFocusVisible(onFocus?: FocusEventHandler<HTMLElement>, onBlur?: FocusEventHandler<HTMLElement>): {
|
|
16
|
+
focusVisible: boolean;
|
|
17
|
+
isFocused: boolean;
|
|
18
|
+
focusHandlers: {
|
|
19
|
+
onFocus: FocusEventHandler<HTMLElement>;
|
|
20
|
+
onBlur: FocusEventHandler<HTMLElement>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Size information reported by ResizeObserver (CSS pixels).
|
|
4
|
+
*
|
|
5
|
+
* @category Hooks
|
|
6
|
+
*/
|
|
7
|
+
export interface ObservedElementSize {
|
|
8
|
+
/** Element width in pixels. */
|
|
9
|
+
width: number;
|
|
10
|
+
/** Element height in pixels. */
|
|
11
|
+
height: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Observes a single DOM element using ResizeObserver
|
|
15
|
+
* and invokes a callback when its size changes.
|
|
16
|
+
*
|
|
17
|
+
* Uses the content box by default, or the border box when `borderBox` is true
|
|
18
|
+
* (includes padding and border; excludes margin).
|
|
19
|
+
*
|
|
20
|
+
* Does not trigger component re-render.
|
|
21
|
+
*
|
|
22
|
+
* @function
|
|
23
|
+
* @param ref Reference to the observed HTMLElement.
|
|
24
|
+
* @param onResize Called when size changes.
|
|
25
|
+
* @param enabled Enables or disables observation. Default: true.
|
|
26
|
+
* @param borderBox When true, report border box size; when false, content box. Default: false.
|
|
27
|
+
*
|
|
28
|
+
* @category Hooks
|
|
29
|
+
*/
|
|
30
|
+
export declare function useResizeObserver<T extends HTMLElement>(ref: RefObject<T>, onResize: (size: ObservedElementSize) => void, enabled?: boolean, borderBox?: boolean): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Defines the directional axis used for roving focus navigation.
|
|
4
|
+
*
|
|
5
|
+
* @category Hooks
|
|
6
|
+
*/
|
|
7
|
+
export type RovingOrientation = 'vertical' | 'horizontal';
|
|
8
|
+
/**
|
|
9
|
+
* Provides roving focus keyboard navigation for a group of elements.
|
|
10
|
+
*
|
|
11
|
+
* Enables Arrow, Home, and End key navigation across registered items
|
|
12
|
+
* using vertical or horizontal orientation.
|
|
13
|
+
*
|
|
14
|
+
* @param orientation Navigation direction. Default: 'vertical'.
|
|
15
|
+
* @param loop Whether focus should wrap around. Default: true.
|
|
16
|
+
*
|
|
17
|
+
* @returns Object containing register, unregister, and onKeyDown handlers.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* const roving = useRovingFocus('vertical');
|
|
21
|
+
*
|
|
22
|
+
* <button ref={roving.register} onKeyDown={roving.onKeyDown} />
|
|
23
|
+
*
|
|
24
|
+
* @category Hooks
|
|
25
|
+
*/
|
|
26
|
+
export declare function useRovingFocus(orientation?: RovingOrientation, loop?: boolean): {
|
|
27
|
+
register: (el: HTMLElement | null) => void;
|
|
28
|
+
unregister: (el: HTMLElement | null) => void;
|
|
29
|
+
onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;
|
|
30
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SelectionContextValue } from '../context';
|
|
2
|
+
/**
|
|
3
|
+
* Provides typed access to SelectionContext including selection state,
|
|
4
|
+
* optional configuration, and roving focus controller.
|
|
5
|
+
*
|
|
6
|
+
* @typeParam T Optional configuration object type provided by the parent.
|
|
7
|
+
*
|
|
8
|
+
* @returns The current selection context value.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const { values, toggle, config, roving } =
|
|
12
|
+
* useSelection<MyConfig>();
|
|
13
|
+
*
|
|
14
|
+
* @category Hooks
|
|
15
|
+
*/
|
|
16
|
+
export declare function useSelection<T = unknown>(): SelectionContextValue<T>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook that provides shared selection state logic for components
|
|
3
|
+
* such as Accordion, Tabs or List.
|
|
4
|
+
*
|
|
5
|
+
* Manages selected values, exposes selection helpers and optionally
|
|
6
|
+
* enables roving focus for keyboard navigation.
|
|
7
|
+
*
|
|
8
|
+
* @function
|
|
9
|
+
*
|
|
10
|
+
* @param type Selection type controlling whether one or multiple values can be active.
|
|
11
|
+
* @param orientation Orientation used by roving focus navigation.
|
|
12
|
+
*
|
|
13
|
+
* @returns Object containing selection state, helper functions and roving focus controller.
|
|
14
|
+
*
|
|
15
|
+
* @category Hooks
|
|
16
|
+
*/
|
|
17
|
+
export declare function useSelectionState(type: 'single' | 'multiple', orientation?: 'vertical' | 'horizontal'): {
|
|
18
|
+
values: string[];
|
|
19
|
+
toggle: (value: string) => void;
|
|
20
|
+
set: (value: string) => void;
|
|
21
|
+
clear: () => void;
|
|
22
|
+
roving: {
|
|
23
|
+
register: (el: HTMLElement | null) => void;
|
|
24
|
+
unregister: (el: HTMLElement | null) => void;
|
|
25
|
+
onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;
|
|
26
|
+
};
|
|
27
|
+
type: "single" | "multiple";
|
|
28
|
+
orientation: "vertical" | "horizontal";
|
|
29
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for slider keyboard navigation.
|
|
4
|
+
*
|
|
5
|
+
* @category Hooks
|
|
6
|
+
*/
|
|
7
|
+
export interface UseSliderKeysOptions {
|
|
8
|
+
/** Current value. */
|
|
9
|
+
value: number;
|
|
10
|
+
/** Minimum value. */
|
|
11
|
+
min: number;
|
|
12
|
+
/** Maximum value. */
|
|
13
|
+
max: number;
|
|
14
|
+
/** Step applied by arrow keys. */
|
|
15
|
+
step: number;
|
|
16
|
+
/** Disables interaction. */
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/** Prevents value changes. */
|
|
19
|
+
readOnly?: boolean;
|
|
20
|
+
/** Called when value changes. */
|
|
21
|
+
onChange: (value: number) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Provides keyboard navigation for slider-like controls.
|
|
25
|
+
*
|
|
26
|
+
* Supports Arrow, Home and End keys to change the value.
|
|
27
|
+
*
|
|
28
|
+
* @param options Slider keyboard configuration.
|
|
29
|
+
*
|
|
30
|
+
* @returns Object containing onKeyDown handler.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* const keys = useSliderKeys({ value, min: 0, max: 5, step: 0.5, onChange });
|
|
34
|
+
*
|
|
35
|
+
* <div role="slider" onKeyDown={keys.onKeyDown} />
|
|
36
|
+
*
|
|
37
|
+
* @category Hooks
|
|
38
|
+
*/
|
|
39
|
+
export declare function useSliderKeys({ value, min, max, step, disabled, readOnly, onChange }: UseSliderKeysOptions): {
|
|
40
|
+
onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;
|
|
41
|
+
};
|