@nuvia/components 0.5.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/ui/alert.d.cts +1 -1
- package/dist/ui/alert.d.ts +1 -1
- package/dist/ui/auto-complete.cjs +1 -1
- package/dist/ui/auto-complete.cjs.map +1 -1
- package/dist/ui/auto-complete.js +1 -1
- package/dist/ui/auto-complete.js.map +1 -1
- package/dist/ui/command.d.cts +7 -7
- package/dist/ui/command.d.ts +7 -7
- package/dist/ui/input-otp.d.cts +2 -2
- package/dist/ui/input-otp.d.ts +2 -2
- package/dist/ui/input.cjs +1 -1
- package/dist/ui/input.cjs.map +1 -1
- package/dist/ui/input.js +1 -1
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/resizable.d.cts +1 -1
- package/dist/ui/resizable.d.ts +1 -1
- package/dist/ui/select.cjs +1 -1
- package/dist/ui/select.cjs.map +1 -1
- package/dist/ui/select.js +1 -1
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/sidebar.cjs +1 -1
- package/dist/ui/sidebar.cjs.map +1 -1
- package/dist/ui/sidebar.js +1 -1
- package/dist/ui/sidebar.js.map +1 -1
- package/package.json +2 -2
package/dist/ui/alert.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const Alert: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
6
|
-
variant?: "default" | "
|
|
6
|
+
variant?: "default" | "destructive" | "primary" | "warning" | null | undefined;
|
|
7
7
|
} & class_variance_authority_types.ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
|
|
8
8
|
declare const AlertTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
9
9
|
declare const AlertDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
package/dist/ui/alert.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const Alert: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
6
|
-
variant?: "default" | "
|
|
6
|
+
variant?: "default" | "destructive" | "primary" | "warning" | null | undefined;
|
|
7
7
|
} & class_variance_authority_types.ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
|
|
8
8
|
declare const AlertTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
9
9
|
declare const AlertDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
@@ -36,7 +36,7 @@ var Input = React2__namespace.forwardRef(
|
|
|
36
36
|
{
|
|
37
37
|
type,
|
|
38
38
|
className: cn(
|
|
39
|
-
"flex h-10 w-full rounded-xl border border-border bg-
|
|
39
|
+
"flex h-10 w-full rounded-xl border border-border bg-background px-3 py-1 text-base transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm group-aria-[invalid=true]:border-danger-foreground aria-[invalid=true]:border-danger-foreground",
|
|
40
40
|
className
|
|
41
41
|
),
|
|
42
42
|
ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/utils.ts","../../src/ui/input.tsx","../../src/ui/auto-complete.tsx"],"names":["twMerge","clsx","React","jsx","React2","useTranslations","jsxs","C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AWd;AAAA,YAEJ,CAAC,CAAA;AAAA,YAGA,cAAA,IACC,cAAA,CAAe,OAAA,IACf,CAAC,aAAA,CAAc,IAAA,CAAK,CAAA,MAAA,KAAU,MAAA,CAAO,KAAA,KAAU,cAAA,CAAe,OAAO,CAAA,oBACrEJ,cAAAA;AAAA,cAAC,KAAA;AAAA,cAAA;AAAA,gBACC,SAAA,EAAU,wDAAA;AAAA,gBACV,SAAS,MAAM,YAAA,CAAa,cAAA,CAAe,OAAA,EAAS,eAAe,OAAO,CAAA;AAAA,gBAEzE,QAAA,EAAA,cAAA,CAAe;AAAA;AAAA;AAClB,WAAA,EAEJ;AAAA;AAAA;AAAA;AAEJ,GAAA,EAGJ,CAAA;AAEJ,CAAC;AAED,YAAA,CAAa,WAAA,GAAc,cAAA","file":"auto-complete.cjs","sourcesContent":["import { clsx } from \"clsx\";\nimport type { ClassValue } from \"clsx\";\nimport { toast } from \"sonner\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport const cn = (...inputs: ClassValue[]): string => twMerge(clsx(inputs));\n\nexport const capitalize = (str: string) =>\n str?.charAt(0)?.toUpperCase() + str?.slice(1);\n\nexport const handleError = (error: { message: string }): void => {\n toast.error(error.message);\n};\n","import * as React from \"react\"\n\nimport { cn } from \"../lib/utils\"\n\nconst Input = React.forwardRef<HTMLInputElement, React.ComponentProps<\"input\">>(\n ({ className, type, ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex h-10 w-full rounded-xl border border-border bg-transparent px-3 py-1 text-base transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm group-aria-[invalid=true]:border-danger-foreground aria-[invalid=true]:border-danger-foreground\",\n className\n )}\n ref={ref}\n {...props}\n />\n )\n }\n)\nInput.displayName = \"Input\"\n\nexport { Input }\n","\"use client\"\n\nimport * as React from \"react\"\nimport { cn } from \"../lib/utils\"\nimport { CheckIcon } from \"@radix-ui/react-icons\"\nimport { useTranslations } from 'next-intl';\nimport { Input } from \"./input\";\nimport { Skeleton } from \"./skeleton\";\n\nexport interface AutoCompleteOption {\n value: string\n label: string\n}\n\n/**\n * A AutoComplete that uses direct DOM manipulation, with debounce,\n * and a focus guard to prevent focus loss on mobile devices during typing.\n */\n\ninterface AutoCompleteProps {\n id?: string;\n options: AutoCompleteOption[]\n placeholder?: string\n searchPlaceholder?: string\n emptyMessage?: string\n inputClassName?: string\n listClassName?: string\n allowNewOption?: boolean\n value?: AutoCompleteOption[] // Always array of option objects\n onValueChange?: (value: AutoCompleteOption[]) => void // Always returns option array\n onSelect?: (value: AutoCompleteOption[]) => void // Always returns option array\n onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void\n characterSenstiveCount?: number\n isLoading?: boolean\n showSuggestions?: boolean\n disabled?: boolean\n closeOptionsOnSelect?: boolean\n initialSuggestions?: { label: string; value: string }[]\n}\n\n/**\n * A completely reworked AutoComplete that uses direct DOM manipulation\n * to prevent focus loss on mobile devices during typing.\n */\nconst AutoComplete = React.forwardRef<HTMLDivElement, AutoCompleteProps>(({\n id,\n options,\n placeholder,\n emptyMessage,\n inputClassName,\n listClassName,\n allowNewOption,\n disabled,\n value: controlledValue,\n onValueChange, \n onSelect,\n onChange,\n showSuggestions = true,\n characterSenstiveCount = 2,\n isLoading = false, // Default to not loading\n closeOptionsOnSelect = true,\n initialSuggestions,\n}, ref) => {\n const t = useTranslations('auto-complete');\n // Use refs instead of state where possible to avoid re-renders during typing\n const valueRef = React.useRef<AutoCompleteOption[]>(controlledValue || []);\n const searchValueRef = React.useRef<string>(\"\");\n const [showOptions, setShowOptions] = React.useState(false);\n const [isHoveringOptions, setIsHoveringOptions] = React.useState(false);\n const [optionsToShow, setOptionsToShow] = React.useState<AutoCompleteOption[]>([]);\n const [showAbove, setShowAbove] = React.useState(false);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const containerRef = React.useRef<HTMLDivElement>(null);\n const optionsContainerRef = React.useRef<HTMLDivElement>(null);\n const mobileDetected = React.useRef(\n typeof window !== 'undefined' &&\n /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(\n navigator.userAgent\n )\n );\n \n // Default values using translations\n const defaultPlaceholder = isLoading \n ? 'Loading suggestions...' \n : (placeholder || t('select-option'));\n const defaultEmptyMessage = emptyMessage || t('no-option-found');\n \n // Check if there's enough space below the input\n const checkPosition = React.useCallback(() => {\n if (!inputRef.current || !containerRef.current) return;\n \n const inputRect = inputRef.current.getBoundingClientRect();\n const windowHeight = window.innerHeight;\n const bottomSpace = windowHeight - inputRect.bottom;\n const optionsHeight = 320; // Approximate max height for options (max-h-60 = 15rem = 240px + padding)\n \n // If there's not enough space below, show above\n setShowAbove(bottomSpace < optionsHeight);\n }, []);\n \n // Initialize options when component mounts or options change\n React.useEffect(() => {\n // Only set initial options if we have options and we're not loading\n if (options?.length && !isLoading) {\n if(!searchValueRef.current) {\n setOptionsToShow(initialSuggestions || options.slice(0, 20));\n } else {\n setOptionsToShow(options.slice(0, 20));\n }\n }\n }, [options, isLoading]);\n \n // Handle window resize and scroll to recalculate position\n React.useEffect(() => {\n if (!showOptions) return;\n \n // Initial position check\n checkPosition();\n \n // Add event listeners for resize and scroll\n window.addEventListener('resize', checkPosition);\n window.addEventListener('scroll', checkPosition);\n \n return () => {\n window.removeEventListener('resize', checkPosition);\n window.removeEventListener('scroll', checkPosition);\n };\n }, [showOptions, checkPosition]);\n \n // Handle forwarded ref\n React.useImperativeHandle(ref, () => ({\n querySelector: (selector: string) => {\n if (selector === 'input') return inputRef.current;\n return containerRef.current?.querySelector(selector);\n }\n } as unknown as HTMLDivElement));\n \n // Handle input value updates without state changes\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = e.target.value;\n searchValueRef.current = inputValue;\n \n // Call parent onChange without triggering re-render\n if (onChange) {\n onChange(e);\n }\n \n // Filter options without state updates during typing\n if (mobileDetected.current) {\n // For mobile, delay showing options to prevent keyboard flicker\n setTimeout(() => {\n const filtered = inputValue \n ? options.filter(option => \n option.label.toLowerCase().includes(inputValue.toLowerCase()))\n : options;\n setOptionsToShow(filtered.slice(0, 20));\n setShowOptions(true);\n }, 50);\n } else {\n // For desktop, update immediately\n const filtered = inputValue \n ? options.filter(option => \n option.label.toLowerCase().includes(inputValue.toLowerCase()))\n : options;\n setOptionsToShow(filtered.slice(0, 20));\n setShowOptions(!!inputValue || filtered.length > 0);\n }\n };\n \n // Handle selection with minimal state updates\n const handleSelect = (selectedValue: string, selectedLabel: string) => {\n const currentValue = valueRef.current;\n const newOptionItem: AutoCompleteOption = { value: selectedValue, label: selectedLabel };\n \n // Check if the option is already selected\n const isSelected = currentValue.some(item => item.value === selectedValue);\n \n // Toggle selection\n let newValue: AutoCompleteOption[];\n if (isSelected) {\n newValue = currentValue.filter(item => item.value !== selectedValue);\n } else {\n newValue = [...currentValue, newOptionItem];\n }\n \n valueRef.current = newValue;\n \n // Only trigger state updates after selection is complete\n if (inputRef.current) {\n inputRef.current.value = \"\";\n searchValueRef.current = \"\";\n }\n \n // Hide options\n if (closeOptionsOnSelect) {\n setShowOptions(false);\n }\n \n // Notify parent components\n if (onValueChange) onValueChange(newValue);\n if (onSelect) onSelect(newValue);\n \n // Ensure the input keeps focus on mobile\n if (mobileDetected.current && inputRef.current) {\n // Use a longer timeout to ensure the keyboard stays up\n setTimeout(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n }\n }, 100);\n }\n };\n \n // Handle outside clicks\n React.useEffect(() => {\n const handleOutsideClick = (e: MouseEvent) => {\n if (\n containerRef.current && \n !containerRef.current.contains(e.target as Node) &&\n optionsContainerRef.current &&\n !optionsContainerRef.current.contains(e.target as Node)\n ) {\n setShowOptions(false);\n }\n };\n \n document.addEventListener('mousedown', handleOutsideClick);\n return () => {\n document.removeEventListener('mousedown', handleOutsideClick);\n };\n }, []);\n \n // Update ref when controlled value changes\n React.useEffect(() => {\n if (controlledValue !== undefined) {\n valueRef.current = controlledValue;\n }\n }, [controlledValue]);\n \n // Get array of selected values for checking\n const selectedValueKeys = valueRef.current.map(item => item.value);\n \n\n return (\n <div ref={containerRef} className={cn(\"relative\", inputClassName)}>\n {/* Input field that maintains focus */}\n <Input\n disabled={disabled}\n ref={inputRef}\n type=\"text\"\n id={id || Math.random().toString(36).substring(2, 15)}\n placeholder={defaultPlaceholder}\n className=\"w-full rounded-xl placeholder:text-sm placeholder:truncate\"\n onChange={handleInputChange}\n onBlur={() => {\n if(allowNewOption && searchValueRef.current && !isHoveringOptions) {\n handleSelect(searchValueRef.current, searchValueRef.current);\n setShowOptions(false);\n }\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n if(optionsToShow.length > 0) {\n handleSelect(optionsToShow[0].value, optionsToShow[0].label);\n setShowOptions(false);\n inputRef.current?.blur();\n } else {\n if(allowNewOption) {\n handleSelect(searchValueRef.current, searchValueRef.current);\n setShowOptions(false);\n inputRef.current?.blur();\n }\n }\n }\n }}\n onFocus={() => {\n // Show options when input is focused with initial list\n if (mobileDetected.current) {\n setTimeout(() => {\n // Make sure we have initial options set\n if (optionsToShow.length === 0 && options.length > 0) {\n setOptionsToShow(options.slice(0, 20));\n }\n setShowOptions(true);\n checkPosition(); // Check position when showing options\n }, 50);\n } else {\n // For desktop, just show the options\n if (optionsToShow.length === 0 && options.length > 0) {\n setOptionsToShow(options.slice(0, 20));\n }\n setShowOptions(true);\n checkPosition(); // Check position when showing options\n }\n }}\n />\n {/* Options dropdown */}\n {showOptions && showSuggestions && (\n <div \n onMouseEnter={() => setIsHoveringOptions(true)}\n onMouseLeave={() => setIsHoveringOptions(false)}\n ref={optionsContainerRef}\n className={cn(\n \"absolute z-50 max-h-60 w-full overflow-auto rounded-xl bg-background border py-1 shadow-lg\",\n showAbove \n ? \"bottom-full mb-1\" // Position above with margin bottom\n : \"top-full mt-1\", // Position below with margin top\n listClassName\n )}\n > \n\n {searchValueRef.current === '' && !isLoading && <span className=\"text-xs text-foreground/75 px-4 py-1 opacity-75\">{t('suggestions')}</span>}\n\n {isLoading ? (\n <div className=\"w-full px-2 py-2 text-center text-foreground/75 text-sm\">\n <div className=\"animate-pulse rounded-xl bg-secondary py-2 dark:bg-secondary/25\">\n {t('loading-suggestions')}\n </div>\n </div>\n ) : optionsToShow.length === 0 ? (\n <div className=\"px-2 py-1 text-center flex items-center justify-center h-[35px] text-sm text-foreground/75\">\n {defaultEmptyMessage}\n </div>\n ) : (\n <div className=\"w-full px-1 flex flex-col gap-1\">\n {optionsToShow.map((option) => {\n const isSelected = selectedValueKeys.includes(option.value);\n return (\n <div\n key={option.label}\n className={cn(\n \"relative cursor-pointer select-none px-3 py-2 hover:bg-secondary/50 dark:hover:bg-secondary/25 rounded-lg\",\n isSelected && \"bg-secondary/50 dark:bg-secondary/25\"\n )}\n onClick={() => handleSelect(option.value, option.label)}\n >\n <span>{option.label}</span>\n {isSelected && (\n <CheckIcon className=\"absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2\" />\n )}\n </div>\n );\n })}\n \n {/* Allow adding new option */}\n {allowNewOption && \n searchValueRef.current && \n !optionsToShow.some(option => option.value === searchValueRef.current) && (\n <div\n className=\"cursor-pointer select-none px-3 py-2 hover:bg-gray-100\"\n onClick={() => handleSelect(searchValueRef.current, searchValueRef.current)}\n >\n {searchValueRef.current}\n </div>\n )}\n </div>\n )}\n </div>\n )}\n\n </div>\n );\n});\n\nAutoComplete.displayName = \"AutoComplete\";\n\nexport { AutoComplete };\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts","../../src/ui/input.tsx","../../src/ui/auto-complete.tsx"],"names":["twMerge","clsx","React","jsx","React2","useTranslations","jsxs","CheckIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,IAAM,KAAK,CAAA,GAAI,MAAA,KAAiCA,qBAAA,CAAQC,SAAA,CAAK,MAAM,CAAC,CAAA;ACD3E,IAAM,KA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Ae,OAAO,CAAA,oBACrEJ,cAAAA;AAAA,cAAC,KAAA;AAAA,cAAA;AAAA,gBACC,SAAA,EAAU,wDAAA;AAAA,gBACV,SAAS,MAAM,YAAA,CAAa,cAAA,CAAe,OAAA,EAAS,eAAe,OAAO,CAAA;AAAA,gBAEzE,QAAA,EAAA,cAAA,CAAe;AAAA;AAAA;AAClB,WAAA,EAEJ;AAAA;AAAA;AAAA;AAEJ,GAAA,EAGJ,CAAA;AAEJ,CAAC;AAED,YAAA,CAAa,WAAA,GAAc,cAAA","file":"auto-complete.cjs","sourcesContent":["import { clsx } from \"clsx\";\nimport type { ClassValue } from \"clsx\";\nimport { toast } from \"sonner\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport const cn = (...inputs: ClassValue[]): string => twMerge(clsx(inputs));\n\nexport const capitalize = (str: string) =>\n str?.charAt(0)?.toUpperCase() + str?.slice(1);\n\nexport const handleError = (error: { message: string }): void => {\n toast.error(error.message);\n};\n","import * as React from \"react\";\n\nimport { cn } from \"../lib/utils\";\n\nconst Input = React.forwardRef<HTMLInputElement, React.ComponentProps<\"input\">>(\n ({ className, type, ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex h-10 w-full rounded-xl border border-border bg-background px-3 py-1 text-base transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm group-aria-[invalid=true]:border-danger-foreground aria-[invalid=true]:border-danger-foreground\",\n className,\n )}\n ref={ref}\n {...props}\n />\n );\n },\n);\nInput.displayName = \"Input\";\n\nexport { Input };\n","\"use client\"\n\nimport * as React from \"react\"\nimport { cn } from \"../lib/utils\"\nimport { CheckIcon } from \"@radix-ui/react-icons\"\nimport { useTranslations } from 'next-intl';\nimport { Input } from \"./input\";\nimport { Skeleton } from \"./skeleton\";\n\nexport interface AutoCompleteOption {\n value: string\n label: string\n}\n\n/**\n * A AutoComplete that uses direct DOM manipulation, with debounce,\n * and a focus guard to prevent focus loss on mobile devices during typing.\n */\n\ninterface AutoCompleteProps {\n id?: string;\n options: AutoCompleteOption[]\n placeholder?: string\n searchPlaceholder?: string\n emptyMessage?: string\n inputClassName?: string\n listClassName?: string\n allowNewOption?: boolean\n value?: AutoCompleteOption[] // Always array of option objects\n onValueChange?: (value: AutoCompleteOption[]) => void // Always returns option array\n onSelect?: (value: AutoCompleteOption[]) => void // Always returns option array\n onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void\n characterSenstiveCount?: number\n isLoading?: boolean\n showSuggestions?: boolean\n disabled?: boolean\n closeOptionsOnSelect?: boolean\n initialSuggestions?: { label: string; value: string }[]\n}\n\n/**\n * A completely reworked AutoComplete that uses direct DOM manipulation\n * to prevent focus loss on mobile devices during typing.\n */\nconst AutoComplete = React.forwardRef<HTMLDivElement, AutoCompleteProps>(({\n id,\n options,\n placeholder,\n emptyMessage,\n inputClassName,\n listClassName,\n allowNewOption,\n disabled,\n value: controlledValue,\n onValueChange, \n onSelect,\n onChange,\n showSuggestions = true,\n characterSenstiveCount = 2,\n isLoading = false, // Default to not loading\n closeOptionsOnSelect = true,\n initialSuggestions,\n}, ref) => {\n const t = useTranslations('auto-complete');\n // Use refs instead of state where possible to avoid re-renders during typing\n const valueRef = React.useRef<AutoCompleteOption[]>(controlledValue || []);\n const searchValueRef = React.useRef<string>(\"\");\n const [showOptions, setShowOptions] = React.useState(false);\n const [isHoveringOptions, setIsHoveringOptions] = React.useState(false);\n const [optionsToShow, setOptionsToShow] = React.useState<AutoCompleteOption[]>([]);\n const [showAbove, setShowAbove] = React.useState(false);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const containerRef = React.useRef<HTMLDivElement>(null);\n const optionsContainerRef = React.useRef<HTMLDivElement>(null);\n const mobileDetected = React.useRef(\n typeof window !== 'undefined' &&\n /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(\n navigator.userAgent\n )\n );\n \n // Default values using translations\n const defaultPlaceholder = isLoading \n ? 'Loading suggestions...' \n : (placeholder || t('select-option'));\n const defaultEmptyMessage = emptyMessage || t('no-option-found');\n \n // Check if there's enough space below the input\n const checkPosition = React.useCallback(() => {\n if (!inputRef.current || !containerRef.current) return;\n \n const inputRect = inputRef.current.getBoundingClientRect();\n const windowHeight = window.innerHeight;\n const bottomSpace = windowHeight - inputRect.bottom;\n const optionsHeight = 320; // Approximate max height for options (max-h-60 = 15rem = 240px + padding)\n \n // If there's not enough space below, show above\n setShowAbove(bottomSpace < optionsHeight);\n }, []);\n \n // Initialize options when component mounts or options change\n React.useEffect(() => {\n // Only set initial options if we have options and we're not loading\n if (options?.length && !isLoading) {\n if(!searchValueRef.current) {\n setOptionsToShow(initialSuggestions || options.slice(0, 20));\n } else {\n setOptionsToShow(options.slice(0, 20));\n }\n }\n }, [options, isLoading]);\n \n // Handle window resize and scroll to recalculate position\n React.useEffect(() => {\n if (!showOptions) return;\n \n // Initial position check\n checkPosition();\n \n // Add event listeners for resize and scroll\n window.addEventListener('resize', checkPosition);\n window.addEventListener('scroll', checkPosition);\n \n return () => {\n window.removeEventListener('resize', checkPosition);\n window.removeEventListener('scroll', checkPosition);\n };\n }, [showOptions, checkPosition]);\n \n // Handle forwarded ref\n React.useImperativeHandle(ref, () => ({\n querySelector: (selector: string) => {\n if (selector === 'input') return inputRef.current;\n return containerRef.current?.querySelector(selector);\n }\n } as unknown as HTMLDivElement));\n \n // Handle input value updates without state changes\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = e.target.value;\n searchValueRef.current = inputValue;\n \n // Call parent onChange without triggering re-render\n if (onChange) {\n onChange(e);\n }\n \n // Filter options without state updates during typing\n if (mobileDetected.current) {\n // For mobile, delay showing options to prevent keyboard flicker\n setTimeout(() => {\n const filtered = inputValue \n ? options.filter(option => \n option.label.toLowerCase().includes(inputValue.toLowerCase()))\n : options;\n setOptionsToShow(filtered.slice(0, 20));\n setShowOptions(true);\n }, 50);\n } else {\n // For desktop, update immediately\n const filtered = inputValue \n ? options.filter(option => \n option.label.toLowerCase().includes(inputValue.toLowerCase()))\n : options;\n setOptionsToShow(filtered.slice(0, 20));\n setShowOptions(!!inputValue || filtered.length > 0);\n }\n };\n \n // Handle selection with minimal state updates\n const handleSelect = (selectedValue: string, selectedLabel: string) => {\n const currentValue = valueRef.current;\n const newOptionItem: AutoCompleteOption = { value: selectedValue, label: selectedLabel };\n \n // Check if the option is already selected\n const isSelected = currentValue.some(item => item.value === selectedValue);\n \n // Toggle selection\n let newValue: AutoCompleteOption[];\n if (isSelected) {\n newValue = currentValue.filter(item => item.value !== selectedValue);\n } else {\n newValue = [...currentValue, newOptionItem];\n }\n \n valueRef.current = newValue;\n \n // Only trigger state updates after selection is complete\n if (inputRef.current) {\n inputRef.current.value = \"\";\n searchValueRef.current = \"\";\n }\n \n // Hide options\n if (closeOptionsOnSelect) {\n setShowOptions(false);\n }\n \n // Notify parent components\n if (onValueChange) onValueChange(newValue);\n if (onSelect) onSelect(newValue);\n \n // Ensure the input keeps focus on mobile\n if (mobileDetected.current && inputRef.current) {\n // Use a longer timeout to ensure the keyboard stays up\n setTimeout(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n }\n }, 100);\n }\n };\n \n // Handle outside clicks\n React.useEffect(() => {\n const handleOutsideClick = (e: MouseEvent) => {\n if (\n containerRef.current && \n !containerRef.current.contains(e.target as Node) &&\n optionsContainerRef.current &&\n !optionsContainerRef.current.contains(e.target as Node)\n ) {\n setShowOptions(false);\n }\n };\n \n document.addEventListener('mousedown', handleOutsideClick);\n return () => {\n document.removeEventListener('mousedown', handleOutsideClick);\n };\n }, []);\n \n // Update ref when controlled value changes\n React.useEffect(() => {\n if (controlledValue !== undefined) {\n valueRef.current = controlledValue;\n }\n }, [controlledValue]);\n \n // Get array of selected values for checking\n const selectedValueKeys = valueRef.current.map(item => item.value);\n \n\n return (\n <div ref={containerRef} className={cn(\"relative\", inputClassName)}>\n {/* Input field that maintains focus */}\n <Input\n disabled={disabled}\n ref={inputRef}\n type=\"text\"\n id={id || Math.random().toString(36).substring(2, 15)}\n placeholder={defaultPlaceholder}\n className=\"w-full rounded-xl placeholder:text-sm placeholder:truncate\"\n onChange={handleInputChange}\n onBlur={() => {\n if(allowNewOption && searchValueRef.current && !isHoveringOptions) {\n handleSelect(searchValueRef.current, searchValueRef.current);\n setShowOptions(false);\n }\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n if(optionsToShow.length > 0) {\n handleSelect(optionsToShow[0].value, optionsToShow[0].label);\n setShowOptions(false);\n inputRef.current?.blur();\n } else {\n if(allowNewOption) {\n handleSelect(searchValueRef.current, searchValueRef.current);\n setShowOptions(false);\n inputRef.current?.blur();\n }\n }\n }\n }}\n onFocus={() => {\n // Show options when input is focused with initial list\n if (mobileDetected.current) {\n setTimeout(() => {\n // Make sure we have initial options set\n if (optionsToShow.length === 0 && options.length > 0) {\n setOptionsToShow(options.slice(0, 20));\n }\n setShowOptions(true);\n checkPosition(); // Check position when showing options\n }, 50);\n } else {\n // For desktop, just show the options\n if (optionsToShow.length === 0 && options.length > 0) {\n setOptionsToShow(options.slice(0, 20));\n }\n setShowOptions(true);\n checkPosition(); // Check position when showing options\n }\n }}\n />\n {/* Options dropdown */}\n {showOptions && showSuggestions && (\n <div \n onMouseEnter={() => setIsHoveringOptions(true)}\n onMouseLeave={() => setIsHoveringOptions(false)}\n ref={optionsContainerRef}\n className={cn(\n \"absolute z-50 max-h-60 w-full overflow-auto rounded-xl bg-background border py-1 shadow-lg\",\n showAbove \n ? \"bottom-full mb-1\" // Position above with margin bottom\n : \"top-full mt-1\", // Position below with margin top\n listClassName\n )}\n > \n\n {searchValueRef.current === '' && !isLoading && <span className=\"text-xs text-foreground/75 px-4 py-1 opacity-75\">{t('suggestions')}</span>}\n\n {isLoading ? (\n <div className=\"w-full px-2 py-2 text-center text-foreground/75 text-sm\">\n <div className=\"animate-pulse rounded-xl bg-secondary py-2 dark:bg-secondary/25\">\n {t('loading-suggestions')}\n </div>\n </div>\n ) : optionsToShow.length === 0 ? (\n <div className=\"px-2 py-1 text-center flex items-center justify-center h-[35px] text-sm text-foreground/75\">\n {defaultEmptyMessage}\n </div>\n ) : (\n <div className=\"w-full px-1 flex flex-col gap-1\">\n {optionsToShow.map((option) => {\n const isSelected = selectedValueKeys.includes(option.value);\n return (\n <div\n key={option.label}\n className={cn(\n \"relative cursor-pointer select-none px-3 py-2 hover:bg-secondary/50 dark:hover:bg-secondary/25 rounded-lg\",\n isSelected && \"bg-secondary/50 dark:bg-secondary/25\"\n )}\n onClick={() => handleSelect(option.value, option.label)}\n >\n <span>{option.label}</span>\n {isSelected && (\n <CheckIcon className=\"absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2\" />\n )}\n </div>\n );\n })}\n \n {/* Allow adding new option */}\n {allowNewOption && \n searchValueRef.current && \n !optionsToShow.some(option => option.value === searchValueRef.current) && (\n <div\n className=\"cursor-pointer select-none px-3 py-2 hover:bg-gray-100\"\n onClick={() => handleSelect(searchValueRef.current, searchValueRef.current)}\n >\n {searchValueRef.current}\n </div>\n )}\n </div>\n )}\n </div>\n )}\n\n </div>\n );\n});\n\nAutoComplete.displayName = \"AutoComplete\";\n\nexport { AutoComplete };\n"]}
|
package/dist/ui/auto-complete.js
CHANGED
|
@@ -14,7 +14,7 @@ var Input = React2.forwardRef(
|
|
|
14
14
|
{
|
|
15
15
|
type,
|
|
16
16
|
className: cn(
|
|
17
|
-
"flex h-10 w-full rounded-xl border border-border bg-
|
|
17
|
+
"flex h-10 w-full rounded-xl border border-border bg-background px-3 py-1 text-base transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm group-aria-[invalid=true]:border-danger-foreground aria-[invalid=true]:border-danger-foreground",
|
|
18
18
|
className
|
|
19
19
|
),
|
|
20
20
|
ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/utils.ts","../../src/ui/input.tsx","../../src/ui/auto-complete.tsx"],"names":["React","jsx"],"mappings":";;;;;;;;AAKO,IAAM,KAAK,CAAA,GAAI,MAAA,KAAiC,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;ACD3E,IAAM,KAAA,GAAcA,MAAA,CAAA,UAAA;AAAA,EAClB,CAAC,EAAE,SAAA,EAAW,MAAM,GAAG,KAAA,IAAS,GAAA,KAAQ;AACtC,IAAA,uBACE,GAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,IAAA;AAAA,QACA,SAAA,EAAW,EAAA;AAAA,UACT,kcAAA;AAAA,UACA;AAAA,SACF;AAAA,QACA,GAAA;AAAA,QACC,GAAG;AAAA;AAAA,KACN;AAAA,EAEJ;AACF,CAAA;AACA,KAAA,CAAM,WAAA,GAAc,OAAA;ACyBpB,IAAM,YAAA,GAAqB,kBAA8C,CAAC;AAAA,EACxE,EAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACA,YAAA;AAAA,EACA,cAAA;AAAA,EACA,aAAA;AAAA,EACA,cAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA,EAAO,eAAA;AAAA,EACP,aAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,eAAA,GAAkB,IAAA;AAAA,EAClB,sBAAA,GAAyB,CAAA;AAAA,EACzB,SAAA,GAAY,KAAA;AAAA;AAAA,EACZ,oBAAA,GAAuB,IAAA;AAAA,EACvB;AACF,CAAA,EAAG,GAAA,KAAQ;AACT,EAAA,MAAM,CAAA,GAAI,gBAAgB,eAAe,CAAA;AAEzC,EAAA,MAAM,QAAA,GAAiB,MAAA,CAAA,MAAA,CAA6B,eAAA,IAAmB,EAAE,CAAA;AACzE,EAAA,MAAM,cAAA,GAAuB,cAAe,EAAE,CAAA;AAC9C,EAAA,MAAM,CAAC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AA;AAAA,iBAAA;AAAA,gBATtE,MAAA,CAAO;AAAA,eAWd;AAAA,YAEJ,CAAC,CAAA;AAAA,YAGA,cAAA,IACC,cAAA,CAAe,OAAA,IACf,CAAC,aAAA,CAAc,IAAA,CAAK,CAAA,MAAA,KAAU,MAAA,CAAO,KAAA,KAAU,cAAA,CAAe,OAAO,CAAA,oBACrEA,GAAAA;AAAA,cAAC,KAAA;AAAA,cAAA;AAAA,gBACC,SAAA,EAAU,wDAAA;AAAA,gBACV,SAAS,MAAM,YAAA,CAAa,cAAA,CAAe,OAAA,EAAS,eAAe,OAAO,CAAA;AAAA,gBAEzE,QAAA,EAAA,cAAA,CAAe;AAAA;AAAA;AAClB,WAAA,EAEJ;AAAA;AAAA;AAAA;AAEJ,GAAA,EAGJ,CAAA;AAEJ,CAAC;AAED,YAAA,CAAa,WAAA,GAAc,cAAA","file":"auto-complete.js","sourcesContent":["import { clsx } from \"clsx\";\nimport type { ClassValue } from \"clsx\";\nimport { toast } from \"sonner\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport const cn = (...inputs: ClassValue[]): string => twMerge(clsx(inputs));\n\nexport const capitalize = (str: string) =>\n str?.charAt(0)?.toUpperCase() + str?.slice(1);\n\nexport const handleError = (error: { message: string }): void => {\n toast.error(error.message);\n};\n","import * as React from \"react\"\n\nimport { cn } from \"../lib/utils\"\n\nconst Input = React.forwardRef<HTMLInputElement, React.ComponentProps<\"input\">>(\n ({ className, type, ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex h-10 w-full rounded-xl border border-border bg-transparent px-3 py-1 text-base transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm group-aria-[invalid=true]:border-danger-foreground aria-[invalid=true]:border-danger-foreground\",\n className\n )}\n ref={ref}\n {...props}\n />\n )\n }\n)\nInput.displayName = \"Input\"\n\nexport { Input }\n","\"use client\"\n\nimport * as React from \"react\"\nimport { cn } from \"../lib/utils\"\nimport { CheckIcon } from \"@radix-ui/react-icons\"\nimport { useTranslations } from 'next-intl';\nimport { Input } from \"./input\";\nimport { Skeleton } from \"./skeleton\";\n\nexport interface AutoCompleteOption {\n value: string\n label: string\n}\n\n/**\n * A AutoComplete that uses direct DOM manipulation, with debounce,\n * and a focus guard to prevent focus loss on mobile devices during typing.\n */\n\ninterface AutoCompleteProps {\n id?: string;\n options: AutoCompleteOption[]\n placeholder?: string\n searchPlaceholder?: string\n emptyMessage?: string\n inputClassName?: string\n listClassName?: string\n allowNewOption?: boolean\n value?: AutoCompleteOption[] // Always array of option objects\n onValueChange?: (value: AutoCompleteOption[]) => void // Always returns option array\n onSelect?: (value: AutoCompleteOption[]) => void // Always returns option array\n onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void\n characterSenstiveCount?: number\n isLoading?: boolean\n showSuggestions?: boolean\n disabled?: boolean\n closeOptionsOnSelect?: boolean\n initialSuggestions?: { label: string; value: string }[]\n}\n\n/**\n * A completely reworked AutoComplete that uses direct DOM manipulation\n * to prevent focus loss on mobile devices during typing.\n */\nconst AutoComplete = React.forwardRef<HTMLDivElement, AutoCompleteProps>(({\n id,\n options,\n placeholder,\n emptyMessage,\n inputClassName,\n listClassName,\n allowNewOption,\n disabled,\n value: controlledValue,\n onValueChange, \n onSelect,\n onChange,\n showSuggestions = true,\n characterSenstiveCount = 2,\n isLoading = false, // Default to not loading\n closeOptionsOnSelect = true,\n initialSuggestions,\n}, ref) => {\n const t = useTranslations('auto-complete');\n // Use refs instead of state where possible to avoid re-renders during typing\n const valueRef = React.useRef<AutoCompleteOption[]>(controlledValue || []);\n const searchValueRef = React.useRef<string>(\"\");\n const [showOptions, setShowOptions] = React.useState(false);\n const [isHoveringOptions, setIsHoveringOptions] = React.useState(false);\n const [optionsToShow, setOptionsToShow] = React.useState<AutoCompleteOption[]>([]);\n const [showAbove, setShowAbove] = React.useState(false);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const containerRef = React.useRef<HTMLDivElement>(null);\n const optionsContainerRef = React.useRef<HTMLDivElement>(null);\n const mobileDetected = React.useRef(\n typeof window !== 'undefined' &&\n /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(\n navigator.userAgent\n )\n );\n \n // Default values using translations\n const defaultPlaceholder = isLoading \n ? 'Loading suggestions...' \n : (placeholder || t('select-option'));\n const defaultEmptyMessage = emptyMessage || t('no-option-found');\n \n // Check if there's enough space below the input\n const checkPosition = React.useCallback(() => {\n if (!inputRef.current || !containerRef.current) return;\n \n const inputRect = inputRef.current.getBoundingClientRect();\n const windowHeight = window.innerHeight;\n const bottomSpace = windowHeight - inputRect.bottom;\n const optionsHeight = 320; // Approximate max height for options (max-h-60 = 15rem = 240px + padding)\n \n // If there's not enough space below, show above\n setShowAbove(bottomSpace < optionsHeight);\n }, []);\n \n // Initialize options when component mounts or options change\n React.useEffect(() => {\n // Only set initial options if we have options and we're not loading\n if (options?.length && !isLoading) {\n if(!searchValueRef.current) {\n setOptionsToShow(initialSuggestions || options.slice(0, 20));\n } else {\n setOptionsToShow(options.slice(0, 20));\n }\n }\n }, [options, isLoading]);\n \n // Handle window resize and scroll to recalculate position\n React.useEffect(() => {\n if (!showOptions) return;\n \n // Initial position check\n checkPosition();\n \n // Add event listeners for resize and scroll\n window.addEventListener('resize', checkPosition);\n window.addEventListener('scroll', checkPosition);\n \n return () => {\n window.removeEventListener('resize', checkPosition);\n window.removeEventListener('scroll', checkPosition);\n };\n }, [showOptions, checkPosition]);\n \n // Handle forwarded ref\n React.useImperativeHandle(ref, () => ({\n querySelector: (selector: string) => {\n if (selector === 'input') return inputRef.current;\n return containerRef.current?.querySelector(selector);\n }\n } as unknown as HTMLDivElement));\n \n // Handle input value updates without state changes\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = e.target.value;\n searchValueRef.current = inputValue;\n \n // Call parent onChange without triggering re-render\n if (onChange) {\n onChange(e);\n }\n \n // Filter options without state updates during typing\n if (mobileDetected.current) {\n // For mobile, delay showing options to prevent keyboard flicker\n setTimeout(() => {\n const filtered = inputValue \n ? options.filter(option => \n option.label.toLowerCase().includes(inputValue.toLowerCase()))\n : options;\n setOptionsToShow(filtered.slice(0, 20));\n setShowOptions(true);\n }, 50);\n } else {\n // For desktop, update immediately\n const filtered = inputValue \n ? options.filter(option => \n option.label.toLowerCase().includes(inputValue.toLowerCase()))\n : options;\n setOptionsToShow(filtered.slice(0, 20));\n setShowOptions(!!inputValue || filtered.length > 0);\n }\n };\n \n // Handle selection with minimal state updates\n const handleSelect = (selectedValue: string, selectedLabel: string) => {\n const currentValue = valueRef.current;\n const newOptionItem: AutoCompleteOption = { value: selectedValue, label: selectedLabel };\n \n // Check if the option is already selected\n const isSelected = currentValue.some(item => item.value === selectedValue);\n \n // Toggle selection\n let newValue: AutoCompleteOption[];\n if (isSelected) {\n newValue = currentValue.filter(item => item.value !== selectedValue);\n } else {\n newValue = [...currentValue, newOptionItem];\n }\n \n valueRef.current = newValue;\n \n // Only trigger state updates after selection is complete\n if (inputRef.current) {\n inputRef.current.value = \"\";\n searchValueRef.current = \"\";\n }\n \n // Hide options\n if (closeOptionsOnSelect) {\n setShowOptions(false);\n }\n \n // Notify parent components\n if (onValueChange) onValueChange(newValue);\n if (onSelect) onSelect(newValue);\n \n // Ensure the input keeps focus on mobile\n if (mobileDetected.current && inputRef.current) {\n // Use a longer timeout to ensure the keyboard stays up\n setTimeout(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n }\n }, 100);\n }\n };\n \n // Handle outside clicks\n React.useEffect(() => {\n const handleOutsideClick = (e: MouseEvent) => {\n if (\n containerRef.current && \n !containerRef.current.contains(e.target as Node) &&\n optionsContainerRef.current &&\n !optionsContainerRef.current.contains(e.target as Node)\n ) {\n setShowOptions(false);\n }\n };\n \n document.addEventListener('mousedown', handleOutsideClick);\n return () => {\n document.removeEventListener('mousedown', handleOutsideClick);\n };\n }, []);\n \n // Update ref when controlled value changes\n React.useEffect(() => {\n if (controlledValue !== undefined) {\n valueRef.current = controlledValue;\n }\n }, [controlledValue]);\n \n // Get array of selected values for checking\n const selectedValueKeys = valueRef.current.map(item => item.value);\n \n\n return (\n <div ref={containerRef} className={cn(\"relative\", inputClassName)}>\n {/* Input field that maintains focus */}\n <Input\n disabled={disabled}\n ref={inputRef}\n type=\"text\"\n id={id || Math.random().toString(36).substring(2, 15)}\n placeholder={defaultPlaceholder}\n className=\"w-full rounded-xl placeholder:text-sm placeholder:truncate\"\n onChange={handleInputChange}\n onBlur={() => {\n if(allowNewOption && searchValueRef.current && !isHoveringOptions) {\n handleSelect(searchValueRef.current, searchValueRef.current);\n setShowOptions(false);\n }\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n if(optionsToShow.length > 0) {\n handleSelect(optionsToShow[0].value, optionsToShow[0].label);\n setShowOptions(false);\n inputRef.current?.blur();\n } else {\n if(allowNewOption) {\n handleSelect(searchValueRef.current, searchValueRef.current);\n setShowOptions(false);\n inputRef.current?.blur();\n }\n }\n }\n }}\n onFocus={() => {\n // Show options when input is focused with initial list\n if (mobileDetected.current) {\n setTimeout(() => {\n // Make sure we have initial options set\n if (optionsToShow.length === 0 && options.length > 0) {\n setOptionsToShow(options.slice(0, 20));\n }\n setShowOptions(true);\n checkPosition(); // Check position when showing options\n }, 50);\n } else {\n // For desktop, just show the options\n if (optionsToShow.length === 0 && options.length > 0) {\n setOptionsToShow(options.slice(0, 20));\n }\n setShowOptions(true);\n checkPosition(); // Check position when showing options\n }\n }}\n />\n {/* Options dropdown */}\n {showOptions && showSuggestions && (\n <div \n onMouseEnter={() => setIsHoveringOptions(true)}\n onMouseLeave={() => setIsHoveringOptions(false)}\n ref={optionsContainerRef}\n className={cn(\n \"absolute z-50 max-h-60 w-full overflow-auto rounded-xl bg-background border py-1 shadow-lg\",\n showAbove \n ? \"bottom-full mb-1\" // Position above with margin bottom\n : \"top-full mt-1\", // Position below with margin top\n listClassName\n )}\n > \n\n {searchValueRef.current === '' && !isLoading && <span className=\"text-xs text-foreground/75 px-4 py-1 opacity-75\">{t('suggestions')}</span>}\n\n {isLoading ? (\n <div className=\"w-full px-2 py-2 text-center text-foreground/75 text-sm\">\n <div className=\"animate-pulse rounded-xl bg-secondary py-2 dark:bg-secondary/25\">\n {t('loading-suggestions')}\n </div>\n </div>\n ) : optionsToShow.length === 0 ? (\n <div className=\"px-2 py-1 text-center flex items-center justify-center h-[35px] text-sm text-foreground/75\">\n {defaultEmptyMessage}\n </div>\n ) : (\n <div className=\"w-full px-1 flex flex-col gap-1\">\n {optionsToShow.map((option) => {\n const isSelected = selectedValueKeys.includes(option.value);\n return (\n <div\n key={option.label}\n className={cn(\n \"relative cursor-pointer select-none px-3 py-2 hover:bg-secondary/50 dark:hover:bg-secondary/25 rounded-lg\",\n isSelected && \"bg-secondary/50 dark:bg-secondary/25\"\n )}\n onClick={() => handleSelect(option.value, option.label)}\n >\n <span>{option.label}</span>\n {isSelected && (\n <CheckIcon className=\"absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2\" />\n )}\n </div>\n );\n })}\n \n {/* Allow adding new option */}\n {allowNewOption && \n searchValueRef.current && \n !optionsToShow.some(option => option.value === searchValueRef.current) && (\n <div\n className=\"cursor-pointer select-none px-3 py-2 hover:bg-gray-100\"\n onClick={() => handleSelect(searchValueRef.current, searchValueRef.current)}\n >\n {searchValueRef.current}\n </div>\n )}\n </div>\n )}\n </div>\n )}\n\n </div>\n );\n});\n\nAutoComplete.displayName = \"AutoComplete\";\n\nexport { AutoComplete };\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts","../../src/ui/input.tsx","../../src/ui/auto-complete.tsx"],"names":["React","jsx"],"mappings":";;;;;;;;AAKO,IAAM,KAAK,CAAA,GAAI,MAAA,KAAiC,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;ACD3E,IAAM,KAAA,GAAcA,MAAA,CA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A;AAAA,gBACC,SAAA,EAAU,wDAAA;AAAA,gBACV,SAAS,MAAM,YAAA,CAAa,cAAA,CAAe,OAAA,EAAS,eAAe,OAAO,CAAA;AAAA,gBAEzE,QAAA,EAAA,cAAA,CAAe;AAAA;AAAA;AAClB,WAAA,EAEJ;AAAA;AAAA;AAAA;AAEJ,GAAA,EAGJ,CAAA;AAEJ,CAAC;AAED,YAAA,CAAa,WAAA,GAAc,cAAA","file":"auto-complete.js","sourcesContent":["import { clsx } from \"clsx\";\nimport type { ClassValue } from \"clsx\";\nimport { toast } from \"sonner\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport const cn = (...inputs: ClassValue[]): string => twMerge(clsx(inputs));\n\nexport const capitalize = (str: string) =>\n str?.charAt(0)?.toUpperCase() + str?.slice(1);\n\nexport const handleError = (error: { message: string }): void => {\n toast.error(error.message);\n};\n","import * as React from \"react\";\n\nimport { cn } from \"../lib/utils\";\n\nconst Input = React.forwardRef<HTMLInputElement, React.ComponentProps<\"input\">>(\n ({ className, type, ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex h-10 w-full rounded-xl border border-border bg-background px-3 py-1 text-base transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm group-aria-[invalid=true]:border-danger-foreground aria-[invalid=true]:border-danger-foreground\",\n className,\n )}\n ref={ref}\n {...props}\n />\n );\n },\n);\nInput.displayName = \"Input\";\n\nexport { Input };\n","\"use client\"\n\nimport * as React from \"react\"\nimport { cn } from \"../lib/utils\"\nimport { CheckIcon } from \"@radix-ui/react-icons\"\nimport { useTranslations } from 'next-intl';\nimport { Input } from \"./input\";\nimport { Skeleton } from \"./skeleton\";\n\nexport interface AutoCompleteOption {\n value: string\n label: string\n}\n\n/**\n * A AutoComplete that uses direct DOM manipulation, with debounce,\n * and a focus guard to prevent focus loss on mobile devices during typing.\n */\n\ninterface AutoCompleteProps {\n id?: string;\n options: AutoCompleteOption[]\n placeholder?: string\n searchPlaceholder?: string\n emptyMessage?: string\n inputClassName?: string\n listClassName?: string\n allowNewOption?: boolean\n value?: AutoCompleteOption[] // Always array of option objects\n onValueChange?: (value: AutoCompleteOption[]) => void // Always returns option array\n onSelect?: (value: AutoCompleteOption[]) => void // Always returns option array\n onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void\n characterSenstiveCount?: number\n isLoading?: boolean\n showSuggestions?: boolean\n disabled?: boolean\n closeOptionsOnSelect?: boolean\n initialSuggestions?: { label: string; value: string }[]\n}\n\n/**\n * A completely reworked AutoComplete that uses direct DOM manipulation\n * to prevent focus loss on mobile devices during typing.\n */\nconst AutoComplete = React.forwardRef<HTMLDivElement, AutoCompleteProps>(({\n id,\n options,\n placeholder,\n emptyMessage,\n inputClassName,\n listClassName,\n allowNewOption,\n disabled,\n value: controlledValue,\n onValueChange, \n onSelect,\n onChange,\n showSuggestions = true,\n characterSenstiveCount = 2,\n isLoading = false, // Default to not loading\n closeOptionsOnSelect = true,\n initialSuggestions,\n}, ref) => {\n const t = useTranslations('auto-complete');\n // Use refs instead of state where possible to avoid re-renders during typing\n const valueRef = React.useRef<AutoCompleteOption[]>(controlledValue || []);\n const searchValueRef = React.useRef<string>(\"\");\n const [showOptions, setShowOptions] = React.useState(false);\n const [isHoveringOptions, setIsHoveringOptions] = React.useState(false);\n const [optionsToShow, setOptionsToShow] = React.useState<AutoCompleteOption[]>([]);\n const [showAbove, setShowAbove] = React.useState(false);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const containerRef = React.useRef<HTMLDivElement>(null);\n const optionsContainerRef = React.useRef<HTMLDivElement>(null);\n const mobileDetected = React.useRef(\n typeof window !== 'undefined' &&\n /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(\n navigator.userAgent\n )\n );\n \n // Default values using translations\n const defaultPlaceholder = isLoading \n ? 'Loading suggestions...' \n : (placeholder || t('select-option'));\n const defaultEmptyMessage = emptyMessage || t('no-option-found');\n \n // Check if there's enough space below the input\n const checkPosition = React.useCallback(() => {\n if (!inputRef.current || !containerRef.current) return;\n \n const inputRect = inputRef.current.getBoundingClientRect();\n const windowHeight = window.innerHeight;\n const bottomSpace = windowHeight - inputRect.bottom;\n const optionsHeight = 320; // Approximate max height for options (max-h-60 = 15rem = 240px + padding)\n \n // If there's not enough space below, show above\n setShowAbove(bottomSpace < optionsHeight);\n }, []);\n \n // Initialize options when component mounts or options change\n React.useEffect(() => {\n // Only set initial options if we have options and we're not loading\n if (options?.length && !isLoading) {\n if(!searchValueRef.current) {\n setOptionsToShow(initialSuggestions || options.slice(0, 20));\n } else {\n setOptionsToShow(options.slice(0, 20));\n }\n }\n }, [options, isLoading]);\n \n // Handle window resize and scroll to recalculate position\n React.useEffect(() => {\n if (!showOptions) return;\n \n // Initial position check\n checkPosition();\n \n // Add event listeners for resize and scroll\n window.addEventListener('resize', checkPosition);\n window.addEventListener('scroll', checkPosition);\n \n return () => {\n window.removeEventListener('resize', checkPosition);\n window.removeEventListener('scroll', checkPosition);\n };\n }, [showOptions, checkPosition]);\n \n // Handle forwarded ref\n React.useImperativeHandle(ref, () => ({\n querySelector: (selector: string) => {\n if (selector === 'input') return inputRef.current;\n return containerRef.current?.querySelector(selector);\n }\n } as unknown as HTMLDivElement));\n \n // Handle input value updates without state changes\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = e.target.value;\n searchValueRef.current = inputValue;\n \n // Call parent onChange without triggering re-render\n if (onChange) {\n onChange(e);\n }\n \n // Filter options without state updates during typing\n if (mobileDetected.current) {\n // For mobile, delay showing options to prevent keyboard flicker\n setTimeout(() => {\n const filtered = inputValue \n ? options.filter(option => \n option.label.toLowerCase().includes(inputValue.toLowerCase()))\n : options;\n setOptionsToShow(filtered.slice(0, 20));\n setShowOptions(true);\n }, 50);\n } else {\n // For desktop, update immediately\n const filtered = inputValue \n ? options.filter(option => \n option.label.toLowerCase().includes(inputValue.toLowerCase()))\n : options;\n setOptionsToShow(filtered.slice(0, 20));\n setShowOptions(!!inputValue || filtered.length > 0);\n }\n };\n \n // Handle selection with minimal state updates\n const handleSelect = (selectedValue: string, selectedLabel: string) => {\n const currentValue = valueRef.current;\n const newOptionItem: AutoCompleteOption = { value: selectedValue, label: selectedLabel };\n \n // Check if the option is already selected\n const isSelected = currentValue.some(item => item.value === selectedValue);\n \n // Toggle selection\n let newValue: AutoCompleteOption[];\n if (isSelected) {\n newValue = currentValue.filter(item => item.value !== selectedValue);\n } else {\n newValue = [...currentValue, newOptionItem];\n }\n \n valueRef.current = newValue;\n \n // Only trigger state updates after selection is complete\n if (inputRef.current) {\n inputRef.current.value = \"\";\n searchValueRef.current = \"\";\n }\n \n // Hide options\n if (closeOptionsOnSelect) {\n setShowOptions(false);\n }\n \n // Notify parent components\n if (onValueChange) onValueChange(newValue);\n if (onSelect) onSelect(newValue);\n \n // Ensure the input keeps focus on mobile\n if (mobileDetected.current && inputRef.current) {\n // Use a longer timeout to ensure the keyboard stays up\n setTimeout(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n }\n }, 100);\n }\n };\n \n // Handle outside clicks\n React.useEffect(() => {\n const handleOutsideClick = (e: MouseEvent) => {\n if (\n containerRef.current && \n !containerRef.current.contains(e.target as Node) &&\n optionsContainerRef.current &&\n !optionsContainerRef.current.contains(e.target as Node)\n ) {\n setShowOptions(false);\n }\n };\n \n document.addEventListener('mousedown', handleOutsideClick);\n return () => {\n document.removeEventListener('mousedown', handleOutsideClick);\n };\n }, []);\n \n // Update ref when controlled value changes\n React.useEffect(() => {\n if (controlledValue !== undefined) {\n valueRef.current = controlledValue;\n }\n }, [controlledValue]);\n \n // Get array of selected values for checking\n const selectedValueKeys = valueRef.current.map(item => item.value);\n \n\n return (\n <div ref={containerRef} className={cn(\"relative\", inputClassName)}>\n {/* Input field that maintains focus */}\n <Input\n disabled={disabled}\n ref={inputRef}\n type=\"text\"\n id={id || Math.random().toString(36).substring(2, 15)}\n placeholder={defaultPlaceholder}\n className=\"w-full rounded-xl placeholder:text-sm placeholder:truncate\"\n onChange={handleInputChange}\n onBlur={() => {\n if(allowNewOption && searchValueRef.current && !isHoveringOptions) {\n handleSelect(searchValueRef.current, searchValueRef.current);\n setShowOptions(false);\n }\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n if(optionsToShow.length > 0) {\n handleSelect(optionsToShow[0].value, optionsToShow[0].label);\n setShowOptions(false);\n inputRef.current?.blur();\n } else {\n if(allowNewOption) {\n handleSelect(searchValueRef.current, searchValueRef.current);\n setShowOptions(false);\n inputRef.current?.blur();\n }\n }\n }\n }}\n onFocus={() => {\n // Show options when input is focused with initial list\n if (mobileDetected.current) {\n setTimeout(() => {\n // Make sure we have initial options set\n if (optionsToShow.length === 0 && options.length > 0) {\n setOptionsToShow(options.slice(0, 20));\n }\n setShowOptions(true);\n checkPosition(); // Check position when showing options\n }, 50);\n } else {\n // For desktop, just show the options\n if (optionsToShow.length === 0 && options.length > 0) {\n setOptionsToShow(options.slice(0, 20));\n }\n setShowOptions(true);\n checkPosition(); // Check position when showing options\n }\n }}\n />\n {/* Options dropdown */}\n {showOptions && showSuggestions && (\n <div \n onMouseEnter={() => setIsHoveringOptions(true)}\n onMouseLeave={() => setIsHoveringOptions(false)}\n ref={optionsContainerRef}\n className={cn(\n \"absolute z-50 max-h-60 w-full overflow-auto rounded-xl bg-background border py-1 shadow-lg\",\n showAbove \n ? \"bottom-full mb-1\" // Position above with margin bottom\n : \"top-full mt-1\", // Position below with margin top\n listClassName\n )}\n > \n\n {searchValueRef.current === '' && !isLoading && <span className=\"text-xs text-foreground/75 px-4 py-1 opacity-75\">{t('suggestions')}</span>}\n\n {isLoading ? (\n <div className=\"w-full px-2 py-2 text-center text-foreground/75 text-sm\">\n <div className=\"animate-pulse rounded-xl bg-secondary py-2 dark:bg-secondary/25\">\n {t('loading-suggestions')}\n </div>\n </div>\n ) : optionsToShow.length === 0 ? (\n <div className=\"px-2 py-1 text-center flex items-center justify-center h-[35px] text-sm text-foreground/75\">\n {defaultEmptyMessage}\n </div>\n ) : (\n <div className=\"w-full px-1 flex flex-col gap-1\">\n {optionsToShow.map((option) => {\n const isSelected = selectedValueKeys.includes(option.value);\n return (\n <div\n key={option.label}\n className={cn(\n \"relative cursor-pointer select-none px-3 py-2 hover:bg-secondary/50 dark:hover:bg-secondary/25 rounded-lg\",\n isSelected && \"bg-secondary/50 dark:bg-secondary/25\"\n )}\n onClick={() => handleSelect(option.value, option.label)}\n >\n <span>{option.label}</span>\n {isSelected && (\n <CheckIcon className=\"absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2\" />\n )}\n </div>\n );\n })}\n \n {/* Allow adding new option */}\n {allowNewOption && \n searchValueRef.current && \n !optionsToShow.some(option => option.value === searchValueRef.current) && (\n <div\n className=\"cursor-pointer select-none px-3 py-2 hover:bg-gray-100\"\n onClick={() => handleSelect(searchValueRef.current, searchValueRef.current)}\n >\n {searchValueRef.current}\n </div>\n )}\n </div>\n )}\n </div>\n )}\n\n </div>\n );\n});\n\nAutoComplete.displayName = \"AutoComplete\";\n\nexport { AutoComplete };\n"]}
|
package/dist/ui/command.d.cts
CHANGED
|
@@ -8,7 +8,7 @@ declare const Command: React.ForwardRefExoticComponent<Omit<{
|
|
|
8
8
|
ref?: React.Ref<HTMLDivElement>;
|
|
9
9
|
} & {
|
|
10
10
|
asChild?: boolean;
|
|
11
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
11
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
12
12
|
label?: string;
|
|
13
13
|
shouldFilter?: boolean;
|
|
14
14
|
filter?: (value: string, search: string, keywords?: string[]) => number;
|
|
@@ -24,7 +24,7 @@ declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<
|
|
|
24
24
|
ref?: React.Ref<HTMLInputElement>;
|
|
25
25
|
} & {
|
|
26
26
|
asChild?: boolean;
|
|
27
|
-
}, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "
|
|
27
|
+
}, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "value" | "onChange" | "type"> & {
|
|
28
28
|
value?: string;
|
|
29
29
|
onValueChange?: (search: string) => void;
|
|
30
30
|
} & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -34,7 +34,7 @@ declare const CommandList: React.ForwardRefExoticComponent<Omit<{
|
|
|
34
34
|
ref?: React.Ref<HTMLDivElement>;
|
|
35
35
|
} & {
|
|
36
36
|
asChild?: boolean;
|
|
37
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
37
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
38
38
|
label?: string;
|
|
39
39
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
40
40
|
declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
|
|
@@ -43,14 +43,14 @@ declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
|
|
|
43
43
|
ref?: React.Ref<HTMLDivElement>;
|
|
44
44
|
} & {
|
|
45
45
|
asChild?: boolean;
|
|
46
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
46
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
47
47
|
declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
|
|
48
48
|
children?: React.ReactNode;
|
|
49
49
|
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
50
50
|
ref?: React.Ref<HTMLDivElement>;
|
|
51
51
|
} & {
|
|
52
52
|
asChild?: boolean;
|
|
53
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
53
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "heading"> & {
|
|
54
54
|
heading?: React.ReactNode;
|
|
55
55
|
value?: string;
|
|
56
56
|
forceMount?: boolean;
|
|
@@ -59,7 +59,7 @@ declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<R
|
|
|
59
59
|
ref?: React.Ref<HTMLDivElement>;
|
|
60
60
|
} & {
|
|
61
61
|
asChild?: boolean;
|
|
62
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
62
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
63
63
|
alwaysRender?: boolean;
|
|
64
64
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
65
65
|
declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
|
|
@@ -68,7 +68,7 @@ declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
|
|
|
68
68
|
ref?: React.Ref<HTMLDivElement>;
|
|
69
69
|
} & {
|
|
70
70
|
asChild?: boolean;
|
|
71
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
71
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "onSelect" | "disabled"> & {
|
|
72
72
|
disabled?: boolean;
|
|
73
73
|
onSelect?: (value: string) => void;
|
|
74
74
|
value?: string;
|
package/dist/ui/command.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ declare const Command: React.ForwardRefExoticComponent<Omit<{
|
|
|
8
8
|
ref?: React.Ref<HTMLDivElement>;
|
|
9
9
|
} & {
|
|
10
10
|
asChild?: boolean;
|
|
11
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
11
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
12
12
|
label?: string;
|
|
13
13
|
shouldFilter?: boolean;
|
|
14
14
|
filter?: (value: string, search: string, keywords?: string[]) => number;
|
|
@@ -24,7 +24,7 @@ declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<
|
|
|
24
24
|
ref?: React.Ref<HTMLInputElement>;
|
|
25
25
|
} & {
|
|
26
26
|
asChild?: boolean;
|
|
27
|
-
}, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "
|
|
27
|
+
}, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "value" | "onChange" | "type"> & {
|
|
28
28
|
value?: string;
|
|
29
29
|
onValueChange?: (search: string) => void;
|
|
30
30
|
} & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -34,7 +34,7 @@ declare const CommandList: React.ForwardRefExoticComponent<Omit<{
|
|
|
34
34
|
ref?: React.Ref<HTMLDivElement>;
|
|
35
35
|
} & {
|
|
36
36
|
asChild?: boolean;
|
|
37
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
37
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
38
38
|
label?: string;
|
|
39
39
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
40
40
|
declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
|
|
@@ -43,14 +43,14 @@ declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
|
|
|
43
43
|
ref?: React.Ref<HTMLDivElement>;
|
|
44
44
|
} & {
|
|
45
45
|
asChild?: boolean;
|
|
46
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
46
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
47
47
|
declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
|
|
48
48
|
children?: React.ReactNode;
|
|
49
49
|
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
50
50
|
ref?: React.Ref<HTMLDivElement>;
|
|
51
51
|
} & {
|
|
52
52
|
asChild?: boolean;
|
|
53
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
53
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "heading"> & {
|
|
54
54
|
heading?: React.ReactNode;
|
|
55
55
|
value?: string;
|
|
56
56
|
forceMount?: boolean;
|
|
@@ -59,7 +59,7 @@ declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<R
|
|
|
59
59
|
ref?: React.Ref<HTMLDivElement>;
|
|
60
60
|
} & {
|
|
61
61
|
asChild?: boolean;
|
|
62
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
62
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
63
63
|
alwaysRender?: boolean;
|
|
64
64
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
65
65
|
declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
|
|
@@ -68,7 +68,7 @@ declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
|
|
|
68
68
|
ref?: React.Ref<HTMLDivElement>;
|
|
69
69
|
} & {
|
|
70
70
|
asChild?: boolean;
|
|
71
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
71
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "onSelect" | "disabled"> & {
|
|
72
72
|
disabled?: boolean;
|
|
73
73
|
onSelect?: (value: string) => void;
|
|
74
74
|
value?: string;
|
package/dist/ui/input-otp.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as input_otp from 'input-otp';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
4
|
+
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
5
5
|
value?: string;
|
|
6
6
|
onChange?: (newValue: string) => unknown;
|
|
7
7
|
maxLength: number;
|
|
@@ -14,7 +14,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
|
|
|
14
14
|
} & {
|
|
15
15
|
render: (props: input_otp.RenderProps) => React.ReactNode;
|
|
16
16
|
children?: never;
|
|
17
|
-
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
17
|
+
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
18
18
|
value?: string;
|
|
19
19
|
onChange?: (newValue: string) => unknown;
|
|
20
20
|
maxLength: number;
|
package/dist/ui/input-otp.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as input_otp from 'input-otp';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
4
|
+
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
5
5
|
value?: string;
|
|
6
6
|
onChange?: (newValue: string) => unknown;
|
|
7
7
|
maxLength: number;
|
|
@@ -14,7 +14,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
|
|
|
14
14
|
} & {
|
|
15
15
|
render: (props: input_otp.RenderProps) => React.ReactNode;
|
|
16
16
|
children?: never;
|
|
17
|
-
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
17
|
+
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
18
18
|
value?: string;
|
|
19
19
|
onChange?: (newValue: string) => unknown;
|
|
20
20
|
maxLength: number;
|
package/dist/ui/input.cjs
CHANGED
|
@@ -35,7 +35,7 @@ var Input = React__namespace.forwardRef(
|
|
|
35
35
|
{
|
|
36
36
|
type,
|
|
37
37
|
className: cn(
|
|
38
|
-
"flex h-10 w-full rounded-xl border border-border bg-
|
|
38
|
+
"flex h-10 w-full rounded-xl border border-border bg-background px-3 py-1 text-base transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm group-aria-[invalid=true]:border-danger-foreground aria-[invalid=true]:border-danger-foreground",
|
|
39
39
|
className
|
|
40
40
|
),
|
|
41
41
|
ref,
|
package/dist/ui/input.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/utils.ts","../../src/ui/input.tsx"],"names":["twMerge","clsx","React","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,IAAM,KAAK,CAAA,GAAI,MAAA,KAAiCA,qBAAA,CAAQC,SAAA,CAAK,MAAM,CAAC,CAAA;ACD3E,IAAM,KAAA,GAAcC,gBAAA,CAAA,UAAA;AAAA,EAClB,CAAC,EAAE,SAAA,EAAW,MAAM,GAAG,KAAA,IAAS,GAAA,KAAQ;AACtC,IAAA,uBACEC,cAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,IAAA;AAAA,QACA,SAAA,EAAW,EAAA;AAAA,UACT,
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts","../../src/ui/input.tsx"],"names":["twMerge","clsx","React","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,IAAM,KAAK,CAAA,GAAI,MAAA,KAAiCA,qBAAA,CAAQC,SAAA,CAAK,MAAM,CAAC,CAAA;ACD3E,IAAM,KAAA,GAAcC,gBAAA,CAAA,UAAA;AAAA,EAClB,CAAC,EAAE,SAAA,EAAW,MAAM,GAAG,KAAA,IAAS,GAAA,KAAQ;AACtC,IAAA,uBACEC,cAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,IAAA;AAAA,QACA,SAAA,EAAW,EAAA;AAAA,UACT,icAAA;AAAA,UACA;AAAA,SACF;AAAA,QACA,GAAA;AAAA,QACC,GAAG;AAAA;AAAA,KACN;AAAA,EAEJ;AACF;AACA,KAAA,CAAM,WAAA,GAAc,OAAA","file":"input.cjs","sourcesContent":["import { clsx } from \"clsx\";\nimport type { ClassValue } from \"clsx\";\nimport { toast } from \"sonner\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport const cn = (...inputs: ClassValue[]): string => twMerge(clsx(inputs));\n\nexport const capitalize = (str: string) =>\n str?.charAt(0)?.toUpperCase() + str?.slice(1);\n\nexport const handleError = (error: { message: string }): void => {\n toast.error(error.message);\n};\n","import * as React from \"react\";\n\nimport { cn } from \"../lib/utils\";\n\nconst Input = React.forwardRef<HTMLInputElement, React.ComponentProps<\"input\">>(\n ({ className, type, ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex h-10 w-full rounded-xl border border-border bg-background px-3 py-1 text-base transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm group-aria-[invalid=true]:border-danger-foreground aria-[invalid=true]:border-danger-foreground\",\n className,\n )}\n ref={ref}\n {...props}\n />\n );\n },\n);\nInput.displayName = \"Input\";\n\nexport { Input };\n"]}
|
package/dist/ui/input.js
CHANGED
|
@@ -13,7 +13,7 @@ var Input = React.forwardRef(
|
|
|
13
13
|
{
|
|
14
14
|
type,
|
|
15
15
|
className: cn(
|
|
16
|
-
"flex h-10 w-full rounded-xl border border-border bg-
|
|
16
|
+
"flex h-10 w-full rounded-xl border border-border bg-background px-3 py-1 text-base transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm group-aria-[invalid=true]:border-danger-foreground aria-[invalid=true]:border-danger-foreground",
|
|
17
17
|
className
|
|
18
18
|
),
|
|
19
19
|
ref,
|
package/dist/ui/input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/utils.ts","../../src/ui/input.tsx"],"names":[],"mappings":";;;;;;;AAKO,IAAM,KAAK,CAAA,GAAI,MAAA,KAAiC,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;ACD3E,IAAM,KAAA,GAAc,KAAA,CAAA,UAAA;AAAA,EAClB,CAAC,EAAE,SAAA,EAAW,MAAM,GAAG,KAAA,IAAS,GAAA,KAAQ;AACtC,IAAA,uBACE,GAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,IAAA;AAAA,QACA,SAAA,EAAW,EAAA;AAAA,UACT,
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts","../../src/ui/input.tsx"],"names":[],"mappings":";;;;;;;AAKO,IAAM,KAAK,CAAA,GAAI,MAAA,KAAiC,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;ACD3E,IAAM,KAAA,GAAc,KAAA,CAAA,UAAA;AAAA,EAClB,CAAC,EAAE,SAAA,EAAW,MAAM,GAAG,KAAA,IAAS,GAAA,KAAQ;AACtC,IAAA,uBACE,GAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,IAAA;AAAA,QACA,SAAA,EAAW,EAAA;AAAA,UACT,icAAA;AAAA,UACA;AAAA,SACF;AAAA,QACA,GAAA;AAAA,QACC,GAAG;AAAA;AAAA,KACN;AAAA,EAEJ;AACF;AACA,KAAA,CAAM,WAAA,GAAc,OAAA","file":"input.js","sourcesContent":["import { clsx } from \"clsx\";\nimport type { ClassValue } from \"clsx\";\nimport { toast } from \"sonner\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport const cn = (...inputs: ClassValue[]): string => twMerge(clsx(inputs));\n\nexport const capitalize = (str: string) =>\n str?.charAt(0)?.toUpperCase() + str?.slice(1);\n\nexport const handleError = (error: { message: string }): void => {\n toast.error(error.message);\n};\n","import * as React from \"react\";\n\nimport { cn } from \"../lib/utils\";\n\nconst Input = React.forwardRef<HTMLInputElement, React.ComponentProps<\"input\">>(\n ({ className, type, ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex h-10 w-full rounded-xl border border-border bg-background px-3 py-1 text-base transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm group-aria-[invalid=true]:border-danger-foreground aria-[invalid=true]:border-danger-foreground\",\n className,\n )}\n ref={ref}\n {...props}\n />\n );\n },\n);\nInput.displayName = \"Input\";\n\nexport { Input };\n"]}
|
package/dist/ui/resizable.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
3
3
|
import * as ResizablePrimitive from 'react-resizable-panels';
|
|
4
4
|
|
|
5
5
|
declare const ResizablePanelGroup: ({ className, ...props }: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => react_jsx_runtime.JSX.Element;
|
|
6
|
-
declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<
|
|
6
|
+
declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLLIElement | HTMLElement | HTMLObjectElement | HTMLMapElement | HTMLAnchorElement | HTMLButtonElement | HTMLDivElement | HTMLFormElement | HTMLHeadingElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLOListElement | HTMLParagraphElement | HTMLSelectElement | HTMLSpanElement | HTMLUListElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLHeadElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLLegendElement | HTMLLinkElement | HTMLMetaElement | HTMLMeterElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLPreElement | HTMLProgressElement | HTMLSlotElement | HTMLScriptElement | HTMLSourceElement | HTMLStyleElement | HTMLTableElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTextAreaElement | HTMLTimeElement | HTMLTitleElement | HTMLTableRowElement | HTMLTrackElement | HTMLVideoElement | HTMLTableCaptionElement | HTMLMenuElement | HTMLPictureElement>, "id" | "onResize"> & {
|
|
7
7
|
className?: string | undefined;
|
|
8
8
|
collapsedSize?: number | undefined;
|
|
9
9
|
collapsible?: boolean | undefined;
|
package/dist/ui/resizable.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
3
3
|
import * as ResizablePrimitive from 'react-resizable-panels';
|
|
4
4
|
|
|
5
5
|
declare const ResizablePanelGroup: ({ className, ...props }: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => react_jsx_runtime.JSX.Element;
|
|
6
|
-
declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<
|
|
6
|
+
declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLLIElement | HTMLElement | HTMLObjectElement | HTMLMapElement | HTMLAnchorElement | HTMLButtonElement | HTMLDivElement | HTMLFormElement | HTMLHeadingElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLOListElement | HTMLParagraphElement | HTMLSelectElement | HTMLSpanElement | HTMLUListElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLHeadElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLLegendElement | HTMLLinkElement | HTMLMetaElement | HTMLMeterElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLPreElement | HTMLProgressElement | HTMLSlotElement | HTMLScriptElement | HTMLSourceElement | HTMLStyleElement | HTMLTableElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTextAreaElement | HTMLTimeElement | HTMLTitleElement | HTMLTableRowElement | HTMLTrackElement | HTMLVideoElement | HTMLTableCaptionElement | HTMLMenuElement | HTMLPictureElement>, "id" | "onResize"> & {
|
|
7
7
|
className?: string | undefined;
|
|
8
8
|
collapsedSize?: number | undefined;
|
|
9
9
|
collapsible?: boolean | undefined;
|
package/dist/ui/select.cjs
CHANGED
|
@@ -38,7 +38,7 @@ var SelectTrigger = React__namespace.forwardRef(({ className, children, ...props
|
|
|
38
38
|
{
|
|
39
39
|
ref,
|
|
40
40
|
className: cn(
|
|
41
|
-
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-xl border border-border bg-
|
|
41
|
+
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-xl border border-border bg-background px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
42
42
|
className
|
|
43
43
|
),
|
|
44
44
|
...props,
|
package/dist/ui/select.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/utils.ts","../../src/ui/select.tsx"],"names":["twMerge","clsx","SelectPrimitive","React","jsxs","jsx","ChevronDownIcon","ChevronUpIcon","CheckIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,IAAM,KAAK,CAAA,GAAI,MAAA,KAAiCA,qBAAA,CAAQC,SAAA,CAAK,MAAM,CAAC,CAAA;
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts","../../src/ui/select.tsx"],"names":["twMerge","clsx","SelectPrimitive","React","jsxs","jsx","ChevronDownIcon","ChevronUpIcon","CheckIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,IAAM,KAAK,CAAA,GAAI,MAAA,KAAiCA,qBAAA,CAAQC,SAAA,CAAK,MAAM,CAAC,CAAA;ACM3E,IAAM,MAAA,GAAyBC,0BAAA,CAAA;AAE/B,IAAM,WAAA,GAA8BA,0BAAA,CAAA;AAEpC,IAAM,WAAA,GAA8BA,0BAAA,CAAA;AAEpC,IAAM,aAAA,GAAsBC,4BAG1B,CAAC,EAAE,WAAW,QAAA,EAAU,GAAG,KAAA,EAAM,EAAG,GAAA,qBACpCC,eAAA;AAAA,EAAiBF,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AA,IAAA;AAAA,EAAhB;AAAA,IACC,GAAA;AAAA,IACA,SAAA,EAAW,EAAA;AAAA,MACT,4PAAA;AAAA,MACA;AAAA,KACF;AAAA,IACC,GAAG,KAAA;AAAA,IAEJ,QAAA,EAAA;AAAA,sBAAAG,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,+DAAA,EACd,QAAA,kBAAAA,cAAA,CAAiBH,0BAAA,CAAA,aAAA,EAAhB,EACC,QAAA,kBAAAG,cAAA,CAACG,oBAAA,EAAA,EAAU,SAAA,EAAU,SAAA,EAAU,CAAA,EACjC,CAAA,EACF,CAAA;AAAA,sBACAH,cAAA,CAAiBH,0BAAA,CAAA,QAAA,EAAhB,EAA0B,QAAA,EAAS;AAAA;AAAA;AACtC,CACD;AACD,UAAA,CAAW,cAA8BA,0BAAA,CAAA,IAAA,CAAK,WAAA;AAE9C,IAAM,eAAA,GAAwBC,4BAG5B,CAAC,EAAE,WAAW,GAAG,KAAA,IAAS,GAAA,qBAC1BE,cAAA;AAAA,EAAiBH,0BAAA,CAAA,SAAA;AAAA,EAAhB;AAAA,IACC,GAAA;AAAA,IACA,SAAA,EAAW,EAAA,CAAG,0BAAA,EAA4B,SAAS,CAAA;AAAA,IAClD,GAAG;AAAA;AACN,CACD;AACD,eAAA,CAAgB,cAA8BA,0BAAA,CAAA,SAAA,CAAU,WAAA","file":"select.cjs","sourcesContent":["import { clsx } from \"clsx\";\nimport type { ClassValue } from \"clsx\";\nimport { toast } from \"sonner\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport const cn = (...inputs: ClassValue[]): string => twMerge(clsx(inputs));\n\nexport const capitalize = (str: string) =>\n str?.charAt(0)?.toUpperCase() + str?.slice(1);\n\nexport const handleError = (error: { message: string }): void => {\n toast.error(error.message);\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\nimport { cn } from \"../lib/utils\";\nimport {\n CheckIcon,\n ChevronDownIcon,\n ChevronUpIcon,\n} from \"@radix-ui/react-icons\";\n\nconst Select = SelectPrimitive.Root;\n\nconst SelectGroup = SelectPrimitive.Group;\n\nconst SelectValue = SelectPrimitive.Value;\n\nconst SelectTrigger = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-xl border border-border bg-background px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1\",\n className,\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon className=\"h-4 w-4 opacity-50\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n));\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n\nconst SelectScrollUpButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton\n ref={ref}\n className={cn(\n \"flex cursor-default items-center justify-center py-1\",\n className,\n )}\n {...props}\n >\n <ChevronUpIcon className=\"h-4 w-4\" />\n </SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\n\nconst SelectScrollDownButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton\n ref={ref}\n className={cn(\n \"flex cursor-default items-center justify-center py-1\",\n className,\n )}\n {...props}\n >\n <ChevronDownIcon className=\"h-4 w-4\" />\n </SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName =\n SelectPrimitive.ScrollDownButton.displayName;\n\nconst SelectContent = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(({ className, children, position = \"popper\", ...props }, ref) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n className={cn(\n \"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-xl border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n position === \"popper\" &&\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\",\n className,\n )}\n position={position}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n \"p-1\",\n position === \"popper\" &&\n \"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]\",\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n));\nSelectContent.displayName = SelectPrimitive.Content.displayName;\n\nconst SelectLabel = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn(\"px-2 py-1.5 text-sm font-semibold\", className)}\n {...props}\n />\n));\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\n\nconst SelectItem = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex w-full cursor-default select-none items-center rounded-lg py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-secondary/50 dark:focus:bg-secondary/25 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute right-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <CheckIcon className=\"h-4 w-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n));\nSelectItem.displayName = SelectPrimitive.Item.displayName;\n\nconst SelectSeparator = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n));\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\n\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n SelectScrollUpButton,\n SelectScrollDownButton,\n};\n"]}
|