@customafk/lunas-ui 0.0.67 → 0.0.69

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 (266) hide show
  1. package/dist/{alert-dialog-B5dXkMIF.js → alert-dialog-BDKOU-BT.js} +1 -1
  2. package/dist/{alert-dialog-B5dXkMIF.js.map → alert-dialog-BDKOU-BT.js.map} +1 -1
  3. package/dist/{alert-dialog-D-4wxqLK.cjs → alert-dialog-CTKVGTqb.cjs} +1 -1
  4. package/dist/{alert-dialog-D-4wxqLK.cjs.map → alert-dialog-CTKVGTqb.cjs.map} +1 -1
  5. package/dist/{button-NPRxTW9Y.d.cts → button-DZYXtWzR.d.ts} +6 -6
  6. package/dist/{button-ld6DUDGr.d.ts → button-LfFi39Jg.d.cts} +5 -5
  7. package/dist/{calendar-B6F_Lppz.cjs → calendar-BaIr1lqT.cjs} +1 -1
  8. package/dist/{calendar-B6F_Lppz.cjs.map → calendar-BaIr1lqT.cjs.map} +1 -1
  9. package/dist/{calendar-CXddeN7A.js → calendar-CAERbEr4.js} +1 -1
  10. package/dist/{calendar-CXddeN7A.js.map → calendar-CAERbEr4.js.map} +1 -1
  11. package/dist/{command-CgW_wSCe.d.cts → command-B2sNWZwT.d.ts} +12 -12
  12. package/dist/{command-CyWyRcle.js → command-BNKI-kLT.js} +2 -2
  13. package/dist/{command-CyWyRcle.js.map → command-BNKI-kLT.js.map} +1 -1
  14. package/dist/{command-BL20khiI.d.ts → command-Cbs1WmSg.d.cts} +12 -12
  15. package/dist/{command-BNYekOzL.cjs → command-DEBqV5of.cjs} +2 -2
  16. package/dist/{command-BNYekOzL.cjs.map → command-DEBqV5of.cjs.map} +1 -1
  17. package/dist/data-display/empty.d.cts +2 -2
  18. package/dist/data-display/empty.d.ts +2 -2
  19. package/dist/data-display/statistic.d.cts +2 -2
  20. package/dist/data-display/statistic.d.ts +2 -2
  21. package/dist/{dialog-CTwMjrks.d.cts → dialog-B7_YVIxQ.d.ts} +12 -12
  22. package/dist/{dialog-pMHkBJ-w.js → dialog-BXL-7iaS.js} +1 -1
  23. package/dist/{dialog-pMHkBJ-w.js.map → dialog-BXL-7iaS.js.map} +1 -1
  24. package/dist/{dialog-BfrTUQrJ.d.ts → dialog-BlSmlsZc.d.cts} +12 -12
  25. package/dist/{dialog-wX27mb8E.cjs → dialog-Cefxay6y.cjs} +1 -1
  26. package/dist/{dialog-wX27mb8E.cjs.map → dialog-Cefxay6y.cjs.map} +1 -1
  27. package/dist/dialogs/confirm-dialog.cjs +1 -1
  28. package/dist/dialogs/confirm-dialog.js +1 -1
  29. package/dist/dialogs/detail-dialog/component/sidebar.cjs +1 -1
  30. package/dist/dialogs/detail-dialog/component/sidebar.d.cts +29 -29
  31. package/dist/dialogs/detail-dialog/component/sidebar.d.ts +31 -31
  32. package/dist/dialogs/detail-dialog/component/sidebar.js +1 -1
  33. package/dist/dialogs/detail-dialog/index.cjs +1 -1
  34. package/dist/dialogs/detail-dialog/index.js +1 -1
  35. package/dist/dialogs/error-dialog.cjs +1 -1
  36. package/dist/dialogs/error-dialog.js +1 -1
  37. package/dist/dialogs/form-dialog.cjs +1 -1
  38. package/dist/dialogs/form-dialog.d.cts +2 -2
  39. package/dist/dialogs/form-dialog.d.ts +2 -2
  40. package/dist/dialogs/form-dialog.js +1 -1
  41. package/dist/dialogs/loading-dialog.cjs +1 -1
  42. package/dist/dialogs/loading-dialog.js +1 -1
  43. package/dist/{drawer-DnhgwetT.js → drawer-D6qggBnW.js} +1 -1
  44. package/dist/{drawer-DnhgwetT.js.map → drawer-D6qggBnW.js.map} +1 -1
  45. package/dist/{drawer-sRfKhXA3.cjs → drawer-oeYvUxv8.cjs} +1 -1
  46. package/dist/{drawer-sRfKhXA3.cjs.map → drawer-oeYvUxv8.cjs.map} +1 -1
  47. package/dist/{error-dialog-DGg0x5xF.cjs → error-dialog-1xq8gXX_.cjs} +2 -2
  48. package/dist/{error-dialog-DGg0x5xF.cjs.map → error-dialog-1xq8gXX_.cjs.map} +1 -1
  49. package/dist/{error-dialog-CphiTB4y.js → error-dialog-m_6k921_.js} +2 -2
  50. package/dist/{error-dialog-CphiTB4y.js.map → error-dialog-m_6k921_.js.map} +1 -1
  51. package/dist/{form-wrapper-Deo8gKv5.js → form-wrapper-BezrUArd.js} +2 -2
  52. package/dist/{form-wrapper-Deo8gKv5.js.map → form-wrapper-BezrUArd.js.map} +1 -1
  53. package/dist/{form-wrapper-C3pU1F5r.cjs → form-wrapper-CIH-4QPY.cjs} +2 -2
  54. package/dist/{form-wrapper-C3pU1F5r.cjs.map → form-wrapper-CIH-4QPY.cjs.map} +1 -1
  55. package/dist/forms/combobox-field.cjs +1 -1
  56. package/dist/forms/combobox-field.d.cts +2 -2
  57. package/dist/forms/combobox-field.d.ts +2 -2
  58. package/dist/forms/combobox-field.js +1 -1
  59. package/dist/forms/date-field.cjs +1 -1
  60. package/dist/forms/date-field.d.cts +2 -2
  61. package/dist/forms/date-field.d.ts +2 -2
  62. package/dist/forms/date-field.js +1 -1
  63. package/dist/forms/form-wrapper.cjs +1 -1
  64. package/dist/forms/form-wrapper.d.ts +2 -2
  65. package/dist/forms/form-wrapper.js +1 -1
  66. package/dist/forms/multi-select-field.cjs +1 -1
  67. package/dist/forms/multi-select-field.cjs.map +1 -1
  68. package/dist/forms/multi-select-field.d.cts +2 -2
  69. package/dist/forms/multi-select-field.d.ts +2 -2
  70. package/dist/forms/multi-select-field.js +1 -1
  71. package/dist/forms/number-field.cjs +1 -1
  72. package/dist/forms/number-field.d.cts +2 -2
  73. package/dist/forms/number-field.d.ts +2 -2
  74. package/dist/forms/number-field.js +1 -1
  75. package/dist/forms/password-field.cjs +1 -1
  76. package/dist/forms/password-field.d.cts +2 -2
  77. package/dist/forms/password-field.d.ts +2 -2
  78. package/dist/forms/password-field.js +1 -1
  79. package/dist/forms/select-field.cjs +1 -1
  80. package/dist/forms/select-field.d.cts +2 -2
  81. package/dist/forms/select-field.d.ts +2 -2
  82. package/dist/forms/select-field.js +1 -1
  83. package/dist/forms/switch-field.cjs +1 -1
  84. package/dist/forms/switch-field.d.cts +2 -2
  85. package/dist/forms/switch-field.d.ts +2 -2
  86. package/dist/forms/switch-field.js +1 -1
  87. package/dist/forms/text-field.cjs +1 -1
  88. package/dist/forms/text-field.d.cts +2 -2
  89. package/dist/forms/text-field.js +1 -1
  90. package/dist/forms/textarea-field.cjs +1 -1
  91. package/dist/forms/textarea-field.d.cts +2 -2
  92. package/dist/forms/textarea-field.js +1 -1
  93. package/dist/{input-Dx2DxNMy.d.cts → input-BFZu6Cb8.d.cts} +3 -3
  94. package/dist/{input-BUYJ4_aj.js → input-BFZuwsER.js} +1 -1
  95. package/dist/{input-BUYJ4_aj.js.map → input-BFZuwsER.js.map} +1 -1
  96. package/dist/{input-DgtTVBtN.cjs → input-ERPHY3v4.cjs} +1 -1
  97. package/dist/{input-DgtTVBtN.cjs.map → input-ERPHY3v4.cjs.map} +1 -1
  98. package/dist/{input-CWzkJbaD.d.ts → input-d_SOv6FU.d.ts} +3 -3
  99. package/dist/layouts/app-layout/index.d.cts +4 -4
  100. package/dist/layouts/app-layout/index.d.ts +29 -29
  101. package/dist/layouts/flex.d.cts +4 -4
  102. package/dist/layouts/flex.d.ts +4 -4
  103. package/dist/layouts/service-layout/index.cjs +1 -1
  104. package/dist/layouts/service-layout/index.cjs.map +1 -1
  105. package/dist/layouts/service-layout/index.d.cts +4 -4
  106. package/dist/layouts/service-layout/index.d.ts +16 -16
  107. package/dist/layouts/service-layout/index.js +1 -1
  108. package/dist/layouts/service-layout/index.js.map +1 -1
  109. package/dist/{multi-select-DRKqFg1M.cjs → multi-select-Bhl2uJgf.cjs} +2 -2
  110. package/dist/{multi-select-DRKqFg1M.cjs.map → multi-select-Bhl2uJgf.cjs.map} +1 -1
  111. package/dist/{multi-select-DyhAPckx.js → multi-select-DLWPfDCM.js} +2 -2
  112. package/dist/{multi-select-DyhAPckx.js.map → multi-select-DLWPfDCM.js.map} +1 -1
  113. package/dist/{popover-CxOK3oy2.js → popover-BjCVseR5.js} +1 -1
  114. package/dist/{popover-CxOK3oy2.js.map → popover-BjCVseR5.js.map} +1 -1
  115. package/dist/{popover-Bi7GLJT5.cjs → popover-D7UZ966w.cjs} +1 -1
  116. package/dist/{popover-Bi7GLJT5.cjs.map → popover-D7UZ966w.cjs.map} +1 -1
  117. package/dist/{search-input-DnYrPBeT.js → search-input-C_7D7Nqj.js} +2 -2
  118. package/dist/{search-input-DnYrPBeT.js.map → search-input-C_7D7Nqj.js.map} +1 -1
  119. package/dist/{search-input-BkhVqB3R.cjs → search-input-hIVKLXXb.cjs} +2 -2
  120. package/dist/{search-input-BkhVqB3R.cjs.map → search-input-hIVKLXXb.cjs.map} +1 -1
  121. package/dist/{select-Cmq5a3Wg.js → select-CijI0HX0.js} +1 -1
  122. package/dist/{select-Cmq5a3Wg.js.map → select-CijI0HX0.js.map} +1 -1
  123. package/dist/{select-DAE3Xg7g.cjs → select-oxr4KoHx.cjs} +1 -1
  124. package/dist/{select-DAE3Xg7g.cjs.map → select-oxr4KoHx.cjs.map} +1 -1
  125. package/dist/{separator-ZGvcRkrl.d.cts → separator-B79v6wKg.d.cts} +3 -3
  126. package/dist/{separator-9s0ppov1.d.ts → separator-CJZGYT24.d.ts} +3 -3
  127. package/dist/{sidebar-CROF88rz.cjs → sidebar-BxGyCuTJ.cjs} +2 -2
  128. package/dist/{sidebar-CROF88rz.cjs.map → sidebar-BxGyCuTJ.cjs.map} +1 -1
  129. package/dist/{sidebar-CrStgrmq.js → sidebar-CMWETVDr.js} +2 -2
  130. package/dist/{sidebar-CrStgrmq.js.map → sidebar-CMWETVDr.js.map} +1 -1
  131. package/dist/{switch-BnHSwQ5T.cjs → switch-BPSKvrTw.cjs} +1 -1
  132. package/dist/{switch-BnHSwQ5T.cjs.map → switch-BPSKvrTw.cjs.map} +1 -1
  133. package/dist/{switch-iwm2-R_e.js → switch-Crju8DJO.js} +1 -1
  134. package/dist/{switch-iwm2-R_e.js.map → switch-Crju8DJO.js.map} +1 -1
  135. package/dist/table/index.cjs +1 -1
  136. package/dist/table/index.d.cts +2 -2
  137. package/dist/table/index.d.ts +2 -2
  138. package/dist/table/index.js +1 -1
  139. package/dist/{textarea-DbNqKCAi.js → textarea-BCZiUxv7.js} +1 -1
  140. package/dist/{textarea-DbNqKCAi.js.map → textarea-BCZiUxv7.js.map} +1 -1
  141. package/dist/{textarea-DK_bNV0u.cjs → textarea-BtACo9UF.cjs} +1 -1
  142. package/dist/{textarea-DK_bNV0u.cjs.map → textarea-BtACo9UF.cjs.map} +1 -1
  143. package/dist/{toggle-DpUG0EqP.d.cts → toggle-B3cvw5ny.d.ts} +6 -6
  144. package/dist/{toggle-DIRRdVOx.d.ts → toggle-Dq091q_s.d.cts} +5 -5
  145. package/dist/{tooltip-ChyvXWdm.d.ts → tooltip-B1Lj1ujY.d.ts} +6 -6
  146. package/dist/{tooltip-BZDwRKZ6.d.cts → tooltip-DijjzZk1.d.cts} +6 -6
  147. package/dist/typography/paragraph.d.cts +2 -2
  148. package/dist/typography/paragraph.d.ts +2 -2
  149. package/dist/typography/title.d.cts +2 -2
  150. package/dist/typography/title.d.ts +2 -2
  151. package/dist/ui/alert-dialog.cjs +1 -1
  152. package/dist/ui/alert-dialog.d.cts +12 -12
  153. package/dist/ui/alert-dialog.d.ts +12 -12
  154. package/dist/ui/alert-dialog.js +1 -1
  155. package/dist/ui/alert.d.cts +4 -4
  156. package/dist/ui/alert.d.ts +4 -4
  157. package/dist/ui/aspect-ratio.d.cts +2 -2
  158. package/dist/ui/aspect-ratio.d.ts +2 -2
  159. package/dist/ui/avatar.d.cts +4 -4
  160. package/dist/ui/avatar.d.ts +4 -4
  161. package/dist/ui/badge.d.cts +2 -2
  162. package/dist/ui/badge.d.ts +4 -4
  163. package/dist/ui/breadcrumb.d.cts +8 -8
  164. package/dist/ui/breadcrumb.d.ts +8 -8
  165. package/dist/ui/button.d.cts +1 -1
  166. package/dist/ui/button.d.ts +1 -1
  167. package/dist/ui/calendar.cjs +1 -1
  168. package/dist/ui/calendar.d.cts +4 -4
  169. package/dist/ui/calendar.d.ts +4 -4
  170. package/dist/ui/calendar.js +1 -1
  171. package/dist/ui/card.d.cts +8 -8
  172. package/dist/ui/card.d.ts +8 -8
  173. package/dist/ui/carousel.d.cts +7 -7
  174. package/dist/ui/carousel.d.ts +7 -7
  175. package/dist/ui/collapsible.d.cts +4 -4
  176. package/dist/ui/collapsible.d.ts +4 -4
  177. package/dist/ui/command.cjs +1 -1
  178. package/dist/ui/command.d.cts +2 -2
  179. package/dist/ui/command.d.ts +2 -2
  180. package/dist/ui/command.js +1 -1
  181. package/dist/ui/context-menu.d.cts +16 -16
  182. package/dist/ui/context-menu.d.ts +16 -16
  183. package/dist/ui/dialog.cjs +1 -1
  184. package/dist/ui/dialog.d.cts +1 -1
  185. package/dist/ui/dialog.d.ts +1 -1
  186. package/dist/ui/dialog.js +1 -1
  187. package/dist/ui/dropdown-menu.d.cts +16 -16
  188. package/dist/ui/dropdown-menu.d.ts +16 -16
  189. package/dist/ui/file-uploader.d.cts +2 -2
  190. package/dist/ui/file-uploader.d.ts +2 -2
  191. package/dist/ui/form.d.cts +7 -7
  192. package/dist/ui/form.d.ts +7 -7
  193. package/dist/ui/hover-card.d.cts +4 -4
  194. package/dist/ui/hover-card.d.ts +4 -4
  195. package/dist/ui/input-otp.d.cts +5 -5
  196. package/dist/ui/input-otp.d.ts +5 -5
  197. package/dist/ui/input.cjs +1 -1
  198. package/dist/ui/input.d.cts +1 -1
  199. package/dist/ui/input.d.ts +1 -1
  200. package/dist/ui/input.js +1 -1
  201. package/dist/ui/inputs/search-input.cjs +1 -1
  202. package/dist/ui/inputs/search-input.d.cts +3 -3
  203. package/dist/ui/inputs/search-input.d.ts +3 -3
  204. package/dist/ui/inputs/search-input.js +1 -1
  205. package/dist/ui/label.d.cts +2 -2
  206. package/dist/ui/label.d.ts +2 -2
  207. package/dist/ui/menubar.d.cts +17 -17
  208. package/dist/ui/menubar.d.ts +17 -17
  209. package/dist/ui/multi-select.cjs +1 -1
  210. package/dist/ui/multi-select.d.cts +2 -2
  211. package/dist/ui/multi-select.d.ts +2 -2
  212. package/dist/ui/multi-select.js +1 -1
  213. package/dist/ui/navigation-menu.d.cts +9 -9
  214. package/dist/ui/navigation-menu.d.ts +11 -11
  215. package/dist/ui/pagination.d.cts +9 -9
  216. package/dist/ui/pagination.d.ts +9 -9
  217. package/dist/ui/popover.cjs +1 -1
  218. package/dist/ui/popover.d.cts +5 -5
  219. package/dist/ui/popover.d.ts +5 -5
  220. package/dist/ui/popover.js +1 -1
  221. package/dist/ui/progress.d.cts +2 -2
  222. package/dist/ui/progress.d.ts +2 -2
  223. package/dist/ui/radio-group.d.cts +3 -3
  224. package/dist/ui/radio-group.d.ts +3 -3
  225. package/dist/ui/resizable.d.cts +4 -4
  226. package/dist/ui/resizable.d.ts +4 -4
  227. package/dist/ui/scroll-area.d.cts +3 -3
  228. package/dist/ui/scroll-area.d.ts +3 -3
  229. package/dist/ui/select.cjs +1 -1
  230. package/dist/ui/select.d.cts +11 -11
  231. package/dist/ui/select.d.ts +11 -11
  232. package/dist/ui/select.js +1 -1
  233. package/dist/ui/separator.d.cts +1 -1
  234. package/dist/ui/separator.d.ts +1 -1
  235. package/dist/ui/sheet.d.cts +9 -9
  236. package/dist/ui/sheet.d.ts +9 -9
  237. package/dist/ui/sidebar.cjs +1 -1
  238. package/dist/ui/sidebar.cjs.map +1 -1
  239. package/dist/ui/sidebar.d.cts +29 -29
  240. package/dist/ui/sidebar.d.ts +29 -29
  241. package/dist/ui/sidebar.js +1 -1
  242. package/dist/ui/sidebar.js.map +1 -1
  243. package/dist/ui/skeleton.d.cts +2 -2
  244. package/dist/ui/skeleton.d.ts +2 -2
  245. package/dist/ui/slider.d.cts +2 -2
  246. package/dist/ui/slider.d.ts +2 -2
  247. package/dist/ui/sonner.d.cts +2 -2
  248. package/dist/ui/sonner.d.ts +2 -2
  249. package/dist/ui/switch.cjs +1 -1
  250. package/dist/ui/switch.d.cts +2 -2
  251. package/dist/ui/switch.d.ts +2 -2
  252. package/dist/ui/switch.js +1 -1
  253. package/dist/ui/table.d.cts +9 -9
  254. package/dist/ui/table.d.ts +9 -9
  255. package/dist/ui/tabs.d.cts +5 -5
  256. package/dist/ui/tabs.d.ts +5 -5
  257. package/dist/ui/textarea.cjs +1 -1
  258. package/dist/ui/textarea.d.ts +2 -2
  259. package/dist/ui/textarea.js +1 -1
  260. package/dist/ui/toggle-group.d.cts +4 -4
  261. package/dist/ui/toggle-group.d.ts +4 -4
  262. package/dist/ui/toggle.d.cts +1 -1
  263. package/dist/ui/toggle.d.ts +1 -1
  264. package/dist/ui/tooltip.d.cts +1 -1
  265. package/dist/ui/tooltip.d.ts +1 -1
  266. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"multi-select-DRKqFg1M.cjs","names":["groupOption: GroupOption","CommandItem","value","Command","X","CommandPrimitive","CommandList","CommandSeparator","CommandGroup","Button","PlusIcon"],"sources":["../packages/components/ui/multi-select.tsx"],"sourcesContent":["'use client'\nimport { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nimport { PlusIcon, X } from 'lucide-react'\n\nimport { Button } from '@/components/ui/button'\nimport { Command, CommandGroup, CommandItem, CommandList, CommandSeparator } from '@/components/ui/command'\n\nimport { Command as CommandPrimitive, useCommandState } from 'cmdk'\n\nexport interface Option {\n value: string\n label: string\n disable?: boolean\n /** fixed option that can&lsquo;t be removed. */\n fixed?: boolean\n /** Group the options by providing key. */\n [key: string]: string | boolean | undefined\n}\ninterface GroupOption {\n [key: string]: Option[]\n}\n\ninterface MultipleSelectorProps {\n value?: Option[]\n defaultOptions?: Option[]\n /** manually controlled options */\n options?: Option[]\n placeholder?: string\n /** Loading component. */\n loadingIndicator?: React.ReactNode\n /** Empty component. */\n emptyIndicator?: React.ReactNode\n /** Debounce time for async search. Only work with `onSearch`. */\n delay?: number\n /**\n * Only work with `onSearch` prop. Trigger search when `onFocus`.\n * For example, when user click on the input, it will trigger the search to get initial options.\n **/\n triggerSearchOnFocus?: boolean\n /** async search */\n onSearch?: (value: string) => Promise<Option[]>\n /**\n * sync search. This search will not showing loadingIndicator.\n * The rest props are the same as async search.\n * i.e.: creatable, groupBy, delay.\n **/\n onSearchSync?: (value: string) => Option[]\n onChange?: (options: Option[]) => void\n /** Limit the maximum number of selected options. */\n maxSelected?: number\n /** When the number of selected options exceeds the limit, the onMaxSelected will be called. */\n onMaxSelected?: (maxLimit: number) => void\n /** Hide the placeholder when there are options selected. */\n hidePlaceholderWhenSelected?: boolean\n disabled?: boolean\n /** Group the options base on provided key. */\n groupBy?: string\n className?: string\n badgeClassName?: string\n /**\n * First item selected is a default behavior by cmdk. That is why the default is true.\n * This is a workaround solution by add a dummy item.\n *\n * @reference: https://github.com/pacocoursey/cmdk/issues/171\n */\n selectFirstItem?: boolean\n /** Allow user to create option when there is no option matched. */\n creatable?: boolean\n /** Props of `Command` */\n commandProps?: React.ComponentPropsWithoutRef<typeof Command>\n /** Props of `CommandInput` */\n inputProps?: Omit<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>, 'value' | 'placeholder' | 'disabled'>\n /** hide the clear all button. */\n hideClearAllButton?: boolean\n\n /** Add new item event for select with search */\n onAddNewItem?: () => void\n}\n\nexport interface MultipleSelectorRef {\n selectedValue: Option[]\n input: HTMLInputElement\n focus: () => void\n reset: () => void\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useDebounce<T>(value: T, delay?: number): T {\n const [debouncedValue, setDebouncedValue] = useState<T>(value)\n\n useEffect(() => {\n const timer = setTimeout(() => setDebouncedValue(value), delay || 500)\n\n return () => {\n clearTimeout(timer)\n }\n }, [value, delay])\n\n return debouncedValue\n}\n\nfunction transToGroupOption(options: Option[], groupBy?: string) {\n if (options.length === 0) {\n return {}\n }\n if (!groupBy) {\n return {\n '': options,\n }\n }\n\n const groupOption: GroupOption = {}\n options.forEach((option) => {\n const key = (option[groupBy] as string) || ''\n if (!groupOption[key]) {\n groupOption[key] = []\n }\n groupOption[key].push(option)\n })\n return groupOption\n}\n\nfunction removePickedOption(groupOption: GroupOption, picked: Option[]) {\n const cloneOption = JSON.parse(JSON.stringify(groupOption)) as GroupOption\n\n for (const [key, value] of Object.entries(cloneOption)) {\n cloneOption[key] = value.filter((val) => !picked.find((p) => p.value === val.value))\n }\n return cloneOption\n}\n\nfunction isOptionsExist(groupOption: GroupOption, targetOption: Option[]) {\n for (const [, value] of Object.entries(groupOption)) {\n if (value.some((option) => targetOption.find((p) => p.value === option.value))) {\n return true\n }\n }\n return false\n}\n\n/**\n * The `CommandEmpty` of shadcn/ui will cause the cmdk empty not rendering correctly.\n * So we create one and copy the `Empty` implementation from `cmdk`.\n *\n * @reference: https://github.com/hsuanyi-chou/shadcn-ui-expansions/issues/34#issuecomment-1949561607\n **/\nconst CommandEmpty = forwardRef<HTMLDivElement, React.ComponentProps<typeof CommandPrimitive.Empty>>(({ className, ...props }, forwardedRef) => {\n const render = useCommandState((state) => state.filtered.count === 0)\n\n if (!render) return null\n\n return <div ref={forwardedRef} className={cn('px-2 py-4 text-center text-sm', className)} cmdk-empty=\"\" role=\"presentation\" {...props} />\n})\n\nCommandEmpty.displayName = 'CommandEmpty'\n\nexport const MultipleSelector = forwardRef<MultipleSelectorRef, MultipleSelectorProps>(\n (\n {\n value,\n onChange,\n placeholder,\n defaultOptions: arrayDefaultOptions = [],\n options: arrayOptions,\n delay,\n onSearch,\n onSearchSync,\n loadingIndicator: LoadingIndicator,\n emptyIndicator,\n maxSelected = Number.MAX_SAFE_INTEGER,\n onMaxSelected,\n hidePlaceholderWhenSelected,\n disabled,\n groupBy,\n className,\n badgeClassName,\n selectFirstItem = true,\n creatable = false,\n triggerSearchOnFocus = false,\n commandProps,\n inputProps,\n hideClearAllButton = false,\n onAddNewItem,\n }: MultipleSelectorProps,\n ref: React.Ref<MultipleSelectorRef>,\n ) => {\n const inputRef = useRef<HTMLInputElement>(null)\n const dropdownRef = useRef<HTMLDivElement>(null) // Added this\n\n const [open, setOpen] = useState(false)\n const [onScrollbar, setOnScrollbar] = useState(false)\n const [isLoading, setIsLoading] = useState(false)\n\n const [selected, setSelected] = useState<Option[]>(value || [])\n const [options, setOptions] = useState<GroupOption>(transToGroupOption(arrayDefaultOptions, groupBy))\n const [inputValue, setInputValue] = useState('')\n\n const debouncedSearchTerm = useDebounce(inputValue, delay || 500)\n\n useImperativeHandle(\n ref,\n () => ({\n selectedValue: [...selected],\n input: inputRef.current as HTMLInputElement,\n focus: () => inputRef?.current?.focus(),\n reset: () => setSelected([]),\n }),\n [selected],\n )\n\n const handleClickOutside = useCallback((event: MouseEvent | TouchEvent) => {\n if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node) && inputRef.current && !inputRef.current.contains(event.target as Node)) {\n setOpen(false)\n inputRef.current.blur()\n }\n }, [])\n\n const handleUnselect = useCallback(\n (option: Option) => {\n const newOptions = selected.filter((s) => s.value !== option.value)\n setSelected(newOptions)\n onChange?.(newOptions)\n },\n [onChange, selected],\n )\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n const input = inputRef.current\n if (!input) return\n\n if (e.key === 'Delete' || e.key === 'Backspace') {\n if (input.value === '' && selected.length > 0) {\n const lastSelectOption = selected[selected.length - 1]\n // If last item is fixed, we should not remove it.\n if (!lastSelectOption.fixed) {\n handleUnselect(selected[selected.length - 1])\n }\n }\n }\n\n // This is not a default behavior of the <input /> field\n if (e.key === 'Escape') {\n input.blur()\n }\n },\n [handleUnselect, selected],\n )\n\n useEffect(() => {\n if (open) {\n document.addEventListener('mousedown', handleClickOutside)\n document.addEventListener('touchend', handleClickOutside)\n } else {\n document.removeEventListener('mousedown', handleClickOutside)\n document.removeEventListener('touchend', handleClickOutside)\n }\n\n return () => {\n document.removeEventListener('mousedown', handleClickOutside)\n document.removeEventListener('touchend', handleClickOutside)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n useEffect(() => {\n if (value) {\n setSelected(value)\n }\n }, [value])\n\n useEffect(() => {\n /** If `onSearch` is provided, do not trigger options updated. */\n if (!arrayOptions || onSearch) {\n return\n }\n const newOption = transToGroupOption(arrayOptions || [], groupBy)\n if (JSON.stringify(newOption) !== JSON.stringify(options)) {\n setOptions(newOption)\n }\n }, [arrayDefaultOptions, arrayOptions, groupBy, onSearch, options])\n\n useEffect(() => {\n /** sync search */\n\n const doSearchSync = () => {\n const res = onSearchSync?.(debouncedSearchTerm)\n setOptions(transToGroupOption(res || [], groupBy))\n }\n\n const exec = async () => {\n if (!onSearchSync || !open) return\n\n if (triggerSearchOnFocus) {\n doSearchSync()\n }\n\n if (debouncedSearchTerm) {\n doSearchSync()\n }\n }\n\n void exec()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [debouncedSearchTerm, groupBy, open, triggerSearchOnFocus])\n\n useEffect(() => {\n /** async search */\n\n const doSearch = async () => {\n setIsLoading(true)\n const res = await onSearch?.(debouncedSearchTerm)\n setOptions(transToGroupOption(res || [], groupBy))\n setIsLoading(false)\n }\n\n const exec = async () => {\n if (!onSearch || !open) return\n\n if (triggerSearchOnFocus) {\n await doSearch()\n }\n\n if (debouncedSearchTerm) {\n await doSearch()\n }\n }\n\n void exec()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [debouncedSearchTerm, groupBy, open, triggerSearchOnFocus])\n\n const CreatableItem = () => {\n if (!creatable) return undefined\n if (isOptionsExist(options, [{ value: inputValue, label: inputValue }]) || selected.find((s) => s.value === inputValue)) {\n return undefined\n }\n\n const Item = (\n <CommandItem\n value={inputValue}\n className=\"cursor-pointer\"\n onMouseDown={(e) => {\n e.preventDefault()\n e.stopPropagation()\n }}\n onSelect={(value: string) => {\n if (selected.length >= maxSelected) {\n onMaxSelected?.(selected.length)\n return\n }\n setInputValue('')\n const newOptions = [...selected, { value, label: value }]\n setSelected(newOptions)\n onChange?.(newOptions)\n }}\n >\n {`Create \"${inputValue}\"`}\n </CommandItem>\n )\n\n // For normal creatable\n if (!onSearch && inputValue.length > 0) {\n return Item\n }\n\n // For async search creatable. avoid showing creatable item before loading at first.\n if (onSearch && debouncedSearchTerm.length > 0 && !isLoading) {\n return Item\n }\n\n return undefined\n }\n\n const EmptyItem = useCallback(() => {\n if (!emptyIndicator) return undefined\n\n // For async search that showing emptyIndicator\n if (onSearch && !creatable && Object.keys(options).length === 0) {\n return (\n <CommandItem value=\"-\" disabled>\n {emptyIndicator}\n </CommandItem>\n )\n }\n\n return <CommandEmpty>{emptyIndicator}</CommandEmpty>\n }, [creatable, emptyIndicator, onSearch, options])\n\n const selectables = useMemo<GroupOption>(() => removePickedOption(options, selected), [options, selected])\n\n /** Avoid Creatable Selector freezing or lagging when paste a long string. */\n const commandFilter = useCallback(() => {\n if (commandProps?.filter) {\n return commandProps.filter\n }\n\n if (creatable) {\n return (value: string, search: string) => {\n return value.toLowerCase().includes(search.toLowerCase()) ? 1 : -1\n }\n }\n // Using default filter in `cmdk`. We don&lsquo;t have to provide it.\n return undefined\n }, [creatable, commandProps?.filter])\n\n return (\n <Command\n ref={dropdownRef}\n {...commandProps}\n onKeyDown={(e) => {\n handleKeyDown(e)\n commandProps?.onKeyDown?.(e)\n }}\n className={cn('h-auto overflow-visible bg-transparent', commandProps?.className)}\n shouldFilter={commandProps?.shouldFilter !== undefined ? commandProps.shouldFilter : !onSearch} // When onSearch is provided, we don&lsquo;t want to filter the options. You can still override it.\n filter={commandFilter()}\n >\n <div\n className={cn(\n 'border-border-weak relative rounded-md border text-sm transition-shadow',\n 'focus-within:border-primary',\n 'focus-within:ring-primary-weak',\n 'focus-within:ring-4',\n 'focus-within:outline-hidden',\n 'has-disabled:bg-muted',\n 'has-disabled:text-muted-foreground',\n selected.length !== 0 && 'p-1',\n !disabled && selected.length !== 0 && 'cursor-text',\n !hideClearAllButton && 'pe-9',\n className,\n )}\n onClick={() => {\n if (disabled) return\n inputRef?.current?.focus()\n }}\n >\n <div className=\"flex flex-wrap gap-1\">\n {selected.map((option) => {\n return (\n <div\n key={option.value}\n className={cn(\n 'animate-fadeIn',\n 'bg-background',\n 'hover:bg-background',\n 'border-border-weak border border-solid',\n 'text-text-positive-weak relative inline-flex h-7 cursor-default items-center rounded-md ps-2 pe-7 pl-2 text-xs font-medium transition-all',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n 'data-fixed:pe-2',\n badgeClassName,\n )}\n data-fixed={option.fixed}\n data-disabled={disabled || undefined}\n >\n {option.label}\n <button\n type=\"button\"\n disabled={disabled || option.fixed}\n className={cn(\n 'text-text-positive-muted absolute -inset-y-px -end-px flex size-7 items-center justify-center rounded-e-lg border border-transparent p-0 outline-0 transition-colors',\n 'hover:text-foreground',\n 'focus-visible:outline',\n 'focus-visible:outline-2',\n 'focus-visible:outline-primary-weak',\n 'disabled:hover:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',\n )}\n onKeyDown={(e) => {\n if (e.key !== 'Enter') return\n handleUnselect(option)\n }}\n onMouseDown={(e) => {\n e.preventDefault()\n e.stopPropagation()\n }}\n onClick={() => handleUnselect(option)}\n aria-label=\"Remove\"\n >\n <X size={14} strokeWidth={2} aria-hidden=\"true\" />\n </button>\n </div>\n )\n })}\n {/* Avoid having the \"Search\" Icon */}\n <CommandPrimitive.Input\n {...inputProps}\n ref={inputRef}\n value={inputValue}\n disabled={disabled}\n onValueChange={(value) => {\n setInputValue(value)\n inputProps?.onValueChange?.(value)\n }}\n onBlur={(event) => {\n if (!onScrollbar) {\n setOpen(false)\n }\n inputProps?.onBlur?.(event)\n }}\n onFocus={(event) => {\n setOpen(true)\n if (triggerSearchOnFocus) {\n onSearch?.(debouncedSearchTerm)\n }\n inputProps?.onFocus?.(event)\n }}\n placeholder={hidePlaceholderWhenSelected && selected.length !== 0 ? '' : placeholder}\n className={cn(\n 'placeholder:text-text-positive-muted flex-1 bg-transparent outline-hidden',\n 'disabled:placeholder:text-transparent',\n {\n 'w-full': hidePlaceholderWhenSelected,\n 'px-3 py-2': selected.length === 0,\n 'ml-1': selected.length !== 0,\n },\n inputProps?.className,\n )}\n />\n <button\n type=\"button\"\n onClick={() => {\n setSelected(selected.filter((s) => s.fixed))\n onChange?.(selected.filter((s) => s.fixed))\n }}\n className={cn(\n 'text-muted-foreground/80',\n 'absolute end-0 top-0 flex size-9 items-center justify-center rounded-lg border border-transparent transition-colors',\n 'focus-visible:outline-2',\n 'hover:text-text-positive',\n 'focus-visible:outline-primary-weak',\n (hideClearAllButton || disabled || selected.length < 1 || selected.filter(({ fixed }) => fixed).length === selected.length) && 'hidden',\n )}\n aria-label=\"Clear all\"\n >\n <X size={16} strokeWidth={2} aria-hidden=\"true\" />\n </button>\n </div>\n </div>\n <div className=\"relative\">\n <div\n className={cn(\n 'shadow-dropdown absolute top-2 z-10 w-full overflow-hidden rounded-lg',\n 'data-[state=open]:animate-in',\n 'data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0',\n 'data-[state=open]:fade-in-0',\n 'data-[state=closed]:zoom-out-95',\n 'data-[state=open]:zoom-in-95',\n !open && 'hidden',\n )}\n data-state={open ? 'open' : 'closed'}\n >\n {open && (\n <CommandList\n className=\"shadow-lg outline-hidden\"\n onMouseLeave={() => {\n setOnScrollbar(false)\n }}\n onMouseEnter={() => {\n setOnScrollbar(true)\n }}\n onMouseUp={() => {\n inputRef?.current?.focus()\n }}\n >\n {onAddNewItem && (\n <>\n <CommandSeparator />\n <CommandGroup>\n <Button type=\"button\" variant=\"ghost\" className=\"w-full font-normal [&_div]:justify-start\" onClick={onAddNewItem}>\n <PlusIcon size={14} className=\"opacity-60\" aria-hidden=\"true\" />\n Thêm mới\n </Button>\n </CommandGroup>\n </>\n )}\n {isLoading ? (\n LoadingIndicator\n ) : (\n <>\n {EmptyItem()}\n {CreatableItem()}\n {!selectFirstItem && <CommandItem value=\"-\" className=\"hidden\" />}\n {Object.entries(selectables).map(([key, dropdowns]) => (\n <CommandGroup key={key} heading={key} className=\"h-full overflow-auto\">\n {dropdowns.map((option) => {\n return (\n <CommandItem\n key={option.value}\n value={option.value}\n disabled={option.disable}\n onMouseDown={(e) => {\n e.preventDefault()\n e.stopPropagation()\n }}\n onSelect={() => {\n if (selected.length >= maxSelected) {\n onMaxSelected?.(selected.length)\n return\n }\n const newOptions = [...selected, option]\n setInputValue('')\n setSelected(newOptions)\n onChange?.(newOptions)\n }}\n className={cn('cursor-pointer', option.disable && 'cursor-not-allowed opacity-50')}\n >\n {option.label}\n </CommandItem>\n )\n })}\n </CommandGroup>\n ))}\n </>\n )}\n </CommandList>\n )}\n </div>\n </div>\n </Command>\n )\n },\n)\n\nMultipleSelector.displayName = 'MultipleSelector'\n"],"mappings":"gTAyFA,SAAgB,EAAe,EAAU,EAAmB,CAC1D,GAAM,CAAC,EAAgB,IAAA,EAAA,EAAA,UAAiC,GAUxD,OARA,EAAA,EAAA,eAAgB,CACd,IAAM,EAAQ,eAAiB,EAAkB,GAAQ,GAAS,KAElE,UAAa,CACX,aAAa,KAEd,CAAC,EAAO,IAEJ,EAGT,SAAS,EAAmB,EAAmB,EAAkB,CAC/D,GAAI,EAAQ,SAAW,EACrB,MAAO,GAET,GAAI,CAAC,EACH,MAAO,CACL,GAAI,GAIR,IAAMA,EAA2B,GAQjC,OAPA,EAAQ,QAAS,GAAW,CAC1B,IAAM,EAAO,EAAO,IAAuB,GACtC,EAAY,KACf,EAAY,GAAO,IAErB,EAAY,GAAK,KAAK,KAEjB,EAGT,SAAS,EAAmB,EAA0B,EAAkB,CACtE,IAAM,EAAc,KAAK,MAAM,KAAK,UAAU,IAE9C,IAAK,GAAM,CAAC,EAAK,KAAU,OAAO,QAAQ,GACxC,EAAY,GAAO,EAAM,OAAQ,GAAQ,CAAC,EAAO,KAAM,GAAM,EAAE,QAAU,EAAI,QAE/E,OAAO,EAGT,SAAS,EAAe,EAA0B,EAAwB,CACxE,IAAK,GAAM,EAAG,KAAU,OAAO,QAAQ,GACrC,GAAI,EAAM,KA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AAI,UAAU,WACrD,OAAO,QAAQ,IAAa,KAAK,CAAC,EAAK,MACtC,EAAA,EAAA,KAACO,EAAAA,aAAAA,CAAuB,QAAS,EAAK,UAAU,gCAC7C,EAAU,IAAK,IAEZ,EAAA,EAAA,KAACP,EAAAA,YAAAA,CAEC,MAAO,EAAO,MACd,SAAU,EAAO,QACjB,YAAc,GAAM,CAClB,EAAE,iBACF,EAAE,mBAEJ,aAAgB,CACd,GAAI,EAAS,QAAU,EAAa,CAClC,IAAgB,EAAS,QACzB,OAEF,IAAM,EAAa,CAAC,GAAG,EAAU,GACjC,EAAc,IACd,EAAY,GACZ,IAAW,IAEb,WAAA,EAAA,EAAA,IAAc,iBAAkB,EAAO,SAAW,0CAEjD,EAAO,OAnBH,EAAO,SAJD,mBAwCzC,EAAiB,YAAc"}
1
+ {"version":3,"file":"multi-select-Bhl2uJgf.cjs","names":["groupOption: GroupOption","CommandItem","value","Command","X","CommandPrimitive","CommandList","CommandSeparator","CommandGroup","Button","PlusIcon"],"sources":["../packages/components/ui/multi-select.tsx"],"sourcesContent":["'use client'\nimport { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nimport { PlusIcon, X } from 'lucide-react'\n\nimport { Button } from '@/components/ui/button'\nimport { Command, CommandGroup, CommandItem, CommandList, CommandSeparator } from '@/components/ui/command'\n\nimport { Command as CommandPrimitive, useCommandState } from 'cmdk'\n\nexport interface Option {\n value: string\n label: string\n disable?: boolean\n /** fixed option that can&lsquo;t be removed. */\n fixed?: boolean\n /** Group the options by providing key. */\n [key: string]: string | boolean | undefined\n}\ninterface GroupOption {\n [key: string]: Option[]\n}\n\ninterface MultipleSelectorProps {\n value?: Option[]\n defaultOptions?: Option[]\n /** manually controlled options */\n options?: Option[]\n placeholder?: string\n /** Loading component. */\n loadingIndicator?: React.ReactNode\n /** Empty component. */\n emptyIndicator?: React.ReactNode\n /** Debounce time for async search. Only work with `onSearch`. */\n delay?: number\n /**\n * Only work with `onSearch` prop. Trigger search when `onFocus`.\n * For example, when user click on the input, it will trigger the search to get initial options.\n **/\n triggerSearchOnFocus?: boolean\n /** async search */\n onSearch?: (value: string) => Promise<Option[]>\n /**\n * sync search. This search will not showing loadingIndicator.\n * The rest props are the same as async search.\n * i.e.: creatable, groupBy, delay.\n **/\n onSearchSync?: (value: string) => Option[]\n onChange?: (options: Option[]) => void\n /** Limit the maximum number of selected options. */\n maxSelected?: number\n /** When the number of selected options exceeds the limit, the onMaxSelected will be called. */\n onMaxSelected?: (maxLimit: number) => void\n /** Hide the placeholder when there are options selected. */\n hidePlaceholderWhenSelected?: boolean\n disabled?: boolean\n /** Group the options base on provided key. */\n groupBy?: string\n className?: string\n badgeClassName?: string\n /**\n * First item selected is a default behavior by cmdk. That is why the default is true.\n * This is a workaround solution by add a dummy item.\n *\n * @reference: https://github.com/pacocoursey/cmdk/issues/171\n */\n selectFirstItem?: boolean\n /** Allow user to create option when there is no option matched. */\n creatable?: boolean\n /** Props of `Command` */\n commandProps?: React.ComponentPropsWithoutRef<typeof Command>\n /** Props of `CommandInput` */\n inputProps?: Omit<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>, 'value' | 'placeholder' | 'disabled'>\n /** hide the clear all button. */\n hideClearAllButton?: boolean\n\n /** Add new item event for select with search */\n onAddNewItem?: () => void\n}\n\nexport interface MultipleSelectorRef {\n selectedValue: Option[]\n input: HTMLInputElement\n focus: () => void\n reset: () => void\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useDebounce<T>(value: T, delay?: number): T {\n const [debouncedValue, setDebouncedValue] = useState<T>(value)\n\n useEffect(() => {\n const timer = setTimeout(() => setDebouncedValue(value), delay || 500)\n\n return () => {\n clearTimeout(timer)\n }\n }, [value, delay])\n\n return debouncedValue\n}\n\nfunction transToGroupOption(options: Option[], groupBy?: string) {\n if (options.length === 0) {\n return {}\n }\n if (!groupBy) {\n return {\n '': options,\n }\n }\n\n const groupOption: GroupOption = {}\n options.forEach((option) => {\n const key = (option[groupBy] as string) || ''\n if (!groupOption[key]) {\n groupOption[key] = []\n }\n groupOption[key].push(option)\n })\n return groupOption\n}\n\nfunction removePickedOption(groupOption: GroupOption, picked: Option[]) {\n const cloneOption = JSON.parse(JSON.stringify(groupOption)) as GroupOption\n\n for (const [key, value] of Object.entries(cloneOption)) {\n cloneOption[key] = value.filter((val) => !picked.find((p) => p.value === val.value))\n }\n return cloneOption\n}\n\nfunction isOptionsExist(groupOption: GroupOption, targetOption: Option[]) {\n for (const [, value] of Object.entries(groupOption)) {\n if (value.some((option) => targetOption.find((p) => p.value === option.value))) {\n return true\n }\n }\n return false\n}\n\n/**\n * The `CommandEmpty` of shadcn/ui will cause the cmdk empty not rendering correctly.\n * So we create one and copy the `Empty` implementation from `cmdk`.\n *\n * @reference: https://github.com/hsuanyi-chou/shadcn-ui-expansions/issues/34#issuecomment-1949561607\n **/\nconst CommandEmpty = forwardRef<HTMLDivElement, React.ComponentProps<typeof CommandPrimitive.Empty>>(({ className, ...props }, forwardedRef) => {\n const render = useCommandState((state) => state.filtered.count === 0)\n\n if (!render) return null\n\n return <div ref={forwardedRef} className={cn('px-2 py-4 text-center text-sm', className)} cmdk-empty=\"\" role=\"presentation\" {...props} />\n})\n\nCommandEmpty.displayName = 'CommandEmpty'\n\nexport const MultipleSelector = forwardRef<MultipleSelectorRef, MultipleSelectorProps>(\n (\n {\n value,\n onChange,\n placeholder,\n defaultOptions: arrayDefaultOptions = [],\n options: arrayOptions,\n delay,\n onSearch,\n onSearchSync,\n loadingIndicator: LoadingIndicator,\n emptyIndicator,\n maxSelected = Number.MAX_SAFE_INTEGER,\n onMaxSelected,\n hidePlaceholderWhenSelected,\n disabled,\n groupBy,\n className,\n badgeClassName,\n selectFirstItem = true,\n creatable = false,\n triggerSearchOnFocus = false,\n commandProps,\n inputProps,\n hideClearAllButton = false,\n onAddNewItem,\n }: MultipleSelectorProps,\n ref: React.Ref<MultipleSelectorRef>,\n ) => {\n const inputRef = useRef<HTMLInputElement>(null)\n const dropdownRef = useRef<HTMLDivElement>(null) // Added this\n\n const [open, setOpen] = useState(false)\n const [onScrollbar, setOnScrollbar] = useState(false)\n const [isLoading, setIsLoading] = useState(false)\n\n const [selected, setSelected] = useState<Option[]>(value || [])\n const [options, setOptions] = useState<GroupOption>(transToGroupOption(arrayDefaultOptions, groupBy))\n const [inputValue, setInputValue] = useState('')\n\n const debouncedSearchTerm = useDebounce(inputValue, delay || 500)\n\n useImperativeHandle(\n ref,\n () => ({\n selectedValue: [...selected],\n input: inputRef.current as HTMLInputElement,\n focus: () => inputRef?.current?.focus(),\n reset: () => setSelected([]),\n }),\n [selected],\n )\n\n const handleClickOutside = useCallback((event: MouseEvent | TouchEvent) => {\n if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node) && inputRef.current && !inputRef.current.contains(event.target as Node)) {\n setOpen(false)\n inputRef.current.blur()\n }\n }, [])\n\n const handleUnselect = useCallback(\n (option: Option) => {\n const newOptions = selected.filter((s) => s.value !== option.value)\n setSelected(newOptions)\n onChange?.(newOptions)\n },\n [onChange, selected],\n )\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n const input = inputRef.current\n if (!input) return\n\n if (e.key === 'Delete' || e.key === 'Backspace') {\n if (input.value === '' && selected.length > 0) {\n const lastSelectOption = selected[selected.length - 1]\n // If last item is fixed, we should not remove it.\n if (!lastSelectOption.fixed) {\n handleUnselect(selected[selected.length - 1])\n }\n }\n }\n\n // This is not a default behavior of the <input /> field\n if (e.key === 'Escape') {\n input.blur()\n }\n },\n [handleUnselect, selected],\n )\n\n useEffect(() => {\n if (open) {\n document.addEventListener('mousedown', handleClickOutside)\n document.addEventListener('touchend', handleClickOutside)\n } else {\n document.removeEventListener('mousedown', handleClickOutside)\n document.removeEventListener('touchend', handleClickOutside)\n }\n\n return () => {\n document.removeEventListener('mousedown', handleClickOutside)\n document.removeEventListener('touchend', handleClickOutside)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n useEffect(() => {\n if (value) {\n setSelected(value)\n }\n }, [value])\n\n useEffect(() => {\n /** If `onSearch` is provided, do not trigger options updated. */\n if (!arrayOptions || onSearch) {\n return\n }\n const newOption = transToGroupOption(arrayOptions || [], groupBy)\n if (JSON.stringify(newOption) !== JSON.stringify(options)) {\n setOptions(newOption)\n }\n }, [arrayDefaultOptions, arrayOptions, groupBy, onSearch, options])\n\n useEffect(() => {\n /** sync search */\n\n const doSearchSync = () => {\n const res = onSearchSync?.(debouncedSearchTerm)\n setOptions(transToGroupOption(res || [], groupBy))\n }\n\n const exec = async () => {\n if (!onSearchSync || !open) return\n\n if (triggerSearchOnFocus) {\n doSearchSync()\n }\n\n if (debouncedSearchTerm) {\n doSearchSync()\n }\n }\n\n void exec()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [debouncedSearchTerm, groupBy, open, triggerSearchOnFocus])\n\n useEffect(() => {\n /** async search */\n\n const doSearch = async () => {\n setIsLoading(true)\n const res = await onSearch?.(debouncedSearchTerm)\n setOptions(transToGroupOption(res || [], groupBy))\n setIsLoading(false)\n }\n\n const exec = async () => {\n if (!onSearch || !open) return\n\n if (triggerSearchOnFocus) {\n await doSearch()\n }\n\n if (debouncedSearchTerm) {\n await doSearch()\n }\n }\n\n void exec()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [debouncedSearchTerm, groupBy, open, triggerSearchOnFocus])\n\n const CreatableItem = () => {\n if (!creatable) return undefined\n if (isOptionsExist(options, [{ value: inputValue, label: inputValue }]) || selected.find((s) => s.value === inputValue)) {\n return undefined\n }\n\n const Item = (\n <CommandItem\n value={inputValue}\n className=\"cursor-pointer\"\n onMouseDown={(e) => {\n e.preventDefault()\n e.stopPropagation()\n }}\n onSelect={(value: string) => {\n if (selected.length >= maxSelected) {\n onMaxSelected?.(selected.length)\n return\n }\n setInputValue('')\n const newOptions = [...selected, { value, label: value }]\n setSelected(newOptions)\n onChange?.(newOptions)\n }}\n >\n {`Create \"${inputValue}\"`}\n </CommandItem>\n )\n\n // For normal creatable\n if (!onSearch && inputValue.length > 0) {\n return Item\n }\n\n // For async search creatable. avoid showing creatable item before loading at first.\n if (onSearch && debouncedSearchTerm.length > 0 && !isLoading) {\n return Item\n }\n\n return undefined\n }\n\n const EmptyItem = useCallback(() => {\n if (!emptyIndicator) return undefined\n\n // For async search that showing emptyIndicator\n if (onSearch && !creatable && Object.keys(options).length === 0) {\n return (\n <CommandItem value=\"-\" disabled>\n {emptyIndicator}\n </CommandItem>\n )\n }\n\n return <CommandEmpty>{emptyIndicator}</CommandEmpty>\n }, [creatable, emptyIndicator, onSearch, options])\n\n const selectables = useMemo<GroupOption>(() => removePickedOption(options, selected), [options, selected])\n\n /** Avoid Creatable Selector freezing or lagging when paste a long string. */\n const commandFilter = useCallback(() => {\n if (commandProps?.filter) {\n return commandProps.filter\n }\n\n if (creatable) {\n return (value: string, search: string) => {\n return value.toLowerCase().includes(search.toLowerCase()) ? 1 : -1\n }\n }\n // Using default filter in `cmdk`. We don&lsquo;t have to provide it.\n return undefined\n }, [creatable, commandProps?.filter])\n\n return (\n <Command\n ref={dropdownRef}\n {...commandProps}\n onKeyDown={(e) => {\n handleKeyDown(e)\n commandProps?.onKeyDown?.(e)\n }}\n className={cn('h-auto overflow-visible bg-transparent', commandProps?.className)}\n shouldFilter={commandProps?.shouldFilter !== undefined ? commandProps.shouldFilter : !onSearch} // When onSearch is provided, we don&lsquo;t want to filter the options. You can still override it.\n filter={commandFilter()}\n >\n <div\n className={cn(\n 'border-border-weak relative rounded-md border text-sm transition-shadow',\n 'focus-within:border-primary',\n 'focus-within:ring-primary-weak',\n 'focus-within:ring-4',\n 'focus-within:outline-hidden',\n 'has-disabled:bg-muted',\n 'has-disabled:text-muted-foreground',\n selected.length !== 0 && 'p-1',\n !disabled && selected.length !== 0 && 'cursor-text',\n !hideClearAllButton && 'pe-9',\n className,\n )}\n onClick={() => {\n if (disabled) return\n inputRef?.current?.focus()\n }}\n >\n <div className=\"flex flex-wrap gap-1\">\n {selected.map((option) => {\n return (\n <div\n key={option.value}\n className={cn(\n 'animate-fadeIn',\n 'bg-background',\n 'hover:bg-background',\n 'border-border-weak border border-solid',\n 'text-text-positive-weak relative inline-flex h-7 cursor-default items-center rounded-md ps-2 pe-7 pl-2 text-xs font-medium transition-all',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n 'data-fixed:pe-2',\n badgeClassName,\n )}\n data-fixed={option.fixed}\n data-disabled={disabled || undefined}\n >\n {option.label}\n <button\n type=\"button\"\n disabled={disabled || option.fixed}\n className={cn(\n 'text-text-positive-muted absolute -inset-y-px -end-px flex size-7 items-center justify-center rounded-e-lg border border-transparent p-0 outline-0 transition-colors',\n 'hover:text-foreground',\n 'focus-visible:outline',\n 'focus-visible:outline-2',\n 'focus-visible:outline-primary-weak',\n 'disabled:hover:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',\n )}\n onKeyDown={(e) => {\n if (e.key !== 'Enter') return\n handleUnselect(option)\n }}\n onMouseDown={(e) => {\n e.preventDefault()\n e.stopPropagation()\n }}\n onClick={() => handleUnselect(option)}\n aria-label=\"Remove\"\n >\n <X size={14} strokeWidth={2} aria-hidden=\"true\" />\n </button>\n </div>\n )\n })}\n {/* Avoid having the \"Search\" Icon */}\n <CommandPrimitive.Input\n {...inputProps}\n ref={inputRef}\n value={inputValue}\n disabled={disabled}\n onValueChange={(value) => {\n setInputValue(value)\n inputProps?.onValueChange?.(value)\n }}\n onBlur={(event) => {\n if (!onScrollbar) {\n setOpen(false)\n }\n inputProps?.onBlur?.(event)\n }}\n onFocus={(event) => {\n setOpen(true)\n if (triggerSearchOnFocus) {\n onSearch?.(debouncedSearchTerm)\n }\n inputProps?.onFocus?.(event)\n }}\n placeholder={hidePlaceholderWhenSelected && selected.length !== 0 ? '' : placeholder}\n className={cn(\n 'placeholder:text-text-positive-muted flex-1 bg-transparent outline-hidden',\n 'disabled:placeholder:text-transparent',\n {\n 'w-full': hidePlaceholderWhenSelected,\n 'px-3 py-2': selected.length === 0,\n 'ml-1': selected.length !== 0,\n },\n inputProps?.className,\n )}\n />\n <button\n type=\"button\"\n onClick={() => {\n setSelected(selected.filter((s) => s.fixed))\n onChange?.(selected.filter((s) => s.fixed))\n }}\n className={cn(\n 'text-muted-foreground/80',\n 'absolute end-0 top-0 flex size-9 items-center justify-center rounded-lg border border-transparent transition-colors',\n 'focus-visible:outline-2',\n 'hover:text-text-positive',\n 'focus-visible:outline-primary-weak',\n (hideClearAllButton || disabled || selected.length < 1 || selected.filter(({ fixed }) => fixed).length === selected.length) && 'hidden',\n )}\n aria-label=\"Clear all\"\n >\n <X size={16} strokeWidth={2} aria-hidden=\"true\" />\n </button>\n </div>\n </div>\n <div className=\"relative\">\n <div\n className={cn(\n 'shadow-dropdown absolute top-2 z-10 w-full overflow-hidden rounded-lg',\n 'data-[state=open]:animate-in',\n 'data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0',\n 'data-[state=open]:fade-in-0',\n 'data-[state=closed]:zoom-out-95',\n 'data-[state=open]:zoom-in-95',\n !open && 'hidden',\n )}\n data-state={open ? 'open' : 'closed'}\n >\n {open && (\n <CommandList\n className=\"shadow-lg outline-hidden\"\n onMouseLeave={() => {\n setOnScrollbar(false)\n }}\n onMouseEnter={() => {\n setOnScrollbar(true)\n }}\n onMouseUp={() => {\n inputRef?.current?.focus()\n }}\n >\n {onAddNewItem && (\n <>\n <CommandSeparator />\n <CommandGroup>\n <Button type=\"button\" variant=\"ghost\" className=\"w-full font-normal [&_div]:justify-start\" onClick={onAddNewItem}>\n <PlusIcon size={14} className=\"opacity-60\" aria-hidden=\"true\" />\n Thêm mới\n </Button>\n </CommandGroup>\n </>\n )}\n {isLoading ? (\n LoadingIndicator\n ) : (\n <>\n {EmptyItem()}\n {CreatableItem()}\n {!selectFirstItem && <CommandItem value=\"-\" className=\"hidden\" />}\n {Object.entries(selectables).map(([key, dropdowns]) => (\n <CommandGroup key={key} heading={key} className=\"h-full overflow-auto\">\n {dropdowns.map((option) => {\n return (\n <CommandItem\n key={option.value}\n value={option.value}\n disabled={option.disable}\n onMouseDown={(e) => {\n e.preventDefault()\n e.stopPropagation()\n }}\n onSelect={() => {\n if (selected.length >= maxSelected) {\n onMaxSelected?.(selected.length)\n return\n }\n const newOptions = [...selected, option]\n setInputValue('')\n setSelected(newOptions)\n onChange?.(newOptions)\n }}\n className={cn('cursor-pointer', option.disable && 'cursor-not-allowed opacity-50')}\n >\n {option.label}\n </CommandItem>\n )\n })}\n </CommandGroup>\n ))}\n </>\n )}\n </CommandList>\n )}\n </div>\n </div>\n </Command>\n )\n },\n)\n\nMultipleSelector.displayName = 'MultipleSelector'\n"],"mappings":"gTAyFA,SAAgB,EAAe,EAAU,EAAmB,CAC1D,GAAM,CAAC,EAAgB,IAAA,EAAA,EAAA,UAAiC,GAUxD,OARA,EAAA,EAAA,eAAgB,CACd,IAAM,EAAQ,eAAiB,EAAkB,GAAQ,GAAS,KAElE,UAAa,CACX,aAAa,KAEd,CAAC,EAAO,IAEJ,EAGT,SAAS,EAAmB,EAAmB,EAAkB,CAC/D,GAAI,EAAQ,SAAW,EACrB,MAAO,GAET,GAAI,CAAC,EACH,MAAO,CACL,GAAI,GAIR,IAAMA,EAA2B,GAQjC,OAPA,EAAQ,QAAS,GAAW,CAC1B,IAAM,EAAO,EAAO,IAAuB,GACtC,EAAY,KACf,EAAY,GAAO,IAErB,EAAY,GAAK,KAAK,KAEjB,EAGT,SAAS,EAAmB,EAA0B,EAAkB,CACtE,IAAM,EAAc,KAAK,MAAM,KAAK,UAAU,IAE9C,IAAK,GAAM,CAAC,EAAK,KAAU,OAAO,QAAQ,GACxC,EAAY,GAAO,EAAM,OAAQ,GAAQ,CAAC,EAAO,KAAM,GAAM,EAAE,QAAU,EAAI,QAE/E,OAAO,EAGT,SAAS,EAAe,EAA0B,EAAwB,CACxE,IAAK,GAAM,EAAG,KAAU,OAAO,QAAQ,GACrC,GAA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AY,MAAM,IAAI,UAAU,WACrD,OAAO,QAAQ,IAAa,KAAK,CAAC,EAAK,MACtC,EAAA,EAAA,KAACO,EAAAA,aAAAA,CAAuB,QAAS,EAAK,UAAU,gCAC7C,EAAU,IAAK,IAEZ,EAAA,EAAA,KAACP,EAAAA,YAAAA,CAEC,MAAO,EAAO,MACd,SAAU,EAAO,QACjB,YAAc,GAAM,CAClB,EAAE,iBACF,EAAE,mBAEJ,aAAgB,CACd,GAAI,EAAS,QAAU,EAAa,CAClC,IAAgB,EAAS,QACzB,OAEF,IAAM,EAAa,CAAC,GAAG,EAAU,GACjC,EAAc,IACd,EAAY,GACZ,IAAW,IAEb,WAAA,EAAA,EAAA,IAAc,iBAAkB,EAAO,SAAW,0CAEjD,EAAO,OAnBH,EAAO,SAJD,mBAwCzC,EAAiB,YAAc"}
@@ -1,2 +1,2 @@
1
- import{Button as e}from"./button-CvQQTSka.js";import{Command as t,CommandGroup as n,CommandItem as r,CommandList as i,CommandSeparator as ee}from"./command-CyWyRcle.js";import{PlusIcon as te,X as a}from"lucide-react";import{cn as o}from"@customafk/react-toolkit/utils";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";import{forwardRef as u,useCallback as d,useEffect as f,useImperativeHandle as ne,useMemo as re,useRef as p,useState as m}from"react";import{Command as h,useCommandState as g}from"cmdk";function _(e,t){let[n,r]=m(e);return f(()=>{let n=setTimeout(()=>r(e),t||500);return()=>{clearTimeout(n)}},[e,t]),n}function v(e,t){if(e.length===0)return{};if(!t)return{"":e};let n={};return e.forEach(e=>{let r=e[t]||``;n[r]||(n[r]=[]),n[r].push(e)}),n}function ie(e,t){let n=JSON.parse(JSON.stringify(e));for(let[e,r]of Object.entries(n))n[e]=r.filter(e=>!t.find(t=>t.value===e.value));return n}function ae(e,t){for(let[,n]of Object.entries(e))if(n.some(e=>t.find(t=>t.value===e.value)))return!0;return!1}const y=u(({className:e,...t},n)=>{let r=g(e=>e.filtered.count===0);return r?c(`div`,{ref:n,className:o(`px-2 py-4 text-center text-sm`,e),"cmdk-empty":``,role:`presentation`,...t}):null});y.displayName=`CommandEmpty`;const b=u(({value:u,onChange:g,placeholder:b,defaultOptions:x=[],options:S,delay:oe,onSearch:C,onSearchSync:w,loadingIndicator:se,emptyIndicator:T,maxSelected:E=9007199254740991,onMaxSelected:D,hidePlaceholderWhenSelected:O,disabled:k,groupBy:A,className:ce,badgeClassName:le,selectFirstItem:ue=!0,creatable:j=!1,triggerSearchOnFocus:M=!1,commandProps:N,inputProps:P,hideClearAllButton:F=!1,onAddNewItem:I},de)=>{let L=p(null),R=p(null),[z,B]=m(!1),[V,H]=m(!1),[U,W]=m(!1),[G,K]=m(u||[]),[q,J]=m(v(x,A)),[Y,X]=m(``),Z=_(Y,oe||500);ne(de,()=>({selectedValue:[...G],input:L.current,focus:()=>L?.current?.focus(),reset:()=>K([])}),[G]);let Q=d(e=>{R.current&&!R.current.contains(e.target)&&L.current&&!L.current.contains(e.target)&&(B(!1),L.current.blur())},[]),$=d(e=>{let t=G.filter(t=>t.value!==e.value);K(t),g?.(t)},[g,G]),fe=d(e=>{let t=L.current;if(t){if((e.key===`Delete`||e.key===`Backspace`)&&t.value===``&&G.length>0){let e=G[G.length-1];e.fixed||$(G[G.length-1])}e.key===`Escape`&&t.blur()}},[$,G]);f(()=>(z?(document.addEventListener(`mousedown`,Q),document.addEventListener(`touchend`,Q)):(document.removeEventListener(`mousedown`,Q),document.removeEventListener(`touchend`,Q)),()=>{document.removeEventListener(`mousedown`,Q),document.removeEventListener(`touchend`,Q)}),[z]),f(()=>{u&&K(u)},[u]),f(()=>{if(!S||C)return;let e=v(S||[],A);JSON.stringify(e)!==JSON.stringify(q)&&J(e)},[x,S,A,C,q]),f(()=>{let e=()=>{let e=w?.(Z);J(v(e||[],A))},t=async()=>{!w||!z||(M&&e(),Z&&e())};t()},[Z,A,z,M]),f(()=>{let e=async()=>{W(!0);let e=await C?.(Z);J(v(e||[],A)),W(!1)},t=async()=>{!C||!z||(M&&await e(),Z&&await e())};t()},[Z,A,z,M]);let pe=()=>{if(!j||ae(q,[{value:Y,label:Y}])||G.find(e=>e.value===Y))return;let e=c(r,{value:Y,className:`cursor-pointer`,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onSelect:e=>{if(G.length>=E){D?.(G.length);return}X(``);let t=[...G,{value:e,label:e}];K(t),g?.(t)},children:`Create "${Y}"`});if(!C&&Y.length>0||C&&Z.length>0&&!U)return e},me=d(()=>{if(T)return C&&!j&&Object.keys(q).length===0?c(r,{value:`-`,disabled:!0,children:T}):c(y,{children:T})},[j,T,C,q]),he=re(()=>ie(q,G),[q,G]),ge=d(()=>{if(N?.filter)return N.filter;if(j)return(e,t)=>e.toLowerCase().includes(t.toLowerCase())?1:-1},[j,N?.filter]);return l(t,{ref:R,...N,onKeyDown:e=>{fe(e),N?.onKeyDown?.(e)},className:o(`h-auto overflow-visible bg-transparent`,N?.className),shouldFilter:N?.shouldFilter===void 0?!C:N.shouldFilter,filter:ge(),children:[c(`div`,{className:o(`border-border-weak relative rounded-md border text-sm transition-shadow`,`focus-within:border-primary`,`focus-within:ring-primary-weak`,`focus-within:ring-4`,`focus-within:outline-hidden`,`has-disabled:bg-muted`,`has-disabled:text-muted-foreground`,G.length!==0&&`p-1`,!k&&G.length!==0&&`cursor-text`,!F&&`pe-9`,ce),onClick:()=>{k||L?.current?.focus()},children:l(`div`,{className:`flex flex-wrap gap-1`,children:[G.map(e=>l(`div`,{className:o(`animate-fadeIn`,`bg-background`,`hover:bg-background`,`border-border-weak border border-solid`,`text-text-positive-weak relative inline-flex h-7 cursor-default items-center rounded-md ps-2 pe-7 pl-2 text-xs font-medium transition-all`,`disabled:cursor-not-allowed`,`disabled:opacity-50`,`data-fixed:pe-2`,le),"data-fixed":e.fixed,"data-disabled":k||void 0,children:[e.label,c(`button`,{type:`button`,disabled:k||e.fixed,className:o(`text-text-positive-muted absolute -inset-y-px -end-px flex size-7 items-center justify-center rounded-e-lg border border-transparent p-0 outline-0 transition-colors`,`hover:text-foreground`,`focus-visible:outline`,`focus-visible:outline-2`,`focus-visible:outline-primary-weak`,`disabled:hover:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`),onKeyDown:t=>{t.key===`Enter`&&$(e)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:()=>$(e),"aria-label":`Remove`,children:c(a,{size:14,strokeWidth:2,"aria-hidden":`true`})})]},e.value)),c(h.Input,{...P,ref:L,value:Y,disabled:k,onValueChange:e=>{X(e),P?.onValueChange?.(e)},onBlur:e=>{V||B(!1),P?.onBlur?.(e)},onFocus:e=>{B(!0),M&&C?.(Z),P?.onFocus?.(e)},placeholder:O&&G.length!==0?``:b,className:o(`placeholder:text-text-positive-muted flex-1 bg-transparent outline-hidden`,`disabled:placeholder:text-transparent`,{"w-full":O,"px-3 py-2":G.length===0,"ml-1":G.length!==0},P?.className)}),c(`button`,{type:`button`,onClick:()=>{K(G.filter(e=>e.fixed)),g?.(G.filter(e=>e.fixed))},className:o(`text-muted-foreground/80`,`absolute end-0 top-0 flex size-9 items-center justify-center rounded-lg border border-transparent transition-colors`,`focus-visible:outline-2`,`hover:text-text-positive`,`focus-visible:outline-primary-weak`,(F||k||G.length<1||G.filter(({fixed:e})=>e).length===G.length)&&`hidden`),"aria-label":`Clear all`,children:c(a,{size:16,strokeWidth:2,"aria-hidden":`true`})})]})}),c(`div`,{className:`relative`,children:c(`div`,{className:o(`shadow-dropdown absolute top-2 z-10 w-full overflow-hidden rounded-lg`,`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`,!z&&`hidden`),"data-state":z?`open`:`closed`,children:z&&l(i,{className:`shadow-lg outline-hidden`,onMouseLeave:()=>{H(!1)},onMouseEnter:()=>{H(!0)},onMouseUp:()=>{L?.current?.focus()},children:[I&&l(s,{children:[c(ee,{}),c(n,{children:l(e,{type:`button`,variant:`ghost`,className:`w-full font-normal [&_div]:justify-start`,onClick:I,children:[c(te,{size:14,className:`opacity-60`,"aria-hidden":`true`}),`Thêm mới`]})})]}),U?se:l(s,{children:[me(),pe(),!ue&&c(r,{value:`-`,className:`hidden`}),Object.entries(he).map(([e,t])=>c(n,{heading:e,className:`h-full overflow-auto`,children:t.map(e=>c(r,{value:e.value,disabled:e.disable,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onSelect:()=>{if(G.length>=E){D?.(G.length);return}let t=[...G,e];X(``),K(t),g?.(t)},className:o(`cursor-pointer`,e.disable&&`cursor-not-allowed opacity-50`),children:e.label},e.value))},e))]})]})})})]})});b.displayName=`MultipleSelector`;export{b as MultipleSelector,_ as useDebounce};
2
- //# sourceMappingURL=multi-select-DyhAPckx.js.map
1
+ import{Button as e}from"./button-CvQQTSka.js";import{Command as t,CommandGroup as n,CommandItem as r,CommandList as i,CommandSeparator as ee}from"./command-BNKI-kLT.js";import{PlusIcon as te,X as a}from"lucide-react";import{cn as o}from"@customafk/react-toolkit/utils";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";import{forwardRef as u,useCallback as d,useEffect as f,useImperativeHandle as ne,useMemo as re,useRef as p,useState as m}from"react";import{Command as h,useCommandState as g}from"cmdk";function _(e,t){let[n,r]=m(e);return f(()=>{let n=setTimeout(()=>r(e),t||500);return()=>{clearTimeout(n)}},[e,t]),n}function v(e,t){if(e.length===0)return{};if(!t)return{"":e};let n={};return e.forEach(e=>{let r=e[t]||``;n[r]||(n[r]=[]),n[r].push(e)}),n}function ie(e,t){let n=JSON.parse(JSON.stringify(e));for(let[e,r]of Object.entries(n))n[e]=r.filter(e=>!t.find(t=>t.value===e.value));return n}function ae(e,t){for(let[,n]of Object.entries(e))if(n.some(e=>t.find(t=>t.value===e.value)))return!0;return!1}const y=u(({className:e,...t},n)=>{let r=g(e=>e.filtered.count===0);return r?c(`div`,{ref:n,className:o(`px-2 py-4 text-center text-sm`,e),"cmdk-empty":``,role:`presentation`,...t}):null});y.displayName=`CommandEmpty`;const b=u(({value:u,onChange:g,placeholder:b,defaultOptions:x=[],options:S,delay:oe,onSearch:C,onSearchSync:w,loadingIndicator:se,emptyIndicator:T,maxSelected:E=9007199254740991,onMaxSelected:D,hidePlaceholderWhenSelected:O,disabled:k,groupBy:A,className:ce,badgeClassName:le,selectFirstItem:ue=!0,creatable:j=!1,triggerSearchOnFocus:M=!1,commandProps:N,inputProps:P,hideClearAllButton:F=!1,onAddNewItem:I},de)=>{let L=p(null),R=p(null),[z,B]=m(!1),[V,H]=m(!1),[U,W]=m(!1),[G,K]=m(u||[]),[q,J]=m(v(x,A)),[Y,X]=m(``),Z=_(Y,oe||500);ne(de,()=>({selectedValue:[...G],input:L.current,focus:()=>L?.current?.focus(),reset:()=>K([])}),[G]);let Q=d(e=>{R.current&&!R.current.contains(e.target)&&L.current&&!L.current.contains(e.target)&&(B(!1),L.current.blur())},[]),$=d(e=>{let t=G.filter(t=>t.value!==e.value);K(t),g?.(t)},[g,G]),fe=d(e=>{let t=L.current;if(t){if((e.key===`Delete`||e.key===`Backspace`)&&t.value===``&&G.length>0){let e=G[G.length-1];e.fixed||$(G[G.length-1])}e.key===`Escape`&&t.blur()}},[$,G]);f(()=>(z?(document.addEventListener(`mousedown`,Q),document.addEventListener(`touchend`,Q)):(document.removeEventListener(`mousedown`,Q),document.removeEventListener(`touchend`,Q)),()=>{document.removeEventListener(`mousedown`,Q),document.removeEventListener(`touchend`,Q)}),[z]),f(()=>{u&&K(u)},[u]),f(()=>{if(!S||C)return;let e=v(S||[],A);JSON.stringify(e)!==JSON.stringify(q)&&J(e)},[x,S,A,C,q]),f(()=>{let e=()=>{let e=w?.(Z);J(v(e||[],A))},t=async()=>{!w||!z||(M&&e(),Z&&e())};t()},[Z,A,z,M]),f(()=>{let e=async()=>{W(!0);let e=await C?.(Z);J(v(e||[],A)),W(!1)},t=async()=>{!C||!z||(M&&await e(),Z&&await e())};t()},[Z,A,z,M]);let pe=()=>{if(!j||ae(q,[{value:Y,label:Y}])||G.find(e=>e.value===Y))return;let e=c(r,{value:Y,className:`cursor-pointer`,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onSelect:e=>{if(G.length>=E){D?.(G.length);return}X(``);let t=[...G,{value:e,label:e}];K(t),g?.(t)},children:`Create "${Y}"`});if(!C&&Y.length>0||C&&Z.length>0&&!U)return e},me=d(()=>{if(T)return C&&!j&&Object.keys(q).length===0?c(r,{value:`-`,disabled:!0,children:T}):c(y,{children:T})},[j,T,C,q]),he=re(()=>ie(q,G),[q,G]),ge=d(()=>{if(N?.filter)return N.filter;if(j)return(e,t)=>e.toLowerCase().includes(t.toLowerCase())?1:-1},[j,N?.filter]);return l(t,{ref:R,...N,onKeyDown:e=>{fe(e),N?.onKeyDown?.(e)},className:o(`h-auto overflow-visible bg-transparent`,N?.className),shouldFilter:N?.shouldFilter===void 0?!C:N.shouldFilter,filter:ge(),children:[c(`div`,{className:o(`border-border-weak relative rounded-md border text-sm transition-shadow`,`focus-within:border-primary`,`focus-within:ring-primary-weak`,`focus-within:ring-4`,`focus-within:outline-hidden`,`has-disabled:bg-muted`,`has-disabled:text-muted-foreground`,G.length!==0&&`p-1`,!k&&G.length!==0&&`cursor-text`,!F&&`pe-9`,ce),onClick:()=>{k||L?.current?.focus()},children:l(`div`,{className:`flex flex-wrap gap-1`,children:[G.map(e=>l(`div`,{className:o(`animate-fadeIn`,`bg-background`,`hover:bg-background`,`border-border-weak border border-solid`,`text-text-positive-weak relative inline-flex h-7 cursor-default items-center rounded-md ps-2 pe-7 pl-2 text-xs font-medium transition-all`,`disabled:cursor-not-allowed`,`disabled:opacity-50`,`data-fixed:pe-2`,le),"data-fixed":e.fixed,"data-disabled":k||void 0,children:[e.label,c(`button`,{type:`button`,disabled:k||e.fixed,className:o(`text-text-positive-muted absolute -inset-y-px -end-px flex size-7 items-center justify-center rounded-e-lg border border-transparent p-0 outline-0 transition-colors`,`hover:text-foreground`,`focus-visible:outline`,`focus-visible:outline-2`,`focus-visible:outline-primary-weak`,`disabled:hover:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`),onKeyDown:t=>{t.key===`Enter`&&$(e)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:()=>$(e),"aria-label":`Remove`,children:c(a,{size:14,strokeWidth:2,"aria-hidden":`true`})})]},e.value)),c(h.Input,{...P,ref:L,value:Y,disabled:k,onValueChange:e=>{X(e),P?.onValueChange?.(e)},onBlur:e=>{V||B(!1),P?.onBlur?.(e)},onFocus:e=>{B(!0),M&&C?.(Z),P?.onFocus?.(e)},placeholder:O&&G.length!==0?``:b,className:o(`placeholder:text-text-positive-muted flex-1 bg-transparent outline-hidden`,`disabled:placeholder:text-transparent`,{"w-full":O,"px-3 py-2":G.length===0,"ml-1":G.length!==0},P?.className)}),c(`button`,{type:`button`,onClick:()=>{K(G.filter(e=>e.fixed)),g?.(G.filter(e=>e.fixed))},className:o(`text-muted-foreground/80`,`absolute end-0 top-0 flex size-9 items-center justify-center rounded-lg border border-transparent transition-colors`,`focus-visible:outline-2`,`hover:text-text-positive`,`focus-visible:outline-primary-weak`,(F||k||G.length<1||G.filter(({fixed:e})=>e).length===G.length)&&`hidden`),"aria-label":`Clear all`,children:c(a,{size:16,strokeWidth:2,"aria-hidden":`true`})})]})}),c(`div`,{className:`relative`,children:c(`div`,{className:o(`shadow-dropdown absolute top-2 z-10 w-full overflow-hidden rounded-lg`,`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`,!z&&`hidden`),"data-state":z?`open`:`closed`,children:z&&l(i,{className:`shadow-lg outline-hidden`,onMouseLeave:()=>{H(!1)},onMouseEnter:()=>{H(!0)},onMouseUp:()=>{L?.current?.focus()},children:[I&&l(s,{children:[c(ee,{}),c(n,{children:l(e,{type:`button`,variant:`ghost`,className:`w-full font-normal [&_div]:justify-start`,onClick:I,children:[c(te,{size:14,className:`opacity-60`,"aria-hidden":`true`}),`Thêm mới`]})})]}),U?se:l(s,{children:[me(),pe(),!ue&&c(r,{value:`-`,className:`hidden`}),Object.entries(he).map(([e,t])=>c(n,{heading:e,className:`h-full overflow-auto`,children:t.map(e=>c(r,{value:e.value,disabled:e.disable,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onSelect:()=>{if(G.length>=E){D?.(G.length);return}let t=[...G,e];X(``),K(t),g?.(t)},className:o(`cursor-pointer`,e.disable&&`cursor-not-allowed opacity-50`),children:e.label},e.value))},e))]})]})})})]})});b.displayName=`MultipleSelector`;export{b as MultipleSelector,_ as useDebounce};
2
+ //# sourceMappingURL=multi-select-DLWPfDCM.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"multi-select-DyhAPckx.js","names":["groupOption: GroupOption","value","Command","CommandPrimitive"],"sources":["../packages/components/ui/multi-select.tsx"],"sourcesContent":["'use client'\nimport { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nimport { PlusIcon, X } from 'lucide-react'\n\nimport { Button } from '@/components/ui/button'\nimport { Command, CommandGroup, CommandItem, CommandList, CommandSeparator } from '@/components/ui/command'\n\nimport { Command as CommandPrimitive, useCommandState } from 'cmdk'\n\nexport interface Option {\n value: string\n label: string\n disable?: boolean\n /** fixed option that can&lsquo;t be removed. */\n fixed?: boolean\n /** Group the options by providing key. */\n [key: string]: string | boolean | undefined\n}\ninterface GroupOption {\n [key: string]: Option[]\n}\n\ninterface MultipleSelectorProps {\n value?: Option[]\n defaultOptions?: Option[]\n /** manually controlled options */\n options?: Option[]\n placeholder?: string\n /** Loading component. */\n loadingIndicator?: React.ReactNode\n /** Empty component. */\n emptyIndicator?: React.ReactNode\n /** Debounce time for async search. Only work with `onSearch`. */\n delay?: number\n /**\n * Only work with `onSearch` prop. Trigger search when `onFocus`.\n * For example, when user click on the input, it will trigger the search to get initial options.\n **/\n triggerSearchOnFocus?: boolean\n /** async search */\n onSearch?: (value: string) => Promise<Option[]>\n /**\n * sync search. This search will not showing loadingIndicator.\n * The rest props are the same as async search.\n * i.e.: creatable, groupBy, delay.\n **/\n onSearchSync?: (value: string) => Option[]\n onChange?: (options: Option[]) => void\n /** Limit the maximum number of selected options. */\n maxSelected?: number\n /** When the number of selected options exceeds the limit, the onMaxSelected will be called. */\n onMaxSelected?: (maxLimit: number) => void\n /** Hide the placeholder when there are options selected. */\n hidePlaceholderWhenSelected?: boolean\n disabled?: boolean\n /** Group the options base on provided key. */\n groupBy?: string\n className?: string\n badgeClassName?: string\n /**\n * First item selected is a default behavior by cmdk. That is why the default is true.\n * This is a workaround solution by add a dummy item.\n *\n * @reference: https://github.com/pacocoursey/cmdk/issues/171\n */\n selectFirstItem?: boolean\n /** Allow user to create option when there is no option matched. */\n creatable?: boolean\n /** Props of `Command` */\n commandProps?: React.ComponentPropsWithoutRef<typeof Command>\n /** Props of `CommandInput` */\n inputProps?: Omit<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>, 'value' | 'placeholder' | 'disabled'>\n /** hide the clear all button. */\n hideClearAllButton?: boolean\n\n /** Add new item event for select with search */\n onAddNewItem?: () => void\n}\n\nexport interface MultipleSelectorRef {\n selectedValue: Option[]\n input: HTMLInputElement\n focus: () => void\n reset: () => void\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useDebounce<T>(value: T, delay?: number): T {\n const [debouncedValue, setDebouncedValue] = useState<T>(value)\n\n useEffect(() => {\n const timer = setTimeout(() => setDebouncedValue(value), delay || 500)\n\n return () => {\n clearTimeout(timer)\n }\n }, [value, delay])\n\n return debouncedValue\n}\n\nfunction transToGroupOption(options: Option[], groupBy?: string) {\n if (options.length === 0) {\n return {}\n }\n if (!groupBy) {\n return {\n '': options,\n }\n }\n\n const groupOption: GroupOption = {}\n options.forEach((option) => {\n const key = (option[groupBy] as string) || ''\n if (!groupOption[key]) {\n groupOption[key] = []\n }\n groupOption[key].push(option)\n })\n return groupOption\n}\n\nfunction removePickedOption(groupOption: GroupOption, picked: Option[]) {\n const cloneOption = JSON.parse(JSON.stringify(groupOption)) as GroupOption\n\n for (const [key, value] of Object.entries(cloneOption)) {\n cloneOption[key] = value.filter((val) => !picked.find((p) => p.value === val.value))\n }\n return cloneOption\n}\n\nfunction isOptionsExist(groupOption: GroupOption, targetOption: Option[]) {\n for (const [, value] of Object.entries(groupOption)) {\n if (value.some((option) => targetOption.find((p) => p.value === option.value))) {\n return true\n }\n }\n return false\n}\n\n/**\n * The `CommandEmpty` of shadcn/ui will cause the cmdk empty not rendering correctly.\n * So we create one and copy the `Empty` implementation from `cmdk`.\n *\n * @reference: https://github.com/hsuanyi-chou/shadcn-ui-expansions/issues/34#issuecomment-1949561607\n **/\nconst CommandEmpty = forwardRef<HTMLDivElement, React.ComponentProps<typeof CommandPrimitive.Empty>>(({ className, ...props }, forwardedRef) => {\n const render = useCommandState((state) => state.filtered.count === 0)\n\n if (!render) return null\n\n return <div ref={forwardedRef} className={cn('px-2 py-4 text-center text-sm', className)} cmdk-empty=\"\" role=\"presentation\" {...props} />\n})\n\nCommandEmpty.displayName = 'CommandEmpty'\n\nexport const MultipleSelector = forwardRef<MultipleSelectorRef, MultipleSelectorProps>(\n (\n {\n value,\n onChange,\n placeholder,\n defaultOptions: arrayDefaultOptions = [],\n options: arrayOptions,\n delay,\n onSearch,\n onSearchSync,\n loadingIndicator: LoadingIndicator,\n emptyIndicator,\n maxSelected = Number.MAX_SAFE_INTEGER,\n onMaxSelected,\n hidePlaceholderWhenSelected,\n disabled,\n groupBy,\n className,\n badgeClassName,\n selectFirstItem = true,\n creatable = false,\n triggerSearchOnFocus = false,\n commandProps,\n inputProps,\n hideClearAllButton = false,\n onAddNewItem,\n }: MultipleSelectorProps,\n ref: React.Ref<MultipleSelectorRef>,\n ) => {\n const inputRef = useRef<HTMLInputElement>(null)\n const dropdownRef = useRef<HTMLDivElement>(null) // Added this\n\n const [open, setOpen] = useState(false)\n const [onScrollbar, setOnScrollbar] = useState(false)\n const [isLoading, setIsLoading] = useState(false)\n\n const [selected, setSelected] = useState<Option[]>(value || [])\n const [options, setOptions] = useState<GroupOption>(transToGroupOption(arrayDefaultOptions, groupBy))\n const [inputValue, setInputValue] = useState('')\n\n const debouncedSearchTerm = useDebounce(inputValue, delay || 500)\n\n useImperativeHandle(\n ref,\n () => ({\n selectedValue: [...selected],\n input: inputRef.current as HTMLInputElement,\n focus: () => inputRef?.current?.focus(),\n reset: () => setSelected([]),\n }),\n [selected],\n )\n\n const handleClickOutside = useCallback((event: MouseEvent | TouchEvent) => {\n if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node) && inputRef.current && !inputRef.current.contains(event.target as Node)) {\n setOpen(false)\n inputRef.current.blur()\n }\n }, [])\n\n const handleUnselect = useCallback(\n (option: Option) => {\n const newOptions = selected.filter((s) => s.value !== option.value)\n setSelected(newOptions)\n onChange?.(newOptions)\n },\n [onChange, selected],\n )\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n const input = inputRef.current\n if (!input) return\n\n if (e.key === 'Delete' || e.key === 'Backspace') {\n if (input.value === '' && selected.length > 0) {\n const lastSelectOption = selected[selected.length - 1]\n // If last item is fixed, we should not remove it.\n if (!lastSelectOption.fixed) {\n handleUnselect(selected[selected.length - 1])\n }\n }\n }\n\n // This is not a default behavior of the <input /> field\n if (e.key === 'Escape') {\n input.blur()\n }\n },\n [handleUnselect, selected],\n )\n\n useEffect(() => {\n if (open) {\n document.addEventListener('mousedown', handleClickOutside)\n document.addEventListener('touchend', handleClickOutside)\n } else {\n document.removeEventListener('mousedown', handleClickOutside)\n document.removeEventListener('touchend', handleClickOutside)\n }\n\n return () => {\n document.removeEventListener('mousedown', handleClickOutside)\n document.removeEventListener('touchend', handleClickOutside)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n useEffect(() => {\n if (value) {\n setSelected(value)\n }\n }, [value])\n\n useEffect(() => {\n /** If `onSearch` is provided, do not trigger options updated. */\n if (!arrayOptions || onSearch) {\n return\n }\n const newOption = transToGroupOption(arrayOptions || [], groupBy)\n if (JSON.stringify(newOption) !== JSON.stringify(options)) {\n setOptions(newOption)\n }\n }, [arrayDefaultOptions, arrayOptions, groupBy, onSearch, options])\n\n useEffect(() => {\n /** sync search */\n\n const doSearchSync = () => {\n const res = onSearchSync?.(debouncedSearchTerm)\n setOptions(transToGroupOption(res || [], groupBy))\n }\n\n const exec = async () => {\n if (!onSearchSync || !open) return\n\n if (triggerSearchOnFocus) {\n doSearchSync()\n }\n\n if (debouncedSearchTerm) {\n doSearchSync()\n }\n }\n\n void exec()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [debouncedSearchTerm, groupBy, open, triggerSearchOnFocus])\n\n useEffect(() => {\n /** async search */\n\n const doSearch = async () => {\n setIsLoading(true)\n const res = await onSearch?.(debouncedSearchTerm)\n setOptions(transToGroupOption(res || [], groupBy))\n setIsLoading(false)\n }\n\n const exec = async () => {\n if (!onSearch || !open) return\n\n if (triggerSearchOnFocus) {\n await doSearch()\n }\n\n if (debouncedSearchTerm) {\n await doSearch()\n }\n }\n\n void exec()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [debouncedSearchTerm, groupBy, open, triggerSearchOnFocus])\n\n const CreatableItem = () => {\n if (!creatable) return undefined\n if (isOptionsExist(options, [{ value: inputValue, label: inputValue }]) || selected.find((s) => s.value === inputValue)) {\n return undefined\n }\n\n const Item = (\n <CommandItem\n value={inputValue}\n className=\"cursor-pointer\"\n onMouseDown={(e) => {\n e.preventDefault()\n e.stopPropagation()\n }}\n onSelect={(value: string) => {\n if (selected.length >= maxSelected) {\n onMaxSelected?.(selected.length)\n return\n }\n setInputValue('')\n const newOptions = [...selected, { value, label: value }]\n setSelected(newOptions)\n onChange?.(newOptions)\n }}\n >\n {`Create \"${inputValue}\"`}\n </CommandItem>\n )\n\n // For normal creatable\n if (!onSearch && inputValue.length > 0) {\n return Item\n }\n\n // For async search creatable. avoid showing creatable item before loading at first.\n if (onSearch && debouncedSearchTerm.length > 0 && !isLoading) {\n return Item\n }\n\n return undefined\n }\n\n const EmptyItem = useCallback(() => {\n if (!emptyIndicator) return undefined\n\n // For async search that showing emptyIndicator\n if (onSearch && !creatable && Object.keys(options).length === 0) {\n return (\n <CommandItem value=\"-\" disabled>\n {emptyIndicator}\n </CommandItem>\n )\n }\n\n return <CommandEmpty>{emptyIndicator}</CommandEmpty>\n }, [creatable, emptyIndicator, onSearch, options])\n\n const selectables = useMemo<GroupOption>(() => removePickedOption(options, selected), [options, selected])\n\n /** Avoid Creatable Selector freezing or lagging when paste a long string. */\n const commandFilter = useCallback(() => {\n if (commandProps?.filter) {\n return commandProps.filter\n }\n\n if (creatable) {\n return (value: string, search: string) => {\n return value.toLowerCase().includes(search.toLowerCase()) ? 1 : -1\n }\n }\n // Using default filter in `cmdk`. We don&lsquo;t have to provide it.\n return undefined\n }, [creatable, commandProps?.filter])\n\n return (\n <Command\n ref={dropdownRef}\n {...commandProps}\n onKeyDown={(e) => {\n handleKeyDown(e)\n commandProps?.onKeyDown?.(e)\n }}\n className={cn('h-auto overflow-visible bg-transparent', commandProps?.className)}\n shouldFilter={commandProps?.shouldFilter !== undefined ? commandProps.shouldFilter : !onSearch} // When onSearch is provided, we don&lsquo;t want to filter the options. You can still override it.\n filter={commandFilter()}\n >\n <div\n className={cn(\n 'border-border-weak relative rounded-md border text-sm transition-shadow',\n 'focus-within:border-primary',\n 'focus-within:ring-primary-weak',\n 'focus-within:ring-4',\n 'focus-within:outline-hidden',\n 'has-disabled:bg-muted',\n 'has-disabled:text-muted-foreground',\n selected.length !== 0 && 'p-1',\n !disabled && selected.length !== 0 && 'cursor-text',\n !hideClearAllButton && 'pe-9',\n className,\n )}\n onClick={() => {\n if (disabled) return\n inputRef?.current?.focus()\n }}\n >\n <div className=\"flex flex-wrap gap-1\">\n {selected.map((option) => {\n return (\n <div\n key={option.value}\n className={cn(\n 'animate-fadeIn',\n 'bg-background',\n 'hover:bg-background',\n 'border-border-weak border border-solid',\n 'text-text-positive-weak relative inline-flex h-7 cursor-default items-center rounded-md ps-2 pe-7 pl-2 text-xs font-medium transition-all',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n 'data-fixed:pe-2',\n badgeClassName,\n )}\n data-fixed={option.fixed}\n data-disabled={disabled || undefined}\n >\n {option.label}\n <button\n type=\"button\"\n disabled={disabled || option.fixed}\n className={cn(\n 'text-text-positive-muted absolute -inset-y-px -end-px flex size-7 items-center justify-center rounded-e-lg border border-transparent p-0 outline-0 transition-colors',\n 'hover:text-foreground',\n 'focus-visible:outline',\n 'focus-visible:outline-2',\n 'focus-visible:outline-primary-weak',\n 'disabled:hover:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',\n )}\n onKeyDown={(e) => {\n if (e.key !== 'Enter') return\n handleUnselect(option)\n }}\n onMouseDown={(e) => {\n e.preventDefault()\n e.stopPropagation()\n }}\n onClick={() => handleUnselect(option)}\n aria-label=\"Remove\"\n >\n <X size={14} strokeWidth={2} aria-hidden=\"true\" />\n </button>\n </div>\n )\n })}\n {/* Avoid having the \"Search\" Icon */}\n <CommandPrimitive.Input\n {...inputProps}\n ref={inputRef}\n value={inputValue}\n disabled={disabled}\n onValueChange={(value) => {\n setInputValue(value)\n inputProps?.onValueChange?.(value)\n }}\n onBlur={(event) => {\n if (!onScrollbar) {\n setOpen(false)\n }\n inputProps?.onBlur?.(event)\n }}\n onFocus={(event) => {\n setOpen(true)\n if (triggerSearchOnFocus) {\n onSearch?.(debouncedSearchTerm)\n }\n inputProps?.onFocus?.(event)\n }}\n placeholder={hidePlaceholderWhenSelected && selected.length !== 0 ? '' : placeholder}\n className={cn(\n 'placeholder:text-text-positive-muted flex-1 bg-transparent outline-hidden',\n 'disabled:placeholder:text-transparent',\n {\n 'w-full': hidePlaceholderWhenSelected,\n 'px-3 py-2': selected.length === 0,\n 'ml-1': selected.length !== 0,\n },\n inputProps?.className,\n )}\n />\n <button\n type=\"button\"\n onClick={() => {\n setSelected(selected.filter((s) => s.fixed))\n onChange?.(selected.filter((s) => s.fixed))\n }}\n className={cn(\n 'text-muted-foreground/80',\n 'absolute end-0 top-0 flex size-9 items-center justify-center rounded-lg border border-transparent transition-colors',\n 'focus-visible:outline-2',\n 'hover:text-text-positive',\n 'focus-visible:outline-primary-weak',\n (hideClearAllButton || disabled || selected.length < 1 || selected.filter(({ fixed }) => fixed).length === selected.length) && 'hidden',\n )}\n aria-label=\"Clear all\"\n >\n <X size={16} strokeWidth={2} aria-hidden=\"true\" />\n </button>\n </div>\n </div>\n <div className=\"relative\">\n <div\n className={cn(\n 'shadow-dropdown absolute top-2 z-10 w-full overflow-hidden rounded-lg',\n 'data-[state=open]:animate-in',\n 'data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0',\n 'data-[state=open]:fade-in-0',\n 'data-[state=closed]:zoom-out-95',\n 'data-[state=open]:zoom-in-95',\n !open && 'hidden',\n )}\n data-state={open ? 'open' : 'closed'}\n >\n {open && (\n <CommandList\n className=\"shadow-lg outline-hidden\"\n onMouseLeave={() => {\n setOnScrollbar(false)\n }}\n onMouseEnter={() => {\n setOnScrollbar(true)\n }}\n onMouseUp={() => {\n inputRef?.current?.focus()\n }}\n >\n {onAddNewItem && (\n <>\n <CommandSeparator />\n <CommandGroup>\n <Button type=\"button\" variant=\"ghost\" className=\"w-full font-normal [&_div]:justify-start\" onClick={onAddNewItem}>\n <PlusIcon size={14} className=\"opacity-60\" aria-hidden=\"true\" />\n Thêm mới\n </Button>\n </CommandGroup>\n </>\n )}\n {isLoading ? (\n LoadingIndicator\n ) : (\n <>\n {EmptyItem()}\n {CreatableItem()}\n {!selectFirstItem && <CommandItem value=\"-\" className=\"hidden\" />}\n {Object.entries(selectables).map(([key, dropdowns]) => (\n <CommandGroup key={key} heading={key} className=\"h-full overflow-auto\">\n {dropdowns.map((option) => {\n return (\n <CommandItem\n key={option.value}\n value={option.value}\n disabled={option.disable}\n onMouseDown={(e) => {\n e.preventDefault()\n e.stopPropagation()\n }}\n onSelect={() => {\n if (selected.length >= maxSelected) {\n onMaxSelected?.(selected.length)\n return\n }\n const newOptions = [...selected, option]\n setInputValue('')\n setSelected(newOptions)\n onChange?.(newOptions)\n }}\n className={cn('cursor-pointer', option.disable && 'cursor-not-allowed opacity-50')}\n >\n {option.label}\n </CommandItem>\n )\n })}\n </CommandGroup>\n ))}\n </>\n )}\n </CommandList>\n )}\n </div>\n </div>\n </Command>\n )\n },\n)\n\nMultipleSelector.displayName = 'MultipleSelector'\n"],"mappings":"sgBAyFA,SAAgB,EAAe,EAAU,EAAmB,CAC1D,GAAM,CAAC,EAAgB,GAAqB,EAAY,GAUxD,OARA,MAAgB,CACd,IAAM,EAAQ,eAAiB,EAAkB,GAAQ,GAAS,KAElE,UAAa,CACX,aAAa,KAEd,CAAC,EAAO,IAEJ,EAGT,SAAS,EAAmB,EAAmB,EAAkB,CAC/D,GAAI,EAAQ,SAAW,EACrB,MAAO,GAET,GAAI,CAAC,EACH,MAAO,CACL,GAAI,GAIR,IAAMA,EAA2B,GAQjC,OAPA,EAAQ,QAAS,GAAW,CAC1B,IAAM,EAAO,EAAO,IAAuB,GACtC,EAAY,KACf,EAAY,GAAO,IAErB,EAAY,GAAK,KAAK,KAEjB,EAGT,SAAS,GAAmB,EAA0B,EAAkB,CACtE,IAAM,EAAc,KAAK,MAAM,KAAK,UAAU,IAE9C,IAAK,GAAM,CAAC,EAAK,KAAU,OAAO,QAAQ,GACxC,EAAY,GAAO,EAAM,OAAQ,GAAQ,CAAC,EAAO,KAAM,GAAM,EAAE,QAAU,EAAI,QAE/E,OAAO,EAGT,SAAS,GAAe,EAA0B,EAAwB,CACxE,IAAK,GAAM,EAAG,KAAU,OAAO,QAAQ,GACrC,GAAI,EAAM,KAAM,GAAW,EAAa,KAAM,GAAM,EAAE,QAAU,EAAO,QACrE,MAAO,GAGX,MAAO,GAST,MAAM,EAAe,GAAiF,CA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CAClB,EAAe,KAEjB,iBAAoB,CAClB,EAAe,KAEjB,cAAiB,CACf,GAAU,SAAS,mBAGpB,GACC,EAAA,EAAA,CAAA,SAAA,CACE,EAAC,GAAA,IACD,EAAC,EAAA,CAAA,SACC,EAAC,EAAA,CAAO,KAAK,SAAS,QAAQ,QAAQ,UAAU,2CAA2C,QAAS,YAClG,EAAC,GAAA,CAAS,KAAM,GAAI,UAAU,aAAa,cAAY,SAAS,mBAMvE,EACC,GAEA,EAAA,EAAA,CAAA,SAAA,CACG,KACA,KACA,CAAC,IAAmB,EAAC,EAAA,CAAY,MAAM,IAAI,UAAU,WACrD,OAAO,QAAQ,IAAa,KAAK,CAAC,EAAK,KACtC,EAAC,EAAA,CAAuB,QAAS,EAAK,UAAU,gCAC7C,EAAU,IAAK,GAEZ,EAAC,EAAA,CAEC,MAAO,EAAO,MACd,SAAU,EAAO,QACjB,YAAc,GAAM,CAClB,EAAE,iBACF,EAAE,mBAEJ,aAAgB,CACd,GAAI,EAAS,QAAU,EAAa,CAClC,IAAgB,EAAS,QACzB,OAEF,IAAM,EAAa,CAAC,GAAG,EAAU,GACjC,EAAc,IACd,EAAY,GACZ,IAAW,IAEb,UAAW,EAAG,iBAAkB,EAAO,SAAW,0CAEjD,EAAO,OAnBH,EAAO,SAJD,mBAwCzC,EAAiB,YAAc"}
1
+ {"version":3,"file":"multi-select-DLWPfDCM.js","names":["groupOption: GroupOption","value","Command","CommandPrimitive"],"sources":["../packages/components/ui/multi-select.tsx"],"sourcesContent":["'use client'\nimport { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nimport { PlusIcon, X } from 'lucide-react'\n\nimport { Button } from '@/components/ui/button'\nimport { Command, CommandGroup, CommandItem, CommandList, CommandSeparator } from '@/components/ui/command'\n\nimport { Command as CommandPrimitive, useCommandState } from 'cmdk'\n\nexport interface Option {\n value: string\n label: string\n disable?: boolean\n /** fixed option that can&lsquo;t be removed. */\n fixed?: boolean\n /** Group the options by providing key. */\n [key: string]: string | boolean | undefined\n}\ninterface GroupOption {\n [key: string]: Option[]\n}\n\ninterface MultipleSelectorProps {\n value?: Option[]\n defaultOptions?: Option[]\n /** manually controlled options */\n options?: Option[]\n placeholder?: string\n /** Loading component. */\n loadingIndicator?: React.ReactNode\n /** Empty component. */\n emptyIndicator?: React.ReactNode\n /** Debounce time for async search. Only work with `onSearch`. */\n delay?: number\n /**\n * Only work with `onSearch` prop. Trigger search when `onFocus`.\n * For example, when user click on the input, it will trigger the search to get initial options.\n **/\n triggerSearchOnFocus?: boolean\n /** async search */\n onSearch?: (value: string) => Promise<Option[]>\n /**\n * sync search. This search will not showing loadingIndicator.\n * The rest props are the same as async search.\n * i.e.: creatable, groupBy, delay.\n **/\n onSearchSync?: (value: string) => Option[]\n onChange?: (options: Option[]) => void\n /** Limit the maximum number of selected options. */\n maxSelected?: number\n /** When the number of selected options exceeds the limit, the onMaxSelected will be called. */\n onMaxSelected?: (maxLimit: number) => void\n /** Hide the placeholder when there are options selected. */\n hidePlaceholderWhenSelected?: boolean\n disabled?: boolean\n /** Group the options base on provided key. */\n groupBy?: string\n className?: string\n badgeClassName?: string\n /**\n * First item selected is a default behavior by cmdk. That is why the default is true.\n * This is a workaround solution by add a dummy item.\n *\n * @reference: https://github.com/pacocoursey/cmdk/issues/171\n */\n selectFirstItem?: boolean\n /** Allow user to create option when there is no option matched. */\n creatable?: boolean\n /** Props of `Command` */\n commandProps?: React.ComponentPropsWithoutRef<typeof Command>\n /** Props of `CommandInput` */\n inputProps?: Omit<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>, 'value' | 'placeholder' | 'disabled'>\n /** hide the clear all button. */\n hideClearAllButton?: boolean\n\n /** Add new item event for select with search */\n onAddNewItem?: () => void\n}\n\nexport interface MultipleSelectorRef {\n selectedValue: Option[]\n input: HTMLInputElement\n focus: () => void\n reset: () => void\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useDebounce<T>(value: T, delay?: number): T {\n const [debouncedValue, setDebouncedValue] = useState<T>(value)\n\n useEffect(() => {\n const timer = setTimeout(() => setDebouncedValue(value), delay || 500)\n\n return () => {\n clearTimeout(timer)\n }\n }, [value, delay])\n\n return debouncedValue\n}\n\nfunction transToGroupOption(options: Option[], groupBy?: string) {\n if (options.length === 0) {\n return {}\n }\n if (!groupBy) {\n return {\n '': options,\n }\n }\n\n const groupOption: GroupOption = {}\n options.forEach((option) => {\n const key = (option[groupBy] as string) || ''\n if (!groupOption[key]) {\n groupOption[key] = []\n }\n groupOption[key].push(option)\n })\n return groupOption\n}\n\nfunction removePickedOption(groupOption: GroupOption, picked: Option[]) {\n const cloneOption = JSON.parse(JSON.stringify(groupOption)) as GroupOption\n\n for (const [key, value] of Object.entries(cloneOption)) {\n cloneOption[key] = value.filter((val) => !picked.find((p) => p.value === val.value))\n }\n return cloneOption\n}\n\nfunction isOptionsExist(groupOption: GroupOption, targetOption: Option[]) {\n for (const [, value] of Object.entries(groupOption)) {\n if (value.some((option) => targetOption.find((p) => p.value === option.value))) {\n return true\n }\n }\n return false\n}\n\n/**\n * The `CommandEmpty` of shadcn/ui will cause the cmdk empty not rendering correctly.\n * So we create one and copy the `Empty` implementation from `cmdk`.\n *\n * @reference: https://github.com/hsuanyi-chou/shadcn-ui-expansions/issues/34#issuecomment-1949561607\n **/\nconst CommandEmpty = forwardRef<HTMLDivElement, React.ComponentProps<typeof CommandPrimitive.Empty>>(({ className, ...props }, forwardedRef) => {\n const render = useCommandState((state) => state.filtered.count === 0)\n\n if (!render) return null\n\n return <div ref={forwardedRef} className={cn('px-2 py-4 text-center text-sm', className)} cmdk-empty=\"\" role=\"presentation\" {...props} />\n})\n\nCommandEmpty.displayName = 'CommandEmpty'\n\nexport const MultipleSelector = forwardRef<MultipleSelectorRef, MultipleSelectorProps>(\n (\n {\n value,\n onChange,\n placeholder,\n defaultOptions: arrayDefaultOptions = [],\n options: arrayOptions,\n delay,\n onSearch,\n onSearchSync,\n loadingIndicator: LoadingIndicator,\n emptyIndicator,\n maxSelected = Number.MAX_SAFE_INTEGER,\n onMaxSelected,\n hidePlaceholderWhenSelected,\n disabled,\n groupBy,\n className,\n badgeClassName,\n selectFirstItem = true,\n creatable = false,\n triggerSearchOnFocus = false,\n commandProps,\n inputProps,\n hideClearAllButton = false,\n onAddNewItem,\n }: MultipleSelectorProps,\n ref: React.Ref<MultipleSelectorRef>,\n ) => {\n const inputRef = useRef<HTMLInputElement>(null)\n const dropdownRef = useRef<HTMLDivElement>(null) // Added this\n\n const [open, setOpen] = useState(false)\n const [onScrollbar, setOnScrollbar] = useState(false)\n const [isLoading, setIsLoading] = useState(false)\n\n const [selected, setSelected] = useState<Option[]>(value || [])\n const [options, setOptions] = useState<GroupOption>(transToGroupOption(arrayDefaultOptions, groupBy))\n const [inputValue, setInputValue] = useState('')\n\n const debouncedSearchTerm = useDebounce(inputValue, delay || 500)\n\n useImperativeHandle(\n ref,\n () => ({\n selectedValue: [...selected],\n input: inputRef.current as HTMLInputElement,\n focus: () => inputRef?.current?.focus(),\n reset: () => setSelected([]),\n }),\n [selected],\n )\n\n const handleClickOutside = useCallback((event: MouseEvent | TouchEvent) => {\n if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node) && inputRef.current && !inputRef.current.contains(event.target as Node)) {\n setOpen(false)\n inputRef.current.blur()\n }\n }, [])\n\n const handleUnselect = useCallback(\n (option: Option) => {\n const newOptions = selected.filter((s) => s.value !== option.value)\n setSelected(newOptions)\n onChange?.(newOptions)\n },\n [onChange, selected],\n )\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n const input = inputRef.current\n if (!input) return\n\n if (e.key === 'Delete' || e.key === 'Backspace') {\n if (input.value === '' && selected.length > 0) {\n const lastSelectOption = selected[selected.length - 1]\n // If last item is fixed, we should not remove it.\n if (!lastSelectOption.fixed) {\n handleUnselect(selected[selected.length - 1])\n }\n }\n }\n\n // This is not a default behavior of the <input /> field\n if (e.key === 'Escape') {\n input.blur()\n }\n },\n [handleUnselect, selected],\n )\n\n useEffect(() => {\n if (open) {\n document.addEventListener('mousedown', handleClickOutside)\n document.addEventListener('touchend', handleClickOutside)\n } else {\n document.removeEventListener('mousedown', handleClickOutside)\n document.removeEventListener('touchend', handleClickOutside)\n }\n\n return () => {\n document.removeEventListener('mousedown', handleClickOutside)\n document.removeEventListener('touchend', handleClickOutside)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n useEffect(() => {\n if (value) {\n setSelected(value)\n }\n }, [value])\n\n useEffect(() => {\n /** If `onSearch` is provided, do not trigger options updated. */\n if (!arrayOptions || onSearch) {\n return\n }\n const newOption = transToGroupOption(arrayOptions || [], groupBy)\n if (JSON.stringify(newOption) !== JSON.stringify(options)) {\n setOptions(newOption)\n }\n }, [arrayDefaultOptions, arrayOptions, groupBy, onSearch, options])\n\n useEffect(() => {\n /** sync search */\n\n const doSearchSync = () => {\n const res = onSearchSync?.(debouncedSearchTerm)\n setOptions(transToGroupOption(res || [], groupBy))\n }\n\n const exec = async () => {\n if (!onSearchSync || !open) return\n\n if (triggerSearchOnFocus) {\n doSearchSync()\n }\n\n if (debouncedSearchTerm) {\n doSearchSync()\n }\n }\n\n void exec()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [debouncedSearchTerm, groupBy, open, triggerSearchOnFocus])\n\n useEffect(() => {\n /** async search */\n\n const doSearch = async () => {\n setIsLoading(true)\n const res = await onSearch?.(debouncedSearchTerm)\n setOptions(transToGroupOption(res || [], groupBy))\n setIsLoading(false)\n }\n\n const exec = async () => {\n if (!onSearch || !open) return\n\n if (triggerSearchOnFocus) {\n await doSearch()\n }\n\n if (debouncedSearchTerm) {\n await doSearch()\n }\n }\n\n void exec()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [debouncedSearchTerm, groupBy, open, triggerSearchOnFocus])\n\n const CreatableItem = () => {\n if (!creatable) return undefined\n if (isOptionsExist(options, [{ value: inputValue, label: inputValue }]) || selected.find((s) => s.value === inputValue)) {\n return undefined\n }\n\n const Item = (\n <CommandItem\n value={inputValue}\n className=\"cursor-pointer\"\n onMouseDown={(e) => {\n e.preventDefault()\n e.stopPropagation()\n }}\n onSelect={(value: string) => {\n if (selected.length >= maxSelected) {\n onMaxSelected?.(selected.length)\n return\n }\n setInputValue('')\n const newOptions = [...selected, { value, label: value }]\n setSelected(newOptions)\n onChange?.(newOptions)\n }}\n >\n {`Create \"${inputValue}\"`}\n </CommandItem>\n )\n\n // For normal creatable\n if (!onSearch && inputValue.length > 0) {\n return Item\n }\n\n // For async search creatable. avoid showing creatable item before loading at first.\n if (onSearch && debouncedSearchTerm.length > 0 && !isLoading) {\n return Item\n }\n\n return undefined\n }\n\n const EmptyItem = useCallback(() => {\n if (!emptyIndicator) return undefined\n\n // For async search that showing emptyIndicator\n if (onSearch && !creatable && Object.keys(options).length === 0) {\n return (\n <CommandItem value=\"-\" disabled>\n {emptyIndicator}\n </CommandItem>\n )\n }\n\n return <CommandEmpty>{emptyIndicator}</CommandEmpty>\n }, [creatable, emptyIndicator, onSearch, options])\n\n const selectables = useMemo<GroupOption>(() => removePickedOption(options, selected), [options, selected])\n\n /** Avoid Creatable Selector freezing or lagging when paste a long string. */\n const commandFilter = useCallback(() => {\n if (commandProps?.filter) {\n return commandProps.filter\n }\n\n if (creatable) {\n return (value: string, search: string) => {\n return value.toLowerCase().includes(search.toLowerCase()) ? 1 : -1\n }\n }\n // Using default filter in `cmdk`. We don&lsquo;t have to provide it.\n return undefined\n }, [creatable, commandProps?.filter])\n\n return (\n <Command\n ref={dropdownRef}\n {...commandProps}\n onKeyDown={(e) => {\n handleKeyDown(e)\n commandProps?.onKeyDown?.(e)\n }}\n className={cn('h-auto overflow-visible bg-transparent', commandProps?.className)}\n shouldFilter={commandProps?.shouldFilter !== undefined ? commandProps.shouldFilter : !onSearch} // When onSearch is provided, we don&lsquo;t want to filter the options. You can still override it.\n filter={commandFilter()}\n >\n <div\n className={cn(\n 'border-border-weak relative rounded-md border text-sm transition-shadow',\n 'focus-within:border-primary',\n 'focus-within:ring-primary-weak',\n 'focus-within:ring-4',\n 'focus-within:outline-hidden',\n 'has-disabled:bg-muted',\n 'has-disabled:text-muted-foreground',\n selected.length !== 0 && 'p-1',\n !disabled && selected.length !== 0 && 'cursor-text',\n !hideClearAllButton && 'pe-9',\n className,\n )}\n onClick={() => {\n if (disabled) return\n inputRef?.current?.focus()\n }}\n >\n <div className=\"flex flex-wrap gap-1\">\n {selected.map((option) => {\n return (\n <div\n key={option.value}\n className={cn(\n 'animate-fadeIn',\n 'bg-background',\n 'hover:bg-background',\n 'border-border-weak border border-solid',\n 'text-text-positive-weak relative inline-flex h-7 cursor-default items-center rounded-md ps-2 pe-7 pl-2 text-xs font-medium transition-all',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n 'data-fixed:pe-2',\n badgeClassName,\n )}\n data-fixed={option.fixed}\n data-disabled={disabled || undefined}\n >\n {option.label}\n <button\n type=\"button\"\n disabled={disabled || option.fixed}\n className={cn(\n 'text-text-positive-muted absolute -inset-y-px -end-px flex size-7 items-center justify-center rounded-e-lg border border-transparent p-0 outline-0 transition-colors',\n 'hover:text-foreground',\n 'focus-visible:outline',\n 'focus-visible:outline-2',\n 'focus-visible:outline-primary-weak',\n 'disabled:hover:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',\n )}\n onKeyDown={(e) => {\n if (e.key !== 'Enter') return\n handleUnselect(option)\n }}\n onMouseDown={(e) => {\n e.preventDefault()\n e.stopPropagation()\n }}\n onClick={() => handleUnselect(option)}\n aria-label=\"Remove\"\n >\n <X size={14} strokeWidth={2} aria-hidden=\"true\" />\n </button>\n </div>\n )\n })}\n {/* Avoid having the \"Search\" Icon */}\n <CommandPrimitive.Input\n {...inputProps}\n ref={inputRef}\n value={inputValue}\n disabled={disabled}\n onValueChange={(value) => {\n setInputValue(value)\n inputProps?.onValueChange?.(value)\n }}\n onBlur={(event) => {\n if (!onScrollbar) {\n setOpen(false)\n }\n inputProps?.onBlur?.(event)\n }}\n onFocus={(event) => {\n setOpen(true)\n if (triggerSearchOnFocus) {\n onSearch?.(debouncedSearchTerm)\n }\n inputProps?.onFocus?.(event)\n }}\n placeholder={hidePlaceholderWhenSelected && selected.length !== 0 ? '' : placeholder}\n className={cn(\n 'placeholder:text-text-positive-muted flex-1 bg-transparent outline-hidden',\n 'disabled:placeholder:text-transparent',\n {\n 'w-full': hidePlaceholderWhenSelected,\n 'px-3 py-2': selected.length === 0,\n 'ml-1': selected.length !== 0,\n },\n inputProps?.className,\n )}\n />\n <button\n type=\"button\"\n onClick={() => {\n setSelected(selected.filter((s) => s.fixed))\n onChange?.(selected.filter((s) => s.fixed))\n }}\n className={cn(\n 'text-muted-foreground/80',\n 'absolute end-0 top-0 flex size-9 items-center justify-center rounded-lg border border-transparent transition-colors',\n 'focus-visible:outline-2',\n 'hover:text-text-positive',\n 'focus-visible:outline-primary-weak',\n (hideClearAllButton || disabled || selected.length < 1 || selected.filter(({ fixed }) => fixed).length === selected.length) && 'hidden',\n )}\n aria-label=\"Clear all\"\n >\n <X size={16} strokeWidth={2} aria-hidden=\"true\" />\n </button>\n </div>\n </div>\n <div className=\"relative\">\n <div\n className={cn(\n 'shadow-dropdown absolute top-2 z-10 w-full overflow-hidden rounded-lg',\n 'data-[state=open]:animate-in',\n 'data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0',\n 'data-[state=open]:fade-in-0',\n 'data-[state=closed]:zoom-out-95',\n 'data-[state=open]:zoom-in-95',\n !open && 'hidden',\n )}\n data-state={open ? 'open' : 'closed'}\n >\n {open && (\n <CommandList\n className=\"shadow-lg outline-hidden\"\n onMouseLeave={() => {\n setOnScrollbar(false)\n }}\n onMouseEnter={() => {\n setOnScrollbar(true)\n }}\n onMouseUp={() => {\n inputRef?.current?.focus()\n }}\n >\n {onAddNewItem && (\n <>\n <CommandSeparator />\n <CommandGroup>\n <Button type=\"button\" variant=\"ghost\" className=\"w-full font-normal [&_div]:justify-start\" onClick={onAddNewItem}>\n <PlusIcon size={14} className=\"opacity-60\" aria-hidden=\"true\" />\n Thêm mới\n </Button>\n </CommandGroup>\n </>\n )}\n {isLoading ? (\n LoadingIndicator\n ) : (\n <>\n {EmptyItem()}\n {CreatableItem()}\n {!selectFirstItem && <CommandItem value=\"-\" className=\"hidden\" />}\n {Object.entries(selectables).map(([key, dropdowns]) => (\n <CommandGroup key={key} heading={key} className=\"h-full overflow-auto\">\n {dropdowns.map((option) => {\n return (\n <CommandItem\n key={option.value}\n value={option.value}\n disabled={option.disable}\n onMouseDown={(e) => {\n e.preventDefault()\n e.stopPropagation()\n }}\n onSelect={() => {\n if (selected.length >= maxSelected) {\n onMaxSelected?.(selected.length)\n return\n }\n const newOptions = [...selected, option]\n setInputValue('')\n setSelected(newOptions)\n onChange?.(newOptions)\n }}\n className={cn('cursor-pointer', option.disable && 'cursor-not-allowed opacity-50')}\n >\n {option.label}\n </CommandItem>\n )\n })}\n </CommandGroup>\n ))}\n </>\n )}\n </CommandList>\n )}\n </div>\n </div>\n </Command>\n )\n },\n)\n\nMultipleSelector.displayName = 'MultipleSelector'\n"],"mappings":"sgBAyFA,SAAgB,EAAe,EAAU,EAAmB,CAC1D,GAAM,CAAC,EAAgB,GAAqB,EAAY,GAUxD,OARA,MAAgB,CACd,IAAM,EAAQ,eAAiB,EAAkB,GAAQ,GAAS,KAElE,UAAa,CACX,aAAa,KAEd,CAAC,EAAO,IAEJ,EAGT,SAAS,EAAmB,EAAmB,EAAkB,CAC/D,GAAI,EAAQ,SAAW,EACrB,MAAO,GAET,GAAI,CAAC,EACH,MAAO,CACL,GAAI,GAIR,IAAMA,EAA2B,GAQjC,OAPA,EAAQ,QAAS,GAAW,CAC1B,IAAM,EAAO,EAAO,IAAuB,GACtC,EAAY,KACf,EAAY,GAAO,IAErB,EAAY,GAAK,KAAK,KAEjB,EAGT,SAAS,GAAmB,EAA0B,EAAkB,CACtE,IAAM,EAAc,KAAK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/utils";import{Popover as t}from"radix-ui";import{jsx as n}from"react/jsx-runtime";function r({...e}){return n(t.Root,{"data-slot":`popover`,...e})}function i({...e}){return n(t.Trigger,{"data-slot":`popover-trigger`,...e})}function a({className:r,align:i=`start`,sideOffset:a=4,...o}){return n(t.Portal,{children:n(t.Content,{"data-slot":`popover-content`,align:i,sideOffset:a,className:e(`bg-popover`,`text-text-positive`,`z-50 w-72`,`origin-(--radix-popover-content-transform-origin)`,`shadow-dropdown rounded-md p-4 outline-none`,`data-[state=open]:animate-in`,`data-[state=open]:fade-in-0`,`data-[state=open]:zoom-in-95`,`data-[state=closed]:animate-out`,`data-[state=closed]:fade-out-0`,`data-[state=closed]:zoom-out-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`,r),...o})})}function o({...e}){return n(t.Anchor,{"data-slot":`popover-anchor`,...e})}export{r as Popover,o as PopoverAnchor,a as PopoverContent,i as PopoverTrigger};
2
- //# sourceMappingURL=popover-CxOK3oy2.js.map
2
+ //# sourceMappingURL=popover-BjCVseR5.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"popover-CxOK3oy2.js","names":["Popover","PopoverPrimitive"],"sources":["../packages/components/ui/popover.tsx"],"sourcesContent":["'use client'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nimport { Popover as PopoverPrimitive } from 'radix-ui'\n\nfunction Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />\n}\n\nfunction PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />\n}\n\nfunction PopoverContent({ className, align = 'start', sideOffset = 4, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n data-slot=\"popover-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n 'bg-popover',\n 'text-text-positive',\n 'z-50 w-72',\n 'origin-(--radix-popover-content-transform-origin)',\n 'shadow-dropdown rounded-md p-4 outline-none',\n 'data-[state=open]:animate-in',\n 'data-[state=open]:fade-in-0',\n 'data-[state=open]:zoom-in-95',\n 'data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0',\n 'data-[state=closed]:zoom-out-95',\n 'data-[side=bottom]:slide-in-from-top-2',\n 'data-[side=left]:slide-in-from-right-2',\n 'data-[side=right]:slide-in-from-left-2',\n 'data-[side=top]:slide-in-from-bottom-2',\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n )\n}\n\nfunction PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {\n return <PopoverPrimitive.Anchor data-slot=\"popover-anchor\" {...props} />\n}\n\nexport { Popover, PopoverAnchor, PopoverContent, PopoverTrigger }\n"],"mappings":"+HAKA,SAASA,EAAQ,CAAE,GAAG,GAA6D,CACjF,OAAO,EAACC,EAAiB,KAAA,CAAK,YAAU,UAAU,GAAI,IAGxD,SAAS,EAAe,CAAE,GAAG,GAAgE,CAC3F,OAAO,EAACA,EAAiB,QAAA,CAAQ,YAAU,kBAAkB,GAAI,IAGnE,SAAS,EAAe,CAAE,YAAW,QAAQ,QAAS,aAAa,EAAG,GAAG,GAAgE,CACvI,OACE,EAACA,EAAiB,OAAA,CAAA,SAChB,EAACA,EAAiB,QAAA,CAChB,YAAU,kBACH,QACK,aACZ,UAAW,EACT,aACA,qBACA,YACA,oDACA,8CACA,+BACA,8BACA,+BACA,kCACA,iCACA,kCACA,yCACA,yCACA,yCACA,yCACA,GAEF,GAAI,MAMZ,SAAS,EAAc,CAAE,GAAG,GAA+D,CACzF,OAAO,EAACA,EAAiB,OAAA,CAAO,YAAU,iBAAiB,GAAI"}
1
+ {"version":3,"file":"popover-BjCVseR5.js","names":["Popover","PopoverPrimitive"],"sources":["../packages/components/ui/popover.tsx"],"sourcesContent":["'use client'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nimport { Popover as PopoverPrimitive } from 'radix-ui'\n\nfunction Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />\n}\n\nfunction PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />\n}\n\nfunction PopoverContent({ className, align = 'start', sideOffset = 4, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n data-slot=\"popover-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n 'bg-popover',\n 'text-text-positive',\n 'z-50 w-72',\n 'origin-(--radix-popover-content-transform-origin)',\n 'shadow-dropdown rounded-md p-4 outline-none',\n 'data-[state=open]:animate-in',\n 'data-[state=open]:fade-in-0',\n 'data-[state=open]:zoom-in-95',\n 'data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0',\n 'data-[state=closed]:zoom-out-95',\n 'data-[side=bottom]:slide-in-from-top-2',\n 'data-[side=left]:slide-in-from-right-2',\n 'data-[side=right]:slide-in-from-left-2',\n 'data-[side=top]:slide-in-from-bottom-2',\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n )\n}\n\nfunction PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {\n return <PopoverPrimitive.Anchor data-slot=\"popover-anchor\" {...props} />\n}\n\nexport { Popover, PopoverAnchor, PopoverContent, PopoverTrigger }\n"],"mappings":"+HAKA,SAASA,EAAQ,CAAE,GAAG,GAA6D,CACjF,OAAO,EAACC,EAAiB,KAAA,CAAK,YAAU,UAAU,GAAI,IAGxD,SAAS,EAAe,CAAE,GAAG,GAAgE,CAC3F,OAAO,EAACA,EAAiB,QAAA,CAAQ,YAAU,kBAAkB,GAAI,IAGnE,SAAS,EAAe,CAAE,YAAW,QAAQ,QAAS,aAAa,EAAG,GAAG,GAAgE,CACvI,OACE,EAACA,EAAiB,OAAA,CAAA,SAChB,EAACA,EAAiB,QAAA,CAChB,YAAU,kBACH,QACK,aACZ,UAAW,EACT,aACA,qBACA,YACA,oDACA,8CACA,+BACA,8BACA,+BACA,kCACA,iCACA,kCACA,yCACA,yCACA,yCACA,yCACA,GAEF,GAAI,MAMZ,SAAS,EAAc,CAAE,GAAG,GAA+D,CACzF,OAAO,EAACA,EAAiB,OAAA,CAAO,YAAU,iBAAiB,GAAI"}
@@ -1,2 +1,2 @@
1
1
  const e=require(`./chunk-CUT6urMc.cjs`),t=e.__toESM(require(`@customafk/react-toolkit/utils`)),n=e.__toESM(require(`radix-ui`)),r=e.__toESM(require(`react/jsx-runtime`));function i({...e}){return(0,r.jsx)(n.Popover.Root,{"data-slot":`popover`,...e})}function a({...e}){return(0,r.jsx)(n.Popover.Trigger,{"data-slot":`popover-trigger`,...e})}function o({className:e,align:i=`start`,sideOffset:a=4,...o}){return(0,r.jsx)(n.Popover.Portal,{children:(0,r.jsx)(n.Popover.Content,{"data-slot":`popover-content`,align:i,sideOffset:a,className:(0,t.cn)(`bg-popover`,`text-text-positive`,`z-50 w-72`,`origin-(--radix-popover-content-transform-origin)`,`shadow-dropdown rounded-md p-4 outline-none`,`data-[state=open]:animate-in`,`data-[state=open]:fade-in-0`,`data-[state=open]:zoom-in-95`,`data-[state=closed]:animate-out`,`data-[state=closed]:fade-out-0`,`data-[state=closed]:zoom-out-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`,e),...o})})}function s({...e}){return(0,r.jsx)(n.Popover.Anchor,{"data-slot":`popover-anchor`,...e})}Object.defineProperty(exports,`Popover`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`PopoverAnchor`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`PopoverContent`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`PopoverTrigger`,{enumerable:!0,get:function(){return a}});
2
- //# sourceMappingURL=popover-Bi7GLJT5.cjs.map
2
+ //# sourceMappingURL=popover-D7UZ966w.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"popover-Bi7GLJT5.cjs","names":["PopoverPrimitive"],"sources":["../packages/components/ui/popover.tsx"],"sourcesContent":["'use client'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nimport { Popover as PopoverPrimitive } from 'radix-ui'\n\nfunction Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />\n}\n\nfunction PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />\n}\n\nfunction PopoverContent({ className, align = 'start', sideOffset = 4, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n data-slot=\"popover-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n 'bg-popover',\n 'text-text-positive',\n 'z-50 w-72',\n 'origin-(--radix-popover-content-transform-origin)',\n 'shadow-dropdown rounded-md p-4 outline-none',\n 'data-[state=open]:animate-in',\n 'data-[state=open]:fade-in-0',\n 'data-[state=open]:zoom-in-95',\n 'data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0',\n 'data-[state=closed]:zoom-out-95',\n 'data-[side=bottom]:slide-in-from-top-2',\n 'data-[side=left]:slide-in-from-right-2',\n 'data-[side=right]:slide-in-from-left-2',\n 'data-[side=top]:slide-in-from-bottom-2',\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n )\n}\n\nfunction PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {\n return <PopoverPrimitive.Anchor data-slot=\"popover-anchor\" {...props} />\n}\n\nexport { Popover, PopoverAnchor, PopoverContent, PopoverTrigger }\n"],"mappings":"0KAKA,SAAS,EAAQ,CAAE,GAAG,GAA6D,CACjF,OAAO,EAAA,EAAA,KAACA,EAAAA,QAAiB,KAAA,CAAK,YAAU,UAAU,GAAI,IAGxD,SAAS,EAAe,CAAE,GAAG,GAAgE,CAC3F,OAAO,EAAA,EAAA,KAACA,EAAAA,QAAiB,QAAA,CAAQ,YAAU,kBAAkB,GAAI,IAGnE,SAAS,EAAe,CAAE,YAAW,QAAQ,QAAS,aAAa,EAAG,GAAG,GAAgE,CACvI,OACE,EAAA,EAAA,KAACA,EAAAA,QAAiB,OAAA,CAAA,UAChB,EAAA,EAAA,KAACA,EAAAA,QAAiB,QAAA,CAChB,YAAU,kBACH,QACK,aACZ,WAAA,EAAA,EAAA,IACE,aACA,qBACA,YACA,oDACA,8CACA,+BACA,8BACA,+BACA,kCACA,iCACA,kCACA,yCACA,yCACA,yCACA,yCACA,GAEF,GAAI,MAMZ,SAAS,EAAc,CAAE,GAAG,GAA+D,CACzF,OAAO,EAAA,EAAA,KAACA,EAAAA,QAAiB,OAAA,CAAO,YAAU,iBAAiB,GAAI"}
1
+ {"version":3,"file":"popover-D7UZ966w.cjs","names":["PopoverPrimitive"],"sources":["../packages/components/ui/popover.tsx"],"sourcesContent":["'use client'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nimport { Popover as PopoverPrimitive } from 'radix-ui'\n\nfunction Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />\n}\n\nfunction PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />\n}\n\nfunction PopoverContent({ className, align = 'start', sideOffset = 4, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n data-slot=\"popover-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n 'bg-popover',\n 'text-text-positive',\n 'z-50 w-72',\n 'origin-(--radix-popover-content-transform-origin)',\n 'shadow-dropdown rounded-md p-4 outline-none',\n 'data-[state=open]:animate-in',\n 'data-[state=open]:fade-in-0',\n 'data-[state=open]:zoom-in-95',\n 'data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0',\n 'data-[state=closed]:zoom-out-95',\n 'data-[side=bottom]:slide-in-from-top-2',\n 'data-[side=left]:slide-in-from-right-2',\n 'data-[side=right]:slide-in-from-left-2',\n 'data-[side=top]:slide-in-from-bottom-2',\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n )\n}\n\nfunction PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {\n return <PopoverPrimitive.Anchor data-slot=\"popover-anchor\" {...props} />\n}\n\nexport { Popover, PopoverAnchor, PopoverContent, PopoverTrigger }\n"],"mappings":"0KAKA,SAAS,EAAQ,CAAE,GAAG,GAA6D,CACjF,OAAO,EAAA,EAAA,KAACA,EAAAA,QAAiB,KAAA,CAAK,YAAU,UAAU,GAAI,IAGxD,SAAS,EAAe,CAAE,GAAG,GAAgE,CAC3F,OAAO,EAAA,EAAA,KAACA,EAAAA,QAAiB,QAAA,CAAQ,YAAU,kBAAkB,GAAI,IAGnE,SAAS,EAAe,CAAE,YAAW,QAAQ,QAAS,aAAa,EAAG,GAAG,GAAgE,CACvI,OACE,EAAA,EAAA,KAACA,EAAAA,QAAiB,OAAA,CAAA,UAChB,EAAA,EAAA,KAACA,EAAAA,QAAiB,QAAA,CAChB,YAAU,kBACH,QACK,aACZ,WAAA,EAAA,EAAA,IACE,aACA,qBACA,YACA,oDACA,8CACA,+BACA,8BACA,+BACA,kCACA,iCACA,kCACA,yCACA,yCACA,yCACA,yCACA,GAEF,GAAI,MAMZ,SAAS,EAAc,CAAE,GAAG,GAA+D,CACzF,OAAO,EAAA,EAAA,KAACA,EAAAA,QAAiB,OAAA,CAAO,YAAU,iBAAiB,GAAI"}
@@ -1,2 +1,2 @@
1
- import{Input as e}from"./input-BUYJ4_aj.js";import{ArrowRightIcon as t,SearchIcon as n}from"lucide-react";import{cn as r}from"@customafk/react-toolkit/utils";import{jsx as i,jsxs as a}from"react/jsx-runtime";const o=({className:o,...s})=>a(`div`,{className:`relative`,children:[i(e,{...s,type:`search`,className:r(`ps-9 pe-9`,o)}),i(`div`,{className:`text-text-positive-weak pointer-events-none absolute inset-y-0 start-0 flex items-center justify-center ps-3 peer-disabled:opacity-50`,children:i(n,{size:16})}),i(`button`,{className:`text-text-positive-weak hover:text-text-positive focus-visible:border-primary-strong focus-visible:ring-primary-weak absolute inset-y-0 end-0 flex h-full w-9 items-center justify-center rounded-e-md transition-[color,box-shadow] outline-none focus:z-10 focus-visible:border focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Submit search`,type:`submit`,children:i(t,{size:16,"aria-hidden":`true`})})]});export{o as SearchInput};
2
- //# sourceMappingURL=search-input-DnYrPBeT.js.map
1
+ import{Input as e}from"./input-BFZuwsER.js";import{ArrowRightIcon as t,SearchIcon as n}from"lucide-react";import{cn as r}from"@customafk/react-toolkit/utils";import{jsx as i,jsxs as a}from"react/jsx-runtime";const o=({className:o,...s})=>a(`div`,{className:`relative`,children:[i(e,{...s,type:`search`,className:r(`ps-9 pe-9`,o)}),i(`div`,{className:`text-text-positive-weak pointer-events-none absolute inset-y-0 start-0 flex items-center justify-center ps-3 peer-disabled:opacity-50`,children:i(n,{size:16})}),i(`button`,{className:`text-text-positive-weak hover:text-text-positive focus-visible:border-primary-strong focus-visible:ring-primary-weak absolute inset-y-0 end-0 flex h-full w-9 items-center justify-center rounded-e-md transition-[color,box-shadow] outline-none focus:z-10 focus-visible:border focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Submit search`,type:`submit`,children:i(t,{size:16,"aria-hidden":`true`})})]});export{o as SearchInput};
2
+ //# sourceMappingURL=search-input-C_7D7Nqj.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"search-input-DnYrPBeT.js","names":[],"sources":["../packages/components/ui/inputs/search-input.tsx"],"sourcesContent":["import { cn } from '@customafk/react-toolkit/utils'\n\nimport { ArrowRightIcon, SearchIcon } from 'lucide-react'\n\nimport { Input } from '../input'\n\ntype Props = React.ComponentPropsWithoutRef<typeof Input>\nexport const SearchInput = ({ className, ...rest }: Props) => {\n return (\n <div className=\"relative\">\n <Input {...rest} type=\"search\" className={cn('ps-9 pe-9', className)} />\n <div className=\"text-text-positive-weak pointer-events-none absolute inset-y-0 start-0 flex items-center justify-center ps-3 peer-disabled:opacity-50\">\n <SearchIcon size={16} />\n </div>\n <button\n className=\"text-text-positive-weak hover:text-text-positive focus-visible:border-primary-strong focus-visible:ring-primary-weak absolute inset-y-0 end-0 flex h-full w-9 items-center justify-center rounded-e-md transition-[color,box-shadow] outline-none focus:z-10 focus-visible:border focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50\"\n aria-label=\"Submit search\"\n type=\"submit\"\n >\n <ArrowRightIcon size={16} aria-hidden=\"true\" />\n </button>\n </div>\n )\n}\n"],"mappings":"gNAOA,MAAa,GAAe,CAAE,YAAW,GAAG,KAExC,EAAC,MAAA,CAAI,UAAU,qBACb,EAAC,EAAA,CAAM,GAAI,EAAM,KAAK,SAAS,UAAW,EAAG,YAAa,KAC1D,EAAC,MAAA,CAAI,UAAU,iJACb,EAAC,EAAA,CAAW,KAAM,OAEpB,EAAC,SAAA,CACC,UAAU,0XACV,aAAW,gBACX,KAAK,kBAEL,EAAC,EAAA,CAAe,KAAM,GAAI,cAAY"}
1
+ {"version":3,"file":"search-input-C_7D7Nqj.js","names":[],"sources":["../packages/components/ui/inputs/search-input.tsx"],"sourcesContent":["import { cn } from '@customafk/react-toolkit/utils'\n\nimport { ArrowRightIcon, SearchIcon } from 'lucide-react'\n\nimport { Input } from '../input'\n\ntype Props = React.ComponentPropsWithoutRef<typeof Input>\nexport const SearchInput = ({ className, ...rest }: Props) => {\n return (\n <div className=\"relative\">\n <Input {...rest} type=\"search\" className={cn('ps-9 pe-9', className)} />\n <div className=\"text-text-positive-weak pointer-events-none absolute inset-y-0 start-0 flex items-center justify-center ps-3 peer-disabled:opacity-50\">\n <SearchIcon size={16} />\n </div>\n <button\n className=\"text-text-positive-weak hover:text-text-positive focus-visible:border-primary-strong focus-visible:ring-primary-weak absolute inset-y-0 end-0 flex h-full w-9 items-center justify-center rounded-e-md transition-[color,box-shadow] outline-none focus:z-10 focus-visible:border focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50\"\n aria-label=\"Submit search\"\n type=\"submit\"\n >\n <ArrowRightIcon size={16} aria-hidden=\"true\" />\n </button>\n </div>\n )\n}\n"],"mappings":"gNAOA,MAAa,GAAe,CAAE,YAAW,GAAG,KAExC,EAAC,MAAA,CAAI,UAAU,qBACb,EAAC,EAAA,CAAM,GAAI,EAAM,KAAK,SAAS,UAAW,EAAG,YAAa,KAC1D,EAAC,MAAA,CAAI,UAAU,iJACb,EAAC,EAAA,CAAW,KAAM,OAEpB,EAAC,SAAA,CACC,UAAU,0XACV,aAAW,gBACX,KAAK,kBAEL,EAAC,EAAA,CAAe,KAAM,GAAI,cAAY"}
@@ -1,2 +1,2 @@
1
- const e=require(`./chunk-CUT6urMc.cjs`),t=require(`./input-DgtTVBtN.cjs`),n=e.__toESM(require(`lucide-react`)),r=e.__toESM(require(`@customafk/react-toolkit/utils`)),i=e.__toESM(require(`react/jsx-runtime`)),a=({className:e,...a})=>(0,i.jsxs)(`div`,{className:`relative`,children:[(0,i.jsx)(t.Input,{...a,type:`search`,className:(0,r.cn)(`ps-9 pe-9`,e)}),(0,i.jsx)(`div`,{className:`text-text-positive-weak pointer-events-none absolute inset-y-0 start-0 flex items-center justify-center ps-3 peer-disabled:opacity-50`,children:(0,i.jsx)(n.SearchIcon,{size:16})}),(0,i.jsx)(`button`,{className:`text-text-positive-weak hover:text-text-positive focus-visible:border-primary-strong focus-visible:ring-primary-weak absolute inset-y-0 end-0 flex h-full w-9 items-center justify-center rounded-e-md transition-[color,box-shadow] outline-none focus:z-10 focus-visible:border focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Submit search`,type:`submit`,children:(0,i.jsx)(n.ArrowRightIcon,{size:16,"aria-hidden":`true`})})]});Object.defineProperty(exports,`SearchInput`,{enumerable:!0,get:function(){return a}});
2
- //# sourceMappingURL=search-input-BkhVqB3R.cjs.map
1
+ const e=require(`./chunk-CUT6urMc.cjs`),t=require(`./input-ERPHY3v4.cjs`),n=e.__toESM(require(`lucide-react`)),r=e.__toESM(require(`@customafk/react-toolkit/utils`)),i=e.__toESM(require(`react/jsx-runtime`)),a=({className:e,...a})=>(0,i.jsxs)(`div`,{className:`relative`,children:[(0,i.jsx)(t.Input,{...a,type:`search`,className:(0,r.cn)(`ps-9 pe-9`,e)}),(0,i.jsx)(`div`,{className:`text-text-positive-weak pointer-events-none absolute inset-y-0 start-0 flex items-center justify-center ps-3 peer-disabled:opacity-50`,children:(0,i.jsx)(n.SearchIcon,{size:16})}),(0,i.jsx)(`button`,{className:`text-text-positive-weak hover:text-text-positive focus-visible:border-primary-strong focus-visible:ring-primary-weak absolute inset-y-0 end-0 flex h-full w-9 items-center justify-center rounded-e-md transition-[color,box-shadow] outline-none focus:z-10 focus-visible:border focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Submit search`,type:`submit`,children:(0,i.jsx)(n.ArrowRightIcon,{size:16,"aria-hidden":`true`})})]});Object.defineProperty(exports,`SearchInput`,{enumerable:!0,get:function(){return a}});
2
+ //# sourceMappingURL=search-input-hIVKLXXb.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"search-input-BkhVqB3R.cjs","names":["Input","SearchIcon","ArrowRightIcon"],"sources":["../packages/components/ui/inputs/search-input.tsx"],"sourcesContent":["import { cn } from '@customafk/react-toolkit/utils'\n\nimport { ArrowRightIcon, SearchIcon } from 'lucide-react'\n\nimport { Input } from '../input'\n\ntype Props = React.ComponentPropsWithoutRef<typeof Input>\nexport const SearchInput = ({ className, ...rest }: Props) => {\n return (\n <div className=\"relative\">\n <Input {...rest} type=\"search\" className={cn('ps-9 pe-9', className)} />\n <div className=\"text-text-positive-weak pointer-events-none absolute inset-y-0 start-0 flex items-center justify-center ps-3 peer-disabled:opacity-50\">\n <SearchIcon size={16} />\n </div>\n <button\n className=\"text-text-positive-weak hover:text-text-positive focus-visible:border-primary-strong focus-visible:ring-primary-weak absolute inset-y-0 end-0 flex h-full w-9 items-center justify-center rounded-e-md transition-[color,box-shadow] outline-none focus:z-10 focus-visible:border focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50\"\n aria-label=\"Submit search\"\n type=\"submit\"\n >\n <ArrowRightIcon size={16} aria-hidden=\"true\" />\n </button>\n </div>\n )\n}\n"],"mappings":"gNAOa,GAAe,CAAE,YAAW,GAAG,MAExC,EAAA,EAAA,MAAC,MAAA,CAAI,UAAU,sBACb,EAAA,EAAA,KAACA,EAAAA,MAAAA,CAAM,GAAI,EAAM,KAAK,SAAS,WAAA,EAAA,EAAA,IAAc,YAAa,MAC1D,EAAA,EAAA,KAAC,MAAA,CAAI,UAAU,kJACb,EAAA,EAAA,KAACC,EAAAA,WAAAA,CAAW,KAAM,QAEpB,EAAA,EAAA,KAAC,SAAA,CACC,UAAU,0XACV,aAAW,gBACX,KAAK,mBAEL,EAAA,EAAA,KAACC,EAAAA,eAAAA,CAAe,KAAM,GAAI,cAAY"}
1
+ {"version":3,"file":"search-input-hIVKLXXb.cjs","names":["Input","SearchIcon","ArrowRightIcon"],"sources":["../packages/components/ui/inputs/search-input.tsx"],"sourcesContent":["import { cn } from '@customafk/react-toolkit/utils'\n\nimport { ArrowRightIcon, SearchIcon } from 'lucide-react'\n\nimport { Input } from '../input'\n\ntype Props = React.ComponentPropsWithoutRef<typeof Input>\nexport const SearchInput = ({ className, ...rest }: Props) => {\n return (\n <div className=\"relative\">\n <Input {...rest} type=\"search\" className={cn('ps-9 pe-9', className)} />\n <div className=\"text-text-positive-weak pointer-events-none absolute inset-y-0 start-0 flex items-center justify-center ps-3 peer-disabled:opacity-50\">\n <SearchIcon size={16} />\n </div>\n <button\n className=\"text-text-positive-weak hover:text-text-positive focus-visible:border-primary-strong focus-visible:ring-primary-weak absolute inset-y-0 end-0 flex h-full w-9 items-center justify-center rounded-e-md transition-[color,box-shadow] outline-none focus:z-10 focus-visible:border focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50\"\n aria-label=\"Submit search\"\n type=\"submit\"\n >\n <ArrowRightIcon size={16} aria-hidden=\"true\" />\n </button>\n </div>\n )\n}\n"],"mappings":"gNAOa,GAAe,CAAE,YAAW,GAAG,MAExC,EAAA,EAAA,MAAC,MAAA,CAAI,UAAU,sBACb,EAAA,EAAA,KAACA,EAAAA,MAAAA,CAAM,GAAI,EAAM,KAAK,SAAS,WAAA,EAAA,EAAA,IAAc,YAAa,MAC1D,EAAA,EAAA,KAAC,MAAA,CAAI,UAAU,kJACb,EAAA,EAAA,KAACC,EAAAA,WAAAA,CAAW,KAAM,QAEpB,EAAA,EAAA,KAAC,SAAA,CACC,UAAU,0XACV,aAAW,gBACX,KAAK,mBAEL,EAAA,EAAA,KAACC,EAAAA,eAAAA,CAAe,KAAM,GAAI,cAAY"}
@@ -1,2 +1,2 @@
1
1
  import{CheckIcon as e,ChevronDownIcon as t,ChevronUpIcon as n}from"lucide-react";import{cn as r}from"@customafk/react-toolkit/utils";import{Select as i}from"radix-ui";import{jsx as a,jsxs as o}from"react/jsx-runtime";function s({...e}){return a(i.Root,{"data-slot":`select`,...e})}function c({...e}){return a(i.Group,{"data-slot":`select-group`,...e})}function l({...e}){return a(i.Value,{"data-slot":`select-value`,...e})}function u({className:e,size:n=`default`,children:s,...c}){return o(i.Trigger,{"data-slot":`select-trigger`,"data-size":n,className:r(`border-border-weak shadow-input`,`flex w-fit items-center justify-between`,`gap-2 rounded-md border bg-transparent px-3 py-2 text-sm`,`whitespace-nowrap transition-all outline-none`,`cursor-pointer`,`hover:border-border`,`focus:border-primary-strong`,`focus:ring-primary-weak`,`focus:ring-4`,`aria-invalid:ring-danger-weak`,`aria-invalid:border-danger-strong`,`disabled:cursor-not-allowed`,`disabled:opacity-50`,`data-[state=open]:text-text-positive-muted`,`data-[state=open]:border-primary`,`data-[state=open]:ring-ring`,`data-[state=open]:ring-4`,`data-[placeholder]:text-text-positive-muted`,`data-[size=default]:h-9`,`data-[size=sm]:h-8`,`*:data-[slot=select-value]:line-clamp-1`,`*:data-[slot=select-value]:flex`,`*:data-[slot=select-value]:items-center`,`*:data-[slot=select-value]:gap-2`,`[&_svg]:shrink-0`,`[&_svg]:pointer-events-none`,`[&_svg:not([class*='size-'])]:size-4`,`[&_svg:not([class*='text-'])]:text-muted-foreground`,e),...c,children:[s,a(i.Icon,{asChild:!0,children:a(t,{size:16,opacity:50})})]})}function d({className:e,children:t,position:n=`popper`,...s}){return a(i.Portal,{children:o(i.Content,{"data-slot":`select-content`,className:r(`bg-popover`,`relative z-50`,`min-w-32`,`overflow-x-hidden overflow-y-auto`,`shadow-dropdown rounded-md`,`data-[state=open]:animate-in`,`data-[state=open]:fade-in-0`,`data-[state=open]:zoom-in-95`,`data-[state=closed]:animate-out`,`data-[state=closed]:fade-out-0`,`data-[state=closed]:zoom-out-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`,`origin-(--radix-select-content-transform-origin)`,n===`popper`&&`data-[side=bottom]:translate-y-1`,n===`popper`&&`data-[side=left]:-translate-x-1`,n===`popper`&&`data-[side=right]:translate-x-1`,n===`popper`&&`data-[side=top]:-translate-y-1`,e),position:n,style:{maxHeight:`var(--radix-select-content-available-height)`},...s,children:[a(h,{}),a(i.Viewport,{className:r(`p-1`,n===`popper`&&`w-full scroll-my-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)]`,n===`popper`&&`min-w-[var(--radix-select-trigger-width)]`),children:t}),a(g,{})]})})}function f({className:e,...t}){return a(i.Label,{"data-slot":`select-label`,className:r(`text-text-positive-weak px-2 py-1.5 text-xs`,e),...t})}function p({className:t,children:n,...s}){return o(i.Item,{"data-slot":`select-item`,className:r(`relative flex items-center select-none`,`gap-2 rounded-md py-2.5 pr-8 pl-2`,`w-full`,`cursor-pointer transition-colors`,`text-text-positive text-sm outline-hidden`,`focus:bg-muted-muted`,`focus:text-text-positive-strong`,`data-[disabled]:opacity-50`,`data-[disabled]:pointer-events-none`,`[&_svg]:pointer-events-none`,`[&_svg]:shrink-0`,`[&_svg:not([class*='size-'])]:size-4`,`[&_svg:not([class*='text-'])]:text-text-positive-weak`,`*:[span]:last:flex`,`*:[span]:last:items-center`,`*:[span]:last:gap-2`,t),...s,children:[a(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:a(i.ItemIndicator,{children:a(e,{size:16})})}),a(i.ItemText,{children:n})]})}function m({className:e,...t}){return a(i.Separator,{"data-slot":`select-separator`,className:r(`bg-border-weak pointer-events-none -mx-1 my-1 h-px`,e),...t})}function h({className:e,...t}){return a(i.ScrollUpButton,{"data-slot":`select-scroll-up-button`,className:r(`flex cursor-default items-center justify-center py-1`,e),...t,children:a(n,{className:`size-4`})})}function g({className:e,...n}){return a(i.ScrollDownButton,{"data-slot":`select-scroll-down-button`,className:r(`flex cursor-default items-center justify-center py-1`,e),...n,children:a(t,{className:`size-4`})})}export{s as Select,d as SelectContent,c as SelectGroup,p as SelectItem,f as SelectLabel,g as SelectScrollDownButton,h as SelectScrollUpButton,m as SelectSeparator,u as SelectTrigger,l as SelectValue};
2
- //# sourceMappingURL=select-Cmq5a3Wg.js.map
2
+ //# sourceMappingURL=select-CijI0HX0.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select-Cmq5a3Wg.js","names":["Select","SelectPrimitive"],"sources":["../packages/components/ui/select.tsx"],"sourcesContent":["'use client'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nimport { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react'\n\nimport { Select as SelectPrimitive } from 'radix-ui'\n\nfunction Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {\n return <SelectPrimitive.Root data-slot=\"select\" {...props} />\n}\n\nfunction SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>) {\n return <SelectPrimitive.Group data-slot=\"select-group\" {...props} />\n}\n\nfunction SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {\n return <SelectPrimitive.Value data-slot=\"select-value\" {...props} />\n}\n\nfunction SelectTrigger({\n className,\n size = 'default',\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {\n size?: 'sm' | 'default'\n}) {\n return (\n <SelectPrimitive.Trigger\n data-slot=\"select-trigger\"\n data-size={size}\n className={cn(\n 'border-border-weak shadow-input',\n 'flex w-fit items-center justify-between',\n 'gap-2 rounded-md border bg-transparent px-3 py-2 text-sm',\n 'whitespace-nowrap transition-all outline-none',\n 'cursor-pointer',\n 'hover:border-border',\n 'focus:border-primary-strong',\n 'focus:ring-primary-weak',\n 'focus:ring-4',\n 'aria-invalid:ring-danger-weak',\n 'aria-invalid:border-danger-strong',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n 'data-[state=open]:text-text-positive-muted',\n 'data-[state=open]:border-primary',\n 'data-[state=open]:ring-ring',\n 'data-[state=open]:ring-4',\n 'data-[placeholder]:text-text-positive-muted',\n 'data-[size=default]:h-9',\n 'data-[size=sm]:h-8',\n '*:data-[slot=select-value]:line-clamp-1',\n '*:data-[slot=select-value]:flex',\n '*:data-[slot=select-value]:items-center',\n '*:data-[slot=select-value]:gap-2',\n '[&_svg]:shrink-0',\n '[&_svg]:pointer-events-none',\n \"[&_svg:not([class*='size-'])]:size-4\",\n \"[&_svg:not([class*='text-'])]:text-muted-foreground\",\n className,\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon size={16} opacity={50} />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n )\n}\n\nfunction SelectContent({ className, children, position = 'popper', ...props }: React.ComponentProps<typeof SelectPrimitive.Content>) {\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n data-slot=\"select-content\"\n className={cn(\n 'bg-popover',\n 'relative z-50',\n 'min-w-32',\n 'overflow-x-hidden overflow-y-auto',\n 'shadow-dropdown rounded-md',\n 'data-[state=open]:animate-in',\n 'data-[state=open]:fade-in-0',\n 'data-[state=open]:zoom-in-95',\n 'data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0',\n 'data-[state=closed]:zoom-out-95',\n 'data-[side=bottom]:slide-in-from-top-2',\n 'data-[side=left]:slide-in-from-right-2',\n 'data-[side=right]:slide-in-from-left-2',\n 'data-[side=top]:slide-in-from-bottom-2',\n 'origin-(--radix-select-content-transform-origin)',\n position === 'popper' && 'data-[side=bottom]:translate-y-1',\n position === 'popper' && 'data-[side=left]:-translate-x-1',\n position === 'popper' && 'data-[side=right]:translate-x-1',\n position === 'popper' && 'data-[side=top]:-translate-y-1',\n className,\n )}\n position={position}\n style={{\n maxHeight: 'var(--radix-select-content-available-height)',\n }}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n 'p-1',\n position === 'popper' && 'w-full scroll-my-1',\n position === 'popper' && 'h-[var(--radix-select-trigger-height)]',\n position === 'popper' && 'min-w-[var(--radix-select-trigger-width)]',\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n )\n}\n\nfunction SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {\n return <SelectPrimitive.Label data-slot=\"select-label\" className={cn('text-text-positive-weak px-2 py-1.5 text-xs', className)} {...props} />\n}\n\nfunction SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>) {\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cn(\n 'relative flex items-center select-none',\n 'gap-2 rounded-md py-2.5 pr-8 pl-2',\n 'w-full',\n 'cursor-pointer transition-colors',\n 'text-text-positive text-sm outline-hidden',\n 'focus:bg-muted-muted',\n 'focus:text-text-positive-strong',\n 'data-[disabled]:opacity-50',\n 'data-[disabled]:pointer-events-none',\n '[&_svg]:pointer-events-none',\n '[&_svg]:shrink-0',\n \"[&_svg:not([class*='size-'])]:size-4\",\n \"[&_svg:not([class*='text-'])]:text-text-positive-weak\",\n '*:[span]:last:flex',\n '*:[span]:last:items-center',\n '*:[span]:last:gap-2',\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 size={16} />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n )\n}\n\nfunction SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>) {\n return <SelectPrimitive.Separator data-slot=\"select-separator\" className={cn('bg-border-weak pointer-events-none -mx-1 my-1 h-px', className)} {...props} />\n}\n\nfunction SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {\n return (\n <SelectPrimitive.ScrollUpButton\n data-slot=\"select-scroll-up-button\"\n className={cn('flex cursor-default items-center justify-center py-1', className)}\n {...props}\n >\n <ChevronUpIcon className=\"size-4\" />\n </SelectPrimitive.ScrollUpButton>\n )\n}\n\nfunction SelectScrollDownButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {\n return (\n <SelectPrimitive.ScrollDownButton\n data-slot=\"select-scroll-down-button\"\n className={cn('flex cursor-default items-center justify-center py-1', className)}\n {...props}\n >\n <ChevronDownIcon className=\"size-4\" />\n </SelectPrimitive.ScrollDownButton>\n )\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n}\n"],"mappings":"yNAOA,SAASA,EAAO,CAAE,GAAG,GAA4D,CAC/E,OAAO,EAACC,EAAgB,KAAA,CAAK,YAAU,SAAS,GAAI,IAGtD,SAAS,EAAY,CAAE,GAAG,GAA6D,CACrF,OAAO,EAACA,EAAgB,MAAA,CAAM,YAAU,eAAe,GAAI,IAG7D,SAAS,EAAY,CAAE,GAAG,GAA6D,CACrF,OAAO,EAACA,EAAgB,MAAA,CAAM,YAAU,eAAe,GAAI,IAG7D,SAAS,EAAc,CACrB,YACA,OAAO,UACP,WACA,GAAG,GAGF,CACD,OACE,EAACA,EAAgB,QAAA,CACf,YAAU,iBACV,YAAW,EACX,UAAW,EACT,kCACA,0CACA,2DACA,gDACA,iBACA,sBACA,8BACA,0BACA,eACA,gCACA,oCACA,8BACA,sBACA,6CACA,mCACA,8BACA,2BACA,8CACA,0BACA,qBACA,0CACA,kCACA,0CACA,mCACA,mBACA,8BACA,uCACA,sDACA,GAEF,GAAI,YAEH,EACD,EAACA,EAAgB,KAAA,CAAK,QAAA,YACpB,EAAC,EAAA,CAAgB,KAAM,GAAI,QAAS,UAM5C,SAAS,EAAc,CAAE,YAAW,WAAU,WAAW,SAAU,GAAG,GAA+D,CACnI,OACE,EAACA,EAAgB,OAAA,CAAA,SACf,EAACA,EAAgB,QAAA,CACf,YAAU,iBACV,UAAW,EACT,aACA,gBACA,WACA,oCACA,6BACA,+BACA,8BACA,+BACA,kCACA,iCACA,kCACA,yCACA,yCACA,yCACA,yCACA,mDACA,IAAa,UAAY,mCACzB,IAAa,UAAY,kCACzB,IAAa,UAAY,kCACzB,IAAa,UAAY,iCACzB,GAEQ,WACV,MAAO,CACL,UAAW,gDAEb,GAAI,YAEJ,EAAC,EAAA,IACD,EAACA,EAAgB,SAAA,CACf,UAAW,EACT,MACA,IAAa,UAAY,qBACzB,IAAa,UAAY,yCACzB,IAAa,UAAY,6CAG1B,aAEH,EAAC,EAAA,SAMT,SAAS,EAAY,CAAE,YAAW,GAAG,GAA6D,CAChG,OAAO,EAACA,EAAgB,MAAA,CAAM,YAAU,eAAe,UAAW,EAAG,8CAA+C,GAAY,GAAI,IAGtI,SAAS,EAAW,CAAE,YAAW,WAAU,GAAG,GAA4D,CACxG,OACE,EAACA,EAAgB,KAAA,CACf,YAAU,cACV,UAAW,EACT,yCACA,oCACA,SACA,mCACA,4CACA,uBACA,kCACA,6BACA,sCACA,8BACA,mBACA,uCACA,wDACA,qBACA,6BACA,sBACA,GAEF,GAAI,YAEJ,EAAC,OAAA,CAAK,UAAU,sEACd,EAACA,EAAgB,cAAA,CAAA,SACf,EAAC,EAAA,CAAU,KAAM,SAGrB,EAACA,EAAgB,SAAA,CAAU,gBAKjC,SAAS,EAAgB,CAAE,YAAW,GAAG,GAAiE,CACxG,OAAO,EAACA,EAAgB,UAAA,CAAU,YAAU,mBAAmB,UAAW,EAAG,qDAAsD,GAAY,GAAI,IAGrJ,SAAS,EAAqB,CAAE,YAAW,GAAG,GAAsE,CAClH,OACE,EAACA,EAAgB,eAAA,CACf,YAAU,0BACV,UAAW,EAAG,uDAAwD,GACtE,GAAI,WAEJ,EAAC,EAAA,CAAc,UAAU,aAK/B,SAAS,EAAuB,CAAE,YAAW,GAAG,GAAwE,CACtH,OACE,EAACA,EAAgB,iBAAA,CACf,YAAU,4BACV,UAAW,EAAG,uDAAwD,GACtE,GAAI,WAEJ,EAAC,EAAA,CAAgB,UAAU"}
1
+ {"version":3,"file":"select-CijI0HX0.js","names":["Select","SelectPrimitive"],"sources":["../packages/components/ui/select.tsx"],"sourcesContent":["'use client'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nimport { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react'\n\nimport { Select as SelectPrimitive } from 'radix-ui'\n\nfunction Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {\n return <SelectPrimitive.Root data-slot=\"select\" {...props} />\n}\n\nfunction SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>) {\n return <SelectPrimitive.Group data-slot=\"select-group\" {...props} />\n}\n\nfunction SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {\n return <SelectPrimitive.Value data-slot=\"select-value\" {...props} />\n}\n\nfunction SelectTrigger({\n className,\n size = 'default',\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {\n size?: 'sm' | 'default'\n}) {\n return (\n <SelectPrimitive.Trigger\n data-slot=\"select-trigger\"\n data-size={size}\n className={cn(\n 'border-border-weak shadow-input',\n 'flex w-fit items-center justify-between',\n 'gap-2 rounded-md border bg-transparent px-3 py-2 text-sm',\n 'whitespace-nowrap transition-all outline-none',\n 'cursor-pointer',\n 'hover:border-border',\n 'focus:border-primary-strong',\n 'focus:ring-primary-weak',\n 'focus:ring-4',\n 'aria-invalid:ring-danger-weak',\n 'aria-invalid:border-danger-strong',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n 'data-[state=open]:text-text-positive-muted',\n 'data-[state=open]:border-primary',\n 'data-[state=open]:ring-ring',\n 'data-[state=open]:ring-4',\n 'data-[placeholder]:text-text-positive-muted',\n 'data-[size=default]:h-9',\n 'data-[size=sm]:h-8',\n '*:data-[slot=select-value]:line-clamp-1',\n '*:data-[slot=select-value]:flex',\n '*:data-[slot=select-value]:items-center',\n '*:data-[slot=select-value]:gap-2',\n '[&_svg]:shrink-0',\n '[&_svg]:pointer-events-none',\n \"[&_svg:not([class*='size-'])]:size-4\",\n \"[&_svg:not([class*='text-'])]:text-muted-foreground\",\n className,\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon size={16} opacity={50} />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n )\n}\n\nfunction SelectContent({ className, children, position = 'popper', ...props }: React.ComponentProps<typeof SelectPrimitive.Content>) {\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n data-slot=\"select-content\"\n className={cn(\n 'bg-popover',\n 'relative z-50',\n 'min-w-32',\n 'overflow-x-hidden overflow-y-auto',\n 'shadow-dropdown rounded-md',\n 'data-[state=open]:animate-in',\n 'data-[state=open]:fade-in-0',\n 'data-[state=open]:zoom-in-95',\n 'data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0',\n 'data-[state=closed]:zoom-out-95',\n 'data-[side=bottom]:slide-in-from-top-2',\n 'data-[side=left]:slide-in-from-right-2',\n 'data-[side=right]:slide-in-from-left-2',\n 'data-[side=top]:slide-in-from-bottom-2',\n 'origin-(--radix-select-content-transform-origin)',\n position === 'popper' && 'data-[side=bottom]:translate-y-1',\n position === 'popper' && 'data-[side=left]:-translate-x-1',\n position === 'popper' && 'data-[side=right]:translate-x-1',\n position === 'popper' && 'data-[side=top]:-translate-y-1',\n className,\n )}\n position={position}\n style={{\n maxHeight: 'var(--radix-select-content-available-height)',\n }}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n 'p-1',\n position === 'popper' && 'w-full scroll-my-1',\n position === 'popper' && 'h-[var(--radix-select-trigger-height)]',\n position === 'popper' && 'min-w-[var(--radix-select-trigger-width)]',\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n )\n}\n\nfunction SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {\n return <SelectPrimitive.Label data-slot=\"select-label\" className={cn('text-text-positive-weak px-2 py-1.5 text-xs', className)} {...props} />\n}\n\nfunction SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>) {\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cn(\n 'relative flex items-center select-none',\n 'gap-2 rounded-md py-2.5 pr-8 pl-2',\n 'w-full',\n 'cursor-pointer transition-colors',\n 'text-text-positive text-sm outline-hidden',\n 'focus:bg-muted-muted',\n 'focus:text-text-positive-strong',\n 'data-[disabled]:opacity-50',\n 'data-[disabled]:pointer-events-none',\n '[&_svg]:pointer-events-none',\n '[&_svg]:shrink-0',\n \"[&_svg:not([class*='size-'])]:size-4\",\n \"[&_svg:not([class*='text-'])]:text-text-positive-weak\",\n '*:[span]:last:flex',\n '*:[span]:last:items-center',\n '*:[span]:last:gap-2',\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 size={16} />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n )\n}\n\nfunction SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>) {\n return <SelectPrimitive.Separator data-slot=\"select-separator\" className={cn('bg-border-weak pointer-events-none -mx-1 my-1 h-px', className)} {...props} />\n}\n\nfunction SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {\n return (\n <SelectPrimitive.ScrollUpButton\n data-slot=\"select-scroll-up-button\"\n className={cn('flex cursor-default items-center justify-center py-1', className)}\n {...props}\n >\n <ChevronUpIcon className=\"size-4\" />\n </SelectPrimitive.ScrollUpButton>\n )\n}\n\nfunction SelectScrollDownButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {\n return (\n <SelectPrimitive.ScrollDownButton\n data-slot=\"select-scroll-down-button\"\n className={cn('flex cursor-default items-center justify-center py-1', className)}\n {...props}\n >\n <ChevronDownIcon className=\"size-4\" />\n </SelectPrimitive.ScrollDownButton>\n )\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n}\n"],"mappings":"yNAOA,SAASA,EAAO,CAAE,GAAG,GAA4D,CAC/E,OAAO,EAACC,EAAgB,KAAA,CAAK,YAAU,SAAS,GAAI,IAGtD,SAAS,EAAY,CAAE,GAAG,GAA6D,CACrF,OAAO,EAACA,EAAgB,MAAA,CAAM,YAAU,eAAe,GAAI,IAG7D,SAAS,EAAY,CAAE,GAAG,GAA6D,CACrF,OAAO,EAACA,EAAgB,MAAA,CAAM,YAAU,eAAe,GAAI,IAG7D,SAAS,EAAc,CACrB,YACA,OAAO,UACP,WACA,GAAG,GAGF,CACD,OACE,EAACA,EAAgB,QAAA,CACf,YAAU,iBACV,YAAW,EACX,UAAW,EACT,kCACA,0CACA,2DACA,gDACA,iBACA,sBACA,8BACA,0BACA,eACA,gCACA,oCACA,8BACA,sBACA,6CACA,mCACA,8BACA,2BACA,8CACA,0BACA,qBACA,0CACA,kCACA,0CACA,mCACA,mBACA,8BACA,uCACA,sDACA,GAEF,GAAI,YAEH,EACD,EAACA,EAAgB,KAAA,CAAK,QAAA,YACpB,EAAC,EAAA,CAAgB,KAAM,GAAI,QAAS,UAM5C,SAAS,EAAc,CAAE,YAAW,WAAU,WAAW,SAAU,GAAG,GAA+D,CACnI,OACE,EAACA,EAAgB,OAAA,CAAA,SACf,EAACA,EAAgB,QAAA,CACf,YAAU,iBACV,UAAW,EACT,aACA,gBACA,WACA,oCACA,6BACA,+BACA,8BACA,+BACA,kCACA,iCACA,kCACA,yCACA,yCACA,yCACA,yCACA,mDACA,IAAa,UAAY,mCACzB,IAAa,UAAY,kCACzB,IAAa,UAAY,kCACzB,IAAa,UAAY,iCACzB,GAEQ,WACV,MAAO,CACL,UAAW,gDAEb,GAAI,YAEJ,EAAC,EAAA,IACD,EAACA,EAAgB,SAAA,CACf,UAAW,EACT,MACA,IAAa,UAAY,qBACzB,IAAa,UAAY,yCACzB,IAAa,UAAY,6CAG1B,aAEH,EAAC,EAAA,SAMT,SAAS,EAAY,CAAE,YAAW,GAAG,GAA6D,CAChG,OAAO,EAACA,EAAgB,MAAA,CAAM,YAAU,eAAe,UAAW,EAAG,8CAA+C,GAAY,GAAI,IAGtI,SAAS,EAAW,CAAE,YAAW,WAAU,GAAG,GAA4D,CACxG,OACE,EAACA,EAAgB,KAAA,CACf,YAAU,cACV,UAAW,EACT,yCACA,oCACA,SACA,mCACA,4CACA,uBACA,kCACA,6BACA,sCACA,8BACA,mBACA,uCACA,wDACA,qBACA,6BACA,sBACA,GAEF,GAAI,YAEJ,EAAC,OAAA,CAAK,UAAU,sEACd,EAACA,EAAgB,cAAA,CAAA,SACf,EAAC,EAAA,CAAU,KAAM,SAGrB,EAACA,EAAgB,SAAA,CAAU,gBAKjC,SAAS,EAAgB,CAAE,YAAW,GAAG,GAAiE,CACxG,OAAO,EAACA,EAAgB,UAAA,CAAU,YAAU,mBAAmB,UAAW,EAAG,qDAAsD,GAAY,GAAI,IAGrJ,SAAS,EAAqB,CAAE,YAAW,GAAG,GAAsE,CAClH,OACE,EAACA,EAAgB,eAAA,CACf,YAAU,0BACV,UAAW,EAAG,uDAAwD,GACtE,GAAI,WAEJ,EAAC,EAAA,CAAc,UAAU,aAK/B,SAAS,EAAuB,CAAE,YAAW,GAAG,GAAwE,CACtH,OACE,EAACA,EAAgB,iBAAA,CACf,YAAU,4BACV,UAAW,EAAG,uDAAwD,GACtE,GAAI,WAEJ,EAAC,EAAA,CAAgB,UAAU"}
@@ -1,2 +1,2 @@
1
1
  const e=require(`./chunk-CUT6urMc.cjs`),t=e.__toESM(require(`lucide-react`)),n=e.__toESM(require(`@customafk/react-toolkit/utils`)),r=e.__toESM(require(`radix-ui`)),i=e.__toESM(require(`react/jsx-runtime`));function a({...e}){return(0,i.jsx)(r.Select.Root,{"data-slot":`select`,...e})}function o({...e}){return(0,i.jsx)(r.Select.Group,{"data-slot":`select-group`,...e})}function s({...e}){return(0,i.jsx)(r.Select.Value,{"data-slot":`select-value`,...e})}function c({className:e,size:a=`default`,children:o,...s}){return(0,i.jsxs)(r.Select.Trigger,{"data-slot":`select-trigger`,"data-size":a,className:(0,n.cn)(`border-border-weak shadow-input`,`flex w-fit items-center justify-between`,`gap-2 rounded-md border bg-transparent px-3 py-2 text-sm`,`whitespace-nowrap transition-all outline-none`,`cursor-pointer`,`hover:border-border`,`focus:border-primary-strong`,`focus:ring-primary-weak`,`focus:ring-4`,`aria-invalid:ring-danger-weak`,`aria-invalid:border-danger-strong`,`disabled:cursor-not-allowed`,`disabled:opacity-50`,`data-[state=open]:text-text-positive-muted`,`data-[state=open]:border-primary`,`data-[state=open]:ring-ring`,`data-[state=open]:ring-4`,`data-[placeholder]:text-text-positive-muted`,`data-[size=default]:h-9`,`data-[size=sm]:h-8`,`*:data-[slot=select-value]:line-clamp-1`,`*:data-[slot=select-value]:flex`,`*:data-[slot=select-value]:items-center`,`*:data-[slot=select-value]:gap-2`,`[&_svg]:shrink-0`,`[&_svg]:pointer-events-none`,`[&_svg:not([class*='size-'])]:size-4`,`[&_svg:not([class*='text-'])]:text-muted-foreground`,e),...s,children:[o,(0,i.jsx)(r.Select.Icon,{asChild:!0,children:(0,i.jsx)(t.ChevronDownIcon,{size:16,opacity:50})})]})}function l({className:e,children:t,position:a=`popper`,...o}){return(0,i.jsx)(r.Select.Portal,{children:(0,i.jsxs)(r.Select.Content,{"data-slot":`select-content`,className:(0,n.cn)(`bg-popover`,`relative z-50`,`min-w-32`,`overflow-x-hidden overflow-y-auto`,`shadow-dropdown rounded-md`,`data-[state=open]:animate-in`,`data-[state=open]:fade-in-0`,`data-[state=open]:zoom-in-95`,`data-[state=closed]:animate-out`,`data-[state=closed]:fade-out-0`,`data-[state=closed]:zoom-out-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`,`origin-(--radix-select-content-transform-origin)`,a===`popper`&&`data-[side=bottom]:translate-y-1`,a===`popper`&&`data-[side=left]:-translate-x-1`,a===`popper`&&`data-[side=right]:translate-x-1`,a===`popper`&&`data-[side=top]:-translate-y-1`,e),position:a,style:{maxHeight:`var(--radix-select-content-available-height)`},...o,children:[(0,i.jsx)(p,{}),(0,i.jsx)(r.Select.Viewport,{className:(0,n.cn)(`p-1`,a===`popper`&&`w-full scroll-my-1`,a===`popper`&&`h-[var(--radix-select-trigger-height)]`,a===`popper`&&`min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,i.jsx)(m,{})]})})}function u({className:e,...t}){return(0,i.jsx)(r.Select.Label,{"data-slot":`select-label`,className:(0,n.cn)(`text-text-positive-weak px-2 py-1.5 text-xs`,e),...t})}function d({className:e,children:a,...o}){return(0,i.jsxs)(r.Select.Item,{"data-slot":`select-item`,className:(0,n.cn)(`relative flex items-center select-none`,`gap-2 rounded-md py-2.5 pr-8 pl-2`,`w-full`,`cursor-pointer transition-colors`,`text-text-positive text-sm outline-hidden`,`focus:bg-muted-muted`,`focus:text-text-positive-strong`,`data-[disabled]:opacity-50`,`data-[disabled]:pointer-events-none`,`[&_svg]:pointer-events-none`,`[&_svg]:shrink-0`,`[&_svg:not([class*='size-'])]:size-4`,`[&_svg:not([class*='text-'])]:text-text-positive-weak`,`*:[span]:last:flex`,`*:[span]:last:items-center`,`*:[span]:last:gap-2`,e),...o,children:[(0,i.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,i.jsx)(r.Select.ItemIndicator,{children:(0,i.jsx)(t.CheckIcon,{size:16})})}),(0,i.jsx)(r.Select.ItemText,{children:a})]})}function f({className:e,...t}){return(0,i.jsx)(r.Select.Separator,{"data-slot":`select-separator`,className:(0,n.cn)(`bg-border-weak pointer-events-none -mx-1 my-1 h-px`,e),...t})}function p({className:e,...a}){return(0,i.jsx)(r.Select.ScrollUpButton,{"data-slot":`select-scroll-up-button`,className:(0,n.cn)(`flex cursor-default items-center justify-center py-1`,e),...a,children:(0,i.jsx)(t.ChevronUpIcon,{className:`size-4`})})}function m({className:e,...a}){return(0,i.jsx)(r.Select.ScrollDownButton,{"data-slot":`select-scroll-down-button`,className:(0,n.cn)(`flex cursor-default items-center justify-center py-1`,e),...a,children:(0,i.jsx)(t.ChevronDownIcon,{className:`size-4`})})}Object.defineProperty(exports,`Select`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`SelectContent`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`SelectGroup`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`SelectItem`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`SelectLabel`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`SelectScrollDownButton`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`SelectScrollUpButton`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`SelectSeparator`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`SelectTrigger`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`SelectValue`,{enumerable:!0,get:function(){return s}});
2
- //# sourceMappingURL=select-DAE3Xg7g.cjs.map
2
+ //# sourceMappingURL=select-oxr4KoHx.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"select-DAE3Xg7g.cjs","names":["SelectPrimitive","ChevronDownIcon","CheckIcon","ChevronUpIcon"],"sources":["../packages/components/ui/select.tsx"],"sourcesContent":["'use client'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nimport { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react'\n\nimport { Select as SelectPrimitive } from 'radix-ui'\n\nfunction Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {\n return <SelectPrimitive.Root data-slot=\"select\" {...props} />\n}\n\nfunction SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>) {\n return <SelectPrimitive.Group data-slot=\"select-group\" {...props} />\n}\n\nfunction SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {\n return <SelectPrimitive.Value data-slot=\"select-value\" {...props} />\n}\n\nfunction SelectTrigger({\n className,\n size = 'default',\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {\n size?: 'sm' | 'default'\n}) {\n return (\n <SelectPrimitive.Trigger\n data-slot=\"select-trigger\"\n data-size={size}\n className={cn(\n 'border-border-weak shadow-input',\n 'flex w-fit items-center justify-between',\n 'gap-2 rounded-md border bg-transparent px-3 py-2 text-sm',\n 'whitespace-nowrap transition-all outline-none',\n 'cursor-pointer',\n 'hover:border-border',\n 'focus:border-primary-strong',\n 'focus:ring-primary-weak',\n 'focus:ring-4',\n 'aria-invalid:ring-danger-weak',\n 'aria-invalid:border-danger-strong',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n 'data-[state=open]:text-text-positive-muted',\n 'data-[state=open]:border-primary',\n 'data-[state=open]:ring-ring',\n 'data-[state=open]:ring-4',\n 'data-[placeholder]:text-text-positive-muted',\n 'data-[size=default]:h-9',\n 'data-[size=sm]:h-8',\n '*:data-[slot=select-value]:line-clamp-1',\n '*:data-[slot=select-value]:flex',\n '*:data-[slot=select-value]:items-center',\n '*:data-[slot=select-value]:gap-2',\n '[&_svg]:shrink-0',\n '[&_svg]:pointer-events-none',\n \"[&_svg:not([class*='size-'])]:size-4\",\n \"[&_svg:not([class*='text-'])]:text-muted-foreground\",\n className,\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon size={16} opacity={50} />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n )\n}\n\nfunction SelectContent({ className, children, position = 'popper', ...props }: React.ComponentProps<typeof SelectPrimitive.Content>) {\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n data-slot=\"select-content\"\n className={cn(\n 'bg-popover',\n 'relative z-50',\n 'min-w-32',\n 'overflow-x-hidden overflow-y-auto',\n 'shadow-dropdown rounded-md',\n 'data-[state=open]:animate-in',\n 'data-[state=open]:fade-in-0',\n 'data-[state=open]:zoom-in-95',\n 'data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0',\n 'data-[state=closed]:zoom-out-95',\n 'data-[side=bottom]:slide-in-from-top-2',\n 'data-[side=left]:slide-in-from-right-2',\n 'data-[side=right]:slide-in-from-left-2',\n 'data-[side=top]:slide-in-from-bottom-2',\n 'origin-(--radix-select-content-transform-origin)',\n position === 'popper' && 'data-[side=bottom]:translate-y-1',\n position === 'popper' && 'data-[side=left]:-translate-x-1',\n position === 'popper' && 'data-[side=right]:translate-x-1',\n position === 'popper' && 'data-[side=top]:-translate-y-1',\n className,\n )}\n position={position}\n style={{\n maxHeight: 'var(--radix-select-content-available-height)',\n }}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n 'p-1',\n position === 'popper' && 'w-full scroll-my-1',\n position === 'popper' && 'h-[var(--radix-select-trigger-height)]',\n position === 'popper' && 'min-w-[var(--radix-select-trigger-width)]',\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n )\n}\n\nfunction SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {\n return <SelectPrimitive.Label data-slot=\"select-label\" className={cn('text-text-positive-weak px-2 py-1.5 text-xs', className)} {...props} />\n}\n\nfunction SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>) {\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cn(\n 'relative flex items-center select-none',\n 'gap-2 rounded-md py-2.5 pr-8 pl-2',\n 'w-full',\n 'cursor-pointer transition-colors',\n 'text-text-positive text-sm outline-hidden',\n 'focus:bg-muted-muted',\n 'focus:text-text-positive-strong',\n 'data-[disabled]:opacity-50',\n 'data-[disabled]:pointer-events-none',\n '[&_svg]:pointer-events-none',\n '[&_svg]:shrink-0',\n \"[&_svg:not([class*='size-'])]:size-4\",\n \"[&_svg:not([class*='text-'])]:text-text-positive-weak\",\n '*:[span]:last:flex',\n '*:[span]:last:items-center',\n '*:[span]:last:gap-2',\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 size={16} />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n )\n}\n\nfunction SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>) {\n return <SelectPrimitive.Separator data-slot=\"select-separator\" className={cn('bg-border-weak pointer-events-none -mx-1 my-1 h-px', className)} {...props} />\n}\n\nfunction SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {\n return (\n <SelectPrimitive.ScrollUpButton\n data-slot=\"select-scroll-up-button\"\n className={cn('flex cursor-default items-center justify-center py-1', className)}\n {...props}\n >\n <ChevronUpIcon className=\"size-4\" />\n </SelectPrimitive.ScrollUpButton>\n )\n}\n\nfunction SelectScrollDownButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {\n return (\n <SelectPrimitive.ScrollDownButton\n data-slot=\"select-scroll-down-button\"\n className={cn('flex cursor-default items-center justify-center py-1', className)}\n {...props}\n >\n <ChevronDownIcon className=\"size-4\" />\n </SelectPrimitive.ScrollDownButton>\n )\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n}\n"],"mappings":"+MAOA,SAAS,EAAO,CAAE,GAAG,GAA4D,CAC/E,OAAO,EAAA,EAAA,KAACA,EAAAA,OAAgB,KAAA,CAAK,YAAU,SAAS,GAAI,IAGtD,SAAS,EAAY,CAAE,GAAG,GAA6D,CACrF,OAAO,EAAA,EAAA,KAACA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ChevronDownIcon","CheckIcon","ChevronUpIcon"],"sources":["../packages/components/ui/select.tsx"],"sourcesContent":["'use client'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nimport { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react'\n\nimport { Select as SelectPrimitive } from 'radix-ui'\n\nfunction Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {\n return <SelectPrimitive.Root data-slot=\"select\" {...props} />\n}\n\nfunction SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>) {\n return <SelectPrimitive.Group data-slot=\"select-group\" {...props} />\n}\n\nfunction SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {\n return <SelectPrimitive.Value data-slot=\"select-value\" {...props} />\n}\n\nfunction SelectTrigger({\n className,\n size = 'default',\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {\n size?: 'sm' | 'default'\n}) {\n return (\n <SelectPrimitive.Trigger\n data-slot=\"select-trigger\"\n data-size={size}\n className={cn(\n 'border-border-weak shadow-input',\n 'flex w-fit items-center justify-between',\n 'gap-2 rounded-md border bg-transparent px-3 py-2 text-sm',\n 'whitespace-nowrap transition-all outline-none',\n 'cursor-pointer',\n 'hover:border-border',\n 'focus:border-primary-strong',\n 'focus:ring-primary-weak',\n 'focus:ring-4',\n 'aria-invalid:ring-danger-weak',\n 'aria-invalid:border-danger-strong',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n 'data-[state=open]:text-text-positive-muted',\n 'data-[state=open]:border-primary',\n 'data-[state=open]:ring-ring',\n 'data-[state=open]:ring-4',\n 'data-[placeholder]:text-text-positive-muted',\n 'data-[size=default]:h-9',\n 'data-[size=sm]:h-8',\n '*:data-[slot=select-value]:line-clamp-1',\n '*:data-[slot=select-value]:flex',\n '*:data-[slot=select-value]:items-center',\n '*:data-[slot=select-value]:gap-2',\n '[&_svg]:shrink-0',\n '[&_svg]:pointer-events-none',\n \"[&_svg:not([class*='size-'])]:size-4\",\n \"[&_svg:not([class*='text-'])]:text-muted-foreground\",\n className,\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon size={16} opacity={50} />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n )\n}\n\nfunction SelectContent({ className, children, position = 'popper', ...props }: React.ComponentProps<typeof SelectPrimitive.Content>) {\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n data-slot=\"select-content\"\n className={cn(\n 'bg-popover',\n 'relative z-50',\n 'min-w-32',\n 'overflow-x-hidden overflow-y-auto',\n 'shadow-dropdown rounded-md',\n 'data-[state=open]:animate-in',\n 'data-[state=open]:fade-in-0',\n 'data-[state=open]:zoom-in-95',\n 'data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0',\n 'data-[state=closed]:zoom-out-95',\n 'data-[side=bottom]:slide-in-from-top-2',\n 'data-[side=left]:slide-in-from-right-2',\n 'data-[side=right]:slide-in-from-left-2',\n 'data-[side=top]:slide-in-from-bottom-2',\n 'origin-(--radix-select-content-transform-origin)',\n position === 'popper' && 'data-[side=bottom]:translate-y-1',\n position === 'popper' && 'data-[side=left]:-translate-x-1',\n position === 'popper' && 'data-[side=right]:translate-x-1',\n position === 'popper' && 'data-[side=top]:-translate-y-1',\n className,\n )}\n position={position}\n style={{\n maxHeight: 'var(--radix-select-content-available-height)',\n }}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n 'p-1',\n position === 'popper' && 'w-full scroll-my-1',\n position === 'popper' && 'h-[var(--radix-select-trigger-height)]',\n position === 'popper' && 'min-w-[var(--radix-select-trigger-width)]',\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n )\n}\n\nfunction SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {\n return <SelectPrimitive.Label data-slot=\"select-label\" className={cn('text-text-positive-weak px-2 py-1.5 text-xs', className)} {...props} />\n}\n\nfunction SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>) {\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cn(\n 'relative flex items-center select-none',\n 'gap-2 rounded-md py-2.5 pr-8 pl-2',\n 'w-full',\n 'cursor-pointer transition-colors',\n 'text-text-positive text-sm outline-hidden',\n 'focus:bg-muted-muted',\n 'focus:text-text-positive-strong',\n 'data-[disabled]:opacity-50',\n 'data-[disabled]:pointer-events-none',\n '[&_svg]:pointer-events-none',\n '[&_svg]:shrink-0',\n \"[&_svg:not([class*='size-'])]:size-4\",\n \"[&_svg:not([class*='text-'])]:text-text-positive-weak\",\n '*:[span]:last:flex',\n '*:[span]:last:items-center',\n '*:[span]:last:gap-2',\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 size={16} />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n )\n}\n\nfunction SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>) {\n return <SelectPrimitive.Separator data-slot=\"select-separator\" className={cn('bg-border-weak pointer-events-none -mx-1 my-1 h-px', className)} {...props} />\n}\n\nfunction SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {\n return (\n <SelectPrimitive.ScrollUpButton\n data-slot=\"select-scroll-up-button\"\n className={cn('flex cursor-default items-center justify-center py-1', className)}\n {...props}\n >\n <ChevronUpIcon className=\"size-4\" />\n </SelectPrimitive.ScrollUpButton>\n )\n}\n\nfunction SelectScrollDownButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {\n return (\n <SelectPrimitive.ScrollDownButton\n data-slot=\"select-scroll-down-button\"\n className={cn('flex cursor-default items-center justify-center py-1', className)}\n {...props}\n >\n <ChevronDownIcon className=\"size-4\" />\n </SelectPrimitive.ScrollDownButton>\n )\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n}\n"],"mappings":"+MAOA,SAAS,EAAO,CAAE,GAAG,GAA4D,CAC/E,OAAO,EAAA,EAAA,KAACA,EAAAA,OAAgB,KAAA,CAAK,YAAU,SAAS,GAAI,IAGtD,SAAS,EAAY,CAAE,GAAG,GAA6D,CACrF,OAAO,EAAA,EAAA,KAACA,EAAAA,OAAgB,MAAA,CAAM,YAAU,eAAe,GAAI,IAG7D,SAAS,EAAY,CAAE,GAAG,GAA6D,CACrF,OAAO,EAAA,EAAA,KAACA,EAAAA,OAAgB,MAAA,CAAM,YAAU,eAAe,GAAI,IAG7D,SAAS,EAAc,CACrB,YACA,OAAO,UACP,WACA,GAAG,GAGF,CACD,OACE,EAAA,EAAA,MAACA,EAAAA,OAAgB,QAAA,CACf,YAAU,iBACV,YAAW,EACX,WAAA,EAAA,EAAA,IACE,kCACA,0CACA,2DACA,gDACA,iBACA,sBACA,8BACA,0BACA,eACA,gCACA,oCACA,8BACA,sBACA,6CACA,mCACA,8BACA,2BACA,8CACA,0BACA,qBACA,0CACA,kCACA,0CACA,mCACA,mBACA,8BACA,uCACA,sDACA,GAEF,GAAI,YAEH,GACD,EAAA,EAAA,KAACA,EAAAA,OAAgB,KAAA,CAAK,QAAA,aACpB,EAAA,EAAA,KAACC,EAAAA,gBAAAA,CAAgB,KAAM,GAAI,QAAS,UAM5C,SAAS,EAAc,CAAE,YAAW,WAAU,WAAW,SAAU,GAAG,GAA+D,CACnI,OACE,EAAA,EAAA,KAACD,EAAAA,OAAgB,OAAA,CAAA,UACf,EAAA,EAAA,MAACA,EAAAA,OAAgB,QAAA,CACf,YAAU,iBACV,WAAA,EAAA,EAAA,IACE,aACA,gBACA,WACA,oCACA,6BAC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