@kumix/ui 0.1.0 → 0.1.1
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/hooks.d.ts +103 -103
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +6 -24
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +74 -58
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +313 -249
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","names":["React","React"],"sources":["../src/hooks/use-body-classes.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-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"],"sourcesContent":["/**\n * Body class management hook for React components.\n */\n\n\"use client\";\n\nimport { useEffect } from \"react\";\n\n/**\n * Adds classes to `document.body` while the component is mounted.\n * Shared classes are reference-counted, so one component unmounting does not\n * remove a class that another mounted component still owns.\n *\n * @param className - Space-separated string of CSS class names to apply to body\n *\n * @example\n * ```tsx\n * // Single class\n * useBodyClasses('dark-theme');\n *\n * // Multiple classes\n * useBodyClasses('modal-open overflow-hidden');\n *\n * // Conditional classes\n * useBodyClasses(isModalOpen ? 'modal-open' : '');\n * ```\n */\nexport const useBodyClasses = (className: string) => {\n useEffect(() => {\n if (!className.trim()) return;\n\n const classList = className.split(/\\s+/).filter(Boolean);\n\n classList.forEach((cls) => {\n const count = bodyClassCounts.get(cls) ?? 0;\n bodyClassCounts.set(cls, count + 1);\n if (count === 0) {\n document.body.classList.add(cls);\n }\n });\n\n return () => {\n classList.forEach((cls) => {\n const nextCount = (bodyClassCounts.get(cls) ?? 1) - 1;\n if (nextCount <= 0) {\n bodyClassCounts.delete(cls);\n document.body.classList.remove(cls);\n return;\n }\n bodyClassCounts.set(cls, nextCount);\n });\n };\n }, [className]);\n};\n\nconst bodyClassCounts = new Map<string, number>();\n","/**\n * File upload functionality hook for React components\n * Provides comprehensive file upload capabilities with drag & drop support\n * Includes validation, preview generation, and state management\n */\n\n\"use client\";\n\nimport type React from \"react\";\nimport {\n type ChangeEvent,\n type DragEvent,\n type InputHTMLAttributes,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\n/**\n * Metadata structure for uploaded files\n */\nexport type FileMetadata = {\n /** The name of the file */\n name: string;\n /** The size of the file in bytes */\n size: number;\n /** The MIME type of the file */\n type: string;\n /** The URL where the file can be accessed */\n url: string;\n /** Unique identifier for the file */\n id: string;\n};\n\n/**\n * File object with preview capabilities\n */\nexport type FileWithPreview = {\n /** The actual file object or metadata */\n file: File | FileMetadata;\n /** Unique identifier for the file */\n id: string;\n /** Optional preview URL for the file (typically for images) */\n preview?: string;\n};\n\n/**\n * Configuration options for the file upload hook\n */\nexport type FileUploadOptions = {\n /** Maximum number of files allowed (only used when multiple is true, defaults to Infinity) */\n maxFiles?: number;\n /** Maximum file size in bytes (defaults to Infinity) */\n maxSize?: number;\n /** Accepted file types (MIME types or extensions, defaults to '*') */\n accept?: string;\n /** Whether multiple files can be selected (defaults to false) */\n multiple?: boolean;\n /** Initial files to populate the upload state */\n initialFiles?: FileMetadata[];\n /** Callback function executed when files change */\n onFilesChange?: (files: FileWithPreview[]) => void;\n /** Callback function executed when new files are added */\n onFilesAdded?: (addedFiles: FileWithPreview[]) => void;\n /** Callback function executed when validation errors occur */\n onError?: (errors: string[]) => void;\n};\n\n/**\n * Current state of the file upload component\n */\nexport type FileUploadState = {\n /** Array of files currently selected/uploaded */\n files: FileWithPreview[];\n /** Whether the user is currently dragging files over the drop zone */\n isDragging: boolean;\n /** Array of validation error messages */\n errors: string[];\n};\n\n/**\n * Actions available for file upload management\n */\nexport type FileUploadActions = {\n /** Add new files to the upload state */\n addFiles: (files: FileList | File[]) => void;\n /** Remove a specific file by its ID */\n removeFile: (id: string) => void;\n /** Clear all files from the upload state */\n clearFiles: () => void;\n /** Clear all error messages */\n clearErrors: () => void;\n /** Handle drag enter event for drop zone */\n handleDragEnter: (e: DragEvent<HTMLElement>) => void;\n /** Handle drag leave event for drop zone */\n handleDragLeave: (e: DragEvent<HTMLElement>) => void;\n /** Handle drag over event for drop zone */\n handleDragOver: (e: DragEvent<HTMLElement>) => void;\n /** Handle drop event for drop zone */\n handleDrop: (e: DragEvent<HTMLElement>) => void;\n /** Handle file input change event */\n handleFileChange: (e: ChangeEvent<HTMLInputElement>) => void;\n /** Programmatically open the file dialog */\n openFileDialog: () => void;\n /** Get props for the file input element */\n getInputProps: (\n props?: InputHTMLAttributes<HTMLInputElement>,\n ) => InputHTMLAttributes<HTMLInputElement> & {\n ref: React.Ref<HTMLInputElement>;\n };\n};\n\nconst EMPTY_INITIAL_FILES: FileMetadata[] = [];\n\n/**\n * Hook for comprehensive file upload functionality with drag & drop support\n *\n * Features:\n * - Single and multiple file upload support\n * - Drag and drop functionality\n * - File validation (size, type, count)\n * - Preview generation for images\n * - Error handling and state management\n * - Duplicate file detection\n * - Memory cleanup for object URLs\n *\n * @param options - Configuration options for the file upload hook\n * @returns Tuple containing current state and available actions\n *\n * @example\n * ```tsx\n * const [state, actions] = useFileUpload({\n * maxFiles: 5,\n * maxSize: 10 * 1024 * 1024, // 10MB\n * accept: 'image/*',\n * multiple: true,\n * onFilesChange: (files) => console.log('Files changed:', files),\n * onFilesAdded: (newFiles) => console.log('New files added:', newFiles)\n * });\n *\n * return (\n * <div\n * onDragEnter={actions.handleDragEnter}\n * onDragLeave={actions.handleDragLeave}\n * onDragOver={actions.handleDragOver}\n * onDrop={actions.handleDrop}\n * >\n * <input {...actions.getInputProps()} />\n * <button onClick={actions.openFileDialog}>\n * Upload Files\n * </button>\n * {state.files.map(file => (\n * <div key={file.id}>\n * {file.file.name}\n * <button onClick={() => actions.removeFile(file.id)}>\n * Remove\n * </button>\n * </div>\n * ))}\n * </div>\n * );\n * ```\n */\nexport const useFileUpload = (\n options: FileUploadOptions = {},\n): [FileUploadState, FileUploadActions] => {\n const {\n maxFiles = Number.POSITIVE_INFINITY,\n maxSize = Number.POSITIVE_INFINITY,\n accept = \"*\",\n multiple = false,\n initialFiles = EMPTY_INITIAL_FILES,\n onFilesChange,\n onFilesAdded,\n onError,\n } = options;\n\n /** Current state of the file upload component */\n const [state, setState] = useState<FileUploadState>({\n files: initialFiles.map((file) => ({\n file,\n id: file.id,\n preview: file.url,\n })),\n isDragging: false,\n errors: [],\n });\n\n /** Reference to the hidden file input element */\n const inputRef = useRef<HTMLInputElement>(null);\n const filesRef = useRef<FileWithPreview[]>([]);\n\n useEffect(() => {\n filesRef.current = state.files;\n }, [state.files]);\n\n useEffect(() => {\n setState((prev) => ({\n ...prev,\n files: initialFiles.map((file) => ({\n file,\n id: file.id,\n preview: file.url,\n })),\n errors: [],\n }));\n }, [initialFiles]);\n\n useEffect(() => {\n return () => {\n filesRef.current.forEach((file) => {\n if (file.preview && file.file instanceof File && file.file.type.startsWith(\"image/\")) {\n URL.revokeObjectURL(file.preview);\n }\n });\n };\n }, []);\n\n /**\n * Validate a file against the configured constraints\n *\n * @param file - The file to validate (File object or FileMetadata)\n * @returns Error message if validation fails, null if valid\n */\n const validateFile = useCallback(\n (file: File | FileMetadata): string | null => {\n if (file.size > maxSize) {\n return `File \"${file.name}\" exceeds the maximum size of ${formatBytes(maxSize)}.`;\n }\n\n if (accept !== \"*\") {\n const acceptedTypes = accept.split(\",\").map((type) => type.trim());\n const fileType = file instanceof File ? file.type || \"\" : file.type;\n const fileExtension = `.${file.name.split(\".\").pop()}`;\n\n const isAccepted = acceptedTypes.some((type) => {\n if (type.startsWith(\".\")) {\n return fileExtension.toLowerCase() === type.toLowerCase();\n }\n if (type.endsWith(\"/*\")) {\n const baseType = type.split(\"/\")[0];\n return fileType.startsWith(`${baseType}/`);\n }\n return fileType === type;\n });\n\n if (!isAccepted) {\n return `File \"${file.name}\" is not an accepted file type.`;\n }\n }\n\n return null;\n },\n [accept, maxSize],\n );\n\n /**\n * Create a preview URL for a file\n *\n * @param file - The file to create a preview for\n * @returns Preview URL string or undefined\n */\n const createPreview = useCallback((file: File | FileMetadata): string | undefined => {\n if (file instanceof File) {\n if (file.type.startsWith(\"image/\")) {\n return URL.createObjectURL(file);\n }\n return undefined;\n }\n return file.url;\n }, []);\n\n /**\n * Generate a unique identifier for a file\n *\n * @param file - The file to generate an ID for\n * @returns Unique identifier string\n */\n const generateUniqueId = useCallback((file: File | FileMetadata): string => {\n if (file instanceof File) {\n return `${file.name}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;\n }\n return file.id;\n }, []);\n\n /**\n * Clear all files from the upload state\n * Also cleans up object URLs to prevent memory leaks\n */\n const clearFiles = useCallback(() => {\n setState((prev) => {\n // Clean up object URLs\n for (const file of prev.files) {\n if (file.preview && file.file instanceof File && file.file.type.startsWith(\"image/\")) {\n URL.revokeObjectURL(file.preview);\n }\n }\n\n if (inputRef.current) {\n inputRef.current.value = \"\";\n }\n\n const newState = {\n ...prev,\n files: [],\n errors: [],\n };\n\n onFilesChange?.(newState.files);\n return newState;\n });\n }, [onFilesChange]);\n\n /**\n * Add new files to the upload state\n * Handles validation, duplicate detection, and state updates\n *\n * @param newFiles - FileList or array of File objects to add\n */\n const addFiles = useCallback(\n (newFiles: FileList | File[]) => {\n if (!newFiles || newFiles.length === 0) return;\n\n const newFilesArray = Array.from(newFiles);\n const errors: string[] = [];\n\n const validFiles: FileWithPreview[] = [];\n\n for (const file of newFilesArray) {\n const error = validateFile(file);\n if (error) {\n errors.push(error);\n } else {\n validFiles.push({\n file,\n id: generateUniqueId(file),\n preview: createPreview(file),\n });\n }\n }\n\n setState((prev) => {\n const baseFiles = multiple ? prev.files : [];\n const dedupedFiles = multiple\n ? validFiles.filter(\n (file) =>\n !baseFiles.some(\n (existingFile) =>\n existingFile.file.name === file.file.name &&\n existingFile.file.size === file.file.size,\n ),\n )\n : validFiles;\n\n if (\n multiple &&\n maxFiles !== Number.POSITIVE_INFINITY &&\n baseFiles.length + dedupedFiles.length > maxFiles\n ) {\n const nextErrors = [`You can only upload a maximum of ${maxFiles} files.`];\n onError?.(nextErrors);\n return { ...prev, errors: nextErrors };\n }\n\n if (!multiple) {\n prev.files.forEach((file) => {\n if (file.preview && file.file instanceof File && file.file.type.startsWith(\"image/\")) {\n URL.revokeObjectURL(file.preview);\n }\n });\n }\n\n const nextFiles = !multiple ? dedupedFiles : [...baseFiles, ...dedupedFiles];\n if (dedupedFiles.length > 0) {\n onFilesAdded?.(dedupedFiles);\n onFilesChange?.(nextFiles);\n }\n if (errors.length > 0) {\n onError?.(errors);\n }\n\n return {\n ...prev,\n files: nextFiles,\n errors,\n };\n });\n\n // Reset input value after handling files\n if (inputRef.current) {\n inputRef.current.value = \"\";\n }\n },\n [\n maxFiles,\n multiple,\n validateFile,\n createPreview,\n generateUniqueId,\n onFilesChange,\n onFilesAdded,\n onError,\n ],\n );\n\n /**\n * Remove a specific file from the upload state\n * Also cleans up object URLs to prevent memory leaks\n *\n * @param id - The unique identifier of the file to remove\n */\n const removeFile = useCallback(\n (id: string) => {\n setState((prev) => {\n const fileToRemove = prev.files.find((file) => file.id === id);\n if (\n fileToRemove?.preview &&\n fileToRemove.file instanceof File &&\n fileToRemove.file.type.startsWith(\"image/\")\n ) {\n URL.revokeObjectURL(fileToRemove.preview);\n }\n\n const newFiles = prev.files.filter((file) => file.id !== id);\n onFilesChange?.(newFiles);\n\n return {\n ...prev,\n files: newFiles,\n errors: [],\n };\n });\n },\n [onFilesChange],\n );\n\n /**\n * Clear all error messages from the state\n */\n const clearErrors = useCallback(() => {\n setState((prev) => ({\n ...prev,\n errors: [],\n }));\n }, []);\n\n /**\n * Handle drag enter event for the drop zone\n * Sets the dragging state to true\n *\n * @param e - The drag event\n */\n const handleDragEnter = useCallback((e: DragEvent<HTMLElement>) => {\n e.preventDefault();\n e.stopPropagation();\n setState((prev) => ({ ...prev, isDragging: true }));\n }, []);\n\n /**\n * Handle drag leave event for the drop zone\n * Sets the dragging state to false when leaving the drop zone\n *\n * @param e - The drag event\n */\n const handleDragLeave = useCallback((e: DragEvent<HTMLElement>) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (e.currentTarget.contains(e.relatedTarget as Node)) {\n return;\n }\n\n setState((prev) => ({ ...prev, isDragging: false }));\n }, []);\n\n /**\n * Handle drag over event for the drop zone\n * Prevents default behavior to allow dropping\n *\n * @param e - The drag event\n */\n const handleDragOver = useCallback((e: DragEvent<HTMLElement>) => {\n e.preventDefault();\n e.stopPropagation();\n }, []);\n\n /**\n * Handle drop event for the drop zone\n * Processes dropped files and adds them to the upload state\n *\n * @param e - The drag event containing the dropped files\n */\n const handleDrop = useCallback(\n (e: DragEvent<HTMLElement>) => {\n e.preventDefault();\n e.stopPropagation();\n setState((prev) => ({ ...prev, isDragging: false }));\n\n // Don't process files if the input is disabled\n if (inputRef.current?.disabled) {\n return;\n }\n\n if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {\n // In single file mode, only use the first file\n if (!multiple) {\n const file = e.dataTransfer.files[0];\n addFiles([file]);\n } else {\n addFiles(e.dataTransfer.files);\n }\n }\n },\n [addFiles, multiple],\n );\n\n /**\n * Handle file input change event\n * Processes selected files from the file input\n *\n * @param e - The change event from the file input\n */\n const handleFileChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.files && e.target.files.length > 0) {\n addFiles(e.target.files);\n }\n },\n [addFiles],\n );\n\n /**\n * Programmatically open the file dialog\n * Triggers the hidden file input click event\n */\n const openFileDialog = useCallback(() => {\n if (inputRef.current) {\n inputRef.current.click();\n }\n }, []);\n\n /**\n * Get props for the file input element\n * Returns properly configured input props with event handlers\n *\n * @param props - Optional additional props for the input element\n * @returns Input props object with ref and event handlers\n */\n const getInputProps = useCallback(\n (props: InputHTMLAttributes<HTMLInputElement> = {}) => {\n return {\n ...props,\n type: \"file\" as const,\n onChange: handleFileChange,\n accept: props.accept || accept,\n multiple: props.multiple !== undefined ? props.multiple : multiple,\n ref: inputRef,\n };\n },\n [accept, multiple, handleFileChange],\n );\n\n return [\n state,\n {\n addFiles,\n removeFile,\n clearFiles,\n clearErrors,\n handleDragEnter,\n handleDragLeave,\n handleDragOver,\n handleDrop,\n handleFileChange,\n openFileDialog,\n getInputProps,\n },\n ];\n};\n\n/**\n * Helper function to format bytes to human-readable format\n *\n * @param bytes - The number of bytes to format\n * @param decimals - Number of decimal places to show (default: 2)\n * @returns Formatted string with appropriate unit (e.g., \"1.5 MB\")\n *\n * @example\n * ```tsx\n * formatBytes(1024); // \"1 KB\"\n * formatBytes(1536, 1); // \"1.5 KB\"\n * formatBytes(1048576); // \"1 MB\"\n * ```\n */\nexport const formatBytes = (bytes: number, decimals = 2): string => {\n if (bytes === 0) return \"0 Bytes\";\n\n const k = 1024;\n const dm = decimals < 0 ? 0 : decimals;\n const sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\", \"ZB\", \"YB\"];\n\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n\n return `${Number.parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;\n};\n","/**\n * Hydration state hook for React components\n * Returns a boolean indicating whether the component is running on the client\n * with SSR-safe behavior to prevent hydration mismatches.\n *\n * This hook leverages `useSyncExternalStore` to provide a stable value between\n * server and client renders: `false` during SSR, `true` after client hydration.\n * The external store does not emit updates because the hydration state is static\n * for the lifetime of the component.\n */\n\"use client\";\n\nimport { useSyncExternalStore } from \"react\";\n\n/**\n * Hook that indicates whether code is executing on the client after hydration\n *\n * Features:\n * - SSR-safe: returns `false` on the server to avoid hydration mismatches\n * - Client-stable: returns `true` after hydration and remains stable\n * - Minimal overhead: uses a no-op external store subscription\n *\n * @returns Boolean indicating hydration state (`true` on client, `false` on server)\n *\n * @example\n * ```tsx\n * // Conditionally render client-only components safely\n * function ClientOnly() {\n * const hydrated = useHydrated();\n * if (!hydrated) return null;\n * return <InteractiveChart />;\n * }\n * ```\n *\n * @since 1.0.0\n */\nexport function useHydrated() {\n return useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\n/**\n * External store subscription used by `useHydrated`\n * No updates are dispatched because hydration state is static.\n * Returns an unsubscribe function for API conformity.\n */\nfunction subscribe() {\n return () => {};\n}\n","/**\n * Intersection observer hook for React components\n * Efficiently observes visibility of DOM elements using a shared IntersectionObserver instance.\n * Ideal for lazy loading, infinite scrolling, and animating elements when they enter the viewport.\n */\n\n\"use client\";\n\nimport * as React from \"react\";\n\n/**\n * Configuration options for the `useIntersectionObserver` hook.\n *\n * Extends the native `IntersectionObserverInit` options with an additional\n * convenience flag for freezing the observer state.\n */\ninterface IntersectionObserverOptions extends IntersectionObserverInit {\n /**\n * When `true`, the hook stops observing once the element becomes visible\n * and keeps returning `true` for subsequent renders.\n *\n * This is useful for one-time animations or lazy loading where you only\n * care about the first time an element enters the viewport.\n */\n freezeOnceVisible?: boolean;\n}\n\n/**\n * A shared intersection observer to manage multiple targets with a single observer instance.\n * Optimized for high-density lists (like the patterns grid).\n */\nclass SharedObserver {\n private observer: IntersectionObserver | null = null;\n private callbacks = new Map<Element, (isIntersecting: boolean) => void>();\n private options: IntersectionObserverInit;\n\n constructor(options: IntersectionObserverInit) {\n this.options = options;\n }\n\n private getObserver() {\n if (!this.observer) {\n this.observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n const callback = this.callbacks.get(entry.target);\n if (callback) {\n callback(entry.isIntersecting);\n }\n });\n }, this.options);\n }\n return this.observer;\n }\n\n observe(element: Element, callback: (isIntersecting: boolean) => void) {\n this.callbacks.set(element, callback);\n this.getObserver().observe(element);\n }\n\n unobserve(element: Element) {\n this.callbacks.delete(element);\n this.observer?.unobserve(element);\n }\n\n get size() {\n return this.callbacks.size;\n }\n\n disconnect() {\n this.observer?.disconnect();\n this.callbacks.clear();\n this.observer = null;\n }\n}\n\n// Singleton instances for common observer options to maximize reuse.\nconst observers = new Map<string, SharedObserver>();\nconst rootIds = new WeakMap<Element, number>();\nlet rootId = 0;\n\nfunction getRootKey(root: Element | Document | null | undefined) {\n if (!root) return \"null\";\n if (!rootIds.has(root as Element)) {\n rootIds.set(root as Element, ++rootId);\n }\n return rootIds.get(root as Element);\n}\n\n/**\n * Get or create a shared `IntersectionObserver` instance based on the provided options.\n *\n * Using a shared observer reduces the number of underlying `IntersectionObserver`\n * instances created by the browser, which is especially beneficial for pages\n * with many observed elements.\n *\n * @param options - Intersection observer configuration (threshold, root, rootMargin)\n * @returns A shared `SharedObserver` instance for the given options\n */\nfunction getSharedObserver(options: IntersectionObserverInit) {\n const threshold = Array.isArray(options.threshold)\n ? options.threshold.join(\",\")\n : (options.threshold ?? 0);\n const key = `${getRootKey(options.root)}|${options.rootMargin ?? \"0px\"}|${threshold}`;\n if (!observers.has(key)) {\n observers.set(key, new SharedObserver(options));\n }\n return { key, observer: observers.get(key)! };\n}\n\n/**\n * React hook that tracks whether a DOM element is currently intersecting the viewport.\n *\n * Features:\n * - Uses a shared `IntersectionObserver` instance for better performance.\n * - Supports custom `threshold`, `root`, and `rootMargin` options.\n * - Optional `freezeOnceVisible` flag to stop observing after first intersection.\n *\n * @param elementRef - React ref pointing to the DOM element to observe.\n * @param options - Optional observer configuration and behavior flags.\n * @param options.threshold - Intersection threshold(s) for triggering visibility changes.\n * @param options.root - Scrollable ancestor element to use as the viewport (defaults to browser viewport).\n * @param options.rootMargin - Margin around the root, expressed in CSS units (e.g. `\"0px 0px -20% 0px\"`).\n * @param options.freezeOnceVisible - When `true`, stops observing after the element first becomes visible.\n *\n * @returns `true` when the element is intersecting based on the given options, otherwise `false`.\n *\n * @example\n * ```tsx\n * const ref = React.useRef<HTMLDivElement | null>(null);\n * const isVisible = useIntersectionObserver(ref, {\n * threshold: 0.2,\n * rootMargin: \"0px 0px -10% 0px\",\n * freezeOnceVisible: true,\n * });\n *\n * return (\n * <div ref={ref} className={isVisible ? \"animate-in\" : \"opacity-0\"}>\n * I will animate when I enter the viewport.\n * </div>\n * );\n * ```\n */\nexport function useIntersectionObserver(\n elementRef: React.RefObject<Element | null>,\n {\n threshold = 0,\n root = null,\n rootMargin = \"0%\",\n freezeOnceVisible = false,\n }: IntersectionObserverOptions = {},\n): boolean {\n const [isIntersecting, setIntersecting] = React.useState(false);\n const frozen = React.useRef(false);\n\n React.useEffect(() => {\n const element = elementRef?.current;\n if (!element || (freezeOnceVisible && frozen.current)) return;\n if (typeof IntersectionObserver === \"undefined\") return;\n\n const { key, observer } = getSharedObserver({ threshold, root, rootMargin });\n\n observer.observe(element, (intersecting) => {\n setIntersecting(intersecting);\n if (intersecting && freezeOnceVisible) {\n frozen.current = true;\n observer.unobserve(element);\n }\n });\n\n return () => {\n observer.unobserve(element);\n if (observer.size === 0) {\n observer.disconnect();\n observers.delete(key);\n }\n };\n }, [elementRef, threshold, root, rootMargin, freezeOnceVisible]);\n\n return isIntersecting;\n}\n","/**\n * Platform detection hook for React components\n * Determines whether the current user agent is running on a macOS device.\n * Useful for rendering platform-specific keyboard shortcuts or UI variations.\n */\n\n\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\n/**\n * React hook that returns whether the current browser reports a macOS platform.\n * It prefers `navigator.userAgentData.platform` when available and falls back\n * to `navigator.userAgent`.\n *\n * @returns `true` if the current platform is macOS, otherwise `false`.\n *\n * @example\n * ```tsx\n * const isMac = useIsMac();\n *\n * return (\n * <kbd>\n * {isMac ? \"⌘\" : \"Ctrl\"} + K\n * </kbd>\n * );\n * ```\n */\nexport function useIsMac() {\n const [isMac, setIsMac] = useState(false);\n\n useEffect(() => {\n const platform =\n (navigator as Navigator & { userAgentData?: { platform?: string } }).userAgentData\n ?.platform ??\n navigator.userAgent ??\n \"\";\n setIsMac(platform.toUpperCase().includes(\"MAC\"));\n }, []);\n\n return isMac;\n}\n","/**\n * Media query hook for responsive React components\n * Provides real-time tracking of CSS media query matches\n * with SSR-safe implementation and automatic cleanup\n */\n\n\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\n/**\n * Helper function to safely check media query matches\n * Prevents SSR hydration issues by checking for window availability\n *\n * @param query - CSS media query string to evaluate\n * @returns Boolean indicating if the media query matches\n */\nconst getMatches = (query: string): boolean => {\n // Prevents SSR issues by checking for window availability\n if (typeof window !== \"undefined\") {\n return window.matchMedia(query).matches;\n }\n // Return false during SSR to prevent hydration mismatches\n return false;\n};\n\n/**\n * Hook for tracking CSS media query matches in React components\n *\n * Features:\n * - Real-time updates when media query state changes\n * - SSR-safe implementation\n * - Automatic event listener cleanup\n * - Supports all standard CSS media queries\n *\n * @param query - CSS media query string (e.g., '(min-width: 768px)')\n * @returns Boolean indicating whether the media query currently matches\n *\n * @example\n * ```tsx\n * // Basic responsive behavior\n * const isMobile = useMediaQuery('(max-width: 768px)');\n * const isTablet = useMediaQuery('(min-width: 769px) and (max-width: 1024px)');\n * const isDesktop = useMediaQuery('(min-width: 1025px)');\n *\n * // Dark mode preference\n * const prefersDark = useMediaQuery('(prefers-color-scheme: dark)');\n *\n * // Reduced motion preference\n * const prefersReducedMotion = useMediaQuery('(prefers-reduced-motion: reduce)');\n *\n * return (\n * <div>\n * {isMobile && <MobileLayout />}\n * {isTablet && <TabletLayout />}\n * {isDesktop && <DesktopLayout />}\n * </div>\n * );\n * ```\n */\nconst useMediaQuery = (query: string): boolean => {\n /** State to track current media query match status */\n const [matches, setMatches] = useState<boolean>(false);\n\n useEffect(() => {\n /**\n * Handler function to update matches state when media query changes\n */\n function handleChange() {\n setMatches(getMatches(query));\n }\n\n // Create MediaQueryList object for the given query\n const matchMedia = window.matchMedia(query);\n\n // Set initial state on client-side mount and when query changes\n handleChange();\n\n // Add event listener for media query changes\n matchMedia.addEventListener(\"change\", handleChange);\n\n // Cleanup function to remove event listener\n return () => {\n matchMedia.removeEventListener(\"change\", handleChange);\n };\n }, [query]); // Re-run effect when query changes\n\n return matches;\n};\n\nexport { useMediaQuery };\n","/**\n * Menu navigation utilities hook for dashboard layouts\n * Provides comprehensive menu state management and navigation helpers\n * Handles active states, breadcrumbs, and hierarchical menu structures\n */\n\n\"use client\";\n\nimport type { ComponentType, SVGProps } from \"react\";\n\n/**\n * Menu item interface\n */\ninterface MenuItem {\n /** Heading text */\n heading?: string;\n /** Menu item title */\n title?: string;\n /** Navigation path */\n path?: string;\n /** Menu item icon component */\n icon?: ComponentType<SVGProps<SVGSVGElement>>;\n /** Whether to show separator */\n separator?: boolean;\n\n /** Root path for active state matching */\n rootPath?: string;\n /** Child menu items */\n children?: MenuConfig;\n /** Children index for nested items */\n childrenIndex?: number;\n\n /** Whether the item is external */\n external?: boolean;\n /** Whether the item is disabled */\n disabled?: boolean;\n /** Disable text */\n disabledText?: string;\n\n /** Badge text */\n badge?: string;\n /** Badge variant */\n badgeVariant?:\n | \"primary\"\n | \"destructive\"\n | \"success\"\n | \"info\"\n | \"warning\"\n | \"secondary\"\n | \"outline\";\n\n /** Collapse configuration */\n collapse?: boolean;\n /** Title when collapsed */\n collapseTitle?: string;\n /** Title when expanded */\n expandTitle?: string;\n}\n\n/**\n * Type aliases for backward compatibility\n */\ntype MenuConfig = MenuItem[];\n\n/** Return type interface for useMenu hook */\ninterface UseMenuReturn {\n /** Check if a specific path is currently active */\n isActive: (path: string | undefined) => boolean;\n /** Check if any child menu item is currently active */\n hasActiveChild: (children: MenuItem[] | undefined) => boolean;\n /** Check if a menu item (including its children) is currently active */\n isItemActive: (item: MenuItem) => boolean;\n /** Get the currently active menu item from the menu configuration */\n getCurrentItem: (items: MenuConfig) => MenuItem | undefined;\n /** Generate breadcrumb trail for the current active path */\n getBreadcrumb: (items: MenuConfig) => MenuItem[];\n /** Get child menu items at a specific level for the current active path */\n getChildren: (items: MenuConfig, level: number) => MenuConfig | null;\n}\n\n/**\n * Hook for managing menu navigation state and utilities\n *\n * This hook provides comprehensive menu management functionality including:\n * - Active state detection for menu items and paths\n * - Hierarchical menu navigation support\n * - Breadcrumb generation for current navigation path\n * - Child menu extraction at specific levels\n * - Support for nested menu structures\n *\n * @param pathname - Current pathname from router or location\n * @returns Object containing menu utility functions\n *\n * @example\n * ```tsx\n * const { isActive, getBreadcrumb, getCurrentItem } = useMenu(pathname);\n *\n * // Check if path is active\n * const isHomeActive = isActive('/dashboard');\n *\n * // Get breadcrumb for current path\n * const breadcrumb = getBreadcrumb(menuItems);\n *\n * // Get current active menu item\n * const currentItem = getCurrentItem(menuItems);\n * ```\n */\nexport const useMenu = (pathname: string): UseMenuReturn => {\n /**\n * Check if a specific path matches the current pathname\n * Handles root path ('/') as exact match, others as prefix match\n *\n * @param path - The path to check against current pathname\n * @returns True if the path is currently active\n */\n const isActive = (path: string | undefined): boolean => {\n if (path && path === \"/\") {\n return path === pathname;\n } else {\n return !!path && pathname.startsWith(path);\n }\n };\n\n /**\n * Recursively check if any child menu item is currently active\n * Traverses through nested menu structures to find active children\n *\n * @param children - Array of child menu items to check\n * @returns True if any child or nested child is active\n */\n const hasActiveChild = (children: MenuItem[] | undefined): boolean => {\n if (!children || !Array.isArray(children)) return false;\n return children.some(\n (child: MenuItem) =>\n (child.path && isActive(child.path)) || (child.children && hasActiveChild(child.children)),\n );\n };\n\n /**\n * Check if a menu item is active (either directly or through its children)\n * Combines direct path matching with child activity detection\n *\n * @param item - The menu item to check for activity\n * @returns True if the item or any of its children are active\n */\n const isItemActive = (item: MenuItem): boolean => {\n return (\n (item.path ? isActive(item.path) : false) ||\n (item.children ? hasActiveChild(item.children) : false)\n );\n };\n\n /**\n * Find and return the currently active menu item from the menu configuration\n * Recursively searches through menu hierarchy to find the most specific active item\n * Prioritizes deeper nested items over parent items when both are active\n *\n * @param items - Array of menu items to search through\n * @returns The currently active menu item, or undefined if none found\n */\n const getCurrentItem = (items: MenuConfig): MenuItem | undefined => {\n for (const item of items) {\n if (item.path && isActive(item.path)) {\n if (item.children && item.children.length > 0) {\n const childMatch = getCurrentItem(item.children);\n return childMatch || item;\n }\n return item;\n }\n if (item.children && item.children.length > 0) {\n const childMatch = getCurrentItem(item.children);\n if (childMatch) {\n return childMatch;\n }\n }\n }\n return undefined;\n };\n\n /**\n * Generate breadcrumb trail for the current active path\n * Creates an array of menu items representing the navigation path from root to current item\n * Useful for displaying navigation breadcrumbs in the UI\n *\n * @param items - Array of menu items to generate breadcrumb from\n * @returns Array of menu items representing the breadcrumb trail\n */\n const getBreadcrumb = (items: MenuConfig): MenuItem[] => {\n const findBreadcrumb = (nodes: MenuItem[], breadcrumb: MenuItem[] = []): MenuItem[] => {\n for (const item of nodes) {\n const currentBreadcrumb = [...breadcrumb, item];\n\n // If item has children, recurse and check them\n if (item.children && item.children.length > 0) {\n const childBreadcrumb = findBreadcrumb(item.children, currentBreadcrumb);\n if (childBreadcrumb.length > currentBreadcrumb.length) {\n return childBreadcrumb; // Return the deeper breadcrumb if found\n }\n }\n\n // Check this item after children so nested routes win over parent prefixes.\n if (item.path && isActive(item.path)) {\n return currentBreadcrumb;\n }\n }\n return breadcrumb; // Return current breadcrumb if no match found\n };\n\n const breadcrumb = findBreadcrumb(items);\n return breadcrumb.length > 0 ? breadcrumb : [];\n };\n\n /**\n * Get child menu items at a specific hierarchical level for the current active path\n * Traverses the menu structure to find children at the specified depth level\n * Useful for displaying sub-navigation menus at different levels\n *\n * @param items - Array of menu items to search through\n * @param level - The hierarchical level to get children from (0-based)\n * @returns Array of child menu items at the specified level, or null if none found\n */\n const getChildren = (items: MenuConfig, level: number): MenuConfig | null => {\n const hasActiveChildAtLevel = (items: MenuConfig): boolean => {\n for (const item of items) {\n if (\n (item.path &&\n (item.path === pathname ||\n (item.path !== \"/\" && item.path !== \"\" && pathname.startsWith(item.path)))) ||\n (item.children && hasActiveChildAtLevel(item.children))\n ) {\n return true;\n }\n }\n return false;\n };\n\n const findChildren = (\n items: MenuConfig,\n targetLevel: number,\n currentLevel: number = 0,\n ): MenuConfig | null => {\n for (const item of items) {\n if (item.children) {\n if (targetLevel === currentLevel && hasActiveChildAtLevel(item.children)) {\n return item.children;\n }\n const children = findChildren(item.children, targetLevel, currentLevel + 1);\n if (children) {\n return children;\n }\n } else if (\n targetLevel === currentLevel &&\n item.path &&\n (item.path === pathname ||\n (item.path !== \"/\" && item.path !== \"\" && pathname.startsWith(item.path)))\n ) {\n return items;\n }\n }\n return null;\n };\n\n return findChildren(items, level);\n };\n\n return {\n isActive,\n hasActiveChild,\n isItemActive,\n getCurrentItem,\n getBreadcrumb,\n getChildren,\n };\n};\n","/**\n * Meta theme color management hook for React components.\n */\n\n\"use client\";\n\nimport * as React from \"react\";\nimport { useTheme } from \"next-themes\";\n\nimport { META_THEME_COLORS, THEME_MODES } from \"@kumix/utils\";\n\n/**\n * Calculates and applies the HTML `theme-color` meta tag from `next-themes`.\n * The returned setter can be used for temporary manual overrides.\n *\n * @param defaultColors - Optional custom color configuration (defaults to META_THEME_COLORS)\n * @returns Object containing current meta color and setter function.\n *\n * @example\n * ```tsx\n * // Basic usage with default colors (supports light, dark, and system)\n * function App() {\n * const { metaColor, setMetaColor } = useMetaColor();\n *\n * // metaColor automatically updates based on theme (light/dark/system)\n * useEffect(() => {\n * console.log('Current meta color:', metaColor);\n * }, [metaColor]);\n *\n * return <div>App content</div>;\n * }\n *\n * // Custom colors with system theme support\n * function CustomThemeApp() {\n * const customColors = {\n * light: '#f0f0f0',\n * dark: '#1a1a1a',\n * system: 'auto' // Will resolve to light or dark based on OS preference\n * };\n * const { metaColor } = useMetaColor(customColors);\n *\n * return <div style={{ backgroundColor: metaColor }}>Custom themed app</div>;\n * }\n *\n * // Manual meta color override for special pages\n * function SpecialPage() {\n * const { setMetaColor } = useMetaColor();\n *\n * useEffect(() => {\n * // Override meta color for this page\n * setMetaColor('#ff0000');\n *\n * // Cleanup: reset to theme color when leaving page\n * return () => {\n * setMetaColor(''); // This will revert to theme-based color\n * };\n * }, [setMetaColor]);\n *\n * return <div>Special page with red theme color</div>;\n * }\n *\n * // Integration with theme switcher\n * function ThemeAwareComponent() {\n * const { theme, setTheme } = useTheme();\n * const { metaColor } = useMetaColor();\n *\n * return (\n * <div>\n * <p>Current theme: {theme}</p>\n * <p>Meta color: {metaColor}</p>\n * <button onClick={() => setTheme('light')}>Light</button>\n * <button onClick={() => setTheme('dark')}>Dark</button>\n * <button onClick={() => setTheme('system')}>System</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function useMetaColor(defaultColors?: typeof META_THEME_COLORS) {\n /** Get resolved theme from next-themes */\n const { resolvedTheme } = useTheme();\n\n /**\n * Helper function to detect system dark mode preference\n */\n const isSystemDarkMode = React.useCallback(() => {\n if (typeof window === \"undefined\") return false;\n return window.matchMedia(\"(prefers-color-scheme: dark)\").matches;\n }, []);\n\n /**\n * Get effective theme mode (resolves 'system' to actual preference)\n */\n const getEffectiveTheme = React.useCallback(\n (theme: string | undefined) => {\n if (theme === THEME_MODES.SYSTEM) {\n return isSystemDarkMode() ? THEME_MODES.DARK : THEME_MODES.LIGHT;\n }\n return theme;\n },\n [isSystemDarkMode],\n );\n\n /**\n * Calculate appropriate meta color based on current theme\n * Handles light, dark, and system themes properly\n * Memoized to prevent unnecessary recalculations\n */\n const metaColor = React.useMemo(() => {\n const colorsToUse = defaultColors ?? META_THEME_COLORS;\n\n // Get the effective theme (resolves system to light/dark)\n const effectiveTheme = getEffectiveTheme(resolvedTheme);\n\n // Handle different theme modes\n if (effectiveTheme === THEME_MODES.DARK) {\n return colorsToUse[THEME_MODES.DARK];\n } else if (effectiveTheme === THEME_MODES.LIGHT) {\n return colorsToUse[THEME_MODES.LIGHT];\n }\n\n // Fallback to light theme if resolvedTheme is undefined (during hydration)\n return colorsToUse[THEME_MODES.LIGHT];\n }, [resolvedTheme, defaultColors, getEffectiveTheme]);\n\n /**\n * Manually set meta theme color in the document\n * Useful for temporary color overrides or custom scenarios\n *\n * @param color - Hex color string to set as meta theme color\n */\n const setMetaColor = React.useCallback((color: string) => {\n // Find and update the meta theme-color tag\n const metaTag = document.querySelector('meta[name=\"theme-color\"]');\n if (metaTag) {\n metaTag.setAttribute(\"content\", color);\n } else {\n // Create meta tag if it doesn't exist\n const newMetaTag = document.createElement(\"meta\");\n newMetaTag.name = \"theme-color\";\n newMetaTag.content = color;\n document.head.appendChild(newMetaTag);\n }\n }, []);\n\n React.useEffect(() => {\n setMetaColor(metaColor);\n }, [metaColor, setMetaColor]);\n\n return {\n /** Current meta theme color based on resolved theme */\n metaColor,\n /** Function to manually set meta theme color */\n setMetaColor,\n };\n}\n","/**\n * DOM Mutation Observer hook for React components\n * Provides a React-friendly interface for observing DOM changes\n * with automatic cleanup and ref integration\n */\n\n\"use client\";\n\nimport * as React from \"react\";\n\n/**\n * Default options for MutationObserver\n * Observes all types of mutations by default\n */\nconst DEFAULT_OPTIONS: MutationObserverInit = {\n /** Watch for attribute changes */\n attributes: true,\n /** Watch for text content changes */\n characterData: true,\n /** Watch for child element additions/removals */\n childList: true,\n /** Watch for changes in descendant elements */\n subtree: true,\n};\n\n/**\n * Hook to observe DOM mutations on a referenced element\n *\n * This hook provides a React-friendly way to use the MutationObserver API.\n * It automatically handles observer creation, cleanup, and ref management.\n * Useful for detecting DOM changes that occur outside of React's control.\n *\n * Features:\n * - Automatic observer lifecycle management\n * - Configurable observation options\n * - Ref-based element targeting\n * - Automatic cleanup on unmount\n *\n * @param ref - React ref pointing to the element to observe\n * @param callback - Function called when mutations are detected\n * @param options - MutationObserver configuration options\n *\n * @example\n * ```tsx\n * function DynamicContent() {\n * const contentRef = useRef<HTMLDivElement>(null);\n *\n * // Watch for any changes to the content div\n * useMutationObserver(\n * contentRef,\n * (mutations) => {\n * mutations.forEach((mutation) => {\n * console.log('DOM changed:', mutation.type);\n * });\n * }\n * );\n *\n * return <div ref={contentRef}>Dynamic content here</div>;\n * }\n *\n * // Watch only for attribute changes\n * function AttributeWatcher() {\n * const elementRef = useRef<HTMLElement>(null);\n *\n * useMutationObserver(\n * elementRef,\n * (mutations) => {\n * mutations.forEach((mutation) => {\n * if (mutation.type === 'attributes') {\n * console.log('Attribute changed:', mutation.attributeName);\n * }\n * });\n * },\n * { attributes: true, childList: false, subtree: false }\n * );\n *\n * return <div ref={elementRef}>Watched element</div>;\n * }\n * ```\n */\nexport const useMutationObserver = (\n ref: React.RefObject<HTMLElement | null>,\n callback: MutationCallback,\n options: MutationObserverInit = DEFAULT_OPTIONS,\n) => {\n React.useEffect(() => {\n // Only proceed if ref has a current element\n if (ref.current) {\n // Create new MutationObserver instance\n const observer = new MutationObserver(callback);\n\n // Start observing the target element\n observer.observe(ref.current, options);\n\n // Cleanup function to disconnect observer\n return () => {\n observer.disconnect();\n };\n }\n }, [ref, callback, options]); // Re-run effect when dependencies change\n};\n","/**\n * Google Analytics linker parameter cleanup hook for React\n * Safely removes the GA `_gl` query parameter from the URL after GA initialization.\n */\n\n\"use client\";\n\nimport { useEffect } from \"react\";\n\n/**\n * Hook to remove the Google Analytics `_gl` query parameter from the current URL.\n *\n * GA's cross-domain linker temporarily appends `_gl` to URLs for attribution.\n * Removing it *too early* can break attribution, so this hook waits briefly\n * (≈2 seconds) to allow GA to read it, then strips the param using\n * `history.replaceState` without causing a page reload or React re-render.\n *\n * Behavior:\n * - Runs once on mount.\n * - If `_gl` is present, schedules its removal after ~2000ms.\n * - Uses `window.history.replaceState` to avoid navigation/re-render.\n *\n * @example\n * ```tsx\n * // app/layout.tsx or a top-level client component\n * import { useRemoveGAParams } from '@/hooks/use-remove-ga-params';\n *\n * export default function RootLayout({ children }: { children: React.ReactNode }) {\n * useRemoveGAParams();\n * return <>{children}</>;\n * }\n * ```\n */\nexport function useRemoveGAParams(): void {\n useEffect(() => {\n if (new URL(window.location.href).searchParams.has(\"_gl\")) {\n // Wait for GA to process the linker param before removing it\n const timer = setTimeout(() => {\n const url = new URL(window.location.href);\n url.searchParams.delete(\"_gl\");\n // Avoid a re-render: do not use router.replace here\n window.history.replaceState({}, \"\", url.toString());\n }, 2000);\n\n return () => clearTimeout(timer);\n }\n }, []);\n}\n","/**\n * Scroll position tracking hook for React components\n * Monitors scroll position of window or specific elements\n * with real-time updates and automatic cleanup\n */\n\n\"use client\";\n\nimport { type RefObject, useEffect, useState } from \"react\";\n\n/**\n * Configuration options for the scroll position hook\n */\ninterface UseScrollPositionProps {\n /** Optional ref to a specific scrollable element (defaults to document) */\n targetRef?: RefObject<HTMLElement | Document | undefined>;\n}\n\n/**\n * Hook to track scroll position of window or specific elements\n *\n * This hook provides real-time tracking of scroll position with support\n * for both window scrolling and element-specific scrolling. It automatically\n * handles event listener management and cleanup.\n *\n * Features:\n * - Real-time scroll position tracking\n * - Support for window and element scrolling\n * - Automatic event listener cleanup\n * - SSR-safe implementation\n * - Performance optimized\n *\n * @param options - Configuration options for the hook\n * @returns Current scroll position in pixels\n *\n * @example\n * ```tsx\n * // Track window scroll position\n * function ScrollIndicator() {\n * const scrollPosition = useScrollPosition();\n *\n * return (\n * <div className=\"scroll-indicator\">\n * Scrolled: {scrollPosition}px\n * </div>\n * );\n * }\n *\n * // Track specific element scroll position\n * function ScrollableContent() {\n * const contentRef = useRef<HTMLDivElement>(null);\n * const scrollPosition = useScrollPosition({ targetRef: contentRef });\n *\n * return (\n * <div\n * ref={contentRef}\n * className=\"h-96 overflow-y-auto\"\n * >\n * <div className=\"h-[1000px]\">\n * <p>Scroll position: {scrollPosition}px</p>\n * <p>Long content here...</p>\n * </div>\n * </div>\n * );\n * }\n *\n * // Show/hide header based on scroll\n * function StickyHeader() {\n * const scrollPosition = useScrollPosition();\n * const isVisible = scrollPosition < 100;\n *\n * return (\n * <header className={`transition-transform ${\n * isVisible ? 'translate-y-0' : '-translate-y-full'\n * }`}>\n * Header content\n * </header>\n * );\n * }\n * ```\n */\nconst useScrollPosition = ({ targetRef }: UseScrollPositionProps = {}): number => {\n /** State to track current scroll position */\n const [scrollPosition, setScrollPosition] = useState<number>(0);\n\n useEffect(() => {\n // Determine the target element (fallback to document if not provided)\n const target = targetRef?.current || document;\n\n // Determine the scrollable element (window for document, element for others)\n const scrollable = target === document ? window : target;\n\n /**\n * Update scroll position state\n * Handles both window and element scrolling\n */\n const updatePosition = () => {\n // Get scroll position based on target type\n const scrollY =\n target === document\n ? window.scrollY || window.pageYOffset // Fallback for older browsers\n : (target as HTMLElement).scrollTop;\n\n setScrollPosition(scrollY);\n };\n\n // Add scroll event listener\n scrollable.addEventListener(\"scroll\", updatePosition, { passive: true });\n\n // Set initial scroll position\n updatePosition();\n\n // Cleanup function to remove event listener\n return () => {\n scrollable.removeEventListener(\"scroll\", updatePosition);\n };\n }, [targetRef]); // Re-run effect when targetRef changes\n\n return scrollPosition;\n};\n\nexport { useScrollPosition };\n","/**\n * Dual slider input management hook for React components\n * Provides synchronized state management between range slider and number inputs\n * with validation and boundary enforcement\n */\n\n\"use client\";\n\nimport type * as React from \"react\";\nimport { useCallback, useState } from \"react\";\n\n/**\n * Configuration options for the slider input hook\n */\ninterface UseSliderInputProps {\n /** Minimum allowed value for the range */\n minValue: number;\n /** Maximum allowed value for the range */\n maxValue: number;\n /** Initial values for the range [min, max] */\n initialValue: [number, number];\n}\n\n/**\n * Hook for managing dual slider input with synchronized state\n *\n * This hook provides state management for components that need both\n * a range slider and corresponding number inputs. It handles synchronization\n * between the two input types, validation, and boundary enforcement.\n *\n * Features:\n * - Synchronized slider and input values\n * - Automatic validation and boundary enforcement\n * - Prevents invalid range configurations (min > max)\n * - Optimized with useCallback for performance\n *\n * @param props - Configuration options for the hook\n * @returns Object containing state and handlers for slider and inputs\n *\n * @example\n * ```tsx\n * function PriceRangeFilter() {\n * const {\n * sliderValues,\n * inputValues,\n * handleSliderChange,\n * handleInputChange,\n * validateAndUpdateValue\n * } = useSliderInput({\n * minValue: 0,\n * maxValue: 1000,\n * initialValue: [100, 500]\n * });\n *\n * return (\n * <div className=\"price-range\">\n * <div className=\"inputs\">\n * <input\n * type=\"number\"\n * value={inputValues[0]}\n * onChange={(e) => handleInputChange(e, 0)}\n * onBlur={() => validateAndUpdateValue(inputValues[0], 0)}\n * placeholder=\"Min price\"\n * />\n * <input\n * type=\"number\"\n * value={inputValues[1]}\n * onChange={(e) => handleInputChange(e, 1)}\n * onBlur={() => validateAndUpdateValue(inputValues[1], 1)}\n * placeholder=\"Max price\"\n * />\n * </div>\n *\n * <Slider\n * value={sliderValues}\n * onValueChange={handleSliderChange}\n * min={0}\n * max={1000}\n * step={10}\n * />\n * </div>\n * );\n * }\n * ```\n */\nexport function useSliderInput({ minValue, maxValue, initialValue }: UseSliderInputProps) {\n /** State for slider component values */\n const [sliderValues, setSliderValues] = useState<[number, number]>(initialValue);\n\n /** State for input field values (may temporarily differ from slider) */\n const [inputValues, setInputValues] = useState<[number, number]>(initialValue);\n\n /**\n * Handle slider value changes and sync with input values\n * Called when user interacts with the range slider\n *\n * @param values - New slider values [min, max]\n */\n const handleSliderChange = useCallback((values: [number, number]) => {\n setSliderValues(values);\n setInputValues(values); // Keep inputs in sync with slider\n }, []);\n\n /**\n * Handle input field changes\n * Updates input state without immediately affecting slider\n *\n * @param e - Input change event\n * @param index - Index of the input (0 for min, 1 for max)\n */\n const handleInputChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>, index: 0 | 1) => {\n const newValue = parseFloat(e.target.value);\n\n // Only update if the value is a valid number\n if (!Number.isNaN(newValue)) {\n const updatedInputs = [...inputValues] as [number, number];\n updatedInputs[index] = newValue;\n setInputValues(updatedInputs);\n }\n },\n [inputValues],\n );\n\n /**\n * Validate and update slider values from input\n * Called when input loses focus or user presses Enter\n * Enforces boundaries and prevents invalid ranges\n *\n * @param value - Value to validate and apply\n * @param index - Index of the value (0 for min, 1 for max)\n */\n const validateAndUpdateValue = useCallback(\n (value: number, index: 0 | 1) => {\n const updatedSlider = [...sliderValues] as [number, number];\n\n if (index === 0) {\n // Validate minimum value\n // Ensure it's not less than minValue and not greater than current max\n updatedSlider[0] = Math.max(minValue, Math.min(value, sliderValues[1]));\n } else {\n // Validate maximum value\n // Ensure it's not greater than maxValue and not less than current min\n updatedSlider[1] = Math.min(maxValue, Math.max(value, sliderValues[0]));\n }\n\n // Update both slider and input values to validated values\n setSliderValues(updatedSlider);\n setInputValues(updatedSlider);\n },\n [sliderValues, minValue, maxValue],\n );\n\n return {\n /** Function to manually set slider values */\n setSliderValues,\n /** Function to manually set input values */\n setInputValues,\n /** Current slider values [min, max] */\n sliderValues,\n /** Current input values [min, max] */\n inputValues,\n /** Handler for slider value changes */\n handleSliderChange,\n /** Handler for input field changes */\n handleInputChange,\n /** Function to validate and update values from inputs */\n validateAndUpdateValue,\n };\n}\n","/**\n * Viewport dimensions tracking hook for React components\n * Provides real-time viewport width and height with automatic updates\n * on window resize events with SSR-safe implementation\n */\n\n\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\n/**\n * Type definition for viewport dimensions\n * Returns tuple of [width, height] in pixels\n */\ntype ViewportDimensions = [number, number];\n\n/**\n * Hook to track viewport dimensions with real-time updates\n *\n * This hook provides the current viewport dimensions and automatically\n * updates when the window is resized. It's useful for responsive layouts,\n * conditional rendering based on screen size, and dynamic calculations.\n *\n * Features:\n * - Real-time viewport dimension tracking\n * - Automatic updates on window resize\n * - Performance optimized with passive event listeners\n * - SSR-safe implementation\n * - Returns both width and height\n *\n * @returns Tuple containing [width, height] in pixels\n *\n * @example\n * ```tsx\n * // Basic usage\n * function ResponsiveComponent() {\n * const [width, height] = useViewport();\n *\n * return (\n * <div>\n * <p>Viewport: {width}x{height}</p>\n * {width > 768 ? <DesktopLayout /> : <MobileLayout />}\n * </div>\n * );\n * }\n *\n * // Destructured usage\n * function ViewportInfo() {\n * const [width, height] = useViewport();\n * const aspectRatio = (width / height).toFixed(2);\n *\n * return (\n * <div className=\"viewport-info\">\n * <p>Width: {width}px</p>\n * <p>Height: {height}px</p>\n * <p>Aspect Ratio: {aspectRatio}</p>\n * </div>\n * );\n * }\n *\n * // Conditional rendering based on viewport\n * function AdaptiveGrid() {\n * const [width] = useViewport();\n * const columns = width > 1200 ? 4 : width > 768 ? 3 : width > 480 ? 2 : 1;\n *\n * return (\n * <div className={`grid grid-cols-${columns} gap-4`}>\n * {items.map(item => <GridItem key={item.id} {...item} />)}\n * </div>\n * );\n * }\n * ```\n */\nconst useViewport = (): ViewportDimensions => {\n /**\n * State to track viewport dimensions\n * Initialized with current window dimensions or fallback for SSR\n */\n const [dimensions, setDimensions] = useState<ViewportDimensions>([0, 0]);\n\n useEffect(() => {\n /**\n * Handle window resize events\n * Updates dimensions state with current viewport size\n */\n const handleResize = (): void => {\n setDimensions([window.innerWidth, window.innerHeight]);\n };\n\n // Set initial dimensions on mount (for SSR hydration)\n handleResize();\n\n // Add resize event listener with passive option for better performance\n window.addEventListener(\"resize\", handleResize, { passive: true });\n\n // Cleanup function to remove event listener\n return () => {\n window.removeEventListener(\"resize\", handleResize);\n };\n }, []); // Empty dependency array - effect runs once on mount\n\n return dimensions;\n};\n\nexport { useViewport };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAa,kBAAkB,cAAsB;CACnD,gBAAgB;EACd,IAAI,CAAC,UAAU,KAAK,GAAG;EAEvB,MAAM,YAAY,UAAU,MAAM,KAAK,CAAC,CAAC,OAAO,OAAO;EAEvD,UAAU,SAAS,QAAQ;GACzB,MAAM,QAAQ,gBAAgB,IAAI,GAAG,KAAK;GAC1C,gBAAgB,IAAI,KAAK,QAAQ,CAAC;GAClC,IAAI,UAAU,GACZ,SAAS,KAAK,UAAU,IAAI,GAAG;EAEnC,CAAC;EAED,aAAa;GACX,UAAU,SAAS,QAAQ;IACzB,MAAM,aAAa,gBAAgB,IAAI,GAAG,KAAK,KAAK;IACpD,IAAI,aAAa,GAAG;KAClB,gBAAgB,OAAO,GAAG;KAC1B,SAAS,KAAK,UAAU,OAAO,GAAG;KAClC;IACF;IACA,gBAAgB,IAAI,KAAK,SAAS;GACpC,CAAC;EACH;CACF,GAAG,CAAC,SAAS,CAAC;AAChB;AAEA,MAAM,kCAAkB,IAAI,IAAoB;;;;;;;;AC0DhD,MAAM,sBAAsC,CAAC;;;;;;;;;;;;;;;;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;EAGjE,aAAa;GACX,OAAO,oBAAoB,UAAU,YAAY;EACnD;CACF,GAAG,CAAC,CAAC;CAEL,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"hooks.js","names":["React","React"],"sources":["../src/hooks/use-body-classes.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-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"],"sourcesContent":["/**\n * Body class management hook for React components.\n */\n\n\"use client\";\n\nimport { useEffect } from \"react\";\n\n/**\n * Adds classes to `document.body` while the component is mounted.\n * Shared classes are reference-counted, so one component unmounting does not\n * remove a class that another mounted component still owns.\n *\n * @param className - Space-separated string of CSS class names to apply to body\n *\n * @example\n * ```tsx\n * // Single class\n * useBodyClasses('dark-theme');\n *\n * // Multiple classes\n * useBodyClasses('modal-open overflow-hidden');\n *\n * // Conditional classes\n * useBodyClasses(isModalOpen ? 'modal-open' : '');\n * ```\n */\nexport const useBodyClasses = (className: string) => {\n useEffect(() => {\n if (!className.trim()) return;\n\n const classList = className.split(/\\s+/).filter(Boolean);\n\n classList.forEach((cls) => {\n const count = bodyClassCounts.get(cls) ?? 0;\n bodyClassCounts.set(cls, count + 1);\n if (count === 0) {\n document.body.classList.add(cls);\n }\n });\n\n return () => {\n classList.forEach((cls) => {\n const nextCount = (bodyClassCounts.get(cls) ?? 1) - 1;\n if (nextCount <= 0) {\n bodyClassCounts.delete(cls);\n document.body.classList.remove(cls);\n return;\n }\n bodyClassCounts.set(cls, nextCount);\n });\n };\n }, [className]);\n};\n\nconst bodyClassCounts = new Map<string, number>();\n","/**\n * File upload functionality hook for React components\n * Provides comprehensive file upload capabilities with drag & drop support\n * Includes validation, preview generation, and state management\n */\n\n\"use client\";\n\nimport type React from \"react\";\nimport {\n type ChangeEvent,\n type DragEvent,\n type InputHTMLAttributes,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\n/**\n * Metadata structure for uploaded files\n */\nexport type FileMetadata = {\n /** The name of the file */\n name: string;\n /** The size of the file in bytes */\n size: number;\n /** The MIME type of the file */\n type: string;\n /** The URL where the file can be accessed */\n url: string;\n /** Unique identifier for the file */\n id: string;\n};\n\n/**\n * File object with preview capabilities\n */\nexport type FileWithPreview = {\n /** The actual file object or metadata */\n file: File | FileMetadata;\n /** Unique identifier for the file */\n id: string;\n /** Optional preview URL for the file (typically for images) */\n preview?: string;\n};\n\n/**\n * Configuration options for the file upload hook\n */\nexport type FileUploadOptions = {\n /** Maximum number of files allowed (only used when multiple is true, defaults to Infinity) */\n maxFiles?: number;\n /** Maximum file size in bytes (defaults to Infinity) */\n maxSize?: number;\n /** Accepted file types (MIME types or extensions, defaults to '*') */\n accept?: string;\n /** Whether multiple files can be selected (defaults to false) */\n multiple?: boolean;\n /** Initial files to populate the upload state */\n initialFiles?: FileMetadata[];\n /** Callback function executed when files change */\n onFilesChange?: (files: FileWithPreview[]) => void;\n /** Callback function executed when new files are added */\n onFilesAdded?: (addedFiles: FileWithPreview[]) => void;\n /** Callback function executed when validation errors occur */\n onError?: (errors: string[]) => void;\n};\n\n/**\n * Current state of the file upload component\n */\nexport type FileUploadState = {\n /** Array of files currently selected/uploaded */\n files: FileWithPreview[];\n /** Whether the user is currently dragging files over the drop zone */\n isDragging: boolean;\n /** Array of validation error messages */\n errors: string[];\n};\n\n/**\n * Actions available for file upload management\n */\nexport type FileUploadActions = {\n /** Add new files to the upload state */\n addFiles: (files: FileList | File[]) => void;\n /** Remove a specific file by its ID */\n removeFile: (id: string) => void;\n /** Clear all files from the upload state */\n clearFiles: () => void;\n /** Clear all error messages */\n clearErrors: () => void;\n /** Handle drag enter event for drop zone */\n handleDragEnter: (e: DragEvent<HTMLElement>) => void;\n /** Handle drag leave event for drop zone */\n handleDragLeave: (e: DragEvent<HTMLElement>) => void;\n /** Handle drag over event for drop zone */\n handleDragOver: (e: DragEvent<HTMLElement>) => void;\n /** Handle drop event for drop zone */\n handleDrop: (e: DragEvent<HTMLElement>) => void;\n /** Handle file input change event */\n handleFileChange: (e: ChangeEvent<HTMLInputElement>) => void;\n /** Programmatically open the file dialog */\n openFileDialog: () => void;\n /** Get props for the file input element */\n getInputProps: (\n props?: InputHTMLAttributes<HTMLInputElement>,\n ) => InputHTMLAttributes<HTMLInputElement> & {\n ref: React.Ref<HTMLInputElement>;\n };\n};\n\nconst EMPTY_INITIAL_FILES: FileMetadata[] = [];\n\n/**\n * Hook for comprehensive file upload functionality with drag & drop support\n *\n * Features:\n * - Single and multiple file upload support\n * - Drag and drop functionality\n * - File validation (size, type, count)\n * - Preview generation for images\n * - Error handling and state management\n * - Duplicate file detection\n * - Memory cleanup for object URLs\n *\n * @param options - Configuration options for the file upload hook\n * @returns Tuple containing current state and available actions\n *\n * @example\n * ```tsx\n * const [state, actions] = useFileUpload({\n * maxFiles: 5,\n * maxSize: 10 * 1024 * 1024, // 10MB\n * accept: 'image/*',\n * multiple: true,\n * onFilesChange: (files) => console.log('Files changed:', files),\n * onFilesAdded: (newFiles) => console.log('New files added:', newFiles)\n * });\n *\n * return (\n * <div\n * onDragEnter={actions.handleDragEnter}\n * onDragLeave={actions.handleDragLeave}\n * onDragOver={actions.handleDragOver}\n * onDrop={actions.handleDrop}\n * >\n * <input {...actions.getInputProps()} />\n * <button onClick={actions.openFileDialog}>\n * Upload Files\n * </button>\n * {state.files.map(file => (\n * <div key={file.id}>\n * {file.file.name}\n * <button onClick={() => actions.removeFile(file.id)}>\n * Remove\n * </button>\n * </div>\n * ))}\n * </div>\n * );\n * ```\n */\nexport const useFileUpload = (\n options: FileUploadOptions = {},\n): [FileUploadState, FileUploadActions] => {\n const {\n maxFiles = Number.POSITIVE_INFINITY,\n maxSize = Number.POSITIVE_INFINITY,\n accept = \"*\",\n multiple = false,\n initialFiles = EMPTY_INITIAL_FILES,\n onFilesChange,\n onFilesAdded,\n onError,\n } = options;\n\n /** Current state of the file upload component */\n const [state, setState] = useState<FileUploadState>({\n files: initialFiles.map((file) => ({\n file,\n id: file.id,\n preview: file.url,\n })),\n isDragging: false,\n errors: [],\n });\n\n /** Reference to the hidden file input element */\n const inputRef = useRef<HTMLInputElement>(null);\n const filesRef = useRef<FileWithPreview[]>([]);\n\n useEffect(() => {\n filesRef.current = state.files;\n }, [state.files]);\n\n useEffect(() => {\n setState((prev) => ({\n ...prev,\n files: initialFiles.map((file) => ({\n file,\n id: file.id,\n preview: file.url,\n })),\n errors: [],\n }));\n }, [initialFiles]);\n\n useEffect(() => {\n return () => {\n filesRef.current.forEach((file) => {\n if (file.preview && file.file instanceof File && file.file.type.startsWith(\"image/\")) {\n URL.revokeObjectURL(file.preview);\n }\n });\n };\n }, []);\n\n /**\n * Validate a file against the configured constraints\n *\n * @param file - The file to validate (File object or FileMetadata)\n * @returns Error message if validation fails, null if valid\n */\n const validateFile = useCallback(\n (file: File | FileMetadata): string | null => {\n if (file.size > maxSize) {\n return `File \"${file.name}\" exceeds the maximum size of ${formatBytes(maxSize)}.`;\n }\n\n if (accept !== \"*\") {\n const acceptedTypes = accept.split(\",\").map((type) => type.trim());\n const fileType = file instanceof File ? file.type || \"\" : file.type;\n const fileExtension = `.${file.name.split(\".\").pop()}`;\n\n const isAccepted = acceptedTypes.some((type) => {\n if (type.startsWith(\".\")) {\n return fileExtension.toLowerCase() === type.toLowerCase();\n }\n if (type.endsWith(\"/*\")) {\n const baseType = type.split(\"/\")[0];\n return fileType.startsWith(`${baseType}/`);\n }\n return fileType === type;\n });\n\n if (!isAccepted) {\n return `File \"${file.name}\" is not an accepted file type.`;\n }\n }\n\n return null;\n },\n [accept, maxSize],\n );\n\n /**\n * Create a preview URL for a file\n *\n * @param file - The file to create a preview for\n * @returns Preview URL string or undefined\n */\n const createPreview = useCallback((file: File | FileMetadata): string | undefined => {\n if (file instanceof File) {\n if (file.type.startsWith(\"image/\")) {\n return URL.createObjectURL(file);\n }\n return undefined;\n }\n return file.url;\n }, []);\n\n /**\n * Generate a unique identifier for a file\n *\n * @param file - The file to generate an ID for\n * @returns Unique identifier string\n */\n const generateUniqueId = useCallback((file: File | FileMetadata): string => {\n if (file instanceof File) {\n return `${file.name}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;\n }\n return file.id;\n }, []);\n\n /**\n * Clear all files from the upload state\n * Also cleans up object URLs to prevent memory leaks\n */\n const clearFiles = useCallback(() => {\n setState((prev) => {\n // Clean up object URLs\n for (const file of prev.files) {\n if (file.preview && file.file instanceof File && file.file.type.startsWith(\"image/\")) {\n URL.revokeObjectURL(file.preview);\n }\n }\n\n if (inputRef.current) {\n inputRef.current.value = \"\";\n }\n\n const newState = {\n ...prev,\n files: [],\n errors: [],\n };\n\n onFilesChange?.(newState.files);\n return newState;\n });\n }, [onFilesChange]);\n\n /**\n * Add new files to the upload state\n * Handles validation, duplicate detection, and state updates\n *\n * @param newFiles - FileList or array of File objects to add\n */\n const addFiles = useCallback(\n (newFiles: FileList | File[]) => {\n if (!newFiles || newFiles.length === 0) return;\n\n const newFilesArray = Array.from(newFiles);\n const errors: string[] = [];\n\n const validFiles: FileWithPreview[] = [];\n\n for (const file of newFilesArray) {\n const error = validateFile(file);\n if (error) {\n errors.push(error);\n } else {\n validFiles.push({\n file,\n id: generateUniqueId(file),\n preview: createPreview(file),\n });\n }\n }\n\n setState((prev) => {\n const baseFiles = multiple ? prev.files : [];\n const dedupedFiles = multiple\n ? validFiles.filter(\n (file) =>\n !baseFiles.some(\n (existingFile) =>\n existingFile.file.name === file.file.name &&\n existingFile.file.size === file.file.size,\n ),\n )\n : validFiles;\n\n if (\n multiple &&\n maxFiles !== Number.POSITIVE_INFINITY &&\n baseFiles.length + dedupedFiles.length > maxFiles\n ) {\n const nextErrors = [`You can only upload a maximum of ${maxFiles} files.`];\n onError?.(nextErrors);\n return { ...prev, errors: nextErrors };\n }\n\n if (!multiple) {\n prev.files.forEach((file) => {\n if (file.preview && file.file instanceof File && file.file.type.startsWith(\"image/\")) {\n URL.revokeObjectURL(file.preview);\n }\n });\n }\n\n const nextFiles = !multiple ? dedupedFiles : [...baseFiles, ...dedupedFiles];\n if (dedupedFiles.length > 0) {\n onFilesAdded?.(dedupedFiles);\n onFilesChange?.(nextFiles);\n }\n if (errors.length > 0) {\n onError?.(errors);\n }\n\n return {\n ...prev,\n files: nextFiles,\n errors,\n };\n });\n\n // Reset input value after handling files\n if (inputRef.current) {\n inputRef.current.value = \"\";\n }\n },\n [\n maxFiles,\n multiple,\n validateFile,\n createPreview,\n generateUniqueId,\n onFilesChange,\n onFilesAdded,\n onError,\n ],\n );\n\n /**\n * Remove a specific file from the upload state\n * Also cleans up object URLs to prevent memory leaks\n *\n * @param id - The unique identifier of the file to remove\n */\n const removeFile = useCallback(\n (id: string) => {\n setState((prev) => {\n const fileToRemove = prev.files.find((file) => file.id === id);\n if (\n fileToRemove?.preview &&\n fileToRemove.file instanceof File &&\n fileToRemove.file.type.startsWith(\"image/\")\n ) {\n URL.revokeObjectURL(fileToRemove.preview);\n }\n\n const newFiles = prev.files.filter((file) => file.id !== id);\n onFilesChange?.(newFiles);\n\n return {\n ...prev,\n files: newFiles,\n errors: [],\n };\n });\n },\n [onFilesChange],\n );\n\n /**\n * Clear all error messages from the state\n */\n const clearErrors = useCallback(() => {\n setState((prev) => ({\n ...prev,\n errors: [],\n }));\n }, []);\n\n /**\n * Handle drag enter event for the drop zone\n * Sets the dragging state to true\n *\n * @param e - The drag event\n */\n const handleDragEnter = useCallback((e: DragEvent<HTMLElement>) => {\n e.preventDefault();\n e.stopPropagation();\n setState((prev) => ({ ...prev, isDragging: true }));\n }, []);\n\n /**\n * Handle drag leave event for the drop zone\n * Sets the dragging state to false when leaving the drop zone\n *\n * @param e - The drag event\n */\n const handleDragLeave = useCallback((e: DragEvent<HTMLElement>) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (e.currentTarget.contains(e.relatedTarget as Node)) {\n return;\n }\n\n setState((prev) => ({ ...prev, isDragging: false }));\n }, []);\n\n /**\n * Handle drag over event for the drop zone\n * Prevents default behavior to allow dropping\n *\n * @param e - The drag event\n */\n const handleDragOver = useCallback((e: DragEvent<HTMLElement>) => {\n e.preventDefault();\n e.stopPropagation();\n }, []);\n\n /**\n * Handle drop event for the drop zone\n * Processes dropped files and adds them to the upload state\n *\n * @param e - The drag event containing the dropped files\n */\n const handleDrop = useCallback(\n (e: DragEvent<HTMLElement>) => {\n e.preventDefault();\n e.stopPropagation();\n setState((prev) => ({ ...prev, isDragging: false }));\n\n // Don't process files if the input is disabled\n if (inputRef.current?.disabled) {\n return;\n }\n\n if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {\n // In single file mode, only use the first file\n if (!multiple) {\n const file = e.dataTransfer.files[0];\n addFiles([file]);\n } else {\n addFiles(e.dataTransfer.files);\n }\n }\n },\n [addFiles, multiple],\n );\n\n /**\n * Handle file input change event\n * Processes selected files from the file input\n *\n * @param e - The change event from the file input\n */\n const handleFileChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.files && e.target.files.length > 0) {\n addFiles(e.target.files);\n }\n },\n [addFiles],\n );\n\n /**\n * Programmatically open the file dialog\n * Triggers the hidden file input click event\n */\n const openFileDialog = useCallback(() => {\n if (inputRef.current) {\n inputRef.current.click();\n }\n }, []);\n\n /**\n * Get props for the file input element\n * Returns properly configured input props with event handlers\n *\n * @param props - Optional additional props for the input element\n * @returns Input props object with ref and event handlers\n */\n const getInputProps = useCallback(\n (props: InputHTMLAttributes<HTMLInputElement> = {}) => {\n return {\n ...props,\n type: \"file\" as const,\n onChange: handleFileChange,\n accept: props.accept || accept,\n multiple: props.multiple !== undefined ? props.multiple : multiple,\n ref: inputRef,\n };\n },\n [accept, multiple, handleFileChange],\n );\n\n return [\n state,\n {\n addFiles,\n removeFile,\n clearFiles,\n clearErrors,\n handleDragEnter,\n handleDragLeave,\n handleDragOver,\n handleDrop,\n handleFileChange,\n openFileDialog,\n getInputProps,\n },\n ];\n};\n\n/**\n * Helper function to format bytes to human-readable format\n *\n * @param bytes - The number of bytes to format\n * @param decimals - Number of decimal places to show (default: 2)\n * @returns Formatted string with appropriate unit (e.g., \"1.5 MB\")\n *\n * @example\n * ```tsx\n * formatBytes(1024); // \"1 KB\"\n * formatBytes(1536, 1); // \"1.5 KB\"\n * formatBytes(1048576); // \"1 MB\"\n * ```\n */\nexport const formatBytes = (bytes: number, decimals = 2): string => {\n if (bytes === 0) return \"0 Bytes\";\n\n const k = 1024;\n const dm = decimals < 0 ? 0 : decimals;\n const sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\", \"ZB\", \"YB\"];\n\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n\n return `${Number.parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;\n};\n","/**\n * Hydration state hook for React components\n * Returns a boolean indicating whether the component is running on the client\n * with SSR-safe behavior to prevent hydration mismatches.\n *\n * This hook leverages `useSyncExternalStore` to provide a stable value between\n * server and client renders: `false` during SSR, `true` after client hydration.\n * The external store does not emit updates because the hydration state is static\n * for the lifetime of the component.\n */\n\"use client\";\n\nimport { useSyncExternalStore } from \"react\";\n\n/**\n * Hook that indicates whether code is executing on the client after hydration\n *\n * Features:\n * - SSR-safe: returns `false` on the server to avoid hydration mismatches\n * - Client-stable: returns `true` after hydration and remains stable\n * - Minimal overhead: uses a no-op external store subscription\n *\n * @returns Boolean indicating hydration state (`true` on client, `false` on server)\n *\n * @example\n * ```tsx\n * // Conditionally render client-only components safely\n * function ClientOnly() {\n * const hydrated = useHydrated();\n * if (!hydrated) return null;\n * return <InteractiveChart />;\n * }\n * ```\n *\n * @since 1.0.0\n */\nexport function useHydrated() {\n return useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\n/**\n * External store subscription used by `useHydrated`\n * No updates are dispatched because hydration state is static.\n * Returns an unsubscribe function for API conformity.\n */\nfunction subscribe() {\n return () => {};\n}\n","/**\n * Intersection observer hook for React components\n * Efficiently observes visibility of DOM elements using a shared IntersectionObserver instance.\n * Ideal for lazy loading, infinite scrolling, and animating elements when they enter the viewport.\n */\n\n\"use client\";\n\nimport * as React from \"react\";\n\n/**\n * Configuration options for the `useIntersectionObserver` hook.\n *\n * Extends the native `IntersectionObserverInit` options with an additional\n * convenience flag for freezing the observer state.\n */\ninterface IntersectionObserverOptions extends IntersectionObserverInit {\n /**\n * When `true`, the hook stops observing once the element becomes visible\n * and keeps returning `true` for subsequent renders.\n *\n * This is useful for one-time animations or lazy loading where you only\n * care about the first time an element enters the viewport.\n */\n freezeOnceVisible?: boolean;\n}\n\n/**\n * A shared intersection observer to manage multiple targets with a single observer instance.\n * Optimized for high-density lists (like the patterns grid).\n */\nclass SharedObserver {\n private observer: IntersectionObserver | null = null;\n private callbacks = new Map<Element, (isIntersecting: boolean) => void>();\n private options: IntersectionObserverInit;\n\n constructor(options: IntersectionObserverInit) {\n this.options = options;\n }\n\n private getObserver() {\n if (!this.observer) {\n this.observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n const callback = this.callbacks.get(entry.target);\n if (callback) {\n callback(entry.isIntersecting);\n }\n });\n }, this.options);\n }\n return this.observer;\n }\n\n observe(element: Element, callback: (isIntersecting: boolean) => void) {\n this.callbacks.set(element, callback);\n this.getObserver().observe(element);\n }\n\n unobserve(element: Element) {\n this.callbacks.delete(element);\n this.observer?.unobserve(element);\n }\n\n get size() {\n return this.callbacks.size;\n }\n\n disconnect() {\n this.observer?.disconnect();\n this.callbacks.clear();\n this.observer = null;\n }\n}\n\n// Singleton instances for common observer options to maximize reuse.\nconst observers = new Map<string, SharedObserver>();\nconst rootIds = new WeakMap<Element, number>();\nlet rootId = 0;\n\nfunction getRootKey(root: Element | Document | null | undefined) {\n if (!root) return \"null\";\n if (!rootIds.has(root as Element)) {\n rootIds.set(root as Element, ++rootId);\n }\n return rootIds.get(root as Element);\n}\n\n/**\n * Get or create a shared `IntersectionObserver` instance based on the provided options.\n *\n * Using a shared observer reduces the number of underlying `IntersectionObserver`\n * instances created by the browser, which is especially beneficial for pages\n * with many observed elements.\n *\n * @param options - Intersection observer configuration (threshold, root, rootMargin)\n * @returns A shared `SharedObserver` instance for the given options\n */\nfunction getSharedObserver(options: IntersectionObserverInit) {\n const threshold = Array.isArray(options.threshold)\n ? options.threshold.join(\",\")\n : (options.threshold ?? 0);\n const key = `${getRootKey(options.root)}|${options.rootMargin ?? \"0px\"}|${threshold}`;\n if (!observers.has(key)) {\n observers.set(key, new SharedObserver(options));\n }\n return { key, observer: observers.get(key)! };\n}\n\n/**\n * React hook that tracks whether a DOM element is currently intersecting the viewport.\n *\n * Features:\n * - Uses a shared `IntersectionObserver` instance for better performance.\n * - Supports custom `threshold`, `root`, and `rootMargin` options.\n * - Optional `freezeOnceVisible` flag to stop observing after first intersection.\n *\n * @param elementRef - React ref pointing to the DOM element to observe.\n * @param options - Optional observer configuration and behavior flags.\n * @param options.threshold - Intersection threshold(s) for triggering visibility changes.\n * @param options.root - Scrollable ancestor element to use as the viewport (defaults to browser viewport).\n * @param options.rootMargin - Margin around the root, expressed in CSS units (e.g. `\"0px 0px -20% 0px\"`).\n * @param options.freezeOnceVisible - When `true`, stops observing after the element first becomes visible.\n *\n * @returns `true` when the element is intersecting based on the given options, otherwise `false`.\n *\n * @example\n * ```tsx\n * const ref = React.useRef<HTMLDivElement | null>(null);\n * const isVisible = useIntersectionObserver(ref, {\n * threshold: 0.2,\n * rootMargin: \"0px 0px -10% 0px\",\n * freezeOnceVisible: true,\n * });\n *\n * return (\n * <div ref={ref} className={isVisible ? \"animate-in\" : \"opacity-0\"}>\n * I will animate when I enter the viewport.\n * </div>\n * );\n * ```\n */\nexport function useIntersectionObserver(\n elementRef: React.RefObject<Element | null>,\n {\n threshold = 0,\n root = null,\n rootMargin = \"0%\",\n freezeOnceVisible = false,\n }: IntersectionObserverOptions = {},\n): boolean {\n const [isIntersecting, setIntersecting] = React.useState(false);\n const frozen = React.useRef(false);\n\n React.useEffect(() => {\n const element = elementRef?.current;\n if (!element || (freezeOnceVisible && frozen.current)) return;\n if (typeof IntersectionObserver === \"undefined\") return;\n\n const { key, observer } = getSharedObserver({ threshold, root, rootMargin });\n\n observer.observe(element, (intersecting) => {\n setIntersecting(intersecting);\n if (intersecting && freezeOnceVisible) {\n frozen.current = true;\n observer.unobserve(element);\n }\n });\n\n return () => {\n observer.unobserve(element);\n if (observer.size === 0) {\n observer.disconnect();\n observers.delete(key);\n }\n };\n }, [elementRef, threshold, root, rootMargin, freezeOnceVisible]);\n\n return isIntersecting;\n}\n","/**\n * Platform detection hook for React components\n * Determines whether the current user agent is running on a macOS device.\n * Useful for rendering platform-specific keyboard shortcuts or UI variations.\n */\n\n\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\n/**\n * React hook that returns whether the current browser reports a macOS platform.\n * It prefers `navigator.userAgentData.platform` when available and falls back\n * to `navigator.userAgent`.\n *\n * @returns `true` if the current platform is macOS, otherwise `false`.\n *\n * @example\n * ```tsx\n * const isMac = useIsMac();\n *\n * return (\n * <kbd>\n * {isMac ? \"⌘\" : \"Ctrl\"} + K\n * </kbd>\n * );\n * ```\n */\nexport function useIsMac() {\n const [isMac, setIsMac] = useState(false);\n\n useEffect(() => {\n const platform =\n (navigator as Navigator & { userAgentData?: { platform?: string } }).userAgentData\n ?.platform ??\n navigator.userAgent ??\n \"\";\n setIsMac(platform.toUpperCase().includes(\"MAC\"));\n }, []);\n\n return isMac;\n}\n","/**\n * Media query hook for responsive React components\n * Provides real-time tracking of CSS media query matches\n * with SSR-safe implementation and automatic cleanup\n */\n\n\"use client\";\n\nimport { useCallback, useSyncExternalStore } from \"react\";\n\n/**\n * Hook for tracking CSS media query matches in React components\n *\n * Features:\n * - Real-time updates when media query state changes\n * - SSR-safe implementation\n * - Automatic event listener cleanup\n * - Supports all standard CSS media queries\n *\n * @param query - CSS media query string (e.g., '(min-width: 768px)')\n * @returns Boolean indicating whether the media query currently matches\n *\n * @example\n * ```tsx\n * // Basic responsive behavior\n * const isMobile = useMediaQuery('(max-width: 768px)');\n * const isTablet = useMediaQuery('(min-width: 769px) and (max-width: 1024px)');\n * const isDesktop = useMediaQuery('(min-width: 1025px)');\n *\n * // Dark mode preference\n * const prefersDark = useMediaQuery('(prefers-color-scheme: dark)');\n *\n * // Reduced motion preference\n * const prefersReducedMotion = useMediaQuery('(prefers-reduced-motion: reduce)');\n *\n * return (\n * <div>\n * {isMobile && <MobileLayout />}\n * {isTablet && <TabletLayout />}\n * {isDesktop && <DesktopLayout />}\n * </div>\n * );\n * ```\n */\nexport const useMediaQuery = (query: string): boolean => {\n // Subscribe to media query changes and clean up automatically\n const subscribe = useCallback(\n (onChange: () => void) => {\n const matchMedia = window.matchMedia(query);\n matchMedia.addEventListener(\"change\", onChange);\n return () => {\n matchMedia.removeEventListener(\"change\", onChange);\n };\n },\n [query],\n );\n\n // Read the current match status on the client\n const getSnapshot = useCallback(() => window.matchMedia(query).matches, [query]);\n\n // Always report false during SSR to avoid hydration mismatches\n const getServerSnapshot = () => false;\n\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n};\n","/**\n * Menu navigation utilities hook for dashboard layouts\n * Provides comprehensive menu state management and navigation helpers\n * Handles active states, breadcrumbs, and hierarchical menu structures\n */\n\n\"use client\";\n\nimport type { ComponentType, SVGProps } from \"react\";\n\n/**\n * Menu item interface\n */\ninterface MenuItem {\n /** Heading text */\n heading?: string;\n /** Menu item title */\n title?: string;\n /** Navigation path */\n path?: string;\n /** Menu item icon component */\n icon?: ComponentType<SVGProps<SVGSVGElement>>;\n /** Whether to show separator */\n separator?: boolean;\n\n /** Root path for active state matching */\n rootPath?: string;\n /** Child menu items */\n children?: MenuConfig;\n /** Children index for nested items */\n childrenIndex?: number;\n\n /** Whether the item is external */\n external?: boolean;\n /** Whether the item is disabled */\n disabled?: boolean;\n /** Disable text */\n disabledText?: string;\n\n /** Badge text */\n badge?: string;\n /** Badge variant */\n badgeVariant?:\n | \"primary\"\n | \"destructive\"\n | \"success\"\n | \"info\"\n | \"warning\"\n | \"secondary\"\n | \"outline\";\n\n /** Collapse configuration */\n collapse?: boolean;\n /** Title when collapsed */\n collapseTitle?: string;\n /** Title when expanded */\n expandTitle?: string;\n}\n\n/**\n * Type aliases for backward compatibility\n */\ntype MenuConfig = MenuItem[];\n\n/** Return type interface for useMenu hook */\ninterface UseMenuReturn {\n /** Check if a specific path is currently active */\n isActive: (path: string | undefined) => boolean;\n /** Check if any child menu item is currently active */\n hasActiveChild: (children: MenuItem[] | undefined) => boolean;\n /** Check if a menu item (including its children) is currently active */\n isItemActive: (item: MenuItem) => boolean;\n /** Get the currently active menu item from the menu configuration */\n getCurrentItem: (items: MenuConfig) => MenuItem | undefined;\n /** Generate breadcrumb trail for the current active path */\n getBreadcrumb: (items: MenuConfig) => MenuItem[];\n /** Get child menu items at a specific level for the current active path */\n getChildren: (items: MenuConfig, level: number) => MenuConfig | null;\n}\n\n/**\n * Hook for managing menu navigation state and utilities\n *\n * This hook provides comprehensive menu management functionality including:\n * - Active state detection for menu items and paths\n * - Hierarchical menu navigation support\n * - Breadcrumb generation for current navigation path\n * - Child menu extraction at specific levels\n * - Support for nested menu structures\n *\n * @param pathname - Current pathname from router or location\n * @returns Object containing menu utility functions\n *\n * @example\n * ```tsx\n * const { isActive, getBreadcrumb, getCurrentItem } = useMenu(pathname);\n *\n * // Check if path is active\n * const isHomeActive = isActive('/dashboard');\n *\n * // Get breadcrumb for current path\n * const breadcrumb = getBreadcrumb(menuItems);\n *\n * // Get current active menu item\n * const currentItem = getCurrentItem(menuItems);\n * ```\n */\nexport const useMenu = (pathname: string): UseMenuReturn => {\n /**\n * Check if a specific path matches the current pathname\n * Handles root path ('/') as exact match, others as prefix match\n *\n * @param path - The path to check against current pathname\n * @returns True if the path is currently active\n */\n const isActive = (path: string | undefined): boolean => {\n if (path && path === \"/\") {\n return path === pathname;\n } else {\n return !!path && pathname.startsWith(path);\n }\n };\n\n /**\n * Recursively check if any child menu item is currently active\n * Traverses through nested menu structures to find active children\n *\n * @param children - Array of child menu items to check\n * @returns True if any child or nested child is active\n */\n const hasActiveChild = (children: MenuItem[] | undefined): boolean => {\n if (!children || !Array.isArray(children)) return false;\n return children.some(\n (child: MenuItem) =>\n (child.path && isActive(child.path)) || (child.children && hasActiveChild(child.children)),\n );\n };\n\n /**\n * Check if a menu item is active (either directly or through its children)\n * Combines direct path matching with child activity detection\n *\n * @param item - The menu item to check for activity\n * @returns True if the item or any of its children are active\n */\n const isItemActive = (item: MenuItem): boolean => {\n return (\n (item.path ? isActive(item.path) : false) ||\n (item.children ? hasActiveChild(item.children) : false)\n );\n };\n\n /**\n * Find and return the currently active menu item from the menu configuration\n * Recursively searches through menu hierarchy to find the most specific active item\n * Prioritizes deeper nested items over parent items when both are active\n *\n * @param items - Array of menu items to search through\n * @returns The currently active menu item, or undefined if none found\n */\n const getCurrentItem = (items: MenuConfig): MenuItem | undefined => {\n for (const item of items) {\n if (item.path && isActive(item.path)) {\n if (item.children && item.children.length > 0) {\n const childMatch = getCurrentItem(item.children);\n return childMatch || item;\n }\n return item;\n }\n if (item.children && item.children.length > 0) {\n const childMatch = getCurrentItem(item.children);\n if (childMatch) {\n return childMatch;\n }\n }\n }\n return undefined;\n };\n\n /**\n * Generate breadcrumb trail for the current active path\n * Creates an array of menu items representing the navigation path from root to current item\n * Useful for displaying navigation breadcrumbs in the UI\n *\n * @param items - Array of menu items to generate breadcrumb from\n * @returns Array of menu items representing the breadcrumb trail\n */\n const getBreadcrumb = (items: MenuConfig): MenuItem[] => {\n const findBreadcrumb = (nodes: MenuItem[], breadcrumb: MenuItem[] = []): MenuItem[] => {\n for (const item of nodes) {\n const currentBreadcrumb = [...breadcrumb, item];\n\n // If item has children, recurse and check them\n if (item.children && item.children.length > 0) {\n const childBreadcrumb = findBreadcrumb(item.children, currentBreadcrumb);\n if (childBreadcrumb.length > currentBreadcrumb.length) {\n return childBreadcrumb; // Return the deeper breadcrumb if found\n }\n }\n\n // Check this item after children so nested routes win over parent prefixes.\n if (item.path && isActive(item.path)) {\n return currentBreadcrumb;\n }\n }\n return breadcrumb; // Return current breadcrumb if no match found\n };\n\n const breadcrumb = findBreadcrumb(items);\n return breadcrumb.length > 0 ? breadcrumb : [];\n };\n\n /**\n * Get child menu items at a specific hierarchical level for the current active path\n * Traverses the menu structure to find children at the specified depth level\n * Useful for displaying sub-navigation menus at different levels\n *\n * @param items - Array of menu items to search through\n * @param level - The hierarchical level to get children from (0-based)\n * @returns Array of child menu items at the specified level, or null if none found\n */\n const getChildren = (items: MenuConfig, level: number): MenuConfig | null => {\n const hasActiveChildAtLevel = (items: MenuConfig): boolean => {\n for (const item of items) {\n if (\n (item.path &&\n (item.path === pathname ||\n (item.path !== \"/\" && item.path !== \"\" && pathname.startsWith(item.path)))) ||\n (item.children && hasActiveChildAtLevel(item.children))\n ) {\n return true;\n }\n }\n return false;\n };\n\n const findChildren = (\n items: MenuConfig,\n targetLevel: number,\n currentLevel: number = 0,\n ): MenuConfig | null => {\n for (const item of items) {\n if (item.children) {\n if (targetLevel === currentLevel && hasActiveChildAtLevel(item.children)) {\n return item.children;\n }\n const children = findChildren(item.children, targetLevel, currentLevel + 1);\n if (children) {\n return children;\n }\n } else if (\n targetLevel === currentLevel &&\n item.path &&\n (item.path === pathname ||\n (item.path !== \"/\" && item.path !== \"\" && pathname.startsWith(item.path)))\n ) {\n return items;\n }\n }\n return null;\n };\n\n return findChildren(items, level);\n };\n\n return {\n isActive,\n hasActiveChild,\n isItemActive,\n getCurrentItem,\n getBreadcrumb,\n getChildren,\n };\n};\n","/**\n * Meta theme color management hook for React components.\n */\n\n\"use client\";\n\nimport * as React from \"react\";\nimport { useTheme } from \"next-themes\";\n\nimport { META_THEME_COLORS, THEME_MODES } from \"@kumix/utils\";\n\n/**\n * Calculates and applies the HTML `theme-color` meta tag from `next-themes`.\n * The returned setter can be used for temporary manual overrides.\n *\n * @param defaultColors - Optional custom color configuration (defaults to META_THEME_COLORS)\n * @returns Object containing current meta color and setter function.\n *\n * @example\n * ```tsx\n * // Basic usage with default colors (supports light, dark, and system)\n * function App() {\n * const { metaColor, setMetaColor } = useMetaColor();\n *\n * // metaColor automatically updates based on theme (light/dark/system)\n * useEffect(() => {\n * console.log('Current meta color:', metaColor);\n * }, [metaColor]);\n *\n * return <div>App content</div>;\n * }\n *\n * // Custom colors with system theme support\n * function CustomThemeApp() {\n * const customColors = {\n * light: '#f0f0f0',\n * dark: '#1a1a1a',\n * system: 'auto' // Will resolve to light or dark based on OS preference\n * };\n * const { metaColor } = useMetaColor(customColors);\n *\n * return <div style={{ backgroundColor: metaColor }}>Custom themed app</div>;\n * }\n *\n * // Manual meta color override for special pages\n * function SpecialPage() {\n * const { setMetaColor } = useMetaColor();\n *\n * useEffect(() => {\n * // Override meta color for this page\n * setMetaColor('#ff0000');\n *\n * // Cleanup: reset to theme color when leaving page\n * return () => {\n * setMetaColor(''); // This will revert to theme-based color\n * };\n * }, [setMetaColor]);\n *\n * return <div>Special page with red theme color</div>;\n * }\n *\n * // Integration with theme switcher\n * function ThemeAwareComponent() {\n * const { theme, setTheme } = useTheme();\n * const { metaColor } = useMetaColor();\n *\n * return (\n * <div>\n * <p>Current theme: {theme}</p>\n * <p>Meta color: {metaColor}</p>\n * <button onClick={() => setTheme('light')}>Light</button>\n * <button onClick={() => setTheme('dark')}>Dark</button>\n * <button onClick={() => setTheme('system')}>System</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function useMetaColor(defaultColors?: typeof META_THEME_COLORS) {\n /** Get resolved theme from next-themes */\n const { resolvedTheme } = useTheme();\n\n /**\n * Helper function to detect system dark mode preference\n */\n const isSystemDarkMode = React.useCallback(() => {\n if (typeof window === \"undefined\") return false;\n return window.matchMedia(\"(prefers-color-scheme: dark)\").matches;\n }, []);\n\n /**\n * Get effective theme mode (resolves 'system' to actual preference)\n */\n const getEffectiveTheme = React.useCallback(\n (theme: string | undefined) => {\n if (theme === THEME_MODES.SYSTEM) {\n return isSystemDarkMode() ? THEME_MODES.DARK : THEME_MODES.LIGHT;\n }\n return theme;\n },\n [isSystemDarkMode],\n );\n\n /**\n * Calculate appropriate meta color based on current theme\n * Handles light, dark, and system themes properly\n * Memoized to prevent unnecessary recalculations\n */\n const metaColor = React.useMemo(() => {\n const colorsToUse = defaultColors ?? META_THEME_COLORS;\n\n // Get the effective theme (resolves system to light/dark)\n const effectiveTheme = getEffectiveTheme(resolvedTheme);\n\n // Handle different theme modes\n if (effectiveTheme === THEME_MODES.DARK) {\n return colorsToUse[THEME_MODES.DARK];\n } else if (effectiveTheme === THEME_MODES.LIGHT) {\n return colorsToUse[THEME_MODES.LIGHT];\n }\n\n // Fallback to light theme if resolvedTheme is undefined (during hydration)\n return colorsToUse[THEME_MODES.LIGHT];\n }, [resolvedTheme, defaultColors, getEffectiveTheme]);\n\n /**\n * Manually set meta theme color in the document\n * Useful for temporary color overrides or custom scenarios\n *\n * @param color - Hex color string to set as meta theme color\n */\n const setMetaColor = React.useCallback((color: string) => {\n // Find and update the meta theme-color tag\n const metaTag = document.querySelector('meta[name=\"theme-color\"]');\n if (metaTag) {\n metaTag.setAttribute(\"content\", color);\n } else {\n // Create meta tag if it doesn't exist\n const newMetaTag = document.createElement(\"meta\");\n newMetaTag.name = \"theme-color\";\n newMetaTag.content = color;\n document.head.appendChild(newMetaTag);\n }\n }, []);\n\n React.useEffect(() => {\n setMetaColor(metaColor);\n }, [metaColor, setMetaColor]);\n\n return {\n /** Current meta theme color based on resolved theme */\n metaColor,\n /** Function to manually set meta theme color */\n setMetaColor,\n };\n}\n","/**\n * DOM Mutation Observer hook for React components\n * Provides a React-friendly interface for observing DOM changes\n * with automatic cleanup and ref integration\n */\n\n\"use client\";\n\nimport * as React from \"react\";\n\n/**\n * Default options for MutationObserver\n * Observes all types of mutations by default\n */\nconst DEFAULT_OPTIONS: MutationObserverInit = {\n /** Watch for attribute changes */\n attributes: true,\n /** Watch for text content changes */\n characterData: true,\n /** Watch for child element additions/removals */\n childList: true,\n /** Watch for changes in descendant elements */\n subtree: true,\n};\n\n/**\n * Hook to observe DOM mutations on a referenced element\n *\n * This hook provides a React-friendly way to use the MutationObserver API.\n * It automatically handles observer creation, cleanup, and ref management.\n * Useful for detecting DOM changes that occur outside of React's control.\n *\n * Features:\n * - Automatic observer lifecycle management\n * - Configurable observation options\n * - Ref-based element targeting\n * - Automatic cleanup on unmount\n *\n * @param ref - React ref pointing to the element to observe\n * @param callback - Function called when mutations are detected\n * @param options - MutationObserver configuration options\n *\n * @example\n * ```tsx\n * function DynamicContent() {\n * const contentRef = useRef<HTMLDivElement>(null);\n *\n * // Watch for any changes to the content div\n * useMutationObserver(\n * contentRef,\n * (mutations) => {\n * mutations.forEach((mutation) => {\n * console.log('DOM changed:', mutation.type);\n * });\n * }\n * );\n *\n * return <div ref={contentRef}>Dynamic content here</div>;\n * }\n *\n * // Watch only for attribute changes\n * function AttributeWatcher() {\n * const elementRef = useRef<HTMLElement>(null);\n *\n * useMutationObserver(\n * elementRef,\n * (mutations) => {\n * mutations.forEach((mutation) => {\n * if (mutation.type === 'attributes') {\n * console.log('Attribute changed:', mutation.attributeName);\n * }\n * });\n * },\n * { attributes: true, childList: false, subtree: false }\n * );\n *\n * return <div ref={elementRef}>Watched element</div>;\n * }\n * ```\n */\nexport const useMutationObserver = (\n ref: React.RefObject<HTMLElement | null>,\n callback: MutationCallback,\n options: MutationObserverInit = DEFAULT_OPTIONS,\n) => {\n React.useEffect(() => {\n // Only proceed if ref has a current element\n if (ref.current) {\n // Create new MutationObserver instance\n const observer = new MutationObserver(callback);\n\n // Start observing the target element\n observer.observe(ref.current, options);\n\n // Cleanup function to disconnect observer\n return () => {\n observer.disconnect();\n };\n }\n }, [ref, callback, options]); // Re-run effect when dependencies change\n};\n","/**\n * Google Analytics linker parameter cleanup hook for React\n * Safely removes the GA `_gl` query parameter from the URL after GA initialization.\n */\n\n\"use client\";\n\nimport { useEffect } from \"react\";\n\n/**\n * Hook to remove the Google Analytics `_gl` query parameter from the current URL.\n *\n * GA's cross-domain linker temporarily appends `_gl` to URLs for attribution.\n * Removing it *too early* can break attribution, so this hook waits briefly\n * (≈2 seconds) to allow GA to read it, then strips the param using\n * `history.replaceState` without causing a page reload or React re-render.\n *\n * Behavior:\n * - Runs once on mount.\n * - If `_gl` is present, schedules its removal after ~2000ms.\n * - Uses `window.history.replaceState` to avoid navigation/re-render.\n *\n * @example\n * ```tsx\n * // app/layout.tsx or a top-level client component\n * import { useRemoveGAParams } from '@/hooks/use-remove-ga-params';\n *\n * export default function RootLayout({ children }: { children: React.ReactNode }) {\n * useRemoveGAParams();\n * return <>{children}</>;\n * }\n * ```\n */\nexport function useRemoveGAParams(): void {\n useEffect(() => {\n if (new URL(window.location.href).searchParams.has(\"_gl\")) {\n // Wait for GA to process the linker param before removing it\n const timer = setTimeout(() => {\n const url = new URL(window.location.href);\n url.searchParams.delete(\"_gl\");\n // Avoid a re-render: do not use router.replace here\n window.history.replaceState({}, \"\", url.toString());\n }, 2000);\n\n return () => clearTimeout(timer);\n }\n }, []);\n}\n","/**\n * Scroll position tracking hook for React components\n * Monitors scroll position of window or specific elements\n * with real-time updates and automatic cleanup\n */\n\n\"use client\";\n\nimport { type RefObject, useEffect, useState } from \"react\";\n\n/**\n * Configuration options for the scroll position hook\n */\ninterface UseScrollPositionProps {\n /** Optional ref to a specific scrollable element (defaults to document) */\n targetRef?: RefObject<HTMLElement | Document | undefined>;\n}\n\n/**\n * Hook to track scroll position of window or specific elements\n *\n * This hook provides real-time tracking of scroll position with support\n * for both window scrolling and element-specific scrolling. It automatically\n * handles event listener management and cleanup.\n *\n * Features:\n * - Real-time scroll position tracking\n * - Support for window and element scrolling\n * - Automatic event listener cleanup\n * - SSR-safe implementation\n * - Performance optimized\n *\n * @param options - Configuration options for the hook\n * @returns Current scroll position in pixels\n *\n * @example\n * ```tsx\n * // Track window scroll position\n * function ScrollIndicator() {\n * const scrollPosition = useScrollPosition();\n *\n * return (\n * <div className=\"scroll-indicator\">\n * Scrolled: {scrollPosition}px\n * </div>\n * );\n * }\n *\n * // Track specific element scroll position\n * function ScrollableContent() {\n * const contentRef = useRef<HTMLDivElement>(null);\n * const scrollPosition = useScrollPosition({ targetRef: contentRef });\n *\n * return (\n * <div\n * ref={contentRef}\n * className=\"h-96 overflow-y-auto\"\n * >\n * <div className=\"h-[1000px]\">\n * <p>Scroll position: {scrollPosition}px</p>\n * <p>Long content here...</p>\n * </div>\n * </div>\n * );\n * }\n *\n * // Show/hide header based on scroll\n * function StickyHeader() {\n * const scrollPosition = useScrollPosition();\n * const isVisible = scrollPosition < 100;\n *\n * return (\n * <header className={`transition-transform ${\n * isVisible ? 'translate-y-0' : '-translate-y-full'\n * }`}>\n * Header content\n * </header>\n * );\n * }\n * ```\n */\nexport const useScrollPosition = ({ targetRef }: UseScrollPositionProps = {}): number => {\n /** State to track current scroll position */\n const [scrollPosition, setScrollPosition] = useState<number>(0);\n\n useEffect(() => {\n // Determine the target element (fallback to document if not provided)\n const target = targetRef?.current || document;\n\n // Determine the scrollable element (window for document, element for others)\n const scrollable = target === document ? window : target;\n\n /**\n * Update scroll position state\n * Handles both window and element scrolling\n */\n const updatePosition = () => {\n // Get scroll position based on target type\n const scrollY =\n target === document\n ? window.scrollY || window.pageYOffset // Fallback for older browsers\n : (target as HTMLElement).scrollTop;\n\n setScrollPosition(scrollY);\n };\n\n // Add scroll event listener\n scrollable.addEventListener(\"scroll\", updatePosition, { passive: true });\n\n // Set initial scroll position\n updatePosition();\n\n // Cleanup function to remove event listener\n return () => {\n scrollable.removeEventListener(\"scroll\", updatePosition);\n };\n }, [targetRef]); // Re-run effect when targetRef changes\n\n return scrollPosition;\n};\n","/**\n * Dual slider input management hook for React components\n * Provides synchronized state management between range slider and number inputs\n * with validation and boundary enforcement\n */\n\n\"use client\";\n\nimport type * as React from \"react\";\nimport { useCallback, useState } from \"react\";\n\n/**\n * Configuration options for the slider input hook\n */\ninterface UseSliderInputProps {\n /** Minimum allowed value for the range */\n minValue: number;\n /** Maximum allowed value for the range */\n maxValue: number;\n /** Initial values for the range [min, max] */\n initialValue: [number, number];\n}\n\n/**\n * Hook for managing dual slider input with synchronized state\n *\n * This hook provides state management for components that need both\n * a range slider and corresponding number inputs. It handles synchronization\n * between the two input types, validation, and boundary enforcement.\n *\n * Features:\n * - Synchronized slider and input values\n * - Automatic validation and boundary enforcement\n * - Prevents invalid range configurations (min > max)\n * - Optimized with useCallback for performance\n *\n * @param props - Configuration options for the hook\n * @returns Object containing state and handlers for slider and inputs\n *\n * @example\n * ```tsx\n * function PriceRangeFilter() {\n * const {\n * sliderValues,\n * inputValues,\n * handleSliderChange,\n * handleInputChange,\n * validateAndUpdateValue\n * } = useSliderInput({\n * minValue: 0,\n * maxValue: 1000,\n * initialValue: [100, 500]\n * });\n *\n * return (\n * <div className=\"price-range\">\n * <div className=\"inputs\">\n * <input\n * type=\"number\"\n * value={inputValues[0]}\n * onChange={(e) => handleInputChange(e, 0)}\n * onBlur={() => validateAndUpdateValue(inputValues[0], 0)}\n * placeholder=\"Min price\"\n * />\n * <input\n * type=\"number\"\n * value={inputValues[1]}\n * onChange={(e) => handleInputChange(e, 1)}\n * onBlur={() => validateAndUpdateValue(inputValues[1], 1)}\n * placeholder=\"Max price\"\n * />\n * </div>\n *\n * <Slider\n * value={sliderValues}\n * onValueChange={handleSliderChange}\n * min={0}\n * max={1000}\n * step={10}\n * />\n * </div>\n * );\n * }\n * ```\n */\nexport function useSliderInput({ minValue, maxValue, initialValue }: UseSliderInputProps) {\n /** State for slider component values */\n const [sliderValues, setSliderValues] = useState<[number, number]>(initialValue);\n\n /** State for input field values (may temporarily differ from slider) */\n const [inputValues, setInputValues] = useState<[number, number]>(initialValue);\n\n /**\n * Handle slider value changes and sync with input values\n * Called when user interacts with the range slider\n *\n * @param values - New slider values [min, max]\n */\n const handleSliderChange = useCallback((values: [number, number]) => {\n setSliderValues(values);\n setInputValues(values); // Keep inputs in sync with slider\n }, []);\n\n /**\n * Handle input field changes\n * Updates input state without immediately affecting slider\n *\n * @param e - Input change event\n * @param index - Index of the input (0 for min, 1 for max)\n */\n const handleInputChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>, index: 0 | 1) => {\n const newValue = parseFloat(e.target.value);\n\n // Only update if the value is a valid number\n if (!Number.isNaN(newValue)) {\n const updatedInputs = [...inputValues] as [number, number];\n updatedInputs[index] = newValue;\n setInputValues(updatedInputs);\n }\n },\n [inputValues],\n );\n\n /**\n * Validate and update slider values from input\n * Called when input loses focus or user presses Enter\n * Enforces boundaries and prevents invalid ranges\n *\n * @param value - Value to validate and apply\n * @param index - Index of the value (0 for min, 1 for max)\n */\n const validateAndUpdateValue = useCallback(\n (value: number, index: 0 | 1) => {\n const updatedSlider = [...sliderValues] as [number, number];\n\n if (index === 0) {\n // Validate minimum value\n // Ensure it's not less than minValue and not greater than current max\n updatedSlider[0] = Math.max(minValue, Math.min(value, sliderValues[1]));\n } else {\n // Validate maximum value\n // Ensure it's not greater than maxValue and not less than current min\n updatedSlider[1] = Math.min(maxValue, Math.max(value, sliderValues[0]));\n }\n\n // Update both slider and input values to validated values\n setSliderValues(updatedSlider);\n setInputValues(updatedSlider);\n },\n [sliderValues, minValue, maxValue],\n );\n\n return {\n /** Function to manually set slider values */\n setSliderValues,\n /** Function to manually set input values */\n setInputValues,\n /** Current slider values [min, max] */\n sliderValues,\n /** Current input values [min, max] */\n inputValues,\n /** Handler for slider value changes */\n handleSliderChange,\n /** Handler for input field changes */\n handleInputChange,\n /** Function to validate and update values from inputs */\n validateAndUpdateValue,\n };\n}\n","/**\n * Viewport dimensions tracking hook for React components\n * Provides real-time viewport width and height with automatic updates\n * on window resize events with SSR-safe implementation\n */\n\n\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\n/**\n * Type definition for viewport dimensions\n * Returns tuple of [width, height] in pixels\n */\ntype ViewportDimensions = [number, number];\n\n/**\n * Hook to track viewport dimensions with real-time updates\n *\n * This hook provides the current viewport dimensions and automatically\n * updates when the window is resized. It's useful for responsive layouts,\n * conditional rendering based on screen size, and dynamic calculations.\n *\n * Features:\n * - Real-time viewport dimension tracking\n * - Automatic updates on window resize\n * - Performance optimized with passive event listeners\n * - SSR-safe implementation\n * - Returns both width and height\n *\n * @returns Tuple containing [width, height] in pixels\n *\n * @example\n * ```tsx\n * // Basic usage\n * function ResponsiveComponent() {\n * const [width, height] = useViewport();\n *\n * return (\n * <div>\n * <p>Viewport: {width}x{height}</p>\n * {width > 768 ? <DesktopLayout /> : <MobileLayout />}\n * </div>\n * );\n * }\n *\n * // Destructured usage\n * function ViewportInfo() {\n * const [width, height] = useViewport();\n * const aspectRatio = (width / height).toFixed(2);\n *\n * return (\n * <div className=\"viewport-info\">\n * <p>Width: {width}px</p>\n * <p>Height: {height}px</p>\n * <p>Aspect Ratio: {aspectRatio}</p>\n * </div>\n * );\n * }\n *\n * // Conditional rendering based on viewport\n * function AdaptiveGrid() {\n * const [width] = useViewport();\n * const columns = width > 1200 ? 4 : width > 768 ? 3 : width > 480 ? 2 : 1;\n *\n * return (\n * <div className={`grid grid-cols-${columns} gap-4`}>\n * {items.map(item => <GridItem key={item.id} {...item} />)}\n * </div>\n * );\n * }\n * ```\n */\nexport const useViewport = (): ViewportDimensions => {\n /**\n * State to track viewport dimensions\n * Initialized with current window dimensions or fallback for SSR\n */\n const [dimensions, setDimensions] = useState<ViewportDimensions>([0, 0]);\n\n useEffect(() => {\n /**\n * Handle window resize events\n * Updates dimensions state with current viewport size\n */\n const handleResize = (): void => {\n setDimensions([window.innerWidth, window.innerHeight]);\n };\n\n // Set initial dimensions on mount (for SSR hydration)\n handleResize();\n\n // Add resize event listener with passive option for better performance\n window.addEventListener(\"resize\", handleResize, { passive: true });\n\n // Cleanup function to remove event listener\n return () => {\n window.removeEventListener(\"resize\", handleResize);\n };\n }, []); // Empty dependency array - effect runs once on mount\n\n return dimensions;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;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