@deweb.id/ui-kit 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (408) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -2
  3. package/css/ui-kit.css +901 -0
  4. package/dist/chunk-028rzptn.js +253 -0
  5. package/dist/chunk-028rzptn.js.map +10 -0
  6. package/dist/chunk-0x0et52k.js +82 -0
  7. package/dist/chunk-0x0et52k.js.map +10 -0
  8. package/dist/chunk-17gmkyd1.js +195 -0
  9. package/dist/chunk-17gmkyd1.js.map +10 -0
  10. package/dist/chunk-19jsevr8.js +17 -0
  11. package/dist/chunk-19jsevr8.js.map +10 -0
  12. package/dist/chunk-1t1fbbme.js +171 -0
  13. package/dist/chunk-1t1fbbme.js.map +10 -0
  14. package/dist/chunk-26ban96z.js +151 -0
  15. package/dist/chunk-26ban96z.js.map +10 -0
  16. package/dist/chunk-39hey5ns.js +2034 -0
  17. package/dist/chunk-39hey5ns.js.map +19 -0
  18. package/dist/chunk-3f0bjycv.js +481 -0
  19. package/dist/chunk-3f0bjycv.js.map +10 -0
  20. package/dist/chunk-3zpf64v4.js +108 -0
  21. package/dist/chunk-3zpf64v4.js.map +10 -0
  22. package/dist/chunk-4jrq15v9.js +919 -0
  23. package/dist/chunk-4jrq15v9.js.map +10 -0
  24. package/dist/chunk-8dacesjp.js +289 -0
  25. package/dist/chunk-8dacesjp.js.map +10 -0
  26. package/dist/chunk-8een770x.js +2546 -0
  27. package/dist/chunk-8een770x.js.map +29 -0
  28. package/dist/chunk-8jv2g2ne.js +371 -0
  29. package/dist/chunk-8jv2g2ne.js.map +10 -0
  30. package/dist/chunk-abdqb4e5.js +156 -0
  31. package/dist/chunk-abdqb4e5.js.map +10 -0
  32. package/dist/chunk-af27xdf2.js +891 -0
  33. package/dist/chunk-af27xdf2.js.map +11 -0
  34. package/dist/chunk-amsyqyh9.js +23 -0
  35. package/dist/chunk-amsyqyh9.js.map +9 -0
  36. package/dist/chunk-czbcw9e1.js +503 -0
  37. package/dist/chunk-czbcw9e1.js.map +11 -0
  38. package/dist/chunk-dar8mz91.js +73 -0
  39. package/dist/chunk-dar8mz91.js.map +10 -0
  40. package/dist/chunk-dsddmmdk.js +136 -0
  41. package/dist/chunk-dsddmmdk.js.map +10 -0
  42. package/dist/chunk-edx7tas6.js +89 -0
  43. package/dist/chunk-edx7tas6.js.map +10 -0
  44. package/dist/chunk-es4tgmvr.js +1686 -0
  45. package/dist/chunk-es4tgmvr.js.map +12 -0
  46. package/dist/chunk-f2aqj672.js +240 -0
  47. package/dist/chunk-f2aqj672.js.map +11 -0
  48. package/dist/chunk-h6k57hyd.js +146 -0
  49. package/dist/chunk-h6k57hyd.js.map +10 -0
  50. package/dist/chunk-hkx78qgj.js +1548 -0
  51. package/dist/chunk-hkx78qgj.js.map +12 -0
  52. package/dist/chunk-hq57r97c.js +770 -0
  53. package/dist/chunk-hq57r97c.js.map +11 -0
  54. package/dist/chunk-jct2e2h1.js +139 -0
  55. package/dist/chunk-jct2e2h1.js.map +10 -0
  56. package/dist/chunk-je0j5sn4.js +246 -0
  57. package/dist/chunk-je0j5sn4.js.map +10 -0
  58. package/dist/chunk-k2b698v5.js +754 -0
  59. package/dist/chunk-k2b698v5.js.map +12 -0
  60. package/dist/chunk-kv58555q.js +267 -0
  61. package/dist/chunk-kv58555q.js.map +11 -0
  62. package/dist/chunk-m0msvrte.js +15 -0
  63. package/dist/chunk-m0msvrte.js.map +10 -0
  64. package/dist/chunk-m3t14v77.js +30 -0
  65. package/dist/chunk-m3t14v77.js.map +10 -0
  66. package/dist/chunk-mctp30cp.js +1466 -0
  67. package/dist/chunk-mctp30cp.js.map +10 -0
  68. package/dist/chunk-n37qb5m5.js +1408 -0
  69. package/dist/chunk-n37qb5m5.js.map +10 -0
  70. package/dist/chunk-nhhgsdt3.js +570 -0
  71. package/dist/chunk-nhhgsdt3.js.map +11 -0
  72. package/dist/chunk-pxydj130.js +28 -0
  73. package/dist/chunk-pxydj130.js.map +10 -0
  74. package/dist/chunk-qmbwp4k7.js +3275 -0
  75. package/dist/chunk-qmbwp4k7.js.map +13 -0
  76. package/dist/chunk-qzxf0aa2.js +149 -0
  77. package/dist/chunk-qzxf0aa2.js.map +10 -0
  78. package/dist/chunk-rbjyp9ff.js +47 -0
  79. package/dist/chunk-rbjyp9ff.js.map +10 -0
  80. package/dist/chunk-rbkc50xg.js +103 -0
  81. package/dist/chunk-rbkc50xg.js.map +10 -0
  82. package/dist/chunk-rn6f0s6x.js +66 -0
  83. package/dist/chunk-rn6f0s6x.js.map +9 -0
  84. package/dist/chunk-rswzbfa2.js +422 -0
  85. package/dist/chunk-rswzbfa2.js.map +10 -0
  86. package/dist/chunk-rzns0reg.js +157 -0
  87. package/dist/chunk-rzns0reg.js.map +10 -0
  88. package/dist/chunk-s851vtje.js +90 -0
  89. package/dist/chunk-s851vtje.js.map +10 -0
  90. package/dist/chunk-vak164kx.js +15 -0
  91. package/dist/chunk-vak164kx.js.map +9 -0
  92. package/dist/chunk-vpvnvegz.js +480 -0
  93. package/dist/chunk-vpvnvegz.js.map +10 -0
  94. package/dist/chunk-x4pk7vxm.js +10 -0
  95. package/dist/chunk-x4pk7vxm.js.map +10 -0
  96. package/dist/chunk-xd2fwgek.js +53 -0
  97. package/dist/chunk-xd2fwgek.js.map +10 -0
  98. package/dist/chunk-y71rd8qf.js +499 -0
  99. package/dist/chunk-y71rd8qf.js.map +10 -0
  100. package/dist/chunk-zjmt193s.js +34 -0
  101. package/dist/chunk-zjmt193s.js.map +9 -0
  102. package/dist/components/blocks/CustomHtmlBlock.d.ts +14 -0
  103. package/dist/components/blocks/LoginFormBlock.d.ts +16 -0
  104. package/dist/components/blocks/SidebarMenuBlock.d.ts +11 -0
  105. package/dist/components/blocks/SliderBlock.d.ts +13 -0
  106. package/dist/components/code/code-editor.d.ts +58 -0
  107. package/dist/components/code/code-preview.d.ts +18 -0
  108. package/dist/components/code/index.d.ts +4 -0
  109. package/dist/components/code/validator.d.ts +10 -0
  110. package/dist/components/code/vsc-themes.d.ts +6 -0
  111. package/dist/components/dashboard/compound/context.d.ts +14 -0
  112. package/dist/components/dashboard/compound/dashboard.d.ts +14 -0
  113. package/dist/components/dashboard/compound/index.d.ts +18 -0
  114. package/dist/components/dashboard/compound/main.d.ts +25 -0
  115. package/dist/components/dashboard/compound/sidebar.d.ts +5 -0
  116. package/dist/components/dashboard/dashboard-head-info.d.ts +38 -0
  117. package/dist/components/dashboard/dashboard-head.d.ts +19 -0
  118. package/dist/components/dashboard/dataview.d.ts +19 -0
  119. package/dist/components/dashboard/detailview.d.ts +1 -0
  120. package/dist/components/dashboard/formview.d.ts +265 -0
  121. package/dist/components/dashboard/pageformview.d.ts +79 -0
  122. package/dist/components/dashboard/styling/background-color-control.d.ts +34 -0
  123. package/dist/components/dashboard/styling/background-control.d.ts +45 -0
  124. package/dist/components/dashboard/styling/border-control.d.ts +14 -0
  125. package/dist/components/dashboard/styling/color-control.d.ts +22 -0
  126. package/dist/components/dashboard/styling/index.d.ts +7 -0
  127. package/dist/components/dashboard/styling/radius-control.d.ts +15 -0
  128. package/dist/components/dashboard/styling/spacing-control.d.ts +17 -0
  129. package/dist/components/dashboard/styling/types.d.ts +50 -0
  130. package/dist/components/document/index.d.ts +25 -0
  131. package/dist/components/ecommerce/commerce-cards.d.ts +37 -0
  132. package/dist/components/effect/action-animation.d.ts +14 -0
  133. package/dist/components/effect/element-animation.d.ts +41 -0
  134. package/dist/components/effect/page-transition.d.ts +10 -0
  135. package/dist/components/layout/BlockPalette.d.ts +14 -0
  136. package/dist/components/layout/DynamicLayout.d.ts +56 -0
  137. package/dist/components/layout/GridRow.d.ts +37 -0
  138. package/dist/components/layout/LayoutBuilder.d.ts +52 -0
  139. package/dist/components/layout/WidgetFieldsForm.d.ts +15 -0
  140. package/dist/components/ui/accordion.d.ts +36 -0
  141. package/dist/components/ui/action-bar.d.ts +46 -0
  142. package/dist/components/ui/alert.d.ts +25 -0
  143. package/dist/components/ui/animated.d.ts +41 -0
  144. package/dist/components/ui/app-shell.d.ts +53 -0
  145. package/dist/components/ui/avatar.d.ts +18 -0
  146. package/dist/components/ui/badge.d.ts +15 -0
  147. package/dist/components/ui/breadcrumb.d.ts +20 -0
  148. package/dist/components/ui/button-icon.d.ts +9 -0
  149. package/dist/components/ui/button.d.ts +37 -0
  150. package/dist/components/ui/calendar.d.ts +14 -0
  151. package/dist/components/ui/card-skeleton-aware.d.ts +2 -0
  152. package/dist/components/ui/card.d.ts +36 -0
  153. package/dist/components/ui/chart.d.ts +75 -0
  154. package/dist/components/ui/chat-bubble.d.ts +74 -0
  155. package/dist/components/ui/code.d.ts +85 -0
  156. package/dist/components/ui/code.js +21 -0
  157. package/dist/components/ui/code.js.map +9 -0
  158. package/dist/components/ui/collapsible.d.ts +25 -0
  159. package/dist/components/ui/control-group.d.ts +39 -0
  160. package/dist/components/ui/dashboard-grid/DashboardDropSlot.d.ts +10 -0
  161. package/dist/components/ui/dashboard-grid/DashboardGrid.d.ts +5 -0
  162. package/dist/components/ui/dashboard-grid/DashboardWidgetCard.d.ts +43 -0
  163. package/dist/components/ui/dashboard-grid/useDashboardDnd.d.ts +36 -0
  164. package/dist/components/ui/data-empty.d.ts +24 -0
  165. package/dist/components/ui/data-list.d.ts +16 -0
  166. package/dist/components/ui/data-table.d.ts +48 -0
  167. package/dist/components/ui/data-view/DataView.d.ts +46 -0
  168. package/dist/components/ui/data-view/DataViewCalendar.d.ts +18 -0
  169. package/dist/components/ui/data-view/DataViewContent.d.ts +5 -0
  170. package/dist/components/ui/data-view/DataViewFilter.d.ts +8 -0
  171. package/dist/components/ui/data-view/DataViewGrid.d.ts +32 -0
  172. package/dist/components/ui/data-view/DataViewHeader.d.ts +22 -0
  173. package/dist/components/ui/data-view/DataViewKanban.d.ts +16 -0
  174. package/dist/components/ui/data-view/DataViewPivot.d.ts +15 -0
  175. package/dist/components/ui/data-view/DataViewTable.d.ts +33 -0
  176. package/dist/components/ui/data-view/index.d.ts +9 -0
  177. package/dist/components/ui/date-time-picker.d.ts +205 -0
  178. package/dist/components/ui/drawer.d.ts +71 -0
  179. package/dist/components/ui/dropdown-animation.d.ts +7 -0
  180. package/dist/components/ui/dropdown.d.ts +71 -0
  181. package/dist/components/ui/error-state.d.ts +15 -0
  182. package/dist/components/ui/filter-bar.d.ts +50 -0
  183. package/dist/components/ui/filter-bar.js +19 -0
  184. package/dist/components/ui/filter-bar.js.map +9 -0
  185. package/dist/components/ui/font.d.ts +24 -0
  186. package/dist/components/ui/form-advanced.d.ts +198 -0
  187. package/dist/components/ui/form-compound.d.ts +58 -0
  188. package/dist/components/ui/form-context.d.ts +19 -0
  189. package/dist/components/ui/form.d.ts +451 -0
  190. package/dist/components/ui/format-currency.d.ts +10 -0
  191. package/dist/components/ui/format-date.d.ts +28 -0
  192. package/dist/components/ui/format-number.d.ts +22 -0
  193. package/dist/components/ui/format-time.d.ts +5 -0
  194. package/dist/components/ui/grid.d.ts +30 -0
  195. package/dist/components/ui/heading.d.ts +9 -0
  196. package/dist/components/ui/indicator.d.ts +17 -0
  197. package/dist/components/ui/initial-icon.d.ts +11 -0
  198. package/dist/components/ui/input-code.d.ts +27 -0
  199. package/dist/components/ui/input-grid.d.ts +54 -0
  200. package/dist/components/ui/input.d.ts +37 -0
  201. package/dist/components/ui/invoice-blocks.d.ts +124 -0
  202. package/dist/components/ui/invoice-document.d.ts +63 -0
  203. package/dist/components/ui/kanban.d.ts +16 -0
  204. package/dist/components/ui/label.d.ts +4 -0
  205. package/dist/components/ui/lazy-load.d.ts +13 -0
  206. package/dist/components/ui/lightbox.d.ts +15 -0
  207. package/dist/components/ui/list.d.ts +33 -0
  208. package/dist/components/ui/loading.d.ts +79 -0
  209. package/dist/components/ui/media-card.d.ts +50 -0
  210. package/dist/components/ui/media-player.d.ts +47 -0
  211. package/dist/components/ui/menu.d.ts +24 -0
  212. package/dist/components/ui/modal.d.ts +233 -0
  213. package/dist/components/ui/page.d.ts +51 -0
  214. package/dist/components/ui/pagination.d.ts +16 -0
  215. package/dist/components/ui/print.d.ts +173 -0
  216. package/dist/components/ui/project-card.d.ts +43 -0
  217. package/dist/components/ui/radius-control.d.ts +36 -0
  218. package/dist/components/ui/rich-text-editor.d.ts +32 -0
  219. package/dist/components/ui/select-card.d.ts +56 -0
  220. package/dist/components/ui/sidebar-logo.d.ts +11 -0
  221. package/dist/components/ui/sidebar-menu.d.ts +82 -0
  222. package/dist/components/ui/sidebar-search.d.ts +7 -0
  223. package/dist/components/ui/skeletons.d.ts +46 -0
  224. package/dist/components/ui/surface.d.ts +13 -0
  225. package/dist/components/ui/table-pivot.d.ts +10 -0
  226. package/dist/components/ui/table.d.ts +258 -0
  227. package/dist/components/ui/tabs.d.ts +79 -0
  228. package/dist/components/ui/task-board.d.ts +29 -0
  229. package/dist/components/ui/terminal.d.ts +51 -0
  230. package/dist/components/ui/text-sensor.d.ts +9 -0
  231. package/dist/components/ui/theme-styler.d.ts +3 -0
  232. package/dist/components/ui/theme-toggle.d.ts +23 -0
  233. package/dist/components/ui/tooltip.d.ts +11 -0
  234. package/dist/components/website/account-banner.d.ts +11 -0
  235. package/dist/components/website/account-layout.d.ts +20 -0
  236. package/dist/components/website/account.d.ts +46 -0
  237. package/dist/components/website/ambient.d.ts +19 -0
  238. package/dist/components/website/auth.d.ts +35 -0
  239. package/dist/components/website/blog/blog-list-custom.d.ts +3 -0
  240. package/dist/components/website/blog/blog-list-gallery.d.ts +2 -0
  241. package/dist/components/website/blog/blog-list-grid.d.ts +2 -0
  242. package/dist/components/website/blog/blog-list-list.d.ts +2 -0
  243. package/dist/components/website/blog.d.ts +50 -0
  244. package/dist/components/website/carousel.d.ts +58 -0
  245. package/dist/components/website/cart.d.ts +31 -0
  246. package/dist/components/website/catalogue-view.d.ts +81 -0
  247. package/dist/components/website/catalogue.d.ts +96 -0
  248. package/dist/components/website/comment.d.ts +52 -0
  249. package/dist/components/website/eclipse.d.ts +15 -0
  250. package/dist/components/website/feature-grid.d.ts +58 -0
  251. package/dist/components/website/filter.d.ts +109 -0
  252. package/dist/components/website/hero.d.ts +89 -0
  253. package/dist/components/website/localize.d.ts +36 -0
  254. package/dist/components/website/logo.d.ts +24 -0
  255. package/dist/components/website/megamenu.d.ts +10 -0
  256. package/dist/components/website/navbar.d.ts +42 -0
  257. package/dist/components/website/notification.d.ts +58 -0
  258. package/dist/components/website/price.d.ts +26 -0
  259. package/dist/components/website/pricing.d.ts +21 -0
  260. package/dist/components/website/product.d.ts +32 -0
  261. package/dist/components/website/rating.d.ts +36 -0
  262. package/dist/components/website/review-form.d.ts +54 -0
  263. package/dist/components/website/reviews.d.ts +119 -0
  264. package/dist/components/website/search.d.ts +30 -0
  265. package/dist/entries/accordion.d.ts +1 -0
  266. package/dist/entries/accordion.js +9 -0
  267. package/dist/entries/accordion.js.map +9 -0
  268. package/dist/entries/alert.d.ts +1 -0
  269. package/dist/entries/alert.js +10 -0
  270. package/dist/entries/alert.js.map +9 -0
  271. package/dist/entries/badge.d.ts +1 -0
  272. package/dist/entries/badge.js +11 -0
  273. package/dist/entries/badge.js.map +9 -0
  274. package/dist/entries/breadcrumb.d.ts +1 -0
  275. package/dist/entries/breadcrumb.js +10 -0
  276. package/dist/entries/breadcrumb.js.map +9 -0
  277. package/dist/entries/button.d.ts +1 -0
  278. package/dist/entries/button.js +12 -0
  279. package/dist/entries/button.js.map +9 -0
  280. package/dist/entries/card.d.ts +1 -0
  281. package/dist/entries/card.js +25 -0
  282. package/dist/entries/card.js.map +9 -0
  283. package/dist/entries/chart.d.ts +1 -0
  284. package/dist/entries/chart.js +130 -0
  285. package/dist/entries/chart.js.map +10 -0
  286. package/dist/entries/components.d.ts +53 -0
  287. package/dist/entries/components.js +643 -0
  288. package/dist/entries/components.js.map +9 -0
  289. package/dist/entries/dashboard/dataview.d.ts +1 -0
  290. package/dist/entries/dashboard/dataview.js +82 -0
  291. package/dist/entries/dashboard/dataview.js.map +10 -0
  292. package/dist/entries/dashboard/pageformview.d.ts +1 -0
  293. package/dist/entries/dashboard/pageformview.js +34 -0
  294. package/dist/entries/dashboard/pageformview.js.map +9 -0
  295. package/dist/entries/data-table.d.ts +1 -0
  296. package/dist/entries/data-table.js +22 -0
  297. package/dist/entries/data-table.js.map +9 -0
  298. package/dist/entries/date-time-picker.d.ts +1 -0
  299. package/dist/entries/date-time-picker.js +28 -0
  300. package/dist/entries/date-time-picker.js.map +9 -0
  301. package/dist/entries/document.d.ts +1 -0
  302. package/dist/entries/document.js +69 -0
  303. package/dist/entries/document.js.map +10 -0
  304. package/dist/entries/drawer.d.ts +1 -0
  305. package/dist/entries/drawer.js +20 -0
  306. package/dist/entries/drawer.js.map +9 -0
  307. package/dist/entries/dropdown.d.ts +1 -0
  308. package/dist/entries/dropdown.js +29 -0
  309. package/dist/entries/dropdown.js.map +9 -0
  310. package/dist/entries/error-state.d.ts +1 -0
  311. package/dist/entries/error-state.js +14 -0
  312. package/dist/entries/error-state.js.map +9 -0
  313. package/dist/entries/favorite-button.d.ts +1 -0
  314. package/dist/entries/favorite-button.js +7 -0
  315. package/dist/entries/favorite-button.js.map +10 -0
  316. package/dist/entries/font.d.ts +1 -0
  317. package/dist/entries/font.js +10 -0
  318. package/dist/entries/font.js.map +9 -0
  319. package/dist/entries/form-advanced.d.ts +1 -0
  320. package/dist/entries/form-advanced.js +39 -0
  321. package/dist/entries/form-advanced.js.map +9 -0
  322. package/dist/entries/form.d.ts +1 -0
  323. package/dist/entries/form.js +74 -0
  324. package/dist/entries/form.js.map +9 -0
  325. package/dist/entries/heading.d.ts +1 -0
  326. package/dist/entries/heading.js +8 -0
  327. package/dist/entries/heading.js.map +9 -0
  328. package/dist/entries/input.d.ts +1 -0
  329. package/dist/entries/input.js +11 -0
  330. package/dist/entries/input.js.map +9 -0
  331. package/dist/entries/layout.d.ts +4 -0
  332. package/dist/entries/layout.js +101 -0
  333. package/dist/entries/layout.js.map +9 -0
  334. package/dist/entries/lazy-load.d.ts +1 -0
  335. package/dist/entries/lazy-load.js +9 -0
  336. package/dist/entries/lazy-load.js.map +9 -0
  337. package/dist/entries/list.d.ts +1 -0
  338. package/dist/entries/list.js +13 -0
  339. package/dist/entries/list.js.map +9 -0
  340. package/dist/entries/loading.d.ts +1 -0
  341. package/dist/entries/loading.js +18 -0
  342. package/dist/entries/loading.js.map +9 -0
  343. package/dist/entries/menu.d.ts +1 -0
  344. package/dist/entries/menu.js +17 -0
  345. package/dist/entries/menu.js.map +9 -0
  346. package/dist/entries/modal.d.ts +1 -0
  347. package/dist/entries/modal.js +33 -0
  348. package/dist/entries/modal.js.map +9 -0
  349. package/dist/entries/product.d.ts +2 -0
  350. package/dist/entries/product.js +10 -0
  351. package/dist/entries/product.js.map +9 -0
  352. package/dist/entries/select-card.d.ts +1 -0
  353. package/dist/entries/select-card.js +13 -0
  354. package/dist/entries/select-card.js.map +9 -0
  355. package/dist/entries/skeletons.d.ts +1 -0
  356. package/dist/entries/skeletons.js +35 -0
  357. package/dist/entries/skeletons.js.map +9 -0
  358. package/dist/entries/surface.d.ts +1 -0
  359. package/dist/entries/surface.js +10 -0
  360. package/dist/entries/surface.js.map +9 -0
  361. package/dist/entries/table.d.ts +1 -0
  362. package/dist/entries/table.js +65 -0
  363. package/dist/entries/table.js.map +9 -0
  364. package/dist/entries/tabs.d.ts +1 -0
  365. package/dist/entries/tabs.js +20 -0
  366. package/dist/entries/tabs.js.map +9 -0
  367. package/dist/entries/theme-styler.d.ts +1 -0
  368. package/dist/entries/theme-styler.js +26 -0
  369. package/dist/entries/theme-styler.js.map +9 -0
  370. package/dist/entries/toast.d.ts +1 -0
  371. package/dist/entries/toast.js +13 -0
  372. package/dist/entries/toast.js.map +9 -0
  373. package/dist/index.d.ts +163 -0
  374. package/dist/index.js +19864 -0
  375. package/dist/index.js.map +92 -0
  376. package/dist/lib/color/className.d.ts +14 -0
  377. package/dist/lib/color/config.d.ts +82 -0
  378. package/dist/lib/color/engine.d.ts +221 -0
  379. package/dist/lib/color/generator.d.ts +45 -0
  380. package/dist/lib/color/index.d.ts +5 -0
  381. package/dist/lib/color/safelist.d.ts +1 -0
  382. package/dist/lib/color/types.d.ts +12 -0
  383. package/dist/lib/font/config.d.ts +13 -0
  384. package/dist/lib/font/engine.d.ts +77 -0
  385. package/dist/lib/font/index.d.ts +3 -0
  386. package/dist/lib/font/types.d.ts +27 -0
  387. package/dist/lib/icon/config.d.ts +37 -0
  388. package/dist/lib/icon/engine.d.ts +84 -0
  389. package/dist/lib/icon/index.d.ts +3 -0
  390. package/dist/lib/icon/presets.d.ts +71 -0
  391. package/dist/lib/layout/config.d.ts +7 -0
  392. package/dist/lib/layout/engine.d.ts +224 -0
  393. package/dist/lib/layout/types.d.ts +151 -0
  394. package/dist/lib/layout/useActiveBreakpoint.d.ts +14 -0
  395. package/dist/lib/layout/useBlockDrag.d.ts +47 -0
  396. package/dist/lib/layout/useSectionDrag.d.ts +30 -0
  397. package/dist/lib/layout/useSpanResize.d.ts +31 -0
  398. package/dist/lib/localize/data.d.ts +9 -0
  399. package/dist/lib/product-utils.d.ts +7 -0
  400. package/dist/lib/sanitize/sanitizeHtml.d.ts +52 -0
  401. package/dist/lib/theme/motion.d.ts +27 -0
  402. package/dist/lib/theme/motion.js +12 -0
  403. package/dist/lib/theme/motion.js.map +9 -0
  404. package/dist/lib/theme/types.d.ts +133 -0
  405. package/dist/lib/useUndoRedo.d.ts +21 -0
  406. package/dist/lib/utils.d.ts +2 -0
  407. package/dist/types/product.d.ts +27 -0
  408. package/package.json +442 -4
@@ -0,0 +1,3275 @@
1
+ import {
2
+ cn2
3
+ } from "./chunk-x4pk7vxm.js";
4
+ import {
5
+ resolveIcon2,
6
+ Icon2
7
+ } from "./chunk-k2b698v5.js";
8
+ import {
9
+ useFormContext2,
10
+ Input2
11
+ } from "./chunk-nhhgsdt3.js";
12
+ import {
13
+ Label2
14
+ } from "./chunk-19jsevr8.js";
15
+ import {
16
+ useRipple2,
17
+ RippleEffect2,
18
+ Button2
19
+ } from "./chunk-kv58555q.js";
20
+ import {
21
+ Dropdown2,
22
+ DropdownTrigger2,
23
+ DropdownContent2
24
+ } from "./chunk-vpvnvegz.js";
25
+ import {
26
+ ButtonIcon2
27
+ } from "./chunk-m3t14v77.js";
28
+ import {
29
+ Modal2
30
+ } from "./chunk-4jrq15v9.js";
31
+ import {
32
+ SelectCard2
33
+ } from "./chunk-je0j5sn4.js";
34
+ import {
35
+ fontStyle2
36
+ } from "./chunk-czbcw9e1.js";
37
+
38
+ // src/components/ui/form.tsx
39
+ import * as React3 from "react";
40
+ import { createPortal as createPortal3 } from "react-dom";
41
+ import { Check as Check2, File as FileIcon, X as X2, Eye, EyeOff, AlertCircle, Copy } from "lucide-react";
42
+ import { HexColorPicker, HexAlphaColorPicker } from "react-colorful";
43
+
44
+ // src/components/ui/form-advanced.tsx
45
+ import * as React2 from "react";
46
+ import { createPortal as createPortal2 } from "react-dom";
47
+ import { ChevronDown, Check, X, Loader2 } from "lucide-react";
48
+
49
+ // src/components/ui/tooltip.tsx
50
+ import * as React from "react";
51
+ import { createPortal } from "react-dom";
52
+ import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
53
+ function PortalTooltip2({
54
+ content,
55
+ children,
56
+ side = "right",
57
+ delayDuration = 200,
58
+ className,
59
+ disabled
60
+ }) {
61
+ const [open, setOpen] = React.useState(false);
62
+ const [coords, setCoords] = React.useState({ x: 0, y: 0 });
63
+ const triggerRef = React.useRef(null);
64
+ const timeoutRef = React.useRef(null);
65
+ const showTooltip = () => {
66
+ if (disabled)
67
+ return;
68
+ if (timeoutRef.current)
69
+ clearTimeout(timeoutRef.current);
70
+ timeoutRef.current = setTimeout(() => {
71
+ if (triggerRef.current) {
72
+ const rect = triggerRef.current.getBoundingClientRect();
73
+ let x = 0;
74
+ let y = 0;
75
+ if (side === "right") {
76
+ x = rect.right + 8;
77
+ y = rect.top + rect.height / 2;
78
+ } else if (side === "top") {
79
+ x = rect.left + rect.width / 2;
80
+ y = rect.top - 8;
81
+ } else if (side === "bottom") {
82
+ x = rect.left + rect.width / 2;
83
+ y = rect.bottom + 8;
84
+ } else if (side === "left") {
85
+ x = rect.left - 8;
86
+ y = rect.top + rect.height / 2;
87
+ }
88
+ setCoords({ x, y });
89
+ setOpen(true);
90
+ }
91
+ }, delayDuration);
92
+ };
93
+ const hideTooltip = () => {
94
+ if (timeoutRef.current)
95
+ clearTimeout(timeoutRef.current);
96
+ setOpen(false);
97
+ };
98
+ React.useEffect(() => {
99
+ return () => {
100
+ if (timeoutRef.current)
101
+ clearTimeout(timeoutRef.current);
102
+ };
103
+ }, []);
104
+ const child = React.Children.only(children);
105
+ const clone = React.cloneElement(child, {
106
+ ref: triggerRef,
107
+ onMouseEnter: (e) => {
108
+ showTooltip();
109
+ if (child.props.onMouseEnter)
110
+ child.props.onMouseEnter(e);
111
+ },
112
+ onMouseLeave: (e) => {
113
+ hideTooltip();
114
+ if (child.props.onMouseLeave)
115
+ child.props.onMouseLeave(e);
116
+ },
117
+ onFocus: (e) => {
118
+ showTooltip();
119
+ if (child.props.onFocus)
120
+ child.props.onFocus(e);
121
+ },
122
+ onBlur: (e) => {
123
+ hideTooltip();
124
+ if (child.props.onBlur)
125
+ child.props.onBlur(e);
126
+ }
127
+ });
128
+ return /* @__PURE__ */ jsxDEV(Fragment, {
129
+ children: [
130
+ clone,
131
+ open && typeof document !== "undefined" && createPortal(/* @__PURE__ */ jsxDEV("div", {
132
+ className: cn2("fixed z-[9999] pointer-events-none rounded-md border border-[color:var(--color-border)] bg-tooltip px-2.5 py-1.5 text-xs font-medium text-tooltip-foreground shadow-md animate-in fade-in zoom-in-95 duration-100", side === "right" && "origin-left -translate-y-1/2 ml-1.5", side === "top" && "origin-bottom -translate-x-1/2 -translate-y-full mb-1.5", side === "bottom" && "origin-top -translate-x-1/2 mt-1.5", side === "left" && "origin-right -translate-x-full -translate-y-1/2 mr-1.5", className),
133
+ style: { top: coords.y, left: coords.x },
134
+ children: [
135
+ content,
136
+ /* @__PURE__ */ jsxDEV("div", {
137
+ className: cn2("absolute w-2 h-2 rotate-45 bg-tooltip pointer-events-none", side === "right" && "right-full top-1/2 -translate-y-1/2 translate-x-1 border-l border-b border-[color:var(--color-border)]", side === "left" && "left-full top-1/2 -translate-y-1/2 -translate-x-1 border-r border-t border-[color:var(--color-border)]", side === "top" && "top-full left-1/2 -translate-x-1/2 -translate-y-1 border-r border-b border-[color:var(--color-border)]", side === "bottom" && "bottom-full left-1/2 -translate-x-1/2 translate-y-1 border-l border-t border-[color:var(--color-border)]")
138
+ }, undefined, false, undefined, this)
139
+ ]
140
+ }, undefined, true, undefined, this), document.body)
141
+ ]
142
+ }, undefined, true, undefined, this);
143
+ }
144
+
145
+ // src/components/ui/dropdown-animation.tsx
146
+ function getDropdownAnimationClass2(animation = "default", isUp = false) {
147
+ if (animation === "none")
148
+ return "";
149
+ if (animation === "fade")
150
+ return "deweb-anim-fade";
151
+ if (animation === "zoom")
152
+ return "deweb-anim-zoom";
153
+ if (animation === "bounce")
154
+ return isUp ? "deweb-anim-bounce-up" : "deweb-anim-bounce-down";
155
+ return isUp ? "deweb-anim-slide-up" : "deweb-anim-slide-down";
156
+ }
157
+ var DROPDOWN_ANIMATION_OPTIONS2 = [
158
+ { value: "default", name: "Slide Down (Standar Halus)", label: "Slide Down (Standar Halus)" },
159
+ { value: "fade", name: "Fade In (Transparansi)", label: "Fade In (Transparansi)" },
160
+ { value: "zoom", name: "Scale / Zoom In (Membesar)", label: "Scale / Zoom In (Membesar)" },
161
+ { value: "bounce", name: "Bounce (Membal)", label: "Bounce (Membal)" },
162
+ { value: "none", name: "Instan (Tanpa Animasi)", label: "Instan (Tanpa Animasi)" }
163
+ ];
164
+
165
+ // src/components/ui/form-advanced.tsx
166
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
167
+ function RadioCard2({
168
+ title,
169
+ price,
170
+ description,
171
+ selected,
172
+ onChange,
173
+ icon,
174
+ disabled,
175
+ name,
176
+ value
177
+ }) {
178
+ return /* @__PURE__ */ jsxDEV2(SelectCard2, {
179
+ selected,
180
+ disabled,
181
+ onClick: onChange,
182
+ className: "group relative flex items-center gap-4 p-4",
183
+ children: [
184
+ name && /* @__PURE__ */ jsxDEV2("input", {
185
+ type: "radio",
186
+ name,
187
+ value,
188
+ checked: selected,
189
+ disabled,
190
+ onChange,
191
+ className: "sr-only"
192
+ }, undefined, false, undefined, this),
193
+ icon && /* @__PURE__ */ jsxDEV2("div", {
194
+ className: "flex-shrink-0 text-[color:var(--color-input-foreground)] opacity-70",
195
+ children: icon
196
+ }, undefined, false, undefined, this),
197
+ /* @__PURE__ */ jsxDEV2("div", {
198
+ className: "flex-1",
199
+ children: [
200
+ /* @__PURE__ */ jsxDEV2("div", {
201
+ className: "mb-1 text-[15px] font-bold leading-tight text-[color:var(--color-input-foreground)]",
202
+ children: title
203
+ }, undefined, false, undefined, this),
204
+ price && /* @__PURE__ */ jsxDEV2("div", {
205
+ className: "mb-2 text-[15px] font-bold leading-tight text-[color:var(--color-input-foreground)]",
206
+ children: price
207
+ }, undefined, false, undefined, this),
208
+ description && /* @__PURE__ */ jsxDEV2("div", {
209
+ className: "text-sm text-[color:var(--color-input-foreground)] opacity-70",
210
+ children: description
211
+ }, undefined, false, undefined, this)
212
+ ]
213
+ }, undefined, true, undefined, this),
214
+ /* @__PURE__ */ jsxDEV2("div", {
215
+ className: "ml-4 flex-shrink-0",
216
+ children: /* @__PURE__ */ jsxDEV2(RadioIndicator2, {
217
+ checked: selected,
218
+ disabled
219
+ }, undefined, false, undefined, this)
220
+ }, undefined, false, undefined, this)
221
+ ]
222
+ }, undefined, true, undefined, this);
223
+ }
224
+ function CheckboxCard2({
225
+ title,
226
+ price,
227
+ description,
228
+ checked,
229
+ onChange,
230
+ icon,
231
+ disabled,
232
+ name,
233
+ value
234
+ }) {
235
+ return /* @__PURE__ */ jsxDEV2(SelectCard2, {
236
+ selected: checked,
237
+ disabled,
238
+ onClick: onChange,
239
+ className: "group relative flex items-center gap-4 p-4",
240
+ children: [
241
+ name && /* @__PURE__ */ jsxDEV2("input", {
242
+ type: "checkbox",
243
+ name,
244
+ value,
245
+ checked,
246
+ disabled,
247
+ onChange,
248
+ className: "sr-only"
249
+ }, undefined, false, undefined, this),
250
+ icon && /* @__PURE__ */ jsxDEV2("div", {
251
+ className: "flex-shrink-0 text-[color:var(--color-input-foreground)] opacity-70",
252
+ children: icon
253
+ }, undefined, false, undefined, this),
254
+ /* @__PURE__ */ jsxDEV2("div", {
255
+ className: "flex-1",
256
+ children: [
257
+ /* @__PURE__ */ jsxDEV2("div", {
258
+ className: "mb-1 text-[15px] font-bold leading-tight text-[color:var(--color-input-foreground)]",
259
+ children: title
260
+ }, undefined, false, undefined, this),
261
+ price && /* @__PURE__ */ jsxDEV2("div", {
262
+ className: "mb-2 text-[15px] font-bold leading-tight text-[color:var(--color-input-foreground)]",
263
+ children: price
264
+ }, undefined, false, undefined, this),
265
+ description && /* @__PURE__ */ jsxDEV2("div", {
266
+ className: "text-sm text-[color:var(--color-input-foreground)] opacity-70",
267
+ children: description
268
+ }, undefined, false, undefined, this)
269
+ ]
270
+ }, undefined, true, undefined, this),
271
+ /* @__PURE__ */ jsxDEV2("div", {
272
+ className: "ml-4 flex-shrink-0",
273
+ children: /* @__PURE__ */ jsxDEV2(CheckboxIndicator2, {
274
+ checked,
275
+ disabled
276
+ }, undefined, false, undefined, this)
277
+ }, undefined, false, undefined, this)
278
+ ]
279
+ }, undefined, true, undefined, this);
280
+ }
281
+ function SelectTrigger({
282
+ displayName,
283
+ selectedOption,
284
+ placeholder,
285
+ isOpen,
286
+ disabled = false,
287
+ invalid = false,
288
+ onClick,
289
+ onKeyDown,
290
+ onClear,
291
+ size = "default",
292
+ radiusClass = "rounded-md"
293
+ }) {
294
+ const showAvatar = Boolean(!selectedOption?.hideAvatar && (selectedOption?.avatarUrl || selectedOption?.icon || selectedOption?.subtitle && !selectedOption?.inlineIcon));
295
+ const sizeClasses = {
296
+ xs: "h-[24px] pl-2 text-[11px]",
297
+ sm: "h-[30px] pl-2.5 text-xs",
298
+ md: "h-[36px] pl-3 text-[13px]",
299
+ default: "h-[36px] pl-3 text-[13px]",
300
+ lg: "h-[42px] pl-4 text-sm"
301
+ }[size || "default"] || "h-[36px] pl-3 text-[13px]";
302
+ const iconPadding = {
303
+ xs: onClear && displayName ? "pr-11" : "pr-5",
304
+ sm: onClear && displayName ? "pr-13" : "pr-7",
305
+ md: onClear && displayName ? "pr-15" : "pr-8",
306
+ default: onClear && displayName ? "pr-15" : "pr-8",
307
+ lg: onClear && displayName ? "pr-16" : "pr-9"
308
+ }[size || "default"] || "pr-8";
309
+ const clearButtonSizes = {
310
+ xs: "!h-[16px] !w-[16px] !p-0 rounded-sm text-[10px]",
311
+ sm: "!h-[20px] !w-[20px] !p-0 rounded-md text-[11px]",
312
+ md: "!h-[22px] !w-[22px] !p-0 rounded-md text-xs",
313
+ default: "!h-[22px] !w-[22px] !p-0 rounded-md text-xs",
314
+ lg: "!h-[26px] !w-[26px] !p-0 rounded-md text-xs"
315
+ }[size || "default"] || "!h-[22px] !w-[22px] !p-0 rounded-md text-xs";
316
+ const clearIconSizes = {
317
+ xs: 10,
318
+ sm: 11,
319
+ md: 12,
320
+ default: 12,
321
+ lg: 13
322
+ }[size || "default"] || 12;
323
+ const clearButtonPositions = {
324
+ xs: "right-5",
325
+ sm: "right-6",
326
+ md: "right-7",
327
+ default: "right-7",
328
+ lg: "right-7.5"
329
+ }[size || "default"] || "right-7";
330
+ return /* @__PURE__ */ jsxDEV2("div", {
331
+ role: "combobox",
332
+ "aria-expanded": isOpen,
333
+ "aria-disabled": disabled,
334
+ tabIndex: disabled ? -1 : 0,
335
+ className: `group relative ${disabled ? "cursor-not-allowed" : "cursor-pointer"}`,
336
+ onClick: () => !disabled && onClick(),
337
+ onKeyDown: (e) => {
338
+ if (disabled)
339
+ return;
340
+ if (e.key === "Enter" || e.key === " ") {
341
+ e.preventDefault();
342
+ onClick();
343
+ }
344
+ onKeyDown?.(e);
345
+ },
346
+ children: [
347
+ /* @__PURE__ */ jsxDEV2("div", {
348
+ className: `flex w-full items-center gap-2 ${radiusClass} [border-width:var(--ui-border-width,1px)] border-solid transition-all duration-200 group-focus:border-[color:var(--color-primary)] group-focus:ring-[length:var(--ui-focus-ring-width,3px)] group-focus:ring-[color:var(--ui-focus-ring-color,var(--color-primary-dimmy))] ${sizeClasses} ${iconPadding} ${disabled ? "border-[color:var(--ui-border-input)] bg-[var(--color-muted)] opacity-70" : invalid ? "border-[color:var(--color-danger)] bg-[var(--color-input)] group-focus:ring-[var(--color-danger)]/20" : isOpen ? "border-[color:var(--color-primary)] ring-[length:var(--ui-focus-ring-width,3px)] ring-[color:var(--ui-focus-ring-color,var(--color-primary-dimmy))] bg-[var(--color-input)]" : "border-[color:var(--ui-border-input)] group-hover:border-[color:var(--color-border-hover)] bg-[var(--color-input)]"}`,
349
+ children: [
350
+ showAvatar && selectedOption && /* @__PURE__ */ jsxDEV2(SelectOptionAvatar, {
351
+ option: selectedOption,
352
+ size: 20
353
+ }, undefined, false, undefined, this),
354
+ selectedOption?.inlineIcon && selectedOption.inlineIcon,
355
+ /* @__PURE__ */ jsxDEV2("span", {
356
+ className: `flex-1 min-w-0 truncate text-left ${disabled ? "text-[color:var(--color-text-color)]" : "text-[color:var(--color-input-foreground)]"} ${!displayName ? "opacity-70" : ""}`,
357
+ children: displayName || placeholder
358
+ }, undefined, false, undefined, this)
359
+ ]
360
+ }, undefined, true, undefined, this),
361
+ onClear && displayName && !disabled && /* @__PURE__ */ jsxDEV2("div", {
362
+ className: `absolute ${clearButtonPositions} top-1/2 -translate-y-1/2 z-10 flex items-center`,
363
+ children: /* @__PURE__ */ jsxDEV2(Button2, {
364
+ type: "button",
365
+ variant: "soft",
366
+ color: "default",
367
+ size: "icon-xs",
368
+ onClick: (e) => {
369
+ e.stopPropagation();
370
+ onClear();
371
+ },
372
+ title: "Kosongkan pilihan",
373
+ className: `${clearButtonSizes} flex items-center justify-center text-[color:var(--color-muted-foreground)] hover:text-[color:var(--color-foreground)] transition-colors`,
374
+ children: /* @__PURE__ */ jsxDEV2(X, {
375
+ size: clearIconSizes
376
+ }, undefined, false, undefined, this)
377
+ }, undefined, false, undefined, this)
378
+ }, undefined, false, undefined, this),
379
+ /* @__PURE__ */ jsxDEV2("div", {
380
+ className: `pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 ${disabled ? "text-[color:var(--color-text-color)]" : "text-[color:var(--color-input-foreground)]"} opacity-70 transition-transform duration-200 ${isOpen ? "rotate-180" : ""}`,
381
+ children: /* @__PURE__ */ jsxDEV2(ChevronDown, {
382
+ size: 15
383
+ }, undefined, false, undefined, this)
384
+ }, undefined, false, undefined, this)
385
+ ]
386
+ }, undefined, true, undefined, this);
387
+ }
388
+ function getSelectOptionLabel2(option) {
389
+ if (!option)
390
+ return "";
391
+ return option.name || option.label || (option.value !== undefined && option.value !== null ? String(option.value) : "");
392
+ }
393
+ function SelectOptionAvatar({ option, size = 40, isSelected = false }) {
394
+ const optName = getSelectOptionLabel2(option);
395
+ if (option.avatarUrl) {
396
+ return /* @__PURE__ */ jsxDEV2("img", {
397
+ src: option.avatarUrl,
398
+ alt: optName,
399
+ className: "flex-shrink-0 rounded-full border border-[color:var(--color-border)] object-cover",
400
+ style: { width: size, height: size }
401
+ }, undefined, false, undefined, this);
402
+ }
403
+ if (option.icon) {
404
+ return /* @__PURE__ */ jsxDEV2("div", {
405
+ className: `flex flex-shrink-0 items-center justify-center rounded-full ${isSelected ? "bg-white/20 text-[color:var(--color-primary-foreground)]" : "bg-[var(--color-secondary)] text-[color:var(--color-secondary-foreground)] opacity-70"}`,
406
+ style: { width: size, height: size },
407
+ children: option.icon
408
+ }, undefined, false, undefined, this);
409
+ }
410
+ return /* @__PURE__ */ jsxDEV2("div", {
411
+ className: `flex flex-shrink-0 items-center justify-center rounded-full font-bold ${isSelected ? "bg-white/20 text-[color:var(--color-primary-foreground)]" : "bg-[var(--color-secondary)] text-[color:var(--color-secondary-foreground)] opacity-70"}`,
412
+ style: { width: size, height: size, fontSize: size * 0.4 },
413
+ children: (optName.charAt(0) || "?").toUpperCase()
414
+ }, undefined, false, undefined, this);
415
+ }
416
+ function SelectOptionRow2({
417
+ option,
418
+ isSelected,
419
+ isActive = false,
420
+ size = "default",
421
+ onClick
422
+ }) {
423
+ const showAvatar = Boolean(!option.hideAvatar && (option.avatarUrl || option.icon || option.subtitle && !option.inlineIcon));
424
+ const sizeClasses = {
425
+ xs: "gap-1.5 px-2 py-1 text-[11px]",
426
+ sm: "gap-2 px-2.5 py-1.5 text-xs",
427
+ md: "gap-2.5 px-2.5 py-1.5 text-[13px]",
428
+ normal: "gap-2.5 px-2.5 py-1.5 text-[13px]",
429
+ default: "gap-2.5 px-2.5 py-1.5 text-[13px]",
430
+ lg: "gap-3 px-3 py-2 text-sm"
431
+ }[size || "default"] || "gap-2.5 px-2.5 py-1.5 text-[13px]";
432
+ const displaySubtitle = option.subtitle || null;
433
+ if (option.disabled && (String(option.value).startsWith("__section_") || String(option.value).startsWith("__header_"))) {
434
+ return /* @__PURE__ */ jsxDEV2("div", {
435
+ className: "px-2.5 pt-3 pb-1 text-[11px] font-bold tracking-wider text-[color:var(--color-muted-foreground)] uppercase select-none border-b border-[color:var(--color-border)]/40 first:pt-1",
436
+ children: getSelectOptionLabel2(option)
437
+ }, undefined, false, undefined, this);
438
+ }
439
+ const renderInlineIcon = () => {
440
+ if (!option.inlineIcon)
441
+ return null;
442
+ if (isSelected && React2.isValidElement(option.inlineIcon)) {
443
+ const el = option.inlineIcon;
444
+ const originalClass = el.props?.className || "";
445
+ const sanitizedClass = originalClass.replace(/\btext-primary\b/g, "").replace(/\btext-[a-z0-9-]+(?:\/[0-9]+)?\b/g, "").trim();
446
+ return /* @__PURE__ */ jsxDEV2("span", {
447
+ className: "inline-flex shrink-0 items-center justify-center text-[color:var(--color-primary-foreground)]",
448
+ style: { color: "var(--color-primary-foreground)" },
449
+ children: React2.cloneElement(el, {
450
+ className: `${sanitizedClass} text-[color:var(--color-primary-foreground)] stroke-current`,
451
+ style: { ...el.props?.style, color: "var(--color-primary-foreground)", stroke: "currentColor" }
452
+ })
453
+ }, undefined, false, undefined, this);
454
+ }
455
+ return /* @__PURE__ */ jsxDEV2("span", {
456
+ className: "inline-flex shrink-0 items-center justify-center",
457
+ children: option.inlineIcon
458
+ }, undefined, false, undefined, this);
459
+ };
460
+ return /* @__PURE__ */ jsxDEV2("div", {
461
+ onClick: () => !option.disabled && onClick(),
462
+ className: `flex items-center rounded-md transition-colors ${sizeClasses} ${option.disabled ? "cursor-not-allowed bg-[var(--color-muted)] text-[color:var(--color-muted-foreground)] opacity-60" : `cursor-pointer ${isSelected ? "bg-[var(--color-primary)] text-[color:var(--color-primary-foreground)]" : isActive ? "bg-hover text-[color:var(--color-foreground)]" : "text-[color:var(--color-foreground)] hover:bg-hover hover:text-[color:var(--color-foreground)]"}`}`,
463
+ children: [
464
+ showAvatar && /* @__PURE__ */ jsxDEV2(SelectOptionAvatar, {
465
+ option,
466
+ size: size === "lg" ? 36 : 30,
467
+ isSelected
468
+ }, undefined, false, undefined, this),
469
+ renderInlineIcon(),
470
+ /* @__PURE__ */ jsxDEV2("div", {
471
+ className: "min-w-0 flex-1",
472
+ children: [
473
+ /* @__PURE__ */ jsxDEV2("div", {
474
+ className: `truncate ${isSelected ? "font-semibold" : "font-medium"}`,
475
+ children: getSelectOptionLabel2(option)
476
+ }, undefined, false, undefined, this),
477
+ displaySubtitle && /* @__PURE__ */ jsxDEV2("div", {
478
+ className: `truncate text-xs ${isSelected ? "text-[color:var(--color-primary-foreground)] opacity-80" : option.disabled ? "text-[color:var(--color-muted-foreground)] opacity-70" : "text-[color:var(--color-input-foreground)] opacity-70"}`,
479
+ children: displaySubtitle
480
+ }, undefined, false, undefined, this)
481
+ ]
482
+ }, undefined, true, undefined, this),
483
+ isSelected && /* @__PURE__ */ jsxDEV2(Check, {
484
+ size: 16,
485
+ className: "ml-2 flex-shrink-0"
486
+ }, undefined, false, undefined, this)
487
+ ]
488
+ }, undefined, true, undefined, this);
489
+ }
490
+ function Select2({
491
+ options = [],
492
+ value,
493
+ onChange,
494
+ placeholder = "Pilih...",
495
+ searchPlaceholder = "Cari...",
496
+ className = "",
497
+ openMode = "dropdown",
498
+ searchable = false,
499
+ multiple = false,
500
+ disabled = false,
501
+ invalid = false,
502
+ clearable = false,
503
+ loading = false,
504
+ size = "default",
505
+ radius = "md",
506
+ animation = "default",
507
+ menuMaxHeight = "max-h-60",
508
+ name,
509
+ label,
510
+ theme = "auto",
511
+ align = "auto"
512
+ }) {
513
+ const { labelPosition, labelWidth } = useFormContext2();
514
+ const [isOpen, setIsOpen] = React2.useState(false);
515
+ const [query, setQuery] = React2.useState("");
516
+ const [activeIndex, setActiveIndex] = React2.useState(0);
517
+ const containerRef = React2.useRef(null);
518
+ const isDisabled = disabled || loading;
519
+ const radiusMap = {
520
+ none: "rounded-none",
521
+ sm: "rounded-sm",
522
+ md: "rounded-[var(--ui-input-radius,var(--ui-radius-md,8px))]",
523
+ lg: "rounded-lg",
524
+ full: "rounded-full"
525
+ };
526
+ const radiusClass = radius ? radiusMap[radius] || radiusMap.md : radiusMap.md;
527
+ const [isDarkScope, setIsDarkScope] = React2.useState(false);
528
+ React2.useLayoutEffect(() => {
529
+ if (theme === "dark") {
530
+ setIsDarkScope(true);
531
+ return;
532
+ }
533
+ if (theme === "light") {
534
+ setIsDarkScope(false);
535
+ return;
536
+ }
537
+ if (containerRef.current) {
538
+ const isDark = containerRef.current.closest(".deweb-dark-scope") !== null || containerRef.current.closest(".dark") !== null || typeof document !== "undefined" && (document.documentElement.classList.contains("deweb-dark-scope") || document.documentElement.classList.contains("dark"));
539
+ setIsDarkScope(Boolean(isDark));
540
+ }
541
+ }, [isOpen, theme]);
542
+ const selectedValues = multiple ? Array.isArray(value) ? value : [] : value !== undefined && value !== null ? [value] : [];
543
+ const selectedOptions = options.filter((o) => selectedValues.includes(o.value));
544
+ const displayName = multiple ? selectedOptions.length > 0 ? `${selectedOptions.length} dipilih` : "" : getSelectOptionLabel2(selectedOptions[0]);
545
+ const filteredOptions = query === "" ? options : options.filter((o) => getSelectOptionLabel2(o).toLowerCase().includes(query.toLowerCase()) || o.subtitle?.toLowerCase().includes(query.toLowerCase()));
546
+ const selectableIndexes = filteredOptions.reduce((acc, o, idx) => o.disabled ? acc : [...acc, idx], []);
547
+ const menuRef = React2.useRef(null);
548
+ const [isUp, setIsUp] = React2.useState(false);
549
+ const [menuPos, setMenuPos] = React2.useState(null);
550
+ React2.useEffect(() => {
551
+ if (isOpen) {
552
+ if (selectedValues.length > 0) {
553
+ const firstSelectedVal = selectedValues[0];
554
+ const idx = filteredOptions.findIndex((o) => o.value === firstSelectedVal);
555
+ if (idx !== -1) {
556
+ setActiveIndex(idx);
557
+ setTimeout(() => {
558
+ document.getElementById(`deweb-select-opt-${firstSelectedVal}`)?.scrollIntoView({ block: "nearest" });
559
+ }, 10);
560
+ return;
561
+ }
562
+ }
563
+ setActiveIndex(selectableIndexes[0] ?? 0);
564
+ }
565
+ }, [isOpen]);
566
+ React2.useLayoutEffect(() => {
567
+ if (!isOpen || !containerRef.current) {
568
+ if (!isOpen)
569
+ setIsUp(false);
570
+ return;
571
+ }
572
+ function reposition() {
573
+ if (!containerRef.current)
574
+ return;
575
+ const rect = containerRef.current.getBoundingClientRect();
576
+ const estimatedHeight = Math.min((filteredOptions.length || 1) * 36 + (searchable ? 48 : 16), 260);
577
+ const menuHeight = menuRef.current?.offsetHeight || estimatedHeight;
578
+ const spaceBelow = window.innerHeight - rect.bottom;
579
+ const spaceAbove = rect.top;
580
+ const flipUp = spaceBelow < menuHeight + 12 && spaceAbove > spaceBelow;
581
+ setIsUp(flipUp);
582
+ setMenuPos({
583
+ left: rect.left,
584
+ width: rect.width,
585
+ top: rect.bottom,
586
+ bottomOffset: window.innerHeight - rect.top,
587
+ spaceAbove,
588
+ spaceBelow
589
+ });
590
+ }
591
+ reposition();
592
+ window.addEventListener("scroll", reposition, true);
593
+ window.addEventListener("resize", reposition);
594
+ return () => {
595
+ window.removeEventListener("scroll", reposition, true);
596
+ window.removeEventListener("resize", reposition);
597
+ };
598
+ }, [isOpen, filteredOptions.length, searchable]);
599
+ React2.useLayoutEffect(() => {
600
+ if (!isOpen || !containerRef.current || !menuRef.current)
601
+ return;
602
+ const rect = containerRef.current.getBoundingClientRect();
603
+ const actualHeight = menuRef.current.offsetHeight;
604
+ const actualWidth = menuRef.current.offsetWidth;
605
+ const spaceBelow = window.innerHeight - rect.bottom;
606
+ const spaceAbove = rect.top;
607
+ const shouldFlipUp = spaceBelow < actualHeight + 12 && spaceAbove > spaceBelow;
608
+ if (shouldFlipUp !== isUp) {
609
+ setIsUp(shouldFlipUp);
610
+ }
611
+ if (align === "right") {
612
+ const targetLeft = Math.max(12, rect.right - actualWidth);
613
+ menuRef.current.style.left = `${targetLeft}px`;
614
+ } else if (align === "left") {
615
+ menuRef.current.style.left = `${Math.max(12, rect.left)}px`;
616
+ } else {
617
+ const fitsOnRight = rect.left + actualWidth <= window.innerWidth - 12;
618
+ if (fitsOnRight) {
619
+ menuRef.current.style.left = `${rect.left}px`;
620
+ } else {
621
+ const targetLeft = Math.max(12, rect.right - actualWidth);
622
+ menuRef.current.style.left = `${targetLeft}px`;
623
+ }
624
+ }
625
+ }, [isOpen, menuPos, isUp, align]);
626
+ React2.useEffect(() => {
627
+ if (openMode !== "dropdown" || !isOpen)
628
+ return;
629
+ function handleClick(e) {
630
+ const target = e.target;
631
+ if (containerRef.current?.contains(target))
632
+ return;
633
+ if (menuRef.current?.contains(target))
634
+ return;
635
+ setIsOpen(false);
636
+ setQuery("");
637
+ }
638
+ document.addEventListener("mousedown", handleClick);
639
+ return () => document.removeEventListener("mousedown", handleClick);
640
+ }, [isOpen, openMode]);
641
+ function openPanel() {
642
+ if (isDisabled)
643
+ return;
644
+ setActiveIndex(0);
645
+ setIsOpen(true);
646
+ }
647
+ function handleSelect(option) {
648
+ if (option.disabled)
649
+ return;
650
+ if (multiple) {
651
+ const next = selectedValues.includes(option.value) ? selectedValues.filter((v) => v !== option.value) : [...selectedValues, option.value];
652
+ onChange(next);
653
+ return;
654
+ }
655
+ onChange(option.value);
656
+ setIsOpen(false);
657
+ setQuery("");
658
+ }
659
+ function isSelected(option) {
660
+ return selectedValues.includes(option.value);
661
+ }
662
+ function handleTriggerKeyDown(e) {
663
+ if (searchable)
664
+ return;
665
+ if (e.key === "ArrowDown") {
666
+ e.preventDefault();
667
+ if (!isOpen)
668
+ return openPanel();
669
+ const next = selectableIndexes.find((i) => i > activeIndex) ?? selectableIndexes[0];
670
+ if (next !== undefined)
671
+ setActiveIndex(next);
672
+ } else if (e.key === "ArrowUp") {
673
+ e.preventDefault();
674
+ const prev = [...selectableIndexes].reverse().find((i) => i < activeIndex) ?? selectableIndexes[selectableIndexes.length - 1];
675
+ if (prev !== undefined)
676
+ setActiveIndex(prev);
677
+ } else if (e.key === "Enter") {
678
+ e.preventDefault();
679
+ if (isOpen && filteredOptions[activeIndex])
680
+ handleSelect(filteredOptions[activeIndex]);
681
+ } else if (e.key === "Escape") {
682
+ setIsOpen(false);
683
+ }
684
+ }
685
+ function handleSearchKeyDown(e) {
686
+ if (e.key === "ArrowDown") {
687
+ e.preventDefault();
688
+ const next = selectableIndexes.find((i) => i > activeIndex) ?? selectableIndexes[0];
689
+ if (next !== undefined) {
690
+ setActiveIndex(next);
691
+ document.getElementById(`deweb-select-opt-${filteredOptions[next]?.value}`)?.scrollIntoView({ block: "nearest" });
692
+ }
693
+ } else if (e.key === "ArrowUp") {
694
+ e.preventDefault();
695
+ const prev = [...selectableIndexes].reverse().find((i) => i < activeIndex) ?? selectableIndexes[selectableIndexes.length - 1];
696
+ if (prev !== undefined) {
697
+ setActiveIndex(prev);
698
+ document.getElementById(`deweb-select-opt-${filteredOptions[prev]?.value}`)?.scrollIntoView({ block: "nearest" });
699
+ }
700
+ } else if (e.key === "Enter") {
701
+ e.preventDefault();
702
+ if (isOpen && filteredOptions[activeIndex])
703
+ handleSelect(filteredOptions[activeIndex]);
704
+ } else if (e.key === "Escape") {
705
+ setIsOpen(false);
706
+ }
707
+ }
708
+ const triggerContent = multiple ? /* @__PURE__ */ jsxDEV2("div", {
709
+ role: "button",
710
+ tabIndex: isDisabled ? -1 : 0,
711
+ onClick: openPanel,
712
+ onKeyDown: (e) => {
713
+ if (e.key === "Enter" || e.key === " ") {
714
+ e.preventDefault();
715
+ openPanel();
716
+ }
717
+ },
718
+ className: `flex min-h-[36px] w-full flex-wrap items-center gap-1.5 ${radiusClass} [border-width:var(--ui-border-width,1px)] border-solid px-2 py-1.5 pr-8 text-[13px] transition-all duration-200 focus:border-[color:var(--color-primary)] focus:ring-[length:var(--ui-focus-ring-width,3px)] focus:ring-[color:var(--ui-focus-ring-color,var(--color-primary-dimmy))] ${isDisabled ? "cursor-not-allowed [border-color:var(--ui-border-input,color-mix(in_srgb,var(--color-foreground)_20%,transparent))] bg-[var(--color-secondary)] opacity-50" : invalid ? "cursor-pointer border-[color:var(--color-danger)] bg-[var(--color-input)]" : isOpen ? "cursor-pointer border-[color:var(--color-primary)] ring-[length:var(--ui-focus-ring-width,3px)] ring-[color:var(--ui-focus-ring-color,var(--color-primary-dimmy))] bg-[var(--color-input)]" : "cursor-pointer [border-color:var(--ui-border-input,color-mix(in_srgb,var(--color-foreground)_20%,transparent))] bg-[var(--color-input)] focus-within:border-[color:var(--color-primary)] focus-within:ring-[length:var(--ui-focus-ring-width,3px)] focus-within:ring-[color:var(--ui-focus-ring-color,var(--color-primary-dimmy))]"}`,
719
+ children: [
720
+ selectedOptions.length === 0 && /* @__PURE__ */ jsxDEV2("span", {
721
+ className: "px-1 text-[color:var(--color-input-foreground)] opacity-70",
722
+ children: placeholder
723
+ }, undefined, false, undefined, this),
724
+ selectedOptions.map((opt) => /* @__PURE__ */ jsxDEV2("span", {
725
+ className: "flex items-center gap-1 rounded-md bg-[var(--color-secondary)] py-0.5 pl-2 pr-1 text-[13px] text-[color:var(--color-secondary-foreground)]",
726
+ children: [
727
+ opt.name,
728
+ /* @__PURE__ */ jsxDEV2("button", {
729
+ type: "button",
730
+ disabled: isDisabled,
731
+ onClick: (e) => {
732
+ e.stopPropagation();
733
+ handleSelect(opt);
734
+ },
735
+ className: "flex h-[18px] w-[18px] flex-none items-center justify-center rounded text-[color:var(--color-input-foreground)] opacity-70 hover:bg-[var(--color-input)] hover:text-[color:var(--color-input-foreground)] focus:outline-none disabled:cursor-not-allowed",
736
+ children: [
737
+ /* @__PURE__ */ jsxDEV2("span", {
738
+ className: "sr-only",
739
+ children: [
740
+ "Hapus ",
741
+ opt.name
742
+ ]
743
+ }, undefined, true, undefined, this),
744
+ /* @__PURE__ */ jsxDEV2(X, {
745
+ size: 11
746
+ }, undefined, false, undefined, this)
747
+ ]
748
+ }, undefined, true, undefined, this)
749
+ ]
750
+ }, opt.value, true, undefined, this)),
751
+ /* @__PURE__ */ jsxDEV2("div", {
752
+ className: "pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-[color:var(--color-input-foreground)] opacity-70",
753
+ children: loading ? /* @__PURE__ */ jsxDEV2(Loader2, {
754
+ size: 16,
755
+ className: "animate-spin"
756
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2(ChevronDown, {
757
+ size: 18
758
+ }, undefined, false, undefined, this)
759
+ }, undefined, false, undefined, this)
760
+ ]
761
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV2(SelectTrigger, {
762
+ displayName,
763
+ selectedOption: selectedOptions[0],
764
+ placeholder,
765
+ isOpen,
766
+ disabled: isDisabled,
767
+ invalid,
768
+ size,
769
+ radiusClass,
770
+ onClick: () => isOpen ? setIsOpen(false) : openPanel(),
771
+ onKeyDown: handleTriggerKeyDown,
772
+ onClear: clearable ? () => onChange(undefined) : undefined
773
+ }, undefined, false, undefined, this);
774
+ const optionsList = loading ? /* @__PURE__ */ jsxDEV2("div", {
775
+ className: "flex items-center justify-center gap-2 px-3 py-8 text-sm text-[color:var(--color-input-foreground)] opacity-70",
776
+ children: [
777
+ /* @__PURE__ */ jsxDEV2(Loader2, {
778
+ size: 16,
779
+ className: "animate-spin"
780
+ }, undefined, false, undefined, this),
781
+ "Memuat opsi..."
782
+ ]
783
+ }, undefined, true, undefined, this) : options.length === 0 ? /* @__PURE__ */ jsxDEV2("div", {
784
+ className: "px-3 py-8 text-center text-sm text-[color:var(--color-input-foreground)] opacity-70",
785
+ children: "Belum ada opsi."
786
+ }, undefined, false, undefined, this) : filteredOptions.length > 0 ? filteredOptions.map((opt, idx) => /* @__PURE__ */ jsxDEV2("div", {
787
+ id: `deweb-select-opt-${opt.value}`,
788
+ children: /* @__PURE__ */ jsxDEV2(SelectOptionRow2, {
789
+ option: opt,
790
+ isSelected: isSelected(opt),
791
+ isActive: idx === activeIndex,
792
+ size,
793
+ onClick: () => handleSelect(opt)
794
+ }, undefined, false, undefined, this)
795
+ }, opt.value, false, undefined, this)) : /* @__PURE__ */ jsxDEV2("div", {
796
+ className: "px-3 py-8 text-center text-sm text-[color:var(--color-input-foreground)] opacity-70",
797
+ children: "Tidak ditemukan."
798
+ }, undefined, false, undefined, this);
799
+ const searchBox = searchable && /* @__PURE__ */ jsxDEV2("div", {
800
+ className: "mb-1.5 px-1 pt-1",
801
+ children: /* @__PURE__ */ jsxDEV2(Input2, {
802
+ autoFocus: true,
803
+ icon: "search",
804
+ type: "text",
805
+ placeholder: searchPlaceholder,
806
+ value: query,
807
+ onChange: (e) => setQuery(e.target.value),
808
+ onKeyDown: handleSearchKeyDown,
809
+ className: "w-full"
810
+ }, undefined, false, undefined, this)
811
+ }, undefined, false, undefined, this);
812
+ const hiddenInput = name && /* @__PURE__ */ jsxDEV2("input", {
813
+ type: "hidden",
814
+ name,
815
+ value: multiple ? selectedValues.join(",") : value !== undefined && value !== null ? String(value) : ""
816
+ }, undefined, false, undefined, this);
817
+ if (openMode === "modal") {
818
+ return /* @__PURE__ */ jsxDEV2("div", {
819
+ className: `relative ${multiple ? "" : className}`,
820
+ children: [
821
+ hiddenInput,
822
+ multiple ? /* @__PURE__ */ jsxDEV2("div", {
823
+ className,
824
+ children: triggerContent
825
+ }, undefined, false, undefined, this) : triggerContent,
826
+ /* @__PURE__ */ jsxDEV2(Modal2, {
827
+ isOpen: isOpen && !isDisabled,
828
+ onClose: () => setIsOpen(false),
829
+ maxWidth: "sm",
830
+ title: placeholder,
831
+ children: /* @__PURE__ */ jsxDEV2("div", {
832
+ className: "flex flex-col gap-1",
833
+ children: [
834
+ searchBox,
835
+ /* @__PURE__ */ jsxDEV2("div", {
836
+ className: `hide-scrollbar flex ${menuMaxHeight} flex-col gap-0.5 overflow-y-auto px-1 pb-1`,
837
+ children: optionsList
838
+ }, undefined, false, undefined, this)
839
+ ]
840
+ }, undefined, true, undefined, this)
841
+ }, undefined, false, undefined, this)
842
+ ]
843
+ }, undefined, true, undefined, this);
844
+ }
845
+ const maxAvailableHeight = menuPos ? isUp ? Math.min(280, Math.max(menuPos.spaceAbove - 16, 80)) : Math.min(280, Math.max(menuPos.spaceBelow - 16, 80)) : 260;
846
+ const menu = isOpen && !isDisabled && menuPos && /* @__PURE__ */ jsxDEV2("div", {
847
+ ref: menuRef,
848
+ style: {
849
+ position: "fixed",
850
+ left: menuPos.left,
851
+ minWidth: menuPos.width,
852
+ width: "max-content",
853
+ maxWidth: `min(90vw, max(${menuPos.width}px, 480px))`,
854
+ maxHeight: maxAvailableHeight,
855
+ boxShadow: isUp ? "var(--ui-shadow-up-lg, 0 -10px 15px -3px rgba(0, 0, 0, 0.1), 0 -4px 6px -4px rgba(0, 0, 0, 0.05))" : "var(--ui-shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05))",
856
+ ...isUp ? { bottom: menuPos.bottomOffset, marginBottom: "var(--ui-dropdown-offset, 6px)" } : { top: menuPos.top, marginTop: "var(--ui-dropdown-offset, 6px)" }
857
+ },
858
+ className: cn2(`z-[120] flex flex-col overflow-hidden ${radiusClass} border border-[color:var(--color-border-field-normal)] bg-[var(--color-card)] text-[color:var(--color-foreground)]`, isDarkScope ? "deweb-dark-scope-portal" : "", getDropdownAnimationClass2(animation, isUp)),
859
+ children: [
860
+ searchBox,
861
+ /* @__PURE__ */ jsxDEV2("div", {
862
+ className: "flex flex-1 min-h-0 flex-col gap-1 overflow-y-auto p-1",
863
+ children: optionsList
864
+ }, undefined, false, undefined, this)
865
+ ]
866
+ }, undefined, true, undefined, this);
867
+ const selectContent = /* @__PURE__ */ jsxDEV2("div", {
868
+ ref: containerRef,
869
+ className: cn2("relative", isDarkScope ? "deweb-dark-scope" : "", className),
870
+ children: [
871
+ hiddenInput,
872
+ triggerContent,
873
+ menu && createPortal2(menu, document.body)
874
+ ]
875
+ }, undefined, true, undefined, this);
876
+ if (label) {
877
+ if (labelPosition === "left") {
878
+ return /* @__PURE__ */ jsxDEV2("div", {
879
+ className: "flex items-start gap-4",
880
+ children: [
881
+ /* @__PURE__ */ jsxDEV2("div", {
882
+ style: { width: labelWidth },
883
+ className: "shrink-0 mt-2",
884
+ children: /* @__PURE__ */ jsxDEV2(Label2, {
885
+ className: "text-[13px] font-medium text-[color:var(--color-foreground)]",
886
+ children: label
887
+ }, undefined, false, undefined, this)
888
+ }, undefined, false, undefined, this),
889
+ /* @__PURE__ */ jsxDEV2("div", {
890
+ className: "flex-1 min-w-0",
891
+ children: selectContent
892
+ }, undefined, false, undefined, this)
893
+ ]
894
+ }, undefined, true, undefined, this);
895
+ } else {
896
+ return /* @__PURE__ */ jsxDEV2("div", {
897
+ className: "flex flex-col gap-1.5",
898
+ children: [
899
+ /* @__PURE__ */ jsxDEV2(Label2, {
900
+ className: "text-[13px] font-medium text-[color:var(--color-foreground)]",
901
+ children: label
902
+ }, undefined, false, undefined, this),
903
+ selectContent
904
+ ]
905
+ }, undefined, true, undefined, this);
906
+ }
907
+ }
908
+ return selectContent;
909
+ }
910
+ var SelectInput2 = Select2;
911
+ var SelectPill2 = React2.forwardRef(({ children, selected = false, disabled = false, className = "", size = "md", radius = "full", variant = "soft", borderless = false, count, icon, onClick, ...props }, ref) => {
912
+ const { ripples, onRippleClick } = useRipple2();
913
+ const sizeClasses = {
914
+ xs: "h-[24px] px-2.5 text-[11.5px]",
915
+ sm: "h-[30px] px-3 text-[12px]",
916
+ md: "h-[36px] px-3.5 text-[13px]",
917
+ lg: "h-[42px] px-4 text-[14px]"
918
+ };
919
+ const radiusMap = {
920
+ none: "rounded-none",
921
+ sm: "rounded-sm",
922
+ md: "rounded-md",
923
+ lg: "rounded-lg",
924
+ full: "rounded-full"
925
+ };
926
+ const radiusClass = radius ? radiusMap[radius] || "rounded-full" : "rounded-full";
927
+ const isGhost = variant === "ghost" || borderless;
928
+ let selectedClass = "";
929
+ if (variant === "soft") {
930
+ selectedClass = isGhost ? "bg-[var(--color-primary-dimmy)] text-[color:var(--color-primary-text)] hover:opacity-90" : "border-[color:var(--color-primary)] bg-[var(--color-primary-dimmy)] text-[color:var(--color-primary-text)] hover:opacity-90";
931
+ } else {
932
+ selectedClass = isGhost ? "bg-[var(--color-primary)] text-[color:var(--color-primary-foreground)] shadow-2xs hover:opacity-90" : "border-[color:var(--color-primary)] bg-[var(--color-primary)] text-[color:var(--color-primary-foreground)] shadow-2xs hover:opacity-90";
933
+ }
934
+ const unselectedClass = isGhost ? "bg-transparent hover:bg-hover text-[color:var(--color-muted-foreground)] hover:text-[color:var(--color-foreground)]" : "border-[color:var(--color-border)] bg-[var(--color-background)] hover:border-[color:var(--color-border-hover)] hover:bg-hover text-[color:var(--color-foreground)]";
935
+ const handleClick = (e) => {
936
+ onRippleClick(e);
937
+ if (onClick) {
938
+ onClick(e);
939
+ }
940
+ };
941
+ return /* @__PURE__ */ jsxDEV2("button", {
942
+ ref,
943
+ type: "button",
944
+ disabled,
945
+ onClick: handleClick,
946
+ className: cn2("relative overflow-hidden inline-flex items-center justify-center font-medium transition-all duration-200 select-none whitespace-nowrap shrink-0", !isGhost && "border", radiusClass, "focus:outline-none focus:border-[color:var(--color-primary)] focus:ring-[length:var(--ui-focus-ring-width,3px)] focus:ring-[color:var(--ui-focus-ring-color,var(--color-primary-dimmy))]", sizeClasses[size], disabled ? "cursor-not-allowed border-[color:var(--color-border)] bg-[var(--color-secondary)] text-[color:var(--color-secondary-foreground)] opacity-50 relative overflow-hidden" : selected ? selectedClass : unselectedClass, className),
947
+ ...props,
948
+ children: [
949
+ /* @__PURE__ */ jsxDEV2(RippleEffect2, {
950
+ ripples
951
+ }, undefined, false, undefined, this),
952
+ /* @__PURE__ */ jsxDEV2("span", {
953
+ className: "relative z-10 inline-flex items-center justify-center gap-1.5 whitespace-nowrap",
954
+ children: [
955
+ icon && /* @__PURE__ */ jsxDEV2("span", {
956
+ className: "inline-flex shrink-0 items-center",
957
+ children: icon
958
+ }, undefined, false, undefined, this),
959
+ children,
960
+ count !== undefined && /* @__PURE__ */ jsxDEV2("span", {
961
+ className: cn2("ml-0.5 px-1.5 py-0.5 rounded-full text-[10px] font-bold leading-none tracking-tight", selected ? variant === "soft" ? "bg-primary/15 text-primary" : "bg-primary-foreground/20 text-primary-foreground" : "bg-muted text-muted-foreground"),
962
+ children: count
963
+ }, undefined, false, undefined, this)
964
+ ]
965
+ }, undefined, true, undefined, this),
966
+ disabled && /* @__PURE__ */ jsxDEV2("svg", {
967
+ className: "absolute inset-0 h-full w-full opacity-60 text-current",
968
+ preserveAspectRatio: "none",
969
+ viewBox: "0 0 100 100",
970
+ children: /* @__PURE__ */ jsxDEV2("line", {
971
+ x1: "0",
972
+ y1: "100",
973
+ x2: "100",
974
+ y2: "0",
975
+ stroke: "currentColor",
976
+ strokeWidth: "1.5"
977
+ }, undefined, false, undefined, this)
978
+ }, undefined, false, undefined, this)
979
+ ]
980
+ }, undefined, true, undefined, this);
981
+ });
982
+ SelectPill2.displayName = "SelectPill";
983
+ var PillList2 = React2.forwardRef(({ children, scrollable = true, arrows = true, className = "", listClassName = "", ...props }, ref) => {
984
+ const internalRef = React2.useRef(null);
985
+ const listRef = ref || internalRef;
986
+ const [overflowState, setOverflowState] = React2.useState({ showLeft: false, showRight: false });
987
+ const [isDragging, setIsDragging] = React2.useState(false);
988
+ const dragState = React2.useRef({ startX: 0, scrollLeft: 0, isDown: false, hasMoved: false });
989
+ const checkOverflow = React2.useCallback(() => {
990
+ const el = listRef.current;
991
+ if (!el || !scrollable)
992
+ return;
993
+ const hasOverflow = el.scrollWidth > el.clientWidth + 1;
994
+ if (!hasOverflow) {
995
+ setOverflowState({ showLeft: false, showRight: false });
996
+ return;
997
+ }
998
+ const atStart = el.scrollLeft <= 1;
999
+ const atEnd = el.scrollLeft + el.clientWidth >= el.scrollWidth - 1;
1000
+ setOverflowState({ showLeft: !atStart, showRight: !atEnd });
1001
+ }, [listRef, scrollable]);
1002
+ React2.useEffect(() => {
1003
+ if (!scrollable)
1004
+ return;
1005
+ const el = listRef.current;
1006
+ if (!el)
1007
+ return;
1008
+ checkOverflow();
1009
+ el.addEventListener("scroll", checkOverflow, { passive: true });
1010
+ const ro = new ResizeObserver(checkOverflow);
1011
+ ro.observe(el);
1012
+ return () => {
1013
+ el.removeEventListener("scroll", checkOverflow);
1014
+ ro.disconnect();
1015
+ };
1016
+ }, [listRef, scrollable, checkOverflow, children]);
1017
+ const scroll = (direction) => {
1018
+ const el = listRef.current;
1019
+ if (!el)
1020
+ return;
1021
+ const distance = el.clientWidth * 0.75;
1022
+ el.scrollBy({ left: direction === "left" ? -distance : distance, behavior: "smooth" });
1023
+ };
1024
+ const onMouseDown = (e) => {
1025
+ if (!scrollable)
1026
+ return;
1027
+ const el = listRef.current;
1028
+ if (!el)
1029
+ return;
1030
+ dragState.current = {
1031
+ startX: e.pageX,
1032
+ scrollLeft: el.scrollLeft,
1033
+ isDown: true,
1034
+ hasMoved: false
1035
+ };
1036
+ };
1037
+ React2.useEffect(() => {
1038
+ if (!scrollable)
1039
+ return;
1040
+ const onMouseMove = (e) => {
1041
+ if (!dragState.current.isDown)
1042
+ return;
1043
+ const el = listRef.current;
1044
+ if (!el)
1045
+ return;
1046
+ const walk = e.pageX - dragState.current.startX;
1047
+ if (Math.abs(walk) > 4) {
1048
+ dragState.current.hasMoved = true;
1049
+ setIsDragging(true);
1050
+ }
1051
+ el.scrollLeft = dragState.current.scrollLeft - walk;
1052
+ };
1053
+ const onMouseUp = () => {
1054
+ if (dragState.current.isDown) {
1055
+ dragState.current.isDown = false;
1056
+ setTimeout(() => setIsDragging(false), 50);
1057
+ }
1058
+ };
1059
+ window.addEventListener("mousemove", onMouseMove);
1060
+ window.addEventListener("mouseup", onMouseUp);
1061
+ return () => {
1062
+ window.removeEventListener("mousemove", onMouseMove);
1063
+ window.removeEventListener("mouseup", onMouseUp);
1064
+ };
1065
+ }, [listRef, scrollable]);
1066
+ const onClickCapture = (e) => {
1067
+ if (dragState.current.hasMoved) {
1068
+ e.stopPropagation();
1069
+ e.preventDefault();
1070
+ }
1071
+ };
1072
+ return /* @__PURE__ */ jsxDEV2("div", {
1073
+ className: cn2("relative overflow-hidden group/pill-list", className),
1074
+ ...props,
1075
+ children: [
1076
+ arrows && overflowState.showLeft && /* @__PURE__ */ jsxDEV2("div", {
1077
+ className: "absolute left-0 top-0 bottom-0 z-20 flex items-center pr-4 pl-0 bg-gradient-to-r from-[var(--color-surface,var(--color-background))] via-[var(--color-surface,var(--color-background))]/90 to-transparent pointer-events-none",
1078
+ children: /* @__PURE__ */ jsxDEV2(ButtonIcon2, {
1079
+ type: "button",
1080
+ variant: "ghost",
1081
+ size: "xs",
1082
+ icon: "chevronLeft",
1083
+ iconSize: 14,
1084
+ onClick: () => scroll("left"),
1085
+ "aria-label": "Scroll pill ke kiri",
1086
+ className: "pointer-events-auto !h-6 !w-6 rounded-md hover:bg-hover text-[color:var(--color-foreground)]"
1087
+ }, undefined, false, undefined, this)
1088
+ }, undefined, false, undefined, this),
1089
+ arrows && overflowState.showRight && /* @__PURE__ */ jsxDEV2("div", {
1090
+ className: "absolute right-0 top-0 bottom-0 z-20 flex items-center pl-4 pr-0 bg-gradient-to-l from-[var(--color-surface,var(--color-background))] via-[var(--color-surface,var(--color-background))]/90 to-transparent pointer-events-none",
1091
+ children: /* @__PURE__ */ jsxDEV2(ButtonIcon2, {
1092
+ type: "button",
1093
+ variant: "ghost",
1094
+ size: "xs",
1095
+ icon: "chevronRight",
1096
+ iconSize: 14,
1097
+ onClick: () => scroll("right"),
1098
+ "aria-label": "Scroll pill ke kanan",
1099
+ className: "pointer-events-auto !h-6 !w-6 rounded-md hover:bg-hover text-[color:var(--color-foreground)]"
1100
+ }, undefined, false, undefined, this)
1101
+ }, undefined, false, undefined, this),
1102
+ /* @__PURE__ */ jsxDEV2("div", {
1103
+ ref: listRef,
1104
+ onMouseDown,
1105
+ onClickCapture,
1106
+ className: cn2("flex items-center gap-1.5 hide-scrollbar py-1.5 px-0.5", scrollable ? "overflow-x-auto" : "flex-wrap", isDragging ? "cursor-grabbing select-none scroll-auto" : scrollable ? "cursor-grab scroll-smooth" : "", listClassName),
1107
+ children
1108
+ }, undefined, false, undefined, this)
1109
+ ]
1110
+ }, undefined, true, undefined, this);
1111
+ });
1112
+ PillList2.displayName = "PillList";
1113
+ var SelectPillList2 = PillList2;
1114
+ var SelectColor2 = React2.forwardRef(({
1115
+ colorHex,
1116
+ selected = false,
1117
+ disabled = false,
1118
+ className = "",
1119
+ size = "md",
1120
+ animatedRing = false,
1121
+ imageUrl,
1122
+ radius,
1123
+ tooltip,
1124
+ title,
1125
+ onClick,
1126
+ state,
1127
+ ...props
1128
+ }, ref) => {
1129
+ const outerSizeClasses = {
1130
+ xs: "w-5 h-5",
1131
+ sm: "w-6 h-6",
1132
+ md: "w-8 h-8",
1133
+ lg: "w-10 h-10"
1134
+ };
1135
+ const ringBorderClasses = {
1136
+ xs: "border",
1137
+ sm: "border",
1138
+ md: "border",
1139
+ lg: "border"
1140
+ };
1141
+ const innerSizeClasses = {
1142
+ xs: "w-3.5 h-3.5",
1143
+ sm: "w-[18px] h-[18px]",
1144
+ md: "w-6 h-6",
1145
+ lg: "w-[30px] h-[30px]"
1146
+ };
1147
+ const radiusMap = {
1148
+ none: "rounded-none",
1149
+ sm: "rounded-sm",
1150
+ md: "rounded-md",
1151
+ lg: "rounded-lg",
1152
+ full: "rounded-full"
1153
+ };
1154
+ const radiusClass = radius ? radiusMap[radius] || "rounded-md" : "rounded-md";
1155
+ const innerRadiusClass = radius ? radiusMap[radius] || "rounded-sm" : "rounded-sm";
1156
+ const forcedStateClasses = {
1157
+ idle: "border-[color:var(--color-border)] bg-[var(--color-background)]",
1158
+ hover: "border-[color:var(--color-border-hover)] bg-[var(--color-background)]",
1159
+ active: "border-[color:var(--color-primary)] bg-[var(--color-background)] shadow-2xs",
1160
+ focused: "border-[color:var(--color-primary)] ring-[length:var(--ui-focus-ring-width,3px)] ring-[color:var(--ui-focus-ring-color,var(--color-primary-dimmy))] bg-[var(--color-background)] shadow-2xs",
1161
+ disabled: "opacity-40 cursor-not-allowed border-[color:var(--color-border)] bg-[var(--color-background)] pointer-events-none"
1162
+ };
1163
+ const isEffectivelyDisabled = disabled || state === "disabled";
1164
+ const stateClasses = state ? forcedStateClasses[state] : isEffectivelyDisabled ? "opacity-40 cursor-not-allowed border-[color:var(--color-border)] bg-[var(--color-background)] pointer-events-none" : selected ? cn2("border-[color:var(--color-primary)] bg-[var(--color-background)] shadow-2xs hover:opacity-90", "focus:outline-none focus:border-[color:var(--color-primary)] focus:ring-[length:var(--ui-focus-ring-width,3px)] focus:ring-[color:var(--ui-focus-ring-color,var(--color-primary-dimmy))]", animatedRing && "animate-pulse") : cn2("border-[color:var(--color-border)] bg-[var(--color-background)]", "hover:border-[color:var(--color-border-hover)]", "focus:outline-none focus:border-[color:var(--color-primary)] focus:ring-[length:var(--ui-focus-ring-width,3px)] focus:ring-[color:var(--ui-focus-ring-color,var(--color-primary-dimmy))]");
1165
+ const tooltipContent = tooltip || title;
1166
+ const buttonEl = /* @__PURE__ */ jsxDEV2("button", {
1167
+ ref,
1168
+ type: "button",
1169
+ disabled: isEffectivelyDisabled,
1170
+ onClick,
1171
+ className: cn2("relative flex items-center justify-center transition-all duration-150 ease-out select-none shrink-0", radiusClass, outerSizeClasses[size], ringBorderClasses[size], stateClasses, className),
1172
+ ...props,
1173
+ children: /* @__PURE__ */ jsxDEV2("span", {
1174
+ className: cn2("relative flex items-center justify-center overflow-hidden transition-all duration-150 border border-black/10 dark:border-white/15", innerRadiusClass, innerSizeClasses[size]),
1175
+ style: {
1176
+ backgroundColor: imageUrl ? "transparent" : colorHex,
1177
+ backgroundImage: imageUrl ? `url(${imageUrl})` : "none",
1178
+ backgroundSize: "cover",
1179
+ backgroundPosition: "center"
1180
+ },
1181
+ children: isEffectivelyDisabled && /* @__PURE__ */ jsxDEV2("svg", {
1182
+ className: "absolute inset-0 h-full w-full pointer-events-none text-foreground/50 opacity-70",
1183
+ viewBox: "0 0 24 24",
1184
+ fill: "none",
1185
+ stroke: "currentColor",
1186
+ strokeWidth: "1.5",
1187
+ strokeLinecap: "round",
1188
+ children: /* @__PURE__ */ jsxDEV2("line", {
1189
+ x1: "3",
1190
+ y1: "21",
1191
+ x2: "21",
1192
+ y2: "3"
1193
+ }, undefined, false, undefined, this)
1194
+ }, undefined, false, undefined, this)
1195
+ }, undefined, false, undefined, this)
1196
+ }, undefined, false, undefined, this);
1197
+ if (tooltipContent) {
1198
+ return /* @__PURE__ */ jsxDEV2(PortalTooltip2, {
1199
+ content: tooltipContent,
1200
+ side: "top",
1201
+ children: disabled ? /* @__PURE__ */ jsxDEV2("span", {
1202
+ className: "inline-flex cursor-not-allowed",
1203
+ children: buttonEl
1204
+ }, undefined, false, undefined, this) : buttonEl
1205
+ }, undefined, false, undefined, this);
1206
+ }
1207
+ return buttonEl;
1208
+ });
1209
+ SelectColor2.displayName = "SelectColor";
1210
+
1211
+ // src/components/ui/form.tsx
1212
+ import { jsxDEV as jsxDEV3, Fragment as Fragment2 } from "react/jsx-dev-runtime";
1213
+ function Textarea2({ className = "", icon = false, label, ...props }) {
1214
+ const { labelPosition, labelWidth } = useFormContext2();
1215
+ const Icon = resolveIcon2(icon, "text");
1216
+ const textarea = /* @__PURE__ */ jsxDEV3("textarea", {
1217
+ className: `w-full resize-none rounded-md border border-[color:var(--color-border-field-normal)] bg-[var(--color-input)] px-3 text-[13px] leading-[19px] text-[color:var(--color-input-foreground)] outline-none transition-all duration-200 hover:border-[color:var(--color-border-hover)] focus:border-[color:var(--color-primary)] focus:ring-[length:var(--ui-focus-ring-width,3px)] focus:ring-[color:var(--ui-focus-ring-color,var(--color-primary-dimmy))] disabled:bg-[var(--color-muted)] disabled:text-[color:var(--color-text-color)] disabled:opacity-70 ${Icon ? "pl-9 pt-2.5 pb-2" : "py-2.5"} ${className}`,
1218
+ ...props
1219
+ }, undefined, false, undefined, this);
1220
+ const textareaContent = Icon ? /* @__PURE__ */ jsxDEV3("div", {
1221
+ className: "relative w-full",
1222
+ children: [
1223
+ /* @__PURE__ */ jsxDEV3(Icon, {
1224
+ size: 16,
1225
+ className: "pointer-events-none absolute left-3 text-[color:var(--color-text-color)]",
1226
+ style: { top: 19.5 }
1227
+ }, undefined, false, undefined, this),
1228
+ textarea
1229
+ ]
1230
+ }, undefined, true, undefined, this) : textarea;
1231
+ if (label) {
1232
+ if (labelPosition === "left") {
1233
+ return /* @__PURE__ */ jsxDEV3("div", {
1234
+ className: "flex items-start gap-4",
1235
+ children: [
1236
+ /* @__PURE__ */ jsxDEV3("div", {
1237
+ style: { width: labelWidth },
1238
+ className: "shrink-0 mt-2",
1239
+ children: /* @__PURE__ */ jsxDEV3(Label2, {
1240
+ className: "text-[13px] font-medium text-[color:var(--color-foreground)]",
1241
+ children: label
1242
+ }, undefined, false, undefined, this)
1243
+ }, undefined, false, undefined, this),
1244
+ /* @__PURE__ */ jsxDEV3("div", {
1245
+ className: "flex-1 min-w-0",
1246
+ children: textareaContent
1247
+ }, undefined, false, undefined, this)
1248
+ ]
1249
+ }, undefined, true, undefined, this);
1250
+ } else {
1251
+ return /* @__PURE__ */ jsxDEV3("div", {
1252
+ className: "flex flex-col gap-1.5",
1253
+ children: [
1254
+ /* @__PURE__ */ jsxDEV3(Label2, {
1255
+ className: "text-[13px] font-medium text-[color:var(--color-foreground)]",
1256
+ children: label
1257
+ }, undefined, false, undefined, this),
1258
+ textareaContent
1259
+ ]
1260
+ }, undefined, true, undefined, this);
1261
+ }
1262
+ }
1263
+ return textareaContent;
1264
+ }
1265
+ function SelectNative2({ className = "", children, ...props }) {
1266
+ return /* @__PURE__ */ jsxDEV3("select", {
1267
+ className: `w-full appearance-none rounded-md border border-[color:var(--color-border-field-normal)] bg-[var(--color-input)] h-9 px-3 pr-9 text-[13px] text-[color:var(--color-input-foreground)] outline-none transition-all duration-200 hover:border-[color:var(--color-border-hover)] focus:border-[color:var(--color-primary)] focus:ring-[length:var(--ui-focus-ring-width,3px)] focus:ring-[color:var(--ui-focus-ring-color,var(--color-primary-dimmy))] disabled:bg-[var(--color-muted)] disabled:text-[color:var(--color-text-color)] disabled:opacity-70 ${className}`,
1268
+ style: {
1269
+ backgroundImage: `url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e")`,
1270
+ backgroundPosition: "right 0.5rem center",
1271
+ backgroundRepeat: "no-repeat",
1272
+ backgroundSize: "1.2em 1.2em"
1273
+ },
1274
+ ...props,
1275
+ children
1276
+ }, undefined, false, undefined, this);
1277
+ }
1278
+ function CheckboxIndicator2({ checked, disabled = false }) {
1279
+ if (disabled) {
1280
+ return /* @__PURE__ */ jsxDEV3("div", {
1281
+ className: "h-4 w-4 rounded-[4px] border border-[color:var(--color-border)] bg-[var(--color-muted)]"
1282
+ }, undefined, false, undefined, this);
1283
+ }
1284
+ return /* @__PURE__ */ jsxDEV3("div", {
1285
+ className: `flex h-4 w-4 flex-shrink-0 items-center justify-center rounded-[4px] border transition-all duration-200 group-focus-within:border-[color:var(--color-primary)] group-focus-within:ring-[3px] group-focus-within:ring-[var(--color-primary-dimmy)] ${checked ? "border-[color:var(--color-primary)] bg-[var(--color-primary)] group-hover:bg-[var(--color-primary)]/90 group-hover:border-[color:var(--color-primary)]/90" : "border-[color:var(--color-border-field-normal)] bg-[var(--color-input)] group-hover:border-[color:var(--color-border-hover)]"}`,
1286
+ children: /* @__PURE__ */ jsxDEV3(Check2, {
1287
+ size: 12,
1288
+ strokeWidth: 4,
1289
+ className: `text-[color:var(--color-primary-foreground)] transition-opacity ${checked ? "opacity-100" : "opacity-0"}`
1290
+ }, undefined, false, undefined, this)
1291
+ }, undefined, false, undefined, this);
1292
+ }
1293
+ var Checkbox2 = React3.forwardRef(({ className = "", disabled, ...props }, ref) => /* @__PURE__ */ jsxDEV3("label", {
1294
+ className: `relative flex items-center justify-center ${className} ${disabled ? "cursor-not-allowed opacity-50" : "group cursor-pointer"}`,
1295
+ children: [
1296
+ /* @__PURE__ */ jsxDEV3("input", {
1297
+ type: "checkbox",
1298
+ className: "peer sr-only",
1299
+ disabled,
1300
+ ref,
1301
+ ...props
1302
+ }, undefined, false, undefined, this),
1303
+ /* @__PURE__ */ jsxDEV3("div", {
1304
+ className: "h-4 w-4 rounded-[4px] border border-[color:var(--color-border-field-normal)] bg-[var(--color-input)] transition-all duration-200 peer-checked:border-[color:var(--color-primary)] peer-checked:bg-[var(--color-primary)] peer-checked:group-hover:bg-[var(--color-primary)]/90 peer-checked:group-hover:border-[color:var(--color-primary)]/90 group-hover:border-[color:var(--color-border-hover)] peer-focus:border-[color:var(--color-primary)] peer-focus:ring-[3px] peer-focus:ring-[var(--color-primary-dimmy)] peer-[:disabled:not(:checked)]:border-[color:var(--color-border-field-normal)] peer-[:disabled:not(:checked)]:bg-[var(--color-muted)] peer-[[aria-invalid=true]]:border-[color:var(--color-danger)] peer-[[aria-invalid=true]:focus]:ring-[var(--color-danger-dimmy)]"
1305
+ }, undefined, false, undefined, this),
1306
+ /* @__PURE__ */ jsxDEV3(Check2, {
1307
+ size: 13,
1308
+ strokeWidth: 3.5,
1309
+ className: "pointer-events-none absolute text-white opacity-0 transition-opacity peer-checked:opacity-100"
1310
+ }, undefined, false, undefined, this)
1311
+ ]
1312
+ }, undefined, true, undefined, this));
1313
+ Checkbox2.displayName = "Checkbox";
1314
+ function MultiSelect2({
1315
+ options,
1316
+ selectedValues,
1317
+ onChange,
1318
+ className = "",
1319
+ name,
1320
+ disabled = false
1321
+ }) {
1322
+ function toggle(value) {
1323
+ if (disabled)
1324
+ return;
1325
+ onChange(selectedValues.includes(value) ? selectedValues.filter((v) => v !== value) : [...selectedValues, value]);
1326
+ }
1327
+ return /* @__PURE__ */ jsxDEV3("div", {
1328
+ className: `space-y-2 ${className}`,
1329
+ children: options.map((option) => /* @__PURE__ */ jsxDEV3("label", {
1330
+ className: `group flex items-center gap-3 ${disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"}`,
1331
+ children: [
1332
+ /* @__PURE__ */ jsxDEV3("input", {
1333
+ type: "checkbox",
1334
+ name,
1335
+ value: option.value,
1336
+ className: "sr-only",
1337
+ checked: selectedValues.includes(option.value),
1338
+ disabled,
1339
+ onChange: () => toggle(option.value)
1340
+ }, undefined, false, undefined, this),
1341
+ /* @__PURE__ */ jsxDEV3(CheckboxIndicator2, {
1342
+ checked: selectedValues.includes(option.value),
1343
+ disabled
1344
+ }, undefined, false, undefined, this),
1345
+ /* @__PURE__ */ jsxDEV3("span", {
1346
+ className: "text-sm font-medium text-[color:var(--color-input-foreground)]",
1347
+ children: option.label
1348
+ }, undefined, false, undefined, this)
1349
+ ]
1350
+ }, option.value, true, undefined, this))
1351
+ }, undefined, false, undefined, this);
1352
+ }
1353
+ function SelectGroup2({
1354
+ options,
1355
+ value,
1356
+ onChange,
1357
+ className = "",
1358
+ iconOnly = false,
1359
+ size = "normal",
1360
+ radius
1361
+ }) {
1362
+ const containerRef = React3.useRef(null);
1363
+ const btnRefs = React3.useRef(new Map);
1364
+ const [pill, setPill] = React3.useState(null);
1365
+ const selectedOptionColor = options.find((o) => o.value === value)?.color ?? "primary";
1366
+ const selectedColor = {
1367
+ bg: `var(--color-${selectedOptionColor})`,
1368
+ fg: `var(--color-${selectedOptionColor}-foreground)`
1369
+ };
1370
+ const isFullWidth = className.includes("w-full");
1371
+ React3.useLayoutEffect(() => {
1372
+ const container = containerRef.current;
1373
+ const activeEl = btnRefs.current.get(value);
1374
+ if (!container || !activeEl)
1375
+ return;
1376
+ const updatePill = () => {
1377
+ setPill({ left: activeEl.offsetLeft, width: activeEl.offsetWidth });
1378
+ };
1379
+ updatePill();
1380
+ const observer = new ResizeObserver(updatePill);
1381
+ observer.observe(activeEl);
1382
+ if (container)
1383
+ observer.observe(container);
1384
+ if (document.fonts && document.fonts.ready) {
1385
+ document.fonts.ready.then(updatePill);
1386
+ }
1387
+ return () => observer.disconnect();
1388
+ }, [value]);
1389
+ const radiusMap = {
1390
+ none: { container: "rounded-none", pill: "rounded-none", btn: "rounded-none" },
1391
+ sm: { container: "rounded-sm", pill: "rounded-sm", btn: "rounded-sm" },
1392
+ md: {
1393
+ container: "rounded-[var(--ui-input-radius,var(--ui-radius-md,8px))]",
1394
+ pill: "rounded-[var(--ui-btn-radius,var(--ui-radius-md,8px))]",
1395
+ btn: "rounded-[var(--ui-btn-radius,var(--ui-radius-md,8px))]"
1396
+ },
1397
+ lg: { container: "rounded-lg", pill: "rounded-lg", btn: "rounded-lg" },
1398
+ squircle: {
1399
+ container: size === "sm" ? "rounded-[14px]" : "rounded-[16px]",
1400
+ pill: size === "sm" ? "rounded-[10px]" : "rounded-[12px]",
1401
+ btn: size === "sm" ? "rounded-[10px]" : "rounded-[12px]"
1402
+ },
1403
+ full: {
1404
+ container: "rounded-full",
1405
+ pill: "rounded-full",
1406
+ btn: "rounded-full"
1407
+ }
1408
+ };
1409
+ const currentRadius = radius ? radiusMap[radius] || radiusMap.md : radiusMap.md;
1410
+ const containerRadius = currentRadius.container;
1411
+ const pillRadius = currentRadius.pill;
1412
+ const buttonRadius = currentRadius.btn;
1413
+ const containerClasses = size === "sm" ? `h-[30px] gap-0.5 p-[2px] ${containerRadius}` : `h-[38px] gap-1 p-[3px] ${containerRadius}`;
1414
+ const pillClasses = size === "sm" ? `top-[2px] bottom-[2px] ${pillRadius}` : `top-[3px] bottom-[3px] ${pillRadius}`;
1415
+ return /* @__PURE__ */ jsxDEV3("div", {
1416
+ ref: containerRef,
1417
+ className: cn2("relative items-center border border-[color:var(--color-border-field-normal)] bg-[var(--color-input)] transition-all duration-200 focus-within:border-[color:var(--color-primary)] focus-within:ring-[length:var(--ui-focus-ring-width,3px)] focus-within:ring-[color:var(--ui-focus-ring-color,var(--color-primary-dimmy))] overflow-x-auto hide-scrollbar max-w-full", isFullWidth ? "flex w-full" : "inline-flex shrink-0", containerClasses, className),
1418
+ children: [
1419
+ pill && /* @__PURE__ */ jsxDEV3("div", {
1420
+ className: `pointer-events-none absolute transition-[left,width,background-color] duration-300 ease-out shadow-xs ${pillClasses}`,
1421
+ style: { left: pill.left, width: pill.width, backgroundColor: selectedColor.bg }
1422
+ }, undefined, false, undefined, this),
1423
+ options.map((option) => {
1424
+ const isSelected = value === option.value;
1425
+ return /* @__PURE__ */ jsxDEV3("button", {
1426
+ ref: (el) => {
1427
+ if (el)
1428
+ btnRefs.current.set(option.value, el);
1429
+ else
1430
+ btnRefs.current.delete(option.value);
1431
+ },
1432
+ type: "button",
1433
+ "aria-label": option.ariaLabel || option.title || (typeof option.label === "string" ? option.label : `Pilihan ${option.value}`),
1434
+ title: option.title || option.ariaLabel || (typeof option.label === "string" ? option.label : undefined),
1435
+ disabled: option.disabled,
1436
+ onClick: () => onChange(option.value),
1437
+ style: fontStyle2("small-text"),
1438
+ className: cn2("relative flex h-full items-center justify-center transition-colors focus:outline-none", buttonRadius, isFullWidth ? "flex-1 min-w-0" : "shrink-0", iconOnly ? size === "sm" ? "w-[26px]" : "w-[32px]" : size === "sm" ? "px-2.5 text-[11.5px] sm:text-[12px] gap-1.5" : "px-3.5 text-[13px] gap-1.5", option.disabled ? "cursor-not-allowed opacity-30 line-through" : isSelected ? "" : "text-[color:var(--color-input-foreground)] hover:bg-[var(--color-secondary)] hover:text-[color:var(--color-secondary-foreground)]"),
1439
+ children: /* @__PURE__ */ jsxDEV3("span", {
1440
+ style: isSelected ? { color: selectedColor.fg } : {},
1441
+ className: cn2("whitespace-nowrap flex items-center justify-center", isFullWidth && "truncate"),
1442
+ children: option.label
1443
+ }, undefined, false, undefined, this)
1444
+ }, option.value, false, undefined, this);
1445
+ })
1446
+ ]
1447
+ }, undefined, true, undefined, this);
1448
+ }
1449
+ var SegmentedControl2 = SelectGroup2;
1450
+ function Switch2({
1451
+ checked,
1452
+ onChange,
1453
+ disabled = false,
1454
+ labelOn = "On",
1455
+ labelOff = "Off",
1456
+ color = "success",
1457
+ size = "normal",
1458
+ className = ""
1459
+ }) {
1460
+ return /* @__PURE__ */ jsxDEV3(SelectGroup2, {
1461
+ options: [
1462
+ { label: labelOn, value: "true", color, disabled },
1463
+ { label: labelOff, value: "false", color: "mist", disabled }
1464
+ ],
1465
+ value: checked ? "true" : "false",
1466
+ onChange: (v) => onChange(v === "true"),
1467
+ size,
1468
+ className
1469
+ }, undefined, false, undefined, this);
1470
+ }
1471
+ function FilterSelection2({
1472
+ options,
1473
+ selectedValue,
1474
+ onChange,
1475
+ className = ""
1476
+ }) {
1477
+ return /* @__PURE__ */ jsxDEV3("div", {
1478
+ className: `flex flex-wrap gap-2 ${className}`,
1479
+ children: options.map((option) => {
1480
+ const isSelected = selectedValue === option.value;
1481
+ return /* @__PURE__ */ jsxDEV3("button", {
1482
+ type: "button",
1483
+ disabled: option.disabled,
1484
+ onClick: () => onChange(option.value),
1485
+ className: `inline-flex items-center justify-center rounded-full border h-[24px] px-2.5 text-[11px] font-medium transition-all duration-200 focus:outline-none focus:border-[color:var(--color-primary)] focus:ring-[length:var(--ui-focus-ring-width,3px)] focus:ring-[color:var(--ui-focus-ring-color,var(--color-primary-dimmy))] ${option.disabled ? "cursor-not-allowed border-[color:var(--color-border)] bg-[var(--color-secondary)] text-[color:var(--color-secondary-foreground)] opacity-50 line-through" : isSelected ? "border-[color:var(--color-filter)] bg-[var(--color-filter)] text-[color:var(--color-filter-foreground)]" : "border-[color:var(--color-border)] bg-[var(--color-background)] hover:bg-hover"}`,
1486
+ children: option.label
1487
+ }, option.value, false, undefined, this);
1488
+ })
1489
+ }, undefined, false, undefined, this);
1490
+ }
1491
+ function NumberRangeInput2({
1492
+ minLabel = "Min",
1493
+ maxLabel = "Max",
1494
+ minValue,
1495
+ maxValue,
1496
+ onMinChange,
1497
+ onMaxChange,
1498
+ className = "",
1499
+ name,
1500
+ disabled = false
1501
+ }) {
1502
+ return /* @__PURE__ */ jsxDEV3("div", {
1503
+ className: `flex items-center space-x-2 ${className}`,
1504
+ children: [
1505
+ /* @__PURE__ */ jsxDEV3(Input2, {
1506
+ type: "number",
1507
+ name: name ? `${name}Min` : undefined,
1508
+ placeholder: minLabel,
1509
+ value: minValue,
1510
+ onChange: onMinChange,
1511
+ disabled
1512
+ }, undefined, false, undefined, this),
1513
+ /* @__PURE__ */ jsxDEV3("span", {
1514
+ className: "font-medium text-[color:var(--color-text-color)]",
1515
+ children: "-"
1516
+ }, undefined, false, undefined, this),
1517
+ /* @__PURE__ */ jsxDEV3(Input2, {
1518
+ type: "number",
1519
+ name: name ? `${name}Max` : undefined,
1520
+ placeholder: maxLabel,
1521
+ value: maxValue,
1522
+ onChange: onMaxChange,
1523
+ disabled
1524
+ }, undefined, false, undefined, this)
1525
+ ]
1526
+ }, undefined, true, undefined, this);
1527
+ }
1528
+ function PhoneInput2({ className = "", onChange, ...props }) {
1529
+ function handleChange(e) {
1530
+ let val = e.target.value;
1531
+ const hasPlus = val.startsWith("+");
1532
+ val = val.replace(/[^\d]/g, "");
1533
+ if (hasPlus)
1534
+ val = "+" + val;
1535
+ e.target.value = val;
1536
+ onChange?.(e);
1537
+ }
1538
+ return /* @__PURE__ */ jsxDEV3(Input2, {
1539
+ type: "tel",
1540
+ className,
1541
+ onChange: handleChange,
1542
+ placeholder: "+62 812 3456 7890",
1543
+ ...props
1544
+ }, undefined, false, undefined, this);
1545
+ }
1546
+ function InputErrorText2({ message }) {
1547
+ return /* @__PURE__ */ jsxDEV3("p", {
1548
+ className: "mt-1 mx-[2px] flex items-start gap-1 text-[11.5px] leading-tight text-[color:var(--color-danger)]",
1549
+ children: [
1550
+ /* @__PURE__ */ jsxDEV3(AlertCircle, {
1551
+ size: 13,
1552
+ className: "shrink-0 mt-[1px]"
1553
+ }, undefined, false, undefined, this),
1554
+ /* @__PURE__ */ jsxDEV3("span", {
1555
+ children: message
1556
+ }, undefined, false, undefined, this)
1557
+ ]
1558
+ }, undefined, true, undefined, this);
1559
+ }
1560
+ function calculatePasswordStrength(password, minLength, requireAlphanumeric, requireSymbol, requireUpperLower) {
1561
+ let score = 0;
1562
+ if (!password)
1563
+ return 0;
1564
+ if (password.length >= minLength)
1565
+ score += 1;
1566
+ if (requireAlphanumeric && /[a-zA-Z]/.test(password) && /[0-9]/.test(password))
1567
+ score += 1;
1568
+ else if (!requireAlphanumeric && /[a-zA-Z0-9]/.test(password))
1569
+ score += 1;
1570
+ if (requireSymbol && /[^a-zA-Z0-9]/.test(password))
1571
+ score += 1;
1572
+ else if (!requireSymbol && password.length >= minLength + 2)
1573
+ score += 1;
1574
+ if (requireUpperLower && /[a-z]/.test(password) && /[A-Z]/.test(password))
1575
+ score += 1;
1576
+ else if (!requireUpperLower && password.length >= minLength + 4)
1577
+ score += 1;
1578
+ return Math.min(4, score);
1579
+ }
1580
+ function generateSecurePassword(minLength, requireAlphanumeric, generateSymbolCount, requireUpperLower) {
1581
+ const lower = "abcdefghijklmnopqrstuvwxyz";
1582
+ const upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
1583
+ const num = "0123456789";
1584
+ const sym = "!@#$%^&*()_+~`|}{[]:;?><,./-=";
1585
+ let chars = lower;
1586
+ if (requireUpperLower)
1587
+ chars += upper;
1588
+ if (requireAlphanumeric)
1589
+ chars += num;
1590
+ if (generateSymbolCount > 0)
1591
+ chars += sym;
1592
+ let pwd = "";
1593
+ if (requireUpperLower) {
1594
+ pwd += lower[Math.floor(Math.random() * lower.length)];
1595
+ pwd += upper[Math.floor(Math.random() * upper.length)];
1596
+ }
1597
+ if (requireAlphanumeric) {
1598
+ pwd += num[Math.floor(Math.random() * num.length)];
1599
+ }
1600
+ for (let i = 0;i < generateSymbolCount; i++) {
1601
+ pwd += sym[Math.floor(Math.random() * sym.length)];
1602
+ }
1603
+ const targetLength = Math.max(minLength, 12);
1604
+ while (pwd.length < targetLength) {
1605
+ pwd += chars[Math.floor(Math.random() * chars.length)];
1606
+ }
1607
+ return pwd.split("").sort(() => 0.5 - Math.random()).join("");
1608
+ }
1609
+ function InputPassword2({
1610
+ className = "",
1611
+ size,
1612
+ icon = false,
1613
+ showToggle = true,
1614
+ renderToggle,
1615
+ showStrength = false,
1616
+ minLength = 8,
1617
+ requireAlphanumeric = true,
1618
+ requireSymbol = false,
1619
+ requireUpperLower = false,
1620
+ showGenerate = false,
1621
+ generateLabel = "Generate",
1622
+ generateIcon,
1623
+ renderGenerate,
1624
+ generateSymbolCount = 1,
1625
+ onGenerate,
1626
+ matchValue,
1627
+ hasError,
1628
+ isSuccess,
1629
+ isLoading,
1630
+ ...props
1631
+ }) {
1632
+ const [visible, setVisible] = React3.useState(false);
1633
+ const inputRef = React3.useRef(null);
1634
+ const Icon = resolveIcon2(icon, "lock");
1635
+ const valueStr = String(props.value ?? props.defaultValue ?? "");
1636
+ const strengthScore = showStrength ? calculatePasswordStrength(valueStr, minLength, requireAlphanumeric, requireSymbol, requireUpperLower) : 0;
1637
+ let strengthColor = "bg-[var(--color-border-field-normal)]";
1638
+ let strengthLabel = "Sangat Lemah";
1639
+ if (strengthScore === 1) {
1640
+ strengthColor = "bg-[var(--color-danger)]";
1641
+ strengthLabel = "Lemah";
1642
+ } else if (strengthScore === 2) {
1643
+ strengthColor = "bg-warning";
1644
+ strengthLabel = "Sedang";
1645
+ } else if (strengthScore >= 3) {
1646
+ strengthColor = "bg-success";
1647
+ strengthLabel = "Kuat";
1648
+ }
1649
+ const isMatched = matchValue !== undefined ? valueStr === matchValue : undefined;
1650
+ const hasValue = valueStr.length > 0;
1651
+ const toggleVisible = () => setVisible((v) => !v);
1652
+ const handleGenerate = () => {
1653
+ const pwd = generateSecurePassword(minLength, requireAlphanumeric, generateSymbolCount, requireUpperLower);
1654
+ if (inputRef.current && props.value === undefined) {
1655
+ inputRef.current.value = pwd;
1656
+ }
1657
+ if (props.onChange) {
1658
+ const event = {
1659
+ target: { value: pwd, name: props.name },
1660
+ currentTarget: { value: pwd, name: props.name }
1661
+ };
1662
+ props.onChange(event);
1663
+ }
1664
+ setVisible(true);
1665
+ onGenerate?.(pwd);
1666
+ };
1667
+ const toggleNode = showToggle ? renderToggle ? renderToggle(visible, toggleVisible) : /* @__PURE__ */ jsxDEV3(Button2, {
1668
+ type: "button",
1669
+ variant: "ghost",
1670
+ color: "muted",
1671
+ size: "icon",
1672
+ tabIndex: -1,
1673
+ onClick: toggleVisible,
1674
+ "aria-label": visible ? "Sembunyikan password" : "Tampilkan password",
1675
+ title: visible ? "Sembunyikan password" : "Tampilkan password",
1676
+ children: [
1677
+ /* @__PURE__ */ jsxDEV3("span", {
1678
+ className: "sr-only",
1679
+ children: visible ? "Sembunyikan password" : "Tampilkan password"
1680
+ }, undefined, false, undefined, this),
1681
+ visible ? /* @__PURE__ */ jsxDEV3(EyeOff, {
1682
+ size: 16
1683
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV3(Eye, {
1684
+ size: 16
1685
+ }, undefined, false, undefined, this)
1686
+ ]
1687
+ }, undefined, true, undefined, this) : null;
1688
+ const generateNode = showGenerate ? renderGenerate ? renderGenerate(handleGenerate) : /* @__PURE__ */ jsxDEV3(Button2, {
1689
+ type: "button",
1690
+ variant: "soft",
1691
+ color: "primary",
1692
+ tabIndex: -1,
1693
+ onClick: handleGenerate,
1694
+ title: "Generate Password",
1695
+ className: generateIcon ? "gap-1" : undefined,
1696
+ children: [
1697
+ generateIcon,
1698
+ /* @__PURE__ */ jsxDEV3("span", {
1699
+ children: generateLabel
1700
+ }, undefined, false, undefined, this)
1701
+ ]
1702
+ }, undefined, true, undefined, this) : null;
1703
+ const buttons = toggleNode && generateNode ? /* @__PURE__ */ jsxDEV3("div", {
1704
+ className: "flex items-center gap-1",
1705
+ children: [
1706
+ toggleNode,
1707
+ generateNode
1708
+ ]
1709
+ }, undefined, true, undefined, this) : toggleNode || generateNode || undefined;
1710
+ return /* @__PURE__ */ jsxDEV3("div", {
1711
+ className: "w-full flex flex-col gap-1.5",
1712
+ children: [
1713
+ /* @__PURE__ */ jsxDEV3(Input2, {
1714
+ ref: inputRef,
1715
+ type: visible ? "text" : "password",
1716
+ size,
1717
+ icon: Icon ?? undefined,
1718
+ className,
1719
+ inputClassName: `${matchValue !== undefined && hasValue && !isMatched ? "!border-[color:var(--color-danger)]" : ""}`,
1720
+ hasError,
1721
+ isSuccess,
1722
+ isLoading,
1723
+ showPasswordToggle: false,
1724
+ buttonInside: buttons,
1725
+ ...props
1726
+ }, undefined, false, undefined, this),
1727
+ showStrength && hasValue && /* @__PURE__ */ jsxDEV3("div", {
1728
+ className: "flex items-center gap-2 px-1",
1729
+ children: [
1730
+ /* @__PURE__ */ jsxDEV3("div", {
1731
+ className: "flex h-1.5 flex-1 gap-1",
1732
+ children: [1, 2, 3, 4].map((level) => /* @__PURE__ */ jsxDEV3("div", {
1733
+ className: `h-full flex-1 rounded-full transition-colors ${strengthScore >= level ? strengthColor : "bg-[var(--color-border-field-normal)]"}`
1734
+ }, level, false, undefined, this))
1735
+ }, undefined, false, undefined, this),
1736
+ /* @__PURE__ */ jsxDEV3("span", {
1737
+ className: `text-[10px] font-semibold uppercase tracking-wider ${strengthScore >= 3 ? "text-success" : strengthScore === 2 ? "text-warning" : "text-[color:var(--color-danger)]"}`,
1738
+ children: strengthLabel
1739
+ }, undefined, false, undefined, this)
1740
+ ]
1741
+ }, undefined, true, undefined, this),
1742
+ matchValue !== undefined && hasValue && /* @__PURE__ */ jsxDEV3("p", {
1743
+ className: `mt-1 flex items-center gap-1 text-[11.5px] ${isMatched ? "text-success" : "text-[color:var(--color-danger)]"}`,
1744
+ children: isMatched ? /* @__PURE__ */ jsxDEV3(Fragment2, {
1745
+ children: [
1746
+ /* @__PURE__ */ jsxDEV3(Check2, {
1747
+ size: 12,
1748
+ className: "flex-none"
1749
+ }, undefined, false, undefined, this),
1750
+ " Password cocok"
1751
+ ]
1752
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV3(Fragment2, {
1753
+ children: [
1754
+ /* @__PURE__ */ jsxDEV3(AlertCircle, {
1755
+ size: 12,
1756
+ className: "flex-none"
1757
+ }, undefined, false, undefined, this),
1758
+ " Password tidak cocok"
1759
+ ]
1760
+ }, undefined, true, undefined, this)
1761
+ }, undefined, false, undefined, this)
1762
+ ]
1763
+ }, undefined, true, undefined, this);
1764
+ }
1765
+ function PasswordText2({
1766
+ value,
1767
+ maskedLength,
1768
+ maskChar = "•",
1769
+ visible: controlledVisible,
1770
+ defaultVisible = false,
1771
+ onVisibleChange,
1772
+ copyable = true,
1773
+ canReveal = true,
1774
+ onRevealDenied,
1775
+ onBeforeReveal,
1776
+ size = "sm",
1777
+ mono = true,
1778
+ className = "",
1779
+ ...props
1780
+ }) {
1781
+ const [internalVisible, setInternalVisible] = React3.useState(defaultVisible);
1782
+ const [copied, setCopied] = React3.useState(false);
1783
+ const [checking, setChecking] = React3.useState(false);
1784
+ const isControlled = controlledVisible !== undefined;
1785
+ const rawVisible = isControlled ? controlledVisible : internalVisible;
1786
+ const isVisible = canReveal ? rawVisible : false;
1787
+ React3.useEffect(() => {
1788
+ if (!canReveal && internalVisible && !isControlled) {
1789
+ setInternalVisible(false);
1790
+ }
1791
+ }, [canReveal, internalVisible, isControlled]);
1792
+ const setVisibility = (next) => {
1793
+ if (!isControlled)
1794
+ setInternalVisible(next);
1795
+ onVisibleChange?.(next);
1796
+ };
1797
+ const handleToggle = async () => {
1798
+ if (isVisible) {
1799
+ setVisibility(false);
1800
+ return;
1801
+ }
1802
+ if (!canReveal) {
1803
+ onRevealDenied?.();
1804
+ return;
1805
+ }
1806
+ if (onBeforeReveal) {
1807
+ setChecking(true);
1808
+ try {
1809
+ const allowed = await onBeforeReveal();
1810
+ if (!allowed) {
1811
+ onRevealDenied?.();
1812
+ return;
1813
+ }
1814
+ } finally {
1815
+ setChecking(false);
1816
+ }
1817
+ }
1818
+ setVisibility(true);
1819
+ };
1820
+ const handleCopy = async () => {
1821
+ if (!canReveal) {
1822
+ onRevealDenied?.();
1823
+ return;
1824
+ }
1825
+ if (onBeforeReveal && !isVisible) {
1826
+ setChecking(true);
1827
+ try {
1828
+ const allowed = await onBeforeReveal();
1829
+ if (!allowed) {
1830
+ onRevealDenied?.();
1831
+ return;
1832
+ }
1833
+ } finally {
1834
+ setChecking(false);
1835
+ }
1836
+ }
1837
+ try {
1838
+ await navigator.clipboard?.writeText(value);
1839
+ setCopied(true);
1840
+ setTimeout(() => setCopied(false), 1500);
1841
+ } catch {}
1842
+ };
1843
+ const sizeMap = {
1844
+ xs: { text: "text-[11px]", icon: 12, btn: "!h-5 !w-5" },
1845
+ sm: { text: "text-[13px]", icon: 14, btn: "!h-6 !w-6" },
1846
+ md: { text: "text-[14px]", icon: 15, btn: "!h-7 !w-7" },
1847
+ lg: { text: "text-[16px]", icon: 16, btn: "!h-8 !w-8" }
1848
+ }[size];
1849
+ const dotsCount = maskedLength ?? Math.min(Math.max(value.length, 6), 12);
1850
+ const displayValue = isVisible ? value : maskChar.repeat(dotsCount);
1851
+ return /* @__PURE__ */ jsxDEV3("span", {
1852
+ className: cn2("inline-flex items-center gap-1 align-middle text-[color:var(--color-foreground)]", sizeMap.text, mono && "font-mono", className),
1853
+ ...props,
1854
+ children: [
1855
+ /* @__PURE__ */ jsxDEV3("span", {
1856
+ className: cn2(!isVisible && "tracking-widest select-none"),
1857
+ children: displayValue
1858
+ }, undefined, false, undefined, this),
1859
+ /* @__PURE__ */ jsxDEV3(Button2, {
1860
+ type: "button",
1861
+ variant: "ghost",
1862
+ color: "muted",
1863
+ size: "icon",
1864
+ disabled: checking,
1865
+ onClick: handleToggle,
1866
+ className: cn2(sizeMap.btn, "!p-0 rounded-md"),
1867
+ "aria-label": isVisible ? "Sembunyikan teks" : "Tampilkan teks",
1868
+ title: isVisible ? "Sembunyikan" : "Tampilkan",
1869
+ children: isVisible ? /* @__PURE__ */ jsxDEV3(EyeOff, {
1870
+ size: sizeMap.icon
1871
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV3(Eye, {
1872
+ size: sizeMap.icon
1873
+ }, undefined, false, undefined, this)
1874
+ }, undefined, false, undefined, this),
1875
+ copyable && canReveal && /* @__PURE__ */ jsxDEV3(Button2, {
1876
+ type: "button",
1877
+ variant: "ghost",
1878
+ color: "muted",
1879
+ size: "icon",
1880
+ disabled: checking,
1881
+ onClick: handleCopy,
1882
+ className: cn2(sizeMap.btn, "!p-0 rounded-md"),
1883
+ "aria-label": "Salin teks",
1884
+ title: copied ? "Tersalin!" : "Salin",
1885
+ children: copied ? /* @__PURE__ */ jsxDEV3(Check2, {
1886
+ size: sizeMap.icon,
1887
+ className: "text-success"
1888
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV3(Copy, {
1889
+ size: sizeMap.icon
1890
+ }, undefined, false, undefined, this)
1891
+ }, undefined, false, undefined, this)
1892
+ ]
1893
+ }, undefined, true, undefined, this);
1894
+ }
1895
+ var EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
1896
+ function InputEmail2({
1897
+ className = "",
1898
+ onBlur,
1899
+ errorMessage = "Format email tidak valid.",
1900
+ icon = false,
1901
+ ...props
1902
+ }) {
1903
+ const [touched, setTouched] = React3.useState(false);
1904
+ const value = String(props.value ?? props.defaultValue ?? "");
1905
+ const isInvalid = touched && value.length > 0 && !EMAIL_REGEX.test(value);
1906
+ return /* @__PURE__ */ jsxDEV3("div", {
1907
+ children: [
1908
+ /* @__PURE__ */ jsxDEV3(Input2, {
1909
+ type: "email",
1910
+ icon: resolveIcon2(icon, "mail") ?? undefined,
1911
+ className: `${isInvalid ? "!border-[color:var(--color-danger)]" : ""} ${className}`,
1912
+ onBlur: (e) => {
1913
+ setTouched(true);
1914
+ onBlur?.(e);
1915
+ },
1916
+ ...props
1917
+ }, undefined, false, undefined, this),
1918
+ isInvalid && /* @__PURE__ */ jsxDEV3(InputErrorText2, {
1919
+ message: errorMessage
1920
+ }, undefined, false, undefined, this)
1921
+ ]
1922
+ }, undefined, true, undefined, this);
1923
+ }
1924
+ function InputNumber2({
1925
+ className = "",
1926
+ onChange,
1927
+ allowDecimal = false,
1928
+ allowNegative = false,
1929
+ icon = false,
1930
+ ...props
1931
+ }) {
1932
+ function handleChange(e) {
1933
+ let val = e.target.value;
1934
+ const isNegative = allowNegative && val.startsWith("-");
1935
+ val = val.replace(allowDecimal ? /[^\d.]/g : /[^\d]/g, "");
1936
+ if (allowDecimal) {
1937
+ const firstDot = val.indexOf(".");
1938
+ if (firstDot !== -1)
1939
+ val = val.slice(0, firstDot + 1) + val.slice(firstDot + 1).replace(/\./g, "");
1940
+ }
1941
+ e.target.value = isNegative ? "-" + val : val;
1942
+ onChange?.(e);
1943
+ }
1944
+ return /* @__PURE__ */ jsxDEV3(Input2, {
1945
+ type: "text",
1946
+ inputMode: allowDecimal ? "decimal" : "numeric",
1947
+ icon: resolveIcon2(icon, "hash") ?? undefined,
1948
+ className,
1949
+ onChange: handleChange,
1950
+ ...props
1951
+ }, undefined, false, undefined, this);
1952
+ }
1953
+ function InputCurrency2({
1954
+ className = "",
1955
+ onChange,
1956
+ onBlur,
1957
+ icon = false,
1958
+ min,
1959
+ max,
1960
+ separator = ".",
1961
+ decimals = 0,
1962
+ ...props
1963
+ }) {
1964
+ const decimalSep = separator === "." ? "," : ".";
1965
+ function formatValue(num, enforceDecimals) {
1966
+ if (isNaN(num))
1967
+ return "";
1968
+ let [intPart, decPart] = num.toString().split(".");
1969
+ intPart = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
1970
+ if (decimals > 0) {
1971
+ if (enforceDecimals) {
1972
+ decPart = (decPart || "").padEnd(decimals, "0").slice(0, decimals);
1973
+ } else if (decPart) {
1974
+ decPart = decPart.slice(0, decimals);
1975
+ }
1976
+ if (decPart)
1977
+ return intPart + decimalSep + decPart;
1978
+ }
1979
+ return intPart;
1980
+ }
1981
+ const formatInitial = (val) => {
1982
+ if (val === undefined || val === null || val === "")
1983
+ return val;
1984
+ if (typeof val === "number")
1985
+ return formatValue(val, false);
1986
+ const strVal = val.toString();
1987
+ if (/^\d+$/.test(strVal)) {
1988
+ return formatValue(parseInt(strVal, 10), false);
1989
+ }
1990
+ return strVal;
1991
+ };
1992
+ const finalValue = props.value !== undefined ? formatInitial(props.value) : undefined;
1993
+ const finalDefaultValue = props.defaultValue !== undefined ? formatInitial(props.defaultValue) : undefined;
1994
+ function parseValue(val) {
1995
+ if (!val)
1996
+ return NaN;
1997
+ let cleanVal = val.split(separator).join("");
1998
+ cleanVal = cleanVal.replace(decimalSep, ".");
1999
+ return parseFloat(cleanVal);
2000
+ }
2001
+ function handleChange(e) {
2002
+ let val = e.target.value;
2003
+ const dSep = decimalSep.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2004
+ val = val.replace(new RegExp(`[^\\d${dSep}]`, "g"), "");
2005
+ const parts = val.split(decimalSep);
2006
+ if (parts.length > 2) {
2007
+ parts[1] = parts.slice(1).join("");
2008
+ val = parts[0] + decimalSep + parts[1];
2009
+ }
2010
+ let [intPart, decPart] = val.split(decimalSep);
2011
+ intPart = intPart.replace(/^0+(?=\d)/, "");
2012
+ if (intPart || decPart !== undefined) {
2013
+ let num = parseFloat((intPart || "0") + "." + (decPart || "0"));
2014
+ if (max !== undefined && num > max) {
2015
+ num = max;
2016
+ let numStrParts = num.toString().split(".");
2017
+ intPart = numStrParts[0];
2018
+ if (numStrParts[1] !== undefined)
2019
+ decPart = numStrParts[1];
2020
+ }
2021
+ if (intPart) {
2022
+ intPart = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
2023
+ } else if (decPart !== undefined) {
2024
+ intPart = "0";
2025
+ }
2026
+ if (decimals > 0 && decPart !== undefined) {
2027
+ decPart = decPart.slice(0, decimals);
2028
+ } else if (decimals === 0) {
2029
+ decPart = undefined;
2030
+ }
2031
+ let finalVal = intPart;
2032
+ if (decPart !== undefined && decimals > 0) {
2033
+ finalVal += decimalSep + decPart;
2034
+ } else if (val.endsWith(decimalSep) && decimals > 0) {
2035
+ finalVal += decimalSep;
2036
+ }
2037
+ e.target.value = finalVal;
2038
+ } else {
2039
+ e.target.value = "";
2040
+ }
2041
+ onChange?.(e);
2042
+ }
2043
+ function handleBlur(e) {
2044
+ let val = e.target.value;
2045
+ let num = parseValue(val);
2046
+ if (!isNaN(num)) {
2047
+ if (min !== undefined && num < min)
2048
+ num = min;
2049
+ if (max !== undefined && num > max)
2050
+ num = max;
2051
+ const formatted = formatValue(num, true);
2052
+ if (formatted !== val) {
2053
+ e.target.value = formatted;
2054
+ const event = { ...e, target: e.target, type: "change" };
2055
+ onChange?.(event);
2056
+ }
2057
+ }
2058
+ onBlur?.(e);
2059
+ }
2060
+ const isStringIcon = typeof icon === "string";
2061
+ const resolvedIcon = isStringIcon ? icon : icon === true ? resolveIcon2(true, "banknote") : icon;
2062
+ return /* @__PURE__ */ jsxDEV3(Input2, {
2063
+ type: "text",
2064
+ inputMode: decimals > 0 ? "decimal" : "numeric",
2065
+ icon: resolvedIcon ?? undefined,
2066
+ className,
2067
+ onChange: handleChange,
2068
+ onBlur: handleBlur,
2069
+ ...props,
2070
+ value: finalValue,
2071
+ defaultValue: finalDefaultValue
2072
+ }, undefined, false, undefined, this);
2073
+ }
2074
+ function InputAlphanumeric2({
2075
+ className = "",
2076
+ onChange,
2077
+ allowSpace = false,
2078
+ icon = false,
2079
+ ...props
2080
+ }) {
2081
+ function handleChange(e) {
2082
+ const pattern = allowSpace ? /[^\p{L}\p{N} ]/gu : /[^\p{L}\p{N}]/gu;
2083
+ e.target.value = e.target.value.replace(pattern, "");
2084
+ onChange?.(e);
2085
+ }
2086
+ return /* @__PURE__ */ jsxDEV3(Input2, {
2087
+ type: "text",
2088
+ icon: resolveIcon2(icon, "text") ?? undefined,
2089
+ className,
2090
+ onChange: handleChange,
2091
+ ...props
2092
+ }, undefined, false, undefined, this);
2093
+ }
2094
+ var HEX_COLOR_REGEX = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/;
2095
+ function hexToRgb(hex) {
2096
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
2097
+ return result ? `${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)}` : "";
2098
+ }
2099
+ function rgbToHex(rgb) {
2100
+ const parts = rgb.split(",").map((s) => parseInt(s.trim(), 10));
2101
+ if (parts.length !== 3 || parts.some(isNaN))
2102
+ return null;
2103
+ const [r, g, b] = parts;
2104
+ return "#" + (1 << 24 | r << 16 | g << 8 | b).toString(16).slice(1).toUpperCase();
2105
+ }
2106
+ function InputColor2({
2107
+ value,
2108
+ onChange,
2109
+ className = "",
2110
+ name,
2111
+ disabled = false,
2112
+ required = false,
2113
+ icon = false,
2114
+ allowTransparent = false,
2115
+ alpha = false,
2116
+ hideInput = false,
2117
+ size = "default"
2118
+ }) {
2119
+ const [text, setText] = React3.useState(value);
2120
+ const [isOpen, setIsOpen] = React3.useState(false);
2121
+ const [colorMode, setColorMode] = React3.useState("HEX");
2122
+ const initialColor = React3.useRef(value);
2123
+ React3.useEffect(() => setText(value), [value]);
2124
+ React3.useEffect(() => {
2125
+ if (isOpen) {
2126
+ initialColor.current = value;
2127
+ }
2128
+ }, [isOpen, value]);
2129
+ function commitValue(raw) {
2130
+ let val = raw.trim().replace(/\s/g, "");
2131
+ if (val && !val.startsWith("#"))
2132
+ val = "#" + val;
2133
+ setText(val);
2134
+ if (HEX_COLOR_REGEX.test(val))
2135
+ onChange(val.toUpperCase());
2136
+ }
2137
+ const handleEyeDropper = async () => {
2138
+ if (!("EyeDropper" in window)) {
2139
+ alert("Browser Anda belum mendukung fitur EyeDropper.");
2140
+ return;
2141
+ }
2142
+ try {
2143
+ const eyeDropper = new window.EyeDropper;
2144
+ const result = await eyeDropper.open();
2145
+ if (result.sRGBHex) {
2146
+ onChange(result.sRGBHex.toUpperCase());
2147
+ setText(result.sRGBHex.toUpperCase());
2148
+ }
2149
+ } catch (e) {
2150
+ console.log("EyeDropper dibatalkan", e);
2151
+ }
2152
+ };
2153
+ const handleReset = () => {
2154
+ onChange(initialColor.current);
2155
+ setText(initialColor.current);
2156
+ };
2157
+ const isTransparent = allowTransparent && (!value || value === "transparent");
2158
+ const displayHex = isTransparent ? alpha ? "#00000000" : "#ffffff" : HEX_COLOR_REGEX.test(value) ? value : "#000000";
2159
+ const Picker = alpha ? HexAlphaColorPicker : HexColorPicker;
2160
+ const SIZES = { sm: "h-[30px]", default: "h-9", lg: "h-[42px]" };
2161
+ const BOX_SIZES = { sm: "h-[30px] w-[30px]", default: "h-9 w-9", lg: "h-[42px] w-[42px]" };
2162
+ return /* @__PURE__ */ jsxDEV3("div", {
2163
+ className: `flex items-stretch gap-2 ${className}`,
2164
+ children: [
2165
+ name && /* @__PURE__ */ jsxDEV3("input", {
2166
+ type: "hidden",
2167
+ name,
2168
+ value
2169
+ }, undefined, false, undefined, this),
2170
+ /* @__PURE__ */ jsxDEV3(Dropdown2, {
2171
+ open: isOpen,
2172
+ onOpenChange: setIsOpen,
2173
+ children: [
2174
+ /* @__PURE__ */ jsxDEV3(DropdownTrigger2, {
2175
+ className: `flex-none flex items-center ${SIZES[size]}`,
2176
+ children: /* @__PURE__ */ jsxDEV3("div", {
2177
+ className: `${BOX_SIZES[size]} flex-none rounded-md shadow-sm outline-none overflow-hidden relative ${disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"}`,
2178
+ title: "Pilih warna",
2179
+ children: [
2180
+ isTransparent ? /* @__PURE__ */ jsxDEV3("div", {
2181
+ className: "absolute inset-0 z-0 opacity-20 bg-[url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAIklEQVQIW2NkQAKrVq36zwjjgzhhYWGMYAEYB8RmROaABADeOQ8CXl/xfgAAAABJRU5ErkJggg==')] bg-repeat"
2182
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV3("div", {
2183
+ className: "absolute inset-0 z-10",
2184
+ style: { backgroundColor: displayHex }
2185
+ }, undefined, false, undefined, this),
2186
+ alpha && !isTransparent && /* @__PURE__ */ jsxDEV3("div", {
2187
+ className: "absolute inset-0 z-0 opacity-20 bg-[url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAIklEQVQIW2NkQAKrVq36zwjjgzhhYWGMYAEYB8RmROaABADeOQ8CXl/xfgAAAABJRU5ErkJggg==')] bg-repeat"
2188
+ }, undefined, false, undefined, this)
2189
+ ]
2190
+ }, undefined, true, undefined, this)
2191
+ }, undefined, false, undefined, this),
2192
+ !disabled && /* @__PURE__ */ jsxDEV3(DropdownContent2, {
2193
+ className: "min-w-0 w-[200px] p-3",
2194
+ children: /* @__PURE__ */ jsxDEV3("div", {
2195
+ className: "flex flex-col gap-3",
2196
+ children: [
2197
+ /* @__PURE__ */ jsxDEV3(Picker, {
2198
+ color: displayHex,
2199
+ onChange: (val) => {
2200
+ const upper = val.toUpperCase();
2201
+ onChange(upper);
2202
+ setText(upper);
2203
+ },
2204
+ style: { width: "100%" }
2205
+ }, undefined, false, undefined, this),
2206
+ /* @__PURE__ */ jsxDEV3("div", {
2207
+ className: "flex items-center gap-2",
2208
+ children: [
2209
+ /* @__PURE__ */ jsxDEV3(Button2, {
2210
+ variant: "ghost",
2211
+ size: "sm",
2212
+ onClick: () => setColorMode(colorMode === "HEX" ? "RGB" : "HEX"),
2213
+ className: "px-2 shrink-0",
2214
+ children: colorMode
2215
+ }, undefined, false, undefined, this),
2216
+ (() => {
2217
+ const canReset = Boolean(initialColor.current && initialColor.current.toLowerCase() !== value.toLowerCase() && !allowTransparent);
2218
+ const insideActions = /* @__PURE__ */ jsxDEV3("div", {
2219
+ className: "flex items-center gap-0.5",
2220
+ children: [
2221
+ canReset && /* @__PURE__ */ jsxDEV3(Button2, {
2222
+ type: "button",
2223
+ variant: "ghost",
2224
+ icon: "rotateCcw",
2225
+ onClick: handleReset,
2226
+ title: "Reset color"
2227
+ }, undefined, false, undefined, this),
2228
+ /* @__PURE__ */ jsxDEV3(Button2, {
2229
+ type: "button",
2230
+ variant: "ghost",
2231
+ icon: "pipette",
2232
+ onClick: handleEyeDropper,
2233
+ title: "Pick Color"
2234
+ }, undefined, false, undefined, this)
2235
+ ]
2236
+ }, undefined, true, undefined, this);
2237
+ const inputPad = "w-full min-w-0 uppercase";
2238
+ return colorMode === "HEX" ? /* @__PURE__ */ jsxDEV3(Input2, {
2239
+ inputSize: "sm",
2240
+ inputClassName: inputPad,
2241
+ value: displayHex.toUpperCase(),
2242
+ onChange: (e) => {
2243
+ let val = e.target.value.toUpperCase();
2244
+ if (!val.startsWith("#"))
2245
+ val = "#" + val.replace(/#/g, "");
2246
+ const maxLen = alpha ? 9 : 7;
2247
+ if (val.length <= maxLen && /^#[0-9A-F]*$/.test(val)) {
2248
+ setText(val);
2249
+ if (val.length === 7 || alpha && val.length === 9) {
2250
+ onChange(val);
2251
+ }
2252
+ }
2253
+ },
2254
+ buttonInside: insideActions
2255
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV3(Input2, {
2256
+ inputSize: "sm",
2257
+ inputClassName: inputPad,
2258
+ value: hexToRgb(displayHex),
2259
+ onChange: (e) => {
2260
+ const newHex = rgbToHex(e.target.value);
2261
+ if (newHex) {
2262
+ onChange(newHex);
2263
+ setText(newHex);
2264
+ }
2265
+ },
2266
+ buttonInside: insideActions
2267
+ }, undefined, false, undefined, this);
2268
+ })()
2269
+ ]
2270
+ }, undefined, true, undefined, this),
2271
+ allowTransparent && /* @__PURE__ */ jsxDEV3("div", {
2272
+ className: "flex items-center justify-end gap-2 pt-2 border-t border-[color:var(--color-border)]",
2273
+ children: /* @__PURE__ */ jsxDEV3(Button2, {
2274
+ variant: "ghost",
2275
+ size: "sm",
2276
+ className: "text-[color:var(--color-danger)] hover:text-[color:var(--color-danger)] hover:bg-[var(--color-danger)]/10",
2277
+ onClick: () => {
2278
+ onChange("transparent");
2279
+ setText("transparent");
2280
+ setIsOpen(false);
2281
+ },
2282
+ children: [
2283
+ /* @__PURE__ */ jsxDEV3(Icon2, {
2284
+ name: "X",
2285
+ size: 14
2286
+ }, undefined, false, undefined, this),
2287
+ "No Color"
2288
+ ]
2289
+ }, undefined, true, undefined, this)
2290
+ }, undefined, false, undefined, this)
2291
+ ]
2292
+ }, undefined, true, undefined, this)
2293
+ }, undefined, false, undefined, this)
2294
+ ]
2295
+ }, undefined, true, undefined, this),
2296
+ !hideInput && /* @__PURE__ */ jsxDEV3(Input2, {
2297
+ type: "text",
2298
+ inputSize: size,
2299
+ icon: resolveIcon2(icon, "color") ?? undefined,
2300
+ value: isTransparent ? "transparent" : text,
2301
+ onChange: (e) => {
2302
+ setText(e.target.value);
2303
+ },
2304
+ onBlur: () => commitValue(text),
2305
+ onKeyDown: (e) => {
2306
+ if (e.key === "Enter") {
2307
+ e.preventDefault();
2308
+ commitValue(text);
2309
+ }
2310
+ },
2311
+ disabled,
2312
+ required,
2313
+ placeholder: "#3377BB",
2314
+ className: `font-mono uppercase flex-1 ${!HEX_COLOR_REGEX.test(text) && text.length > 0 && text !== "transparent" ? "!border-[color:var(--color-danger)]" : ""}`
2315
+ }, undefined, false, undefined, this)
2316
+ ]
2317
+ }, undefined, true, undefined, this);
2318
+ }
2319
+ function InputUrl2({
2320
+ className = "",
2321
+ onBlur,
2322
+ onChange,
2323
+ errorMessage = "Format URL tidak valid.",
2324
+ icon = false,
2325
+ ...props
2326
+ }) {
2327
+ const [touched, setTouched] = React3.useState(false);
2328
+ const [internalValue, setInternalValue] = React3.useState(String(props.value ?? props.defaultValue ?? ""));
2329
+ const value = props.value !== undefined ? String(props.value) : internalValue;
2330
+ function isValidUrl(val) {
2331
+ if (!val)
2332
+ return true;
2333
+ try {
2334
+ new URL(val);
2335
+ return true;
2336
+ } catch {
2337
+ return false;
2338
+ }
2339
+ }
2340
+ const isInvalid = touched && value.length > 0 && !isValidUrl(value);
2341
+ return /* @__PURE__ */ jsxDEV3("div", {
2342
+ children: [
2343
+ /* @__PURE__ */ jsxDEV3("div", {
2344
+ className: "relative",
2345
+ children: /* @__PURE__ */ jsxDEV3(Input2, {
2346
+ type: "text",
2347
+ icon: resolveIcon2(icon, "link") ?? undefined,
2348
+ className: `${isInvalid ? "!border-[color:var(--color-danger)]" : ""} ${className}`,
2349
+ onChange: (e) => {
2350
+ setInternalValue(e.target.value);
2351
+ onChange?.(e);
2352
+ },
2353
+ onBlur: (e) => {
2354
+ let val = e.target.value;
2355
+ if (val && !/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//.test(val)) {
2356
+ val = "https://" + val;
2357
+ e.target.value = val;
2358
+ setInternalValue(val);
2359
+ onChange?.(e);
2360
+ }
2361
+ setTouched(true);
2362
+ onBlur?.(e);
2363
+ },
2364
+ ...props,
2365
+ value
2366
+ }, undefined, false, undefined, this)
2367
+ }, undefined, false, undefined, this),
2368
+ isInvalid && /* @__PURE__ */ jsxDEV3(InputErrorText2, {
2369
+ message: errorMessage
2370
+ }, undefined, false, undefined, this)
2371
+ ]
2372
+ }, undefined, true, undefined, this);
2373
+ }
2374
+ var SLIDER_DOT_SIZE = 13;
2375
+ var SLIDER_DOT_HOVER_SCALE = 1.15;
2376
+ function SliderDot({ isHovering, isDragging, side = "end" }) {
2377
+ return /* @__PURE__ */ jsxDEV3("div", {
2378
+ style: {
2379
+ width: SLIDER_DOT_SIZE,
2380
+ height: SLIDER_DOT_SIZE,
2381
+ marginLeft: side === "end" ? -SLIDER_DOT_SIZE / 2 : undefined,
2382
+ marginRight: side === "start" ? -SLIDER_DOT_SIZE / 2 : undefined,
2383
+ transform: `translateY(-50%) scale(${isHovering || isDragging ? SLIDER_DOT_HOVER_SCALE : 1})`,
2384
+ transitionDuration: isDragging ? "0ms" : "300ms",
2385
+ transitionTimingFunction: "cubic-bezier(0.34, 1.15, 0.64, 1)",
2386
+ transitionProperty: isDragging ? "none" : "transform"
2387
+ },
2388
+ className: `pointer-events-none absolute top-1/2 rounded-full bg-[var(--color-primary)] shadow-sm ${side === "end" ? "left-full" : "right-full"}`
2389
+ }, undefined, false, undefined, this);
2390
+ }
2391
+ function RangeSlider2({ className = "", ...props }) {
2392
+ const [internalValue, setInternalValue] = React3.useState(Number(props.defaultValue || props.value || 0));
2393
+ const [isDragging, setIsDragging] = React3.useState(false);
2394
+ const [isHovering, setIsHovering] = React3.useState(false);
2395
+ const trackRef = React3.useRef(null);
2396
+ const inputRef = React3.useRef(null);
2397
+ const dragTimeout = React3.useRef(null);
2398
+ React3.useEffect(() => {
2399
+ if (props.value !== undefined)
2400
+ setInternalValue(Number(props.value));
2401
+ }, [props.value]);
2402
+ function handleChange(e) {
2403
+ setInternalValue(Number(e.target.value));
2404
+ props.onChange?.(e);
2405
+ }
2406
+ function handlePointerDown() {
2407
+ dragTimeout.current = setTimeout(() => setIsDragging(true), 60);
2408
+ }
2409
+ function handlePointerUp() {
2410
+ if (dragTimeout.current)
2411
+ clearTimeout(dragTimeout.current);
2412
+ setIsDragging(false);
2413
+ }
2414
+ function handleTrackClick(e) {
2415
+ if (e.target.tagName.toLowerCase() === "input")
2416
+ return;
2417
+ if (!trackRef.current || !inputRef.current)
2418
+ return;
2419
+ const rect = trackRef.current.getBoundingClientRect();
2420
+ const clickPercent = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));
2421
+ const min = Number(props.min || 0);
2422
+ const max = Number(props.max || 100);
2423
+ const step = Number(props.step || 1);
2424
+ let clickedValue = min + (max - min) * clickPercent;
2425
+ if (step > 0) {
2426
+ clickedValue = Math.round((clickedValue - min) / step) * step + min;
2427
+ }
2428
+ clickedValue = Math.max(min, Math.min(max, clickedValue));
2429
+ setInternalValue(clickedValue);
2430
+ const nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set;
2431
+ nativeInputValueSetter?.call(inputRef.current, clickedValue);
2432
+ const event = new Event("input", { bubbles: true });
2433
+ inputRef.current.dispatchEvent(event);
2434
+ const changeEvent = new Event("change", { bubbles: true });
2435
+ inputRef.current.dispatchEvent(changeEvent);
2436
+ }
2437
+ const min = Number(props.min || 0);
2438
+ const max = Number(props.max || 100);
2439
+ const percentage = max > min ? (internalValue - min) / (max - min) * 100 : 0;
2440
+ return /* @__PURE__ */ jsxDEV3("div", {
2441
+ ref: trackRef,
2442
+ onPointerDown: handleTrackClick,
2443
+ className: `relative flex h-1.5 w-full cursor-pointer items-center rounded-lg bg-[var(--color-input-lighter)] ${className}`,
2444
+ onMouseEnter: () => setIsHovering(true),
2445
+ onMouseLeave: () => setIsHovering(false),
2446
+ children: [
2447
+ /* @__PURE__ */ jsxDEV3("div", {
2448
+ className: `absolute h-full rounded-lg bg-[var(--color-primary)] ${isDragging ? "" : "transition-all duration-300 ease-out"}`,
2449
+ style: { width: `${percentage}%` },
2450
+ children: /* @__PURE__ */ jsxDEV3(SliderDot, {
2451
+ isHovering,
2452
+ isDragging
2453
+ }, undefined, false, undefined, this)
2454
+ }, undefined, false, undefined, this),
2455
+ /* @__PURE__ */ jsxDEV3("input", {
2456
+ ref: inputRef,
2457
+ type: "range",
2458
+ ...props,
2459
+ "aria-label": props["aria-label"] || props.name || props.placeholder || "Slider",
2460
+ className: "pointer-events-none absolute z-10 h-1.5 w-full cursor-pointer appearance-none opacity-0 [&::-webkit-slider-thumb]:pointer-events-auto [&::-webkit-slider-thumb]:h-3.5 [&::-webkit-slider-thumb]:w-3.5 [&::-webkit-slider-thumb]:appearance-none [&::-moz-range-thumb]:pointer-events-auto [&::-moz-range-thumb]:h-3.5 [&::-moz-range-thumb]:w-3.5 [&::-moz-range-thumb]:appearance-none",
2461
+ value: props.value !== undefined ? props.value : internalValue,
2462
+ onChange: handleChange,
2463
+ onPointerDown: handlePointerDown,
2464
+ onPointerUp: handlePointerUp,
2465
+ onPointerCancel: handlePointerUp
2466
+ }, undefined, false, undefined, this)
2467
+ ]
2468
+ }, undefined, true, undefined, this);
2469
+ }
2470
+ function DualRangeSlider2({
2471
+ min,
2472
+ max,
2473
+ step,
2474
+ value,
2475
+ onChange,
2476
+ className = "",
2477
+ name
2478
+ }) {
2479
+ const [minVal, maxVal] = value;
2480
+ const [isDragging, setIsDragging] = React3.useState(false);
2481
+ const [isHovering, setIsHovering] = React3.useState(false);
2482
+ const trackRef = React3.useRef(null);
2483
+ function handlePointerDown() {
2484
+ setIsDragging(true);
2485
+ }
2486
+ function handlePointerUp() {
2487
+ setIsDragging(false);
2488
+ }
2489
+ function handleTrackClick(e) {
2490
+ if (e.target.tagName.toLowerCase() === "input")
2491
+ return;
2492
+ if (!trackRef.current)
2493
+ return;
2494
+ const rect = trackRef.current.getBoundingClientRect();
2495
+ const clickPercent = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));
2496
+ const clickedValue = Math.round(min + (max - min) * clickPercent);
2497
+ const distToMin = Math.abs(clickedValue - minVal);
2498
+ const distToMax = Math.abs(clickedValue - maxVal);
2499
+ if (distToMin < distToMax)
2500
+ onChange([Math.min(clickedValue, maxVal - 1), maxVal]);
2501
+ else
2502
+ onChange([minVal, Math.max(clickedValue, minVal + 1)]);
2503
+ }
2504
+ const minPercent = max > min ? (minVal - min) / (max - min) * 100 : 0;
2505
+ const maxPercent = max > min ? (maxVal - min) / (max - min) * 100 : 0;
2506
+ return /* @__PURE__ */ jsxDEV3("div", {
2507
+ ref: trackRef,
2508
+ onPointerDown: handleTrackClick,
2509
+ onMouseEnter: () => setIsHovering(true),
2510
+ onMouseLeave: () => setIsHovering(false),
2511
+ className: `relative flex h-1.5 w-full cursor-pointer items-center rounded-lg bg-[var(--color-input-lighter)] ${className}`,
2512
+ children: [
2513
+ /* @__PURE__ */ jsxDEV3("div", {
2514
+ className: `absolute h-full rounded-lg bg-[var(--color-primary)] ${isDragging ? "" : "transition-all duration-300 ease-out"}`,
2515
+ style: { left: `${minPercent}%`, width: `${maxPercent - minPercent}%` },
2516
+ children: [
2517
+ /* @__PURE__ */ jsxDEV3(SliderDot, {
2518
+ side: "start",
2519
+ isHovering,
2520
+ isDragging
2521
+ }, undefined, false, undefined, this),
2522
+ /* @__PURE__ */ jsxDEV3(SliderDot, {
2523
+ side: "end",
2524
+ isHovering,
2525
+ isDragging
2526
+ }, undefined, false, undefined, this)
2527
+ ]
2528
+ }, undefined, true, undefined, this),
2529
+ /* @__PURE__ */ jsxDEV3("input", {
2530
+ type: "range",
2531
+ name: name ? `${name}Min` : undefined,
2532
+ "aria-label": name ? `${name} minimum` : "Rentang nilai minimum",
2533
+ min,
2534
+ max,
2535
+ step,
2536
+ value: minVal,
2537
+ onPointerDown: handlePointerDown,
2538
+ onPointerUp: handlePointerUp,
2539
+ onPointerCancel: handlePointerUp,
2540
+ onChange: (e) => onChange([Math.min(Number(e.target.value), maxVal - 1), maxVal]),
2541
+ className: "pointer-events-none absolute z-20 h-1.5 w-full cursor-pointer appearance-none opacity-0 [&::-webkit-slider-thumb]:pointer-events-auto [&::-webkit-slider-thumb]:h-3.5 [&::-webkit-slider-thumb]:w-3.5 [&::-webkit-slider-thumb]:appearance-none [&::-moz-range-thumb]:pointer-events-auto [&::-moz-range-thumb]:h-3.5 [&::-moz-range-thumb]:w-3.5 [&::-moz-range-thumb]:appearance-none"
2542
+ }, undefined, false, undefined, this),
2543
+ /* @__PURE__ */ jsxDEV3("input", {
2544
+ type: "range",
2545
+ name: name ? `${name}Max` : undefined,
2546
+ "aria-label": name ? `${name} maksimum` : "Rentang nilai maksimum",
2547
+ min,
2548
+ max,
2549
+ step,
2550
+ value: maxVal,
2551
+ onPointerDown: handlePointerDown,
2552
+ onPointerUp: handlePointerUp,
2553
+ onPointerCancel: handlePointerUp,
2554
+ onChange: (e) => onChange([minVal, Math.max(Number(e.target.value), minVal + 1)]),
2555
+ className: "pointer-events-none absolute z-30 h-1.5 w-full cursor-pointer appearance-none opacity-0 [&::-webkit-slider-thumb]:pointer-events-auto [&::-webkit-slider-thumb]:h-3.5 [&::-webkit-slider-thumb]:w-3.5 [&::-webkit-slider-thumb]:appearance-none [&::-moz-range-thumb]:pointer-events-auto [&::-moz-range-thumb]:h-3.5 [&::-moz-range-thumb]:w-3.5 [&::-moz-range-thumb]:appearance-none"
2556
+ }, undefined, false, undefined, this)
2557
+ ]
2558
+ }, undefined, true, undefined, this);
2559
+ }
2560
+ function StepSlider2({
2561
+ steps,
2562
+ value,
2563
+ onChange,
2564
+ className = "",
2565
+ name
2566
+ }) {
2567
+ const [isDragging, setIsDragging] = React3.useState(false);
2568
+ const [isHovering, setIsHovering] = React3.useState(false);
2569
+ const dragTimeout = React3.useRef(null);
2570
+ const currentIndex = Math.max(0, steps.findIndex((s) => s.value === value));
2571
+ const percent = steps.length > 1 ? currentIndex / (steps.length - 1) * 100 : 0;
2572
+ function handlePointerDown() {
2573
+ dragTimeout.current = setTimeout(() => setIsDragging(true), 100);
2574
+ }
2575
+ function handlePointerUp() {
2576
+ if (dragTimeout.current)
2577
+ clearTimeout(dragTimeout.current);
2578
+ setIsDragging(false);
2579
+ }
2580
+ return /* @__PURE__ */ jsxDEV3("div", {
2581
+ className: `w-full ${className}`,
2582
+ children: [
2583
+ /* @__PURE__ */ jsxDEV3("div", {
2584
+ className: "relative flex h-1.5 w-full items-center rounded-lg bg-[var(--color-input-lighter)]",
2585
+ onMouseEnter: () => setIsHovering(true),
2586
+ onMouseLeave: () => setIsHovering(false),
2587
+ children: [
2588
+ /* @__PURE__ */ jsxDEV3("div", {
2589
+ className: `absolute h-full rounded-lg bg-[var(--color-primary)] ${isDragging ? "" : "transition-all duration-300 ease-out"}`,
2590
+ style: { width: `${percent}%` },
2591
+ children: /* @__PURE__ */ jsxDEV3(SliderDot, {
2592
+ isHovering,
2593
+ isDragging
2594
+ }, undefined, false, undefined, this)
2595
+ }, undefined, false, undefined, this),
2596
+ steps.map((step, idx) => {
2597
+ const stepPercent = steps.length > 1 ? idx / (steps.length - 1) * 100 : 0;
2598
+ const passed = idx <= currentIndex;
2599
+ return /* @__PURE__ */ jsxDEV3("div", {
2600
+ className: `pointer-events-none absolute h-2.5 w-2.5 -translate-x-1/2 rounded-full transition-colors duration-300 ${passed ? "bg-[var(--color-primary)]" : "bg-border"}`,
2601
+ style: { left: `${stepPercent}%` }
2602
+ }, step.value, false, undefined, this);
2603
+ }),
2604
+ /* @__PURE__ */ jsxDEV3("input", {
2605
+ type: "range",
2606
+ name,
2607
+ "aria-label": name || "Pilihan langkah nilai slider",
2608
+ min: 0,
2609
+ max: steps.length - 1,
2610
+ step: 1,
2611
+ value: currentIndex,
2612
+ onChange: (e) => onChange(steps[Number(e.target.value)].value),
2613
+ onPointerDown: handlePointerDown,
2614
+ onPointerUp: handlePointerUp,
2615
+ onPointerCancel: handlePointerUp,
2616
+ className: "absolute z-10 h-1.5 w-full cursor-pointer appearance-none opacity-0"
2617
+ }, undefined, false, undefined, this)
2618
+ ]
2619
+ }, undefined, true, undefined, this),
2620
+ /* @__PURE__ */ jsxDEV3("div", {
2621
+ className: "relative mt-2 h-4 w-full",
2622
+ children: steps.map((step, idx) => {
2623
+ const stepPercent = steps.length > 1 ? idx / (steps.length - 1) * 100 : 0;
2624
+ const translate = idx === 0 ? "0%" : idx === steps.length - 1 ? "-100%" : "-50%";
2625
+ return /* @__PURE__ */ jsxDEV3("span", {
2626
+ className: `absolute top-0 inline-block whitespace-nowrap text-[11px] transition-all duration-300 ${idx === currentIndex ? "scale-125 font-bold text-[color:var(--color-input-foreground)]" : "scale-100 font-medium text-[color:var(--color-text-color)]"}`,
2627
+ style: {
2628
+ left: `${stepPercent}%`,
2629
+ transform: `translateX(${translate})`,
2630
+ transitionTimingFunction: idx === currentIndex ? "cubic-bezier(0.34, 1.35, 0.64, 1)" : "ease-in"
2631
+ },
2632
+ children: step.label
2633
+ }, step.value, false, undefined, this);
2634
+ })
2635
+ }, undefined, false, undefined, this)
2636
+ ]
2637
+ }, undefined, true, undefined, this);
2638
+ }
2639
+ function RadioIndicator2({ checked, disabled = false }) {
2640
+ if (disabled) {
2641
+ return /* @__PURE__ */ jsxDEV3("div", {
2642
+ className: "h-4 w-4 rounded-full border border-[color:var(--color-border)] bg-[var(--color-muted)]"
2643
+ }, undefined, false, undefined, this);
2644
+ }
2645
+ return /* @__PURE__ */ jsxDEV3("div", {
2646
+ className: `flex h-4 w-4 flex-shrink-0 items-center justify-center rounded-full border transition-all duration-200 group-focus-within:border-[color:var(--color-primary)] group-focus-within:ring-[3px] group-focus-within:ring-[var(--color-primary-dimmy)] ${checked ? "border-[color:var(--color-primary)] bg-[var(--color-primary)] group-hover:bg-[var(--color-primary)]/90 group-hover:border-[color:var(--color-primary)]/90" : "border-[color:var(--color-border-field-normal)] bg-[var(--color-input)] group-hover:border-[color:var(--color-border-hover)]"}`,
2647
+ children: checked && /* @__PURE__ */ jsxDEV3("div", {
2648
+ className: "h-1.5 w-1.5 rounded-full bg-[var(--color-primary-foreground)]"
2649
+ }, undefined, false, undefined, this)
2650
+ }, undefined, false, undefined, this);
2651
+ }
2652
+ function Radio2({
2653
+ className = "",
2654
+ label,
2655
+ checked,
2656
+ disabled,
2657
+ onChange,
2658
+ ...props
2659
+ }) {
2660
+ return /* @__PURE__ */ jsxDEV3("label", {
2661
+ className: `group flex items-center gap-3 ${disabled ? "cursor-not-allowed opacity-60" : "cursor-pointer"} ${className}`,
2662
+ children: [
2663
+ /* @__PURE__ */ jsxDEV3("input", {
2664
+ type: "radio",
2665
+ className: "sr-only",
2666
+ checked,
2667
+ disabled,
2668
+ onChange,
2669
+ ...props
2670
+ }, undefined, false, undefined, this),
2671
+ /* @__PURE__ */ jsxDEV3(RadioIndicator2, {
2672
+ checked: Boolean(checked),
2673
+ disabled
2674
+ }, undefined, false, undefined, this),
2675
+ /* @__PURE__ */ jsxDEV3("span", {
2676
+ className: "text-sm text-[color:var(--color-input-foreground)]",
2677
+ children: label
2678
+ }, undefined, false, undefined, this)
2679
+ ]
2680
+ }, undefined, true, undefined, this);
2681
+ }
2682
+ function formatFileSize(bytes) {
2683
+ if (bytes < 1024)
2684
+ return `${bytes} B`;
2685
+ if (bytes < 1024 * 1024)
2686
+ return `${(bytes / 1024).toFixed(1)} KB`;
2687
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
2688
+ }
2689
+ function validateFile(file, accept, maxSizeMB) {
2690
+ if (accept) {
2691
+ const acceptedTypes = accept.split(",").map((t) => t.trim());
2692
+ const matches = acceptedTypes.some((pattern) => {
2693
+ if (pattern.endsWith("/*"))
2694
+ return file.type.startsWith(pattern.slice(0, -1));
2695
+ return file.type === pattern || file.name.toLowerCase().endsWith(pattern.toLowerCase());
2696
+ });
2697
+ if (!matches)
2698
+ return `Tipe file "${file.name}" tidak diizinkan (harus ${accept}).`;
2699
+ }
2700
+ if (maxSizeMB && file.size > maxSizeMB * 1024 * 1024) {
2701
+ return `Ukuran "${file.name}" (${formatFileSize(file.size)}) melebihi maksimal ${maxSizeMB}MB.`;
2702
+ }
2703
+ return null;
2704
+ }
2705
+ function FileInput2({
2706
+ className = "",
2707
+ uploadLabel = "+ Upload File",
2708
+ helperText = "JPG, PNG, PDF (Maks 2MB)",
2709
+ file,
2710
+ variant = "dropzone",
2711
+ onRemove,
2712
+ maxSizeMB,
2713
+ onError,
2714
+ onChange,
2715
+ ...props
2716
+ }) {
2717
+ const [preview, setPreview] = React3.useState(null);
2718
+ function handleFileChange(e) {
2719
+ const picked = e.target.files?.[0];
2720
+ if (!picked)
2721
+ return onChange?.(e);
2722
+ const error = validateFile(picked, props.accept, maxSizeMB);
2723
+ if (error) {
2724
+ onError?.(error);
2725
+ e.target.value = "";
2726
+ return;
2727
+ }
2728
+ onChange?.(e);
2729
+ }
2730
+ React3.useEffect(() => {
2731
+ if (!file || variant !== "dropzone") {
2732
+ setPreview(null);
2733
+ return;
2734
+ }
2735
+ if (file.type.startsWith("image/") || file.type.startsWith("video/") || file.type === "application/pdf") {
2736
+ const objectUrl = URL.createObjectURL(file);
2737
+ setPreview(objectUrl);
2738
+ return () => URL.revokeObjectURL(objectUrl);
2739
+ }
2740
+ setPreview(null);
2741
+ }, [file, variant]);
2742
+ if (variant === "classic") {
2743
+ return /* @__PURE__ */ jsxDEV3("label", {
2744
+ tabIndex: 0,
2745
+ className: `group flex h-9 w-full cursor-pointer items-center gap-2.5 rounded-md border border-[color:var(--color-border-field-normal)] bg-[var(--color-input)] px-3 text-[13px] transition-all duration-200 hover:border-[color:var(--color-border-hover)] focus:outline-none focus:border-[color:var(--color-primary)] focus:ring-[length:var(--ui-focus-ring-width,3px)] focus:ring-[color:var(--ui-focus-ring-color,var(--color-primary-dimmy))] ${className}`,
2746
+ children: [
2747
+ /* @__PURE__ */ jsxDEV3(FileIcon, {
2748
+ size: 16,
2749
+ className: "flex-none text-[color:var(--color-text-color)]"
2750
+ }, undefined, false, undefined, this),
2751
+ file ? /* @__PURE__ */ jsxDEV3("span", {
2752
+ className: "flex min-w-0 flex-1 items-baseline gap-2",
2753
+ children: [
2754
+ /* @__PURE__ */ jsxDEV3("span", {
2755
+ className: "truncate font-medium text-[color:var(--color-input-foreground)]",
2756
+ children: file.name
2757
+ }, undefined, false, undefined, this),
2758
+ /* @__PURE__ */ jsxDEV3("span", {
2759
+ className: "flex-none text-xs text-[color:var(--color-text-color)]",
2760
+ children: formatFileSize(file.size)
2761
+ }, undefined, false, undefined, this)
2762
+ ]
2763
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV3("span", {
2764
+ className: "flex-1 text-[color:var(--color-text-color)]",
2765
+ children: uploadLabel.replace(/^\+\s*/, "")
2766
+ }, undefined, false, undefined, this),
2767
+ /* @__PURE__ */ jsxDEV3("input", {
2768
+ type: "file",
2769
+ className: "hidden",
2770
+ ...props,
2771
+ onChange: handleFileChange
2772
+ }, undefined, false, undefined, this),
2773
+ file && onRemove ? /* @__PURE__ */ jsxDEV3(Button2, {
2774
+ type: "button",
2775
+ variant: "ghost",
2776
+ size: "icon-sm",
2777
+ onClick: (e) => {
2778
+ e.preventDefault();
2779
+ onRemove();
2780
+ },
2781
+ className: "flex-none text-[color:var(--color-text-color)]",
2782
+ children: [
2783
+ /* @__PURE__ */ jsxDEV3("span", {
2784
+ className: "sr-only",
2785
+ children: "Hapus file"
2786
+ }, undefined, false, undefined, this),
2787
+ /* @__PURE__ */ jsxDEV3(X2, {
2788
+ size: 14
2789
+ }, undefined, false, undefined, this)
2790
+ ]
2791
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV3("span", {
2792
+ className: "flex-none text-xs font-medium text-[color:var(--color-primary)]",
2793
+ children: "Browse"
2794
+ }, undefined, false, undefined, this)
2795
+ ]
2796
+ }, undefined, true, undefined, this);
2797
+ }
2798
+ return /* @__PURE__ */ jsxDEV3("label", {
2799
+ tabIndex: 0,
2800
+ className: `group relative flex w-full cursor-pointer flex-col items-center justify-center rounded-md border border-[color:var(--color-border-field-normal)] bg-[var(--color-input)] p-4 text-[color:var(--color-text-color)] transition-all duration-200 hover:border-[color:var(--color-border-hover)] focus:outline-none focus:border-[color:var(--color-primary)] focus:ring-[length:var(--ui-focus-ring-width,3px)] focus:ring-[color:var(--ui-focus-ring-color,var(--color-primary-dimmy))] ${className}`,
2801
+ children: [
2802
+ !preview && /* @__PURE__ */ jsxDEV3(Fragment2, {
2803
+ children: [
2804
+ /* @__PURE__ */ jsxDEV3("span", {
2805
+ className: "text-xs font-medium",
2806
+ children: uploadLabel
2807
+ }, undefined, false, undefined, this),
2808
+ helperText && /* @__PURE__ */ jsxDEV3("span", {
2809
+ className: "mt-1 text-[10px] text-[color:var(--color-text-color)]/70",
2810
+ children: helperText
2811
+ }, undefined, false, undefined, this)
2812
+ ]
2813
+ }, undefined, true, undefined, this),
2814
+ /* @__PURE__ */ jsxDEV3("input", {
2815
+ type: "file",
2816
+ className: "hidden",
2817
+ ...props,
2818
+ onChange: handleFileChange
2819
+ }, undefined, false, undefined, this),
2820
+ preview && /* @__PURE__ */ jsxDEV3("div", {
2821
+ className: "checkerboard-bg relative mt-2 w-full overflow-hidden rounded-md border border-[color:var(--color-border-field-normal)] p-1",
2822
+ children: file?.type === "application/pdf" ? /* @__PURE__ */ jsxDEV3("embed", {
2823
+ src: preview,
2824
+ type: "application/pdf",
2825
+ className: "h-48 w-full rounded"
2826
+ }, undefined, false, undefined, this) : file?.type.startsWith("video/") ? /* @__PURE__ */ jsxDEV3("video", {
2827
+ src: preview,
2828
+ controls: true,
2829
+ className: "h-48 w-full rounded object-contain"
2830
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV3("img", {
2831
+ src: preview,
2832
+ alt: "Preview",
2833
+ className: "h-32 w-full rounded object-contain"
2834
+ }, undefined, false, undefined, this)
2835
+ }, undefined, false, undefined, this),
2836
+ file && /* @__PURE__ */ jsxDEV3("div", {
2837
+ className: "mt-2 flex w-full max-w-full items-center gap-2 px-2",
2838
+ children: [
2839
+ /* @__PURE__ */ jsxDEV3("div", {
2840
+ className: "min-w-0 flex-1 text-center",
2841
+ children: [
2842
+ /* @__PURE__ */ jsxDEV3("div", {
2843
+ className: "truncate text-xs font-bold text-[color:var(--color-primary)]",
2844
+ children: file.name
2845
+ }, undefined, false, undefined, this),
2846
+ /* @__PURE__ */ jsxDEV3("div", {
2847
+ className: "text-[10.5px] text-[color:var(--color-text-color)]",
2848
+ children: formatFileSize(file.size)
2849
+ }, undefined, false, undefined, this)
2850
+ ]
2851
+ }, undefined, true, undefined, this),
2852
+ onRemove && /* @__PURE__ */ jsxDEV3(Button2, {
2853
+ type: "button",
2854
+ variant: "ghost",
2855
+ size: "icon-sm",
2856
+ onClick: (e) => {
2857
+ e.preventDefault();
2858
+ onRemove();
2859
+ },
2860
+ className: "flex-none text-[color:var(--color-text-color)]",
2861
+ children: [
2862
+ /* @__PURE__ */ jsxDEV3("span", {
2863
+ className: "sr-only",
2864
+ children: "Hapus file"
2865
+ }, undefined, false, undefined, this),
2866
+ /* @__PURE__ */ jsxDEV3(X2, {
2867
+ size: 14
2868
+ }, undefined, false, undefined, this)
2869
+ ]
2870
+ }, undefined, true, undefined, this)
2871
+ ]
2872
+ }, undefined, true, undefined, this)
2873
+ ]
2874
+ }, undefined, true, undefined, this);
2875
+ }
2876
+ function FileInputMultiple2({
2877
+ className = "",
2878
+ uploadLabel = "+ Upload File (bisa lebih dari 1)",
2879
+ helperText,
2880
+ accept,
2881
+ files,
2882
+ onChange,
2883
+ maxSizeMB,
2884
+ maxFiles,
2885
+ minFiles,
2886
+ onError,
2887
+ disabled = false
2888
+ }) {
2889
+ const [isDragOver, setIsDragOver] = React3.useState(false);
2890
+ function addFiles(fileList) {
2891
+ if (disabled || !fileList)
2892
+ return;
2893
+ const incoming = Array.from(fileList);
2894
+ const remainingQuota = maxFiles !== undefined ? Math.max(0, maxFiles - files.length) : Infinity;
2895
+ const accepted = [];
2896
+ const errors = [];
2897
+ for (const f of incoming) {
2898
+ if (accepted.length >= remainingQuota) {
2899
+ errors.push(`Batas maksimal ${maxFiles} file tercapai, "${f.name}" tidak ditambahkan.`);
2900
+ continue;
2901
+ }
2902
+ const error = validateFile(f, accept, maxSizeMB);
2903
+ if (error) {
2904
+ errors.push(error);
2905
+ continue;
2906
+ }
2907
+ accepted.push(f);
2908
+ }
2909
+ if (accepted.length)
2910
+ onChange([...files, ...accepted]);
2911
+ if (errors.length)
2912
+ onError?.(errors);
2913
+ }
2914
+ function removeAt(idx) {
2915
+ onChange(files.filter((_, i) => i !== idx));
2916
+ }
2917
+ return /* @__PURE__ */ jsxDEV3("div", {
2918
+ className: `w-full ${className}`,
2919
+ children: [
2920
+ /* @__PURE__ */ jsxDEV3("label", {
2921
+ tabIndex: disabled ? -1 : 0,
2922
+ onDragOver: (e) => {
2923
+ if (disabled)
2924
+ return;
2925
+ e.preventDefault();
2926
+ setIsDragOver(true);
2927
+ },
2928
+ onDragLeave: () => setIsDragOver(false),
2929
+ onDrop: (e) => {
2930
+ e.preventDefault();
2931
+ setIsDragOver(false);
2932
+ addFiles(e.dataTransfer.files);
2933
+ },
2934
+ className: `flex w-full flex-col items-center justify-center rounded-md border p-6 text-center transition-all duration-200 focus:outline-none focus:border-[color:var(--color-primary)] focus:ring-[length:var(--ui-focus-ring-width,3px)] focus:ring-[color:var(--ui-focus-ring-color,var(--color-primary-dimmy))] ${disabled ? "cursor-not-allowed border-[color:var(--color-border-field-normal)] bg-[var(--color-input)] text-[color:var(--color-text-color)] opacity-50" : `cursor-pointer text-[color:var(--color-text-color)] ${isDragOver ? "border-[color:var(--color-primary)] bg-[var(--color-primary)]/5" : "border-[color:var(--color-border-field-normal)] bg-[var(--color-input)] hover:border-[color:var(--color-border-hover)] hover:bg-hover"}`}`,
2935
+ children: [
2936
+ /* @__PURE__ */ jsxDEV3("span", {
2937
+ className: "text-xs font-medium",
2938
+ children: uploadLabel
2939
+ }, undefined, false, undefined, this),
2940
+ helperText && /* @__PURE__ */ jsxDEV3("span", {
2941
+ className: "mt-1 text-[10px] text-[color:var(--color-text-color)]/70",
2942
+ children: helperText
2943
+ }, undefined, false, undefined, this),
2944
+ /* @__PURE__ */ jsxDEV3("span", {
2945
+ className: "mt-1 text-[10px] text-[color:var(--color-text-color)]/70",
2946
+ children: "Drag & drop di sini, atau klik untuk pilih file"
2947
+ }, undefined, false, undefined, this),
2948
+ (minFiles !== undefined || maxFiles !== undefined) && /* @__PURE__ */ jsxDEV3("span", {
2949
+ className: "mt-1 text-[10px] text-[color:var(--color-text-color)]/70",
2950
+ children: [
2951
+ minFiles !== undefined && maxFiles !== undefined ? `${minFiles}-${maxFiles} file` : maxFiles !== undefined ? `Maks ${maxFiles} file` : `Min ${minFiles} file`,
2952
+ " -- ",
2953
+ files.length,
2954
+ " terpilih"
2955
+ ]
2956
+ }, undefined, true, undefined, this),
2957
+ /* @__PURE__ */ jsxDEV3("input", {
2958
+ type: "file",
2959
+ multiple: true,
2960
+ accept,
2961
+ disabled,
2962
+ className: "hidden",
2963
+ onChange: (e) => addFiles(e.target.files)
2964
+ }, undefined, false, undefined, this)
2965
+ ]
2966
+ }, undefined, true, undefined, this),
2967
+ files.length > 0 && /* @__PURE__ */ jsxDEV3("div", {
2968
+ className: "mt-3 flex flex-col gap-1.5",
2969
+ children: files.map((f, idx) => /* @__PURE__ */ jsxDEV3("div", {
2970
+ className: "flex items-center gap-2.5 rounded-md border border-[color:var(--color-border-field-normal)] bg-[var(--color-input)] px-3 py-2 text-sm",
2971
+ children: [
2972
+ /* @__PURE__ */ jsxDEV3(FileIcon, {
2973
+ size: 16,
2974
+ className: "flex-none text-[color:var(--color-text-color)]"
2975
+ }, undefined, false, undefined, this),
2976
+ /* @__PURE__ */ jsxDEV3("span", {
2977
+ className: "min-w-0 flex-1 truncate font-medium text-[color:var(--color-input-foreground)]",
2978
+ children: f.name
2979
+ }, undefined, false, undefined, this),
2980
+ /* @__PURE__ */ jsxDEV3("span", {
2981
+ className: "flex-none text-xs text-[color:var(--color-text-color)]",
2982
+ children: formatFileSize(f.size)
2983
+ }, undefined, false, undefined, this),
2984
+ /* @__PURE__ */ jsxDEV3(Button2, {
2985
+ type: "button",
2986
+ variant: "ghost",
2987
+ size: "icon-sm",
2988
+ onClick: () => removeAt(idx),
2989
+ disabled,
2990
+ className: "flex-none text-[color:var(--color-text-color)]",
2991
+ children: [
2992
+ /* @__PURE__ */ jsxDEV3("span", {
2993
+ className: "sr-only",
2994
+ children: "Hapus file"
2995
+ }, undefined, false, undefined, this),
2996
+ /* @__PURE__ */ jsxDEV3(X2, {
2997
+ size: 14
2998
+ }, undefined, false, undefined, this)
2999
+ ]
3000
+ }, undefined, true, undefined, this)
3001
+ ]
3002
+ }, `${f.name}-${idx}`, true, undefined, this))
3003
+ }, undefined, false, undefined, this)
3004
+ ]
3005
+ }, undefined, true, undefined, this);
3006
+ }
3007
+ function TagInput2({
3008
+ options,
3009
+ value,
3010
+ onChange,
3011
+ placeholder = "Pilih...",
3012
+ maxTags,
3013
+ onError,
3014
+ className = "",
3015
+ name
3016
+ }) {
3017
+ const [query, setQuery] = React3.useState("");
3018
+ const [isOpen, setIsOpen] = React3.useState(false);
3019
+ const [activeIndex, setActiveIndex] = React3.useState(0);
3020
+ const containerRef = React3.useRef(null);
3021
+ const menuRef = React3.useRef(null);
3022
+ const inputRef = React3.useRef(null);
3023
+ const [isUp, setIsUp] = React3.useState(false);
3024
+ const [menuPos, setMenuPos] = React3.useState(null);
3025
+ const selectableOptions = options.filter((o) => !value.includes(o.value));
3026
+ const filteredOptions = query === "" ? selectableOptions : selectableOptions.filter((o) => o.label.toLowerCase().includes(query.toLowerCase()));
3027
+ React3.useLayoutEffect(() => {
3028
+ if (!isOpen || !containerRef.current) {
3029
+ if (!isOpen)
3030
+ setIsUp(false);
3031
+ return;
3032
+ }
3033
+ function reposition() {
3034
+ if (!containerRef.current)
3035
+ return;
3036
+ const rect = containerRef.current.getBoundingClientRect();
3037
+ const estimatedHeight = Math.min((filteredOptions.length || 1) * 36 + 16, 260);
3038
+ const menuHeight = menuRef.current?.offsetHeight || estimatedHeight;
3039
+ const spaceBelow = window.innerHeight - rect.bottom;
3040
+ const spaceAbove = rect.top;
3041
+ const flipUp = spaceBelow < menuHeight + 12 && spaceAbove > spaceBelow;
3042
+ setIsUp(flipUp);
3043
+ setMenuPos({
3044
+ left: rect.left,
3045
+ width: rect.width,
3046
+ top: rect.bottom,
3047
+ bottomOffset: window.innerHeight - rect.top,
3048
+ spaceAbove,
3049
+ spaceBelow
3050
+ });
3051
+ }
3052
+ reposition();
3053
+ window.addEventListener("scroll", reposition, true);
3054
+ window.addEventListener("resize", reposition);
3055
+ return () => {
3056
+ window.removeEventListener("scroll", reposition, true);
3057
+ window.removeEventListener("resize", reposition);
3058
+ };
3059
+ }, [isOpen, filteredOptions.length]);
3060
+ React3.useEffect(() => {
3061
+ if (!isOpen)
3062
+ return;
3063
+ function handleClick(e) {
3064
+ const target = e.target;
3065
+ if (containerRef.current?.contains(target))
3066
+ return;
3067
+ if (menuRef.current?.contains(target))
3068
+ return;
3069
+ setIsOpen(false);
3070
+ setQuery("");
3071
+ }
3072
+ document.addEventListener("mousedown", handleClick);
3073
+ return () => document.removeEventListener("mousedown", handleClick);
3074
+ }, [isOpen]);
3075
+ function selectOption(option) {
3076
+ if (maxTags !== undefined && value.length >= maxTags) {
3077
+ onError?.(`Batas maksimal ${maxTags} tag tercapai, "${option.label}" tidak ditambahkan.`);
3078
+ return;
3079
+ }
3080
+ onChange([...value, option.value]);
3081
+ setQuery("");
3082
+ setActiveIndex(0);
3083
+ inputRef.current?.focus();
3084
+ }
3085
+ function removeAt(idx) {
3086
+ onChange(value.filter((_, i) => i !== idx));
3087
+ }
3088
+ function handleKeyDown(e) {
3089
+ if (e.key === "ArrowDown") {
3090
+ e.preventDefault();
3091
+ if (!isOpen) {
3092
+ setIsOpen(true);
3093
+ return;
3094
+ }
3095
+ setActiveIndex((prev) => Math.min(prev + 1, filteredOptions.length - 1));
3096
+ } else if (e.key === "ArrowUp") {
3097
+ e.preventDefault();
3098
+ setActiveIndex((prev) => Math.max(prev - 1, 0));
3099
+ } else if (e.key === "Enter") {
3100
+ e.preventDefault();
3101
+ if (isOpen && filteredOptions[activeIndex])
3102
+ selectOption(filteredOptions[activeIndex]);
3103
+ } else if (e.key === "Escape") {
3104
+ setIsOpen(false);
3105
+ setQuery("");
3106
+ } else if (e.key === "Backspace" && query === "" && value.length > 0) {
3107
+ removeAt(value.length - 1);
3108
+ }
3109
+ }
3110
+ const menu = isOpen && menuPos && /* @__PURE__ */ jsxDEV3("div", {
3111
+ ref: menuRef,
3112
+ style: {
3113
+ position: "fixed",
3114
+ left: menuPos.left,
3115
+ minWidth: menuPos.width,
3116
+ width: "max-content",
3117
+ maxWidth: `min(90vw, max(${menuPos.width}px, 480px))`,
3118
+ maxHeight: isUp ? Math.min(menuPos.spaceAbove - 16, 260) : Math.min(menuPos.spaceBelow - 16, 260),
3119
+ boxShadow: isUp ? "var(--ui-shadow-up-lg, 0 -10px 15px -3px rgba(0, 0, 0, 0.1), 0 -4px 6px -4px rgba(0, 0, 0, 0.05))" : "var(--ui-shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05))",
3120
+ ...isUp ? { bottom: menuPos.bottomOffset } : { top: menuPos.top }
3121
+ },
3122
+ className: `z-[120] flex flex-col overflow-hidden rounded-md border border-[color:var(--color-border-field-normal)] bg-[var(--color-card)] text-[color:var(--color-foreground)] ${isUp ? "mb-1" : "mt-1"}`,
3123
+ children: /* @__PURE__ */ jsxDEV3("div", {
3124
+ className: "flex flex-1 min-h-0 flex-col gap-0.5 overflow-y-auto p-1",
3125
+ children: filteredOptions.length === 0 ? /* @__PURE__ */ jsxDEV3("div", {
3126
+ className: "px-3 py-2 text-xs text-[color:var(--color-text-color)]",
3127
+ children: query !== "" ? "Tidak ditemukan." : "Semua opsi sudah dipilih."
3128
+ }, undefined, false, undefined, this) : filteredOptions.map((option, idx) => /* @__PURE__ */ jsxDEV3("div", {
3129
+ onMouseDown: (e) => e.preventDefault(),
3130
+ onMouseEnter: () => setActiveIndex(idx),
3131
+ children: /* @__PURE__ */ jsxDEV3(SelectOptionRow2, {
3132
+ option: { value: option.value, name: option.label },
3133
+ isSelected: false,
3134
+ isActive: idx === activeIndex,
3135
+ onClick: () => selectOption(option)
3136
+ }, undefined, false, undefined, this)
3137
+ }, option.value, false, undefined, this))
3138
+ }, undefined, false, undefined, this)
3139
+ }, undefined, false, undefined, this);
3140
+ return /* @__PURE__ */ jsxDEV3("div", {
3141
+ ref: containerRef,
3142
+ className: `relative ${className}`,
3143
+ children: [
3144
+ name && /* @__PURE__ */ jsxDEV3("input", {
3145
+ type: "hidden",
3146
+ name,
3147
+ value: value.join(",")
3148
+ }, undefined, false, undefined, this),
3149
+ /* @__PURE__ */ jsxDEV3("div", {
3150
+ onClick: () => inputRef.current?.focus(),
3151
+ className: `flex min-h-9 w-full flex-wrap items-center gap-1.5 rounded-md border border-[color:var(--color-border-field-normal)] bg-[var(--color-input)] px-2 py-1.5 transition-all duration-200 hover:border-[color:var(--color-border-hover)] focus-within:border-[color:var(--color-primary)] focus-within:ring-[length:var(--ui-focus-ring-width,3px)] focus-within:ring-[color:var(--ui-focus-ring-color,var(--color-primary-dimmy))] ${!options.length ? "cursor-not-allowed opacity-70" : ""}`,
3152
+ children: [
3153
+ value.map((v, idx) => {
3154
+ const option = options.find((o) => o.value === v);
3155
+ return /* @__PURE__ */ jsxDEV3("span", {
3156
+ className: "flex items-center gap-1 rounded-md bg-[var(--color-secondary)] py-0.5 pl-2 pr-1 text-[13px] text-[color:var(--color-secondary-foreground)]",
3157
+ children: [
3158
+ option?.label ?? v,
3159
+ /* @__PURE__ */ jsxDEV3("button", {
3160
+ type: "button",
3161
+ onClick: (e) => {
3162
+ e.stopPropagation();
3163
+ removeAt(idx);
3164
+ },
3165
+ className: "flex h-[18px] w-[18px] flex-none items-center justify-center rounded-full text-[color:var(--color-secondary-foreground)] opacity-70 hover:opacity-100 hover:bg-[var(--color-input)] hover:text-[color:var(--color-input-foreground)] focus:outline-none",
3166
+ children: [
3167
+ /* @__PURE__ */ jsxDEV3("span", {
3168
+ className: "sr-only",
3169
+ children: [
3170
+ "Hapus ",
3171
+ option?.label ?? v
3172
+ ]
3173
+ }, undefined, true, undefined, this),
3174
+ /* @__PURE__ */ jsxDEV3(X2, {
3175
+ size: 11
3176
+ }, undefined, false, undefined, this)
3177
+ ]
3178
+ }, undefined, true, undefined, this)
3179
+ ]
3180
+ }, v, true, undefined, this);
3181
+ }),
3182
+ /* @__PURE__ */ jsxDEV3("input", {
3183
+ ref: inputRef,
3184
+ type: "text",
3185
+ value: query,
3186
+ onChange: (e) => {
3187
+ setQuery(e.target.value);
3188
+ setActiveIndex(0);
3189
+ if (!isOpen)
3190
+ setIsOpen(true);
3191
+ },
3192
+ onFocus: () => setIsOpen(true),
3193
+ onKeyDown: handleKeyDown,
3194
+ placeholder: value.length === 0 ? placeholder : "",
3195
+ className: "min-w-[80px] flex-1 border-none bg-transparent text-[13px] text-[color:var(--color-input-foreground)] outline-none placeholder:text-[color:var(--color-text-color)]"
3196
+ }, undefined, false, undefined, this)
3197
+ ]
3198
+ }, undefined, true, undefined, this),
3199
+ typeof document !== "undefined" && menu && createPortal3(menu, document.body)
3200
+ ]
3201
+ }, undefined, true, undefined, this);
3202
+ }
3203
+ var PREFIX_INPUT_ICON_SIZE = { sm: 13, default: 16, lg: 16 };
3204
+ var PREFIX_INPUT_ICON_LEFT = { sm: 8, default: 12, lg: 14 };
3205
+ var PREFIX_INPUT_DIVIDER_HEIGHT = { sm: 28, default: 34, lg: 40 };
3206
+ function PrefixInput2({
3207
+ prefixNode,
3208
+ prefixClassName = "",
3209
+ className = "",
3210
+ inputSize = "default",
3211
+ icon = false,
3212
+ ...props
3213
+ }) {
3214
+ const heightClass = inputSize === "sm" ? "h-[30px]" : inputSize === "lg" ? "h-[42px]" : "h-9";
3215
+ const isStringIcon = typeof icon === "string";
3216
+ const Icon = isStringIcon ? null : resolveIcon2(icon, "text");
3217
+ const hasIcon = Icon || isStringIcon;
3218
+ const prefixTextRef = React3.useRef(null);
3219
+ const [prefixTextLeft, setPrefixTextLeft] = React3.useState(0);
3220
+ const [inputPaddingLeft, setInputPaddingLeft] = React3.useState(0);
3221
+ React3.useLayoutEffect(() => {
3222
+ const iconLeft = PREFIX_INPUT_ICON_LEFT[inputSize];
3223
+ const iconSize = PREFIX_INPUT_ICON_SIZE[inputSize];
3224
+ const gapAfterIcon = 8;
3225
+ const textLeft = hasIcon ? iconLeft + iconSize + gapAfterIcon : iconLeft;
3226
+ setPrefixTextLeft(textLeft);
3227
+ const textWidth = prefixTextRef.current?.getBoundingClientRect().width ?? 0;
3228
+ setInputPaddingLeft(textLeft + textWidth + 10);
3229
+ }, [Icon, inputSize, prefixNode]);
3230
+ if (hasIcon) {
3231
+ return /* @__PURE__ */ jsxDEV3("div", {
3232
+ className: `relative w-full ${className}`,
3233
+ children: [
3234
+ isStringIcon ? /* @__PURE__ */ jsxDEV3("span", {
3235
+ className: "pointer-events-none absolute top-1/2 -translate-y-1/2 text-[13px] font-medium text-[color:var(--color-text-color)]",
3236
+ style: { left: PREFIX_INPUT_ICON_LEFT[inputSize] },
3237
+ children: icon
3238
+ }, undefined, false, undefined, this) : Icon ? /* @__PURE__ */ jsxDEV3(Icon, {
3239
+ size: PREFIX_INPUT_ICON_SIZE[inputSize],
3240
+ className: "pointer-events-none absolute top-1/2 -translate-y-1/2 text-[color:var(--color-text-color)]",
3241
+ style: { left: PREFIX_INPUT_ICON_LEFT[inputSize] }
3242
+ }, undefined, false, undefined, this) : null,
3243
+ /* @__PURE__ */ jsxDEV3("span", {
3244
+ ref: prefixTextRef,
3245
+ className: `pointer-events-none absolute top-1/2 flex items-center whitespace-nowrap border-r border-[color:var(--color-border-field-normal)] pr-3 text-[13px] text-[color:var(--color-text-color)] ${prefixClassName}`,
3246
+ style: { left: prefixTextLeft, height: PREFIX_INPUT_DIVIDER_HEIGHT[inputSize], transform: "translateY(calc(-53% + 1px))" },
3247
+ children: prefixNode
3248
+ }, undefined, false, undefined, this),
3249
+ /* @__PURE__ */ jsxDEV3(Input2, {
3250
+ inputSize,
3251
+ ...props,
3252
+ style: { paddingLeft: inputPaddingLeft || undefined, ...props.style }
3253
+ }, undefined, false, undefined, this)
3254
+ ]
3255
+ }, undefined, true, undefined, this);
3256
+ }
3257
+ return /* @__PURE__ */ jsxDEV3("div", {
3258
+ className: `flex w-full items-stretch ${className}`,
3259
+ children: [
3260
+ /* @__PURE__ */ jsxDEV3("div", {
3261
+ className: `flex ${heightClass} flex-none items-center justify-center rounded-l-md border border-r-0 border-[color:var(--color-border-field-normal)] bg-[var(--color-input)] px-3 text-[13px] text-[color:var(--color-input-foreground)] ${prefixClassName}`,
3262
+ children: prefixNode
3263
+ }, undefined, false, undefined, this),
3264
+ /* @__PURE__ */ jsxDEV3(Input2, {
3265
+ inputSize,
3266
+ ...props,
3267
+ className: "!rounded-l-none"
3268
+ }, undefined, false, undefined, this)
3269
+ ]
3270
+ }, undefined, true, undefined, this);
3271
+ }
3272
+
3273
+ export { PortalTooltip2, getDropdownAnimationClass2, DROPDOWN_ANIMATION_OPTIONS2, RadioCard2, CheckboxCard2, getSelectOptionLabel2, SelectOptionRow2, Select2, SelectInput2, SelectPill2, PillList2, SelectPillList2, SelectColor2, Textarea2, SelectNative2, CheckboxIndicator2, Checkbox2, MultiSelect2, SelectGroup2, SegmentedControl2, Switch2, FilterSelection2, NumberRangeInput2, PhoneInput2, InputErrorText2, InputPassword2, PasswordText2, InputEmail2, InputNumber2, InputCurrency2, InputAlphanumeric2, InputColor2, InputUrl2, RangeSlider2, DualRangeSlider2, StepSlider2, RadioIndicator2, Radio2, FileInput2, FileInputMultiple2, TagInput2, PrefixInput2 };
3274
+
3275
+ //# debugId=ED2156C1302D3BB764756E2164756E21