hazo_ui 6.0.0 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGE_LOG.md +71 -0
- package/README.md +24 -1
- package/dist/announce-DAnQDTld.d.cts +92 -0
- package/dist/announce-DAnQDTld.d.ts +92 -0
- package/dist/index.cjs +274 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +160 -3
- package/dist/index.d.ts +160 -3
- package/dist/index.js +266 -2
- package/dist/index.js.map +1 -1
- package/dist/index.utils.cjs +72 -0
- package/dist/index.utils.cjs.map +1 -1
- package/dist/index.utils.d.cts +31 -1
- package/dist/index.utils.d.ts +31 -1
- package/dist/index.utils.js +64 -1
- package/dist/index.utils.js.map +1 -1
- package/package.json +3 -3
- package/dist/index.utils-DZVbQXFR.d.cts +0 -20
- package/dist/index.utils-DZVbQXFR.d.ts +0 -20
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { c as cn, s as safeHref } from './
|
|
1
|
+
export { A as AnnounceOptions, a as AnnouncePriority, D as DEFAULT_ANNOUNCE_EVENT, L as LiveAnnouncement, b as announce, c as cn, h as hasUrlParam, r as readRememberedState, s as safeHref, w as writeRememberedState } from './announce-DAnQDTld.cjs';
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
|
-
import { ReactNode, RefObject } from 'react';
|
|
3
|
+
import { ReactNode, RefObject, PointerEvent, MouseEvent } from 'react';
|
|
4
4
|
import { ICommand } from '@uiw/react-md-editor';
|
|
5
5
|
export { ICommand as MarkdownEditorCommand } from '@uiw/react-md-editor';
|
|
6
6
|
import { Node, Extension } from '@tiptap/core';
|
|
@@ -1618,6 +1618,25 @@ interface ToastOptions {
|
|
|
1618
1618
|
}
|
|
1619
1619
|
declare function successToast({ title, description, duration, action }: ToastOptions): string | number;
|
|
1620
1620
|
declare function errorToast({ title, description, duration, action }: ToastOptions): string | number;
|
|
1621
|
+
interface PermissionToastOptions {
|
|
1622
|
+
/** The permission keys that were missing, e.g. ["env.migrate"]. */
|
|
1623
|
+
missingPermissions: string[];
|
|
1624
|
+
/** Optional human descriptions keyed by permission key, e.g. { "env.migrate": "Migrate environments" }. */
|
|
1625
|
+
descriptions?: Record<string, string>;
|
|
1626
|
+
/** Optional action button (e.g. "Request access"). */
|
|
1627
|
+
action?: {
|
|
1628
|
+
label: string;
|
|
1629
|
+
onClick: () => void;
|
|
1630
|
+
};
|
|
1631
|
+
/** Auto-dismiss duration in ms. Default 5000 (matches errorToast). */
|
|
1632
|
+
duration?: number;
|
|
1633
|
+
}
|
|
1634
|
+
/**
|
|
1635
|
+
* Standardized permission-failure toast. Renders a fixed "Permission required"
|
|
1636
|
+
* title and composes a description listing the missing permission key(s),
|
|
1637
|
+
* with an optional human description per key. Delegates to `errorToast`.
|
|
1638
|
+
*/
|
|
1639
|
+
declare function permissionToast({ missingPermissions, descriptions, action, duration, }: PermissionToastOptions): string | number;
|
|
1621
1640
|
|
|
1622
1641
|
interface UseLoadingStateResult {
|
|
1623
1642
|
/** Current loading flag. */
|
|
@@ -2699,4 +2718,142 @@ interface AppFooterProps {
|
|
|
2699
2718
|
}
|
|
2700
2719
|
declare function AppFooter({ variant, footer, identity, className }: AppFooterProps): React$1.JSX.Element;
|
|
2701
2720
|
|
|
2702
|
-
|
|
2721
|
+
interface UseRememberedStateOptions<T> {
|
|
2722
|
+
/** Full localStorage key. Callers own their own namespacing/prefix. */
|
|
2723
|
+
key: string;
|
|
2724
|
+
/** Current serialisable state to remember. */
|
|
2725
|
+
snapshot: T;
|
|
2726
|
+
/** Feed a remembered snapshot back into the caller. Called at most once, on mount. */
|
|
2727
|
+
restore: (snapshot: T) => void;
|
|
2728
|
+
/** Default `true`; when `false` the hook is entirely inert (no read, no write). */
|
|
2729
|
+
enabled?: boolean;
|
|
2730
|
+
/** Debounce delay (ms) before a changed snapshot is written. Default `600`. */
|
|
2731
|
+
debounceMs?: number;
|
|
2732
|
+
/**
|
|
2733
|
+
* When set, restore-on-mount is skipped if this URL query param is present
|
|
2734
|
+
* in `window.location.search` — an explicit shared-link or saved-record
|
|
2735
|
+
* load should always win over remembered state. Omit to never skip.
|
|
2736
|
+
*/
|
|
2737
|
+
skipWhenUrlParam?: string;
|
|
2738
|
+
}
|
|
2739
|
+
/**
|
|
2740
|
+
* Remembers a snapshot of state in localStorage and restores it on mount.
|
|
2741
|
+
*
|
|
2742
|
+
* - Restore is attempted **once** per mount (a ref-based guard, independent
|
|
2743
|
+
* of prop/dependency changes — `restore`'s identity may change every
|
|
2744
|
+
* render without retriggering it).
|
|
2745
|
+
* - If `skipWhenUrlParam` is set and that query param is present in the
|
|
2746
|
+
* current URL, the restore-on-mount step is skipped entirely (an explicit
|
|
2747
|
+
* link/record load wins over remembered state).
|
|
2748
|
+
* - Writes are debounced by `debounceMs` and keyed off the snapshot's
|
|
2749
|
+
* serialised JSON (not object identity), so a structurally-equal-but-new
|
|
2750
|
+
* snapshot object doesn't reschedule a write.
|
|
2751
|
+
*
|
|
2752
|
+
* @example
|
|
2753
|
+
* useRememberedState({
|
|
2754
|
+
* key: `myapp:tool:${slug}`,
|
|
2755
|
+
* snapshot: currentSeed,
|
|
2756
|
+
* restore: (seed) => applySeed(seed),
|
|
2757
|
+
* skipWhenUrlParam: "restore",
|
|
2758
|
+
* });
|
|
2759
|
+
*/
|
|
2760
|
+
declare function useRememberedState<T>({ key, snapshot, restore, enabled, debounceMs, skipWhenUrlParam, }: UseRememberedStateOptions<T>): void;
|
|
2761
|
+
|
|
2762
|
+
interface UseLongPressOptions {
|
|
2763
|
+
onLongPress: (e: PointerEvent) => void;
|
|
2764
|
+
/** ms to hold before firing. Default 500. */
|
|
2765
|
+
delayMs?: number;
|
|
2766
|
+
/** Pixels of movement that cancel the press. Default 8. */
|
|
2767
|
+
moveThresholdPx?: number;
|
|
2768
|
+
/** Vibration ms on fire. Default 10. Set 0 to disable. */
|
|
2769
|
+
hapticMs?: number;
|
|
2770
|
+
}
|
|
2771
|
+
interface UseLongPressResult {
|
|
2772
|
+
onPointerDown: (e: PointerEvent) => void;
|
|
2773
|
+
onPointerMove: (e: PointerEvent) => void;
|
|
2774
|
+
onPointerUp: (e: PointerEvent) => void;
|
|
2775
|
+
onPointerCancel: (e: PointerEvent) => void;
|
|
2776
|
+
/** Spread onto the same element to suppress the trailing click that
|
|
2777
|
+
* fires after the long-press triggers. Without this, the touch that
|
|
2778
|
+
* ends the press also opens the hover card or detail panel — double
|
|
2779
|
+
* action. */
|
|
2780
|
+
onClick: (e: MouseEvent) => void;
|
|
2781
|
+
}
|
|
2782
|
+
/**
|
|
2783
|
+
* Touch-only long-press hook. On fine-pointer devices (mouse), every
|
|
2784
|
+
* returned handler is a no-op — desktop relies on `onContextMenu` for
|
|
2785
|
+
* right-click instead. The returned event handlers should be spread onto
|
|
2786
|
+
* the target element via `<div {...longPress}>`.
|
|
2787
|
+
*
|
|
2788
|
+
* @param options.onLongPress - Fired once the press has been held for `delayMs`.
|
|
2789
|
+
* @param options.delayMs - ms to hold before firing. Default `500`.
|
|
2790
|
+
* @param options.moveThresholdPx - Pixels of movement that cancel the press. Default `8`.
|
|
2791
|
+
* @param options.hapticMs - Vibration ms on fire (`navigator.vibrate`). Default `10`; `0` disables.
|
|
2792
|
+
*
|
|
2793
|
+
* @example
|
|
2794
|
+
* const longPress = useLongPress({ onLongPress: (e) => openContextMenu(e) });
|
|
2795
|
+
* <div {...longPress}>Hold me</div>
|
|
2796
|
+
*/
|
|
2797
|
+
declare function useLongPress({ onLongPress, delayMs, moveThresholdPx, hapticMs, }: UseLongPressOptions): UseLongPressResult;
|
|
2798
|
+
|
|
2799
|
+
interface LiveRegionProps {
|
|
2800
|
+
/** Custom-event name to listen on. Must match the `eventName` passed to `announce()`. Default `DEFAULT_ANNOUNCE_EVENT`. */
|
|
2801
|
+
eventName?: string;
|
|
2802
|
+
/** className applied to both region `<div>`s. Default `"sr-only"` (Tailwind's screen-reader-only utility). */
|
|
2803
|
+
className?: string;
|
|
2804
|
+
/** Milliseconds a message stays in the DOM before self-clearing. Default `6000`. */
|
|
2805
|
+
clearAfterMs?: number;
|
|
2806
|
+
}
|
|
2807
|
+
/**
|
|
2808
|
+
* Mount once per `eventName` channel (typically once, at the app root).
|
|
2809
|
+
* Renders two visually-hidden `aria-live` regions (`polite` / `assertive`)
|
|
2810
|
+
* that receive text pushed by `announce()` calls dispatched on the same
|
|
2811
|
+
* `eventName`.
|
|
2812
|
+
*
|
|
2813
|
+
* @example
|
|
2814
|
+
* // root layout
|
|
2815
|
+
* <LiveRegion />
|
|
2816
|
+
* // elsewhere in the client tree
|
|
2817
|
+
* announce("Saved");
|
|
2818
|
+
*
|
|
2819
|
+
* @example
|
|
2820
|
+
* // namespaced channel — LiveRegion and announce() must agree on eventName
|
|
2821
|
+
* <LiveRegion eventName="myapp:announce" />
|
|
2822
|
+
* announce("Saved", "polite", { eventName: "myapp:announce" });
|
|
2823
|
+
*/
|
|
2824
|
+
declare function LiveRegion({ eventName, className, clearAfterMs, }: LiveRegionProps): React$1.JSX.Element;
|
|
2825
|
+
|
|
2826
|
+
interface UseScrollRestoreOptions {
|
|
2827
|
+
/** localStorage key prefix. Callers own their own namespacing. Default `DEFAULT_SCROLL_RESTORE_PREFIX` ("hazo_ui:scrollPos"). */
|
|
2828
|
+
prefix?: string;
|
|
2829
|
+
}
|
|
2830
|
+
interface UseScrollRestoreResult {
|
|
2831
|
+
/** Persist a scroll position (rounded to the nearest pixel). */
|
|
2832
|
+
save: (scrollY: number) => void;
|
|
2833
|
+
/** Read back the persisted scroll position, or `null` if none / unreadable. */
|
|
2834
|
+
load: () => number | null;
|
|
2835
|
+
}
|
|
2836
|
+
/**
|
|
2837
|
+
* localStorage-backed scroll-position save/load, keyed by
|
|
2838
|
+
* `${prefix}.${treeId}.${viewName}`. SSR-safe (no-ops when `window` is
|
|
2839
|
+
* undefined) and quota-safe (write failures are swallowed).
|
|
2840
|
+
*
|
|
2841
|
+
* @param treeId - Identifies the scrollable subject (e.g. a document/tree id).
|
|
2842
|
+
* @param viewName - Identifies which view/pane within that subject.
|
|
2843
|
+
* @param options.prefix - Storage-key prefix. Default `"hazo_ui:scrollPos"`.
|
|
2844
|
+
*
|
|
2845
|
+
* @example
|
|
2846
|
+
* const { save, load } = useScrollRestore(treeId, "canvas");
|
|
2847
|
+
* useEffect(() => {
|
|
2848
|
+
* const y = load();
|
|
2849
|
+
* if (y !== null) containerRef.current?.scrollTo(0, y);
|
|
2850
|
+
* }, []);
|
|
2851
|
+
* const onScroll = (e: React.UIEvent<HTMLDivElement>) => save(e.currentTarget.scrollTop);
|
|
2852
|
+
*
|
|
2853
|
+
* @example
|
|
2854
|
+
* // namespaced prefix — avoids collisions with other apps sharing a domain
|
|
2855
|
+
* useScrollRestore(treeId, "canvas", { prefix: "myapp:scrollPos" });
|
|
2856
|
+
*/
|
|
2857
|
+
declare function useScrollRestore(treeId: string, viewName: string, options?: UseScrollRestoreOptions): UseScrollRestoreResult;
|
|
2858
|
+
|
|
2859
|
+
export { ANIMATION_PRESETS, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AnimationPreset, AppFooter, type AppFooterProps, AppHeader, type AppHeaderProps, type BaseCommandInputProps, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CELEBRATION_GRADIENT, Calendar, CanvasTextToolbar, type CanvasTextToolbarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CelebrationPayload, CelebrationProvider, type CelebrationProviderProps, type CelebrationShareableCard, type ChartDataPoint, type ChartDataSeries, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, type CommandEditContext, type CommandItem$1 as CommandItem, CommandNodeExtension, CommandPill, type CommandPillProps, CommandPopover, type CommandPopoverProps, type CommandTextOutput, type ConfirmDialogVariant, type DateRangeOption, DateRangeSelector, type DateRangeSelectorProps, type DialogVariant, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, type EmptyStateProps, ErrorBanner, type ErrorBannerProps, type ErrorBannerSeverity, ErrorPage, type ErrorPageProps, type EtaProgressHandle, type FilterConfig, type FilterField, FunnelChart, type FunnelChartProps, type FunnelStep, HazoContextProvider, type HazoContextProviderProps, type HazoUiConfig, HazoUiConfirmDialog, type HazoUiConfirmDialogProps, HazoUiDialog, DialogClose as HazoUiDialogClose, DialogContent as HazoUiDialogContent, DialogDescription as HazoUiDialogDescription, DialogFooter as HazoUiDialogFooter, DialogHeader as HazoUiDialogHeader, type HazoUiDialogKind, DialogOverlay as HazoUiDialogOverlay, DialogPortal as HazoUiDialogPortal, type HazoUiDialogProps, Dialog as HazoUiDialogRoot, DialogTitle as HazoUiDialogTitle, DialogTrigger as HazoUiDialogTrigger, HazoUiEtaProgress, type HazoUiEtaProgressProps, HazoUiFlexInput, type HazoUiFlexInputProps, HazoUiFlexRadio, type HazoUiFlexRadioItem, type HazoUiFlexRadioProps, HazoUiIcon, HazoUiIconPicker, type HazoUiIconPickerProps, type HazoUiIconProps, HazoUiImageCropper, HazoUiImageCropperDialog, type HazoUiImageCropperDialogProps, type HazoUiImageCropperHandle, type HazoUiImageCropperProps, HazoUiKanban, HazoUiKanbanFilter, type HazoUiKanbanFilterProps, type HazoUiKanbanProps, HazoUiMemoryDropdown, type HazoUiMemoryDropdownProps, HazoUiMultiFilterDialog, HazoUiMultiSortDialog, HazoUiPillRadio, type HazoUiPillRadioItem, type HazoUiPillRadioProps, HazoUiProgressBar, type HazoUiProgressBarProps, HazoUiRte, type HazoUiRteProps, HazoUiTable, type HazoUiTablePagination, type HazoUiTableProps, type HazoUiTableServerLoadArgs, type HazoUiTableServerLoadResult, HazoUiTextarea, type HazoUiTextareaProps, HazoUiTextbox, type HazoUiTextboxProps, HazoUiToaster, type HazoUiToasterProps, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputAffix, type InputAffixProps, type InsertedCommand, InverseSparkline, type InverseSparklineProps, type KanbanAnnouncements, type KanbanColumn, type KanbanEditorCtx, type KanbanEditorField, type KanbanEditorFieldType, type KanbanFilterValue, type KanbanItem, type KanbanMoveEvent, type KanbanMoveHandle, type KanbanPriority, type KanbanReorderEvent, type KanbanSaveEvent, Label, LiveRegion, type LiveRegionProps, LoadingTimeout, type LoadingTimeoutProps, type Logger, Logo, type LogoProps, MarkdownEditor, type MarkdownEditorProps, type MarkdownEmbed, type MemoryEntry, NotificationCountBadge, type NotificationCountBadgeProps, NotificationItem, type NotificationItemProps, NotificationPanel, type NotificationPanelProps, type PermissionToastOptions, Popover, PopoverContent, PopoverTrigger, type PrefixColor, type PrefixConfig, ProgressiveImage, type ProgressiveImageProps, RadioGroup, RadioGroupItem, type RteAttachment, type RteOutput, type RteVariable, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Command as ShadcnCommand, CommandEmpty as ShadcnCommandEmpty, CommandGroup as ShadcnCommandGroup, CommandInput as ShadcnCommandInput, CommandItem as ShadcnCommandItem, CommandList as ShadcnCommandList, Skeleton, SkeletonBar, type SkeletonBarProps, SkeletonCircle, type SkeletonCircleProps, SkeletonGroup, type SkeletonGroupProps, SkeletonRect, type SkeletonRectProps, Slider, type SortConfig, type SortField, Sparkline, type SparklineProps, Spinner, type StackedBar, StackedBars, type StackedBarsProps, type SuggestionState, Switch, Table, TableBody, TableCaption, TableCell, type TableColumn, type TableFilter, TableFooter, type TableFormatter, TableHead, TableHeader, TableRow, type TableSort, type TableSortEntry, type TableSortProp, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type ToastOptions, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseCopyToClipboardResult, type UseErrorDisplayResult, type UseEtaProgressOptions, type UseFullscreenRefResult, type UseFullscreenResult, type UseLoadingStateResult, type UseLongPressOptions, type UseLongPressResult, type UseRememberedStateOptions, type UseScrollRestoreOptions, type UseScrollRestoreResult, type UseWakeLockResult, applyKanbanFilter, buttonGroupVariants, celebrate, computeEta, create_command_suggestion_extension, easeToward, errorToast, format_num, generateUUID, get_hazo_ui_config, get_logger, isLucideValue, median, parse_commands_from_text, permissionToast, pick_x_label_indices, reset_hazo_ui_config, resolve_animation_classes, set_hazo_ui_config, set_logger, successToast, text_to_tiptap_content, toggleVariants, upsertEntry as upsertMemoryEntry, useClickOutside, useCopyToClipboard, useDebounce, useErrorDisplay, useEtaProgress, useFullscreen, useIsMobile, useLoadingState, useLocalStorage, useLongPress, useMediaQuery, useRememberedState, useScrollRestore, useSessionStorage, useViewport, useWakeLock, use_fullscreen, use_wake_lock };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { c as cn, s as safeHref } from './
|
|
1
|
+
export { A as AnnounceOptions, a as AnnouncePriority, D as DEFAULT_ANNOUNCE_EVENT, L as LiveAnnouncement, b as announce, c as cn, h as hasUrlParam, r as readRememberedState, s as safeHref, w as writeRememberedState } from './announce-DAnQDTld.js';
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
|
-
import { ReactNode, RefObject } from 'react';
|
|
3
|
+
import { ReactNode, RefObject, PointerEvent, MouseEvent } from 'react';
|
|
4
4
|
import { ICommand } from '@uiw/react-md-editor';
|
|
5
5
|
export { ICommand as MarkdownEditorCommand } from '@uiw/react-md-editor';
|
|
6
6
|
import { Node, Extension } from '@tiptap/core';
|
|
@@ -1618,6 +1618,25 @@ interface ToastOptions {
|
|
|
1618
1618
|
}
|
|
1619
1619
|
declare function successToast({ title, description, duration, action }: ToastOptions): string | number;
|
|
1620
1620
|
declare function errorToast({ title, description, duration, action }: ToastOptions): string | number;
|
|
1621
|
+
interface PermissionToastOptions {
|
|
1622
|
+
/** The permission keys that were missing, e.g. ["env.migrate"]. */
|
|
1623
|
+
missingPermissions: string[];
|
|
1624
|
+
/** Optional human descriptions keyed by permission key, e.g. { "env.migrate": "Migrate environments" }. */
|
|
1625
|
+
descriptions?: Record<string, string>;
|
|
1626
|
+
/** Optional action button (e.g. "Request access"). */
|
|
1627
|
+
action?: {
|
|
1628
|
+
label: string;
|
|
1629
|
+
onClick: () => void;
|
|
1630
|
+
};
|
|
1631
|
+
/** Auto-dismiss duration in ms. Default 5000 (matches errorToast). */
|
|
1632
|
+
duration?: number;
|
|
1633
|
+
}
|
|
1634
|
+
/**
|
|
1635
|
+
* Standardized permission-failure toast. Renders a fixed "Permission required"
|
|
1636
|
+
* title and composes a description listing the missing permission key(s),
|
|
1637
|
+
* with an optional human description per key. Delegates to `errorToast`.
|
|
1638
|
+
*/
|
|
1639
|
+
declare function permissionToast({ missingPermissions, descriptions, action, duration, }: PermissionToastOptions): string | number;
|
|
1621
1640
|
|
|
1622
1641
|
interface UseLoadingStateResult {
|
|
1623
1642
|
/** Current loading flag. */
|
|
@@ -2699,4 +2718,142 @@ interface AppFooterProps {
|
|
|
2699
2718
|
}
|
|
2700
2719
|
declare function AppFooter({ variant, footer, identity, className }: AppFooterProps): React$1.JSX.Element;
|
|
2701
2720
|
|
|
2702
|
-
|
|
2721
|
+
interface UseRememberedStateOptions<T> {
|
|
2722
|
+
/** Full localStorage key. Callers own their own namespacing/prefix. */
|
|
2723
|
+
key: string;
|
|
2724
|
+
/** Current serialisable state to remember. */
|
|
2725
|
+
snapshot: T;
|
|
2726
|
+
/** Feed a remembered snapshot back into the caller. Called at most once, on mount. */
|
|
2727
|
+
restore: (snapshot: T) => void;
|
|
2728
|
+
/** Default `true`; when `false` the hook is entirely inert (no read, no write). */
|
|
2729
|
+
enabled?: boolean;
|
|
2730
|
+
/** Debounce delay (ms) before a changed snapshot is written. Default `600`. */
|
|
2731
|
+
debounceMs?: number;
|
|
2732
|
+
/**
|
|
2733
|
+
* When set, restore-on-mount is skipped if this URL query param is present
|
|
2734
|
+
* in `window.location.search` — an explicit shared-link or saved-record
|
|
2735
|
+
* load should always win over remembered state. Omit to never skip.
|
|
2736
|
+
*/
|
|
2737
|
+
skipWhenUrlParam?: string;
|
|
2738
|
+
}
|
|
2739
|
+
/**
|
|
2740
|
+
* Remembers a snapshot of state in localStorage and restores it on mount.
|
|
2741
|
+
*
|
|
2742
|
+
* - Restore is attempted **once** per mount (a ref-based guard, independent
|
|
2743
|
+
* of prop/dependency changes — `restore`'s identity may change every
|
|
2744
|
+
* render without retriggering it).
|
|
2745
|
+
* - If `skipWhenUrlParam` is set and that query param is present in the
|
|
2746
|
+
* current URL, the restore-on-mount step is skipped entirely (an explicit
|
|
2747
|
+
* link/record load wins over remembered state).
|
|
2748
|
+
* - Writes are debounced by `debounceMs` and keyed off the snapshot's
|
|
2749
|
+
* serialised JSON (not object identity), so a structurally-equal-but-new
|
|
2750
|
+
* snapshot object doesn't reschedule a write.
|
|
2751
|
+
*
|
|
2752
|
+
* @example
|
|
2753
|
+
* useRememberedState({
|
|
2754
|
+
* key: `myapp:tool:${slug}`,
|
|
2755
|
+
* snapshot: currentSeed,
|
|
2756
|
+
* restore: (seed) => applySeed(seed),
|
|
2757
|
+
* skipWhenUrlParam: "restore",
|
|
2758
|
+
* });
|
|
2759
|
+
*/
|
|
2760
|
+
declare function useRememberedState<T>({ key, snapshot, restore, enabled, debounceMs, skipWhenUrlParam, }: UseRememberedStateOptions<T>): void;
|
|
2761
|
+
|
|
2762
|
+
interface UseLongPressOptions {
|
|
2763
|
+
onLongPress: (e: PointerEvent) => void;
|
|
2764
|
+
/** ms to hold before firing. Default 500. */
|
|
2765
|
+
delayMs?: number;
|
|
2766
|
+
/** Pixels of movement that cancel the press. Default 8. */
|
|
2767
|
+
moveThresholdPx?: number;
|
|
2768
|
+
/** Vibration ms on fire. Default 10. Set 0 to disable. */
|
|
2769
|
+
hapticMs?: number;
|
|
2770
|
+
}
|
|
2771
|
+
interface UseLongPressResult {
|
|
2772
|
+
onPointerDown: (e: PointerEvent) => void;
|
|
2773
|
+
onPointerMove: (e: PointerEvent) => void;
|
|
2774
|
+
onPointerUp: (e: PointerEvent) => void;
|
|
2775
|
+
onPointerCancel: (e: PointerEvent) => void;
|
|
2776
|
+
/** Spread onto the same element to suppress the trailing click that
|
|
2777
|
+
* fires after the long-press triggers. Without this, the touch that
|
|
2778
|
+
* ends the press also opens the hover card or detail panel — double
|
|
2779
|
+
* action. */
|
|
2780
|
+
onClick: (e: MouseEvent) => void;
|
|
2781
|
+
}
|
|
2782
|
+
/**
|
|
2783
|
+
* Touch-only long-press hook. On fine-pointer devices (mouse), every
|
|
2784
|
+
* returned handler is a no-op — desktop relies on `onContextMenu` for
|
|
2785
|
+
* right-click instead. The returned event handlers should be spread onto
|
|
2786
|
+
* the target element via `<div {...longPress}>`.
|
|
2787
|
+
*
|
|
2788
|
+
* @param options.onLongPress - Fired once the press has been held for `delayMs`.
|
|
2789
|
+
* @param options.delayMs - ms to hold before firing. Default `500`.
|
|
2790
|
+
* @param options.moveThresholdPx - Pixels of movement that cancel the press. Default `8`.
|
|
2791
|
+
* @param options.hapticMs - Vibration ms on fire (`navigator.vibrate`). Default `10`; `0` disables.
|
|
2792
|
+
*
|
|
2793
|
+
* @example
|
|
2794
|
+
* const longPress = useLongPress({ onLongPress: (e) => openContextMenu(e) });
|
|
2795
|
+
* <div {...longPress}>Hold me</div>
|
|
2796
|
+
*/
|
|
2797
|
+
declare function useLongPress({ onLongPress, delayMs, moveThresholdPx, hapticMs, }: UseLongPressOptions): UseLongPressResult;
|
|
2798
|
+
|
|
2799
|
+
interface LiveRegionProps {
|
|
2800
|
+
/** Custom-event name to listen on. Must match the `eventName` passed to `announce()`. Default `DEFAULT_ANNOUNCE_EVENT`. */
|
|
2801
|
+
eventName?: string;
|
|
2802
|
+
/** className applied to both region `<div>`s. Default `"sr-only"` (Tailwind's screen-reader-only utility). */
|
|
2803
|
+
className?: string;
|
|
2804
|
+
/** Milliseconds a message stays in the DOM before self-clearing. Default `6000`. */
|
|
2805
|
+
clearAfterMs?: number;
|
|
2806
|
+
}
|
|
2807
|
+
/**
|
|
2808
|
+
* Mount once per `eventName` channel (typically once, at the app root).
|
|
2809
|
+
* Renders two visually-hidden `aria-live` regions (`polite` / `assertive`)
|
|
2810
|
+
* that receive text pushed by `announce()` calls dispatched on the same
|
|
2811
|
+
* `eventName`.
|
|
2812
|
+
*
|
|
2813
|
+
* @example
|
|
2814
|
+
* // root layout
|
|
2815
|
+
* <LiveRegion />
|
|
2816
|
+
* // elsewhere in the client tree
|
|
2817
|
+
* announce("Saved");
|
|
2818
|
+
*
|
|
2819
|
+
* @example
|
|
2820
|
+
* // namespaced channel — LiveRegion and announce() must agree on eventName
|
|
2821
|
+
* <LiveRegion eventName="myapp:announce" />
|
|
2822
|
+
* announce("Saved", "polite", { eventName: "myapp:announce" });
|
|
2823
|
+
*/
|
|
2824
|
+
declare function LiveRegion({ eventName, className, clearAfterMs, }: LiveRegionProps): React$1.JSX.Element;
|
|
2825
|
+
|
|
2826
|
+
interface UseScrollRestoreOptions {
|
|
2827
|
+
/** localStorage key prefix. Callers own their own namespacing. Default `DEFAULT_SCROLL_RESTORE_PREFIX` ("hazo_ui:scrollPos"). */
|
|
2828
|
+
prefix?: string;
|
|
2829
|
+
}
|
|
2830
|
+
interface UseScrollRestoreResult {
|
|
2831
|
+
/** Persist a scroll position (rounded to the nearest pixel). */
|
|
2832
|
+
save: (scrollY: number) => void;
|
|
2833
|
+
/** Read back the persisted scroll position, or `null` if none / unreadable. */
|
|
2834
|
+
load: () => number | null;
|
|
2835
|
+
}
|
|
2836
|
+
/**
|
|
2837
|
+
* localStorage-backed scroll-position save/load, keyed by
|
|
2838
|
+
* `${prefix}.${treeId}.${viewName}`. SSR-safe (no-ops when `window` is
|
|
2839
|
+
* undefined) and quota-safe (write failures are swallowed).
|
|
2840
|
+
*
|
|
2841
|
+
* @param treeId - Identifies the scrollable subject (e.g. a document/tree id).
|
|
2842
|
+
* @param viewName - Identifies which view/pane within that subject.
|
|
2843
|
+
* @param options.prefix - Storage-key prefix. Default `"hazo_ui:scrollPos"`.
|
|
2844
|
+
*
|
|
2845
|
+
* @example
|
|
2846
|
+
* const { save, load } = useScrollRestore(treeId, "canvas");
|
|
2847
|
+
* useEffect(() => {
|
|
2848
|
+
* const y = load();
|
|
2849
|
+
* if (y !== null) containerRef.current?.scrollTo(0, y);
|
|
2850
|
+
* }, []);
|
|
2851
|
+
* const onScroll = (e: React.UIEvent<HTMLDivElement>) => save(e.currentTarget.scrollTop);
|
|
2852
|
+
*
|
|
2853
|
+
* @example
|
|
2854
|
+
* // namespaced prefix — avoids collisions with other apps sharing a domain
|
|
2855
|
+
* useScrollRestore(treeId, "canvas", { prefix: "myapp:scrollPos" });
|
|
2856
|
+
*/
|
|
2857
|
+
declare function useScrollRestore(treeId: string, viewName: string, options?: UseScrollRestoreOptions): UseScrollRestoreResult;
|
|
2858
|
+
|
|
2859
|
+
export { ANIMATION_PRESETS, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AnimationPreset, AppFooter, type AppFooterProps, AppHeader, type AppHeaderProps, type BaseCommandInputProps, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CELEBRATION_GRADIENT, Calendar, CanvasTextToolbar, type CanvasTextToolbarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CelebrationPayload, CelebrationProvider, type CelebrationProviderProps, type CelebrationShareableCard, type ChartDataPoint, type ChartDataSeries, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, type CommandEditContext, type CommandItem$1 as CommandItem, CommandNodeExtension, CommandPill, type CommandPillProps, CommandPopover, type CommandPopoverProps, type CommandTextOutput, type ConfirmDialogVariant, type DateRangeOption, DateRangeSelector, type DateRangeSelectorProps, type DialogVariant, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, type EmptyStateProps, ErrorBanner, type ErrorBannerProps, type ErrorBannerSeverity, ErrorPage, type ErrorPageProps, type EtaProgressHandle, type FilterConfig, type FilterField, FunnelChart, type FunnelChartProps, type FunnelStep, HazoContextProvider, type HazoContextProviderProps, type HazoUiConfig, HazoUiConfirmDialog, type HazoUiConfirmDialogProps, HazoUiDialog, DialogClose as HazoUiDialogClose, DialogContent as HazoUiDialogContent, DialogDescription as HazoUiDialogDescription, DialogFooter as HazoUiDialogFooter, DialogHeader as HazoUiDialogHeader, type HazoUiDialogKind, DialogOverlay as HazoUiDialogOverlay, DialogPortal as HazoUiDialogPortal, type HazoUiDialogProps, Dialog as HazoUiDialogRoot, DialogTitle as HazoUiDialogTitle, DialogTrigger as HazoUiDialogTrigger, HazoUiEtaProgress, type HazoUiEtaProgressProps, HazoUiFlexInput, type HazoUiFlexInputProps, HazoUiFlexRadio, type HazoUiFlexRadioItem, type HazoUiFlexRadioProps, HazoUiIcon, HazoUiIconPicker, type HazoUiIconPickerProps, type HazoUiIconProps, HazoUiImageCropper, HazoUiImageCropperDialog, type HazoUiImageCropperDialogProps, type HazoUiImageCropperHandle, type HazoUiImageCropperProps, HazoUiKanban, HazoUiKanbanFilter, type HazoUiKanbanFilterProps, type HazoUiKanbanProps, HazoUiMemoryDropdown, type HazoUiMemoryDropdownProps, HazoUiMultiFilterDialog, HazoUiMultiSortDialog, HazoUiPillRadio, type HazoUiPillRadioItem, type HazoUiPillRadioProps, HazoUiProgressBar, type HazoUiProgressBarProps, HazoUiRte, type HazoUiRteProps, HazoUiTable, type HazoUiTablePagination, type HazoUiTableProps, type HazoUiTableServerLoadArgs, type HazoUiTableServerLoadResult, HazoUiTextarea, type HazoUiTextareaProps, HazoUiTextbox, type HazoUiTextboxProps, HazoUiToaster, type HazoUiToasterProps, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputAffix, type InputAffixProps, type InsertedCommand, InverseSparkline, type InverseSparklineProps, type KanbanAnnouncements, type KanbanColumn, type KanbanEditorCtx, type KanbanEditorField, type KanbanEditorFieldType, type KanbanFilterValue, type KanbanItem, type KanbanMoveEvent, type KanbanMoveHandle, type KanbanPriority, type KanbanReorderEvent, type KanbanSaveEvent, Label, LiveRegion, type LiveRegionProps, LoadingTimeout, type LoadingTimeoutProps, type Logger, Logo, type LogoProps, MarkdownEditor, type MarkdownEditorProps, type MarkdownEmbed, type MemoryEntry, NotificationCountBadge, type NotificationCountBadgeProps, NotificationItem, type NotificationItemProps, NotificationPanel, type NotificationPanelProps, type PermissionToastOptions, Popover, PopoverContent, PopoverTrigger, type PrefixColor, type PrefixConfig, ProgressiveImage, type ProgressiveImageProps, RadioGroup, RadioGroupItem, type RteAttachment, type RteOutput, type RteVariable, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Command as ShadcnCommand, CommandEmpty as ShadcnCommandEmpty, CommandGroup as ShadcnCommandGroup, CommandInput as ShadcnCommandInput, CommandItem as ShadcnCommandItem, CommandList as ShadcnCommandList, Skeleton, SkeletonBar, type SkeletonBarProps, SkeletonCircle, type SkeletonCircleProps, SkeletonGroup, type SkeletonGroupProps, SkeletonRect, type SkeletonRectProps, Slider, type SortConfig, type SortField, Sparkline, type SparklineProps, Spinner, type StackedBar, StackedBars, type StackedBarsProps, type SuggestionState, Switch, Table, TableBody, TableCaption, TableCell, type TableColumn, type TableFilter, TableFooter, type TableFormatter, TableHead, TableHeader, TableRow, type TableSort, type TableSortEntry, type TableSortProp, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type ToastOptions, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseCopyToClipboardResult, type UseErrorDisplayResult, type UseEtaProgressOptions, type UseFullscreenRefResult, type UseFullscreenResult, type UseLoadingStateResult, type UseLongPressOptions, type UseLongPressResult, type UseRememberedStateOptions, type UseScrollRestoreOptions, type UseScrollRestoreResult, type UseWakeLockResult, applyKanbanFilter, buttonGroupVariants, celebrate, computeEta, create_command_suggestion_extension, easeToward, errorToast, format_num, generateUUID, get_hazo_ui_config, get_logger, isLucideValue, median, parse_commands_from_text, permissionToast, pick_x_label_indices, reset_hazo_ui_config, resolve_animation_classes, set_hazo_ui_config, set_logger, successToast, text_to_tiptap_content, toggleVariants, upsertEntry as upsertMemoryEntry, useClickOutside, useCopyToClipboard, useDebounce, useErrorDisplay, useEtaProgress, useFullscreen, useIsMobile, useLoadingState, useLocalStorage, useLongPress, useMediaQuery, useRememberedState, useScrollRestore, useSessionStorage, useViewport, useWakeLock, use_fullscreen, use_wake_lock };
|