@nextlyhq/ui 0.0.2-alpha.54 → 0.0.2-alpha.57

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/dist/index.d.ts CHANGED
@@ -26,6 +26,7 @@ import { ToasterProps } from 'sonner';
26
26
  export { ToasterProps, toast } from 'sonner';
27
27
  import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
28
28
  import * as ResizablePrimitive from 'react-resizable-panels';
29
+ import * as SliderPrimitive from '@radix-ui/react-slider';
29
30
 
30
31
  /** @public */
31
32
  interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
@@ -2327,6 +2328,74 @@ interface TableSkeletonProps {
2327
2328
  /** @experimental */
2328
2329
  declare const TableSkeleton: react.FC<TableSkeletonProps>;
2329
2330
 
2331
+ /**
2332
+ * One preset a host offers.
2333
+ *
2334
+ * `color` is what the swatch is PAINTED with. `value` is what `onSwatchSelect`
2335
+ * hands back, unread by this component — a host storing design tokens puts its
2336
+ * own token reference there and receives it unchanged, so choosing a swatch
2337
+ * never resolves a token into the colour it currently happens to be. Without
2338
+ * that, re-theming stops moving the values that pointed at it.
2339
+ *
2340
+ * @experimental
2341
+ */
2342
+ interface ColorSwatch<TValue = string> {
2343
+ id: string;
2344
+ label: string;
2345
+ color: string;
2346
+ value?: TValue;
2347
+ }
2348
+ /**
2349
+ * Props for ColorPicker.
2350
+ * @experimental
2351
+ */
2352
+ interface ColorPickerProps<TValue = string> {
2353
+ /** The colour shown on the surface, as hex. */
2354
+ color: string;
2355
+ /** A colour was chosen by editing — surface, hue, alpha or the hex field. */
2356
+ onColorChange: (color: string) => void;
2357
+ /** Presets. Painted from `color`, returned by `value`. */
2358
+ swatches?: ColorSwatch<TValue>[];
2359
+ /**
2360
+ * A preset was chosen. Separate from `onColorChange` because only the host
2361
+ * can say what a swatch MEANS: the two are different events, and collapsing
2362
+ * them is what loses a token reference.
2363
+ */
2364
+ onSwatchSelect?: (swatch: ColorSwatch<TValue>) => void;
2365
+ /**
2366
+ * Recently used colours. Owned by the host, never by this component — the
2367
+ * admin scopes them per user, and a component writing `localStorage` at
2368
+ * render is unusable on a server and untestable without a DOM.
2369
+ */
2370
+ recentColors?: string[];
2371
+ /** Alpha channel. Off by default: most call sites want an opaque colour. */
2372
+ showAlpha?: boolean;
2373
+ className?: string;
2374
+ }
2375
+ /**
2376
+ * A colour control: a saturation square, a hue strip, optional alpha, a hex
2377
+ * field, and any presets the host supplies.
2378
+ *
2379
+ * Deliberately knows nothing about design tokens. A swatch carries an opaque
2380
+ * `value` this component never reads and hands back untouched, so a host can
2381
+ * store a token reference and keep it. That is what lets one component serve
2382
+ * both a plain colour field and a token-aware surface without either learning
2383
+ * about the other.
2384
+ *
2385
+ * @experimental
2386
+ *
2387
+ * @example
2388
+ * ```tsx
2389
+ * <ColorPicker
2390
+ * color={color}
2391
+ * onColorChange={setColor}
2392
+ * swatches={tokens.map(t => ({ id: t.name, label: t.name, color: t.value, value: { $token: t.name } }))}
2393
+ * onSwatchSelect={s => store(s.value)}
2394
+ * />
2395
+ * ```
2396
+ */
2397
+ declare function ColorPicker<TValue = string>({ color, onColorChange, swatches, onSwatchSelect, recentColors, showAlpha, className, }: ColorPickerProps<TValue>): react_jsx_runtime.JSX.Element;
2398
+
2330
2399
  /** @experimental */
2331
2400
  interface PaginationMeta {
2332
2401
  total: number;
@@ -2564,4 +2633,379 @@ interface TreeViewProps extends Omit<react.HTMLAttributes<HTMLDivElement>, "onSe
2564
2633
  */
2565
2634
  declare const TreeView: react.ForwardRefExoticComponent<TreeViewProps & react.RefAttributes<HTMLDivElement>>;
2566
2635
 
2567
- export { Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, type ActionCallbacks, Alert, AlertDescription, type AlertDescriptionProps, AlertDialog, AlertDialogAction, type AlertDialogActionProps, AlertDialogCancel, type AlertDialogCancelProps, AlertDialogContent, type AlertDialogContentProps, AlertDialogDescription, type AlertDialogDescriptionProps, AlertDialogFooter, type AlertDialogFooterProps, AlertDialogHeader, type AlertDialogHeaderProps, AlertDialogOverlay, type AlertDialogOverlayProps, AlertDialogPortal, AlertDialogTitle, type AlertDialogTitleProps, AlertDialogTrigger, type AlertProps, AlertTitle, type AlertTitleProps, Avatar, AvatarFallback, type AvatarFallbackProps, AvatarImage, type AvatarImageProps, type AvatarProps, Badge, type BadgeProps, Button, type ButtonProps, Card, CardAction, type CardActionProps, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, CardTitle, type CardTitleProps, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, type CommandDialogProps, CommandEmpty, type CommandEmptyProps, CommandGroup, type CommandGroupProps, CommandInput, type CommandInputProps, CommandItem, type CommandItemProps, CommandList, type CommandListProps, type CommandProps, CommandSeparator, type CommandSeparatorProps, CommandShortcut, type CommandShortcutProps, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, type DataFetcher, Dialog, DialogClose, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderProps, DialogOverlay, type DialogOverlayProps, DialogPortal, DialogTitle, type DialogTitleProps, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, type DropdownMenuCheckboxItemProps, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, type DropdownMenuRadioItemProps, DropdownMenuSeparator, type DropdownMenuSeparatorProps, DropdownMenuShortcut, type DropdownMenuShortcutProps, DropdownMenuSub, DropdownMenuSubContent, type DropdownMenuSubContentProps, DropdownMenuSubTrigger, type DropdownMenuSubTriggerProps, DropdownMenuTrigger, type FilterInfo, FormLabelWithTooltip, type FormLabelWithTooltipProps, Grid, type GridProps, Input, type InputProps, Label, type ListResponse, type PaginationConfig, type PaginationMeta, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PortalProvider, Progress, type ProgressProps, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, type SelectTriggerProps, SelectValue, Separator, Sheet, SheetClose, type SheetCloseProps, SheetContent, type SheetContentProps, type SheetContentRef, SheetDescription, type SheetDescriptionProps, type SheetDescriptionRef, SheetFooter, type SheetFooterProps, SheetHeader, type SheetHeaderProps, SheetOverlay, type SheetOverlayProps, type SheetOverlayRef, SheetPortal, type SheetProps, SheetTitle, type SheetTitleProps, type SheetTitleRef, SheetTrigger, type SheetTriggerProps, Skeleton, type SkeletonProps, type SortInfo, Spinner, type SpinnerProps, Stack, type StackProps, Stat, type StatProps, Switch, Table, TableBody, TableCaption, TableCell, TableEmpty, type TableEmptyProps, TableError, type TableErrorProps, TableFooter, TableHead, TableHeader, TableLoading, type TableParams, TableRow, TableSearch, type TableSearchProps, TableSkeleton, type TableSkeletonProps, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsListProps, type TabsProps, TabsTrigger, type TabsTriggerProps, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TreeNode, TreeView, type TreeViewProps, alertVariants, avatarVariants, badgeVariants, buttonVariants, cardVariants, dialogContentVariants, inputVariants, progressVariants, selectTriggerVariants, sheetVariants, spinnerVariants, usePortalContainer };
2636
+ /**
2637
+ * The assistive-technology attributes a single thumb can carry.
2638
+ *
2639
+ * @experimental
2640
+ */
2641
+ interface SliderThumbProps {
2642
+ /** The thumb's accessible name. */
2643
+ "aria-label"?: string;
2644
+ /** An element naming the thumb, when the name is already on screen. */
2645
+ "aria-labelledby"?: string;
2646
+ /**
2647
+ * What the value MEANS, when the number alone does not say it — "40
2648
+ * percent", "Medium". Announced in place of the raw number.
2649
+ */
2650
+ "aria-valuetext"?: string;
2651
+ /** An element carrying help text for this thumb. */
2652
+ "aria-describedby"?: string;
2653
+ }
2654
+ /**
2655
+ * The slider's props, mirroring the Radix root.
2656
+ *
2657
+ * @experimental
2658
+ */
2659
+ type SliderProps = Omit<react.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>, "asChild"> & {
2660
+ /**
2661
+ * Assistive-technology attributes per thumb, in value order.
2662
+ *
2663
+ * The reason this exists at all: the focusable element with the `slider`
2664
+ * role is the THUMB, and none of these attributes are inherited from the
2665
+ * root. Anything a caller puts on the root is therefore announced by
2666
+ * nothing, and the thumbs are generated internally so they cannot be
2667
+ * reached any other way.
2668
+ *
2669
+ * Deliberately a curated set rather than the thumb's full prop type. This
2670
+ * is the surface assistive technology reads; opening it to arbitrary props
2671
+ * would let a caller replace the class names or the role the control
2672
+ * depends on, and every escape hatch in a design system eventually gets
2673
+ * used that way.
2674
+ *
2675
+ * Required for a RANGE: two thumbs sharing one name are announced
2676
+ * identically, so nothing says which end is held. A single thumb falls back
2677
+ * to the root's `aria-label`/`aria-labelledby`, so the one-thumb API stays
2678
+ * as documented.
2679
+ */
2680
+ thumbs?: readonly SliderThumbProps[];
2681
+ };
2682
+ /**
2683
+ * A bounded numeric value chosen by dragging.
2684
+ *
2685
+ * @experimental
2686
+ */
2687
+ declare const Slider: react.ForwardRefExoticComponent<Omit<Omit<SliderPrimitive.SliderProps & react.RefAttributes<HTMLSpanElement>, "ref">, "asChild"> & {
2688
+ /**
2689
+ * Assistive-technology attributes per thumb, in value order.
2690
+ *
2691
+ * The reason this exists at all: the focusable element with the `slider`
2692
+ * role is the THUMB, and none of these attributes are inherited from the
2693
+ * root. Anything a caller puts on the root is therefore announced by
2694
+ * nothing, and the thumbs are generated internally so they cannot be
2695
+ * reached any other way.
2696
+ *
2697
+ * Deliberately a curated set rather than the thumb's full prop type. This
2698
+ * is the surface assistive technology reads; opening it to arbitrary props
2699
+ * would let a caller replace the class names or the role the control
2700
+ * depends on, and every escape hatch in a design system eventually gets
2701
+ * used that way.
2702
+ *
2703
+ * Required for a RANGE: two thumbs sharing one name are announced
2704
+ * identically, so nothing says which end is held. A single thumb falls back
2705
+ * to the root's `aria-label`/`aria-labelledby`, so the one-thumb API stays
2706
+ * as documented.
2707
+ */
2708
+ thumbs?: readonly SliderThumbProps[];
2709
+ } & react.RefAttributes<HTMLSpanElement>>;
2710
+
2711
+ /**
2712
+ * The single owner of keyboard shortcuts for an application.
2713
+ *
2714
+ * ## Why this exists
2715
+ *
2716
+ * Shortcuts are usually registered by whoever needs them, each component adding its own
2717
+ * `document` listener. That works until two of them want the same key, and then it fails in a way
2718
+ * that is very hard to see: `stopPropagation()` does NOT stop other listeners on the same node —
2719
+ * that requires `stopImmediatePropagation()`, and even then only for listeners registered later.
2720
+ * So every global handler runs, in mount order, and mount order is not something a developer
2721
+ * chose. Pressing Escape during a drag can cancel the drag AND navigate away from the page,
2722
+ * because two independent listeners each believed they owned the key.
2723
+ *
2724
+ * This module replaces that with one listener and an explicit precedence rule.
2725
+ *
2726
+ * ## The model: a stack of layers
2727
+ *
2728
+ * A **layer** is a set of bindings belonging to one interactive context — the application shell,
2729
+ * a dialog, an editor canvas mid-drag. Layers are ordered, the topmost is offered each keystroke
2730
+ * first, and the first binding that matches consumes it.
2731
+ *
2732
+ * Precedence is `(depth, sequence)`: the deeper layer wins, and between layers at equal depth the
2733
+ * more recently registered wins.
2734
+ *
2735
+ * Of those two, **depth is declared and sequence is incidental** — and only declared properties
2736
+ * survive a refactor. A layer that unmounts and remounts takes a fresh sequence number, so a
2737
+ * subtree rebuilt for unrelated reasons can change equal-depth ordering. The guidance that falls
2738
+ * out: if relative order matters to you, express it as depth, because depth is the part of the
2739
+ * tuple you control. Equal-depth ordering is for stacking things that arrive in genuine
2740
+ * mount order, such as one dialog over another. Depth comes from how the application nests, so precedence
2741
+ * follows the component tree rather than a set of coordinated numbers — the z-index problem,
2742
+ * avoided. Equal-depth ordering is what stacks a second dialog above the first.
2743
+ *
2744
+ * A layer may be **blocking**, meaning it also swallows the keys it does NOT bind. That is the
2745
+ * property a drag or a modal needs: while it is up, nothing beneath it can act. This is the same
2746
+ * shape as a window manager's keyboard grab, and as the dismissable-layer stack this kit's
2747
+ * dialogs already sit on.
2748
+ *
2749
+ * ## What it deliberately does not do
2750
+ *
2751
+ * It listens in the BUBBLE phase, so a focused component that handles its own keys and calls
2752
+ * `stopPropagation()` wins without needing to know this module exists. React attaches its
2753
+ * handlers at the app root, below `document`, so an `onKeyDown` prop is a sufficient opt-out.
2754
+ * Capturing instead would make this module outrank every component in the tree, including the
2755
+ * kit's own dialogs, and there would be no way for a component to decline.
2756
+ *
2757
+ * @module lib/shortcuts/manager
2758
+ */
2759
+ /**
2760
+ * One shortcut and what it does.
2761
+ *
2762
+ * @experimental
2763
+ */
2764
+ interface ShortcutBinding {
2765
+ /** The keys, as understood by `parseKeys` — `"mod+s"`, `"Escape"`, `"g d"`. */
2766
+ keys: string;
2767
+ /**
2768
+ * What this does, in words, for a shortcuts help panel. Required because an undiscoverable
2769
+ * shortcut helps only the person who wrote it.
2770
+ */
2771
+ description: string;
2772
+ /** Runs when the shortcut fires. */
2773
+ run: (event: KeyboardEvent) => void;
2774
+ /** Checked at press time; a binding whose condition is false is skipped and passes the key on. */
2775
+ when?: () => boolean;
2776
+ /**
2777
+ * Whether this fires while the user is typing in a field.
2778
+ *
2779
+ * Defaults to true for bindings whose FIRST chord carries a non-shift modifier or is Escape,
2780
+ * and false otherwise — the rule nearly every application converges on. `mod+s` must save
2781
+ * mid-sentence and Escape must dismiss, while a bare `n` must be able to be the letter n.
2782
+ *
2783
+ * The first chord decides because it is the keystroke that has to be taken from the field.
2784
+ * `mod+k c` is a command from its opening chord, so its bare `c` completes it in an input. A
2785
+ * sequence that OPENS on a plain character cannot fire while typing whatever it ends with:
2786
+ * allowing `g Escape` would mean swallowing the `g` of every word containing one.
2787
+ */
2788
+ whenTyping?: boolean;
2789
+ /** Whether to call `preventDefault()` when it fires. Defaults to true. */
2790
+ preventDefault?: boolean;
2791
+ }
2792
+ /**
2793
+ * How a layer behaves for keys it does not bind.
2794
+ *
2795
+ * @experimental
2796
+ */
2797
+ interface ShortcutLayerOptions {
2798
+ /** Identifies the layer in diagnostics and in a help panel. */
2799
+ name: string;
2800
+ /** Precedence: deeper layers are offered keystrokes first. */
2801
+ depth: number;
2802
+ /**
2803
+ * Whether unmatched keys stop here instead of reaching layers beneath.
2804
+ *
2805
+ * The reason a drag can be interrupted safely: everything below is inert for as long as this
2806
+ * is set, so no other context can act on a keystroke aimed at this one.
2807
+ */
2808
+ blocking?: boolean;
2809
+ /** Whether the layer participates at all. A disabled layer neither matches nor blocks. */
2810
+ enabled?: boolean;
2811
+ }
2812
+ /**
2813
+ * A layer's registration, held by whoever created it.
2814
+ *
2815
+ * @experimental
2816
+ */
2817
+ interface ShortcutRegistration {
2818
+ /** Replace this layer's bindings and options without changing its precedence. */
2819
+ update: (bindings: readonly ShortcutBinding[], options: ShortcutLayerOptions) => void;
2820
+ /** Remove the layer. */
2821
+ dispose: () => void;
2822
+ }
2823
+ /**
2824
+ * Options for creating a manager.
2825
+ *
2826
+ * @experimental
2827
+ */
2828
+ interface ShortcutManagerOptions {
2829
+ /** Whether `mod` means Command. Detected from the platform when omitted. */
2830
+ isApple?: boolean;
2831
+ /** How long a partially typed sequence waits for its next key, in milliseconds. */
2832
+ sequenceTimeoutMs?: number;
2833
+ /** Clock source, for tests that need to control sequence expiry. */
2834
+ now?: () => number;
2835
+ }
2836
+ /**
2837
+ * A shortcut manager: the registry, the matcher, and the one listener.
2838
+ *
2839
+ * @experimental
2840
+ */
2841
+ interface ShortcutManager {
2842
+ /** Add a layer. */
2843
+ register: (bindings: readonly ShortcutBinding[], options: ShortcutLayerOptions) => ShortcutRegistration;
2844
+ /**
2845
+ * Offer a keystroke to the stack. Returns whether it was consumed.
2846
+ *
2847
+ * Public so the behaviour can be tested without a DOM, and so a host that already owns its
2848
+ * event plumbing can drive the manager itself.
2849
+ */
2850
+ handle: (event: KeyboardEvent) => boolean;
2851
+ /** Install the single listener on a target, returning a function that removes it. */
2852
+ attach: (target: Pick<EventTarget, "addEventListener" | "removeEventListener">) => () => void;
2853
+ /**
2854
+ * Every active binding, most-precedent layer first, for a shortcuts help panel.
2855
+ *
2856
+ * The same array is returned until the layer stack changes, so it is safe to use as an external
2857
+ * store snapshot without re-rendering on every read.
2858
+ */
2859
+ activeBindings: () => readonly ActiveShortcut[];
2860
+ /**
2861
+ * Watch for changes to the layer stack.
2862
+ *
2863
+ * A help panel mounting alongside the components that register shortcuts would otherwise read
2864
+ * BEFORE their effects run and show nothing, with no later render to correct it.
2865
+ */
2866
+ subscribe: (onChange: () => void) => () => void;
2867
+ }
2868
+ /**
2869
+ * A binding as presented to a help panel, with the layer it came from.
2870
+ *
2871
+ * @experimental
2872
+ */
2873
+ interface ActiveShortcut {
2874
+ keys: string;
2875
+ description: string;
2876
+ layer: string;
2877
+ }
2878
+ /**
2879
+ * Create a shortcut manager.
2880
+ *
2881
+ * @experimental
2882
+ */
2883
+ declare function createShortcutManager(options?: ShortcutManagerOptions): ShortcutManager;
2884
+
2885
+ /**
2886
+ * Props for {@link ShortcutProvider}.
2887
+ *
2888
+ * @experimental
2889
+ */
2890
+ interface ShortcutProviderProps extends ShortcutManagerOptions {
2891
+ children?: react.ReactNode;
2892
+ /**
2893
+ * Where the listener is installed. Defaults to `document`.
2894
+ *
2895
+ * The bubble phase is deliberate: a component that handles its own keys and calls
2896
+ * `stopPropagation` wins without knowing this exists, because React attaches its handlers
2897
+ * below `document`.
2898
+ */
2899
+ target?: Pick<EventTarget, "addEventListener" | "removeEventListener"> | null;
2900
+ }
2901
+ /**
2902
+ * Installs the application's one keydown listener and roots the layer stack.
2903
+ *
2904
+ * @experimental
2905
+ */
2906
+ declare function ShortcutProvider({ children, target, ...managerOptions }: ShortcutProviderProps): react.JSX.Element;
2907
+ /**
2908
+ * Raises the precedence of everything inside it by one level.
2909
+ *
2910
+ * @experimental
2911
+ */
2912
+ declare function ShortcutScope({ children, }: {
2913
+ children?: react.ReactNode;
2914
+ }): react.JSX.Element;
2915
+ /**
2916
+ * Options for {@link useShortcuts}, minus the depth, which comes from the tree.
2917
+ *
2918
+ * @experimental
2919
+ */
2920
+ interface UseShortcutsOptions {
2921
+ /** Identifies this layer in a help panel. */
2922
+ name: string;
2923
+ /** Whether the layer participates. A disabled layer neither matches nor blocks. */
2924
+ enabled?: boolean;
2925
+ /**
2926
+ * Whether unmatched keys stop here rather than reaching layers beneath.
2927
+ *
2928
+ * Set this while a drag or a modal interaction owns the keyboard.
2929
+ */
2930
+ blocking?: boolean;
2931
+ }
2932
+ /**
2933
+ * Register shortcuts for as long as the calling component is mounted.
2934
+ *
2935
+ * The bindings array may be rebuilt on every render; it is re-read in place rather than
2936
+ * re-registered, so inline closures are fine and the layer keeps its position in the stack.
2937
+ *
2938
+ * @experimental
2939
+ */
2940
+ declare function useShortcuts(bindings: readonly ShortcutBinding[], options: UseShortcutsOptions): void;
2941
+ /**
2942
+ * The manager itself, for a help panel that lists what is currently bound.
2943
+ *
2944
+ * @experimental
2945
+ */
2946
+ declare function useShortcutManager(): ShortcutManager;
2947
+ /**
2948
+ * The shortcuts currently in effect, most precedent first.
2949
+ *
2950
+ * SUBSCRIBED rather than read once. A help panel mounting alongside the components that register
2951
+ * shortcuts reads before their effects have run, so a one-time read returns an empty list and no
2952
+ * later render corrects it — the panel simply shows nothing. The same applies whenever a layer is
2953
+ * enabled, disabled or replaced while the panel is open.
2954
+ *
2955
+ * The manager returns the same array until its stack changes, so this re-renders when the
2956
+ * shortcuts change and not on every read.
2957
+ *
2958
+ * @experimental
2959
+ */
2960
+ declare function useActiveShortcuts(): readonly ActiveShortcut[];
2961
+
2962
+ /**
2963
+ * Parsing and matching for keyboard shortcut specifications.
2964
+ *
2965
+ * A spec is written the way it is spoken: `"mod+s"`, `"Escape"`, `"shift+alt+f"`, and — for a
2966
+ * sequence — `"g d"`, meaning `g` then `d`. Steps are separated by spaces; within a step,
2967
+ * modifiers are joined to the key with `+`.
2968
+ *
2969
+ * The space bar is written `"Space"`, because the character the browser reports for it is `" "`
2970
+ * and a spec split on whitespace has no way to carry that.
2971
+ *
2972
+ * **`mod` is the point of this module.** It resolves to Command on Apple platforms and Control
2973
+ * everywhere else, so a binding is written once. Writing `ctrl` or `meta` explicitly is still
2974
+ * possible and then means exactly that, which is what lets a platform-specific binding coexist
2975
+ * with a portable one — a distinction lost by any implementation that treats the two as
2976
+ * interchangeable.
2977
+ *
2978
+ * @module lib/shortcuts/key-spec
2979
+ */
2980
+ /**
2981
+ * One keystroke: a key plus the modifier state required with it.
2982
+ *
2983
+ * @experimental
2984
+ */
2985
+ interface KeyChord {
2986
+ /** The `KeyboardEvent.key` value, normalized to lower case for single characters. */
2987
+ readonly key: string;
2988
+ /** Command on Apple platforms, Control elsewhere. */
2989
+ readonly mod: boolean;
2990
+ readonly ctrl: boolean;
2991
+ readonly meta: boolean;
2992
+ readonly alt: boolean;
2993
+ readonly shift: boolean;
2994
+ }
2995
+ /**
2996
+ * A shortcut: one chord, or several pressed in order.
2997
+ *
2998
+ * @experimental
2999
+ */
3000
+ type KeySequence = readonly KeyChord[];
3001
+ /**
3002
+ * Parse a spec into the sequence of chords it describes.
3003
+ *
3004
+ * @param spec - For example `"mod+s"`, `"Escape"`, or `"g d"`.
3005
+ * @throws If the spec is empty, or a step names modifiers but no key.
3006
+ *
3007
+ * @experimental
3008
+ */
3009
+ declare function parseKeys(spec: string): KeySequence;
3010
+
3011
+ export { Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, type ActionCallbacks, type ActiveShortcut, Alert, AlertDescription, type AlertDescriptionProps, AlertDialog, AlertDialogAction, type AlertDialogActionProps, AlertDialogCancel, type AlertDialogCancelProps, AlertDialogContent, type AlertDialogContentProps, AlertDialogDescription, type AlertDialogDescriptionProps, AlertDialogFooter, type AlertDialogFooterProps, AlertDialogHeader, type AlertDialogHeaderProps, AlertDialogOverlay, type AlertDialogOverlayProps, AlertDialogPortal, AlertDialogTitle, type AlertDialogTitleProps, AlertDialogTrigger, type AlertProps, AlertTitle, type AlertTitleProps, Avatar, AvatarFallback, type AvatarFallbackProps, AvatarImage, type AvatarImageProps, type AvatarProps, Badge, type BadgeProps, Button, type ButtonProps, Card, CardAction, type CardActionProps, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, CardTitle, type CardTitleProps, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, ColorPicker, type ColorPickerProps, type ColorSwatch, Command, CommandDialog, type CommandDialogProps, CommandEmpty, type CommandEmptyProps, CommandGroup, type CommandGroupProps, CommandInput, type CommandInputProps, CommandItem, type CommandItemProps, CommandList, type CommandListProps, type CommandProps, CommandSeparator, type CommandSeparatorProps, CommandShortcut, type CommandShortcutProps, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, type DataFetcher, Dialog, DialogClose, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderProps, DialogOverlay, type DialogOverlayProps, DialogPortal, DialogTitle, type DialogTitleProps, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, type DropdownMenuCheckboxItemProps, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, type DropdownMenuRadioItemProps, DropdownMenuSeparator, type DropdownMenuSeparatorProps, DropdownMenuShortcut, type DropdownMenuShortcutProps, DropdownMenuSub, DropdownMenuSubContent, type DropdownMenuSubContentProps, DropdownMenuSubTrigger, type DropdownMenuSubTriggerProps, DropdownMenuTrigger, type FilterInfo, FormLabelWithTooltip, type FormLabelWithTooltipProps, Grid, type GridProps, Input, type InputProps, type KeyChord, type KeySequence, Label, type ListResponse, type PaginationConfig, type PaginationMeta, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PortalProvider, Progress, type ProgressProps, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, type SelectTriggerProps, SelectValue, Separator, Sheet, SheetClose, type SheetCloseProps, SheetContent, type SheetContentProps, type SheetContentRef, SheetDescription, type SheetDescriptionProps, type SheetDescriptionRef, SheetFooter, type SheetFooterProps, SheetHeader, type SheetHeaderProps, SheetOverlay, type SheetOverlayProps, type SheetOverlayRef, SheetPortal, type SheetProps, SheetTitle, type SheetTitleProps, type SheetTitleRef, SheetTrigger, type SheetTriggerProps, type ShortcutBinding, type ShortcutLayerOptions, type ShortcutManager, type ShortcutManagerOptions, ShortcutProvider, type ShortcutProviderProps, type ShortcutRegistration, ShortcutScope, Skeleton, type SkeletonProps, Slider, type SliderProps, type SliderThumbProps, type SortInfo, Spinner, type SpinnerProps, Stack, type StackProps, Stat, type StatProps, Switch, Table, TableBody, TableCaption, TableCell, TableEmpty, type TableEmptyProps, TableError, type TableErrorProps, TableFooter, TableHead, TableHeader, TableLoading, type TableParams, TableRow, TableSearch, type TableSearchProps, TableSkeleton, type TableSkeletonProps, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsListProps, type TabsProps, TabsTrigger, type TabsTriggerProps, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TreeNode, TreeView, type TreeViewProps, type UseShortcutsOptions, alertVariants, avatarVariants, badgeVariants, buttonVariants, cardVariants, createShortcutManager, dialogContentVariants, inputVariants, parseKeys, progressVariants, selectTriggerVariants, sheetVariants, spinnerVariants, useActiveShortcuts, usePortalContainer, useShortcutManager, useShortcuts };