@intlayer/design-system 5.1.4 → 5.1.5

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.
Files changed (160) hide show
  1. package/dist/.vite/manifest.json +34 -88
  2. package/dist/Form-BZUDRfoN.js.map +1 -1
  3. package/dist/Form-yi0CMK-a.cjs.map +1 -1
  4. package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs +1 -1
  5. package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs +1 -1
  6. package/dist/components/Command/index.d.ts +1 -1
  7. package/dist/components/Container/index.cjs +5 -6
  8. package/dist/components/Container/index.cjs.map +1 -1
  9. package/dist/components/Container/index.mjs +5 -6
  10. package/dist/components/Container/index.mjs.map +1 -1
  11. package/dist/components/DictionaryEditor/DictionaryEditor.cjs +3 -3
  12. package/dist/components/DictionaryEditor/DictionaryEditor.cjs.map +1 -1
  13. package/dist/components/DictionaryEditor/DictionaryEditor.d.ts +1 -1
  14. package/dist/components/DictionaryEditor/DictionaryEditor.d.ts.map +1 -1
  15. package/dist/components/DictionaryEditor/DictionaryEditor.mjs +3 -3
  16. package/dist/components/DictionaryEditor/DictionaryEditor.mjs.map +1 -1
  17. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs +33 -20
  18. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs.map +1 -1
  19. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.d.ts.map +1 -1
  20. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs +34 -21
  21. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs.map +1 -1
  22. package/dist/components/DictionaryFieldEditor/ContentEditor.cjs +2 -2
  23. package/dist/components/DictionaryFieldEditor/ContentEditor.cjs.map +1 -1
  24. package/dist/components/DictionaryFieldEditor/ContentEditor.mjs +3 -3
  25. package/dist/components/DictionaryFieldEditor/ContentEditor.mjs.map +1 -1
  26. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs +10 -7
  27. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs.map +1 -1
  28. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts.map +1 -1
  29. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +10 -7
  30. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs.map +1 -1
  31. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map +1 -1
  32. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts +1 -1
  33. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts.map +1 -1
  34. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs.map +1 -1
  35. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +1 -1
  36. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +1 -1
  37. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +92 -120
  38. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
  39. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts +1 -1
  40. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
  41. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +94 -122
  42. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
  43. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs +0 -143
  44. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs.map +1 -1
  45. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +0 -143
  46. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts.map +1 -1
  47. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs +0 -143
  48. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs.map +1 -1
  49. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs +1 -2
  50. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs.map +1 -1
  51. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts +0 -3
  52. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts.map +1 -1
  53. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs +1 -2
  54. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs.map +1 -1
  55. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +51 -70
  56. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
  57. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts +1 -1
  58. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
  59. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +51 -70
  60. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
  61. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +52 -103
  62. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
  63. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts +3 -3
  64. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
  65. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +56 -107
  66. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
  67. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs +0 -32
  68. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs.map +1 -1
  69. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +0 -32
  70. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts.map +1 -1
  71. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs +0 -32
  72. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs.map +1 -1
  73. package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs +1 -0
  74. package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs.map +1 -1
  75. package/dist/components/DictionaryFieldEditor/StructureView/StructureView.d.ts.map +1 -1
  76. package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs +1 -0
  77. package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs.map +1 -1
  78. package/dist/components/DictionaryFieldEditor/index.cjs +0 -2
  79. package/dist/components/DictionaryFieldEditor/index.cjs.map +1 -1
  80. package/dist/components/DictionaryFieldEditor/index.d.ts +0 -1
  81. package/dist/components/DictionaryFieldEditor/index.d.ts.map +1 -1
  82. package/dist/components/DictionaryFieldEditor/index.mjs +0 -2
  83. package/dist/components/DictionaryFieldEditor/index.mjs.map +1 -1
  84. package/dist/components/Form/FormBase.cjs +0 -1
  85. package/dist/components/Form/FormBase.cjs.map +1 -1
  86. package/dist/components/Form/FormBase.d.ts +1 -4
  87. package/dist/components/Form/FormBase.d.ts.map +1 -1
  88. package/dist/components/Form/FormBase.mjs +0 -1
  89. package/dist/components/Form/FormBase.mjs.map +1 -1
  90. package/dist/components/Form/elements/EditableFieldInputElement.d.ts +1 -1
  91. package/dist/components/Form/elements/EditableFieldInputElement.d.ts.map +1 -1
  92. package/dist/components/Form/elements/EditableFieldTextAreaElement.d.ts +1 -1
  93. package/dist/components/Form/elements/EditableFieldTextAreaElement.d.ts.map +1 -1
  94. package/dist/components/Input/Checkbox.cjs +0 -1
  95. package/dist/components/Input/Checkbox.cjs.map +1 -1
  96. package/dist/components/Input/Checkbox.mjs +0 -1
  97. package/dist/components/Input/Checkbox.mjs.map +1 -1
  98. package/dist/components/Input/Input.cjs +1 -1
  99. package/dist/components/Input/Input.cjs.map +1 -1
  100. package/dist/components/Input/Input.mjs +1 -1
  101. package/dist/components/Input/Input.mjs.map +1 -1
  102. package/dist/components/KeyboardScreenAdapter/index.cjs +25 -0
  103. package/dist/components/KeyboardScreenAdapter/index.cjs.map +1 -0
  104. package/dist/components/KeyboardScreenAdapter/index.d.ts +3 -0
  105. package/dist/components/KeyboardScreenAdapter/index.d.ts.map +1 -0
  106. package/dist/components/KeyboardScreenAdapter/index.mjs +25 -0
  107. package/dist/components/KeyboardScreenAdapter/index.mjs.map +1 -0
  108. package/dist/components/MaxHeightSmoother/index.cjs +2 -0
  109. package/dist/components/MaxHeightSmoother/index.cjs.map +1 -1
  110. package/dist/components/MaxHeightSmoother/index.d.ts.map +1 -1
  111. package/dist/components/MaxHeightSmoother/index.mjs +2 -0
  112. package/dist/components/MaxHeightSmoother/index.mjs.map +1 -1
  113. package/dist/components/Modal/Modal.cjs +15 -13
  114. package/dist/components/Modal/Modal.cjs.map +1 -1
  115. package/dist/components/Modal/Modal.d.ts.map +1 -1
  116. package/dist/components/Modal/Modal.mjs +15 -13
  117. package/dist/components/Modal/Modal.mjs.map +1 -1
  118. package/dist/components/RightDrawer/RightDrawer.cjs +1 -1
  119. package/dist/components/RightDrawer/RightDrawer.cjs.map +1 -1
  120. package/dist/components/RightDrawer/RightDrawer.mjs +1 -1
  121. package/dist/components/RightDrawer/RightDrawer.mjs.map +1 -1
  122. package/dist/components/Select/Multiselect.cjs +0 -1
  123. package/dist/components/Select/Multiselect.cjs.map +1 -1
  124. package/dist/components/Select/Multiselect.d.ts.map +1 -1
  125. package/dist/components/Select/Multiselect.mjs +1 -2
  126. package/dist/components/Select/Multiselect.mjs.map +1 -1
  127. package/dist/components/Select/Select.cjs +0 -1
  128. package/dist/components/Select/Select.cjs.map +1 -1
  129. package/dist/components/Select/Select.d.ts.map +1 -1
  130. package/dist/components/Select/Select.mjs +0 -1
  131. package/dist/components/Select/Select.mjs.map +1 -1
  132. package/dist/components/index.cjs +2 -2
  133. package/dist/components/index.d.ts +1 -0
  134. package/dist/components/index.d.ts.map +1 -1
  135. package/dist/components/index.mjs +2 -2
  136. package/dist/hooks/index.cjs +2 -0
  137. package/dist/hooks/index.cjs.map +1 -1
  138. package/dist/hooks/index.d.ts +1 -0
  139. package/dist/hooks/index.d.ts.map +1 -1
  140. package/dist/hooks/index.mjs +2 -0
  141. package/dist/hooks/index.mjs.map +1 -1
  142. package/dist/hooks/useAsync/useAsyncStateStore.cjs +8 -14
  143. package/dist/hooks/useAsync/useAsyncStateStore.cjs.map +1 -1
  144. package/dist/hooks/useAsync/useAsyncStateStore.d.ts.map +1 -1
  145. package/dist/hooks/useAsync/useAsyncStateStore.mjs +8 -14
  146. package/dist/hooks/useAsync/useAsyncStateStore.mjs.map +1 -1
  147. package/dist/hooks/useKeyboardDetector.cjs +27 -0
  148. package/dist/hooks/useKeyboardDetector.cjs.map +1 -0
  149. package/dist/hooks/useKeyboardDetector.d.ts +5 -0
  150. package/dist/hooks/useKeyboardDetector.d.ts.map +1 -0
  151. package/dist/hooks/useKeyboardDetector.mjs +27 -0
  152. package/dist/hooks/useKeyboardDetector.mjs.map +1 -0
  153. package/dist/{index-BTDHuTxL.js → index-B1w5h_6-.js} +7 -7
  154. package/dist/index-B1w5h_6-.js.map +1 -0
  155. package/dist/{index-Db5Dym4h.cjs → index-U1U6ySIn.cjs} +7 -7
  156. package/dist/index-U1U6ySIn.cjs.map +1 -0
  157. package/dist/tailwind.css +1 -1
  158. package/package.json +17 -17
  159. package/dist/index-BTDHuTxL.js.map +0 -1
  160. package/dist/index-Db5Dym4h.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Multiselect.cjs","sources":["../../../src/components/Select/Multiselect.tsx"],"sourcesContent":["'use client';\n\nimport { X as RemoveIcon, Check } from 'lucide-react';\nimport {\n type ComponentProps,\n type Dispatch,\n type FC,\n type HTMLAttributes,\n type KeyboardEvent,\n type LegacyRef,\n type MouseEventHandler,\n type RefObject,\n type SetStateAction,\n type SyntheticEvent,\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { Badge } from '../Badge';\nimport { Command, CommandRoot } from '../Command';\n\ntype MultiSelectContextProps = {\n value: string[];\n onValueChange: (value: string) => void;\n open: boolean;\n setOpen: (value: boolean) => void;\n inputValue: string;\n setInputValue: Dispatch<SetStateAction<string>>;\n activeIndex: number;\n setActiveIndex: Dispatch<SetStateAction<number>>;\n ref: RefObject<HTMLInputElement | null>;\n handleSelect: (e: SyntheticEvent<HTMLInputElement>) => void;\n};\n\nconst MultiSelectContext = createContext<MultiSelectContextProps | null>(null);\n\nconst useMultiSelect = () => {\n const context = useContext(MultiSelectContext);\n if (!context) {\n throw new Error('useMultiSelect must be used within MultiSelectProvider');\n }\n return context;\n};\n\n/**\n * MultiSelect Docs: {@link: https://shadcn-extension.vercel.app/docs/multi-select}\n */\n\ntype MultiSelectProps = ComponentProps<typeof CommandRoot> & {\n values?: string[];\n defaultValues?: string[];\n onValueChange?: (value: string[]) => void;\n loop?: boolean;\n};\n\n/**\n *\n * Usage example:\n * ```jsx\n * <MultiSelect\n * values={value}\n * onValuesChange={setValue}\n * loop\n * >\n * <MultiSelectTrigger>\n * <MultiSelectInput placeholder=\"Select your framework\" />\n * </MultiSelectTrigger>\n * <MultiSelectContent>\n * <MultiSelectList>\n * <MultiSelectItem value={\"React\"}>React</MultiSelectItem>\n * <MultiSelectItem value={\"Vue\"}>Vue</MultiSelectItem>\n * <MultiSelectItem value={\"Svelte\"}>Svelte</MultiSelectItem>\n * </MultiSelectList>\n * </MultiSelectContent>\n * </MultiSelect>\n * ```\n */\nconst MultiSelectRoot: FC<MultiSelectProps> = ({\n values: valuesProp,\n defaultValues,\n onValueChange: onValueChange,\n loop = false,\n className,\n children,\n dir,\n ...props\n}) => {\n const [value, setValue] = useState<string[]>(defaultValues ?? []);\n const [inputValue, setInputValue] = useState('');\n const [open, setOpen] = useState<boolean>(false);\n const [activeIndex, setActiveIndex] = useState<number>(-1);\n const inputRef = useRef<HTMLInputElement>(null);\n const [isValueSelected, setIsValueSelected] = useState(false);\n const [selectedValue, setSelectedValue] = useState('');\n\n useEffect(() => {\n if (valuesProp) {\n setValue(valuesProp);\n }\n }, [valuesProp]);\n\n const onValueChangeHandler = useCallback(\n (val: string) => {\n if (value.includes(val)) {\n const newValue = value.filter((item) => item !== val);\n setValue(newValue);\n onValueChange?.(newValue);\n } else {\n const newValue = [...value, val];\n setValue(newValue);\n onValueChange?.(newValue);\n }\n },\n\n [value]\n );\n\n const handleSelect = useCallback(\n (e: SyntheticEvent<HTMLInputElement>) => {\n e.preventDefault();\n const target = e.currentTarget;\n const selection = target.value.substring(\n target.selectionStart ?? 0,\n target.selectionEnd ?? 0\n );\n\n setSelectedValue(selection);\n setIsValueSelected(selection === inputValue);\n },\n [inputValue]\n );\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n e.stopPropagation();\n const target = inputRef.current;\n\n if (!target) return;\n\n const moveNext = () => {\n const nextIndex = activeIndex + 1;\n setActiveIndex(\n nextIndex > value.length - 1 ? (loop ? 0 : -1) : nextIndex\n );\n };\n\n const movePrev = () => {\n const prevIndex = activeIndex - 1;\n setActiveIndex(prevIndex < 0 ? value.length - 1 : prevIndex);\n };\n\n const moveCurrent = () => {\n const newIndex =\n activeIndex - 1 <= 0\n ? value.length - 1 === 0\n ? -1\n : 0\n : activeIndex - 1;\n setActiveIndex(newIndex);\n };\n\n switch (e.key) {\n case 'ArrowLeft':\n if (dir === 'rtl') {\n if (value.length > 0 && (activeIndex !== -1 || loop)) {\n moveNext();\n }\n } else if (value.length > 0 && target.selectionStart === 0) {\n movePrev();\n }\n break;\n\n case 'ArrowRight':\n if (dir === 'rtl') {\n if (value.length > 0 && target.selectionStart === 0) {\n movePrev();\n }\n } else if (value.length > 0 && (activeIndex !== -1 || loop)) {\n moveNext();\n }\n break;\n\n case 'Backspace':\n case 'Delete':\n if (value.length > 0) {\n if (activeIndex !== -1 && activeIndex < value.length) {\n onValueChangeHandler(value[activeIndex]);\n moveCurrent();\n } else if (\n (target.selectionStart === 0 && selectedValue === inputValue) ||\n isValueSelected\n ) {\n onValueChangeHandler(value[value.length - 1]);\n }\n }\n break;\n\n case 'Enter':\n setOpen(true);\n break;\n\n case 'Escape':\n if (activeIndex !== -1) {\n setActiveIndex(-1);\n } else if (open) {\n setOpen(false);\n }\n break;\n }\n },\n\n [value, inputValue, activeIndex, loop]\n );\n\n const memoValue = useMemo(\n () => ({\n value,\n onValueChange: onValueChangeHandler,\n open,\n setOpen,\n inputValue,\n setInputValue,\n activeIndex,\n setActiveIndex,\n ref: inputRef,\n handleSelect,\n }),\n [\n value,\n onValueChangeHandler,\n open,\n setOpen,\n inputValue,\n setInputValue,\n activeIndex,\n setActiveIndex,\n inputRef,\n handleSelect,\n ]\n );\n\n return (\n <MultiSelectContext value={memoValue}>\n <CommandRoot\n onKeyDown={handleKeyDown}\n className={cn(\n 'flex w-full flex-col gap-2 overflow-visible bg-transparent',\n className\n )}\n dir={dir}\n {...props}\n >\n {children}\n </CommandRoot>\n </MultiSelectContext>\n );\n};\n\nconst MultiSelectTrigger: FC<\n HTMLAttributes<HTMLDivElement> & {\n getBadgeValue?: (value: string) => string;\n validationStyleEnabled?: boolean;\n }\n> = ({\n className,\n getBadgeValue = (value) => value,\n validationStyleEnabled = false,\n children,\n ...props\n}) => {\n const { value, onValueChange, activeIndex } = useMultiSelect();\n\n const mousePreventDefault: MouseEventHandler<HTMLButtonElement> = useCallback(\n (e) => {\n e.preventDefault();\n e.stopPropagation();\n },\n []\n );\n\n return (\n <div\n className={cn(\n 'flex w-full flex-col gap-3 rounded-lg p-1 py-2',\n 'border-input ring-offset-background placeholder:text-muted-foreground focus:ring-ring flex w-full items-center justify-between whitespace-nowrap border px-3 py-2 text-sm focus:outline-none focus:ring-1 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',\n 'bg-input-background dark:bg-input-background-dark text-input-text dark:text-input-text-dark w-full select-text resize-none rounded-xl border-2 px-2 py-1 text-sm shadow-none outline-0 transition-all',\n 'border-input-border dark:border-input-border-dark hover:border-input-border-hover dark:hover:border-input-border-hover-dark focus:border-input-border-focus dark:focus:border-input-border-focus focus:outline-0 focus:[box-shadow:none]',\n 'aria-[invalid=true]:border-error dark:aria-[invalid=true]:border-error-dark',\n validationStyleEnabled &&\n 'valid:border-success dark:valid:border-success-dark invalid:border-error dark:invalid:border-error-dark',\n className\n )}\n {...props}\n >\n {value.length > 0 && (\n <div className=\"flex w-full flex-wrap gap-1\">\n {value.map((item, index) => (\n <Badge\n key={item}\n className={cn(\n 'flex items-center gap-1 rounded-xl px-1',\n activeIndex === index && 'ring-muted-foreground ring-2'\n )}\n color=\"text\"\n >\n <span className=\"text-xs\">{getBadgeValue(item)}</span>\n <button\n aria-label={`Remove ${item} option`}\n aria-roledescription=\"button to remove option\"\n onMouseDown={mousePreventDefault}\n onClick={() => onValueChange(item)}\n >\n <span className=\"sr-only\">Remove {item} option</span>\n <RemoveIcon className=\"size-4 cursor-pointer\" />\n </button>\n </Badge>\n ))}\n </div>\n )}\n {children}\n </div>\n );\n};\n\nconst MultiSelectInput: FC<ComponentProps<typeof Command.Input>> = ({\n className,\n ...props\n}) => {\n const {\n setOpen,\n inputValue,\n setInputValue,\n activeIndex,\n setActiveIndex,\n handleSelect,\n ref: inputRef,\n } = useMultiSelect();\n\n return (\n <Command.Input\n {...props}\n tabIndex={0}\n ref={inputRef as LegacyRef<HTMLInputElement>}\n value={inputValue}\n onValueChange={activeIndex === -1 ? setInputValue : undefined}\n onSelect={handleSelect}\n onBlur={() => setOpen(false)}\n onFocus={() => setOpen(true)}\n onClick={() => setActiveIndex(-1)}\n className={cn(\n 'ml-2 flex-1 cursor-pointer outline-none',\n className,\n activeIndex !== -1 && 'caret-transparent'\n )}\n />\n );\n};\n\nconst MultiSelectContent: FC<HTMLAttributes<HTMLDivElement>> = ({\n children,\n}) => {\n const { open } = useMultiSelect();\n return <div className=\"relative\">{open && children}</div>;\n};\n\nconst MultiSelectList: typeof Command.List = ({ className, children }) => (\n <Command.List\n className={cn(\n 'border-muted bg-input-background dark:bg-input-background-dark absolute top-0 z-10 flex w-full flex-col gap-2 rounded-lg border p-2 shadow-md transition-colors',\n className\n )}\n >\n {children}\n <Command.Empty>\n <span className=\"text-muted-foreground\">No results found</span>\n </Command.Empty>\n </Command.List>\n);\n\nconst MultiSelectItem: FC<\n { value: string } & ComponentProps<typeof Command.Item>\n> = ({ className, value, children, ...props }) => {\n const { value: Options, onValueChange, setInputValue } = useMultiSelect();\n\n const mousePreventDefault: MouseEventHandler<HTMLDivElement> = useCallback(\n (e) => {\n e.preventDefault();\n e.stopPropagation();\n },\n []\n );\n\n const isIncluded = Options.includes(value);\n return (\n <Command.Item\n {...props}\n onSelect={() => {\n onValueChange(value);\n setInputValue('');\n }}\n className={cn(\n 'flex cursor-pointer justify-between rounded-lg px-2 py-1 transition-colors',\n 'hover:bg-neutral/10 dark:hover:bg-neutral-dark/10',\n className,\n isIncluded && 'opacity-50',\n props.disabled && 'cursor-not-allowed opacity-50'\n )}\n onMouseDown={mousePreventDefault}\n >\n {children}\n {isIncluded && <Check className=\"size-4\" />}\n </Command.Item>\n );\n};\n\nMultiSelectItem.displayName = 'MultiSelectItem';\n\ntype MultiSelectType = typeof MultiSelectRoot & {\n Trigger: typeof MultiSelectTrigger;\n Input: typeof MultiSelectInput;\n Content: typeof MultiSelectContent;\n List: typeof MultiSelectList;\n Item: typeof MultiSelectItem;\n};\n\n/**\n *\n * Usage example:\n * ```jsx\n * <MultiSelect\n * values={value}\n * onValuesChange={setValue}\n * loop\n * >\n * <MultiSelect.Trigger>\n * <MultiSelect.Input placeholder=\"Select your framework\" />\n * </MultiSelect.Trigger>\n * <MultiSelect.Content>\n * <MultiSelect.List>\n * <MultiSelect.Item value={\"React\"}>React</MultiSelect.Item>\n * <MultiSelect.Item value={\"Vue\"}>Vue</MultiSelect.Item>\n * <MultiSelect.Item value={\"Svelte\"}>Svelte</MultiSelect.Item>\n * </MultiSelect.List>\n * </MultiSelect.Content>\n * </MultiSelect>\n * ```\n */\nexport const MultiSelect = MultiSelectRoot as MultiSelectType;\nMultiSelect.Trigger = MultiSelectTrigger;\nMultiSelect.Input = MultiSelectInput;\nMultiSelect.Content = MultiSelectContent;\nMultiSelect.List = MultiSelectList;\nMultiSelect.Item = MultiSelectItem;\n"],"names":["createContext","useContext","useState","useRef","useEffect","useCallback","useMemo","jsx","CommandRoot","cn","jsxs","Badge","RemoveIcon","Command","Check"],"mappings":";;;;;;;;;AAuCA,MAAM,qBAAqBA,2BAA8C,IAAI;AAE7E,MAAM,iBAAiB,MAAM;AACrB,QAAA,UAAUC,wBAAW,kBAAkB;AAC7C,MAAI,CAAC,SAAS;AACN,UAAA,IAAI,MAAM,wDAAwD;AAAA,EAAA;AAEnE,SAAA;AACT;AAmCA,MAAM,kBAAwC,CAAC;AAAA,EAC7C,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,OAAO,QAAQ,IAAIC,aAAAA,SAAmB,iBAAiB,CAAA,CAAE;AAChE,QAAM,CAAC,YAAY,aAAa,IAAIA,aAAAA,SAAS,EAAE;AAC/C,QAAM,CAAC,MAAM,OAAO,IAAIA,aAAAA,SAAkB,KAAK;AAC/C,QAAM,CAAC,aAAa,cAAc,IAAIA,aAAAA,SAAiB,EAAE;AACnD,QAAA,WAAWC,oBAAyB,IAAI;AAC9C,QAAM,CAAC,iBAAiB,kBAAkB,IAAID,aAAAA,SAAS,KAAK;AAC5D,QAA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client';\n\nimport { X as RemoveIcon, Check } from 'lucide-react';\nimport {\n type ComponentProps,\n type Dispatch,\n type FC,\n type HTMLAttributes,\n type KeyboardEvent,\n type LegacyRef,\n type MouseEventHandler,\n type RefObject,\n type SetStateAction,\n type SyntheticEvent,\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { Badge } from '../Badge';\nimport { Command, CommandRoot } from '../Command';\n\ntype MultiSelectContextProps = {\n value: string[];\n onValueChange: (value: string) => void;\n open: boolean;\n setOpen: (value: boolean) => void;\n inputValue: string;\n setInputValue: Dispatch<SetStateAction<string>>;\n activeIndex: number;\n setActiveIndex: Dispatch<SetStateAction<number>>;\n ref: RefObject<HTMLInputElement | null>;\n handleSelect: (e: SyntheticEvent<HTMLInputElement>) => void;\n};\n\nconst MultiSelectContext = createContext<MultiSelectContextProps | null>(null);\n\nconst useMultiSelect = () => {\n const context = useContext(MultiSelectContext);\n if (!context) {\n throw new Error('useMultiSelect must be used within MultiSelectProvider');\n }\n return context;\n};\n\n/**\n * MultiSelect Docs: {@link: https://shadcn-extension.vercel.app/docs/multi-select}\n */\n\ntype MultiSelectProps = ComponentProps<typeof CommandRoot> & {\n values?: string[];\n defaultValues?: string[];\n onValueChange?: (value: string[]) => void;\n loop?: boolean;\n};\n\n/**\n *\n * Usage example:\n * ```jsx\n * <MultiSelect\n * values={value}\n * onValuesChange={setValue}\n * loop\n * >\n * <MultiSelectTrigger>\n * <MultiSelectInput placeholder=\"Select your framework\" />\n * </MultiSelectTrigger>\n * <MultiSelectContent>\n * <MultiSelectList>\n * <MultiSelectItem value={\"React\"}>React</MultiSelectItem>\n * <MultiSelectItem value={\"Vue\"}>Vue</MultiSelectItem>\n * <MultiSelectItem value={\"Svelte\"}>Svelte</MultiSelectItem>\n * </MultiSelectList>\n * </MultiSelectContent>\n * </MultiSelect>\n * ```\n */\nconst MultiSelectRoot: FC<MultiSelectProps> = ({\n values: valuesProp,\n defaultValues,\n onValueChange: onValueChange,\n loop = false,\n className,\n children,\n dir,\n ...props\n}) => {\n const [value, setValue] = useState<string[]>(defaultValues ?? []);\n const [inputValue, setInputValue] = useState('');\n const [open, setOpen] = useState<boolean>(false);\n const [activeIndex, setActiveIndex] = useState<number>(-1);\n const inputRef = useRef<HTMLInputElement>(null);\n const [isValueSelected, setIsValueSelected] = useState(false);\n const [selectedValue, setSelectedValue] = useState('');\n\n useEffect(() => {\n if (valuesProp) {\n setValue(valuesProp);\n }\n }, [valuesProp]);\n\n const onValueChangeHandler = useCallback(\n (val: string) => {\n if (value.includes(val)) {\n const newValue = value.filter((item) => item !== val);\n setValue(newValue);\n onValueChange?.(newValue);\n } else {\n const newValue = [...value, val];\n setValue(newValue);\n onValueChange?.(newValue);\n }\n },\n\n [value]\n );\n\n const handleSelect = useCallback(\n (e: SyntheticEvent<HTMLInputElement>) => {\n e.preventDefault();\n const target = e.currentTarget;\n const selection = target.value.substring(\n target.selectionStart ?? 0,\n target.selectionEnd ?? 0\n );\n\n setSelectedValue(selection);\n setIsValueSelected(selection === inputValue);\n },\n [inputValue]\n );\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n e.stopPropagation();\n const target = inputRef.current;\n\n if (!target) return;\n\n const moveNext = () => {\n const nextIndex = activeIndex + 1;\n setActiveIndex(\n nextIndex > value.length - 1 ? (loop ? 0 : -1) : nextIndex\n );\n };\n\n const movePrev = () => {\n const prevIndex = activeIndex - 1;\n setActiveIndex(prevIndex < 0 ? value.length - 1 : prevIndex);\n };\n\n const moveCurrent = () => {\n const newIndex =\n activeIndex - 1 <= 0\n ? value.length - 1 === 0\n ? -1\n : 0\n : activeIndex - 1;\n setActiveIndex(newIndex);\n };\n\n switch (e.key) {\n case 'ArrowLeft':\n if (dir === 'rtl') {\n if (value.length > 0 && (activeIndex !== -1 || loop)) {\n moveNext();\n }\n } else if (value.length > 0 && target.selectionStart === 0) {\n movePrev();\n }\n break;\n\n case 'ArrowRight':\n if (dir === 'rtl') {\n if (value.length > 0 && target.selectionStart === 0) {\n movePrev();\n }\n } else if (value.length > 0 && (activeIndex !== -1 || loop)) {\n moveNext();\n }\n break;\n\n case 'Backspace':\n case 'Delete':\n if (value.length > 0) {\n if (activeIndex !== -1 && activeIndex < value.length) {\n onValueChangeHandler(value[activeIndex]);\n moveCurrent();\n } else if (\n (target.selectionStart === 0 && selectedValue === inputValue) ||\n isValueSelected\n ) {\n onValueChangeHandler(value[value.length - 1]);\n }\n }\n break;\n\n case 'Enter':\n setOpen(true);\n break;\n\n case 'Escape':\n if (activeIndex !== -1) {\n setActiveIndex(-1);\n } else if (open) {\n setOpen(false);\n }\n break;\n }\n },\n\n [value, inputValue, activeIndex, loop]\n );\n\n const memoValue = useMemo(\n () => ({\n value,\n onValueChange: onValueChangeHandler,\n open,\n setOpen,\n inputValue,\n setInputValue,\n activeIndex,\n setActiveIndex,\n ref: inputRef,\n handleSelect,\n }),\n [\n value,\n onValueChangeHandler,\n open,\n setOpen,\n inputValue,\n setInputValue,\n activeIndex,\n setActiveIndex,\n inputRef,\n handleSelect,\n ]\n );\n\n return (\n <MultiSelectContext value={memoValue}>\n <CommandRoot\n onKeyDown={handleKeyDown}\n className={cn(\n 'flex w-full flex-col gap-2 overflow-visible bg-transparent',\n className\n )}\n dir={dir}\n {...props}\n >\n {children}\n </CommandRoot>\n </MultiSelectContext>\n );\n};\n\nconst MultiSelectTrigger: FC<\n HTMLAttributes<HTMLDivElement> & {\n getBadgeValue?: (value: string) => string;\n validationStyleEnabled?: boolean;\n }\n> = ({\n className,\n getBadgeValue = (value) => value,\n validationStyleEnabled = false,\n children,\n ...props\n}) => {\n const { value, onValueChange, activeIndex } = useMultiSelect();\n\n const mousePreventDefault: MouseEventHandler<HTMLButtonElement> = useCallback(\n (e) => {\n e.preventDefault();\n e.stopPropagation();\n },\n []\n );\n\n return (\n <div\n className={cn(\n 'flex w-full flex-col gap-3 rounded-lg p-1 py-2',\n 'border-input ring-offset-background placeholder:text-muted-foreground focus:ring-ring flex w-full items-center justify-between whitespace-nowrap border px-3 py-2 text-sm focus:outline-none focus:ring-1 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',\n 'bg-input-background dark:bg-input-background-dark text-input-text dark:text-input-text-dark w-full select-text resize-none rounded-xl border-2 px-2 py-1 text-sm shadow-none outline-0 transition-all',\n 'border-input-border dark:border-input-border-dark hover:border-input-border-hover dark:hover:border-input-border-hover-dark focus:border-input-border-focus dark:focus:border-input-border-focus focus:outline-0 focus:[box-shadow:none]',\n 'aria-[invalid=true]:border-error dark:aria-[invalid=true]:border-error-dark',\n validationStyleEnabled &&\n 'valid:border-success dark:valid:border-success-dark invalid:border-error dark:invalid:border-error-dark',\n className\n )}\n {...props}\n >\n {value.length > 0 && (\n <div className=\"flex w-full flex-wrap gap-1\">\n {value.map((item, index) => (\n <Badge\n key={item}\n className={cn(\n 'flex items-center gap-1 rounded-xl px-1',\n activeIndex === index && 'ring-muted-foreground ring-2'\n )}\n color=\"text\"\n >\n <span className=\"text-xs\">{getBadgeValue(item)}</span>\n <button\n aria-label={`Remove ${item} option`}\n aria-roledescription=\"button to remove option\"\n onMouseDown={mousePreventDefault}\n onClick={() => onValueChange(item)}\n >\n <span className=\"sr-only\">Remove {item} option</span>\n <RemoveIcon className=\"size-4 cursor-pointer\" />\n </button>\n </Badge>\n ))}\n </div>\n )}\n {children}\n </div>\n );\n};\n\nconst MultiSelectInput: FC<ComponentProps<typeof Command.Input>> = ({\n className,\n ...props\n}) => {\n const {\n setOpen,\n inputValue,\n setInputValue,\n activeIndex,\n setActiveIndex,\n handleSelect,\n ref: inputRef,\n } = useMultiSelect();\n\n return (\n <Command.Input\n {...props}\n tabIndex={0}\n ref={inputRef as LegacyRef<HTMLInputElement>}\n value={inputValue}\n onValueChange={activeIndex === -1 ? setInputValue : undefined}\n onSelect={handleSelect}\n onBlur={() => setOpen(false)}\n onFocus={() => setOpen(true)}\n onClick={() => setActiveIndex(-1)}\n className={cn(\n 'ml-2 flex-1 cursor-pointer outline-none',\n className,\n activeIndex !== -1 && 'caret-transparent'\n )}\n />\n );\n};\n\nconst MultiSelectContent: FC<HTMLAttributes<HTMLDivElement>> = ({\n children,\n}) => {\n const { open } = useMultiSelect();\n return <div className=\"relative\">{open && children}</div>;\n};\n\nconst MultiSelectList: typeof Command.List = ({ className, children }) => (\n <Command.List\n className={cn(\n 'border-muted bg-input-background dark:bg-input-background-dark absolute top-0 z-10 flex w-full flex-col gap-2 rounded-lg border p-2 shadow-md transition-colors',\n className\n )}\n >\n {children}\n <Command.Empty>\n <span className=\"text-muted-foreground\">No results found</span>\n </Command.Empty>\n </Command.List>\n);\n\nconst MultiSelectItem: FC<\n { value: string } & ComponentProps<typeof Command.Item>\n> = ({ className, value, children, ...props }) => {\n const { value: Options, onValueChange, setInputValue } = useMultiSelect();\n\n const mousePreventDefault: MouseEventHandler<HTMLDivElement> = useCallback(\n (e) => {\n e.preventDefault();\n e.stopPropagation();\n },\n []\n );\n\n const isIncluded = Options.includes(value);\n return (\n <Command.Item\n {...props}\n onSelect={() => {\n onValueChange(value);\n setInputValue('');\n }}\n className={cn(\n 'flex cursor-pointer justify-between rounded-lg px-2 py-1 transition-colors',\n 'hover:bg-neutral/10 dark:hover:bg-neutral-dark/10',\n className,\n isIncluded && 'opacity-50',\n props.disabled && 'cursor-not-allowed opacity-50'\n )}\n onMouseDown={mousePreventDefault}\n >\n {children}\n {isIncluded && <Check className=\"size-4\" />}\n </Command.Item>\n );\n};\n\ntype MultiSelectType = typeof MultiSelectRoot & {\n Trigger: typeof MultiSelectTrigger;\n Input: typeof MultiSelectInput;\n Content: typeof MultiSelectContent;\n List: typeof MultiSelectList;\n Item: typeof MultiSelectItem;\n};\n\n/**\n *\n * Usage example:\n * ```jsx\n * <MultiSelect\n * values={value}\n * onValuesChange={setValue}\n * loop\n * >\n * <MultiSelect.Trigger>\n * <MultiSelect.Input placeholder=\"Select your framework\" />\n * </MultiSelect.Trigger>\n * <MultiSelect.Content>\n * <MultiSelect.List>\n * <MultiSelect.Item value={\"React\"}>React</MultiSelect.Item>\n * <MultiSelect.Item value={\"Vue\"}>Vue</MultiSelect.Item>\n * <MultiSelect.Item value={\"Svelte\"}>Svelte</MultiSelect.Item>\n * </MultiSelect.List>\n * </MultiSelect.Content>\n * </MultiSelect>\n * ```\n */\nexport const MultiSelect = MultiSelectRoot as MultiSelectType;\nMultiSelect.Trigger = MultiSelectTrigger;\nMultiSelect.Input = MultiSelectInput;\nMultiSelect.Content = MultiSelectContent;\nMultiSelect.List = MultiSelectList;\nMultiSelect.Item = MultiSelectItem;\n"],"names":["createContext","useContext","useState","useRef","useEffect","useCallback","useMemo","jsx","CommandRoot","cn","jsxs","Badge","RemoveIcon","Command","Check"],"mappings":";;;;;;;;;AAuCA,MAAM,qBAAqBA,2BAA8C,IAAI;AAE7E,MAAM,iBAAiB,MAAM;AACrB,QAAA,UAAUC,wBAAW,kBAAkB;AAC7C,MAAI,CAAC,SAAS;AACN,UAAA,IAAI,MAAM,wDAAwD;AAAA,EAAA;AAEnE,SAAA;AACT;AAmCA,MAAM,kBAAwC,CAAC;AAAA,EAC7C,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,OAAO,QAAQ,IAAIC,aAAAA,SAAmB,iBAAiB,CAAA,CAAE;AAChE,QAAM,CAAC,YAAY,aAAa,IAAIA,aAAAA,SAAS,EAAE;AAC/C,QAAM,CAAC,MAAM,OAAO,IAAIA,aAAAA,SAAkB,KAAK;AAC/C,QAAM,CAAC,aAAa,cAAc,IAAIA,aAAAA,SAAiB,EAAE;AACnD,QAAA,WAAWC,oBAAyB,IAAI;AAC9C,QAAM,CAAC,iBAAiB,kBAAkB,IAAID,aAAAA,SAAS,KAAK;AAC5D,QAAM,CAAC,eAAe,gBAAgB,IAAIA,aAAAA,SAA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AAC,IAYrC,CAAC;AAEF,QAAA,MAAM,eAAe,EAAE,EAAE,CACvB;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,cAAc,CAAC,OAAO,OAAO,CAAC,IAAI,CAAC,CAiCxD,CAAC;AAEF,KAAK,eAAe,GAAG,OAAO,eAAe,GAAG;IAC9C,OAAO,EAAE,OAAO,kBAAkB,CAAC;IACnC,KAAK,EAAE,OAAO,gBAAgB,CAAC;IAC/B,OAAO,EAAE,OAAO,kBAAkB,CAAC;IACnC,IAAI,EAAE,OAAO,eAAe,CAAC;IAC7B,IAAI,EAAE,OAAO,eAAe,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,WAAW,EAAsB,eAAe,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { Check, X } from "lucide-react";
3
+ import { X, Check } from "lucide-react";
4
4
  import { createContext, useState, useRef, useEffect, useCallback, useMemo, useContext } from "react";
5
5
  import { cn } from "../../utils/cn.mjs";
6
6
  import { Badge } from "../Badge/index.mjs";
@@ -315,7 +315,6 @@ const MultiSelectItem = ({ className, value, children, ...props }) => {
315
315
  }
316
316
  );
317
317
  };
318
- MultiSelectItem.displayName = "MultiSelectItem";
319
318
  const MultiSelect = MultiSelectRoot;
320
319
  MultiSelect.Trigger = MultiSelectTrigger;
321
320
  MultiSelect.Input = MultiSelectInput;
@@ -1 +1 @@
1
- {"version":3,"file":"Multiselect.mjs","sources":["../../../src/components/Select/Multiselect.tsx"],"sourcesContent":["'use client';\n\nimport { X as RemoveIcon, Check } from 'lucide-react';\nimport {\n type ComponentProps,\n type Dispatch,\n type FC,\n type HTMLAttributes,\n type KeyboardEvent,\n type LegacyRef,\n type MouseEventHandler,\n type RefObject,\n type SetStateAction,\n type SyntheticEvent,\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { Badge } from '../Badge';\nimport { Command, CommandRoot } from '../Command';\n\ntype MultiSelectContextProps = {\n value: string[];\n onValueChange: (value: string) => void;\n open: boolean;\n setOpen: (value: boolean) => void;\n inputValue: string;\n setInputValue: Dispatch<SetStateAction<string>>;\n activeIndex: number;\n setActiveIndex: Dispatch<SetStateAction<number>>;\n ref: RefObject<HTMLInputElement | null>;\n handleSelect: (e: SyntheticEvent<HTMLInputElement>) => void;\n};\n\nconst MultiSelectContext = createContext<MultiSelectContextProps | null>(null);\n\nconst useMultiSelect = () => {\n const context = useContext(MultiSelectContext);\n if (!context) {\n throw new Error('useMultiSelect must be used within MultiSelectProvider');\n }\n return context;\n};\n\n/**\n * MultiSelect Docs: {@link: https://shadcn-extension.vercel.app/docs/multi-select}\n */\n\ntype MultiSelectProps = ComponentProps<typeof CommandRoot> & {\n values?: string[];\n defaultValues?: string[];\n onValueChange?: (value: string[]) => void;\n loop?: boolean;\n};\n\n/**\n *\n * Usage example:\n * ```jsx\n * <MultiSelect\n * values={value}\n * onValuesChange={setValue}\n * loop\n * >\n * <MultiSelectTrigger>\n * <MultiSelectInput placeholder=\"Select your framework\" />\n * </MultiSelectTrigger>\n * <MultiSelectContent>\n * <MultiSelectList>\n * <MultiSelectItem value={\"React\"}>React</MultiSelectItem>\n * <MultiSelectItem value={\"Vue\"}>Vue</MultiSelectItem>\n * <MultiSelectItem value={\"Svelte\"}>Svelte</MultiSelectItem>\n * </MultiSelectList>\n * </MultiSelectContent>\n * </MultiSelect>\n * ```\n */\nconst MultiSelectRoot: FC<MultiSelectProps> = ({\n values: valuesProp,\n defaultValues,\n onValueChange: onValueChange,\n loop = false,\n className,\n children,\n dir,\n ...props\n}) => {\n const [value, setValue] = useState<string[]>(defaultValues ?? []);\n const [inputValue, setInputValue] = useState('');\n const [open, setOpen] = useState<boolean>(false);\n const [activeIndex, setActiveIndex] = useState<number>(-1);\n const inputRef = useRef<HTMLInputElement>(null);\n const [isValueSelected, setIsValueSelected] = useState(false);\n const [selectedValue, setSelectedValue] = useState('');\n\n useEffect(() => {\n if (valuesProp) {\n setValue(valuesProp);\n }\n }, [valuesProp]);\n\n const onValueChangeHandler = useCallback(\n (val: string) => {\n if (value.includes(val)) {\n const newValue = value.filter((item) => item !== val);\n setValue(newValue);\n onValueChange?.(newValue);\n } else {\n const newValue = [...value, val];\n setValue(newValue);\n onValueChange?.(newValue);\n }\n },\n\n [value]\n );\n\n const handleSelect = useCallback(\n (e: SyntheticEvent<HTMLInputElement>) => {\n e.preventDefault();\n const target = e.currentTarget;\n const selection = target.value.substring(\n target.selectionStart ?? 0,\n target.selectionEnd ?? 0\n );\n\n setSelectedValue(selection);\n setIsValueSelected(selection === inputValue);\n },\n [inputValue]\n );\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n e.stopPropagation();\n const target = inputRef.current;\n\n if (!target) return;\n\n const moveNext = () => {\n const nextIndex = activeIndex + 1;\n setActiveIndex(\n nextIndex > value.length - 1 ? (loop ? 0 : -1) : nextIndex\n );\n };\n\n const movePrev = () => {\n const prevIndex = activeIndex - 1;\n setActiveIndex(prevIndex < 0 ? value.length - 1 : prevIndex);\n };\n\n const moveCurrent = () => {\n const newIndex =\n activeIndex - 1 <= 0\n ? value.length - 1 === 0\n ? -1\n : 0\n : activeIndex - 1;\n setActiveIndex(newIndex);\n };\n\n switch (e.key) {\n case 'ArrowLeft':\n if (dir === 'rtl') {\n if (value.length > 0 && (activeIndex !== -1 || loop)) {\n moveNext();\n }\n } else if (value.length > 0 && target.selectionStart === 0) {\n movePrev();\n }\n break;\n\n case 'ArrowRight':\n if (dir === 'rtl') {\n if (value.length > 0 && target.selectionStart === 0) {\n movePrev();\n }\n } else if (value.length > 0 && (activeIndex !== -1 || loop)) {\n moveNext();\n }\n break;\n\n case 'Backspace':\n case 'Delete':\n if (value.length > 0) {\n if (activeIndex !== -1 && activeIndex < value.length) {\n onValueChangeHandler(value[activeIndex]);\n moveCurrent();\n } else if (\n (target.selectionStart === 0 && selectedValue === inputValue) ||\n isValueSelected\n ) {\n onValueChangeHandler(value[value.length - 1]);\n }\n }\n break;\n\n case 'Enter':\n setOpen(true);\n break;\n\n case 'Escape':\n if (activeIndex !== -1) {\n setActiveIndex(-1);\n } else if (open) {\n setOpen(false);\n }\n break;\n }\n },\n\n [value, inputValue, activeIndex, loop]\n );\n\n const memoValue = useMemo(\n () => ({\n value,\n onValueChange: onValueChangeHandler,\n open,\n setOpen,\n inputValue,\n setInputValue,\n activeIndex,\n setActiveIndex,\n ref: inputRef,\n handleSelect,\n }),\n [\n value,\n onValueChangeHandler,\n open,\n setOpen,\n inputValue,\n setInputValue,\n activeIndex,\n setActiveIndex,\n inputRef,\n handleSelect,\n ]\n );\n\n return (\n <MultiSelectContext value={memoValue}>\n <CommandRoot\n onKeyDown={handleKeyDown}\n className={cn(\n 'flex w-full flex-col gap-2 overflow-visible bg-transparent',\n className\n )}\n dir={dir}\n {...props}\n >\n {children}\n </CommandRoot>\n </MultiSelectContext>\n );\n};\n\nconst MultiSelectTrigger: FC<\n HTMLAttributes<HTMLDivElement> & {\n getBadgeValue?: (value: string) => string;\n validationStyleEnabled?: boolean;\n }\n> = ({\n className,\n getBadgeValue = (value) => value,\n validationStyleEnabled = false,\n children,\n ...props\n}) => {\n const { value, onValueChange, activeIndex } = useMultiSelect();\n\n const mousePreventDefault: MouseEventHandler<HTMLButtonElement> = useCallback(\n (e) => {\n e.preventDefault();\n e.stopPropagation();\n },\n []\n );\n\n return (\n <div\n className={cn(\n 'flex w-full flex-col gap-3 rounded-lg p-1 py-2',\n 'border-input ring-offset-background placeholder:text-muted-foreground focus:ring-ring flex w-full items-center justify-between whitespace-nowrap border px-3 py-2 text-sm focus:outline-none focus:ring-1 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',\n 'bg-input-background dark:bg-input-background-dark text-input-text dark:text-input-text-dark w-full select-text resize-none rounded-xl border-2 px-2 py-1 text-sm shadow-none outline-0 transition-all',\n 'border-input-border dark:border-input-border-dark hover:border-input-border-hover dark:hover:border-input-border-hover-dark focus:border-input-border-focus dark:focus:border-input-border-focus focus:outline-0 focus:[box-shadow:none]',\n 'aria-[invalid=true]:border-error dark:aria-[invalid=true]:border-error-dark',\n validationStyleEnabled &&\n 'valid:border-success dark:valid:border-success-dark invalid:border-error dark:invalid:border-error-dark',\n className\n )}\n {...props}\n >\n {value.length > 0 && (\n <div className=\"flex w-full flex-wrap gap-1\">\n {value.map((item, index) => (\n <Badge\n key={item}\n className={cn(\n 'flex items-center gap-1 rounded-xl px-1',\n activeIndex === index && 'ring-muted-foreground ring-2'\n )}\n color=\"text\"\n >\n <span className=\"text-xs\">{getBadgeValue(item)}</span>\n <button\n aria-label={`Remove ${item} option`}\n aria-roledescription=\"button to remove option\"\n onMouseDown={mousePreventDefault}\n onClick={() => onValueChange(item)}\n >\n <span className=\"sr-only\">Remove {item} option</span>\n <RemoveIcon className=\"size-4 cursor-pointer\" />\n </button>\n </Badge>\n ))}\n </div>\n )}\n {children}\n </div>\n );\n};\n\nconst MultiSelectInput: FC<ComponentProps<typeof Command.Input>> = ({\n className,\n ...props\n}) => {\n const {\n setOpen,\n inputValue,\n setInputValue,\n activeIndex,\n setActiveIndex,\n handleSelect,\n ref: inputRef,\n } = useMultiSelect();\n\n return (\n <Command.Input\n {...props}\n tabIndex={0}\n ref={inputRef as LegacyRef<HTMLInputElement>}\n value={inputValue}\n onValueChange={activeIndex === -1 ? setInputValue : undefined}\n onSelect={handleSelect}\n onBlur={() => setOpen(false)}\n onFocus={() => setOpen(true)}\n onClick={() => setActiveIndex(-1)}\n className={cn(\n 'ml-2 flex-1 cursor-pointer outline-none',\n className,\n activeIndex !== -1 && 'caret-transparent'\n )}\n />\n );\n};\n\nconst MultiSelectContent: FC<HTMLAttributes<HTMLDivElement>> = ({\n children,\n}) => {\n const { open } = useMultiSelect();\n return <div className=\"relative\">{open && children}</div>;\n};\n\nconst MultiSelectList: typeof Command.List = ({ className, children }) => (\n <Command.List\n className={cn(\n 'border-muted bg-input-background dark:bg-input-background-dark absolute top-0 z-10 flex w-full flex-col gap-2 rounded-lg border p-2 shadow-md transition-colors',\n className\n )}\n >\n {children}\n <Command.Empty>\n <span className=\"text-muted-foreground\">No results found</span>\n </Command.Empty>\n </Command.List>\n);\n\nconst MultiSelectItem: FC<\n { value: string } & ComponentProps<typeof Command.Item>\n> = ({ className, value, children, ...props }) => {\n const { value: Options, onValueChange, setInputValue } = useMultiSelect();\n\n const mousePreventDefault: MouseEventHandler<HTMLDivElement> = useCallback(\n (e) => {\n e.preventDefault();\n e.stopPropagation();\n },\n []\n );\n\n const isIncluded = Options.includes(value);\n return (\n <Command.Item\n {...props}\n onSelect={() => {\n onValueChange(value);\n setInputValue('');\n }}\n className={cn(\n 'flex cursor-pointer justify-between rounded-lg px-2 py-1 transition-colors',\n 'hover:bg-neutral/10 dark:hover:bg-neutral-dark/10',\n className,\n isIncluded && 'opacity-50',\n props.disabled && 'cursor-not-allowed opacity-50'\n )}\n onMouseDown={mousePreventDefault}\n >\n {children}\n {isIncluded && <Check className=\"size-4\" />}\n </Command.Item>\n );\n};\n\nMultiSelectItem.displayName = 'MultiSelectItem';\n\ntype MultiSelectType = typeof MultiSelectRoot & {\n Trigger: typeof MultiSelectTrigger;\n Input: typeof MultiSelectInput;\n Content: typeof MultiSelectContent;\n List: typeof MultiSelectList;\n Item: typeof MultiSelectItem;\n};\n\n/**\n *\n * Usage example:\n * ```jsx\n * <MultiSelect\n * values={value}\n * onValuesChange={setValue}\n * loop\n * >\n * <MultiSelect.Trigger>\n * <MultiSelect.Input placeholder=\"Select your framework\" />\n * </MultiSelect.Trigger>\n * <MultiSelect.Content>\n * <MultiSelect.List>\n * <MultiSelect.Item value={\"React\"}>React</MultiSelect.Item>\n * <MultiSelect.Item value={\"Vue\"}>Vue</MultiSelect.Item>\n * <MultiSelect.Item value={\"Svelte\"}>Svelte</MultiSelect.Item>\n * </MultiSelect.List>\n * </MultiSelect.Content>\n * </MultiSelect>\n * ```\n */\nexport const MultiSelect = MultiSelectRoot as MultiSelectType;\nMultiSelect.Trigger = MultiSelectTrigger;\nMultiSelect.Input = MultiSelectInput;\nMultiSelect.Content = MultiSelectContent;\nMultiSelect.List = MultiSelectList;\nMultiSelect.Item = MultiSelectItem;\n"],"names":["RemoveIcon"],"mappings":";;;;;;;AAuCA,MAAM,qBAAqB,cAA8C,IAAI;AAE7E,MAAM,iBAAiB,MAAM;AACrB,QAAA,UAAU,WAAW,kBAAkB;AAC7C,MAAI,CAAC,SAAS;AACN,UAAA,IAAI,MAAM,wDAAwD;AAAA,EAAA;AAEnE,SAAA;AACT;AAmCA,MAAM,kBAAwC,CAAC;AAAA,EAC7C,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAmB,iBAAiB,CAAA,CAAE;AAChE,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,EAAE;AAC/C,QAAM,CAAC,MAAM,OAAO,IAAI,SAAkB,KAAK;AAC/C,QAAM,CAAC,aAAa,cAAc,IAAI,SAAiB,EAAE;AACnD,QAAA,WAAW,OAAyB,IAAI;AAC9C,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,SAAS,KAAK;AAC5D,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAS,EAAE;AAErD,YAAU,MAAM;AACd,QAAI,YAAY;AACd,eAAS,UAAU;AAAA,IAAA;AAAA,EACrB,GACC,CAAC,UAAU,CAAC;AAEf,QAAM,uBAAuB;AAAA,IAC3B,CAAC,QAAgB;AACX,UAAA,MAAM,SAAS,GAAG,GAAG;AACvB,cAAM,WAAW,MAAM,OAAO,CAAC,SAAS,SAAS,GAAG;AACpD,iBAAS,QAAQ;AACjB,wBAAgB,QAAQ;AAAA,MAAA,OACnB;AACL,cAAM,WAAW,CAAC,GA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AAEvC,SAAA;AAAA,IAAC,QAAQ;AAAA,IAAR;AAAA,MACE,GAAG;AAAA,MACJ,UAAU,MAAM;AACd,sBAAc,KAAK;AACnB,sBAAc,EAAE;AAAA,MAClB;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA,cAAc;AAAA,QACd,MAAM,YAAY;AAAA,MACpB;AAAA,MACA,aAAa;AAAA,MAEZ,UAAA;AAAA,QAAA;AAAA,QACA,cAAc,oBAAC,OAAM,EAAA,WAAU,SAAS,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAC3C;AAEJ;AAEA,gBAAgB,cAAc;AAgCvB,MAAM,cAAc;AAC3B,YAAY,UAAU;AACtB,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,YAAY,OAAO;AACnB,YAAY,OAAO;"}
1
+ {"version":3,"file":"Multiselect.mjs","sources":["../../../src/components/Select/Multiselect.tsx"],"sourcesContent":["'use client';\n\nimport { X as RemoveIcon, Check } from 'lucide-react';\nimport {\n type ComponentProps,\n type Dispatch,\n type FC,\n type HTMLAttributes,\n type KeyboardEvent,\n type LegacyRef,\n type MouseEventHandler,\n type RefObject,\n type SetStateAction,\n type SyntheticEvent,\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { Badge } from '../Badge';\nimport { Command, CommandRoot } from '../Command';\n\ntype MultiSelectContextProps = {\n value: string[];\n onValueChange: (value: string) => void;\n open: boolean;\n setOpen: (value: boolean) => void;\n inputValue: string;\n setInputValue: Dispatch<SetStateAction<string>>;\n activeIndex: number;\n setActiveIndex: Dispatch<SetStateAction<number>>;\n ref: RefObject<HTMLInputElement | null>;\n handleSelect: (e: SyntheticEvent<HTMLInputElement>) => void;\n};\n\nconst MultiSelectContext = createContext<MultiSelectContextProps | null>(null);\n\nconst useMultiSelect = () => {\n const context = useContext(MultiSelectContext);\n if (!context) {\n throw new Error('useMultiSelect must be used within MultiSelectProvider');\n }\n return context;\n};\n\n/**\n * MultiSelect Docs: {@link: https://shadcn-extension.vercel.app/docs/multi-select}\n */\n\ntype MultiSelectProps = ComponentProps<typeof CommandRoot> & {\n values?: string[];\n defaultValues?: string[];\n onValueChange?: (value: string[]) => void;\n loop?: boolean;\n};\n\n/**\n *\n * Usage example:\n * ```jsx\n * <MultiSelect\n * values={value}\n * onValuesChange={setValue}\n * loop\n * >\n * <MultiSelectTrigger>\n * <MultiSelectInput placeholder=\"Select your framework\" />\n * </MultiSelectTrigger>\n * <MultiSelectContent>\n * <MultiSelectList>\n * <MultiSelectItem value={\"React\"}>React</MultiSelectItem>\n * <MultiSelectItem value={\"Vue\"}>Vue</MultiSelectItem>\n * <MultiSelectItem value={\"Svelte\"}>Svelte</MultiSelectItem>\n * </MultiSelectList>\n * </MultiSelectContent>\n * </MultiSelect>\n * ```\n */\nconst MultiSelectRoot: FC<MultiSelectProps> = ({\n values: valuesProp,\n defaultValues,\n onValueChange: onValueChange,\n loop = false,\n className,\n children,\n dir,\n ...props\n}) => {\n const [value, setValue] = useState<string[]>(defaultValues ?? []);\n const [inputValue, setInputValue] = useState('');\n const [open, setOpen] = useState<boolean>(false);\n const [activeIndex, setActiveIndex] = useState<number>(-1);\n const inputRef = useRef<HTMLInputElement>(null);\n const [isValueSelected, setIsValueSelected] = useState(false);\n const [selectedValue, setSelectedValue] = useState('');\n\n useEffect(() => {\n if (valuesProp) {\n setValue(valuesProp);\n }\n }, [valuesProp]);\n\n const onValueChangeHandler = useCallback(\n (val: string) => {\n if (value.includes(val)) {\n const newValue = value.filter((item) => item !== val);\n setValue(newValue);\n onValueChange?.(newValue);\n } else {\n const newValue = [...value, val];\n setValue(newValue);\n onValueChange?.(newValue);\n }\n },\n\n [value]\n );\n\n const handleSelect = useCallback(\n (e: SyntheticEvent<HTMLInputElement>) => {\n e.preventDefault();\n const target = e.currentTarget;\n const selection = target.value.substring(\n target.selectionStart ?? 0,\n target.selectionEnd ?? 0\n );\n\n setSelectedValue(selection);\n setIsValueSelected(selection === inputValue);\n },\n [inputValue]\n );\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n e.stopPropagation();\n const target = inputRef.current;\n\n if (!target) return;\n\n const moveNext = () => {\n const nextIndex = activeIndex + 1;\n setActiveIndex(\n nextIndex > value.length - 1 ? (loop ? 0 : -1) : nextIndex\n );\n };\n\n const movePrev = () => {\n const prevIndex = activeIndex - 1;\n setActiveIndex(prevIndex < 0 ? value.length - 1 : prevIndex);\n };\n\n const moveCurrent = () => {\n const newIndex =\n activeIndex - 1 <= 0\n ? value.length - 1 === 0\n ? -1\n : 0\n : activeIndex - 1;\n setActiveIndex(newIndex);\n };\n\n switch (e.key) {\n case 'ArrowLeft':\n if (dir === 'rtl') {\n if (value.length > 0 && (activeIndex !== -1 || loop)) {\n moveNext();\n }\n } else if (value.length > 0 && target.selectionStart === 0) {\n movePrev();\n }\n break;\n\n case 'ArrowRight':\n if (dir === 'rtl') {\n if (value.length > 0 && target.selectionStart === 0) {\n movePrev();\n }\n } else if (value.length > 0 && (activeIndex !== -1 || loop)) {\n moveNext();\n }\n break;\n\n case 'Backspace':\n case 'Delete':\n if (value.length > 0) {\n if (activeIndex !== -1 && activeIndex < value.length) {\n onValueChangeHandler(value[activeIndex]);\n moveCurrent();\n } else if (\n (target.selectionStart === 0 && selectedValue === inputValue) ||\n isValueSelected\n ) {\n onValueChangeHandler(value[value.length - 1]);\n }\n }\n break;\n\n case 'Enter':\n setOpen(true);\n break;\n\n case 'Escape':\n if (activeIndex !== -1) {\n setActiveIndex(-1);\n } else if (open) {\n setOpen(false);\n }\n break;\n }\n },\n\n [value, inputValue, activeIndex, loop]\n );\n\n const memoValue = useMemo(\n () => ({\n value,\n onValueChange: onValueChangeHandler,\n open,\n setOpen,\n inputValue,\n setInputValue,\n activeIndex,\n setActiveIndex,\n ref: inputRef,\n handleSelect,\n }),\n [\n value,\n onValueChangeHandler,\n open,\n setOpen,\n inputValue,\n setInputValue,\n activeIndex,\n setActiveIndex,\n inputRef,\n handleSelect,\n ]\n );\n\n return (\n <MultiSelectContext value={memoValue}>\n <CommandRoot\n onKeyDown={handleKeyDown}\n className={cn(\n 'flex w-full flex-col gap-2 overflow-visible bg-transparent',\n className\n )}\n dir={dir}\n {...props}\n >\n {children}\n </CommandRoot>\n </MultiSelectContext>\n );\n};\n\nconst MultiSelectTrigger: FC<\n HTMLAttributes<HTMLDivElement> & {\n getBadgeValue?: (value: string) => string;\n validationStyleEnabled?: boolean;\n }\n> = ({\n className,\n getBadgeValue = (value) => value,\n validationStyleEnabled = false,\n children,\n ...props\n}) => {\n const { value, onValueChange, activeIndex } = useMultiSelect();\n\n const mousePreventDefault: MouseEventHandler<HTMLButtonElement> = useCallback(\n (e) => {\n e.preventDefault();\n e.stopPropagation();\n },\n []\n );\n\n return (\n <div\n className={cn(\n 'flex w-full flex-col gap-3 rounded-lg p-1 py-2',\n 'border-input ring-offset-background placeholder:text-muted-foreground focus:ring-ring flex w-full items-center justify-between whitespace-nowrap border px-3 py-2 text-sm focus:outline-none focus:ring-1 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',\n 'bg-input-background dark:bg-input-background-dark text-input-text dark:text-input-text-dark w-full select-text resize-none rounded-xl border-2 px-2 py-1 text-sm shadow-none outline-0 transition-all',\n 'border-input-border dark:border-input-border-dark hover:border-input-border-hover dark:hover:border-input-border-hover-dark focus:border-input-border-focus dark:focus:border-input-border-focus focus:outline-0 focus:[box-shadow:none]',\n 'aria-[invalid=true]:border-error dark:aria-[invalid=true]:border-error-dark',\n validationStyleEnabled &&\n 'valid:border-success dark:valid:border-success-dark invalid:border-error dark:invalid:border-error-dark',\n className\n )}\n {...props}\n >\n {value.length > 0 && (\n <div className=\"flex w-full flex-wrap gap-1\">\n {value.map((item, index) => (\n <Badge\n key={item}\n className={cn(\n 'flex items-center gap-1 rounded-xl px-1',\n activeIndex === index && 'ring-muted-foreground ring-2'\n )}\n color=\"text\"\n >\n <span className=\"text-xs\">{getBadgeValue(item)}</span>\n <button\n aria-label={`Remove ${item} option`}\n aria-roledescription=\"button to remove option\"\n onMouseDown={mousePreventDefault}\n onClick={() => onValueChange(item)}\n >\n <span className=\"sr-only\">Remove {item} option</span>\n <RemoveIcon className=\"size-4 cursor-pointer\" />\n </button>\n </Badge>\n ))}\n </div>\n )}\n {children}\n </div>\n );\n};\n\nconst MultiSelectInput: FC<ComponentProps<typeof Command.Input>> = ({\n className,\n ...props\n}) => {\n const {\n setOpen,\n inputValue,\n setInputValue,\n activeIndex,\n setActiveIndex,\n handleSelect,\n ref: inputRef,\n } = useMultiSelect();\n\n return (\n <Command.Input\n {...props}\n tabIndex={0}\n ref={inputRef as LegacyRef<HTMLInputElement>}\n value={inputValue}\n onValueChange={activeIndex === -1 ? setInputValue : undefined}\n onSelect={handleSelect}\n onBlur={() => setOpen(false)}\n onFocus={() => setOpen(true)}\n onClick={() => setActiveIndex(-1)}\n className={cn(\n 'ml-2 flex-1 cursor-pointer outline-none',\n className,\n activeIndex !== -1 && 'caret-transparent'\n )}\n />\n );\n};\n\nconst MultiSelectContent: FC<HTMLAttributes<HTMLDivElement>> = ({\n children,\n}) => {\n const { open } = useMultiSelect();\n return <div className=\"relative\">{open && children}</div>;\n};\n\nconst MultiSelectList: typeof Command.List = ({ className, children }) => (\n <Command.List\n className={cn(\n 'border-muted bg-input-background dark:bg-input-background-dark absolute top-0 z-10 flex w-full flex-col gap-2 rounded-lg border p-2 shadow-md transition-colors',\n className\n )}\n >\n {children}\n <Command.Empty>\n <span className=\"text-muted-foreground\">No results found</span>\n </Command.Empty>\n </Command.List>\n);\n\nconst MultiSelectItem: FC<\n { value: string } & ComponentProps<typeof Command.Item>\n> = ({ className, value, children, ...props }) => {\n const { value: Options, onValueChange, setInputValue } = useMultiSelect();\n\n const mousePreventDefault: MouseEventHandler<HTMLDivElement> = useCallback(\n (e) => {\n e.preventDefault();\n e.stopPropagation();\n },\n []\n );\n\n const isIncluded = Options.includes(value);\n return (\n <Command.Item\n {...props}\n onSelect={() => {\n onValueChange(value);\n setInputValue('');\n }}\n className={cn(\n 'flex cursor-pointer justify-between rounded-lg px-2 py-1 transition-colors',\n 'hover:bg-neutral/10 dark:hover:bg-neutral-dark/10',\n className,\n isIncluded && 'opacity-50',\n props.disabled && 'cursor-not-allowed opacity-50'\n )}\n onMouseDown={mousePreventDefault}\n >\n {children}\n {isIncluded && <Check className=\"size-4\" />}\n </Command.Item>\n );\n};\n\ntype MultiSelectType = typeof MultiSelectRoot & {\n Trigger: typeof MultiSelectTrigger;\n Input: typeof MultiSelectInput;\n Content: typeof MultiSelectContent;\n List: typeof MultiSelectList;\n Item: typeof MultiSelectItem;\n};\n\n/**\n *\n * Usage example:\n * ```jsx\n * <MultiSelect\n * values={value}\n * onValuesChange={setValue}\n * loop\n * >\n * <MultiSelect.Trigger>\n * <MultiSelect.Input placeholder=\"Select your framework\" />\n * </MultiSelect.Trigger>\n * <MultiSelect.Content>\n * <MultiSelect.List>\n * <MultiSelect.Item value={\"React\"}>React</MultiSelect.Item>\n * <MultiSelect.Item value={\"Vue\"}>Vue</MultiSelect.Item>\n * <MultiSelect.Item value={\"Svelte\"}>Svelte</MultiSelect.Item>\n * </MultiSelect.List>\n * </MultiSelect.Content>\n * </MultiSelect>\n * ```\n */\nexport const MultiSelect = MultiSelectRoot as MultiSelectType;\nMultiSelect.Trigger = MultiSelectTrigger;\nMultiSelect.Input = MultiSelectInput;\nMultiSelect.Content = MultiSelectContent;\nMultiSelect.List = MultiSelectList;\nMultiSelect.Item = MultiSelectItem;\n"],"names":["RemoveIcon"],"mappings":";;;;;;;AAuCA,MAAM,qBAAqB,cAA8C,IAAI;AAE7E,MAAM,iBAAiB,MAAM;AACrB,QAAA,UAAU,WAAW,kBAAkB;AAC7C,MAAI,CAAC,SAAS;AACN,UAAA,IAAI,MAAM,wDAAwD;AAAA,EAAA;AAEnE,SAAA;AACT;AAmCA,MAAM,kBAAwC,CAAC;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ACpB,YAAY,UAAU;AACtB,YAAY,OAAO;AACnB,YAAY,OAAO;"}
@@ -65,7 +65,6 @@ const SelectScrollDownButton = ({ className, ...props }) => /* @__PURE__ */ jsxR
65
65
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, {})
66
66
  }
67
67
  );
68
- SelectScrollDownButton.displayName = SelectPrimitive__namespace.ScrollDownButton.displayName;
69
68
  const SelectContent = ({ className, children, position = "popper", ...props }) => /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
70
69
  SelectPrimitive__namespace.Content,
71
70
  {
@@ -1 +1 @@
1
- {"version":3,"file":"Select.cjs","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["'use client';\n\nimport * as SelectPrimitive from '@radix-ui/react-select';\nimport {\n ChevronsUpDown,\n CheckIcon,\n ChevronDownIcon,\n ChevronUpIcon,\n} from 'lucide-react';\nimport { type FC, type ComponentProps } from 'react';\nimport { cn } from '../../utils/cn';\n\nconst SelectRoot = SelectPrimitive.Root;\nconst SelectGroup = SelectPrimitive.Group;\nconst SelectValue = SelectPrimitive.Value;\n\nconst SelectTrigger: FC<\n ComponentProps<typeof SelectPrimitive.Trigger> & {\n validationStyleEnabled?: boolean;\n }\n> = ({ validationStyleEnabled = false, className, children, ...props }) => (\n <SelectPrimitive.Trigger\n className={cn(\n 'border-input ring-offset-background placeholder:text-muted-foreground focus:ring-ring flex w-full items-center justify-between whitespace-nowrap rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',\n 'bg-input-background dark:bg-input-background-dark text-input-text dark:text-input-text-dark w-full select-text resize-none rounded-xl border-2 px-2 py-1 text-sm shadow-none outline-0 transition-all',\n 'border-input-border dark:border-input-border-dark hover:border-input-border-hover dark:hover:border-input-border-hover-dark focus:border-input-border-focus dark:focus:border-input-border-focus focus:outline-0 focus:[box-shadow:none]',\n 'aria-[invalid=true]:border-error dark:aria-[invalid=true]:border-error-dark',\n validationStyleEnabled &&\n 'valid:border-success dark:valid:border-success-dark invalid:border-error dark:invalid:border-error-dark',\n className\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronsUpDown className=\"size-4 opacity-50\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n);\n\nconst SelectScrollUpButton: FC<\n ComponentProps<typeof SelectPrimitive.ScrollUpButton>\n> = ({ className, ...props }) => (\n <SelectPrimitive.ScrollUpButton\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className\n )}\n {...props}\n >\n <ChevronUpIcon />\n </SelectPrimitive.ScrollUpButton>\n);\n\nconst SelectScrollDownButton: FC<\n ComponentProps<typeof SelectPrimitive.ScrollDownButton>\n> = ({ className, ...props }) => (\n <SelectPrimitive.ScrollDownButton\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className\n )}\n {...props}\n >\n <ChevronDownIcon />\n </SelectPrimitive.ScrollDownButton>\n);\nSelectScrollDownButton.displayName =\n SelectPrimitive.ScrollDownButton.displayName;\n\nexport const SelectContent: FC<\n ComponentProps<typeof SelectPrimitive.Content>\n> = ({ className, children, position = 'popper', ...props }) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n className={cn(\n 'bg-input-background dark:bg-input-background-dark text-input-text dark:text-input-text-dark w-full select-text resize-none rounded-xl border-2 p-1 text-sm shadow-none outline-0 transition-all',\n '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 relative z-50 max-h-96 min-w-[8rem] overflow-hidden border shadow-md',\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);\n\nexport const SelectLabel: FC<ComponentProps<typeof SelectPrimitive.Label>> = ({\n className,\n ...props\n}) => (\n <SelectPrimitive.Label\n className={cn('px-1 py-0.5 text-sm font-semibold', className)}\n {...props}\n />\n);\n\nconst SelectItem: FC<ComponentProps<typeof SelectPrimitive.Item>> = ({\n className,\n children,\n ...props\n}) => (\n <SelectPrimitive.Item\n className={cn(\n 'focus:bg-neutral/10 dark:focus:bg-neutral-dark/10 relative flex w-full cursor-pointer select-none items-center rounded-lg py-1.5 pl-2 pr-8 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className\n )}\n {...props}\n >\n <span className=\"absolute right-2 flex size-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n);\n\nexport const SelectSeparator: FC<\n ComponentProps<typeof SelectPrimitive.Separator>\n> = ({ className, ...props }) => (\n <SelectPrimitive.Separator\n className={cn('-mx-1 my-1 h-px bg-red-300', className)}\n {...props}\n />\n);\n\ntype SelectType = typeof SelectRoot & {\n Group: typeof SelectGroup;\n Value: typeof SelectValue;\n Trigger: typeof SelectTrigger;\n ScrollUpButton: typeof SelectScrollUpButton;\n ScrollDownButton: typeof SelectScrollDownButton;\n Content: typeof SelectContent;\n Label: typeof SelectLabel;\n Item: typeof SelectItem;\n Separator: typeof SelectSeparator;\n};\n\n/**\n * Usage example:\n * ```jsx\n * <Select>\n * <Select.Trigger>\n * <Select.Value placeholder=\"Theme\" />\n * </Select.Trigger>\n * <Select.Content>\n * <Select.Item value=\"light\">Light</Select.Item>\n * <Select.Item value=\"dark\">Dark</Select.Item>\n * <Select.Item value=\"system\">System</Select.Item>\n * </Select.Content>\n * </Select>\n * ```\n */\nexport const Select = SelectRoot as SelectType;\nSelect.Group = SelectGroup;\nSelect.Value = SelectValue;\nSelect.Trigger = SelectTrigger;\nSelect.ScrollUpButton = SelectScrollUpButton;\nSelect.ScrollDownButton = SelectScrollDownButton;\nSelect.Content = SelectContent;\nSelect.Label = SelectLabel;\nSelect.Item = SelectItem;\nSelect.Separator = SelectSeparator;\n"],"names":["SelectPrimitive","jsxs","cn","jsx","ChevronsUpDown","ChevronUpIcon","ChevronDownIcon","CheckIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAM,aAAaA,2BAAgB;AACnC,MAAM,cAAcA,2BAAgB;AACpC,MAAM,cAAcA,2BAAgB;AAEpC,MAAM,gBAIF,CAAC,EAAE,yBAAyB,OAAO,WAAW,UAAU,GAAG,MAAA,MAC7DC,2BAAA;AAAA,EAACD,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAA;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,0BACE;AAAA,MACF;AAAA,IACF;AAAA,IACC,GAAG;AAAA,IAEH,UAAA;AAAA,MAAA;AAAA,MACDC,2BAAAA,IAACH,2BAAgB,MAAhB,EAAqB,SAAO,MAC3B,UAACG,2BAAAA,IAAAC,YAAAA,gBAAA,EAAe,WAAU,oBAAoB,CAAA,EAChD,CAAA;AAAA,IAAA;AAAA,EAAA;AACF;AAGF,MAAM,uBAEF,CAAC,EAAE,WAAW,GAAG,MACnB,MAAAD,2BAAA;AAAA,EAACH,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAA;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA,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AA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA,IAEJ,UAAA;AAAA,MAAAC,2BAAA,IAAC,QAAK,EAAA,WAAU,8DACd,UAAAA,2BAAA,IAACH,2BAAgB,eAAhB,EACC,UAAAG,2BAAA,IAACI,uBAAU,EAAA,WAAU,SAAS,CAAA,EAChC,CAAA,GACF;AAAA,MACCJ,2BAAAA,IAAAH,2BAAgB,UAAhB,EAA0B,SAAS,CAAA;AAAA,IAAA;AAAA,EAAA;AACtC;AAGK,MAAM,kBAET,CAAC,EAAE,WAAW,GAAG,MACnB,MAAAG,2BAAA;AAAA,EAACH,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAAA,GAAG,8BAA8B,SAAS;AAAA,IACpD,GAAG;AAAA,EAAA;AACN;AA8BK,MAAM,SAAS;AACtB,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,iBAAiB;AACxB,OAAO,mBAAmB;AAC1B,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,OAAO,OAAO;AACd,OAAO,YAAY;;;;;"}
1
+ {"version":3,"file":"Select.cjs","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["'use client';\n\nimport * as SelectPrimitive from '@radix-ui/react-select';\nimport {\n ChevronsUpDown,\n CheckIcon,\n ChevronDownIcon,\n ChevronUpIcon,\n} from 'lucide-react';\nimport { type FC, type ComponentProps } from 'react';\nimport { cn } from '../../utils/cn';\n\nconst SelectRoot = SelectPrimitive.Root;\nconst SelectGroup = SelectPrimitive.Group;\nconst SelectValue = SelectPrimitive.Value;\n\nconst SelectTrigger: FC<\n ComponentProps<typeof SelectPrimitive.Trigger> & {\n validationStyleEnabled?: boolean;\n }\n> = ({ validationStyleEnabled = false, className, children, ...props }) => (\n <SelectPrimitive.Trigger\n className={cn(\n 'border-input ring-offset-background placeholder:text-muted-foreground focus:ring-ring flex w-full items-center justify-between whitespace-nowrap rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',\n 'bg-input-background dark:bg-input-background-dark text-input-text dark:text-input-text-dark w-full select-text resize-none rounded-xl border-2 px-2 py-1 text-sm shadow-none outline-0 transition-all',\n 'border-input-border dark:border-input-border-dark hover:border-input-border-hover dark:hover:border-input-border-hover-dark focus:border-input-border-focus dark:focus:border-input-border-focus focus:outline-0 focus:[box-shadow:none]',\n 'aria-[invalid=true]:border-error dark:aria-[invalid=true]:border-error-dark',\n validationStyleEnabled &&\n 'valid:border-success dark:valid:border-success-dark invalid:border-error dark:invalid:border-error-dark',\n className\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronsUpDown className=\"size-4 opacity-50\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n);\n\nconst SelectScrollUpButton: FC<\n ComponentProps<typeof SelectPrimitive.ScrollUpButton>\n> = ({ className, ...props }) => (\n <SelectPrimitive.ScrollUpButton\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className\n )}\n {...props}\n >\n <ChevronUpIcon />\n </SelectPrimitive.ScrollUpButton>\n);\n\nconst SelectScrollDownButton: FC<\n ComponentProps<typeof SelectPrimitive.ScrollDownButton>\n> = ({ className, ...props }) => (\n <SelectPrimitive.ScrollDownButton\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className\n )}\n {...props}\n >\n <ChevronDownIcon />\n </SelectPrimitive.ScrollDownButton>\n);\n\nexport const SelectContent: FC<\n ComponentProps<typeof SelectPrimitive.Content>\n> = ({ className, children, position = 'popper', ...props }) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n className={cn(\n 'bg-input-background dark:bg-input-background-dark text-input-text dark:text-input-text-dark w-full select-text resize-none rounded-xl border-2 p-1 text-sm shadow-none outline-0 transition-all',\n '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 relative z-50 max-h-96 min-w-[8rem] overflow-hidden border shadow-md',\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);\n\nexport const SelectLabel: FC<ComponentProps<typeof SelectPrimitive.Label>> = ({\n className,\n ...props\n}) => (\n <SelectPrimitive.Label\n className={cn('px-1 py-0.5 text-sm font-semibold', className)}\n {...props}\n />\n);\n\nconst SelectItem: FC<ComponentProps<typeof SelectPrimitive.Item>> = ({\n className,\n children,\n ...props\n}) => (\n <SelectPrimitive.Item\n className={cn(\n 'focus:bg-neutral/10 dark:focus:bg-neutral-dark/10 relative flex w-full cursor-pointer select-none items-center rounded-lg py-1.5 pl-2 pr-8 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className\n )}\n {...props}\n >\n <span className=\"absolute right-2 flex size-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n);\n\nexport const SelectSeparator: FC<\n ComponentProps<typeof SelectPrimitive.Separator>\n> = ({ className, ...props }) => (\n <SelectPrimitive.Separator\n className={cn('-mx-1 my-1 h-px bg-red-300', className)}\n {...props}\n />\n);\n\ntype SelectType = typeof SelectRoot & {\n Group: typeof SelectGroup;\n Value: typeof SelectValue;\n Trigger: typeof SelectTrigger;\n ScrollUpButton: typeof SelectScrollUpButton;\n ScrollDownButton: typeof SelectScrollDownButton;\n Content: typeof SelectContent;\n Label: typeof SelectLabel;\n Item: typeof SelectItem;\n Separator: typeof SelectSeparator;\n};\n\n/**\n * Usage example:\n * ```jsx\n * <Select>\n * <Select.Trigger>\n * <Select.Value placeholder=\"Theme\" />\n * </Select.Trigger>\n * <Select.Content>\n * <Select.Item value=\"light\">Light</Select.Item>\n * <Select.Item value=\"dark\">Dark</Select.Item>\n * <Select.Item value=\"system\">System</Select.Item>\n * </Select.Content>\n * </Select>\n * ```\n */\nexport const Select = SelectRoot as SelectType;\nSelect.Group = SelectGroup;\nSelect.Value = SelectValue;\nSelect.Trigger = SelectTrigger;\nSelect.ScrollUpButton = SelectScrollUpButton;\nSelect.ScrollDownButton = SelectScrollDownButton;\nSelect.Content = SelectContent;\nSelect.Label = SelectLabel;\nSelect.Item = SelectItem;\nSelect.Separator = SelectSeparator;\n"],"names":["SelectPrimitive","jsxs","cn","jsx","ChevronsUpDown","ChevronUpIcon","ChevronDownIcon","CheckIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAM,aAAaA,2BAAgB;AACnC,MAAM,cAAcA,2BAAgB;AACpC,MAAM,cAAcA,2BAAgB;AAEpC,MAAM,gBAIF,CAAC,EAAE,yBAAyB,OAAO,WAAW,UAAU,GAAG,MAAA,MAC7DC,2BAAA;AAAA,EAACD,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAA;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,0BACE;AAAA,MACF;AAAA,IACF;AAAA,IACC,GAAG;AAAA,IAEH,UAAA;AAAA,MAAA;AAAA,MACDC,2BAAAA,IAACH,2BAAgB,MAAhB,EAAqB,SAAO,MAC3B,UAACG,2BAAAA,IAAAC,YAAAA,gBAAA,EAAe,WAAU,oBAAoB,C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O,sBAAsB,CAAC;IAChD,OAAO,EAAE,OAAO,aAAa,CAAC;IAC9B,KAAK,EAAE,OAAO,WAAW,CAAC;IAC1B,IAAI,EAAE,OAAO,UAAU,CAAC;IACxB,SAAS,EAAE,OAAO,eAAe,CAAC;CACnC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,MAAM,EAAiB,UAAU,CAAC"}
@@ -46,7 +46,6 @@ const SelectScrollDownButton = ({ className, ...props }) => /* @__PURE__ */ jsx(
46
46
  children: /* @__PURE__ */ jsx(ChevronDownIcon, {})
47
47
  }
48
48
  );
49
- SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
50
49
  const SelectContent = ({ className, children, position = "popper", ...props }) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
51
50
  SelectPrimitive.Content,
52
51
  {
@@ -1 +1 @@
1
- {"version":3,"file":"Select.mjs","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["'use client';\n\nimport * as SelectPrimitive from '@radix-ui/react-select';\nimport {\n ChevronsUpDown,\n CheckIcon,\n ChevronDownIcon,\n ChevronUpIcon,\n} from 'lucide-react';\nimport { type FC, type ComponentProps } from 'react';\nimport { cn } from '../../utils/cn';\n\nconst SelectRoot = SelectPrimitive.Root;\nconst SelectGroup = SelectPrimitive.Group;\nconst SelectValue = SelectPrimitive.Value;\n\nconst SelectTrigger: FC<\n ComponentProps<typeof SelectPrimitive.Trigger> & {\n validationStyleEnabled?: boolean;\n }\n> = ({ validationStyleEnabled = false, className, children, ...props }) => (\n <SelectPrimitive.Trigger\n className={cn(\n 'border-input ring-offset-background placeholder:text-muted-foreground focus:ring-ring flex w-full items-center justify-between whitespace-nowrap rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',\n 'bg-input-background dark:bg-input-background-dark text-input-text dark:text-input-text-dark w-full select-text resize-none rounded-xl border-2 px-2 py-1 text-sm shadow-none outline-0 transition-all',\n 'border-input-border dark:border-input-border-dark hover:border-input-border-hover dark:hover:border-input-border-hover-dark focus:border-input-border-focus dark:focus:border-input-border-focus focus:outline-0 focus:[box-shadow:none]',\n 'aria-[invalid=true]:border-error dark:aria-[invalid=true]:border-error-dark',\n validationStyleEnabled &&\n 'valid:border-success dark:valid:border-success-dark invalid:border-error dark:invalid:border-error-dark',\n className\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronsUpDown className=\"size-4 opacity-50\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n);\n\nconst SelectScrollUpButton: FC<\n ComponentProps<typeof SelectPrimitive.ScrollUpButton>\n> = ({ className, ...props }) => (\n <SelectPrimitive.ScrollUpButton\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className\n )}\n {...props}\n >\n <ChevronUpIcon />\n </SelectPrimitive.ScrollUpButton>\n);\n\nconst SelectScrollDownButton: FC<\n ComponentProps<typeof SelectPrimitive.ScrollDownButton>\n> = ({ className, ...props }) => (\n <SelectPrimitive.ScrollDownButton\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className\n )}\n {...props}\n >\n <ChevronDownIcon />\n </SelectPrimitive.ScrollDownButton>\n);\nSelectScrollDownButton.displayName =\n SelectPrimitive.ScrollDownButton.displayName;\n\nexport const SelectContent: FC<\n ComponentProps<typeof SelectPrimitive.Content>\n> = ({ className, children, position = 'popper', ...props }) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n className={cn(\n 'bg-input-background dark:bg-input-background-dark text-input-text dark:text-input-text-dark w-full select-text resize-none rounded-xl border-2 p-1 text-sm shadow-none outline-0 transition-all',\n '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 relative z-50 max-h-96 min-w-[8rem] overflow-hidden border shadow-md',\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);\n\nexport const SelectLabel: FC<ComponentProps<typeof SelectPrimitive.Label>> = ({\n className,\n ...props\n}) => (\n <SelectPrimitive.Label\n className={cn('px-1 py-0.5 text-sm font-semibold', className)}\n {...props}\n />\n);\n\nconst SelectItem: FC<ComponentProps<typeof SelectPrimitive.Item>> = ({\n className,\n children,\n ...props\n}) => (\n <SelectPrimitive.Item\n className={cn(\n 'focus:bg-neutral/10 dark:focus:bg-neutral-dark/10 relative flex w-full cursor-pointer select-none items-center rounded-lg py-1.5 pl-2 pr-8 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className\n )}\n {...props}\n >\n <span className=\"absolute right-2 flex size-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n);\n\nexport const SelectSeparator: FC<\n ComponentProps<typeof SelectPrimitive.Separator>\n> = ({ className, ...props }) => (\n <SelectPrimitive.Separator\n className={cn('-mx-1 my-1 h-px bg-red-300', className)}\n {...props}\n />\n);\n\ntype SelectType = typeof SelectRoot & {\n Group: typeof SelectGroup;\n Value: typeof SelectValue;\n Trigger: typeof SelectTrigger;\n ScrollUpButton: typeof SelectScrollUpButton;\n ScrollDownButton: typeof SelectScrollDownButton;\n Content: typeof SelectContent;\n Label: typeof SelectLabel;\n Item: typeof SelectItem;\n Separator: typeof SelectSeparator;\n};\n\n/**\n * Usage example:\n * ```jsx\n * <Select>\n * <Select.Trigger>\n * <Select.Value placeholder=\"Theme\" />\n * </Select.Trigger>\n * <Select.Content>\n * <Select.Item value=\"light\">Light</Select.Item>\n * <Select.Item value=\"dark\">Dark</Select.Item>\n * <Select.Item value=\"system\">System</Select.Item>\n * </Select.Content>\n * </Select>\n * ```\n */\nexport const Select = SelectRoot as SelectType;\nSelect.Group = SelectGroup;\nSelect.Value = SelectValue;\nSelect.Trigger = SelectTrigger;\nSelect.ScrollUpButton = SelectScrollUpButton;\nSelect.ScrollDownButton = SelectScrollDownButton;\nSelect.Content = SelectContent;\nSelect.Label = SelectLabel;\nSelect.Item = SelectItem;\nSelect.Separator = SelectSeparator;\n"],"names":[],"mappings":";;;;;AAYA,MAAM,aAAa,gBAAgB;AACnC,MAAM,cAAc,gBAAgB;AACpC,MAAM,cAAc,gBAAgB;AAEpC,MAAM,gBAIF,CAAC,EAAE,yBAAyB,OAAO,WAAW,UAAU,GAAG,MAAA,MAC7D;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,0BACE;AAAA,MACF;AAAA,IACF;AAAA,IACC,GAAG;AAAA,IAEH,UAAA;AAAA,MAAA;AAAA,MACD,oBAAC,gBAAgB,MAAhB,EAAqB,SAAO,MAC3B,UAAC,oBAAA,gBAAA,EAAe,WAAU,oBAAoB,CAAA,EAChD,CAAA;AAAA,IAAA;AAAA,EAAA;AACF;AAGF,MAAM,uBAEF,CAAC,EAAE,WAAW,GAAG,MACnB,MAAA;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA,IAEJ,8BA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,gBAAgB,eAAhB,EACC,UAAA,oBAAC,WAAU,EAAA,WAAU,SAAS,CAAA,EAChC,CAAA,GACF;AAAA,MACC,oBAAA,gBAAgB,UAAhB,EAA0B,SAAS,CAAA;AAAA,IAAA;AAAA,EAAA;AACtC;AAGK,MAAM,kBAET,CAAC,EAAE,WAAW,GAAG,MACnB,MAAA;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC,WAAW,GAAG,8BAA8B,SAAS;AAAA,IACpD,GAAG;AAAA,EAAA;AACN;AA8BK,MAAM,SAAS;AACtB,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,iBAAiB;AACxB,OAAO,mBAAmB;AAC1B,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,OAAO,OAAO;AACd,OAAO,YAAY;"}
1
+ {"version":3,"file":"Select.mjs","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["'use client';\n\nimport * as SelectPrimitive from '@radix-ui/react-select';\nimport {\n ChevronsUpDown,\n CheckIcon,\n ChevronDownIcon,\n ChevronUpIcon,\n} from 'lucide-react';\nimport { type FC, type ComponentProps } from 'react';\nimport { cn } from '../../utils/cn';\n\nconst SelectRoot = SelectPrimitive.Root;\nconst SelectGroup = SelectPrimitive.Group;\nconst SelectValue = SelectPrimitive.Value;\n\nconst SelectTrigger: FC<\n ComponentProps<typeof SelectPrimitive.Trigger> & {\n validationStyleEnabled?: boolean;\n }\n> = ({ validationStyleEnabled = false, className, children, ...props }) => (\n <SelectPrimitive.Trigger\n className={cn(\n 'border-input ring-offset-background placeholder:text-muted-foreground focus:ring-ring flex w-full items-center justify-between whitespace-nowrap rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',\n 'bg-input-background dark:bg-input-background-dark text-input-text dark:text-input-text-dark w-full select-text resize-none rounded-xl border-2 px-2 py-1 text-sm shadow-none outline-0 transition-all',\n 'border-input-border dark:border-input-border-dark hover:border-input-border-hover dark:hover:border-input-border-hover-dark focus:border-input-border-focus dark:focus:border-input-border-focus focus:outline-0 focus:[box-shadow:none]',\n 'aria-[invalid=true]:border-error dark:aria-[invalid=true]:border-error-dark',\n validationStyleEnabled &&\n 'valid:border-success dark:valid:border-success-dark invalid:border-error dark:invalid:border-error-dark',\n className\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronsUpDown className=\"size-4 opacity-50\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n);\n\nconst SelectScrollUpButton: FC<\n ComponentProps<typeof SelectPrimitive.ScrollUpButton>\n> = ({ className, ...props }) => (\n <SelectPrimitive.ScrollUpButton\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className\n )}\n {...props}\n >\n <ChevronUpIcon />\n </SelectPrimitive.ScrollUpButton>\n);\n\nconst SelectScrollDownButton: FC<\n ComponentProps<typeof SelectPrimitive.ScrollDownButton>\n> = ({ className, ...props }) => (\n <SelectPrimitive.ScrollDownButton\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className\n )}\n {...props}\n >\n <ChevronDownIcon />\n </SelectPrimitive.ScrollDownButton>\n);\n\nexport const SelectContent: FC<\n ComponentProps<typeof SelectPrimitive.Content>\n> = ({ className, children, position = 'popper', ...props }) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n className={cn(\n 'bg-input-background dark:bg-input-background-dark text-input-text dark:text-input-text-dark w-full select-text resize-none rounded-xl border-2 p-1 text-sm shadow-none outline-0 transition-all',\n '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 relative z-50 max-h-96 min-w-[8rem] overflow-hidden border shadow-md',\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);\n\nexport const SelectLabel: FC<ComponentProps<typeof SelectPrimitive.Label>> = ({\n className,\n ...props\n}) => (\n <SelectPrimitive.Label\n className={cn('px-1 py-0.5 text-sm font-semibold', className)}\n {...props}\n />\n);\n\nconst SelectItem: FC<ComponentProps<typeof SelectPrimitive.Item>> = ({\n className,\n children,\n ...props\n}) => (\n <SelectPrimitive.Item\n className={cn(\n 'focus:bg-neutral/10 dark:focus:bg-neutral-dark/10 relative flex w-full cursor-pointer select-none items-center rounded-lg py-1.5 pl-2 pr-8 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className\n )}\n {...props}\n >\n <span className=\"absolute right-2 flex size-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n);\n\nexport const SelectSeparator: FC<\n ComponentProps<typeof SelectPrimitive.Separator>\n> = ({ className, ...props }) => (\n <SelectPrimitive.Separator\n className={cn('-mx-1 my-1 h-px bg-red-300', className)}\n {...props}\n />\n);\n\ntype SelectType = typeof SelectRoot & {\n Group: typeof SelectGroup;\n Value: typeof SelectValue;\n Trigger: typeof SelectTrigger;\n ScrollUpButton: typeof SelectScrollUpButton;\n ScrollDownButton: typeof SelectScrollDownButton;\n Content: typeof SelectContent;\n Label: typeof SelectLabel;\n Item: typeof SelectItem;\n Separator: typeof SelectSeparator;\n};\n\n/**\n * Usage example:\n * ```jsx\n * <Select>\n * <Select.Trigger>\n * <Select.Value placeholder=\"Theme\" />\n * </Select.Trigger>\n * <Select.Content>\n * <Select.Item value=\"light\">Light</Select.Item>\n * <Select.Item value=\"dark\">Dark</Select.Item>\n * <Select.Item value=\"system\">System</Select.Item>\n * </Select.Content>\n * </Select>\n * ```\n */\nexport const Select = SelectRoot as SelectType;\nSelect.Group = SelectGroup;\nSelect.Value = SelectValue;\nSelect.Trigger = SelectTrigger;\nSelect.ScrollUpButton = SelectScrollUpButton;\nSelect.ScrollDownButton = SelectScrollDownButton;\nSelect.Content = SelectContent;\nSelect.Label = SelectLabel;\nSelect.Item = SelectItem;\nSelect.Separator = SelectSeparator;\n"],"names":[],"mappings":";;;;;AAYA,MAAM,aAAa,gBAAgB;AACnC,MAAM,cAAc,gBAAgB;AACpC,MAAM,cAAc,gBAAgB;AAEpC,MAAM,gBAIF,CAAC,EAAE,yBAAyB,OAAO,WAAW,UAAU,GAAG,MAAA,MAC7D;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,0BACE;AAAA,MACF;AAAA,IACF;AAAA,IACC,GAAG;AAAA,IAEH,UAAA;AAAA,MAAA;AAAA,MACD,oBAAC,gBAAgB,MAAhB,EAAqB,SAAO,MAC3B,UAAC,oBAAA,gBAAA,EAAe,WAAU,oBAAoB,CAAA,EAChD,CAAA;AAAA,IAAA;AAAA,EAAA;AACF;AAGF,MAAM,uBAEF,CAAC,EAAE,WAAW,GAAG,MACnB,MAAA;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA,IAEJ,8BAAC,eAAc,CAAA,CAAA;AAAA,EAAA;AACjB;AAGF,MAAM,yBAEF,CAAC,EAAE,WAAW,GAAG,MACnB,MAAA;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;AAAA,IAAA;AAAA,EAAA;AACtC;AAGK,MAAM,kBAET,CAAC,EAAE,WAAW,GAAG,MACnB,MAAA;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC,WAAW,GAAG,8BAA8B,SAAS;AAAA,IACpD,GAAG;AAAA,EAAA;AACN;AA8BK,MAAM,SAAS;AACtB,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,iBAAiB;AACxB,OAAO,mBAAmB;AAC1B,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,OAAO,OAAO;AACd,OAAO,YAAY;"}
@@ -7,7 +7,6 @@ const components_RightDrawer_useRightDrawerStore = require("./RightDrawer/useRig
7
7
  const components_PressableSpan_PressableSpan = require("./PressableSpan/PressableSpan.cjs");
8
8
  const components_ContentSelector_ContentSelector = require("./ContentSelector/ContentSelector.cjs");
9
9
  const components_DictionaryEditor_DictionaryEditor = require("./DictionaryEditor/DictionaryEditor.cjs");
10
- const components_DictionaryFieldEditor_DictionariesSelector_DictionariesSelector = require("./DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs");
11
10
  const components_DictionaryFieldEditor_DictionaryCreationForm_DictionaryCreationForm = require("./DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs");
12
11
  const components_DictionaryFieldEditor_DictionaryFieldEditor = require("./DictionaryFieldEditor/DictionaryFieldEditor.cjs");
13
12
  const components_DictionaryFieldEditor_VersionSwitcherDropDown_VersionSwitcher = require("./DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.cjs");
@@ -79,6 +78,7 @@ const components_LocaleSwitcherDropDown_LocaleSwitcher = require("./LocaleSwitch
79
78
  const components_LocaleSwitcherContentDropDown_LocaleSwitcherContent = require("./LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs");
80
79
  const components_LocaleSwitcherContentDropDown_LocaleSwitcherContentContext = require("./LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs");
81
80
  const components_ClickOutsideDiv_index = require("./ClickOutsideDiv/index.cjs");
81
+ const components_KeyboardScreenAdapter_index = require("./KeyboardScreenAdapter/index.cjs");
82
82
  exports.MaxHeightSmoother = components_MaxHeightSmoother_index.MaxHeightSmoother;
83
83
  exports.MaxWidthSmoother = components_MaxWidthSmoother_index.MaxWidthSmoother;
84
84
  exports.RightDrawer = components_RightDrawer_RightDrawer.RightDrawer;
@@ -86,7 +86,6 @@ exports.useRightDrawerStore = components_RightDrawer_useRightDrawerStore.useRigh
86
86
  exports.PressableSpan = components_PressableSpan_PressableSpan.PressableSpan;
87
87
  exports.ContentSelector = components_ContentSelector_ContentSelector.ContentSelector;
88
88
  exports.DictionaryEditor = components_DictionaryEditor_DictionaryEditor.DictionaryEditor;
89
- exports.DictionariesSelector = components_DictionaryFieldEditor_DictionariesSelector_DictionariesSelector.DictionariesSelector;
90
89
  exports.DictionaryCreationForm = components_DictionaryFieldEditor_DictionaryCreationForm_DictionaryCreationForm.DictionaryCreationForm;
91
90
  exports.DictionaryFieldEditor = components_DictionaryFieldEditor_DictionaryFieldEditor.DictionaryFieldEditor;
92
91
  exports.VersionSwitcher = components_DictionaryFieldEditor_VersionSwitcherDropDown_VersionSwitcher.VersionSwitcher;
@@ -183,4 +182,5 @@ exports.LocaleSwitcherContent = components_LocaleSwitcherContentDropDown_LocaleS
183
182
  exports.LocaleSwitcherContentProvider = components_LocaleSwitcherContentDropDown_LocaleSwitcherContentContext.LocaleSwitcherContentProvider;
184
183
  exports.useLocaleSwitcherContent = components_LocaleSwitcherContentDropDown_LocaleSwitcherContentContext.useLocaleSwitcherContent;
185
184
  exports.ClickOutsideDiv = components_ClickOutsideDiv_index.ClickOutsideDiv;
185
+ exports.KeyboardScreenAdapter = components_KeyboardScreenAdapter_index.KeyboardScreenAdapter;
186
186
  //# sourceMappingURL=index.cjs.map
@@ -43,4 +43,5 @@ export * from './Accordion';
43
43
  export * from './LocaleSwitcherDropDown';
44
44
  export * from './LocaleSwitcherContentDropDown';
45
45
  export * from './ClickOutsideDiv';
46
+ export * from './KeyboardScreenAdapter';
46
47
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,c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ACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC"}
@@ -5,7 +5,6 @@ import { useRightDrawerStore } from "./RightDrawer/useRightDrawerStore.mjs";
5
5
  import { PressableSpan } from "./PressableSpan/PressableSpan.mjs";
6
6
  import { ContentSelector } from "./ContentSelector/ContentSelector.mjs";
7
7
  import { DictionaryEditor } from "./DictionaryEditor/DictionaryEditor.mjs";
8
- import { DictionariesSelector } from "./DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs";
9
8
  import { DictionaryCreationForm } from "./DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs";
10
9
  import { DictionaryFieldEditor } from "./DictionaryFieldEditor/DictionaryFieldEditor.mjs";
11
10
  import { VersionSwitcher } from "./DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.mjs";
@@ -77,6 +76,7 @@ import { LocaleSwitcher } from "./LocaleSwitcherDropDown/LocaleSwitcher.mjs";
77
76
  import { LocaleSwitcherContent } from "./LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs";
78
77
  import { LocaleSwitcherContentProvider, useLocaleSwitcherContent } from "./LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs";
79
78
  import { ClickOutsideDiv } from "./ClickOutsideDiv/index.mjs";
79
+ import { KeyboardScreenAdapter } from "./KeyboardScreenAdapter/index.mjs";
80
80
  export {
81
81
  Accordion,
82
82
  AuthModal,
@@ -96,7 +96,6 @@ export {
96
96
  ContentSelector,
97
97
  CopyToClipboard,
98
98
  DesktopThemeSwitcher,
99
- DictionariesSelector,
100
99
  DictionaryCreationForm,
101
100
  DictionaryEditor,
102
101
  DictionaryFieldEditor,
@@ -121,6 +120,7 @@ export {
121
120
  InformationTag,
122
121
  Input,
123
122
  InputPassword,
123
+ KeyboardScreenAdapter,
124
124
  Label,
125
125
  Link,
126
126
  Loader,
@@ -12,6 +12,7 @@ const hooks_useItemSelector = require("./useItemSelector.cjs");
12
12
  const hooks_useGetAllDictionaries = require("./useGetAllDictionaries.cjs");
13
13
  const hooks_usePersistedStore = require("./usePersistedStore.cjs");
14
14
  const hooks_useIsDarkMode = require("./useIsDarkMode.cjs");
15
+ const hooks_useKeyboardDetector = require("./useKeyboardDetector.cjs");
15
16
  exports.useDevice = hooks_useDevice.useDevice;
16
17
  exports.useGetElementOrWindow = hooks_useGetElementOrWindow.useGetElementOrWindow;
17
18
  exports.useScrollBlockage = hooks_useScrollBlockage_index.useScrollBlockage;
@@ -74,4 +75,5 @@ exports.useItemSelector = hooks_useItemSelector.useItemSelector;
74
75
  exports.useGetAllDictionaries = hooks_useGetAllDictionaries.useGetAllDictionaries;
75
76
  exports.usePersistedStore = hooks_usePersistedStore.usePersistedStore;
76
77
  exports.useIsDarkMode = hooks_useIsDarkMode.useIsDarkMode;
78
+ exports.useKeyboardDetector = hooks_useKeyboardDetector.useKeyboardDetector;
77
79
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -9,4 +9,5 @@ export * from './useItemSelector';
9
9
  export * from './useGetAllDictionaries';
10
10
  export * from './usePersistedStore';
11
11
  export * from './useIsDarkMode';
12
+ export * from './useKeyboardDetector';
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC"}
@@ -10,6 +10,7 @@ import { useItemSelector } from "./useItemSelector.mjs";
10
10
  import { useGetAllDictionaries } from "./useGetAllDictionaries.mjs";
11
11
  import { usePersistedStore } from "./usePersistedStore.mjs";
12
12
  import { useIsDarkMode } from "./useIsDarkMode.mjs";
13
+ import { useKeyboardDetector } from "./useKeyboardDetector.mjs";
13
14
  export {
14
15
  AsyncStateProvider,
15
16
  useAddDictionary,
@@ -51,6 +52,7 @@ export {
51
52
  useIsDarkMode,
52
53
  useIsMounted,
53
54
  useItemSelector,
55
+ useKeyboardDetector,
54
56
  useLogin,
55
57
  useLogout,
56
58
  usePersistedStore,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
@@ -14,14 +14,6 @@ const createDefaultStates = () => ({
14
14
  errorCount: 0,
15
15
  isEnabled: true
16
16
  });
17
- const ensureArray = (value) => {
18
- if (!value) {
19
- return [];
20
- } else if (Array.isArray(value)) {
21
- return value;
22
- }
23
- return [value];
24
- };
25
17
  const getMatchKeys = (selectorsKeys, keysWithArgs) => keysWithArgs.filter((key) => selectorsKeys.includes(key.split("/")[0]));
26
18
  const reducer = (state, action) => {
27
19
  switch (action.type) {
@@ -61,10 +53,12 @@ const reducer = (state, action) => {
61
53
  }
62
54
  case "SET_QUERIES_STATE": {
63
55
  const { keys, value } = action;
64
- const keyArray = ensureArray(keys);
65
- if (keyArray.length === 0) return state;
66
- const updatedStates = { ...state.states };
67
- keyArray.forEach((key) => {
56
+ const keyArray = [keys].flat();
57
+ const allKeys = Object.keys(state.states);
58
+ const matchedKeys = getMatchKeys(keyArray, allKeys);
59
+ if (matchedKeys.length === 0) return state;
60
+ const updatedStates = structuredClone(state.states);
61
+ matchedKeys.forEach((key) => {
68
62
  updatedStates[key] = {
69
63
  ...state.states[key] ?? createDefaultStates(),
70
64
  ...value
@@ -77,7 +71,7 @@ const reducer = (state, action) => {
77
71
  }
78
72
  case "RESET_KEY_STATE": {
79
73
  const { keys } = action;
80
- const keyArray = ensureArray(keys);
74
+ const keyArray = [keys].flat();
81
75
  if (keyArray.length === 0) return state;
82
76
  const allKeys = Object.keys(state.states);
83
77
  const matchedKeys = getMatchKeys(keyArray, allKeys);
@@ -92,7 +86,7 @@ const reducer = (state, action) => {
92
86
  };
93
87
  }
94
88
  case "RESET_STATE": {
95
- const excludeArray = ensureArray(action.excludeKeys);
89
+ const excludeArray = [action.excludeKeys].flat();
96
90
  const allKeys = Object.keys(state.states);
97
91
  const matchedKeys = getMatchKeys(excludeArray, allKeys);
98
92
  const newStates = {};