@addsign/moje-agenda-shared-lib 2.0.16 → 2.0.18
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.js","sources":["../../../node_modules/lucide-react/dist/esm/icons/chevrons-up-down.js","../../../node_modules/lucide-react/dist/esm/icons/plus.js","../../../lib/components/ui/Combobox.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.456.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst ChevronsUpDown = createLucideIcon(\"ChevronsUpDown\", [\n [\"path\", { d: \"m7 15 5 5 5-5\", key: \"1hf1tw\" }],\n [\"path\", { d: \"m7 9 5-5 5 5\", key: \"sgt6xg\" }]\n]);\n\nexport { ChevronsUpDown as default };\n//# sourceMappingURL=chevrons-up-down.js.map\n","/**\n * @license lucide-react v0.456.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst Plus = createLucideIcon(\"Plus\", [\n [\"path\", { d: \"M5 12h14\", key: \"1ays0h\" }],\n [\"path\", { d: \"M12 5v14\", key: \"s699le\" }]\n]);\n\nexport { Plus as default };\n//# sourceMappingURL=plus.js.map\n","\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { Check, ChevronsUpDown, Plus, X } from \"lucide-react\";\r\n\r\nimport { cn } from \"../../utils/utils\";\r\nimport { Button } from \"./button\";\r\nimport {\r\n Command,\r\n CommandEmpty,\r\n CommandGroup,\r\n CommandInput,\r\n CommandItem,\r\n CommandList,\r\n} from \"./command\";\r\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\r\nimport { IOptionItem } from \"../../types\";\r\n\r\ninterface ComboboxProps {\r\n value?: string;\r\n onChange?: (value: string | undefined) => void;\r\n className?: string;\r\n placeholder?: string;\r\n placeholderSearch?: string;\r\n clearable?: boolean;\r\n options?: IOptionItem[];\r\n allowAddNew?: boolean;\r\n disabled?: boolean;\r\n}\r\n\r\nconst Combobox = React.forwardRef<HTMLButtonElement, ComboboxProps>(\r\n (\r\n {\r\n value: propValue,\r\n onChange: propOnChange,\r\n className,\r\n placeholder,\r\n placeholderSearch = \"Vyhledejte položku\",\r\n clearable = false,\r\n options: propOptions = [],\r\n allowAddNew = false,\r\n disabled = false,\r\n },\r\n ref\r\n ) => {\r\n const [open, setOpen] = React.useState(false);\r\n const [value, setValue] = React.useState(propValue || \"\");\r\n const [inputValue, setInputValue] = React.useState(\"\");\r\n const [frameworks, setFrameworks] =\r\n React.useState<IOptionItem[]>(propOptions);\r\n\r\n React.useEffect(() => {\r\n if (propValue !== undefined) {\r\n setValue(propValue);\r\n }\r\n }, [propValue]);\r\n\r\n React.useEffect(() => {\r\n setFrameworks(propOptions);\r\n }, [propOptions]);\r\n\r\n const handleSelect = (currentValue: string) => {\r\n if (currentValue === \"add-custom\") {\r\n if (\r\n inputValue &&\r\n !frameworks.some((f) => f.value === inputValue.toLowerCase())\r\n ) {\r\n const newFramework = {\r\n value: inputValue.toLowerCase(),\r\n label: inputValue,\r\n };\r\n\r\n setFrameworks([...frameworks, newFramework]);\r\n updateValue(newFramework.value);\r\n }\r\n } else {\r\n updateValue(currentValue === value ? \"\" : currentValue);\r\n }\r\n setOpen(false);\r\n };\r\n\r\n const updateValue = (newValue: string) => {\r\n setValue(newValue);\r\n propOnChange?.(newValue || undefined);\r\n };\r\n\r\n const handleClear = (e: React.MouseEvent) => {\r\n e.stopPropagation();\r\n updateValue(\"\");\r\n setInputValue(\"\");\r\n setOpen(false);\r\n };\r\n\r\n value;\r\n return (\r\n <Popover open={open} onOpenChange={setOpen}>\r\n <div className=\"relative w-full\">\r\n <PopoverTrigger asChild>\r\n <Button\r\n ref={ref}\r\n type=\"button\"\r\n variant=\"outline\"\r\n role=\"combobox\"\r\n aria-expanded={open}\r\n disabled={disabled}\r\n className={cn(\"w-full justify-between\", className)}\r\n title={\r\n value\r\n ? frameworks.find((framework) => framework.value === value)\r\n ?.label\r\n : placeholder\r\n }\r\n >\r\n <span className=\"flex-1 text-left truncate mr-2 font-normal\">\r\n {value ? (\r\n frameworks.find((framework) => framework.value === value)\r\n ?.label\r\n ) : (\r\n <span className=\"text-muted-foreground font-normal\">\r\n {placeholder}\r\n </span>\r\n )}\r\n </span>\r\n\r\n <ChevronsUpDown className=\"h-4 w-4 shrink-0 opacity-50 ml-6\" />\r\n </Button>\r\n </PopoverTrigger>\r\n {clearable && value && (\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n size=\"sm\"\r\n className=\"absolute right-6 top-0 h-full px-1 py-2 hover:bg-transparent\"\r\n onClick={handleClear}\r\n >\r\n <X className=\"h-4 w-4 shrink-0 opacity-50 hover:opacity-100\" />\r\n </Button>\r\n )}\r\n </div>\r\n <PopoverContent className=\"min-w-[200px] w-[var(--radix-popover-trigger-width)] p-0\">\r\n <Command>\r\n <CommandInput\r\n placeholder={placeholderSearch}\r\n className=\"h-9\"\r\n value={inputValue}\r\n onValueChange={setInputValue}\r\n />\r\n <CommandList>\r\n <CommandEmpty>\r\n {allowAddNew && (\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n className=\"w-full justify-start\"\r\n onClick={() => handleSelect(\"add-custom\")}\r\n >\r\n <Plus className=\"mr-2 h-4 w-4\" />\r\n Přidat \"{inputValue}\"\r\n </Button>\r\n )}\r\n </CommandEmpty>\r\n\r\n <CommandGroup>\r\n {frameworks.map((framework) => (\r\n <CommandItem\r\n key={framework.value}\r\n value={framework.label as string}\r\n onSelect={() => handleSelect(framework.value as string)}\r\n >\r\n {framework.label}\r\n <Check\r\n className={cn(\r\n \"ml-auto h-4 w-4\",\r\n value === framework.value ? \"opacity-100\" : \"opacity-0\"\r\n )}\r\n />\r\n </CommandItem>\r\n ))}\r\n </CommandGroup>\r\n </Comm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A;AAAA,EAEJ;AACF;AAEA,SAAS,cAAc;","x_google_ignoreList":[0,1]}
|
|
1
|
+
{"version":3,"file":"Combobox.js","sources":["../../../node_modules/lucide-react/dist/esm/icons/chevrons-up-down.js","../../../node_modules/lucide-react/dist/esm/icons/plus.js","../../../lib/components/ui/Combobox.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.456.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst ChevronsUpDown = createLucideIcon(\"ChevronsUpDown\", [\n [\"path\", { d: \"m7 15 5 5 5-5\", key: \"1hf1tw\" }],\n [\"path\", { d: \"m7 9 5-5 5 5\", key: \"sgt6xg\" }]\n]);\n\nexport { ChevronsUpDown as default };\n//# sourceMappingURL=chevrons-up-down.js.map\n","/**\n * @license lucide-react v0.456.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst Plus = createLucideIcon(\"Plus\", [\n [\"path\", { d: \"M5 12h14\", key: \"1ays0h\" }],\n [\"path\", { d: \"M12 5v14\", key: \"s699le\" }]\n]);\n\nexport { Plus as default };\n//# sourceMappingURL=plus.js.map\n","\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { Check, ChevronsUpDown, Plus, X } from \"lucide-react\";\r\n\r\nimport { cn } from \"../../utils/utils\";\r\nimport { Button } from \"./button\";\r\nimport {\r\n Command,\r\n CommandEmpty,\r\n CommandGroup,\r\n CommandInput,\r\n CommandItem,\r\n CommandList,\r\n} from \"./command\";\r\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\r\nimport { IOptionItem } from \"../../types\";\r\n\r\ninterface ComboboxProps {\r\n value?: string;\r\n onChange?: (value: string | undefined) => void;\r\n className?: string;\r\n placeholder?: string;\r\n placeholderSearch?: string;\r\n clearable?: boolean;\r\n options?: IOptionItem[];\r\n allowAddNew?: boolean;\r\n disabled?: boolean;\r\n}\r\n\r\nconst Combobox = React.forwardRef<HTMLButtonElement, ComboboxProps>(\r\n (\r\n {\r\n value: propValue,\r\n onChange: propOnChange,\r\n className,\r\n placeholder,\r\n placeholderSearch = \"Vyhledejte položku\",\r\n clearable = false,\r\n options: propOptions = [],\r\n allowAddNew = false,\r\n disabled = false,\r\n },\r\n ref\r\n ) => {\r\n const [open, setOpen] = React.useState(false);\r\n const [value, setValue] = React.useState(propValue || \"\");\r\n const [inputValue, setInputValue] = React.useState(\"\");\r\n const [frameworks, setFrameworks] =\r\n React.useState<IOptionItem[]>(propOptions);\r\n\r\n React.useEffect(() => {\r\n if (propValue !== undefined) {\r\n setValue(propValue);\r\n }\r\n }, [propValue]);\r\n\r\n React.useEffect(() => {\r\n setFrameworks(propOptions);\r\n }, [propOptions]);\r\n\r\n const handleSelect = (currentValue: string) => {\r\n if (currentValue === \"add-custom\") {\r\n if (\r\n inputValue &&\r\n !frameworks.some((f) => f.value === inputValue.toLowerCase())\r\n ) {\r\n const newFramework = {\r\n value: inputValue.toLowerCase(),\r\n label: inputValue,\r\n };\r\n\r\n setFrameworks([...frameworks, newFramework]);\r\n updateValue(newFramework.value);\r\n }\r\n } else {\r\n updateValue(currentValue === value ? \"\" : currentValue);\r\n }\r\n setOpen(false);\r\n };\r\n\r\n const updateValue = (newValue: string) => {\r\n setValue(newValue);\r\n propOnChange?.(newValue || undefined);\r\n };\r\n\r\n const handleClear = (e: React.MouseEvent) => {\r\n e.stopPropagation();\r\n updateValue(\"\");\r\n setInputValue(\"\");\r\n setOpen(false);\r\n };\r\n\r\n value;\r\n return (\r\n <Popover open={open} onOpenChange={setOpen}>\r\n <div className=\"relative w-full\">\r\n <PopoverTrigger asChild>\r\n <Button\r\n ref={ref}\r\n type=\"button\"\r\n variant=\"outline\"\r\n role=\"combobox\"\r\n aria-expanded={open}\r\n disabled={disabled}\r\n className={cn(\"w-full justify-between\", className)}\r\n title={\r\n value\r\n ? frameworks.find((framework) => framework.value === value)\r\n ?.label\r\n : placeholder\r\n }\r\n >\r\n <span className=\"flex-1 text-left truncate mr-2 font-normal\">\r\n {value ? (\r\n frameworks.find((framework) => framework.value === value)\r\n ?.label\r\n ) : (\r\n <span className=\"text-muted-foreground font-normal\">\r\n {placeholder}\r\n </span>\r\n )}\r\n </span>\r\n\r\n <ChevronsUpDown className=\"h-4 w-4 shrink-0 opacity-50 ml-6\" />\r\n </Button>\r\n </PopoverTrigger>\r\n {clearable && !disabled && value && (\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n size=\"sm\"\r\n className=\"absolute right-6 top-0 h-full px-1 py-2 hover:bg-transparent\"\r\n onClick={handleClear}\r\n >\r\n <X className=\"h-4 w-4 shrink-0 opacity-50 hover:opacity-100\" />\r\n </Button>\r\n )}\r\n </div>\r\n <PopoverContent className=\"min-w-[200px] w-[var(--radix-popover-trigger-width)] p-0\">\r\n <Command>\r\n <CommandInput\r\n placeholder={placeholderSearch}\r\n className=\"h-9\"\r\n value={inputValue}\r\n onValueChange={setInputValue}\r\n />\r\n <CommandList>\r\n <CommandEmpty>\r\n {allowAddNew && (\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n className=\"w-full justify-start\"\r\n onClick={() => handleSelect(\"add-custom\")}\r\n >\r\n <Plus className=\"mr-2 h-4 w-4\" />\r\n Přidat \"{inputValue}\"\r\n </Button>\r\n )}\r\n </CommandEmpty>\r\n\r\n <CommandGroup>\r\n {frameworks.map((framework) => (\r\n <CommandItem\r\n key={framework.value}\r\n value={framework.label as string}\r\n onSelect={() => handleSelect(framework.value as string)}\r\n >\r\n {framework.label}\r\n <Check\r\n className={cn(\r\n \"ml-auto h-4 w-4\",\r\n value === framework.value ? \"opacity-100\" : \"opacity-0\"\r\n )}\r\n />\r\n </CommandItem>\r\n ))}\r\n </CommandGroup>\r\n </CommandList>\r\n </Command>\r\n </PopoverContent>\r\n </Popover>\r\n );\r\n }\r\n);\r\n\r\nCombobox.display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|
@@ -22,6 +22,7 @@ const Input = React.forwardRef(
|
|
|
22
22
|
onChange,
|
|
23
23
|
clearable = false,
|
|
24
24
|
debounceTimeout,
|
|
25
|
+
disabled,
|
|
25
26
|
...props
|
|
26
27
|
}, ref) => {
|
|
27
28
|
const [internalValue, setInternalValue] = React.useState(propValue || "");
|
|
@@ -71,10 +72,11 @@ const Input = React.forwardRef(
|
|
|
71
72
|
value: internalValue,
|
|
72
73
|
onChange: handleDebouncedChange,
|
|
73
74
|
className: cn(
|
|
74
|
-
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 " + (clearable && !!internalValue ? " pr-10 " : " pr-3 ") + " text-base ring-offset-ring 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-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-80 disabled:border-opacity-100 md:text-sm",
|
|
75
|
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 " + (clearable && !disabled && !!internalValue ? " pr-10 " : " pr-3 ") + " text-base ring-offset-ring 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-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-80 disabled:border-opacity-100 md:text-sm",
|
|
75
76
|
className
|
|
76
77
|
),
|
|
77
78
|
ref,
|
|
79
|
+
disabled,
|
|
78
80
|
...props
|
|
79
81
|
}
|
|
80
82
|
),
|
|
@@ -84,7 +86,7 @@ const Input = React.forwardRef(
|
|
|
84
86
|
icon: /* @__PURE__ */ jsx(LoaderCircle, { size: 25, className: "text-muted-foreground" })
|
|
85
87
|
}
|
|
86
88
|
) }),
|
|
87
|
-
!!internalValue && clearable && /* @__PURE__ */ jsxs(
|
|
89
|
+
!!internalValue && clearable && !disabled && /* @__PURE__ */ jsxs(
|
|
88
90
|
Button,
|
|
89
91
|
{
|
|
90
92
|
type: "button",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sources":["../../../node_modules/lucide-react/dist/esm/icons/loader-circle.js","../../../lib/components/ui/input.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.456.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst LoaderCircle = createLucideIcon(\"LoaderCircle\", [\n [\"path\", { d: \"M21 12a9 9 0 1 1-6.219-8.56\", key: \"13zald\" }]\n]);\n\nexport { LoaderCircle as default };\n//# sourceMappingURL=loader-circle.js.map\n","import * as React from \"react\";\r\nimport { cn } from \"../..//utils/utils\";\r\nimport { Button } from \"./button\";\r\nimport { LoaderCircleIcon, X } from \"lucide-react\";\r\nimport SpinnerIcon from \"../SpinnerIcon\";\r\n\r\ninterface IInputProps extends React.InputHTMLAttributes<HTMLInputElement> {\r\n debounceTimeout?: number;\r\n clearable?: boolean;\r\n}\r\nconst Input = React.forwardRef<HTMLInputElement, IInputProps>(\r\n (\r\n {\r\n className,\r\n type,\r\n value: propValue,\r\n onChange,\r\n clearable = false,\r\n debounceTimeout,\r\n ...props\r\n },\r\n ref\r\n ) => {\r\n const [internalValue, setInternalValue] = React.useState(propValue || \"\");\r\n const debounceTimeoutRef = React.useRef<NodeJS.Timeout | null>(null); // Ref to hold the debounce timeout\r\n const [inputIsChanging, setInputIsChanging] = React.useState(false);\r\n\r\n React.useEffect(() => {\r\n setInternalValue(propValue ?? \"\");\r\n }, [propValue]);\r\n\r\n const handleDebouncedChange = React.useCallback(\r\n (e: React.ChangeEvent<HTMLInputElement>) => {\r\n const { value } = e.target;\r\n setInternalValue(value); // Update local state\r\n setInputIsChanging(true);\r\n\r\n if (debounceTimeout) {\r\n // Clear any previous debounce timeout\r\n if (debounceTimeoutRef.current)\r\n clearTimeout(debounceTimeoutRef.current);\r\n\r\n // Set a new debounce timeout\r\n debounceTimeoutRef.current = setTimeout(() => {\r\n const newValue: string | null =\r\n type === \"number\" && value === \"\" ? null : value;\r\n setInternalValue(newValue || \"\");\r\n onChange?.({\r\n target: { value: newValue },\r\n } as React.ChangeEvent<HTMLInputElement>);\r\n setInputIsChanging(false);\r\n }, debounceTimeout);\r\n } else {\r\n const newValue = type === \"number\" && value === \"\" ? null : value;\r\n setInternalValue(newValue || \"\");\r\n onChange?.({\r\n target: { value: newValue },\r\n } as React.ChangeEvent<HTMLInputElement>);\r\n setInputIsChanging(false);\r\n }\r\n },\r\n [debounceTimeout, type, onChange]\r\n );\r\n\r\n const handleClear = () => {\r\n setInternalValue(\"\");\r\n onChange?.({\r\n target: { value: type === \"number\" ? null : \"\" },\r\n } as React.ChangeEvent<HTMLInputElement>);\r\n };\r\n\r\n return (\r\n <div className=\"relative w-full\">\r\n <input\r\n type={type}\r\n value={internalValue}\r\n onChange={handleDebouncedChange}\r\n className={cn(\r\n \"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 \" +\r\n (clearable && !!internalValue
|
|
1
|
+
{"version":3,"file":"input.js","sources":["../../../node_modules/lucide-react/dist/esm/icons/loader-circle.js","../../../lib/components/ui/input.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.456.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst LoaderCircle = createLucideIcon(\"LoaderCircle\", [\n [\"path\", { d: \"M21 12a9 9 0 1 1-6.219-8.56\", key: \"13zald\" }]\n]);\n\nexport { LoaderCircle as default };\n//# sourceMappingURL=loader-circle.js.map\n","import * as React from \"react\";\r\nimport { cn } from \"../..//utils/utils\";\r\nimport { Button } from \"./button\";\r\nimport { LoaderCircleIcon, X } from \"lucide-react\";\r\nimport SpinnerIcon from \"../SpinnerIcon\";\r\n\r\ninterface IInputProps extends React.InputHTMLAttributes<HTMLInputElement> {\r\n debounceTimeout?: number;\r\n clearable?: boolean;\r\n}\r\nconst Input = React.forwardRef<HTMLInputElement, IInputProps>(\r\n (\r\n {\r\n className,\r\n type,\r\n value: propValue,\r\n onChange,\r\n clearable = false,\r\n debounceTimeout,\r\n disabled,\r\n ...props\r\n },\r\n ref\r\n ) => {\r\n const [internalValue, setInternalValue] = React.useState(propValue || \"\");\r\n const debounceTimeoutRef = React.useRef<NodeJS.Timeout | null>(null); // Ref to hold the debounce timeout\r\n const [inputIsChanging, setInputIsChanging] = React.useState(false);\r\n\r\n React.useEffect(() => {\r\n setInternalValue(propValue ?? \"\");\r\n }, [propValue]);\r\n\r\n const handleDebouncedChange = React.useCallback(\r\n (e: React.ChangeEvent<HTMLInputElement>) => {\r\n const { value } = e.target;\r\n setInternalValue(value); // Update local state\r\n setInputIsChanging(true);\r\n\r\n if (debounceTimeout) {\r\n // Clear any previous debounce timeout\r\n if (debounceTimeoutRef.current)\r\n clearTimeout(debounceTimeoutRef.current);\r\n\r\n // Set a new debounce timeout\r\n debounceTimeoutRef.current = setTimeout(() => {\r\n const newValue: string | null =\r\n type === \"number\" && value === \"\" ? null : value;\r\n setInternalValue(newValue || \"\");\r\n onChange?.({\r\n target: { value: newValue },\r\n } as React.ChangeEvent<HTMLInputElement>);\r\n setInputIsChanging(false);\r\n }, debounceTimeout);\r\n } else {\r\n const newValue = type === \"number\" && value === \"\" ? null : value;\r\n setInternalValue(newValue || \"\");\r\n onChange?.({\r\n target: { value: newValue },\r\n } as React.ChangeEvent<HTMLInputElement>);\r\n setInputIsChanging(false);\r\n }\r\n },\r\n [debounceTimeout, type, onChange]\r\n );\r\n\r\n const handleClear = () => {\r\n setInternalValue(\"\");\r\n onChange?.({\r\n target: { value: type === \"number\" ? null : \"\" },\r\n } as React.ChangeEvent<HTMLInputElement>);\r\n };\r\n\r\n return (\r\n <div className=\"relative w-full\">\r\n <input\r\n type={type}\r\n value={internalValue}\r\n onChange={handleDebouncedChange}\r\n className={cn(\r\n \"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 \" +\r\n (clearable && !disabled && !!internalValue\r\n ? \" pr-10 \"\r\n : \" pr-3 \") +\r\n \" text-base ring-offset-ring 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-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-80 disabled:border-opacity-100 md:text-sm\",\r\n className\r\n )}\r\n ref={ref}\r\n disabled={disabled}\r\n {...props}\r\n />\r\n\r\n {inputIsChanging === true && (\r\n <div className=\"absolute right-0 top-0 h-full px-2 py-2 hover:bg-transparent text-muted-foreground\">\r\n <SpinnerIcon\r\n icon={\r\n <LoaderCircleIcon size={25} className=\"text-muted-foreground\" />\r\n }\r\n />\r\n </div>\r\n )}\r\n {!!internalValue && clearable && !disabled && (\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n size=\"icon\"\r\n className=\"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent\"\r\n onClick={handleClear}\r\n >\r\n <X className=\"h-4 w-4 text-muted-foreground\" />\r\n <span className=\"sr-only\">Clear input</span>\r\n </Button>\r\n )}\r\n </div>\r\n );\r\n }\r\n);\r\nInput.displayName = \"Input\";\r\n\r\nexport { Input };\r\n"],"names":["LoaderCircleIcon"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAM,eAAe,iBAAiB,gBAAgB;AAAA,EACpD,CAAC,QAAQ,EAAE,GAAG,+BAA+B,KAAK,SAAQ,CAAE;AAC9D,CAAC;ACDD,MAAM,QAAQ,MAAM;AAAA,EAClB,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA,GAAG;AAAA,KAEL,QACG;AACH,UAAM,CAAC,eAAe,gBAAgB,IAAI,MAAM,SAAS,aAAa,EAAE;AAClE,UAAA,qBAAqB,MAAM,OAA8B,IAAI;AACnE,UAAM,CAAC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C,oBAAoB,QAClB,oBAAA,OAAA,EAAI,WAAU,sFACb,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MACG,oBAAAA,cAAA,EAAiB,MAAM,IAAI,WAAU,yBAAwB;AAAA,QAAA;AAAA,MAAA,GAGpE;AAAA,MAED,CAAC,CAAC,iBAAiB,aAAa,CAAC,YAChC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,WAAU;AAAA,UACV,SAAS;AAAA,UAET,UAAA;AAAA,YAAC,oBAAA,GAAA,EAAE,WAAU,gCAAgC,CAAA;AAAA,YAC5C,oBAAA,QAAA,EAAK,WAAU,WAAU,UAAW,eAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACvC;AAAA,IAEJ,EAAA,CAAA;AAAA,EAEJ;AACF;AACA,MAAM,cAAc;","x_google_ignoreList":[0]}
|
|
@@ -125,7 +125,7 @@ const Combobox = React.forwardRef<HTMLButtonElement, ComboboxProps>(
|
|
|
125
125
|
<ChevronsUpDown className="h-4 w-4 shrink-0 opacity-50 ml-6" />
|
|
126
126
|
</Button>
|
|
127
127
|
</PopoverTrigger>
|
|
128
|
-
{clearable && value && (
|
|
128
|
+
{clearable && !disabled && value && (
|
|
129
129
|
<Button
|
|
130
130
|
type="button"
|
|
131
131
|
variant="ghost"
|
|
@@ -17,6 +17,7 @@ const Input = React.forwardRef<HTMLInputElement, IInputProps>(
|
|
|
17
17
|
onChange,
|
|
18
18
|
clearable = false,
|
|
19
19
|
debounceTimeout,
|
|
20
|
+
disabled,
|
|
20
21
|
...props
|
|
21
22
|
},
|
|
22
23
|
ref
|
|
@@ -77,11 +78,14 @@ const Input = React.forwardRef<HTMLInputElement, IInputProps>(
|
|
|
77
78
|
onChange={handleDebouncedChange}
|
|
78
79
|
className={cn(
|
|
79
80
|
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 " +
|
|
80
|
-
(clearable && !!internalValue
|
|
81
|
+
(clearable && !disabled && !!internalValue
|
|
82
|
+
? " pr-10 "
|
|
83
|
+
: " pr-3 ") +
|
|
81
84
|
" text-base ring-offset-ring 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-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-80 disabled:border-opacity-100 md:text-sm",
|
|
82
85
|
className
|
|
83
86
|
)}
|
|
84
87
|
ref={ref}
|
|
88
|
+
disabled={disabled}
|
|
85
89
|
{...props}
|
|
86
90
|
/>
|
|
87
91
|
|
|
@@ -94,7 +98,7 @@ const Input = React.forwardRef<HTMLInputElement, IInputProps>(
|
|
|
94
98
|
/>
|
|
95
99
|
</div>
|
|
96
100
|
)}
|
|
97
|
-
{!!internalValue && clearable && (
|
|
101
|
+
{!!internalValue && clearable && !disabled && (
|
|
98
102
|
<Button
|
|
99
103
|
type="button"
|
|
100
104
|
variant="ghost"
|