@kumix/ui 0.1.0 → 0.1.2

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 CHANGED
@@ -4,7 +4,10 @@ Headless, accessible React component library for Kumix products. Built on Radix
4
4
 
5
5
  ## What's Inside
6
6
 
7
- - 80+ UI components: form controls, overlays, navigation, data display, DataGrid, Kanban, Sortable, and more.
7
+ - 90+ UI components: form controls, overlays, navigation, data display, DataGrid, Kanban, Sortable, and more.
8
+ - Charts: `Chart` components built on Recharts, with theme-aware colors, tooltips, and legends.
9
+ - Messaging: `Message`, `Bubble`, `Attachment`, and `MessageScroller` primitives for chat and AI interfaces.
10
+ - Input building blocks: `Combobox`, `InputGroup`, `NativeSelect`, and `Marker`, plus a `DirectionProvider` for RTL/LTR support.
8
11
  - Hooks entry: viewport, media query, copy-to-clipboard, file upload, intersection observer, mutation observer, and related utilities.
9
12
  - Animation components: marquee, text effects, counting/sliding numbers, animated backgrounds, avatar groups, and more.
10
13
  - Tailwind-friendly styling via utility classes, semantic CSS variables, and `data-slot` attributes.
@@ -22,7 +25,7 @@ Install peer dependencies required by the components you use. Common peers inclu
22
25
  bun add @kumix/utils class-variance-authority lucide-react radix-ui react
23
26
  ```
24
27
 
25
- Feature-specific components may also require `@tanstack/react-table`, `@dnd-kit/*`, `cmdk`, `motion`, `react-day-picker`, `react-aria-components`, `react-hook-form`, `react-resizable-panels`, `sonner`, `vaul`, `input-otp`, `embla-carousel-react`, `next-themes`, or `@headless-tree/core`.
28
+ Feature-specific components may also require `@base-ui/react`, `recharts`, `@tanstack/react-table`, `@dnd-kit/*`, `cmdk`, `motion`, `react-day-picker`, `react-aria-components`, `react-hook-form`, `react-resizable-panels`, `sonner`, `vaul`, `input-otp`, `embla-carousel-react`, `next-themes`, or `@headless-tree/core`.
26
29
 
27
30
  See `package.json` for exact peer dependency ranges.
28
31
 
package/dist/hooks.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import * as React$1 from "react";
2
2
  import React, { ChangeEvent, ComponentType, DragEvent, InputHTMLAttributes, RefObject, SVGProps } from "react";
3
3
  import { META_THEME_COLORS } from "@kumix/utils";
4
-
5
4
  //#region src/hooks/use-body-classes.d.ts
6
5
  /**
7
6
  * Body class management hook for React components.
@@ -61,11 +60,10 @@ interface UseCopyToClipboardOptions {
61
60
  * );
62
61
  * ```
63
62
  */
64
- declare function useCopyToClipboard({
65
- timeout,
66
- onCopy
67
- }?: UseCopyToClipboardOptions): {
68
- /** Whether text was recently copied (true for timeout duration) */copied: boolean; /** Function to copy text to clipboard */
63
+ declare function useCopyToClipboard({ timeout, onCopy }?: UseCopyToClipboardOptions): {
64
+ /** Whether text was recently copied (true for timeout duration) */
65
+ copied: boolean;
66
+ /** Function to copy text to clipboard */
69
67
  copy: (value: string) => Promise<boolean>;
70
68
  };
71
69
  //#endregion
@@ -74,55 +72,85 @@ declare function useCopyToClipboard({
74
72
  * Metadata structure for uploaded files
75
73
  */
76
74
  type FileMetadata = {
77
- /** The name of the file */name: string; /** The size of the file in bytes */
78
- size: number; /** The MIME type of the file */
79
- type: string; /** The URL where the file can be accessed */
80
- url: string; /** Unique identifier for the file */
75
+ /** The name of the file */
76
+ name: string;
77
+ /** The size of the file in bytes */
78
+ size: number;
79
+ /** The MIME type of the file */
80
+ type: string;
81
+ /** The URL where the file can be accessed */
82
+ url: string;
83
+ /** Unique identifier for the file */
81
84
  id: string;
82
85
  };
83
86
  /**
84
87
  * File object with preview capabilities
85
88
  */
86
89
  type FileWithPreview = {
87
- /** The actual file object or metadata */file: File | FileMetadata; /** Unique identifier for the file */
88
- id: string; /** Optional preview URL for the file (typically for images) */
90
+ /** The actual file object or metadata */
91
+ file: File | FileMetadata;
92
+ /** Unique identifier for the file */
93
+ id: string;
94
+ /** Optional preview URL for the file (typically for images) */
89
95
  preview?: string;
90
96
  };
91
97
  /**
92
98
  * Configuration options for the file upload hook
93
99
  */
94
100
  type FileUploadOptions = {
95
- /** Maximum number of files allowed (only used when multiple is true, defaults to Infinity) */maxFiles?: number; /** Maximum file size in bytes (defaults to Infinity) */
96
- maxSize?: number; /** Accepted file types (MIME types or extensions, defaults to '*') */
97
- accept?: string; /** Whether multiple files can be selected (defaults to false) */
98
- multiple?: boolean; /** Initial files to populate the upload state */
99
- initialFiles?: FileMetadata[]; /** Callback function executed when files change */
100
- onFilesChange?: (files: FileWithPreview[]) => void; /** Callback function executed when new files are added */
101
- onFilesAdded?: (addedFiles: FileWithPreview[]) => void; /** Callback function executed when validation errors occur */
101
+ /** Maximum number of files allowed (only used when multiple is true, defaults to Infinity) */
102
+ maxFiles?: number;
103
+ /** Maximum file size in bytes (defaults to Infinity) */
104
+ maxSize?: number;
105
+ /** Accepted file types (MIME types or extensions, defaults to '*') */
106
+ accept?: string;
107
+ /** Whether multiple files can be selected (defaults to false) */
108
+ multiple?: boolean;
109
+ /** Initial files to populate the upload state */
110
+ initialFiles?: FileMetadata[];
111
+ /** Callback function executed when files change */
112
+ onFilesChange?: (files: FileWithPreview[]) => void;
113
+ /** Callback function executed when new files are added */
114
+ onFilesAdded?: (addedFiles: FileWithPreview[]) => void;
115
+ /** Callback function executed when validation errors occur */
102
116
  onError?: (errors: string[]) => void;
103
117
  };
104
118
  /**
105
119
  * Current state of the file upload component
106
120
  */
107
121
  type FileUploadState = {
108
- /** Array of files currently selected/uploaded */files: FileWithPreview[]; /** Whether the user is currently dragging files over the drop zone */
109
- isDragging: boolean; /** Array of validation error messages */
122
+ /** Array of files currently selected/uploaded */
123
+ files: FileWithPreview[];
124
+ /** Whether the user is currently dragging files over the drop zone */
125
+ isDragging: boolean;
126
+ /** Array of validation error messages */
110
127
  errors: string[];
111
128
  };
112
129
  /**
113
130
  * Actions available for file upload management
114
131
  */
115
132
  type FileUploadActions = {
116
- /** Add new files to the upload state */addFiles: (files: FileList | File[]) => void; /** Remove a specific file by its ID */
117
- removeFile: (id: string) => void; /** Clear all files from the upload state */
118
- clearFiles: () => void; /** Clear all error messages */
119
- clearErrors: () => void; /** Handle drag enter event for drop zone */
120
- handleDragEnter: (e: DragEvent<HTMLElement>) => void; /** Handle drag leave event for drop zone */
121
- handleDragLeave: (e: DragEvent<HTMLElement>) => void; /** Handle drag over event for drop zone */
122
- handleDragOver: (e: DragEvent<HTMLElement>) => void; /** Handle drop event for drop zone */
123
- handleDrop: (e: DragEvent<HTMLElement>) => void; /** Handle file input change event */
124
- handleFileChange: (e: ChangeEvent<HTMLInputElement>) => void; /** Programmatically open the file dialog */
125
- openFileDialog: () => void; /** Get props for the file input element */
133
+ /** Add new files to the upload state */
134
+ addFiles: (files: FileList | File[]) => void;
135
+ /** Remove a specific file by its ID */
136
+ removeFile: (id: string) => void;
137
+ /** Clear all files from the upload state */
138
+ clearFiles: () => void;
139
+ /** Clear all error messages */
140
+ clearErrors: () => void;
141
+ /** Handle drag enter event for drop zone */
142
+ handleDragEnter: (e: DragEvent<HTMLElement>) => void;
143
+ /** Handle drag leave event for drop zone */
144
+ handleDragLeave: (e: DragEvent<HTMLElement>) => void;
145
+ /** Handle drag over event for drop zone */
146
+ handleDragOver: (e: DragEvent<HTMLElement>) => void;
147
+ /** Handle drop event for drop zone */
148
+ handleDrop: (e: DragEvent<HTMLElement>) => void;
149
+ /** Handle file input change event */
150
+ handleFileChange: (e: ChangeEvent<HTMLInputElement>) => void;
151
+ /** Programmatically open the file dialog */
152
+ openFileDialog: () => void;
153
+ /** Get props for the file input element */
126
154
  getInputProps: (props?: InputHTMLAttributes<HTMLInputElement>) => InputHTMLAttributes<HTMLInputElement> & {
127
155
  ref: React.Ref<HTMLInputElement>;
128
156
  };
@@ -268,12 +296,7 @@ interface IntersectionObserverOptions extends IntersectionObserverInit {
268
296
  * );
269
297
  * ```
270
298
  */
271
- declare function useIntersectionObserver(elementRef: React$1.RefObject<Element | null>, {
272
- threshold,
273
- root,
274
- rootMargin,
275
- freezeOnceVisible
276
- }?: IntersectionObserverOptions): boolean;
299
+ declare function useIntersectionObserver(elementRef: React$1.RefObject<Element | null>, { threshold, root, rootMargin, freezeOnceVisible }?: IntersectionObserverOptions): boolean;
277
300
  //#endregion
278
301
  //#region src/hooks/use-is-mac.d.ts
279
302
  /**
@@ -301,6 +324,109 @@ declare function useIntersectionObserver(elementRef: React$1.RefObject<Element |
301
324
  */
302
325
  declare function useIsMac(): boolean;
303
326
  //#endregion
327
+ //#region src/hooks/use-is-mobile.d.ts
328
+ /**
329
+ * Mobile device detection hook for React components
330
+ * Provides real-time mobile/desktop state based on configurable viewport width breakpoint
331
+ * Uses customizable mobile breakpoint with proper SSR handling and hydration safety
332
+ */
333
+ /**
334
+ * Hook to detect if the current viewport is mobile-sized based on configurable breakpoint
335
+ *
336
+ * This hook provides real-time detection of mobile vs desktop viewports with a customizable
337
+ * breakpoint threshold. It handles SSR properly by starting with undefined state and updating
338
+ * on client-side hydration to prevent hydration mismatches.
339
+ *
340
+ * The hook uses both `matchMedia` API for efficient media query listening and `window.innerWidth`
341
+ * for consistent viewport width detection across different browsers and devices.
342
+ *
343
+ * Features:
344
+ * - Real-time viewport size tracking with media query listeners
345
+ * - SSR-safe implementation preventing hydration mismatches
346
+ * - Automatic event listener cleanup on unmount
347
+ * - Configurable mobile breakpoint with sensible default (1024px)
348
+ * - Performance optimized with proper dependency management
349
+ * - TypeScript support with proper type definitions
350
+ *
351
+ * @param breakpoint - Custom breakpoint in pixels. Viewports smaller than this value are considered mobile. Defaults to 1024px if not provided.
352
+ * @returns Boolean indicating if current viewport width is smaller than the specified breakpoint (mobile-sized)
353
+ *
354
+ * @example
355
+ * ```tsx
356
+ * // Basic usage with default breakpoint (1024px)
357
+ * function ResponsiveComponent() {
358
+ * const isMobile = useIsMobile();
359
+ *
360
+ * return (
361
+ * <div>
362
+ * {isMobile ? (
363
+ * <MobileNavigation />
364
+ * ) : (
365
+ * <DesktopNavigation />
366
+ * )}
367
+ * </div>
368
+ * );
369
+ * }
370
+ *
371
+ * // Custom breakpoint for tablet detection
372
+ * function TabletResponsiveComponent() {
373
+ * const isMobile = useIsMobile(768); // Use 768px breakpoint
374
+ * const isTablet = useIsMobile(1024); // Use 1024px for tablet detection
375
+ *
376
+ * return (
377
+ * <div className={isMobile ? 'mobile-layout' : isTablet ? 'tablet-layout' : 'desktop-layout'}>
378
+ * <Content />
379
+ * </div>
380
+ * );
381
+ * }
382
+ *
383
+ * // Conditional rendering with custom breakpoint
384
+ * function AdaptiveLayout() {
385
+ * const isSmallScreen = useIsMobile(640); // Custom small screen breakpoint
386
+ *
387
+ * return (
388
+ * <div className="container">
389
+ * {isSmallScreen ? (
390
+ * <div className="flex flex-col space-y-4">
391
+ * <MobileHeader />
392
+ * <MobileContent />
393
+ * </div>
394
+ * ) : (
395
+ * <div className="grid grid-cols-12 gap-6">
396
+ * <aside className="col-span-3">
397
+ * <Sidebar />
398
+ * </aside>
399
+ * <main className="col-span-9">
400
+ * <DesktopContent />
401
+ * </main>
402
+ * </div>
403
+ * )}
404
+ * </div>
405
+ * );
406
+ * }
407
+ *
408
+ * // Multiple breakpoints for different layouts
409
+ * function MultiBreakpointLayout() {
410
+ * const isMobile = useIsMobile(640); // Mobile: < 640px
411
+ * const isTablet = useIsMobile(1024); // Tablet: < 1024px
412
+ * const isDesktop = !isTablet; // Desktop: >= 1024px
413
+ *
414
+ * if (isMobile) {
415
+ * return <MobileLayout />;
416
+ * }
417
+ *
418
+ * if (isTablet) {
419
+ * return <TabletLayout />;
420
+ * }
421
+ *
422
+ * return <DesktopLayout />;
423
+ * }
424
+ * ```
425
+ *
426
+ * @since 1.0.0
427
+ */
428
+ declare function useIsMobile(breakpoint?: number): boolean;
429
+ //#endregion
304
430
  //#region src/hooks/use-media-query.d.ts
305
431
  /**
306
432
  * Media query hook for responsive React components
@@ -498,113 +624,12 @@ declare const useMenu: (pathname: string) => UseMenuReturn;
498
624
  * ```
499
625
  */
500
626
  declare function useMetaColor(defaultColors?: typeof META_THEME_COLORS): {
501
- /** Current meta theme color based on resolved theme */metaColor: "#09090b" | "#ffffff"; /** Function to manually set meta theme color */
627
+ /** Current meta theme color based on resolved theme */
628
+ metaColor: "#09090b" | "#ffffff";
629
+ /** Function to manually set meta theme color */
502
630
  setMetaColor: (color: string) => void;
503
631
  };
504
632
  //#endregion
505
- //#region src/hooks/use-is-mobile.d.ts
506
- /**
507
- * Mobile device detection hook for React components
508
- * Provides real-time mobile/desktop state based on configurable viewport width breakpoint
509
- * Uses customizable mobile breakpoint with proper SSR handling and hydration safety
510
- */
511
- /**
512
- * Hook to detect if the current viewport is mobile-sized based on configurable breakpoint
513
- *
514
- * This hook provides real-time detection of mobile vs desktop viewports with a customizable
515
- * breakpoint threshold. It handles SSR properly by starting with undefined state and updating
516
- * on client-side hydration to prevent hydration mismatches.
517
- *
518
- * The hook uses both `matchMedia` API for efficient media query listening and `window.innerWidth`
519
- * for consistent viewport width detection across different browsers and devices.
520
- *
521
- * Features:
522
- * - Real-time viewport size tracking with media query listeners
523
- * - SSR-safe implementation preventing hydration mismatches
524
- * - Automatic event listener cleanup on unmount
525
- * - Configurable mobile breakpoint with sensible default (1024px)
526
- * - Performance optimized with proper dependency management
527
- * - TypeScript support with proper type definitions
528
- *
529
- * @param breakpoint - Custom breakpoint in pixels. Viewports smaller than this value are considered mobile. Defaults to 1024px if not provided.
530
- * @returns Boolean indicating if current viewport width is smaller than the specified breakpoint (mobile-sized)
531
- *
532
- * @example
533
- * ```tsx
534
- * // Basic usage with default breakpoint (1024px)
535
- * function ResponsiveComponent() {
536
- * const isMobile = useIsMobile();
537
- *
538
- * return (
539
- * <div>
540
- * {isMobile ? (
541
- * <MobileNavigation />
542
- * ) : (
543
- * <DesktopNavigation />
544
- * )}
545
- * </div>
546
- * );
547
- * }
548
- *
549
- * // Custom breakpoint for tablet detection
550
- * function TabletResponsiveComponent() {
551
- * const isMobile = useIsMobile(768); // Use 768px breakpoint
552
- * const isTablet = useIsMobile(1024); // Use 1024px for tablet detection
553
- *
554
- * return (
555
- * <div className={isMobile ? 'mobile-layout' : isTablet ? 'tablet-layout' : 'desktop-layout'}>
556
- * <Content />
557
- * </div>
558
- * );
559
- * }
560
- *
561
- * // Conditional rendering with custom breakpoint
562
- * function AdaptiveLayout() {
563
- * const isSmallScreen = useIsMobile(640); // Custom small screen breakpoint
564
- *
565
- * return (
566
- * <div className="container">
567
- * {isSmallScreen ? (
568
- * <div className="flex flex-col space-y-4">
569
- * <MobileHeader />
570
- * <MobileContent />
571
- * </div>
572
- * ) : (
573
- * <div className="grid grid-cols-12 gap-6">
574
- * <aside className="col-span-3">
575
- * <Sidebar />
576
- * </aside>
577
- * <main className="col-span-9">
578
- * <DesktopContent />
579
- * </main>
580
- * </div>
581
- * )}
582
- * </div>
583
- * );
584
- * }
585
- *
586
- * // Multiple breakpoints for different layouts
587
- * function MultiBreakpointLayout() {
588
- * const isMobile = useIsMobile(640); // Mobile: < 640px
589
- * const isTablet = useIsMobile(1024); // Tablet: < 1024px
590
- * const isDesktop = !isTablet; // Desktop: >= 1024px
591
- *
592
- * if (isMobile) {
593
- * return <MobileLayout />;
594
- * }
595
- *
596
- * if (isTablet) {
597
- * return <TabletLayout />;
598
- * }
599
- *
600
- * return <DesktopLayout />;
601
- * }
602
- * ```
603
- *
604
- * @since 1.0.0
605
- */
606
- declare function useIsMobile(breakpoint?: number): boolean;
607
- //#endregion
608
633
  //#region src/hooks/use-mutation-observer.d.ts
609
634
  /**
610
635
  * Hook to observe DOM mutations on a referenced element
@@ -765,9 +790,7 @@ interface UseScrollPositionProps {
765
790
  * }
766
791
  * ```
767
792
  */
768
- declare const useScrollPosition: ({
769
- targetRef
770
- }?: UseScrollPositionProps) => number;
793
+ declare const useScrollPosition: ({ targetRef }?: UseScrollPositionProps) => number;
771
794
  //#endregion
772
795
  //#region src/hooks/use-slider-input.d.ts
773
796
  /**
@@ -843,17 +866,20 @@ interface UseSliderInputProps {
843
866
  * }
844
867
  * ```
845
868
  */
846
- declare function useSliderInput({
847
- minValue,
848
- maxValue,
849
- initialValue
850
- }: UseSliderInputProps): {
851
- /** Function to manually set slider values */setSliderValues: React$1.Dispatch<React$1.SetStateAction<[number, number]>>; /** Function to manually set input values */
852
- setInputValues: React$1.Dispatch<React$1.SetStateAction<[number, number]>>; /** Current slider values [min, max] */
853
- sliderValues: [number, number]; /** Current input values [min, max] */
854
- inputValues: [number, number]; /** Handler for slider value changes */
855
- handleSliderChange: (values: [number, number]) => void; /** Handler for input field changes */
856
- handleInputChange: (e: React$1.ChangeEvent<HTMLInputElement>, index: 0 | 1) => void; /** Function to validate and update values from inputs */
869
+ declare function useSliderInput({ minValue, maxValue, initialValue }: UseSliderInputProps): {
870
+ /** Function to manually set slider values */
871
+ setSliderValues: React$1.Dispatch<React$1.SetStateAction<[number, number]>>;
872
+ /** Function to manually set input values */
873
+ setInputValues: React$1.Dispatch<React$1.SetStateAction<[number, number]>>;
874
+ /** Current slider values [min, max] */
875
+ sliderValues: [number, number];
876
+ /** Current input values [min, max] */
877
+ inputValues: [number, number];
878
+ /** Handler for slider value changes */
879
+ handleSliderChange: (values: [number, number]) => void;
880
+ /** Handler for input field changes */
881
+ handleInputChange: (e: React$1.ChangeEvent<HTMLInputElement>, index: 0 | 1) => void;
882
+ /** Function to validate and update values from inputs */
857
883
  validateAndUpdateValue: (value: number, index: 0 | 1) => void;
858
884
  };
859
885
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","names":[],"sources":["../src/hooks/use-body-classes.ts","../src/hooks/use-copy-to-clipboard.ts","../src/hooks/use-file-upload.ts","../src/hooks/use-hydrated.ts","../src/hooks/use-intersection-observer.ts","../src/hooks/use-is-mac.ts","../src/hooks/use-media-query.ts","../src/hooks/use-menu.ts","../src/hooks/use-meta-color.ts","../src/hooks/use-is-mobile.ts","../src/hooks/use-mutation-observer.ts","../src/hooks/use-remove-ga-params.ts","../src/hooks/use-scroll-position.ts","../src/hooks/use-slider-input.ts","../src/hooks/use-viewport.ts"],"mappings":";;;;;;;;;;AA2BA;;;;AAAgD;;;;;;;;ACVxC;AAwBR;;;;cDda,cAAA,G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AA,CAAU,WAAA,GAAc,QAAA;AAAA;;;;;AXE9B;AAwBR;;;;;;;;;;;;;;;;;;;AAWwB;;;;AC9BxB;;;;;;;;;;AAUI;AAMJ;;;;;;;;;;AAMS;AAMT;;;;;;;;;;;;;cU+BM,iBAAA;EAAqB;AAAA,IAAe,sBAA2B;;;;;;UCnE3D,mBAAA;;EAER,QAAA;;EAEA,QAAA;EZLiC;EYOjC,YAAA;AAAA;AZHM;AAwBR;;;;;;;;;;;;;;;;;;;AAWwB;;;;AC9BxB;;;;;;;;;;AAUI;AAMJ;;;;;;;;;;AAMS;AAMT;;;;;;;;;;;;;;;;ADjCQ,iBYoEQ,cAAA;EAAiB,QAAA;EAAU,QAAA;EAAU;AAAA,GAAgB,mBAAA;EXrBnE,0HAAgB;8EAEL;kCAAgB;iCAMF;0DAEH;yBWqChB,OAAA,CAAM,WAAA,CAAY,gBAAA,GAAiB,KAAA,kBXrClC;0CW2DS,KAAA;AAAA;;;;;;;;Ab1GlB;;;;AAAA,KcbK,kBAAA;;;;;;;;AbGG;AAwBR;;;;;;;;;;;;;;;;;;;AAWwB;;;;AC9BxB;;;;;;;;;;AAUI;AAMJ;;;;;;;;;;AAMS;AAMT;;;;cYuBM,WAAA,QAAkB,kBA6BvB"}
1
+ {"version":3,"file":"hooks.d.ts","names":[],"sources":["../src/hooks/use-body-classes.ts","../src/hooks/use-copy-to-clipboard.ts","../src/hooks/use-file-upload.ts","../src/hooks/use-hydrated.ts","../src/hooks/use-intersection-observer.ts","../src/hooks/use-is-mac.ts","../src/hooks/use-is-mobile.ts","../src/hooks/use-media-query.ts","../src/hooks/use-menu.ts","../src/hooks/use-meta-color.ts","../src/hooks/use-mutation-observer.ts","../src/hooks/use-remove-ga-params.ts","../src/hooks/use-scroll-position.ts","../src/hooks/use-slider-input.ts","../src/hooks/use-viewport.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;cA2Ba,iBAAkB;;;;;;;;;UCdrB;;EAER;;EAEA;;;;;;;;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;EAEX;;EAGA;;EAEA;;EAEA;;EAGA;;EAEA;;EAUA;;EAEA;;EAEA;;;;;KAMG,aAAa;;UAGR;;EAER,WAAW;;EAEX,iBAAiB,UAAU;;EAE3B,eAAe,MAAM;;EAErB,iBAAiB,OAAO,eAAe;;EAEvC,gBAAgB,OAAO,eAAe;;EAEtC,cAAc,OAAO,YAAY,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA8BxC,UAAW,qBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBC7B3B,aAAa,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCEvC,sBACX,KAAK,QAAM,UAAU,qBACrB,UAAU,kBACV,UAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBClDK;;;;;;UCpBN;;EAER,YAAY,UAAU,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkEzB,sBAAqB,cAAe;;;;;;UCnEvC;;EAER;;EAEA;;EAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiEc,iBAAiB,UAAU,UAAU,gBAAgB;;;;;;;;;;;;yBA0B7D,QAAM,YAAY,mBAAiB;;0CAsBzB;;;;;;;;;;;;;KCvHb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA2DQ,mBAAkB"}
package/dist/hooks.js CHANGED
@@ -644,17 +644,6 @@ function useIsMac() {
644
644
  * with SSR-safe implementation and automatic cleanup
645
645
  */
646
646
  /**
647
- * Helper function to safely check media query matches
648
- * Prevents SSR hydration issues by checking for window availability
649
- *
650
- * @param query - CSS media query string to evaluate
651
- * @returns Boolean indicating if the media query matches
652
- */
653
- const getMatches = (query) => {
654
- if (typeof window !== "undefined") return window.matchMedia(query).matches;
655
- return false;
656
- };
657
- /**
658
647
  * Hook for tracking CSS media query matches in React components
659
648
  *
660
649
  * Features:
@@ -689,23 +678,16 @@ const getMatches = (query) => {
689
678
  * ```
690
679
  */
691
680
  const useMediaQuery = (query) => {
692
- /** State to track current media query match status */
693
- const [matches, setMatches] = useState(false);
694
- useEffect(() => {
695
- /**
696
- * Handler function to update matches state when media query changes
697
- */
698
- function handleChange() {
699
- setMatches(getMatches(query));
700
- }
681
+ const subscribe = useCallback((onChange) => {
701
682
  const matchMedia = window.matchMedia(query);
702
- handleChange();
703
- matchMedia.addEventListener("change", handleChange);
683
+ matchMedia.addEventListener("change", onChange);
704
684
  return () => {
705
- matchMedia.removeEventListener("change", handleChange);
685
+ matchMedia.removeEventListener("change", onChange);
706
686
  };
707
687
  }, [query]);
708
- return matches;
688
+ const getSnapshot = useCallback(() => window.matchMedia(query).matches, [query]);
689
+ const getServerSnapshot = () => false;
690
+ return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
709
691
  };
710
692
  //#endregion
711
693
  //#region src/hooks/use-menu.ts