@intlayer/design-system 3.4.9 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (343) hide show
  1. package/dist/.vite/manifest.json +0 -1
  2. package/dist/Form-BDcoNTLV.cjs.map +1 -1
  3. package/dist/Form-DhsgC7kB.js.map +1 -1
  4. package/dist/components/Accordion/Accordion.cjs.map +1 -1
  5. package/dist/components/Accordion/Accordion.mjs.map +1 -1
  6. package/dist/components/Auth/AuthModal/index.cjs.map +1 -1
  7. package/dist/components/Auth/AuthModal/index.mjs.map +1 -1
  8. package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierClient.cjs.map +1 -1
  9. package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierClient.mjs.map +1 -1
  10. package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierServer.cjs.map +1 -1
  11. package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierServer.mjs.map +1 -1
  12. package/dist/components/Auth/AuthenticationBarrier/accessValidation.cjs.map +1 -1
  13. package/dist/components/Auth/AuthenticationBarrier/accessValidation.mjs.map +1 -1
  14. package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.cjs.map +1 -1
  15. package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.mjs.map +1 -1
  16. package/dist/components/Auth/ChangePasswordForm/ChangePasswordSchema.cjs.map +1 -1
  17. package/dist/components/Auth/ChangePasswordForm/ChangePasswordSchema.mjs.map +1 -1
  18. package/dist/components/Auth/ChangePasswordForm/index.content.cjs.map +1 -1
  19. package/dist/components/Auth/ChangePasswordForm/index.content.mjs.map +1 -1
  20. package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs.map +1 -1
  21. package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs.map +1 -1
  22. package/dist/components/Auth/ExternalsLoginButtons/assets/GoogleLogo.cjs.map +1 -1
  23. package/dist/components/Auth/ExternalsLoginButtons/assets/GoogleLogo.mjs.map +1 -1
  24. package/dist/components/Auth/ExternalsLoginButtons/externalsLoginButtons.content.cjs.map +1 -1
  25. package/dist/components/Auth/ExternalsLoginButtons/externalsLoginButtons.content.mjs.map +1 -1
  26. package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.cjs.map +1 -1
  27. package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.mjs.map +1 -1
  28. package/dist/components/Auth/ResetPasswordForm/ResetPasswordSchema.cjs.map +1 -1
  29. package/dist/components/Auth/ResetPasswordForm/ResetPasswordSchema.mjs.map +1 -1
  30. package/dist/components/Auth/ResetPasswordForm/index.content.cjs.map +1 -1
  31. package/dist/components/Auth/ResetPasswordForm/index.content.mjs.map +1 -1
  32. package/dist/components/Auth/SignInForm/SignInForm.cjs.map +1 -1
  33. package/dist/components/Auth/SignInForm/SignInForm.mjs.map +1 -1
  34. package/dist/components/Auth/SignInForm/SignInSchema.cjs.map +1 -1
  35. package/dist/components/Auth/SignInForm/SignInSchema.mjs.map +1 -1
  36. package/dist/components/Auth/SignInForm/index.content.cjs.map +1 -1
  37. package/dist/components/Auth/SignInForm/index.content.mjs.map +1 -1
  38. package/dist/components/Auth/SignUpForm/SignUpForm.cjs.map +1 -1
  39. package/dist/components/Auth/SignUpForm/SignUpForm.mjs.map +1 -1
  40. package/dist/components/Auth/SignUpForm/SignUpSchema.cjs.map +1 -1
  41. package/dist/components/Auth/SignUpForm/SignUpSchema.mjs.map +1 -1
  42. package/dist/components/Auth/SignUpForm/index.content.cjs.map +1 -1
  43. package/dist/components/Auth/SignUpForm/index.content.mjs.map +1 -1
  44. package/dist/components/Auth/useAuth/index.cjs.map +1 -1
  45. package/dist/components/Auth/useAuth/index.mjs.map +1 -1
  46. package/dist/components/Auth/useAuth/useCSRF.cjs.map +1 -1
  47. package/dist/components/Auth/useAuth/useCSRF.mjs.map +1 -1
  48. package/dist/components/Auth/useAuth/useOAuth2.cjs.map +1 -1
  49. package/dist/components/Auth/useAuth/useOAuth2.mjs.map +1 -1
  50. package/dist/components/Auth/useAuth/useSession.cjs.map +1 -1
  51. package/dist/components/Auth/useAuth/useSession.mjs.map +1 -1
  52. package/dist/components/Auth/useUser/index.cjs.map +1 -1
  53. package/dist/components/Auth/useUser/index.mjs.map +1 -1
  54. package/dist/components/Avatar/index.cjs.map +1 -1
  55. package/dist/components/Avatar/index.mjs.map +1 -1
  56. package/dist/components/Badge/index.cjs.map +1 -1
  57. package/dist/components/Badge/index.mjs.map +1 -1
  58. package/dist/components/Breadcrumb/index.cjs.map +1 -1
  59. package/dist/components/Breadcrumb/index.mjs.map +1 -1
  60. package/dist/components/Button/Button.cjs.map +1 -1
  61. package/dist/components/Button/Button.mjs.map +1 -1
  62. package/dist/components/Command/index.cjs.map +1 -1
  63. package/dist/components/Command/index.mjs.map +1 -1
  64. package/dist/components/Container/index.cjs.map +1 -1
  65. package/dist/components/Container/index.mjs.map +1 -1
  66. package/dist/components/ContentEditor/ContentEditor.cjs.map +1 -1
  67. package/dist/components/ContentEditor/ContentEditor.mjs.map +1 -1
  68. package/dist/components/ContentEditor/ContentEditorTextArea.cjs.map +1 -1
  69. package/dist/components/ContentEditor/ContentEditorTextArea.mjs.map +1 -1
  70. package/dist/components/CopyToClipboard/index.cjs.map +1 -1
  71. package/dist/components/CopyToClipboard/index.mjs.map +1 -1
  72. package/dist/components/DictionaryEditor/DictionaryEditor.cjs.map +1 -1
  73. package/dist/components/DictionaryEditor/DictionaryEditor.mjs.map +1 -1
  74. package/dist/components/DictionaryEditor/ItemLayout.cjs.map +1 -1
  75. package/dist/components/DictionaryEditor/ItemLayout.mjs.map +1 -1
  76. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.cjs.map +1 -1
  77. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.mjs.map +1 -1
  78. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs.map +1 -1
  79. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs.map +1 -1
  80. package/dist/components/DictionaryEditor/useEditedContentStore.cjs.map +1 -1
  81. package/dist/components/DictionaryEditor/useEditedContentStore.mjs.map +1 -1
  82. package/dist/components/DictionaryEditor/useEditionPanelStore.cjs.map +1 -1
  83. package/dist/components/DictionaryEditor/useEditionPanelStore.mjs.map +1 -1
  84. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.cjs.map +1 -1
  85. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.mjs.map +1 -1
  86. package/dist/components/DictionaryEditor/validDictionaryChangeButtonsSchema.cjs.map +1 -1
  87. package/dist/components/DictionaryEditor/validDictionaryChangeButtonsSchema.mjs.map +1 -1
  88. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map +1 -1
  89. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs.map +1 -1
  90. package/dist/components/DictionaryFieldEditor/DictionariesSelector/dictionariesSelector.content.cjs.map +1 -1
  91. package/dist/components/DictionaryFieldEditor/DictionariesSelector/dictionariesSelector.content.mjs.map +1 -1
  92. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map +1 -1
  93. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
  94. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.cjs.map +1 -1
  95. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs.map +1 -1
  96. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryFormSchema.cjs.map +1 -1
  97. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryFormSchema.mjs.map +1 -1
  98. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
  99. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
  100. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsSchema.cjs.map +1 -1
  101. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsSchema.mjs.map +1 -1
  102. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs.map +1 -1
  103. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs.map +1 -1
  104. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
  105. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
  106. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs.map +1 -1
  107. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs.map +1 -1
  108. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs.map +1 -1
  109. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs.map +1 -1
  110. package/dist/components/DictionaryFieldEditor/EnumKeyInput.cjs.map +1 -1
  111. package/dist/components/DictionaryFieldEditor/EnumKeyInput.mjs.map +1 -1
  112. package/dist/components/DictionaryFieldEditor/JSONEditor.cjs.map +1 -1
  113. package/dist/components/DictionaryFieldEditor/JSONEditor.mjs.map +1 -1
  114. package/dist/components/DictionaryFieldEditor/KeyPathBreadcrumb.cjs.map +1 -1
  115. package/dist/components/DictionaryFieldEditor/KeyPathBreadcrumb.mjs.map +1 -1
  116. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
  117. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
  118. package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.cjs.map +1 -1
  119. package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.mjs.map +1 -1
  120. package/dist/components/DictionaryFieldEditor/NodeEditor.cjs.map +1 -1
  121. package/dist/components/DictionaryFieldEditor/NodeEditor.mjs.map +1 -1
  122. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs.map +1 -1
  123. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs.map +1 -1
  124. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
  125. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
  126. package/dist/components/DictionaryFieldEditor/SaveForm/SaveFormSchema.cjs.map +1 -1
  127. package/dist/components/DictionaryFieldEditor/SaveForm/SaveFormSchema.mjs.map +1 -1
  128. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs.map +1 -1
  129. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs.map +1 -1
  130. package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.cjs.map +1 -1
  131. package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.mjs.map +1 -1
  132. package/dist/components/DictionaryFieldEditor/editorView.content.cjs.map +1 -1
  133. package/dist/components/DictionaryFieldEditor/editorView.content.mjs.map +1 -1
  134. package/dist/components/DictionaryFieldEditor/getIsEditableSection.cjs.map +1 -1
  135. package/dist/components/DictionaryFieldEditor/getIsEditableSection.mjs.map +1 -1
  136. package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.cjs.map +1 -1
  137. package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.mjs.map +1 -1
  138. package/dist/components/DropDown/index.cjs.map +1 -1
  139. package/dist/components/DropDown/index.mjs.map +1 -1
  140. package/dist/components/EditableField/EditableFieldInput.cjs.map +1 -1
  141. package/dist/components/EditableField/EditableFieldInput.mjs.map +1 -1
  142. package/dist/components/EditableField/EditableFieldLayout.cjs.map +1 -1
  143. package/dist/components/EditableField/EditableFieldLayout.mjs.map +1 -1
  144. package/dist/components/EditableField/EditableFieldTextArea.cjs.map +1 -1
  145. package/dist/components/EditableField/EditableFieldTextArea.mjs.map +1 -1
  146. package/dist/components/Footer/index.cjs.map +1 -1
  147. package/dist/components/Footer/index.mjs.map +1 -1
  148. package/dist/components/Form/FormBase.cjs.map +1 -1
  149. package/dist/components/Form/FormBase.mjs.map +1 -1
  150. package/dist/components/Form/FormControl.cjs.map +1 -1
  151. package/dist/components/Form/FormControl.mjs.map +1 -1
  152. package/dist/components/Form/FormDescription.cjs.map +1 -1
  153. package/dist/components/Form/FormDescription.mjs.map +1 -1
  154. package/dist/components/Form/FormField.cjs.map +1 -1
  155. package/dist/components/Form/FormField.mjs.map +1 -1
  156. package/dist/components/Form/FormItem.cjs.map +1 -1
  157. package/dist/components/Form/FormItem.mjs.map +1 -1
  158. package/dist/components/Form/FormLabel.cjs.map +1 -1
  159. package/dist/components/Form/FormLabel.mjs.map +1 -1
  160. package/dist/components/Form/FormMessage.cjs.map +1 -1
  161. package/dist/components/Form/FormMessage.mjs.map +1 -1
  162. package/dist/components/Form/elements/FormElementWrapper.cjs.map +1 -1
  163. package/dist/components/Form/elements/FormElementWrapper.mjs.map +1 -1
  164. package/dist/components/Form/layout/FormLabelLayout.cjs.map +1 -1
  165. package/dist/components/Form/layout/FormLabelLayout.mjs.map +1 -1
  166. package/dist/components/Headers/SectionScroller.cjs.map +1 -1
  167. package/dist/components/Headers/SectionScroller.mjs.map +1 -1
  168. package/dist/components/Headers/index.cjs.map +1 -1
  169. package/dist/components/Headers/index.mjs.map +1 -1
  170. package/dist/components/IDE/CodeRender.cjs +9 -3
  171. package/dist/components/IDE/CodeRender.cjs.map +1 -1
  172. package/dist/components/IDE/CodeRender.d.ts.map +1 -1
  173. package/dist/components/IDE/CodeRender.mjs +9 -3
  174. package/dist/components/IDE/CodeRender.mjs.map +1 -1
  175. package/dist/components/IDE/FileList.cjs.map +1 -1
  176. package/dist/components/IDE/FileList.mjs.map +1 -1
  177. package/dist/components/IDE/FileTree.cjs.map +1 -1
  178. package/dist/components/IDE/FileTree.mjs.map +1 -1
  179. package/dist/components/IDE/IDE.cjs +1 -1
  180. package/dist/components/IDE/IDE.cjs.map +1 -1
  181. package/dist/components/IDE/IDE.mjs +1 -1
  182. package/dist/components/IDE/IDE.mjs.map +1 -1
  183. package/dist/components/IDE/MarkDownRender.cjs.map +1 -1
  184. package/dist/components/IDE/MarkDownRender.mjs.map +1 -1
  185. package/dist/components/IDE/createFileTree.cjs.map +1 -1
  186. package/dist/components/IDE/createFileTree.mjs.map +1 -1
  187. package/dist/components/Input/Checkbox.cjs.map +1 -1
  188. package/dist/components/Input/Checkbox.mjs.map +1 -1
  189. package/dist/components/Input/Input.cjs.map +1 -1
  190. package/dist/components/Input/Input.mjs.map +1 -1
  191. package/dist/components/Input/InputPassword.cjs.map +1 -1
  192. package/dist/components/Input/InputPassword.mjs.map +1 -1
  193. package/dist/components/Link/Link.cjs.map +1 -1
  194. package/dist/components/Link/Link.mjs.map +1 -1
  195. package/dist/components/Loader/spinner.cjs.map +1 -1
  196. package/dist/components/Loader/spinner.mjs.map +1 -1
  197. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.cjs.map +1 -1
  198. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs.map +1 -1
  199. package/dist/components/Logo/LogoCircle.cjs.map +1 -1
  200. package/dist/components/Logo/LogoCircle.mjs.map +1 -1
  201. package/dist/components/Logo/LogoNoFrame.cjs.map +1 -1
  202. package/dist/components/Logo/LogoNoFrame.mjs.map +1 -1
  203. package/dist/components/Logo/LogoSquare.cjs.map +1 -1
  204. package/dist/components/Logo/LogoSquare.mjs.map +1 -1
  205. package/dist/components/Logo/LogoSquircle.cjs.map +1 -1
  206. package/dist/components/Logo/LogoSquircle.mjs.map +1 -1
  207. package/dist/components/Logo/LogoTextOnly.cjs.map +1 -1
  208. package/dist/components/Logo/LogoTextOnly.mjs.map +1 -1
  209. package/dist/components/Logo/LogoWithTextBelowCircle.cjs.map +1 -1
  210. package/dist/components/Logo/LogoWithTextBelowCircle.mjs.map +1 -1
  211. package/dist/components/Logo/LogoWithTextBelowNoFrame.cjs.map +1 -1
  212. package/dist/components/Logo/LogoWithTextBelowNoFrame.mjs.map +1 -1
  213. package/dist/components/Logo/LogoWithTextBelowSquircle.cjs.map +1 -1
  214. package/dist/components/Logo/LogoWithTextBelowSquircle.mjs.map +1 -1
  215. package/dist/components/Logo/LogoWithTextCircle.cjs.map +1 -1
  216. package/dist/components/Logo/LogoWithTextCircle.mjs.map +1 -1
  217. package/dist/components/Logo/LogoWithTextNoFrame.cjs.map +1 -1
  218. package/dist/components/Logo/LogoWithTextNoFrame.mjs.map +1 -1
  219. package/dist/components/Logo/LogoWithTextSquircle.cjs.map +1 -1
  220. package/dist/components/Logo/LogoWithTextSquircle.mjs.map +1 -1
  221. package/dist/components/Logo/index.cjs.map +1 -1
  222. package/dist/components/Logo/index.mjs.map +1 -1
  223. package/dist/components/MarkDownRender/index.cjs.map +1 -1
  224. package/dist/components/MarkDownRender/index.mjs.map +1 -1
  225. package/dist/components/MaxHeightSmoother/index.cjs.map +1 -1
  226. package/dist/components/MaxHeightSmoother/index.mjs.map +1 -1
  227. package/dist/components/MaxWidthSmoother/index.cjs.map +1 -1
  228. package/dist/components/MaxWidthSmoother/index.mjs.map +1 -1
  229. package/dist/components/Modal/Modal.cjs.map +1 -1
  230. package/dist/components/Modal/Modal.mjs.map +1 -1
  231. package/dist/components/Navbar/Burger.cjs.map +1 -1
  232. package/dist/components/Navbar/Burger.mjs.map +1 -1
  233. package/dist/components/Navbar/DesktopNavbar.cjs.map +1 -1
  234. package/dist/components/Navbar/DesktopNavbar.mjs.map +1 -1
  235. package/dist/components/Navbar/MobileNavbar.cjs.map +1 -1
  236. package/dist/components/Navbar/MobileNavbar.mjs.map +1 -1
  237. package/dist/components/Navbar/index.cjs.map +1 -1
  238. package/dist/components/Navbar/index.mjs.map +1 -1
  239. package/dist/components/Navbar/useNavigation.cjs.map +1 -1
  240. package/dist/components/Navbar/useNavigation.mjs.map +1 -1
  241. package/dist/components/Pattern/DotPattern.cjs.map +1 -1
  242. package/dist/components/Pattern/DotPattern.mjs.map +1 -1
  243. package/dist/components/Pattern/GridPattern.cjs.map +1 -1
  244. package/dist/components/Pattern/GridPattern.mjs.map +1 -1
  245. package/dist/components/Pattern/SpotLight.cjs.map +1 -1
  246. package/dist/components/Pattern/SpotLight.mjs.map +1 -1
  247. package/dist/components/Popover/index.cjs.map +1 -1
  248. package/dist/components/Popover/index.mjs.map +1 -1
  249. package/dist/components/PressableSpan/PressableSpan.cjs.map +1 -1
  250. package/dist/components/PressableSpan/PressableSpan.mjs.map +1 -1
  251. package/dist/components/ProfileDropDown/index.cjs.map +1 -1
  252. package/dist/components/ProfileDropDown/index.mjs.map +1 -1
  253. package/dist/components/RightDrawer/RightDrawer.cjs.map +1 -1
  254. package/dist/components/RightDrawer/RightDrawer.mjs.map +1 -1
  255. package/dist/components/RightDrawer/useRightDrawerStore.cjs.map +1 -1
  256. package/dist/components/RightDrawer/useRightDrawerStore.mjs.map +1 -1
  257. package/dist/components/Select/Multiselect.cjs.map +1 -1
  258. package/dist/components/Select/Multiselect.mjs.map +1 -1
  259. package/dist/components/Select/Select.cjs.map +1 -1
  260. package/dist/components/Select/Select.mjs.map +1 -1
  261. package/dist/components/SwitchSelector/index.cjs.map +1 -1
  262. package/dist/components/SwitchSelector/index.mjs.map +1 -1
  263. package/dist/components/TabSelector/TabSelector.cjs.map +1 -1
  264. package/dist/components/TabSelector/TabSelector.mjs.map +1 -1
  265. package/dist/components/Tag/index.cjs.map +1 -1
  266. package/dist/components/Tag/index.mjs.map +1 -1
  267. package/dist/components/TextArea/AutoSizeTextArea.cjs.map +1 -1
  268. package/dist/components/TextArea/AutoSizeTextArea.mjs.map +1 -1
  269. package/dist/components/TextArea/TextArea.cjs.map +1 -1
  270. package/dist/components/TextArea/TextArea.mjs.map +1 -1
  271. package/dist/components/ThemeSwitcherDropDown/DesktopThemeSwitcher.cjs.map +1 -1
  272. package/dist/components/ThemeSwitcherDropDown/DesktopThemeSwitcher.mjs.map +1 -1
  273. package/dist/components/ThemeSwitcherDropDown/MobileThemeSwitcher.cjs.map +1 -1
  274. package/dist/components/ThemeSwitcherDropDown/MobileThemeSwitcher.mjs.map +1 -1
  275. package/dist/components/Toaster/Toast.cjs.map +1 -1
  276. package/dist/components/Toaster/Toast.mjs.map +1 -1
  277. package/dist/components/Toaster/Toaster.cjs.map +1 -1
  278. package/dist/components/Toaster/Toaster.mjs.map +1 -1
  279. package/dist/components/Toaster/useToast.cjs.map +1 -1
  280. package/dist/components/Toaster/useToast.mjs.map +1 -1
  281. package/dist/components/WithResizer/index.cjs.map +1 -1
  282. package/dist/components/WithResizer/index.mjs.map +1 -1
  283. package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
  284. package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
  285. package/dist/hooks/useAsync/useAsync.cjs.map +1 -1
  286. package/dist/hooks/useAsync/useAsync.mjs.map +1 -1
  287. package/dist/hooks/useAsync/useAsyncStateStore.cjs.map +1 -1
  288. package/dist/hooks/useAsync/useAsyncStateStore.mjs.map +1 -1
  289. package/dist/hooks/useDevice.cjs.map +1 -1
  290. package/dist/hooks/useDevice.mjs.map +1 -1
  291. package/dist/hooks/useGetAllDictionaries.cjs.map +1 -1
  292. package/dist/hooks/useGetAllDictionaries.mjs.map +1 -1
  293. package/dist/hooks/useGetElementOrWindow.cjs.map +1 -1
  294. package/dist/hooks/useIntlayerAPI.cjs.map +1 -1
  295. package/dist/hooks/useIntlayerAPI.mjs.map +1 -1
  296. package/dist/hooks/useIsMounted.cjs.map +1 -1
  297. package/dist/hooks/useIsMounted.mjs.map +1 -1
  298. package/dist/hooks/useItemSelector.cjs.map +1 -1
  299. package/dist/hooks/useItemSelector.mjs.map +1 -1
  300. package/dist/hooks/usePersistedStore.cjs.map +1 -1
  301. package/dist/hooks/usePersistedStore.mjs.map +1 -1
  302. package/dist/hooks/useScrollBlockage/index.cjs.map +1 -1
  303. package/dist/hooks/useScrollBlockage/index.mjs.map +1 -1
  304. package/dist/hooks/useScrollBlockage/useScrollBlockageStore.cjs.map +1 -1
  305. package/dist/hooks/useScrollBlockage/useScrollBlockageStore.mjs.map +1 -1
  306. package/dist/hooks/useScrollDetection.cjs.map +1 -1
  307. package/dist/hooks/useScrollDetection.mjs.map +1 -1
  308. package/dist/index-BtZWYJhL.cjs.map +1 -1
  309. package/dist/index-D9oaKvKC.js.map +1 -1
  310. package/dist/jsx-runtime-DaNGiM0W.js.map +1 -1
  311. package/dist/jsx-runtime-XHKiWCTo.cjs.map +1 -1
  312. package/dist/libs/intlayer-api/auth.cjs.map +1 -1
  313. package/dist/libs/intlayer-api/auth.mjs.map +1 -1
  314. package/dist/libs/intlayer-api/dictionary.cjs.map +1 -1
  315. package/dist/libs/intlayer-api/dictionary.mjs.map +1 -1
  316. package/dist/libs/intlayer-api/fetcher.cjs.map +1 -1
  317. package/dist/libs/intlayer-api/fetcher.mjs.map +1 -1
  318. package/dist/libs/intlayer-api/organization.cjs.map +1 -1
  319. package/dist/libs/intlayer-api/organization.mjs.map +1 -1
  320. package/dist/libs/intlayer-api/project.cjs.map +1 -1
  321. package/dist/libs/intlayer-api/project.mjs.map +1 -1
  322. package/dist/libs/intlayer-api/stripe.cjs.map +1 -1
  323. package/dist/libs/intlayer-api/stripe.mjs.map +1 -1
  324. package/dist/libs/intlayer-api/user.cjs.map +1 -1
  325. package/dist/libs/intlayer-api/user.mjs.map +1 -1
  326. package/dist/shallow-lhDIFtEp.cjs.map +1 -1
  327. package/dist/shallow-m9BpCkKh.js.map +1 -1
  328. package/dist/tailwind.config.cjs.map +1 -1
  329. package/dist/tailwind.config.mjs.map +1 -1
  330. package/dist/tailwind.css +1 -1
  331. package/dist/utils/camelCase.cjs.map +1 -1
  332. package/dist/utils/camelCase.mjs.map +1 -1
  333. package/dist/utils/capitalize.cjs.map +1 -1
  334. package/dist/utils/capitalize.mjs.map +1 -1
  335. package/dist/utils/dictionary.cjs.map +1 -1
  336. package/dist/utils/dictionary.mjs.map +1 -1
  337. package/dist/utils/isElementAtTopAndNotCovered.cjs.map +1 -1
  338. package/dist/utils/isElementAtTopAndNotCovered.mjs.map +1 -1
  339. package/dist/utils/object.cjs.map +1 -1
  340. package/dist/utils/object.mjs.map +1 -1
  341. package/dist/zod-BV4nCGJE.js.map +1 -1
  342. package/dist/zod-DSrtTSD_.cjs.map +1 -1
  343. package/package.json +14 -14
@@ -1 +1 @@
1
- {"version":3,"file":"Multiselect.mjs","sources":["../../../src/components/Select/Multiselect.tsx"],"sourcesContent":["/* eslint-disable sonarjs/no-nested-conditional */\n/* eslint-disable sonarjs/cognitive-complexity */\n'use client';\n\nimport { X as RemoveIcon, Check } from 'lucide-react';\nimport {\n type ComponentPropsWithoutRef,\n type Dispatch,\n type ElementRef,\n type FC,\n type HTMLAttributes,\n type KeyboardEvent,\n type MouseEventHandler,\n type RefObject,\n type SetStateAction,\n type SyntheticEvent,\n createContext,\n forwardRef,\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>;\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 = ComponentPropsWithoutRef<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 // eslint-disable-next-line react-hooks/exhaustive-deps\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 // eslint-disable-next-line react-hooks/exhaustive-deps\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.Provider 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.Provider>\n );\n};\n\nconst MultiSelectTrigger = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement> & {\n getBadgeValue?: (value: string) => string;\n validationStyleEnabled?: boolean;\n }\n>(\n (\n {\n className,\n getBadgeValue = (value) => value,\n validationStyleEnabled = false,\n children,\n ...props\n },\n ref\n ) => {\n const { value, onValueChange, activeIndex } = useMultiSelect();\n\n const mousePreventDefault: MouseEventHandler<HTMLButtonElement> =\n useCallback((e) => {\n e.preventDefault();\n e.stopPropagation();\n }, []);\n\n return (\n <div\n ref={ref}\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);\n\nMultiSelectTrigger.displayName = 'MultiSelectTrigger';\n\nconst MultiSelectInput: FC<ComponentPropsWithoutRef<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}\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\nMultiSelectInput.displayName = 'MultiSelectInput';\n\nconst MultiSelectContent = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement>\n>(({ children }, ref) => {\n const { open } = useMultiSelect();\n return (\n <div ref={ref} className=\"relative\">\n {open && children}\n </div>\n );\n});\n\nMultiSelectContent.displayName = 'MultiSelectContent';\n\nconst MultiSelectList = forwardRef<\n ElementRef<typeof Command.List>,\n ComponentPropsWithoutRef<typeof Command.List>\n>(({ className, children }, ref) => (\n <Command.List\n ref={ref}\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\nMultiSelectList.displayName = 'MultiSelectList';\n\nconst MultiSelectItem = forwardRef<\n ElementRef<typeof Command.Item>,\n { value: string } & ComponentPropsWithoutRef<typeof Command.Item>\n>(({ className, value, children, ...props }, ref) => {\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 ref={ref}\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":["jsx","jsxs","RemoveIcon"],"mappings":";;;;;;;AA0CA,MAAM,qBAAqB,cAA8C,IAAI;AAE7E,MAAM,iBAAiB,MAAM;AACrB,QAAA,UAAU,WAAW,kBAAkB;A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AK;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,cAAcD,kCAAAA,IAAC,OAAM,EAAA,WAAU,SAAS,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG/C,CAAC;AAED,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":["/* eslint-disable sonarjs/no-nested-conditional */\n/* eslint-disable sonarjs/cognitive-complexity */\n'use client';\n\nimport { X as RemoveIcon, Check } from 'lucide-react';\nimport {\n type ComponentPropsWithoutRef,\n type Dispatch,\n type ElementRef,\n type FC,\n type HTMLAttributes,\n type KeyboardEvent,\n type MouseEventHandler,\n type RefObject,\n type SetStateAction,\n type SyntheticEvent,\n createContext,\n forwardRef,\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>;\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 = ComponentPropsWithoutRef<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 // eslint-disable-next-line react-hooks/exhaustive-deps\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 // eslint-disable-next-line react-hooks/exhaustive-deps\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.Provider 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.Provider>\n );\n};\n\nconst MultiSelectTrigger = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement> & {\n getBadgeValue?: (value: string) => string;\n validationStyleEnabled?: boolean;\n }\n>(\n (\n {\n className,\n getBadgeValue = (value) => value,\n validationStyleEnabled = false,\n children,\n ...props\n },\n ref\n ) => {\n const { value, onValueChange, activeIndex } = useMultiSelect();\n\n const mousePreventDefault: MouseEventHandler<HTMLButtonElement> =\n useCallback((e) => {\n e.preventDefault();\n e.stopPropagation();\n }, []);\n\n return (\n <div\n ref={ref}\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);\n\nMultiSelectTrigger.displayName = 'MultiSelectTrigger';\n\nconst MultiSelectInput: FC<ComponentPropsWithoutRef<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}\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\nMultiSelectInput.displayName = 'MultiSelectInput';\n\nconst MultiSelectContent = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement>\n>(({ children }, ref) => {\n const { open } = useMultiSelect();\n return (\n <div ref={ref} className=\"relative\">\n {open && children}\n </div>\n );\n});\n\nMultiSelectContent.displayName = 'MultiSelectContent';\n\nconst MultiSelectList = forwardRef<\n ElementRef<typeof Command.List>,\n ComponentPropsWithoutRef<typeof Command.List>\n>(({ className, children }, ref) => (\n <Command.List\n ref={ref}\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\nMultiSelectList.displayName = 'MultiSelectList';\n\nconst MultiSelectItem = forwardRef<\n ElementRef<typeof Command.Item>,\n { value: string } & ComponentPropsWithoutRef<typeof Command.Item>\n>(({ className, value, children, ...props }, ref) => {\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 ref={ref}\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":["jsx","jsxs","RemoveIcon"],"mappings":";;;;;;;AA0CA,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,GAAG,OAAO,GAAG;AAC/B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EAAE,WAAW,OAAO,UAAU,GAAG,MAAM,GAAG,QAAQ;AACnD,QAAM,EAAE,OAAO,SAAS,eAAe,cAAA,IAAkB,eAAe;AAExE,QAAM,sBAAyD;AAAA,IAC7D,CAAC,MAAM;AACL,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAAA,IACpB;AAAA,IACA,CAAA;AAAA,EACF;AAEM,QAAA,aAAa,QAAQ,SAAS,KAAK;AAEvC,SAAAC,kCAAA;AAAA,IAAC,QAAQ;AAAA,IAAR;AAAA,MACC;AAAA,MACC,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,cAAcD,kCAAAA,IAAC,OAAM,EAAA,WAAU,SAAS,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAC3C;AAEJ,CAAC;AAED,gBAAgB,cAAc;AAgCvB,MAAM,cAAc;AAC3B,YAAY,UAAU;AACtB,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,YAAY,OAAO;AACnB,YAAY,OAAO;"}
@@ -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 {\n type ComponentPropsWithoutRef,\n type ElementRef,\n forwardRef,\n} from 'react';\nimport { cn } from '../../utils/cn';\n\nconst SelectRoot = SelectPrimitive.Root;\nconst SelectGroup = SelectPrimitive.Group;\nconst SelectValue = SelectPrimitive.Value;\n\nconst SelectTrigger = forwardRef<\n ElementRef<typeof SelectPrimitive.Trigger>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> & {\n validationStyleEnabled?: boolean;\n }\n>(({ validationStyleEnabled = false, className, children, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\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));\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n\nconst SelectScrollUpButton = forwardRef<\n ElementRef<typeof SelectPrimitive.ScrollUpButton>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton\n ref={ref}\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className\n )}\n {...props}\n >\n <ChevronUpIcon />\n </SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\n\nconst SelectScrollDownButton = forwardRef<\n ElementRef<typeof SelectPrimitive.ScrollDownButton>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton\n ref={ref}\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className\n )}\n {...props}\n >\n <ChevronDownIcon />\n </SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName =\n SelectPrimitive.ScrollDownButton.displayName;\n\nexport const SelectContent = forwardRef<\n ElementRef<typeof SelectPrimitive.Content>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(({ className, children, position = 'popper', ...props }, ref) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\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));\nSelectContent.displayName = SelectPrimitive.Content.displayName;\n\nexport const SelectLabel = forwardRef<\n ElementRef<typeof SelectPrimitive.Label>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn('px-1 py-0.5 text-sm font-semibold', className)}\n {...props}\n />\n));\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\n\nconst SelectItem = forwardRef<\n ElementRef<typeof SelectPrimitive.Item>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\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));\nSelectItem.displayName = SelectPrimitive.Item.displayName;\n\nexport const SelectSeparator = forwardRef<\n ElementRef<typeof SelectPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn('-mx-1 my-1 h-px bg-red-300', className)}\n {...props}\n />\n));\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\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","forwardRef","jsxs","cn","jsx","ChevronsUpDown","ChevronUpIcon","ChevronDownIcon","CheckIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAM,aAAaA,2BAAgB;AACnC,MAAM,cAAcA,2BAAgB;AACpC,MAAM,cAAcA,2BAAgB;AAEpC,MAAM,gBAAgBC,WAKpB,WAAA,CAAC,EAAE,yBAAyB,OAAO,WAAW,UAAU,GAAG,SAAS,QACpEC,2BAAA,kBAAA;AAAA,EAACF,2BAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAWG,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,kBAAAA,IAACJ,2BAAgB,MAAhB,EAAqB,SAAO,MAC3B,UAACI,2BAAA,kBAAA,IAAAC,YAAA,gBAAA,EAAe,WAAU,oBAAA,CAAoB,EAChD,CAAA;AAAA,IAAA;AAAA,EAAA;AACF,CACD;AACD,cAAc,cAAcL,2BAAgB,QAAQ;AAEpD,MAAM,uBAAuBC,sBAG3B,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1BG,2BAAA,kBAAA;AAAA,EAACJ,2BAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAWG,SAAA;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA,IAEJ,2DAACG,YAAc,eAAA,EAAA;AAAA,EAAA;AACjB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D;AACD,YAAY,cAAcH,2BAAgB,MAAM;AAEhD,MAAM,aAAaC,WAAAA,WAGjB,CAAC,EAAE,WAAW,UAAU,GAAG,MAAM,GAAG,QACpCC,2BAAA,kBAAA;AAAA,EAACF,2BAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAWG,SAAA;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA,IAEJ,UAAA;AAAA,MAAAC,2BAAA,kBAAA,IAAC,QAAK,EAAA,WAAU,8DACd,UAAAA,2BAAA,kBAAA,IAACJ,2BAAgB,eAAhB,EACC,UAAAI,2BAAA,kBAAA,IAACI,uBAAU,EAAA,WAAU,SAAS,CAAA,EAChC,CAAA,GACF;AAAA,MACCJ,2BAAAA,kBAAAA,IAAAJ,2BAAgB,UAAhB,EAA0B,SAAS,CAAA;AAAA,IAAA;AAAA,EAAA;AACtC,CACD;AACD,WAAW,cAAcA,2BAAgB,KAAK;AAEjC,MAAA,kBAAkBC,sBAG7B,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1BG,2BAAA,kBAAA;AAAA,EAACJ,2BAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAWG,SAAAA,GAAG,8BAA8B,SAAS;AAAA,IACpD,GAAG;AAAA,EAAA;AACN,CACD;AACD,gBAAgB,cAAcH,2BAAgB,UAAU;AA6BjD,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 {\n type ComponentPropsWithoutRef,\n type ElementRef,\n forwardRef,\n} from 'react';\nimport { cn } from '../../utils/cn';\n\nconst SelectRoot = SelectPrimitive.Root;\nconst SelectGroup = SelectPrimitive.Group;\nconst SelectValue = SelectPrimitive.Value;\n\nconst SelectTrigger = forwardRef<\n ElementRef<typeof SelectPrimitive.Trigger>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> & {\n validationStyleEnabled?: boolean;\n }\n>(({ validationStyleEnabled = false, className, children, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\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));\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n\nconst SelectScrollUpButton = forwardRef<\n ElementRef<typeof SelectPrimitive.ScrollUpButton>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton\n ref={ref}\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className\n )}\n {...props}\n >\n <ChevronUpIcon />\n </SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\n\nconst SelectScrollDownButton = forwardRef<\n ElementRef<typeof SelectPrimitive.ScrollDownButton>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton\n ref={ref}\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className\n )}\n {...props}\n >\n <ChevronDownIcon />\n </SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName =\n SelectPrimitive.ScrollDownButton.displayName;\n\nexport const SelectContent = forwardRef<\n ElementRef<typeof SelectPrimitive.Content>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(({ className, children, position = 'popper', ...props }, ref) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\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));\nSelectContent.displayName = SelectPrimitive.Content.displayName;\n\nexport const SelectLabel = forwardRef<\n ElementRef<typeof SelectPrimitive.Label>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn('px-1 py-0.5 text-sm font-semibold', className)}\n {...props}\n />\n));\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\n\nconst SelectItem = forwardRef<\n ElementRef<typeof SelectPrimitive.Item>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\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));\nSelectItem.displayName = SelectPrimitive.Item.displayName;\n\nexport const SelectSeparator = forwardRef<\n ElementRef<typeof SelectPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn('-mx-1 my-1 h-px bg-red-300', className)}\n {...props}\n />\n));\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\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","forwardRef","jsxs","cn","jsx","ChevronsUpDown","ChevronUpIcon","ChevronDownIcon","CheckIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAM,aAAaA,2BAAgB;AACnC,MAAM,cAAcA,2BAAgB;AACpC,MAAM,cAAcA,2BAAgB;AAEpC,MAAM,gBAAgBC,WAKpB,WAAA,CAAC,EAAE,yBAAyB,OAAO,WAAW,UAAU,GAAG,SAAS,QACpEC,2BAAA,kBAAA;AAAA,EAACF,2BAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAWG,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,kBAAAA,IAACJ,2BAAgB,MAAhB,EAAqB,SAAO,MAC3B,UAACI,2BAAAA,kBAAAA,IAAAC,YAAAA,gBAAA,EAAe,WAAU,oBAAoB,CAAA,EAChD,CAAA;AAAA,IAAA;AAAA,EAAA;AACF,CACD;AACD,cAAc,cAAcL,2BAAgB,QAAQ;AAEpD,MAAM,uBAAuBC,sBAG3B,CAAC,EAAE,W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QAAQ;AACf,OAAO,OAAO;AACd,OAAO,YAAY;;;;;"}
@@ -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 {\n type ComponentPropsWithoutRef,\n type ElementRef,\n forwardRef,\n} from 'react';\nimport { cn } from '../../utils/cn';\n\nconst SelectRoot = SelectPrimitive.Root;\nconst SelectGroup = SelectPrimitive.Group;\nconst SelectValue = SelectPrimitive.Value;\n\nconst SelectTrigger = forwardRef<\n ElementRef<typeof SelectPrimitive.Trigger>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> & {\n validationStyleEnabled?: boolean;\n }\n>(({ validationStyleEnabled = false, className, children, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\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));\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n\nconst SelectScrollUpButton = forwardRef<\n ElementRef<typeof SelectPrimitive.ScrollUpButton>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton\n ref={ref}\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className\n )}\n {...props}\n >\n <ChevronUpIcon />\n </SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\n\nconst SelectScrollDownButton = forwardRef<\n ElementRef<typeof SelectPrimitive.ScrollDownButton>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton\n ref={ref}\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className\n )}\n {...props}\n >\n <ChevronDownIcon />\n </SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName =\n SelectPrimitive.ScrollDownButton.displayName;\n\nexport const SelectContent = forwardRef<\n ElementRef<typeof SelectPrimitive.Content>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(({ className, children, position = 'popper', ...props }, ref) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\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));\nSelectContent.displayName = SelectPrimitive.Content.displayName;\n\nexport const SelectLabel = forwardRef<\n ElementRef<typeof SelectPrimitive.Label>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn('px-1 py-0.5 text-sm font-semibold', className)}\n {...props}\n />\n));\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\n\nconst SelectItem = forwardRef<\n ElementRef<typeof SelectPrimitive.Item>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\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));\nSelectItem.displayName = SelectPrimitive.Item.displayName;\n\nexport const SelectSeparator = forwardRef<\n ElementRef<typeof SelectPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn('-mx-1 my-1 h-px bg-red-300', className)}\n {...props}\n />\n));\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\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":["jsxs","jsx"],"mappings":";;;;;;AAgBA,MAAM,aAAa,gBAAgB;AACnC,MAAM,cAAc,gBAAgB;AACpC,MAAM,cAAc,gBAAgB;AAEpC,MAAM,gBAAgB,WAKpB,CAAC,EAAE,yBAAyB,OAAO,WAAW,UAAU,GAAG,SAAS,QACpEA,kCAAA;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,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,MACDC,kCAAAA,IAAC,gBAAgB,MAAhB,EAAqB,SAAO,MAC3B,UAACA,kCAAA,IAAA,gBAAA,EAAe,WAAU,oBAAA,CAAoB,EAChD,CAAA;AAAA,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import * as SelectPrimitive from '@radix-ui/react-select';\nimport {\n ChevronsUpDown,\n CheckIcon,\n ChevronDownIcon,\n ChevronUpIcon,\n} from 'lucide-react';\nimport {\n type ComponentPropsWithoutRef,\n type ElementRef,\n forwardRef,\n} from 'react';\nimport { cn } from '../../utils/cn';\n\nconst SelectRoot = SelectPrimitive.Root;\nconst SelectGroup = SelectPrimitive.Group;\nconst SelectValue = SelectPrimitive.Value;\n\nconst SelectTrigger = forwardRef<\n ElementRef<typeof SelectPrimitive.Trigger>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> & {\n validationStyleEnabled?: boolean;\n }\n>(({ validationStyleEnabled = false, className, children, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\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));\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n\nconst SelectScrollUpButton = forwardRef<\n ElementRef<typeof SelectPrimitive.ScrollUpButton>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton\n ref={ref}\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className\n )}\n {...props}\n >\n <ChevronUpIcon />\n </SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\n\nconst SelectScrollDownButton = forwardRef<\n ElementRef<typeof SelectPrimitive.ScrollDownButton>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton\n ref={ref}\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className\n )}\n {...props}\n >\n <ChevronDownIcon />\n </SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName =\n SelectPrimitive.ScrollDownButton.displayName;\n\nexport const SelectContent = forwardRef<\n ElementRef<typeof SelectPrimitive.Content>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(({ className, children, position = 'popper', ...props }, ref) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\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));\nSelectContent.displayName = SelectPrimitive.Content.displayName;\n\nexport const SelectLabel = forwardRef<\n ElementRef<typeof SelectPrimitive.Label>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn('px-1 py-0.5 text-sm font-semibold', className)}\n {...props}\n />\n));\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\n\nconst SelectItem = forwardRef<\n ElementRef<typeof SelectPrimitive.Item>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\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));\nSelectItem.displayName = SelectPrimitive.Item.displayName;\n\nexport const SelectSeparator = forwardRef<\n ElementRef<typeof SelectPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn('-mx-1 my-1 h-px bg-red-300', className)}\n {...props}\n />\n));\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\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":["jsxs","jsx"],"mappings":";;;;;;AAgBA,MAAM,aAAa,gBAAgB;AACnC,MAAM,cAAc,gBAAgB;AACpC,MAAM,cAAc,gBAAgB;AAEpC,MAAM,gBAAgB,WAKpB,CAAC,EAAE,yBAAyB,OAAO,WAAW,UAAU,GAAG,SAAS,QACpEA,kCAAA;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,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,MACDC,kCAAAA,IAAC,gBAAgB,MAAhB,EAAqB,SAAO,MAC3B,UAACA,kCAAAA,IAAA,gBAAA,EAAe,WAAU,oBAAoB,CAAA,EAChD,CAAA;AAAA,IAAA;AAAA,EAAA;AACF,CACD;AACD,cAAc,cAAc,gBAAgB,QAAQ;AAEpD,MAAM,uBAAuB,WAG3B,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1BA,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C;AAAA,IACA,WAAW,GAAG,qCAAqC,SAAS;AAAA,IAC3D,GAAG;AAAA,EAAA;AACN,CACD;AACD,YAAY,cAAc,gBAAgB,MAAM;AAEhD,MAAM,aAAa,WAGjB,CAAC,EAAE,WAAW,UAAU,GAAG,MAAM,GAAG,QACpCD,kCAAA;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA,IAEJ,UAAA;AAAA,MAAAC,kCAAA,IAAC,QAAK,EAAA,WAAU,8DACd,UAAAA,kCAAA,IAAC,gBAAgB,eAAhB,EACC,UAAAA,kCAAA,IAAC,WAAU,EAAA,WAAU,SAAS,CAAA,EAChC,CAAA,GACF;AAAA,MACCA,kCAAAA,IAAA,gBAAgB,UAAhB,EAA0B,SAAS,CAAA;AAAA,IAAA;AAAA,EAAA;AACtC,CACD;AACD,WAAW,cAAc,gBAAgB,KAAK;AAEjC,MAAA,kBAAkB,WAG7B,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1BA,kCAAA;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW,GAAG,8BAA8B,SAAS;AAAA,IACpD,GAAG;AAAA,EAAA;AACN,CACD;AACD,gBAAgB,cAAc,gBAAgB,UAAU;AA6BjD,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 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/components/SwitchSelector/index.tsx"],"sourcesContent":["'use client';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useRef, type ReactNode, type HTMLAttributes, useState } from 'react';\nimport { useItemSelector } from '../../hooks';\nimport { cn } from '../../utils/cn';\n\nexport type SwitchSelectorChoice<T = boolean> = {\n content: ReactNode;\n value: T;\n} & HTMLAttributes<HTMLButtonElement>;\nexport type SwitchSelectorChoices<T> = SwitchSelectorChoice<T>[];\n\nconst defaultChoices: SwitchSelectorChoices<boolean> = [\n { content: 'Off', value: false },\n { content: 'On', value: true },\n];\n\ntype SwitchSelectorProps<T = boolean> = {\n choices?: SwitchSelectorChoices<T>;\n value?: T;\n defaultValue?: T;\n onChange?: (choice: T) => void;\n className?: string;\n} & VariantProps<typeof switchSelectorVariant> &\n VariantProps<typeof choiceVariant>;\n\nconst switchSelectorVariant = cva(\n 'flex flex-row gap-2 rounded-full w-fit border-[1.5px] p-[1.5px]',\n {\n variants: {\n color: {\n primary:\n 'border-primary text-primary dark:border-primary-dark dark:text-primary-dark',\n secondary:\n 'border-secondary text-secondary dark:border-secondary-dark dark:text-secondary-dark',\n destructive:\n 'border-destructive bg-destructive text-destructive dark:border-destructive-dark dark:bg-destructive-dark',\n neutral:\n 'border-neutral text-neutral dark:border-neutral-dark dark:text-neutral-dark',\n light: 'border-white text-white',\n dark: 'border-neutral-800 text-neutral-800',\n text: 'border-text text-text dark:border-text-dark dark:text-text-dark',\n },\n },\n defaultVariants: {\n color: 'primary',\n },\n }\n);\n\nconst choiceVariant = cva(\n 'z-1 text-sm font-medium transition-all duration-300 ease-in-out aria-selected:cursor-default aria-selected:text-text-dark motion-reduce:transition-none dark:aria-selected:text-text',\n {\n variants: {\n size: {\n sm: 'py-1 px-2 text-xs',\n md: 'p-2 text-sm',\n lg: 'p-4 text-base',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n }\n);\n\nconst indicatorVariant = cva(\n 'absolute top-0 z-[-1] h-full w-auto rounded-full transition-[left,width] duration-300 ease-in-out motion-reduce:transition-none',\n {\n variants: {\n color: {\n primary:\n 'bg-primary aria-selected:text-text dark:bg-primary-dark dark:aria-selected:text-text-dark',\n secondary:\n 'bg-secondary aria-selected:text-text dark:bg-secondary-dark dark:aria-selected:text-text-dark',\n destructive:\n 'bg-destructive aria-selected:text-text dark:bg-destructive-dark dark:aria-selected:text-text-dark',\n neutral:\n 'bg-neutral aria-selected:text-white dark:bg-neutral-dark dark:aria-selected:text-text',\n light: 'bg-white aria-selected:text-black',\n dark: 'bg-neutral-800 aria-selected:text-white',\n text: 'bg-text aria-selected:text-text-dark dark:bg-text-dark dark:aria-selected:text-text',\n },\n },\n }\n);\n\n/**\n *\n * Component that allows the user to select one of the provided choices.\n *\n * Example:\n * ```jsx\n * <SwitchSelector\n * choices={[\n * { content: 'Option 1', value: 'option1' },\n * { content: 'Option 2', value: 'option2' },\n * { content: 'Option 3', value: 'option3' },\n * ]}\n * value=\"option1\"\n * onChange={(choice) => console.log(choice)}\n * />\n * ```\n */\nexport const SwitchSelector = <T,>({\n choices = defaultChoices as SwitchSelectorChoices<T>,\n value,\n defaultValue,\n onChange,\n color = 'primary',\n size = 'md',\n className,\n}: SwitchSelectorProps<T>) => {\n const [valueState, setValue] = useState<T>(\n value ?? defaultValue ?? choices[0].value\n );\n const optionsRefs = useRef<HTMLButtonElement[]>([]);\n const indicatorRef = useRef<HTMLDivElement | null>(null);\n const { choiceIndicatorPosition } = useItemSelector(optionsRefs);\n\n const handleChange = (newValue: T) => {\n setValue(newValue);\n onChange?.(newValue);\n };\n\n return (\n <div\n className={switchSelectorVariant({\n color,\n className,\n })}\n role=\"tablist\"\n >\n <div className=\"relative flex size-full flex-row items-center justify-center\">\n {choices.map((choice, index) => {\n const { content, value, ...buttonProps } = choice;\n\n const isKeyOfKey =\n typeof value === 'string' || typeof value === 'number';\n\n const isSelected = value === valueState;\n\n return (\n <button\n {...buttonProps}\n className={cn(\n choiceVariant({\n size,\n })\n )}\n key={isKeyOfKey ? value : index}\n role=\"tab\"\n onClick={() => handleChange(value)}\n aria-selected={isSelected}\n disabled={isSelected}\n ref={(el) => {\n optionsRefs.current[index] = el!;\n }}\n >\n {content}\n </button>\n );\n })}\n {choiceIndicatorPosition && (\n <div\n className={cn(\n indicatorVariant({\n color,\n })\n )}\n style={choiceIndicatorPosition}\n ref={indicatorRef}\n />\n )}\n </div>\n </div>\n );\n};\n"],"names":["cva","useState","useRef","useItemSelector","jsx","jsxs","value","createElement","cn"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAM,iBAAiD;AAAA,EACrD,EAAE,SAAS,OAAO,OAAO,MAAM;AAAA,EAC/B,EAAE,SAAS,MAAM,OAAO,KAAK;AAC/B;AAWA,MAAM,wBAAwBA,uBAAA;AAAA,EAC5B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,OAAO;AAAA,QACL,SACE;AAAA,QACF,WACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,OAAO;AAAA,QACP,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,OAAO;AAAA,IACT;AAAA,EACF;AACF;AAEA,MAAM,gBAAgBA,uBAAA;AAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MACN;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,MAAM;AAAA,IACR;AAAA,EACF;AACF;AAEA,MAAM,mBAAmBA,uBAAA;AAAA,EACvB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,OAAO;AAAA,QACL,SACE;AAAA,QACF,WACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,OAAO;AAAA,QACP,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;AAmBO,MAAM,iBAAiB,CAAK;AAAA,EACjC,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,OAAO;AAAA,EACP;AACF,MAA8B;AACtB,QAAA,CAAC,YAAY,QAAQ,IAAIC,WAAA;AAAA,IAC7B,SAAS,gBAA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;AAAA,MAAA,GAEJ;AAAA,IAAA;AAAA,EAAA;AAGN;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/SwitchSelector/index.tsx"],"sourcesContent":["'use client';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useRef, type ReactNode, type HTMLAttributes, useState } from 'react';\nimport { useItemSelector } from '../../hooks';\nimport { cn } from '../../utils/cn';\n\nexport type SwitchSelectorChoice<T = boolean> = {\n content: ReactNode;\n value: T;\n} & HTMLAttributes<HTMLButtonElement>;\nexport type SwitchSelectorChoices<T> = SwitchSelectorChoice<T>[];\n\nconst defaultChoices: SwitchSelectorChoices<boolean> = [\n { content: 'Off', value: false },\n { content: 'On', value: true },\n];\n\ntype SwitchSelectorProps<T = boolean> = {\n choices?: SwitchSelectorChoices<T>;\n value?: T;\n defaultValue?: T;\n onChange?: (choice: T) => void;\n className?: string;\n} & VariantProps<typeof switchSelectorVariant> &\n VariantProps<typeof choiceVariant>;\n\nconst switchSelectorVariant = cva(\n 'flex flex-row gap-2 rounded-full w-fit border-[1.5px] p-[1.5px]',\n {\n variants: {\n color: {\n primary:\n 'border-primary text-primary dark:border-primary-dark dark:text-primary-dark',\n secondary:\n 'border-secondary text-secondary dark:border-secondary-dark dark:text-secondary-dark',\n destructive:\n 'border-destructive bg-destructive text-destructive dark:border-destructive-dark dark:bg-destructive-dark',\n neutral:\n 'border-neutral text-neutral dark:border-neutral-dark dark:text-neutral-dark',\n light: 'border-white text-white',\n dark: 'border-neutral-800 text-neutral-800',\n text: 'border-text text-text dark:border-text-dark dark:text-text-dark',\n },\n },\n defaultVariants: {\n color: 'primary',\n },\n }\n);\n\nconst choiceVariant = cva(\n 'z-1 text-sm font-medium transition-all duration-300 ease-in-out aria-selected:cursor-default aria-selected:text-text-dark motion-reduce:transition-none dark:aria-selected:text-text',\n {\n variants: {\n size: {\n sm: 'py-1 px-2 text-xs',\n md: 'p-2 text-sm',\n lg: 'p-4 text-base',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n }\n);\n\nconst indicatorVariant = cva(\n 'absolute top-0 z-[-1] h-full w-auto rounded-full transition-[left,width] duration-300 ease-in-out motion-reduce:transition-none',\n {\n variants: {\n color: {\n primary:\n 'bg-primary aria-selected:text-text dark:bg-primary-dark dark:aria-selected:text-text-dark',\n secondary:\n 'bg-secondary aria-selected:text-text dark:bg-secondary-dark dark:aria-selected:text-text-dark',\n destructive:\n 'bg-destructive aria-selected:text-text dark:bg-destructive-dark dark:aria-selected:text-text-dark',\n neutral:\n 'bg-neutral aria-selected:text-white dark:bg-neutral-dark dark:aria-selected:text-text',\n light: 'bg-white aria-selected:text-black',\n dark: 'bg-neutral-800 aria-selected:text-white',\n text: 'bg-text aria-selected:text-text-dark dark:bg-text-dark dark:aria-selected:text-text',\n },\n },\n }\n);\n\n/**\n *\n * Component that allows the user to select one of the provided choices.\n *\n * Example:\n * ```jsx\n * <SwitchSelector\n * choices={[\n * { content: 'Option 1', value: 'option1' },\n * { content: 'Option 2', value: 'option2' },\n * { content: 'Option 3', value: 'option3' },\n * ]}\n * value=\"option1\"\n * onChange={(choice) => console.log(choice)}\n * />\n * ```\n */\nexport const SwitchSelector = <T,>({\n choices = defaultChoices as SwitchSelectorChoices<T>,\n value,\n defaultValue,\n onChange,\n color = 'primary',\n size = 'md',\n className,\n}: SwitchSelectorProps<T>) => {\n const [valueState, setValue] = useState<T>(\n value ?? defaultValue ?? choices[0].value\n );\n const optionsRefs = useRef<HTMLButtonElement[]>([]);\n const indicatorRef = useRef<HTMLDivElement | null>(null);\n const { choiceIndicatorPosition } = useItemSelector(optionsRefs);\n\n const handleChange = (newValue: T) => {\n setValue(newValue);\n onChange?.(newValue);\n };\n\n return (\n <div\n className={switchSelectorVariant({\n color,\n className,\n })}\n role=\"tablist\"\n >\n <div className=\"relative flex size-full flex-row items-center justify-center\">\n {choices.map((choice, index) => {\n const { content, value, ...buttonProps } = choice;\n\n const isKeyOfKey =\n typeof value === 'string' || typeof value === 'number';\n\n const isSelected = value === valueState;\n\n return (\n <button\n {...buttonProps}\n className={cn(\n choiceVariant({\n size,\n })\n )}\n key={isKeyOfKey ? value : index}\n role=\"tab\"\n onClick={() => handleChange(value)}\n aria-selected={isSelected}\n disabled={isSelected}\n ref={(el) => {\n optionsRefs.current[index] = el!;\n }}\n >\n {content}\n </button>\n );\n })}\n {choiceIndicatorPosition && (\n <div\n className={cn(\n indicatorVariant({\n color,\n })\n )}\n style={choiceIndicatorPosition}\n ref={indicatorRef}\n />\n )}\n </div>\n </div>\n );\n};\n"],"names":["cva","useState","useRef","useItemSelector","jsx","jsxs","value","createElement","cn"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAM,iBAAiD;AAAA,EACrD,EAAE,SAAS,OAAO,OAAO,MAAM;AAAA,EAC/B,EAAE,SAAS,MAAM,OAAO,KAAK;AAC/B;AAWA,MAAM,wBAAwBA,uBAAA;AAAA,EAC5B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,OAAO;AAAA,QACL,SACE;AAAA,QACF,WACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,OAAO;AAAA,QACP,MAAM;AAAA,QACN,MAAM;AAAA,MAAA;AAAA,IAEV;AAAA,IACA,iBAAiB;AAAA,MACf,OAAO;AAAA,IAAA;AAAA,EACT;AAEJ;AAEA,MAAM,gBAAgBA,uBAAA;AAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA;AAAA,IAER;AAAA,IACA,iBAAiB;AAAA,MACf,MAAM;AAAA,IAAA;AAAA,EACR;AAEJ;AAEA,MAAM,mBAAmBA,uBAAA;AAAA,EACvB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,OAAO;AAAA,QACL,SACE;AAAA,QACF,WACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,OAAO;AAAA,QACP,MAAM;AAAA,QACN,M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AA,YAC/B;AAAA,YAEC;AAAA,UACH;AAAA,QAAA,CAEH;AAAA,QACA,2BACCF,2BAAA,kBAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWI,SAAA;AAAA,cACT,iBAAiB;AAAA,gBACf;AAAA,cACD,CAAA;AAAA,YACH;AAAA,YACA,OAAO;AAAA,YACP,KAAK;AAAA,UAAA;AAAA,QAAA;AAAA,MACP,EAEJ,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../src/components/SwitchSelector/index.tsx"],"sourcesContent":["'use client';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useRef, type ReactNode, type HTMLAttributes, useState } from 'react';\nimport { useItemSelector } from '../../hooks';\nimport { cn } from '../../utils/cn';\n\nexport type SwitchSelectorChoice<T = boolean> = {\n content: ReactNode;\n value: T;\n} & HTMLAttributes<HTMLButtonElement>;\nexport type SwitchSelectorChoices<T> = SwitchSelectorChoice<T>[];\n\nconst defaultChoices: SwitchSelectorChoices<boolean> = [\n { content: 'Off', value: false },\n { content: 'On', value: true },\n];\n\ntype SwitchSelectorProps<T = boolean> = {\n choices?: SwitchSelectorChoices<T>;\n value?: T;\n defaultValue?: T;\n onChange?: (choice: T) => void;\n className?: string;\n} & VariantProps<typeof switchSelectorVariant> &\n VariantProps<typeof choiceVariant>;\n\nconst switchSelectorVariant = cva(\n 'flex flex-row gap-2 rounded-full w-fit border-[1.5px] p-[1.5px]',\n {\n variants: {\n color: {\n primary:\n 'border-primary text-primary dark:border-primary-dark dark:text-primary-dark',\n secondary:\n 'border-secondary text-secondary dark:border-secondary-dark dark:text-secondary-dark',\n destructive:\n 'border-destructive bg-destructive text-destructive dark:border-destructive-dark dark:bg-destructive-dark',\n neutral:\n 'border-neutral text-neutral dark:border-neutral-dark dark:text-neutral-dark',\n light: 'border-white text-white',\n dark: 'border-neutral-800 text-neutral-800',\n text: 'border-text text-text dark:border-text-dark dark:text-text-dark',\n },\n },\n defaultVariants: {\n color: 'primary',\n },\n }\n);\n\nconst choiceVariant = cva(\n 'z-1 text-sm font-medium transition-all duration-300 ease-in-out aria-selected:cursor-default aria-selected:text-text-dark motion-reduce:transition-none dark:aria-selected:text-text',\n {\n variants: {\n size: {\n sm: 'py-1 px-2 text-xs',\n md: 'p-2 text-sm',\n lg: 'p-4 text-base',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n }\n);\n\nconst indicatorVariant = cva(\n 'absolute top-0 z-[-1] h-full w-auto rounded-full transition-[left,width] duration-300 ease-in-out motion-reduce:transition-none',\n {\n variants: {\n color: {\n primary:\n 'bg-primary aria-selected:text-text dark:bg-primary-dark dark:aria-selected:text-text-dark',\n secondary:\n 'bg-secondary aria-selected:text-text dark:bg-secondary-dark dark:aria-selected:text-text-dark',\n destructive:\n 'bg-destructive aria-selected:text-text dark:bg-destructive-dark dark:aria-selected:text-text-dark',\n neutral:\n 'bg-neutral aria-selected:text-white dark:bg-neutral-dark dark:aria-selected:text-text',\n light: 'bg-white aria-selected:text-black',\n dark: 'bg-neutral-800 aria-selected:text-white',\n text: 'bg-text aria-selected:text-text-dark dark:bg-text-dark dark:aria-selected:text-text',\n },\n },\n }\n);\n\n/**\n *\n * Component that allows the user to select one of the provided choices.\n *\n * Example:\n * ```jsx\n * <SwitchSelector\n * choices={[\n * { content: 'Option 1', value: 'option1' },\n * { content: 'Option 2', value: 'option2' },\n * { content: 'Option 3', value: 'option3' },\n * ]}\n * value=\"option1\"\n * onChange={(choice) => console.log(choice)}\n * />\n * ```\n */\nexport const SwitchSelector = <T,>({\n choices = defaultChoices as SwitchSelectorChoices<T>,\n value,\n defaultValue,\n onChange,\n color = 'primary',\n size = 'md',\n className,\n}: SwitchSelectorProps<T>) => {\n const [valueState, setValue] = useState<T>(\n value ?? defaultValue ?? choices[0].value\n );\n const optionsRefs = useRef<HTMLButtonElement[]>([]);\n const indicatorRef = useRef<HTMLDivElement | null>(null);\n const { choiceIndicatorPosition } = useItemSelector(optionsRefs);\n\n const handleChange = (newValue: T) => {\n setValue(newValue);\n onChange?.(newValue);\n };\n\n return (\n <div\n className={switchSelectorVariant({\n color,\n className,\n })}\n role=\"tablist\"\n >\n <div className=\"relative flex size-full flex-row items-center justify-center\">\n {choices.map((choice, index) => {\n const { content, value, ...buttonProps } = choice;\n\n const isKeyOfKey =\n typeof value === 'string' || typeof value === 'number';\n\n const isSelected = value === valueState;\n\n return (\n <button\n {...buttonProps}\n className={cn(\n choiceVariant({\n size,\n })\n )}\n key={isKeyOfKey ? value : index}\n role=\"tab\"\n onClick={() => handleChange(value)}\n aria-selected={isSelected}\n disabled={isSelected}\n ref={(el) => {\n optionsRefs.current[index] = el!;\n }}\n >\n {content}\n </button>\n );\n })}\n {choiceIndicatorPosition && (\n <div\n className={cn(\n indicatorVariant({\n color,\n })\n )}\n style={choiceIndicatorPosition}\n ref={indicatorRef}\n />\n )}\n </div>\n </div>\n );\n};\n"],"names":["jsx","jsxs","value"],"mappings":";;;;;;;;;;;;;AAaA,MAAM,iBAAiD;AAAA,EACrD,EAAE,SAAS,OAAO,OAAO,MAAM;AAAA,EAC/B,EAAE,SAAS,MAAM,OAAO,KAAK;AAC/B;AAWA,MAAM,wBAAwB;AAAA,EAC5B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,OAAO;AAAA,QACL,SACE;AAAA,QACF,WACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,OAAO;AAAA,QACP,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,OAAO;AAAA,IACT;AAAA,EACF;AACF;AAEA,MAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MACN;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,MAAM;AAAA,IACR;AA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;AAAA,cACL,SAAS,MAAM,aAAaA,MAAK;AAAA,cACjC,iBAAe;AAAA,cACf,UAAU;AAAA,cACV,KAAK,CAAC,OAAO;AACC,4BAAA,QAAQ,KAAK,IAAI;AAAA,cAC/B;AAAA,YAAA;AAAA,YAEC;AAAA,UAAA;AAAA,QACH,CAEH;AAAA,QACA,2BACCF,kCAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAW;AAAA,cACT,iBAAiB;AAAA,gBACf;AAAA,cAAA,CACD;AAAA,YACH;AAAA,YACA,OAAO;AAAA,YACP,KAAK;AAAA,UAAA;AAAA,QACP;AAAA,MAAA,GAEJ;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../src/components/SwitchSelector/index.tsx"],"sourcesContent":["'use client';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useRef, type ReactNode, type HTMLAttributes, useState } from 'react';\nimport { useItemSelector } from '../../hooks';\nimport { cn } from '../../utils/cn';\n\nexport type SwitchSelectorChoice<T = boolean> = {\n content: ReactNode;\n value: T;\n} & HTMLAttributes<HTMLButtonElement>;\nexport type SwitchSelectorChoices<T> = SwitchSelectorChoice<T>[];\n\nconst defaultChoices: SwitchSelectorChoices<boolean> = [\n { content: 'Off', value: false },\n { content: 'On', value: true },\n];\n\ntype SwitchSelectorProps<T = boolean> = {\n choices?: SwitchSelectorChoices<T>;\n value?: T;\n defaultValue?: T;\n onChange?: (choice: T) => void;\n className?: string;\n} & VariantProps<typeof switchSelectorVariant> &\n VariantProps<typeof choiceVariant>;\n\nconst switchSelectorVariant = cva(\n 'flex flex-row gap-2 rounded-full w-fit border-[1.5px] p-[1.5px]',\n {\n variants: {\n color: {\n primary:\n 'border-primary text-primary dark:border-primary-dark dark:text-primary-dark',\n secondary:\n 'border-secondary text-secondary dark:border-secondary-dark dark:text-secondary-dark',\n destructive:\n 'border-destructive bg-destructive text-destructive dark:border-destructive-dark dark:bg-destructive-dark',\n neutral:\n 'border-neutral text-neutral dark:border-neutral-dark dark:text-neutral-dark',\n light: 'border-white text-white',\n dark: 'border-neutral-800 text-neutral-800',\n text: 'border-text text-text dark:border-text-dark dark:text-text-dark',\n },\n },\n defaultVariants: {\n color: 'primary',\n },\n }\n);\n\nconst choiceVariant = cva(\n 'z-1 text-sm font-medium transition-all duration-300 ease-in-out aria-selected:cursor-default aria-selected:text-text-dark motion-reduce:transition-none dark:aria-selected:text-text',\n {\n variants: {\n size: {\n sm: 'py-1 px-2 text-xs',\n md: 'p-2 text-sm',\n lg: 'p-4 text-base',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n }\n);\n\nconst indicatorVariant = cva(\n 'absolute top-0 z-[-1] h-full w-auto rounded-full transition-[left,width] duration-300 ease-in-out motion-reduce:transition-none',\n {\n variants: {\n color: {\n primary:\n 'bg-primary aria-selected:text-text dark:bg-primary-dark dark:aria-selected:text-text-dark',\n secondary:\n 'bg-secondary aria-selected:text-text dark:bg-secondary-dark dark:aria-selected:text-text-dark',\n destructive:\n 'bg-destructive aria-selected:text-text dark:bg-destructive-dark dark:aria-selected:text-text-dark',\n neutral:\n 'bg-neutral aria-selected:text-white dark:bg-neutral-dark dark:aria-selected:text-text',\n light: 'bg-white aria-selected:text-black',\n dark: 'bg-neutral-800 aria-selected:text-white',\n text: 'bg-text aria-selected:text-text-dark dark:bg-text-dark dark:aria-selected:text-text',\n },\n },\n }\n);\n\n/**\n *\n * Component that allows the user to select one of the provided choices.\n *\n * Example:\n * ```jsx\n * <SwitchSelector\n * choices={[\n * { content: 'Option 1', value: 'option1' },\n * { content: 'Option 2', value: 'option2' },\n * { content: 'Option 3', value: 'option3' },\n * ]}\n * value=\"option1\"\n * onChange={(choice) => console.log(choice)}\n * />\n * ```\n */\nexport const SwitchSelector = <T,>({\n choices = defaultChoices as SwitchSelectorChoices<T>,\n value,\n defaultValue,\n onChange,\n color = 'primary',\n size = 'md',\n className,\n}: SwitchSelectorProps<T>) => {\n const [valueState, setValue] = useState<T>(\n value ?? defaultValue ?? choices[0].value\n );\n const optionsRefs = useRef<HTMLButtonElement[]>([]);\n const indicatorRef = useRef<HTMLDivElement | null>(null);\n const { choiceIndicatorPosition } = useItemSelector(optionsRefs);\n\n const handleChange = (newValue: T) => {\n setValue(newValue);\n onChange?.(newValue);\n };\n\n return (\n <div\n className={switchSelectorVariant({\n color,\n className,\n })}\n role=\"tablist\"\n >\n <div className=\"relative flex size-full flex-row items-center justify-center\">\n {choices.map((choice, index) => {\n const { content, value, ...buttonProps } = choice;\n\n const isKeyOfKey =\n typeof value === 'string' || typeof value === 'number';\n\n const isSelected = value === valueState;\n\n return (\n <button\n {...buttonProps}\n className={cn(\n choiceVariant({\n size,\n })\n )}\n key={isKeyOfKey ? value : index}\n role=\"tab\"\n onClick={() => handleChange(value)}\n aria-selected={isSelected}\n disabled={isSelected}\n ref={(el) => {\n optionsRefs.current[index] = el!;\n }}\n >\n {content}\n </button>\n );\n })}\n {choiceIndicatorPosition && (\n <div\n className={cn(\n indicatorVariant({\n color,\n })\n )}\n style={choiceIndicatorPosition}\n ref={indicatorRef}\n />\n )}\n </div>\n </div>\n );\n};\n"],"names":["jsx","jsxs","value"],"mappings":";;;;;;;;;;;;;AAaA,MAAM,iBAAiD;AAAA,EACrD,EAAE,SAAS,OAAO,OAAO,MAAM;AAAA,EAC/B,EAAE,SAAS,MAAM,OAAO,KAAK;AAC/B;AAWA,MAAM,wBAAwB;AAAA,EAC5B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,OAAO;AAAA,QACL,SACE;AAAA,QACF,WACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,OAAO;AAAA,QACP,MAAM;AAAA,QACN,MAAM;AAAA,MAAA;AAAA,IAEV;AAAA,IACA,iBAAiB;AAAA,MACf,OAAO;AAAA,IAAA;AAAA,EACT;AAEJ;AAEA,MAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,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J,WAAW;AAAA,gBACT,cAAc;AAAA,kBACZ;AAAA,gBACD,CAAA;AAAA,cACH;AAAA,cACA,KAAK,aAAaA,SAAQ;AAAA,cAC1B,MAAK;AAAA,cACL,SAAS,MAAM,aAAaA,MAAK;AAAA,cACjC,iBAAe;AAAA,cACf,UAAU;AAAA,cACV,KAAK,CAAC,OAAO;AACC,4BAAA,QAAQ,KAAK,IAAI;AAAA,cAAA;AAAA,YAC/B;AAAA,YAEC;AAAA,UACH;AAAA,QAAA,CAEH;AAAA,QACA,2BACCF,kCAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAW;AAAA,cACT,iBAAiB;AAAA,gBACf;AAAA,cACD,CAAA;AAAA,YACH;AAAA,YACA,OAAO;AAAA,YACP,KAAK;AAAA,UAAA;AAAA,QAAA;AAAA,MACP,EAEJ,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TabSelector.cjs","sources":["../../../src/components/TabSelector/TabSelector.tsx"],"sourcesContent":["'use client';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n useRef,\n type HTMLAttributes,\n type ReactElement,\n cloneElement,\n} from 'react';\nimport { useItemSelector } from '../../hooks';\nimport { cn } from '../../utils/cn';\n\nconst tabSelectorVariant = cva(\n 'relative flex size-full flex-row items-center gap-2',\n {\n variants: {\n color: {\n primary:\n 'border-primary text-primary dark:border-primary-dark dark:text-primary-dark',\n secondary:\n 'border-secondary text-secondary dark:border-secondary-dark dark:text-secondary-dark',\n destructive:\n 'border-destructive bg-destructive text-destructive dark:border-destructive-dark dark:bg-destructive-dark',\n neutral:\n 'border-neutral text-neutral dark:border-neutral-dark dark:text-neutral-dark',\n light: 'border-white text-white',\n dark: 'border-neutral-800 text-neutral-800',\n text: 'border-text text-text dark:border-text-dark dark:text-text-dark',\n },\n },\n defaultVariants: {\n color: 'primary',\n },\n }\n);\n\nconst indicatorVariant = cva(\n 'absolute top-0 z-[-1] h-full w-auto rounded-lg transition-[left,width] duration-300 ease-in-out motion-reduce:transition-none',\n {\n variants: {\n color: {\n primary:\n 'bg-primary/10 aria-selected:text-text dark:bg-primary-dark/10 dark:aria-selected:text-text-dark',\n secondary:\n 'bg-secondary/10 aria-selected:text-text dark:bg-secondary-dark/10 dark:aria-selected:text-text-dark',\n destructive:\n 'bg-destructive/10 aria-selected:text-text dark:bg-destructive-dark/10 dark:aria-selected:text-text-dark',\n neutral:\n 'bg-neutral/10 aria-selected:text-white dark:bg-neutral-dark/10 dark:aria-selected:text-text',\n light: 'bg-white/10 aria-selected:text-black',\n dark: 'bg-neutral-800/10 aria-selected:text-white',\n text: 'bg-text/10 aria-selected:text-text-dark dark:bg-text-dark/10 dark:aria-selected:text-text',\n },\n },\n }\n);\n\nexport type TabProps = HTMLAttributes<HTMLElement> & {\n key: string | number;\n};\n\ntype TabSelectorProps<T extends TabProps> = {\n tabs: ReactElement<T>[];\n selectedChoice: T['key'];\n onTabClick?: (choice: T['key']) => void;\n hoverable?: boolean;\n} & HTMLAttributes<HTMLElement> &\n VariantProps<typeof tabSelectorVariant>;\n\n/**\n *\n * Component that allows the user to select one of the provided choices.\n *\n * Example:\n * ```jsx\n * <TabSelector\n * selectedChoice=\"option1\"\n * onTabClick={(choice) => console.log(choice)}\n * hoverable={true}\n * >\n * <Button key=\"option1\"/>\n * <Button key=\"option2\"/>\n * <Button key=\"option3\"/>\n * </TabSelector>\n * ```\n */\nexport const TabSelector = <T extends TabProps>({\n tabs,\n selectedChoice,\n onTabClick,\n color = 'primary',\n hoverable = false,\n className,\n}: TabSelectorProps<T>) => {\n const optionsRefs = useRef<HTMLElement[]>([]);\n const indicatorRef = useRef<HTMLDivElement | null>(null);\n const { choiceIndicatorPosition } = useItemSelector(\n optionsRefs,\n undefined,\n hoverable\n );\n\n return (\n <div\n className={cn(\n tabSelectorVariant({\n color,\n }),\n className\n )}\n aria-orientation=\"horizontal\"\n aria-multiselectable=\"false\"\n role=\"tablist\"\n >\n {tabs.map((Tab, index) => {\n const key = Tab.key!;\n\n const isSelected = selectedChoice === key;\n\n return cloneElement(Tab, {\n key: key ?? index,\n role: 'tab',\n onClick: () => onTabClick?.(key),\n 'aria-selected': isSelected,\n ref: (el: HTMLElement) => {\n optionsRefs.current[index] = el!;\n },\n } as unknown as T);\n })}\n {choiceIndicatorPosition && (\n <div\n className={indicatorVariant({\n color,\n })}\n style={choiceIndicatorPosition}\n ref={indicatorRef}\n key={`${selectedChoice}${JSON.stringify(tabs.map((tab) => tab.key))}`}\n />\n )}\n </div>\n );\n};\n"],"names":["cva","useRef","useItemSelector","jsxs","cn","cloneElement","jsx"],"mappings":";;;;;;;;;;;;;;;AAYA,MAAM,qBAAqBA,uBAAA;AAAA,EACzB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,OAAO;AAAA,QACL,SACE;AAAA,QACF,WACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,OAAO;AAAA,QACP,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,OAAO;AAAA,IACT;AAAA,EACF;AACF;AAEA,MAAM,mBAAmBA,uBAAA;AAAA,EACvB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,OAAO;AAAA,QACL,SACE;AAAA,QACF,WACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,OAAO;AAAA,QACP,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;AA+BO,MAAM,cAAc,CAAqB;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ;AACF,MAA2B;AACnB,QAAA,cAAcC,kBAAsB,CAAA,CAAE;AACtC,QAAA,eAAeA,kBAA8B,IAAI;AACjD,QAAA,EAAE,4BAA4BC,sBAAA;AAAA,IAClC;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAIA,SAAAC,2BAAA,kBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,SAAA;AAAA,QACT,mBAAmB;AAAA,UACjB;AAAA,QAAA,CACD;AAAA,QACD;AAAA,MACF;AAAA,MACA,oBAAiB;AAAA,MACjB,wBAAqB;AAAA,MACrB,MAAK;AAAA,MAEJ,UAAA;AAAA,QAAK,KAAA,IAAI,CAAC,KAAK,UAAU;AACxB,gBAAM,MAAM,IAAI;AAEhB,gBAAM,aAAa,mBAAmB;AAEtC,iBAAOC,WAAAA,aAAa,KAAK;AAAA,YACvB,KAAK,OAAO;AAAA,YACZ,MAAM;AAAA,YACN,SAAS,MAAM,aAAa,GAAG;AAAA,YAC/B,iBAAiB;AAAA,YACjB,KAAK,CAAC,OAAoB;AACZ,0BAAA,QAAQ,KAAK,IAAI;AAAA,YAC/B;AAAA,UAAA,CACe;AAAA,QAAA,CAClB;AAAA,QACA,2BACCC,2BAAA,kBAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAW,iBAAiB;AAAA,cAC1B;AAAA,YAAA,CACD;AAAA,YACD,OAAO;AAAA,YACP,KAAK;AAAA,UAAA;AAAA,UACA,GAAG,cAAc,GAAG,KAAK,UAAU,KAAK,IAAI,CAAC,QAAQ,IAAI,GAAG,CAAC,CAAC;AAAA,QACrE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;;"}
1
+ {"version":3,"file":"TabSelector.cjs","sources":["../../../src/components/TabSelector/TabSelector.tsx"],"sourcesContent":["'use client';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n useRef,\n type HTMLAttributes,\n type ReactElement,\n cloneElement,\n} from 'react';\nimport { useItemSelector } from '../../hooks';\nimport { cn } from '../../utils/cn';\n\nconst tabSelectorVariant = cva(\n 'relative flex size-full flex-row items-center gap-2',\n {\n variants: {\n color: {\n primary:\n 'border-primary text-primary dark:border-primary-dark dark:text-primary-dark',\n secondary:\n 'border-secondary text-secondary dark:border-secondary-dark dark:text-secondary-dark',\n destructive:\n 'border-destructive bg-destructive text-destructive dark:border-destructive-dark dark:bg-destructive-dark',\n neutral:\n 'border-neutral text-neutral dark:border-neutral-dark dark:text-neutral-dark',\n light: 'border-white text-white',\n dark: 'border-neutral-800 text-neutral-800',\n text: 'border-text text-text dark:border-text-dark dark:text-text-dark',\n },\n },\n defaultVariants: {\n color: 'primary',\n },\n }\n);\n\nconst indicatorVariant = cva(\n 'absolute top-0 z-[-1] h-full w-auto rounded-lg transition-[left,width] duration-300 ease-in-out motion-reduce:transition-none',\n {\n variants: {\n color: {\n primary:\n 'bg-primary/10 aria-selected:text-text dark:bg-primary-dark/10 dark:aria-selected:text-text-dark',\n secondary:\n 'bg-secondary/10 aria-selected:text-text dark:bg-secondary-dark/10 dark:aria-selected:text-text-dark',\n destructive:\n 'bg-destructive/10 aria-selected:text-text dark:bg-destructive-dark/10 dark:aria-selected:text-text-dark',\n neutral:\n 'bg-neutral/10 aria-selected:text-white dark:bg-neutral-dark/10 dark:aria-selected:text-text',\n light: 'bg-white/10 aria-selected:text-black',\n dark: 'bg-neutral-800/10 aria-selected:text-white',\n text: 'bg-text/10 aria-selected:text-text-dark dark:bg-text-dark/10 dark:aria-selected:text-text',\n },\n },\n }\n);\n\nexport type TabProps = HTMLAttributes<HTMLElement> & {\n key: string | number;\n};\n\ntype TabSelectorProps<T extends TabProps> = {\n tabs: ReactElement<T>[];\n selectedChoice: T['key'];\n onTabClick?: (choice: T['key']) => void;\n hoverable?: boolean;\n} & HTMLAttributes<HTMLElement> &\n VariantProps<typeof tabSelectorVariant>;\n\n/**\n *\n * Component that allows the user to select one of the provided choices.\n *\n * Example:\n * ```jsx\n * <TabSelector\n * selectedChoice=\"option1\"\n * onTabClick={(choice) => console.log(choice)}\n * hoverable={true}\n * >\n * <Button key=\"option1\"/>\n * <Button key=\"option2\"/>\n * <Button key=\"option3\"/>\n * </TabSelector>\n * ```\n */\nexport const TabSelector = <T extends TabProps>({\n tabs,\n selectedChoice,\n onTabClick,\n color = 'primary',\n hoverable = false,\n className,\n}: TabSelectorProps<T>) => {\n const optionsRefs = useRef<HTMLElement[]>([]);\n const indicatorRef = useRef<HTMLDivElement | null>(null);\n const { choiceIndicatorPosition } = useItemSelector(\n optionsRefs,\n undefined,\n hoverable\n );\n\n return (\n <div\n className={cn(\n tabSelectorVariant({\n color,\n }),\n className\n )}\n aria-orientation=\"horizontal\"\n aria-multiselectable=\"false\"\n role=\"tablist\"\n >\n {tabs.map((Tab, index) => {\n const key = Tab.key!;\n\n const isSelected = selectedChoice === key;\n\n return cloneElement(Tab, {\n key: key ?? index,\n role: 'tab',\n onClick: () => onTabClick?.(key),\n 'aria-selected': isSelected,\n ref: (el: HTMLElement) => {\n optionsRefs.current[index] = el!;\n },\n } as unknown as T);\n })}\n {choiceIndicatorPosition && (\n <div\n className={indicatorVariant({\n color,\n })}\n style={choiceIndicatorPosition}\n ref={indicatorRef}\n key={`${selectedChoice}${JSON.stringify(tabs.map((tab) => tab.key))}`}\n />\n )}\n </div>\n );\n};\n"],"names":["cva","useRef","useItemSelector","jsxs","cn","cloneElement","jsx"],"mappings":";;;;;;;;;;;;;;;AAYA,MAAM,qBAAqBA,uBAAA;AAAA,EACzB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,OAAO;AAAA,QACL,SACE;AAAA,QACF,WACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,OAAO;AAAA,QACP,MAAM;AAAA,QACN,MAAM;AAAA,MAAA;AAAA,IAEV;AAAA,IACA,iBAAiB;AAAA,MACf,OAAO;AAAA,IAAA;AAAA,EACT;AAEJ;AAEA,MAAM,mBAAmBA,uBAAA;AAAA,EACvB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,OAAO;AAAA,QACL,SACE;AAAA,QACF,WACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,OAAO;AAAA,QACP,MAAM;AAAA,QACN,MAAM;AAAA,MAAA;AAAA,IACR;AAAA,EACF;AAEJ;AA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client';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n useRef,\n type HTMLAttributes,\n type ReactElement,\n cloneElement,\n} from 'react';\nimport { useItemSelector } from '../../hooks';\nimport { cn } from '../../utils/cn';\n\nconst tabSelectorVariant = cva(\n 'relative flex size-full flex-row items-center gap-2',\n {\n variants: {\n color: {\n primary:\n 'border-primary text-primary dark:border-primary-dark dark:text-primary-dark',\n secondary:\n 'border-secondary text-secondary dark:border-secondary-dark dark:text-secondary-dark',\n destructive:\n 'border-destructive bg-destructive text-destructive dark:border-destructive-dark dark:bg-destructive-dark',\n neutral:\n 'border-neutral text-neutral dark:border-neutral-dark dark:text-neutral-dark',\n light: 'border-white text-white',\n dark: 'border-neutral-800 text-neutral-800',\n text: 'border-text text-text dark:border-text-dark dark:text-text-dark',\n },\n },\n defaultVariants: {\n color: 'primary',\n },\n }\n);\n\nconst indicatorVariant = cva(\n 'absolute top-0 z-[-1] h-full w-auto rounded-lg transition-[left,width] duration-300 ease-in-out motion-reduce:transition-none',\n {\n variants: {\n color: {\n primary:\n 'bg-primary/10 aria-selected:text-text dark:bg-primary-dark/10 dark:aria-selected:text-text-dark',\n secondary:\n 'bg-secondary/10 aria-selected:text-text dark:bg-secondary-dark/10 dark:aria-selected:text-text-dark',\n destructive:\n 'bg-destructive/10 aria-selected:text-text dark:bg-destructive-dark/10 dark:aria-selected:text-text-dark',\n neutral:\n 'bg-neutral/10 aria-selected:text-white dark:bg-neutral-dark/10 dark:aria-selected:text-text',\n light: 'bg-white/10 aria-selected:text-black',\n dark: 'bg-neutral-800/10 aria-selected:text-white',\n text: 'bg-text/10 aria-selected:text-text-dark dark:bg-text-dark/10 dark:aria-selected:text-text',\n },\n },\n }\n);\n\nexport type TabProps = HTMLAttributes<HTMLElement> & {\n key: string | number;\n};\n\ntype TabSelectorProps<T extends TabProps> = {\n tabs: ReactElement<T>[];\n selectedChoice: T['key'];\n onTabClick?: (choice: T['key']) => void;\n hoverable?: boolean;\n} & HTMLAttributes<HTMLElement> &\n VariantProps<typeof tabSelectorVariant>;\n\n/**\n *\n * Component that allows the user to select one of the provided choices.\n *\n * Example:\n * ```jsx\n * <TabSelector\n * selectedChoice=\"option1\"\n * onTabClick={(choice) => console.log(choice)}\n * hoverable={true}\n * >\n * <Button key=\"option1\"/>\n * <Button key=\"option2\"/>\n * <Button key=\"option3\"/>\n * </TabSelector>\n * ```\n */\nexport const TabSelector = <T extends TabProps>({\n tabs,\n selectedChoice,\n onTabClick,\n color = 'primary',\n hoverable = false,\n className,\n}: TabSelectorProps<T>) => {\n const optionsRefs = useRef<HTMLElement[]>([]);\n const indicatorRef = useRef<HTMLDivElement | null>(null);\n const { choiceIndicatorPosition } = useItemSelector(\n optionsRefs,\n undefined,\n hoverable\n );\n\n return (\n <div\n className={cn(\n tabSelectorVariant({\n color,\n }),\n className\n )}\n aria-orientation=\"horizontal\"\n aria-multiselectable=\"false\"\n role=\"tablist\"\n >\n {tabs.map((Tab, index) => {\n const key = Tab.key!;\n\n const isSelected = selectedChoice === key;\n\n return cloneElement(Tab, {\n key: key ?? index,\n role: 'tab',\n onClick: () => onTabClick?.(key),\n 'aria-selected': isSelected,\n ref: (el: HTMLElement) => {\n optionsRefs.current[index] = el!;\n },\n } as unknown as T);\n })}\n {choiceIndicatorPosition && (\n <div\n className={indicatorVariant({\n color,\n })}\n style={choiceIndicatorPosition}\n ref={indicatorRef}\n key={`${selectedChoice}${JSON.stringify(tabs.map((tab) => tab.key))}`}\n />\n )}\n </div>\n );\n};\n"],"names":["jsxs","jsx"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,qBAAqB;AAAA,EACzB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,OAAO;AAAA,QACL,SACE;AAAA,QACF,WACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,OAAO;AAAA,QACP,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,OAAO;AAAA,IACT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UAAU,KAAK,IAAI,CAAC,QAAQ,IAAI,GAAG,CAAC,CAAC;AAAA,QACrE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;"}
1
+ {"version":3,"file":"TabSelector.mjs","sources":["../../../src/components/TabSelector/TabSelector.tsx"],"sourcesContent":["'use client';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n useRef,\n type HTMLAttributes,\n type ReactElement,\n cloneElement,\n} from 'react';\nimport { useItemSelector } from '../../hooks';\nimport { cn } from '../../utils/cn';\n\nconst tabSelectorVariant = cva(\n 'relative flex size-full flex-row items-center gap-2',\n {\n variants: {\n color: {\n primary:\n 'border-primary text-primary dark:border-primary-dark dark:text-primary-dark',\n secondary:\n 'border-secondary text-secondary dark:border-secondary-dark dark:text-secondary-dark',\n destructive:\n 'border-destructive bg-destructive text-destructive dark:border-destructive-dark dark:bg-destructive-dark',\n neutral:\n 'border-neutral text-neutral dark:border-neutral-dark dark:text-neutral-dark',\n light: 'border-white text-white',\n dark: 'border-neutral-800 text-neutral-800',\n text: 'border-text text-text dark:border-text-dark dark:text-text-dark',\n },\n },\n defaultVariants: {\n color: 'primary',\n },\n }\n);\n\nconst indicatorVariant = cva(\n 'absolute top-0 z-[-1] h-full w-auto rounded-lg transition-[left,width] duration-300 ease-in-out motion-reduce:transition-none',\n {\n variants: {\n color: {\n primary:\n 'bg-primary/10 aria-selected:text-text dark:bg-primary-dark/10 dark:aria-selected:text-text-dark',\n secondary:\n 'bg-secondary/10 aria-selected:text-text dark:bg-secondary-dark/10 dark:aria-selected:text-text-dark',\n destructive:\n 'bg-destructive/10 aria-selected:text-text dark:bg-destructive-dark/10 dark:aria-selected:text-text-dark',\n neutral:\n 'bg-neutral/10 aria-selected:text-white dark:bg-neutral-dark/10 dark:aria-selected:text-text',\n light: 'bg-white/10 aria-selected:text-black',\n dark: 'bg-neutral-800/10 aria-selected:text-white',\n text: 'bg-text/10 aria-selected:text-text-dark dark:bg-text-dark/10 dark:aria-selected:text-text',\n },\n },\n }\n);\n\nexport type TabProps = HTMLAttributes<HTMLElement> & {\n key: string | number;\n};\n\ntype TabSelectorProps<T extends TabProps> = {\n tabs: ReactElement<T>[];\n selectedChoice: T['key'];\n onTabClick?: (choice: T['key']) => void;\n hoverable?: boolean;\n} & HTMLAttributes<HTMLElement> &\n VariantProps<typeof tabSelectorVariant>;\n\n/**\n *\n * Component that allows the user to select one of the provided choices.\n *\n * Example:\n * ```jsx\n * <TabSelector\n * selectedChoice=\"option1\"\n * onTabClick={(choice) => console.log(choice)}\n * hoverable={true}\n * >\n * <Button key=\"option1\"/>\n * <Button key=\"option2\"/>\n * <Button key=\"option3\"/>\n * </TabSelector>\n * ```\n */\nexport const TabSelector = <T extends TabProps>({\n tabs,\n selectedChoice,\n onTabClick,\n color = 'primary',\n hoverable = false,\n className,\n}: TabSelectorProps<T>) => {\n const optionsRefs = useRef<HTMLElement[]>([]);\n const indicatorRef = useRef<HTMLDivElement | null>(null);\n const { choiceIndicatorPosition } = useItemSelector(\n optionsRefs,\n undefined,\n hoverable\n );\n\n return (\n <div\n className={cn(\n tabSelectorVariant({\n color,\n }),\n className\n )}\n aria-orientation=\"horizontal\"\n aria-multiselectable=\"false\"\n role=\"tablist\"\n >\n {tabs.map((Tab, index) => {\n const key = Tab.key!;\n\n const isSelected = selectedChoice === key;\n\n return cloneElement(Tab, {\n key: key ?? index,\n role: 'tab',\n onClick: () => onTabClick?.(key),\n 'aria-selected': isSelected,\n ref: (el: HTMLElement) => {\n optionsRefs.current[index] = el!;\n },\n } as unknown as T);\n })}\n {choiceIndicatorPosition && (\n <div\n className={indicatorVariant({\n color,\n })}\n style={choiceIndicatorPosition}\n ref={indicatorRef}\n key={`${selectedChoice}${JSON.stringify(tabs.map((tab) => tab.key))}`}\n />\n )}\n </div>\n );\n};\n"],"names":["jsxs","jsx"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,qBAAqB;AAAA,EACzB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MAC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CAClB;AAAA,QACA,2BACCC,kCAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAW,iBAAiB;AAAA,cAC1B;AAAA,YAAA,CACD;AAAA,YACD,OAAO;AAAA,YACP,KAAK;AAAA,UAAA;AAAA,UACA,GAAG,cAAc,GAAG,KAAK,UAAU,KAAK,IAAI,CAAC,QAAQ,IAAI,GAAG,CAAC,CAAC;AAAA,QAAA;AAAA,MACrE;AAAA,IAAA;AAAA,EAEJ;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/components/Tag/index.tsx"],"sourcesContent":["import { cva, VariantProps } from 'class-variance-authority';\nimport { forwardRef, HTMLAttributes, PropsWithChildren } from 'react';\n\ntype TagProps = PropsWithChildren<VariantProps<typeof containerVariants>> &\n HTMLAttributes<HTMLDivElement>;\n\nconst containerVariants = cva('backdrop-blur w-fit', {\n variants: {\n roundedSize: {\n none: 'rounded-none',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-lg',\n xl: 'rounded-xl',\n '2xl': 'rounded-2xl',\n '3xl': 'rounded-3xl',\n full: 'rounded-full',\n },\n color: {\n success:\n 'bg-success/10 dark:bg-success-dark/10 border-success dark:border-success-dark text-success dark:text-success-dark',\n error:\n 'bg-error/10 dark:bg-error-dark/10 border-error dark:border-error-dark text-error dark:text-error-dark',\n warning:\n 'bg-warning/10 dark:bg-warning-dark/10 border-warning dark:border-warning-dark text-warning dark:text-warning-dark',\n neutral:\n 'bg-neutral/10 dark:bg-neutral-dark/10 border-neutral dark:border-neutral-dark text-neutral dark:text-neutral-dark',\n info: 'bg-info/10 dark:bg-info-dark/10 border-info dark:border-info-dark text-info dark:text-info-dark',\n text: 'bg-text/10 dark:bg-text-dark/10 border-text dark:border-text-dark text-text dark:text-text-dark',\n },\n size: {\n xs: 'py-0.5 px-2 text-xs border-[1.2px]',\n sm: 'py-0.5 px-2 text-sm border-[1.5px]',\n md: 'py-1 px-2 text-base border-2',\n lg: 'py-2 px-3 text-lg border-2',\n xl: 'py-4 px-5 text-xl border-2',\n },\n border: {\n none: 'border-none',\n with: 'border-text dark:border-text-dark border-[1.5px]',\n },\n background: {\n none: 'bg-none',\n with: '',\n },\n },\n\n defaultVariants: {\n roundedSize: 'full',\n border: 'none',\n color: 'text',\n size: 'md',\n },\n});\n\nexport const Tag = forwardRef<HTMLDivElement, TagProps>(\n (\n {\n children,\n color,\n roundedSize,\n size,\n border,\n background,\n className,\n ...props\n },\n ref\n ) => {\n return (\n <div\n ref={ref}\n className={containerVariants({\n color,\n roundedSize,\n size,\n border,\n background,\n className,\n })}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\n\nTag.displayName = 'Tag';\n"],"names":["cva","forwardRef","jsx"],"mappings":";;;;;AAMA,MAAM,oBAAoBA,2BAAI,uBAAuB;AAAA,EACnD,UAAU;AAAA,IACR,aAAa;AAAA,MACX,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,IACA,OAAO;AAAA,MACL,SACE;AAAA,MACF,OACE;AAAA,MACF,SACE;AAAA,MACF,SACE;AAAA,MACF,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IACN;AAAA,IACA,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,YAAY;AAAA,MACV,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EAEA,iBAAiB;AAAA,IACf,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AACF,CAAC;AAEM,MAAM,MAAMC,WAAA;AAAA,EACjB,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,KAEL,QACG;AAED,WAAAC,2BAAA,kBAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,kBAAkB;AAAA,UAC3B;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA,CACD;AAAA,QACA,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,IAAI,cAAc;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/Tag/index.tsx"],"sourcesContent":["import { cva, VariantProps } from 'class-variance-authority';\nimport { forwardRef, HTMLAttributes, PropsWithChildren } from 'react';\n\ntype TagProps = PropsWithChildren<VariantProps<typeof containerVariants>> &\n HTMLAttributes<HTMLDivElement>;\n\nconst containerVariants = cva('backdrop-blur w-fit', {\n variants: {\n roundedSize: {\n none: 'rounded-none',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-lg',\n xl: 'rounded-xl',\n '2xl': 'rounded-2xl',\n '3xl': 'rounded-3xl',\n full: 'rounded-full',\n },\n color: {\n success:\n 'bg-success/10 dark:bg-success-dark/10 border-success dark:border-success-dark text-success dark:text-success-dark',\n error:\n 'bg-error/10 dark:bg-error-dark/10 border-error dark:border-error-dark text-error dark:text-error-dark',\n warning:\n 'bg-warning/10 dark:bg-warning-dark/10 border-warning dark:border-warning-dark text-warning dark:text-warning-dark',\n neutral:\n 'bg-neutral/10 dark:bg-neutral-dark/10 border-neutral dark:border-neutral-dark text-neutral dark:text-neutral-dark',\n info: 'bg-info/10 dark:bg-info-dark/10 border-info dark:border-info-dark text-info dark:text-info-dark',\n text: 'bg-text/10 dark:bg-text-dark/10 border-text dark:border-text-dark text-text dark:text-text-dark',\n },\n size: {\n xs: 'py-0.5 px-2 text-xs border-[1.2px]',\n sm: 'py-0.5 px-2 text-sm border-[1.5px]',\n md: 'py-1 px-2 text-base border-2',\n lg: 'py-2 px-3 text-lg border-2',\n xl: 'py-4 px-5 text-xl border-2',\n },\n border: {\n none: 'border-none',\n with: 'border-text dark:border-text-dark border-[1.5px]',\n },\n background: {\n none: 'bg-none',\n with: '',\n },\n },\n\n defaultVariants: {\n roundedSize: 'full',\n border: 'none',\n color: 'text',\n size: 'md',\n },\n});\n\nexport const Tag = forwardRef<HTMLDivElement, TagProps>(\n (\n {\n children,\n color,\n roundedSize,\n size,\n border,\n background,\n className,\n ...props\n },\n ref\n ) => {\n return (\n <div\n ref={ref}\n className={containerVariants({\n color,\n roundedSize,\n size,\n border,\n background,\n className,\n })}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\n\nTag.displayName = 'Tag';\n"],"names":["cva","forwardRef","jsx"],"mappings":";;;;;AAMA,MAAM,oBAAoBA,2BAAI,uBAAuB;AAAA,EACnD,UAAU;AAAA,IACR,aAAa;AAAA,MACX,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,IACA,OAAO;AAAA,MACL,SACE;AAAA,MACF,OACE;AAAA,MACF,SACE;AAAA,MACF,SACE;AAAA,MACF,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IACN;AAAA,IACA,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,YAAY;AAAA,MACV,MAAM;AAAA,MACN,MAAM;AAAA,IAAA;AAAA,EAEV;AAAA,EAEA,iBAAiB;AAAA,IACf,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAEV,CAAC;AAEM,MAAM,MAAMC,WAAA;AAAA,EACjB,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,KAEL,QACG;AAED,WAAAC,2BAAA,kBAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,kBAAkB;AAAA,UAC3B;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA,CACD;AAAA,QACA,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IACH;AAAA,EAAA;AAGN;AAEA,IAAI,cAAc;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../src/components/Tag/index.tsx"],"sourcesContent":["import { cva, VariantProps } from 'class-variance-authority';\nimport { forwardRef, HTMLAttributes, PropsWithChildren } from 'react';\n\ntype TagProps = PropsWithChildren<VariantProps<typeof containerVariants>> &\n HTMLAttributes<HTMLDivElement>;\n\nconst containerVariants = cva('backdrop-blur w-fit', {\n variants: {\n roundedSize: {\n none: 'rounded-none',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-lg',\n xl: 'rounded-xl',\n '2xl': 'rounded-2xl',\n '3xl': 'rounded-3xl',\n full: 'rounded-full',\n },\n color: {\n success:\n 'bg-success/10 dark:bg-success-dark/10 border-success dark:border-success-dark text-success dark:text-success-dark',\n error:\n 'bg-error/10 dark:bg-error-dark/10 border-error dark:border-error-dark text-error dark:text-error-dark',\n warning:\n 'bg-warning/10 dark:bg-warning-dark/10 border-warning dark:border-warning-dark text-warning dark:text-warning-dark',\n neutral:\n 'bg-neutral/10 dark:bg-neutral-dark/10 border-neutral dark:border-neutral-dark text-neutral dark:text-neutral-dark',\n info: 'bg-info/10 dark:bg-info-dark/10 border-info dark:border-info-dark text-info dark:text-info-dark',\n text: 'bg-text/10 dark:bg-text-dark/10 border-text dark:border-text-dark text-text dark:text-text-dark',\n },\n size: {\n xs: 'py-0.5 px-2 text-xs border-[1.2px]',\n sm: 'py-0.5 px-2 text-sm border-[1.5px]',\n md: 'py-1 px-2 text-base border-2',\n lg: 'py-2 px-3 text-lg border-2',\n xl: 'py-4 px-5 text-xl border-2',\n },\n border: {\n none: 'border-none',\n with: 'border-text dark:border-text-dark border-[1.5px]',\n },\n background: {\n none: 'bg-none',\n with: '',\n },\n },\n\n defaultVariants: {\n roundedSize: 'full',\n border: 'none',\n color: 'text',\n size: 'md',\n },\n});\n\nexport const Tag = forwardRef<HTMLDivElement, TagProps>(\n (\n {\n children,\n color,\n roundedSize,\n size,\n border,\n background,\n className,\n ...props\n },\n ref\n ) => {\n return (\n <div\n ref={ref}\n className={containerVariants({\n color,\n roundedSize,\n size,\n border,\n background,\n className,\n })}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\n\nTag.displayName = 'Tag';\n"],"names":["jsx"],"mappings":";;;AAMA,MAAM,oBAAoB,IAAI,uBAAuB;AAAA,EACnD,UAAU;AAAA,IACR,aAAa;AAAA,MACX,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,IACA,OAAO;AAAA,MACL,SACE;AAAA,MACF,OACE;AAAA,MACF,SACE;AAAA,MACF,SACE;AAAA,MACF,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IACN;AAAA,IACA,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,YAAY;AAAA,MACV,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EAEA,iBAAiB;AAAA,IACf,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AACF,CAAC;AAEM,MAAM,MAAM;AAAA,EACjB,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,KAEL,QACG;AAED,WAAAA,kCAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,kBAAkB;AAAA,UAC3B;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA,CACD;AAAA,QACA,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,IAAI,cAAc;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../src/components/Tag/index.tsx"],"sourcesContent":["import { cva, VariantProps } from 'class-variance-authority';\nimport { forwardRef, HTMLAttributes, PropsWithChildren } from 'react';\n\ntype TagProps = PropsWithChildren<VariantProps<typeof containerVariants>> &\n HTMLAttributes<HTMLDivElement>;\n\nconst containerVariants = cva('backdrop-blur w-fit', {\n variants: {\n roundedSize: {\n none: 'rounded-none',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-lg',\n xl: 'rounded-xl',\n '2xl': 'rounded-2xl',\n '3xl': 'rounded-3xl',\n full: 'rounded-full',\n },\n color: {\n success:\n 'bg-success/10 dark:bg-success-dark/10 border-success dark:border-success-dark text-success dark:text-success-dark',\n error:\n 'bg-error/10 dark:bg-error-dark/10 border-error dark:border-error-dark text-error dark:text-error-dark',\n warning:\n 'bg-warning/10 dark:bg-warning-dark/10 border-warning dark:border-warning-dark text-warning dark:text-warning-dark',\n neutral:\n 'bg-neutral/10 dark:bg-neutral-dark/10 border-neutral dark:border-neutral-dark text-neutral dark:text-neutral-dark',\n info: 'bg-info/10 dark:bg-info-dark/10 border-info dark:border-info-dark text-info dark:text-info-dark',\n text: 'bg-text/10 dark:bg-text-dark/10 border-text dark:border-text-dark text-text dark:text-text-dark',\n },\n size: {\n xs: 'py-0.5 px-2 text-xs border-[1.2px]',\n sm: 'py-0.5 px-2 text-sm border-[1.5px]',\n md: 'py-1 px-2 text-base border-2',\n lg: 'py-2 px-3 text-lg border-2',\n xl: 'py-4 px-5 text-xl border-2',\n },\n border: {\n none: 'border-none',\n with: 'border-text dark:border-text-dark border-[1.5px]',\n },\n background: {\n none: 'bg-none',\n with: '',\n },\n },\n\n defaultVariants: {\n roundedSize: 'full',\n border: 'none',\n color: 'text',\n size: 'md',\n },\n});\n\nexport const Tag = forwardRef<HTMLDivElement, TagProps>(\n (\n {\n children,\n color,\n roundedSize,\n size,\n border,\n background,\n className,\n ...props\n },\n ref\n ) => {\n return (\n <div\n ref={ref}\n className={containerVariants({\n color,\n roundedSize,\n size,\n border,\n background,\n className,\n })}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\n\nTag.displayName = 'Tag';\n"],"names":["jsx"],"mappings":";;;AAMA,MAAM,oBAAoB,IAAI,uBAAuB;AAAA,EACnD,UAAU;AAAA,IACR,aAAa;AAAA,MACX,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,IACA,OAAO;AAAA,MACL,SACE;AAAA,MACF,OACE;AAAA,MACF,SACE;AAAA,MACF,SACE;AAAA,MACF,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IACN;AAAA,IACA,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,YAAY;AAAA,MACV,MAAM;AAAA,MACN,MAAM;AAAA,IAAA;AAAA,EAEV;AAAA,EAEA,iBAAiB;AAAA,IACf,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAEV,CAAC;AAEM,MAAM,MAAM;AAAA,EACjB,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,KAEL,QACG;AAED,WAAAA,kCAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,kBAAkB;AAAA,UAC3B;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA,CACD;AAAA,QACA,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IACH;AAAA,EAAA;AAGN;AAEA,IAAI,cAAc;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AutoSizeTextArea.cjs","sources":["../../../src/components/TextArea/AutoSizeTextArea.tsx"],"sourcesContent":["import {\n useRef,\n useEffect,\n type ChangeEventHandler,\n forwardRef,\n useImperativeHandle,\n useCallback,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { TextAreaProps, TextArea } from './TextArea';\n\nexport type AutoSizedTextAreaProps = TextAreaProps & {\n autoSize?: boolean;\n maxRows?: number;\n};\n\nconst LINE_HEIGHT = 24; // px\nconst LINE_PADDING = 12; // px\n\nexport const AutoSizedTextArea = forwardRef<\n HTMLTextAreaElement,\n AutoSizedTextAreaProps\n>(({ className, autoSize = true, onChange, maxRows = 999, ...props }, ref) => {\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n\n useImperativeHandle(ref, () => textAreaRef.current!);\n\n const adjustHeight = useCallback(() => {\n const textAreaEl = textAreaRef.current;\n\n if (!textAreaEl || !autoSize) return;\n\n const textAreaStyle = textAreaEl.style;\n\n // Reset height to get accurate scrollHeight\n textAreaStyle.height = 'auto';\n const scrollHeight = textAreaEl.scrollHeight;\n const maxHeight = LINE_HEIGHT * maxRows + LINE_PADDING;\n const minHeight = LINE_HEIGHT + LINE_PADDING;\n\n // Set the new height\n textAreaStyle.height =\n Math.max(Math.min(scrollHeight, maxHeight), minHeight) + 'px';\n }, [autoSize, maxRows]);\n\n useEffect(() => {\n adjustHeight();\n }, [props.value, props.defaultValue, adjustHeight]);\n\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = (e) => {\n onChange?.(e);\n adjustHeight();\n };\n\n const setRef = useCallback(\n (el: HTMLTextAreaElement | null) => {\n textAreaRef.current = el;\n if (el) {\n adjustHeight();\n }\n },\n [adjustHeight]\n );\n\n return (\n <TextArea\n ref={setRef}\n onChange={handleChange}\n className={cn(\n 'overflow-y-scroll',\n autoSize ? 'resize-none' : '',\n className\n )}\n {...props}\n />\n );\n});\n\nAutoSizedTextArea.displayName = 'AutoSizedTextArea';\n"],"names":["forwardRef","useRef","useImperativeHandle","useCallback","useEffect","jsx","TextArea","cn"],"mappings":";;;;;;AAgBA,MAAM,cAAc;AACpB,MAAM,eAAe;AAEd,MAAM,oBAAoBA,WAAA,WAG/B,CAAC,EAAE,WAAW,WAAW,MAAM,UAAU,UAAU,KAAK,GAAG,MAAA,GAAS,QAAQ;AACtE,QAAA,cAAcC,kBAAmC,IAAI;AAEvCC,aAAAA,oBAAA,KAAK,MAAM,YAAY,OAAQ;AAE7C,QAAA,eAAeC,WAAAA,YAAY,MAAM;AACrC,UAAM,aAAa,YAAY;AAE3B,QAAA,CAAC,cAAc,CAAC,SAAU;AAE9B,UAAM,gBAAgB,WAAW;AAGjC,kBAAc,SAAS;AACvB,UAAM,eAAe,WAAW;AAC1B,UAAA,YAAY,cAAc,UAAU;AAC1C,UAAM,YAAY,cAAc;AAGlB,kBAAA,SACZ,KAAK,IAAI,KAAK,IAAI,cAAc,SAAS,GAAG,SAAS,IAAI;AAAA,EAAA,GAC1D,CAAC,UAAU,OAAO,CAAC;AAEtBC,aAAAA,UAAU,MAAM;AACD;EAAA,GACZ,CAAC,MAAM,OAAO,MAAM,cAAc,YAAY,CAAC;AAE5C,QAAA,eAAwD,CAAC,MAAM;AACnE,eAAW,CAAC;AACC;EAAA;AAGf,QAAM,SAASD,WAAA;AAAA,IACb,CAAC,OAAmC;AAClC,kBAAY,UAAU;AACtB,UAAI,IAAI;AACO;MACf;AAAA,IACF;AAAA,IACA,CAAC,YAAY;AAAA,EAAA;AAIb,SAAAE,2BAAA,kBAAA;AAAA,IAACC,6BAAA;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,UAAU;AAAA,MACV,WAAWC,SAAA;AAAA,QACT;AAAA,QACA,WAAW,gBAAgB;AAAA,QAC3B;AAAA,MACF;AAAA,MACC,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;AAED,kBAAkB,cAAc;;"}
1
+ {"version":3,"file":"AutoSizeTextArea.cjs","sources":["../../../src/components/TextArea/AutoSizeTextArea.tsx"],"sourcesContent":["import {\n useRef,\n useEffect,\n type ChangeEventHandler,\n forwardRef,\n useImperativeHandle,\n useCallback,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { TextAreaProps, TextArea } from './TextArea';\n\nexport type AutoSizedTextAreaProps = TextAreaProps & {\n autoSize?: boolean;\n maxRows?: number;\n};\n\nconst LINE_HEIGHT = 24; // px\nconst LINE_PADDING = 12; // px\n\nexport const AutoSizedTextArea = forwardRef<\n HTMLTextAreaElement,\n AutoSizedTextAreaProps\n>(({ className, autoSize = true, onChange, maxRows = 999, ...props }, ref) => {\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n\n useImperativeHandle(ref, () => textAreaRef.current!);\n\n const adjustHeight = useCallback(() => {\n const textAreaEl = textAreaRef.current;\n\n if (!textAreaEl || !autoSize) return;\n\n const textAreaStyle = textAreaEl.style;\n\n // Reset height to get accurate scrollHeight\n textAreaStyle.height = 'auto';\n const scrollHeight = textAreaEl.scrollHeight;\n const maxHeight = LINE_HEIGHT * maxRows + LINE_PADDING;\n const minHeight = LINE_HEIGHT + LINE_PADDING;\n\n // Set the new height\n textAreaStyle.height =\n Math.max(Math.min(scrollHeight, maxHeight), minHeight) + 'px';\n }, [autoSize, maxRows]);\n\n useEffect(() => {\n adjustHeight();\n }, [props.value, props.defaultValue, adjustHeight]);\n\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = (e) => {\n onChange?.(e);\n adjustHeight();\n };\n\n const setRef = useCallback(\n (el: HTMLTextAreaElement | null) => {\n textAreaRef.current = el;\n if (el) {\n adjustHeight();\n }\n },\n [adjustHeight]\n );\n\n return (\n <TextArea\n ref={setRef}\n onChange={handleChange}\n className={cn(\n 'overflow-y-scroll',\n autoSize ? 'resize-none' : '',\n className\n )}\n {...props}\n />\n );\n});\n\nAutoSizedTextArea.displayName = 'AutoSizedTextArea';\n"],"names":["forwardRef","useRef","useImperativeHandle","useCallback","useEffect","jsx","TextArea","cn"],"mappings":";;;;;;AAgBA,MAAM,cAAc;AACpB,MAAM,eAAe;AAEd,MAAM,oBAAoBA,WAAA,WAG/B,CAAC,EAAE,WAAW,WAAW,MAAM,UAAU,UAAU,KAAK,GAAG,MAAA,GAAS,QAAQ;AACtE,QAAA,cAAcC,kBAAmC,IAAI;AAEvCC,aAAAA,oBAAA,KAAK,MAAM,YAAY,OAAQ;AAE7C,QAAA,eAAeC,WAAAA,YAAY,MAAM;AACrC,UAAM,aAAa,YAAY;AAE3B,QAAA,CAAC,cAAc,CAAC,SAAU;AAE9B,UAAM,gBAAgB,WAAW;AAGjC,kBAAc,SAAS;AACvB,UAAM,eAAe,WAAW;AAC1B,UAAA,YAAY,cAAc,UAAU;AAC1C,UAAM,YAAY,cAAc;AAGlB,kBAAA,SACZ,KAAK,IAAI,KAAK,IAAI,cAAc,SAAS,GAAG,SAAS,IAAI;AAAA,EAAA,GAC1D,CAAC,UAAU,OAAO,CAAC;AAEtBC,aAAAA,UAAU,MAAM;AACD,iBAAA;AAAA,EAAA,GACZ,CAAC,MAAM,OAAO,MAAM,cAAc,YAAY,CAAC;AAE5C,QAAA,eAAwD,CAAC,MAAM;AACnE,eAAW,CAAC;AACC,iBAAA;AAAA,EACf;AAEA,QAAM,SAASD,WAAA;AAAA,IACb,CAAC,OAAmC;AAClC,kBAAY,UAAU;AACtB,UAAI,IAAI;AACO,qBAAA;AAAA,MAAA;AAAA,IAEjB;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AAGE,SAAAE,2BAAA,kBAAA;AAAA,IAACC,6BAAA;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,UAAU;AAAA,MACV,WAAWC,SAAA;AAAA,QACT;AAAA,QACA,WAAW,gBAAgB;AAAA,QAC3B;AAAA,MACF;AAAA,MACC,GAAG;AAAA,IAAA;AAAA,EACN;AAEJ,CAAC;AAED,kBAAkB,cAAc;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AutoSizeTextArea.mjs","sources":["../../../src/components/TextArea/AutoSizeTextArea.tsx"],"sourcesContent":["import {\n useRef,\n useEffect,\n type ChangeEventHandler,\n forwardRef,\n useImperativeHandle,\n useCallback,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { TextAreaProps, TextArea } from './TextArea';\n\nexport type AutoSizedTextAreaProps = TextAreaProps & {\n autoSize?: boolean;\n maxRows?: number;\n};\n\nconst LINE_HEIGHT = 24; // px\nconst LINE_PADDING = 12; // px\n\nexport const AutoSizedTextArea = forwardRef<\n HTMLTextAreaElement,\n AutoSizedTextAreaProps\n>(({ className, autoSize = true, onChange, maxRows = 999, ...props }, ref) => {\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n\n useImperativeHandle(ref, () => textAreaRef.current!);\n\n const adjustHeight = useCallback(() => {\n const textAreaEl = textAreaRef.current;\n\n if (!textAreaEl || !autoSize) return;\n\n const textAreaStyle = textAreaEl.style;\n\n // Reset height to get accurate scrollHeight\n textAreaStyle.height = 'auto';\n const scrollHeight = textAreaEl.scrollHeight;\n const maxHeight = LINE_HEIGHT * maxRows + LINE_PADDING;\n const minHeight = LINE_HEIGHT + LINE_PADDING;\n\n // Set the new height\n textAreaStyle.height =\n Math.max(Math.min(scrollHeight, maxHeight), minHeight) + 'px';\n }, [autoSize, maxRows]);\n\n useEffect(() => {\n adjustHeight();\n }, [props.value, props.defaultValue, adjustHeight]);\n\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = (e) => {\n onChange?.(e);\n adjustHeight();\n };\n\n const setRef = useCallback(\n (el: HTMLTextAreaElement | null) => {\n textAreaRef.current = el;\n if (el) {\n adjustHeight();\n }\n },\n [adjustHeight]\n );\n\n return (\n <TextArea\n ref={setRef}\n onChange={handleChange}\n className={cn(\n 'overflow-y-scroll',\n autoSize ? 'resize-none' : '',\n className\n )}\n {...props}\n />\n );\n});\n\nAutoSizedTextArea.displayName = 'AutoSizedTextArea';\n"],"names":["jsx"],"mappings":";;;;AAgBA,MAAM,cAAc;AACpB,MAAM,eAAe;AAEd,MAAM,oBAAoB,WAG/B,CAAC,EAAE,WAAW,WAAW,MAAM,UAAU,UAAU,KAAK,GAAG,MAAA,GAAS,QAAQ;AACtE,QAAA,cAAc,OAAmC,IAAI;AAEvC,sBAAA,KAAK,MAAM,YAAY,OAAQ;AAE7C,QAAA,eAAe,YAAY,MAAM;AACrC,UAAM,aAAa,YAAY;AAE3B,QAAA,CAAC,cAAc,CAAC,SAAU;AAE9B,UAAM,gBAAgB,WAAW;AAGjC,kBAAc,SAAS;AACvB,UAAM,eAAe,WAAW;AAC1B,UAAA,YAAY,cAAc,UAAU;AAC1C,UAAM,YAAY,cAAc;AAGlB,kBAAA,SACZ,KAAK,IAAI,KAAK,IAAI,cAAc,SAAS,GAAG,SAAS,IAAI;AAAA,EAAA,GAC1D,CAAC,UAAU,OAAO,CAAC;AAEtB,YAAU,MAAM;AACD;EAAA,GACZ,CAAC,MAAM,OAAO,MAAM,cAAc,YAAY,CAAC;AAE5C,QAAA,eAAwD,CAAC,MAAM;AACnE,eAAW,CAAC;AACC;EAAA;AAGf,QAAM,SAAS;AAAA,IACb,CAAC,OAAmC;AAClC,kBAAY,UAAU;AACtB,UAAI,IAAI;AACO;MACf;AAAA,IACF;AAAA,IACA,CAAC,YAAY;AAAA,EAAA;AAIb,SAAAA,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,UAAU;AAAA,MACV,WAAW;AAAA,QACT;AAAA,QACA,WAAW,gBAAgB;AAAA,QAC3B;AAAA,MACF;AAAA,MACC,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;AAED,kBAAkB,cAAc;"}
1
+ {"version":3,"file":"AutoSizeTextArea.mjs","sources":["../../../src/components/TextArea/AutoSizeTextArea.tsx"],"sourcesContent":["import {\n useRef,\n useEffect,\n type ChangeEventHandler,\n forwardRef,\n useImperativeHandle,\n useCallback,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { TextAreaProps, TextArea } from './TextArea';\n\nexport type AutoSizedTextAreaProps = TextAreaProps & {\n autoSize?: boolean;\n maxRows?: number;\n};\n\nconst LINE_HEIGHT = 24; // px\nconst LINE_PADDING = 12; // px\n\nexport const AutoSizedTextArea = forwardRef<\n HTMLTextAreaElement,\n AutoSizedTextAreaProps\n>(({ className, autoSize = true, onChange, maxRows = 999, ...props }, ref) => {\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n\n useImperativeHandle(ref, () => textAreaRef.current!);\n\n const adjustHeight = useCallback(() => {\n const textAreaEl = textAreaRef.current;\n\n if (!textAreaEl || !autoSize) return;\n\n const textAreaStyle = textAreaEl.style;\n\n // Reset height to get accurate scrollHeight\n textAreaStyle.height = 'auto';\n const scrollHeight = textAreaEl.scrollHeight;\n const maxHeight = LINE_HEIGHT * maxRows + LINE_PADDING;\n const minHeight = LINE_HEIGHT + LINE_PADDING;\n\n // Set the new height\n textAreaStyle.height =\n Math.max(Math.min(scrollHeight, maxHeight), minHeight) + 'px';\n }, [autoSize, maxRows]);\n\n useEffect(() => {\n adjustHeight();\n }, [props.value, props.defaultValue, adjustHeight]);\n\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = (e) => {\n onChange?.(e);\n adjustHeight();\n };\n\n const setRef = useCallback(\n (el: HTMLTextAreaElement | null) => {\n textAreaRef.current = el;\n if (el) {\n adjustHeight();\n }\n },\n [adjustHeight]\n );\n\n return (\n <TextArea\n ref={setRef}\n onChange={handleChange}\n className={cn(\n 'overflow-y-scroll',\n autoSize ? 'resize-none' : '',\n className\n )}\n {...props}\n />\n );\n});\n\nAutoSizedTextArea.displayName = 'AutoSizedTextArea';\n"],"names":["jsx"],"mappings":";;;;AAgBA,MAAM,cAAc;AACpB,MAAM,eAAe;AAEd,MAAM,oBAAoB,WAG/B,CAAC,EAAE,WAAW,WAAW,MAAM,UAAU,UAAU,KAAK,GAAG,MAAA,GAAS,QAAQ;AACtE,QAAA,cAAc,OAAmC,IAAI;AAEvC,sBAAA,KAAK,MAAM,YAAY,OAAQ;AAE7C,QAAA,eAAe,YAAY,MAAM;AACrC,UAAM,aAAa,YAAY;AAE3B,QAAA,CAAC,cAAc,CAAC,SAAU;AAE9B,UAAM,gBAAgB,WAAW;AAGjC,kBAAc,SAAS;AACvB,UAAM,eAAe,WAAW;AAC1B,UAAA,YAAY,cAAc,UAAU;AAC1C,UAAM,YAAY,cAAc;AAGlB,kBAAA,SACZ,KAAK,IAAI,KAAK,IAAI,cAAc,SAAS,GAAG,SAAS,IAAI;AAAA,EAAA,GAC1D,CAAC,UAAU,OAAO,CAAC;AAEtB,YAAU,MAAM;AACD,iBAAA;AAAA,EAAA,GACZ,CAAC,MAAM,OAAO,MAAM,cAAc,YAAY,CAAC;AAE5C,QAAA,eAAwD,CAAC,MAAM;AACnE,eAAW,CAAC;AACC,iBAAA;AAAA,EACf;AAEA,QAAM,SAAS;AAAA,IACb,CAAC,OAAmC;AAClC,kBAAY,UAAU;AACtB,UAAI,IAAI;AACO,qBAAA;AAAA,MAAA;AAAA,IAEjB;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AAGE,SAAAA,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,UAAU;AAAA,MACV,WAAW;AAAA,QACT;AAAA,QACA,WAAW,gBAAgB;AAAA,QAC3B;AAAA,MACF;AAAA,MACC,GAAG;AAAA,IAAA;AAAA,EACN;AAEJ,CAAC;AAED,kBAAkB,cAAc;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.cjs","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import type { VariantProps } from 'class-variance-authority';\nimport {\n forwardRef,\n type TextareaHTMLAttributes,\n type DetailedHTMLProps,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { inputVariants } from '../Input';\n\nexport type TextAreaProps = DetailedHTMLProps<\n DetailedHTMLProps<\n TextareaHTMLAttributes<HTMLTextAreaElement>,\n HTMLTextAreaElement\n >,\n HTMLTextAreaElement\n> & {\n validationStyleEnabled?: boolean;\n} & Omit<VariantProps<typeof inputVariants>, 'validationStyleEnabled'>;\n\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n ({ className, variant, validationStyleEnabled = false, ...props }, ref) => (\n <textarea\n className={cn(\n 'resize-none',\n inputVariants({\n variant,\n validationStyleEnabled: validationStyleEnabled\n ? 'enabled'\n : 'disabled',\n className,\n })\n )}\n ref={ref}\n {...props}\n />\n )\n);\n\nTextArea.displayName = 'TextArea';\n"],"names":["forwardRef","jsx","cn","inputVariants"],"mappings":";;;;;;;;AAmBO,MAAM,WAAWA,WAAA;AAAA,EACtB,CAAC,EAAE,WAAW,SAAS,yBAAyB,OAAO,GAAG,MAAM,GAAG,QACjEC,2BAAA,kBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,SAAA;AAAA,QACT;AAAA,QACAC,qCAAc;AAAA,UACZ;AAAA,UACA,wBAAwB,yBACpB,YACA;AAAA,UACJ;AAAA,QAAA,CACD;AAAA,MACH;AAAA,MACA;AAAA,MACC,GAAG;AAAA,IAAA;AAAA,EACN;AAEJ;AAEA,SAAS,cAAc;;"}
1
+ {"version":3,"file":"TextArea.cjs","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import type { VariantProps } from 'class-variance-authority';\nimport {\n forwardRef,\n type TextareaHTMLAttributes,\n type DetailedHTMLProps,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { inputVariants } from '../Input';\n\nexport type TextAreaProps = DetailedHTMLProps<\n DetailedHTMLProps<\n TextareaHTMLAttributes<HTMLTextAreaElement>,\n HTMLTextAreaElement\n >,\n HTMLTextAreaElement\n> & {\n validationStyleEnabled?: boolean;\n} & Omit<VariantProps<typeof inputVariants>, 'validationStyleEnabled'>;\n\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n ({ className, variant, validationStyleEnabled = false, ...props }, ref) => (\n <textarea\n className={cn(\n 'resize-none',\n inputVariants({\n variant,\n validationStyleEnabled: validationStyleEnabled\n ? 'enabled'\n : 'disabled',\n className,\n })\n )}\n ref={ref}\n {...props}\n />\n )\n);\n\nTextArea.displayName = 'TextArea';\n"],"names":["forwardRef","jsx","cn","inputVariants"],"mappings":";;;;;;;;AAmBO,MAAM,WAAWA,WAAA;AAAA,EACtB,CAAC,EAAE,WAAW,SAAS,yBAAyB,OAAO,GAAG,MAAM,GAAG,QACjEC,2BAAA,kBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,SAAA;AAAA,QACT;AAAA,QACAC,qCAAc;AAAA,UACZ;AAAA,UACA,wBAAwB,yBACpB,YACA;AAAA,UACJ;AAAA,QACD,CAAA;AAAA,MACH;AAAA,MACA;AAAA,MACC,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;AAEA,SAAS,cAAc;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.mjs","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import type { VariantProps } from 'class-variance-authority';\nimport {\n forwardRef,\n type TextareaHTMLAttributes,\n type DetailedHTMLProps,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { inputVariants } from '../Input';\n\nexport type TextAreaProps = DetailedHTMLProps<\n DetailedHTMLProps<\n TextareaHTMLAttributes<HTMLTextAreaElement>,\n HTMLTextAreaElement\n >,\n HTMLTextAreaElement\n> & {\n validationStyleEnabled?: boolean;\n} & Omit<VariantProps<typeof inputVariants>, 'validationStyleEnabled'>;\n\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n ({ className, variant, validationStyleEnabled = false, ...props }, ref) => (\n <textarea\n className={cn(\n 'resize-none',\n inputVariants({\n variant,\n validationStyleEnabled: validationStyleEnabled\n ? 'enabled'\n : 'disabled',\n className,\n })\n )}\n ref={ref}\n {...props}\n />\n )\n);\n\nTextArea.displayName = 'TextArea';\n"],"names":["jsx"],"mappings":";;;;;;AAmBO,MAAM,WAAW;AAAA,EACtB,CAAC,EAAE,WAAW,SAAS,yBAAyB,OAAO,GAAG,MAAM,GAAG,QACjEA,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,cAAc;AAAA,UACZ;AAAA,UACA,wBAAwB,yBACpB,YACA;AAAA,UACJ;AAAA,QAAA,CACD;AAAA,MACH;AAAA,MACA;AAAA,MACC,GAAG;AAAA,IAAA;AAAA,EACN;AAEJ;AAEA,SAAS,cAAc;"}
1
+ {"version":3,"file":"TextArea.mjs","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import type { VariantProps } from 'class-variance-authority';\nimport {\n forwardRef,\n type TextareaHTMLAttributes,\n type DetailedHTMLProps,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { inputVariants } from '../Input';\n\nexport type TextAreaProps = DetailedHTMLProps<\n DetailedHTMLProps<\n TextareaHTMLAttributes<HTMLTextAreaElement>,\n HTMLTextAreaElement\n >,\n HTMLTextAreaElement\n> & {\n validationStyleEnabled?: boolean;\n} & Omit<VariantProps<typeof inputVariants>, 'validationStyleEnabled'>;\n\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n ({ className, variant, validationStyleEnabled = false, ...props }, ref) => (\n <textarea\n className={cn(\n 'resize-none',\n inputVariants({\n variant,\n validationStyleEnabled: validationStyleEnabled\n ? 'enabled'\n : 'disabled',\n className,\n })\n )}\n ref={ref}\n {...props}\n />\n )\n);\n\nTextArea.displayName = 'TextArea';\n"],"names":["jsx"],"mappings":";;;;;;AAmBO,MAAM,WAAW;AAAA,EACtB,CAAC,EAAE,WAAW,SAAS,yBAAyB,OAAO,GAAG,MAAM,GAAG,QACjEA,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,cAAc;AAAA,UACZ;AAAA,UACA,wBAAwB,yBACpB,YACA;AAAA,UACJ;AAAA,QACD,CAAA;AAAA,MACH;AAAA,MACA;AAAA,MACC,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;AAEA,SAAS,cAAc;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DesktopThemeSwitcher.cjs","sources":["../../../src/components/ThemeSwitcherDropDown/DesktopThemeSwitcher.tsx"],"sourcesContent":["'use client';\n\nimport { Moon, Sun, CircleDashed } from 'lucide-react';\nimport { useState, type FC } from 'react';\nimport { type ButtonProps, Button } from '../Button';\nimport { Container } from '../Container';\nimport { DropDown } from '../DropDown';\nimport { Modes } from './types';\n\nconst ButtonItem: FC<ButtonProps> = ({ Icon, children, ...props }) => (\n <div className=\"relative w-full p-0.5\">\n <Button\n className=\"hover:bg-text/10 focus:bg-text-opposite/20 dark:hover:bg-text-opposite/10 dark:focus:bg-text-opposite/20 w-full cursor-pointer rounded-lg p-1 text-left focus:outline-none disabled:text-white/25\"\n Icon={Icon}\n data-mode=\"system\"\n role=\"option\"\n variant=\"none\"\n {...props}\n >\n {children}\n </Button>\n </div>\n);\n\ntype DesktopThemeSwitcherProps = {\n theme: Modes;\n setTheme: (theme: Modes) => void;\n systemTheme: Modes;\n};\n\nexport const DesktopThemeSwitcher: FC<DesktopThemeSwitcherProps> = ({\n theme,\n setTheme,\n systemTheme,\n}) => {\n const isThemeSystemTheme = systemTheme === theme;\n const defaultMode = isThemeSystemTheme ? Modes.system : theme;\n\n const [mode, setMode] = useState<Modes>(defaultMode);\n\n const switchMode = (mode: Modes) => {\n if (mode === Modes.system) {\n setTheme(systemTheme ?? Modes.light);\n } else {\n setTheme(mode);\n }\n setMode(mode);\n };\n\n const panelIdentifier = 'theme-switcher';\n\n return (\n <DropDown identifier={panelIdentifier}>\n <DropDown.Trigger\n className=\"p-2\"\n identifier={panelIdentifier}\n aria-label=\"Theme selector\"\n >\n {mode === Modes.system && <CircleDashed data-mode=\"system\" />}\n {mode === Modes.light && <Sun data-mode=\"light\" />}\n {mode === Modes.dark && <Moon data-mode=\"dark\" />}\n </DropDown.Trigger>\n\n <DropDown.Panel identifier={panelIdentifier} isFocusable isOverable>\n <Container className=\"min-w-[100px] items-start p-1\" separator=\"y\">\n <ButtonItem\n Icon={CircleDashed}\n onClick={() => switchMode(Modes.system)}\n isActive={mode === Modes.system}\n label=\"Restore to system mode\"\n >\n System\n </ButtonItem>\n <ButtonItem\n Icon={Sun}\n onClick={() => switchMode(Modes.light)}\n isActive={mode === Modes.light}\n label=\"Switch to light mode\"\n >\n Light\n </ButtonItem>\n <ButtonItem\n Icon={Moon}\n onClick={() => switchMode(Modes.dark)}\n isActive={mode === Modes.dark}\n label=\"Switch to dark mode\"\n >\n Dark\n </ButtonItem>\n </Container>\n </DropDown.Panel>\n </DropDown>\n );\n};\n"],"names":["jsx","Button","Modes","useState","mode","jsxs","DropDown","CircleDashed","Sun","Moon","Container"],"mappings":";;;;;;;;;;AASA,MAAM,aAA8B,CAAC,EAAE,MAAM,UAAU,GAAG,MAAA,MACxDA,2BAAA,kBAAA,IAAC,OAAI,EAAA,WAAU,yBACb,UAAAA,2BAAA,kBAAA;AAAA,EAACC,yBAAA;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV;AAAA,IACA,aAAU;AAAA,IACV,MAAK;AAAA,IACL,SAAQ;AAAA,IACP,GAAG;AAAA,IAEH;AAAA,EAAA;AACH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M,MAAM;AAAA,UACtC,UAAU,SAASA,uCAAAA,MAAM;AAAA,UACzB,OAAM;AAAA,UACP,UAAA;AAAA,QAAA;AAAA,MAED;AAAA,MACAF,2BAAA,kBAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAMQ,YAAA;AAAA,UACN,SAAS,MAAM,WAAWN,uCAAA,MAAM,KAAK;AAAA,UACrC,UAAU,SAASA,uCAAAA,MAAM;AAAA,UACzB,OAAM;AAAA,UACP,UAAA;AAAA,QAAA;AAAA,MAED;AAAA,MACAF,2BAAA,kBAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAMS,YAAA;AAAA,UACN,SAAS,MAAM,WAAWP,uCAAA,MAAM,IAAI;AAAA,UACpC,UAAU,SAASA,uCAAAA,MAAM;AAAA,UACzB,OAAM;AAAA,UACP,UAAA;AAAA,QAAA;AAAA,MAED;AAAA,IAAA,EAAA,CACF,EACF,CAAA;AAAA,EACF,EAAA,CAAA;AAEJ;;"}
1
+ {"version":3,"file":"DesktopThemeSwitcher.cjs","sources":["../../../src/components/ThemeSwitcherDropDown/DesktopThemeSwitcher.tsx"],"sourcesContent":["'use client';\n\nimport { Moon, Sun, CircleDashed } from 'lucide-react';\nimport { useState, type FC } from 'react';\nimport { type ButtonProps, Button } from '../Button';\nimport { Container } from '../Container';\nimport { DropDown } from '../DropDown';\nimport { Modes } from './types';\n\nconst ButtonItem: FC<ButtonProps> = ({ Icon, children, ...props }) => (\n <div className=\"relative w-full p-0.5\">\n <Button\n className=\"hover:bg-text/10 focus:bg-text-opposite/20 dark:hover:bg-text-opposite/10 dark:focus:bg-text-opposite/20 w-full cursor-pointer rounded-lg p-1 text-left focus:outline-none disabled:text-white/25\"\n Icon={Icon}\n data-mode=\"system\"\n role=\"option\"\n variant=\"none\"\n {...props}\n >\n {children}\n </Button>\n </div>\n);\n\ntype DesktopThemeSwitcherProps = {\n theme: Modes;\n setTheme: (theme: Modes) => void;\n systemTheme: Modes;\n};\n\nexport const DesktopThemeSwitcher: FC<DesktopThemeSwitcherProps> = ({\n theme,\n setTheme,\n systemTheme,\n}) => {\n const isThemeSystemTheme = systemTheme === theme;\n const defaultMode = isThemeSystemTheme ? Modes.system : theme;\n\n const [mode, setMode] = useState<Modes>(defaultMode);\n\n const switchMode = (mode: Modes) => {\n if (mode === Modes.system) {\n setTheme(systemTheme ?? Modes.light);\n } else {\n setTheme(mode);\n }\n setMode(mode);\n };\n\n const panelIdentifier = 'theme-switcher';\n\n return (\n <DropDown identifier={panelIdentifier}>\n <DropDown.Trigger\n className=\"p-2\"\n identifier={panelIdentifier}\n aria-label=\"Theme selector\"\n >\n {mode === Modes.system && <CircleDashed data-mode=\"system\" />}\n {mode === Modes.light && <Sun data-mode=\"light\" />}\n {mode === Modes.dark && <Moon data-mode=\"dark\" />}\n </DropDown.Trigger>\n\n <DropDown.Panel identifier={panelIdentifier} isFocusable isOverable>\n <Container className=\"min-w-[100px] items-start p-1\" separator=\"y\">\n <ButtonItem\n Icon={CircleDashed}\n onClick={() => switchMode(Modes.system)}\n isActive={mode === Modes.system}\n label=\"Restore to system mode\"\n >\n System\n </ButtonItem>\n <ButtonItem\n Icon={Sun}\n onClick={() => switchMode(Modes.light)}\n isActive={mode === Modes.light}\n label=\"Switch to light mode\"\n >\n Light\n </ButtonItem>\n <ButtonItem\n Icon={Moon}\n onClick={() => switchMode(Modes.dark)}\n isActive={mode === Modes.dark}\n label=\"Switch to dark mode\"\n >\n Dark\n </ButtonItem>\n </Container>\n </DropDown.Panel>\n </DropDown>\n );\n};\n"],"names":["jsx","Button","Modes","useState","mode","jsxs","DropDown","CircleDashed","Sun","Moon","Container"],"mappings":";;;;;;;;;;AASA,MAAM,aAA8B,CAAC,EAAE,MAAM,UAAU,GAAG,MAAA,MACxDA,2BAAA,kBAAA,IAAC,OAAI,EAAA,WAAU,yBACb,UAAAA,2BAAA,kBAAA;AAAA,EAACC,yBAAA;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV;AAAA,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2BAAA,kBAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAMO,YAAA;AAAA,UACN,SAAS,MAAM,WAAWL,uCAAA,MAAM,MAAM;AAAA,UACtC,UAAU,SAASA,uCAAAA,MAAM;AAAA,UACzB,OAAM;AAAA,UACP,UAAA;AAAA,QAAA;AAAA,MAED;AAAA,MACAF,2BAAA,kBAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAMQ,YAAA;AAAA,UACN,SAAS,MAAM,WAAWN,uCAAA,MAAM,KAAK;AAAA,UACrC,UAAU,SAASA,uCAAAA,MAAM;AAAA,UACzB,OAAM;AAAA,UACP,UAAA;AAAA,QAAA;AAAA,MAED;AAAA,MACAF,2BAAA,kBAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAMS,YAAA;AAAA,UACN,SAAS,MAAM,WAAWP,uCAAA,MAAM,IAAI;AAAA,UACpC,UAAU,SAASA,uCAAAA,MAAM;AAAA,UACzB,OAAM;AAAA,UACP,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAED,EAAA,CACF,EACF,CAAA;AAAA,EAAA,GACF;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DesktopThemeSwitcher.mjs","sources":["../../../src/components/ThemeSwitcherDropDown/DesktopThemeSwitcher.tsx"],"sourcesContent":["'use client';\n\nimport { Moon, Sun, CircleDashed } from 'lucide-react';\nimport { useState, type FC } from 'react';\nimport { type ButtonProps, Button } from '../Button';\nimport { Container } from '../Container';\nimport { DropDown } from '../DropDown';\nimport { Modes } from './types';\n\nconst ButtonItem: FC<ButtonProps> = ({ Icon, children, ...props }) => (\n <div className=\"relative w-full p-0.5\">\n <Button\n className=\"hover:bg-text/10 focus:bg-text-opposite/20 dark:hover:bg-text-opposite/10 dark:focus:bg-text-opposite/20 w-full cursor-pointer rounded-lg p-1 text-left focus:outline-none disabled:text-white/25\"\n Icon={Icon}\n data-mode=\"system\"\n role=\"option\"\n variant=\"none\"\n {...props}\n >\n {children}\n </Button>\n </div>\n);\n\ntype DesktopThemeSwitcherProps = {\n theme: Modes;\n setTheme: (theme: Modes) => void;\n systemTheme: Modes;\n};\n\nexport const DesktopThemeSwitcher: FC<DesktopThemeSwitcherProps> = ({\n theme,\n setTheme,\n systemTheme,\n}) => {\n const isThemeSystemTheme = systemTheme === theme;\n const defaultMode = isThemeSystemTheme ? Modes.system : theme;\n\n const [mode, setMode] = useState<Modes>(defaultMode);\n\n const switchMode = (mode: Modes) => {\n if (mode === Modes.system) {\n setTheme(systemTheme ?? Modes.light);\n } else {\n setTheme(mode);\n }\n setMode(mode);\n };\n\n const panelIdentifier = 'theme-switcher';\n\n return (\n <DropDown identifier={panelIdentifier}>\n <DropDown.Trigger\n className=\"p-2\"\n identifier={panelIdentifier}\n aria-label=\"Theme selector\"\n >\n {mode === Modes.system && <CircleDashed data-mode=\"system\" />}\n {mode === Modes.light && <Sun data-mode=\"light\" />}\n {mode === Modes.dark && <Moon data-mode=\"dark\" />}\n </DropDown.Trigger>\n\n <DropDown.Panel identifier={panelIdentifier} isFocusable isOverable>\n <Container className=\"min-w-[100px] items-start p-1\" separator=\"y\">\n <ButtonItem\n Icon={CircleDashed}\n onClick={() => switchMode(Modes.system)}\n isActive={mode === Modes.system}\n label=\"Restore to system mode\"\n >\n System\n </ButtonItem>\n <ButtonItem\n Icon={Sun}\n onClick={() => switchMode(Modes.light)}\n isActive={mode === Modes.light}\n label=\"Switch to light mode\"\n >\n Light\n </ButtonItem>\n <ButtonItem\n Icon={Moon}\n onClick={() => switchMode(Modes.dark)}\n isActive={mode === Modes.dark}\n label=\"Switch to dark mode\"\n >\n Dark\n </ButtonItem>\n </Container>\n </DropDown.Panel>\n </DropDown>\n );\n};\n"],"names":["jsx","mode","jsxs"],"mappings":";;;;;;;;AASA,MAAM,aAA8B,CAAC,EAAE,MAAM,UAAU,GAAG,MAAA,MACxDA,kCAAA,IAAC,OAAI,EAAA,WAAU,yBACb,UAAAA,kCAAA;AAAA,EAAC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MAAM;AAAA,UACzB,OAAM;AAAA,UACP,UAAA;AAAA,QAAA;AAAA,MAED;AAAA,MACAA,kCAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAM;AAAA,UACN,SAAS,MAAM,WAAW,MAAM,KAAK;AAAA,UACrC,UAAU,SAAS,MAAM;AAAA,UACzB,OAAM;AAAA,UACP,UAAA;AAAA,QAAA;AAAA,MAED;AAAA,MACAA,kCAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAM;AAAA,UACN,SAAS,MAAM,WAAW,MAAM,IAAI;AAAA,UACpC,UAAU,SAAS,MAAM;AAAA,UACzB,OAAM;AAAA,UACP,UAAA;AAAA,QAAA;AAAA,MAED;AAAA,IAAA,EAAA,CACF,EACF,CAAA;AAAA,EACF,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"DesktopThemeSwitcher.mjs","sources":["../../../src/components/ThemeSwitcherDropDown/DesktopThemeSwitcher.tsx"],"sourcesContent":["'use client';\n\nimport { Moon, Sun, CircleDashed } from 'lucide-react';\nimport { useState, type FC } from 'react';\nimport { type ButtonProps, Button } from '../Button';\nimport { Container } from '../Container';\nimport { DropDown } from '../DropDown';\nimport { Modes } from './types';\n\nconst ButtonItem: FC<ButtonProps> = ({ Icon, children, ...props }) => (\n <div className=\"relative w-full p-0.5\">\n <Button\n className=\"hover:bg-text/10 focus:bg-text-opposite/20 dark:hover:bg-text-opposite/10 dark:focus:bg-text-opposite/20 w-full cursor-pointer rounded-lg p-1 text-left focus:outline-none disabled:text-white/25\"\n Icon={Icon}\n data-mode=\"system\"\n role=\"option\"\n variant=\"none\"\n {...props}\n >\n {children}\n </Button>\n </div>\n);\n\ntype DesktopThemeSwitcherProps = {\n theme: Modes;\n setTheme: (theme: Modes) => void;\n systemTheme: Modes;\n};\n\nexport const DesktopThemeSwitcher: FC<DesktopThemeSwitcherProps> = ({\n theme,\n setTheme,\n systemTheme,\n}) => {\n const isThemeSystemTheme = systemTheme === theme;\n const defaultMode = isThemeSystemTheme ? Modes.system : theme;\n\n const [mode, setMode] = useState<Modes>(defaultMode);\n\n const switchMode = (mode: Modes) => {\n if (mode === Modes.system) {\n setTheme(systemTheme ?? Modes.light);\n } else {\n setTheme(mode);\n }\n setMode(mode);\n };\n\n const panelIdentifier = 'theme-switcher';\n\n return (\n <DropDown identifier={panelIdentifier}>\n <DropDown.Trigger\n className=\"p-2\"\n identifier={panelIdentifier}\n aria-label=\"Theme selector\"\n >\n {mode === Modes.system && <CircleDashed data-mode=\"system\" />}\n {mode === Modes.light && <Sun data-mode=\"light\" />}\n {mode === Modes.dark && <Moon data-mode=\"dark\" />}\n </DropDown.Trigger>\n\n <DropDown.Panel identifier={panelIdentifier} isFocusable isOverable>\n <Container className=\"min-w-[100px] items-start p-1\" separator=\"y\">\n <ButtonItem\n Icon={CircleDashed}\n onClick={() => switchMode(Modes.system)}\n isActive={mode === Modes.system}\n label=\"Restore to system mode\"\n >\n System\n </ButtonItem>\n <ButtonItem\n Icon={Sun}\n onClick={() => switchMode(Modes.light)}\n isActive={mode === Modes.light}\n label=\"Switch to light mode\"\n >\n Light\n </ButtonItem>\n <ButtonItem\n Icon={Moon}\n onClick={() => switchMode(Modes.dark)}\n isActive={mode === Modes.dark}\n label=\"Switch to dark mode\"\n >\n Dark\n </ButtonItem>\n </Container>\n </DropDown.Panel>\n </DropDown>\n );\n};\n"],"names":["jsx","mode","jsxs"],"mappings":";;;;;;;;AASA,MAAM,aAA8B,CAAC,EAAE,MAAM,UAAU,GAAG,MAAA,MACxDA,kCAAA,IAAC,OAAI,EAAA,WAAU,yBACb,UAAAA,kCAAA;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV;AAAA,IACA,aAAU;AAAA,IACV,MAAK;AAAA,IACL,SAAQ;AAAA,IACP,GAAG;AAAA,IAEH;AAAA,EAAA;AACH,GACF;AASK,MAAM,uBAAsD,CAAC;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ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AA,UACP,UAAA;AAAA,QAAA;AAAA,MAED;AAAA,MACAA,kCAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAM;AAAA,UACN,SAAS,MAAM,WAAW,MAAM,IAAI;AAAA,UACpC,UAAU,SAAS,MAAM;AAAA,UACzB,OAAM;AAAA,UACP,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAED,EAAA,CACF,EACF,CAAA;AAAA,EAAA,GACF;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MobileThemeSwitcher.cjs","sources":["../../../src/components/ThemeSwitcherDropDown/MobileThemeSwitcher.tsx"],"sourcesContent":["/* eslint-disable sonarjs/no-nested-conditional */\n'use client';\n\nimport { Moon, Sun, CircleDashed } from 'lucide-react';\nimport { useState, type FC } from 'react';\nimport { cn } from '../../utils/cn';\nimport { Modes } from './types';\n\ntype MobileThemeSwitcherProps = {\n theme: Modes;\n systemTheme: Modes;\n setTheme: (theme: Modes) => void;\n};\n\nconst getIconStyle = ({\n isCurrentMode,\n isNextMode,\n}: {\n isCurrentMode: boolean;\n isNextMode: boolean;\n}) =>\n cn(\n `absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2`,\n `opacity-0 transition-opacity duration-300 ease-in-out`,\n isCurrentMode && `opacity-100 group-hover:opacity-0`,\n isNextMode && `group-hover:opacity-100`\n );\n\nexport const MobileThemeSwitcher: FC<MobileThemeSwitcherProps> = ({\n theme,\n systemTheme,\n setTheme,\n}) => {\n const isThemeSystemTheme = systemTheme === theme;\n const defaultMode = isThemeSystemTheme ? Modes.system : theme;\n\n const [mode, setMode] = useState<Modes>(defaultMode);\n\n const nextMode =\n // Start loop\n // If mode is system, toggle the theme inverse of the system theme\n mode === Modes.system\n ? theme === Modes.dark\n ? Modes.light\n : Modes.dark\n : // Close loop\n // If current theme same as system theme, reset by toggle the system theme\n isThemeSystemTheme\n ? Modes.system\n : // Go to next step\n // Otherwise, toggle the remaining theme\n mode === Modes.light\n ? Modes.dark\n : Modes.light;\n\n const toggleMode = () => {\n if (nextMode === Modes.system) {\n setTheme(systemTheme ?? Modes.light);\n } else {\n setTheme(nextMode);\n }\n setMode(nextMode);\n };\n\n return (\n <button className=\"group relative size-10\" aria-label=\"Theme selector\">\n <CircleDashed\n className={getIconStyle({\n isCurrentMode: mode === Modes.system,\n isNextMode: nextMode === Modes.system,\n })}\n onClick={toggleMode}\n data-mode=\"system\"\n />\n\n <Moon\n className={getIconStyle({\n isCurrentMode: mode === Modes.light,\n isNextMode: nextMode === Modes.light,\n })}\n onClick={toggleMode}\n data-mode=\"light\"\n />\n\n <Sun\n className={getIconStyle({\n isCurrentMode: mode === Modes.dark,\n isNextMode: nextMode === Modes.dark,\n })}\n onClick={toggleMode}\n data-mode=\"dark\"\n />\n </button>\n );\n};\n"],"names":["cn","Modes","useState","jsxs","jsx","CircleDashed","Moon","Sun"],"mappings":";;;;;;;;AAcA,MAAM,eAAe,CAAC;AAAA,EACpB;AAAA,EACA;AACF,MAIEA,SAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB,cAAc;AAChB;AAEK,MAAM,sBAAoD,CAAC;AAAA,EAChE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,qBAAqB,gBAAgB;AACrC,QAAA,cAAc,qBAAqBC,6CAAM,SAAS;AAExD,QAAM,CAAC,MAAM,OAAO,IAAIC,oBAAgB,WAAW;AAE7C,QAAA;AAAA;AAAA;AAAA,IAGJ,SAASD,uCAAAA,MAAM,SACX,UAAUA,uCAAAA,MAAM,OACdA,uCAAA,MAAM,QACNA,uCAAAA,MAAM;AAAA;AAAA;AAAA,MAGR,qBACEA,uCAAM,MAAA;AAAA;AAAA;AAAA,QAGN,SAASA,uCAAA,MAAM,QACbA,uCAAA,MAAM,OACNA,uCAAM,MAAA;AAAA;AAAA;AAAA;AAEhB,QAAM,aAAa,MAAM;AACnB,QAAA,aAAaA,6CAAM,QAAQ;AACpB,eAAA,eAAeA,6CAAM,KAAK;AAAA,IAAA,OAC9B;AACL,eAAS,QAAQ;AAAA,IACnB;AACA,YAAQ,QAAQ;AAAA,EAAA;AAGlB,SACGE,2BAAAA,kBAAAA,KAAA,UAAA,EAAO,WAAU,0BAAyB,cAAW,kBACpD,UAAA;AAAA,IAAAC,2BAAA,kBAAA;AAAA,MAACC,YAAA;AAAA,MAAA;AAAA,QACC,WAAW,aAAa;AAAA,UACtB,eAAe,SAASJ,uCAAAA,MAAM;AAAA,UAC9B,YAAY,aAAaA,uCAAAA,MAAM;AAAA,QAAA,CAChC;AAAA,QACD,SAAS;AAAA,QACT,aAAU;AAAA,MAAA;AAAA,IACZ;AAAA,IAEAG,2BAAA,kBAAA;AAAA,MAACE,YAAA;AAAA,MAAA;AAAA,QACC,WAAW,aAAa;AAAA,UACtB,eAAe,SAASL,uCAAAA,MAAM;AAAA,UAC9B,YAAY,aAAaA,uCAAAA,MAAM;AAAA,QAAA,CAChC;AAAA,QACD,SAAS;AAAA,QACT,aAAU;AAAA,MAAA;AAAA,IACZ;AAAA,IAEAG,2BAAA,kBAAA;AAAA,MAACG,YAAA;AAAA,MAAA;AAAA,QACC,WAAW,aAAa;AAAA,UACtB,eAAe,SAASN,uCAAAA,MAAM;AAAA,UAC9B,YAAY,aAAaA,uCAAAA,MAAM;AAAA,QAAA,CAChC;AAAA,QACD,SAAS;AAAA,QACT,aAAU;AAAA,MAAA;AAAA,IACZ;AAAA,EACF,EAAA,CAAA;AAEJ;;"}
1
+ {"version":3,"file":"MobileThemeSwitcher.cjs","sources":["../../../src/components/ThemeSwitcherDropDown/MobileThemeSwitcher.tsx"],"sourcesContent":["/* eslint-disable sonarjs/no-nested-conditional */\n'use client';\n\nimport { Moon, Sun, CircleDashed } from 'lucide-react';\nimport { useState, type FC } from 'react';\nimport { cn } from '../../utils/cn';\nimport { Modes } from './types';\n\ntype MobileThemeSwitcherProps = {\n theme: Modes;\n systemTheme: Modes;\n setTheme: (theme: Modes) => void;\n};\n\nconst getIconStyle = ({\n isCurrentMode,\n isNextMode,\n}: {\n isCurrentMode: boolean;\n isNextMode: boolean;\n}) =>\n cn(\n `absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2`,\n `opacity-0 transition-opacity duration-300 ease-in-out`,\n isCurrentMode && `opacity-100 group-hover:opacity-0`,\n isNextMode && `group-hover:opacity-100`\n );\n\nexport const MobileThemeSwitcher: FC<MobileThemeSwitcherProps> = ({\n theme,\n systemTheme,\n setTheme,\n}) => {\n const isThemeSystemTheme = systemTheme === theme;\n const defaultMode = isThemeSystemTheme ? Modes.system : theme;\n\n const [mode, setMode] = useState<Modes>(defaultMode);\n\n const nextMode =\n // Start loop\n // If mode is system, toggle the theme inverse of the system theme\n mode === Modes.system\n ? theme === Modes.dark\n ? Modes.light\n : Modes.dark\n : // Close loop\n // If current theme same as system theme, reset by toggle the system theme\n isThemeSystemTheme\n ? Modes.system\n : // Go to next step\n // Otherwise, toggle the remaining theme\n mode === Modes.light\n ? Modes.dark\n : Modes.light;\n\n const toggleMode = () => {\n if (nextMode === Modes.system) {\n setTheme(systemTheme ?? Modes.light);\n } else {\n setTheme(nextMode);\n }\n setMode(nextMode);\n };\n\n return (\n <button className=\"group relative size-10\" aria-label=\"Theme selector\">\n <CircleDashed\n className={getIconStyle({\n isCurrentMode: mode === Modes.system,\n isNextMode: nextMode === Modes.system,\n })}\n onClick={toggleMode}\n data-mode=\"system\"\n />\n\n <Moon\n className={getIconStyle({\n isCurrentMode: mode === Modes.light,\n isNextMode: nextMode === Modes.light,\n })}\n onClick={toggleMode}\n data-mode=\"light\"\n />\n\n <Sun\n className={getIconStyle({\n isCurrentMode: mode === Modes.dark,\n isNextMode: nextMode === Modes.dark,\n })}\n onClick={toggleMode}\n data-mode=\"dark\"\n />\n </button>\n );\n};\n"],"names":["cn","Modes","useState","jsxs","jsx","CircleDashed","Moon","Sun"],"mappings":";;;;;;;;AAcA,MAAM,eAAe,CAAC;AAAA,EACpB;AAAA,EACA;AACF,MAIEA,SA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