@customafk/lunas-ui 0.0.26 → 0.0.28

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 (364) hide show
  1. package/dist/{alert-dialog-D-oR0YW3.cjs → alert-dialog-26JyobJb.cjs} +1 -1
  2. package/dist/{alert-dialog-D-oR0YW3.cjs.map → alert-dialog-26JyobJb.cjs.map} +1 -1
  3. package/dist/{alert-dialog-CNHyP_A9.js → alert-dialog-Dv0cgymS.js} +1 -1
  4. package/dist/{alert-dialog-CNHyP_A9.js.map → alert-dialog-Dv0cgymS.js.map} +1 -1
  5. package/dist/{button-BmBtMriU.d.ts → button-CPBLm_02.d.ts} +5 -5
  6. package/dist/{button-tCnJHt8O.d.cts → button-ghXW1WTr.d.cts} +5 -5
  7. package/dist/{calendar-CbuOOMpK.js → calendar-B66UT_fu.js} +1 -1
  8. package/dist/{calendar-CbuOOMpK.js.map → calendar-B66UT_fu.js.map} +1 -1
  9. package/dist/{calendar-B8IKzrdN.cjs → calendar-DXegnGRJ.cjs} +1 -1
  10. package/dist/{calendar-B8IKzrdN.cjs.map → calendar-DXegnGRJ.cjs.map} +1 -1
  11. package/dist/{command-Dr2XmKV6.d.cts → command-CE_Qcgo7.d.ts} +12 -12
  12. package/dist/{command-Dvq-HZwH.d.ts → command-CiEjoEnP.d.cts} +12 -12
  13. package/dist/{command-TFZwJmux.js → command-Dbkg10QA.js} +2 -2
  14. package/dist/{command-TFZwJmux.js.map → command-Dbkg10QA.js.map} +1 -1
  15. package/dist/{command-CoB5R5FI.cjs → command-IL3ogESu.cjs} +2 -2
  16. package/dist/{command-CoB5R5FI.cjs.map → command-IL3ogESu.cjs.map} +1 -1
  17. package/dist/data-display/empty.d.cts +2 -2
  18. package/dist/data-display/statistic.d.cts +2 -2
  19. package/dist/data-display/statistic.d.ts +2 -2
  20. package/dist/{dialog-CSDDiHKO.js → dialog-BEdMA5Lp.js} +1 -1
  21. package/dist/{dialog-CSDDiHKO.js.map → dialog-BEdMA5Lp.js.map} +1 -1
  22. package/dist/{dialog-C-DYoapJ.d.ts → dialog-Bw_T5aco.d.cts} +12 -12
  23. package/dist/{dialog-_Cgij9NP.cjs → dialog-C4oHnJNN.cjs} +1 -1
  24. package/dist/{dialog-_Cgij9NP.cjs.map → dialog-C4oHnJNN.cjs.map} +1 -1
  25. package/dist/{dialog-CA0E_tNX.d.cts → dialog-CoH1pTBH.d.ts} +12 -12
  26. package/dist/dialogs/confirm-dialog.cjs +1 -1
  27. package/dist/dialogs/confirm-dialog.js +1 -1
  28. package/dist/dialogs/detail-dialog/component/sidebar.d.cts +4 -4
  29. package/dist/dialogs/detail-dialog/component/sidebar.d.ts +28 -28
  30. package/dist/dialogs/detail-dialog/index.cjs +1 -1
  31. package/dist/dialogs/detail-dialog/index.js +1 -1
  32. package/dist/dialogs/error-dialog.cjs +1 -1
  33. package/dist/dialogs/error-dialog.js +1 -1
  34. package/dist/dialogs/form-dialog.cjs +1 -1
  35. package/dist/dialogs/form-dialog.d.cts +2 -2
  36. package/dist/dialogs/form-dialog.d.ts +2 -2
  37. package/dist/dialogs/form-dialog.js +1 -1
  38. package/dist/dialogs/loading-dialog.cjs +1 -1
  39. package/dist/dialogs/loading-dialog.js +1 -1
  40. package/dist/{error-dialog-D5R5le-W.cjs → error-dialog-C0PDn-pj.cjs} +2 -2
  41. package/dist/{error-dialog-D5R5le-W.cjs.map → error-dialog-C0PDn-pj.cjs.map} +1 -1
  42. package/dist/{error-dialog-Q99thrSD.js → error-dialog-CCdQ8zbQ.js} +2 -2
  43. package/dist/{error-dialog-Q99thrSD.js.map → error-dialog-CCdQ8zbQ.js.map} +1 -1
  44. package/dist/{form-wrapper-CY-stRaQ.cjs → form-wrapper-Cd8c5MIL.cjs} +2 -2
  45. package/dist/{form-wrapper-CY-stRaQ.cjs.map → form-wrapper-Cd8c5MIL.cjs.map} +1 -1
  46. package/dist/{form-wrapper-C2xlvWx0.js → form-wrapper-DntbFqN1.js} +2 -2
  47. package/dist/{form-wrapper-C2xlvWx0.js.map → form-wrapper-DntbFqN1.js.map} +1 -1
  48. package/dist/forms/combobox-field.cjs +1 -1
  49. package/dist/forms/combobox-field.d.cts +2 -2
  50. package/dist/forms/combobox-field.d.ts +2 -2
  51. package/dist/forms/combobox-field.js +1 -1
  52. package/dist/forms/date-field.cjs +1 -1
  53. package/dist/forms/date-field.d.cts +2 -2
  54. package/dist/forms/date-field.d.ts +2 -2
  55. package/dist/forms/date-field.js +1 -1
  56. package/dist/forms/form-wrapper.cjs +1 -1
  57. package/dist/forms/form-wrapper.d.cts +2 -2
  58. package/dist/forms/form-wrapper.d.ts +2 -2
  59. package/dist/forms/form-wrapper.js +1 -1
  60. package/dist/forms/multi-select-field.cjs +1 -1
  61. package/dist/forms/multi-select-field.cjs.map +1 -1
  62. package/dist/forms/multi-select-field.d.cts +2 -2
  63. package/dist/forms/multi-select-field.d.ts +2 -2
  64. package/dist/forms/multi-select-field.js +1 -1
  65. package/dist/forms/number-field.d.cts +2 -2
  66. package/dist/forms/number-field.d.ts +2 -2
  67. package/dist/forms/password-field.d.cts +2 -2
  68. package/dist/forms/password-field.d.ts +2 -2
  69. package/dist/forms/select-field.d.cts +2 -2
  70. package/dist/forms/select-field.d.ts +2 -2
  71. package/dist/forms/switch-field.d.cts +2 -2
  72. package/dist/forms/switch-field.d.ts +2 -2
  73. package/dist/forms/text-field.d.cts +2 -2
  74. package/dist/forms/text-field.d.ts +2 -2
  75. package/dist/forms/textarea-field.d.cts +2 -2
  76. package/dist/forms/textarea-field.d.ts +2 -2
  77. package/dist/{input-CjNcnHb_.d.ts → input-CUDclgoU.d.ts} +3 -3
  78. package/dist/{input-BsXm0_Iq.d.cts → input-y_n-XGys.d.cts} +3 -3
  79. package/dist/layouts/app-layout/index.d.cts +5 -5
  80. package/dist/layouts/app-layout/index.d.ts +3 -3
  81. package/dist/layouts/flex.d.cts +4 -4
  82. package/dist/layouts/flex.d.ts +4 -4
  83. package/dist/layouts/main/index.d.cts +4 -4
  84. package/dist/layouts/main/index.d.ts +4 -4
  85. package/dist/{multi-select-Cjvm4tK5.cjs → multi-select-3yxD9gbY.cjs} +2 -2
  86. package/dist/{multi-select-Cjvm4tK5.cjs.map → multi-select-3yxD9gbY.cjs.map} +1 -1
  87. package/dist/{multi-select-D0bZVOnm.js → multi-select-Cb07NlA7.js} +2 -2
  88. package/dist/{multi-select-D0bZVOnm.js.map → multi-select-Cb07NlA7.js.map} +1 -1
  89. package/dist/{popover-CTFp7ZXi.js → popover-CqAD7HNo.js} +1 -1
  90. package/dist/{popover-CTFp7ZXi.js.map → popover-CqAD7HNo.js.map} +1 -1
  91. package/dist/{popover-DCcPvdz2.cjs → popover-Dd0acCEk.cjs} +1 -1
  92. package/dist/{popover-DCcPvdz2.cjs.map → popover-Dd0acCEk.cjs.map} +1 -1
  93. package/dist/{separator-5FdzRGaJ.d.ts → separator-BLYi41aC.d.ts} +3 -3
  94. package/dist/{separator-DpxrpK_H.d.cts → separator-ClGBPiYE.d.cts} +3 -3
  95. package/dist/table/index.d.cts +2 -2
  96. package/dist/table/index.d.ts +2 -2
  97. package/dist/{toggle-Cx9H5u3p.d.cts → toggle-BWQWsKMA.d.ts} +4 -4
  98. package/dist/{toggle-DH9IssyE.d.ts → toggle-DnGvFJh8.d.cts} +4 -4
  99. package/dist/{tooltip-Djh_dcy5.d.ts → tooltip-Bk8VwHdM.d.ts} +6 -6
  100. package/dist/{tooltip-BAtWdJyX.d.cts → tooltip-cisSpCHG.d.cts} +6 -6
  101. package/dist/typography/paragraph.d.cts +2 -2
  102. package/dist/typography/paragraph.d.ts +2 -2
  103. package/dist/typography/title.d.cts +2 -2
  104. package/dist/typography/title.d.ts +2 -2
  105. package/dist/ui/alert-dialog.cjs +1 -1
  106. package/dist/ui/alert-dialog.d.cts +12 -12
  107. package/dist/ui/alert-dialog.d.ts +12 -12
  108. package/dist/ui/alert-dialog.js +1 -1
  109. package/dist/ui/alert.d.cts +6 -6
  110. package/dist/ui/alert.d.ts +6 -6
  111. package/dist/ui/aspect-ratio.d.cts +2 -2
  112. package/dist/ui/aspect-ratio.d.ts +2 -2
  113. package/dist/ui/avatar.d.cts +4 -4
  114. package/dist/ui/avatar.d.ts +4 -4
  115. package/dist/ui/badge.d.cts +2 -2
  116. package/dist/ui/badge.d.ts +4 -4
  117. package/dist/ui/breadcrumb.d.cts +8 -8
  118. package/dist/ui/breadcrumb.d.ts +8 -8
  119. package/dist/ui/button.d.cts +1 -1
  120. package/dist/ui/button.d.ts +1 -1
  121. package/dist/ui/calendar.cjs +1 -1
  122. package/dist/ui/calendar.d.cts +4 -4
  123. package/dist/ui/calendar.d.ts +4 -4
  124. package/dist/ui/calendar.js +1 -1
  125. package/dist/ui/card.d.cts +8 -8
  126. package/dist/ui/card.d.ts +8 -8
  127. package/dist/ui/carousel.d.cts +7 -7
  128. package/dist/ui/carousel.d.ts +7 -7
  129. package/dist/ui/collapsible.d.cts +4 -4
  130. package/dist/ui/collapsible.d.ts +4 -4
  131. package/dist/ui/command.cjs +1 -1
  132. package/dist/ui/command.d.cts +2 -2
  133. package/dist/ui/command.d.ts +2 -2
  134. package/dist/ui/command.js +1 -1
  135. package/dist/ui/context-menu.d.cts +16 -16
  136. package/dist/ui/context-menu.d.ts +16 -16
  137. package/dist/ui/dialog.cjs +1 -1
  138. package/dist/ui/dialog.d.cts +1 -1
  139. package/dist/ui/dialog.d.ts +1 -1
  140. package/dist/ui/dialog.js +1 -1
  141. package/dist/ui/dropdown-menu.d.cts +16 -16
  142. package/dist/ui/dropdown-menu.d.ts +16 -16
  143. package/dist/ui/file-uploader.d.cts +2 -2
  144. package/dist/ui/file-uploader.d.ts +2 -2
  145. package/dist/ui/form.d.cts +7 -7
  146. package/dist/ui/form.d.ts +7 -7
  147. package/dist/ui/hover-card.d.cts +4 -4
  148. package/dist/ui/hover-card.d.ts +4 -4
  149. package/dist/ui/input-otp.d.cts +5 -5
  150. package/dist/ui/input-otp.d.ts +5 -5
  151. package/dist/ui/input.d.cts +1 -1
  152. package/dist/ui/input.d.ts +1 -1
  153. package/dist/ui/inputs/search-input.d.cts +1 -1
  154. package/dist/ui/inputs/search-input.d.ts +3 -3
  155. package/dist/ui/label.d.cts +2 -2
  156. package/dist/ui/label.d.ts +2 -2
  157. package/dist/ui/menubar.d.cts +17 -17
  158. package/dist/ui/menubar.d.ts +17 -17
  159. package/dist/ui/multi-select.cjs +1 -1
  160. package/dist/ui/multi-select.d.cts +2 -2
  161. package/dist/ui/multi-select.d.ts +2 -2
  162. package/dist/ui/multi-select.js +1 -1
  163. package/dist/ui/navigation-menu.d.cts +11 -11
  164. package/dist/ui/navigation-menu.d.ts +9 -9
  165. package/dist/ui/pagination.d.cts +9 -9
  166. package/dist/ui/pagination.d.ts +9 -9
  167. package/dist/ui/popover.cjs +1 -1
  168. package/dist/ui/popover.d.cts +5 -5
  169. package/dist/ui/popover.d.ts +5 -5
  170. package/dist/ui/popover.js +1 -1
  171. package/dist/ui/progress.d.cts +2 -2
  172. package/dist/ui/progress.d.ts +2 -2
  173. package/dist/ui/radio-group.d.cts +3 -3
  174. package/dist/ui/radio-group.d.ts +3 -3
  175. package/dist/ui/resizable.d.cts +4 -4
  176. package/dist/ui/resizable.d.ts +4 -4
  177. package/dist/ui/scroll-area.d.ts +3 -3
  178. package/dist/ui/select.d.cts +11 -11
  179. package/dist/ui/select.d.ts +11 -11
  180. package/dist/ui/separator.d.cts +1 -1
  181. package/dist/ui/separator.d.ts +1 -1
  182. package/dist/ui/sheet.d.cts +9 -9
  183. package/dist/ui/sheet.d.ts +9 -9
  184. package/dist/ui/sidebar.d.cts +30 -30
  185. package/dist/ui/sidebar.d.ts +30 -30
  186. package/dist/ui/skeleton.d.cts +2 -2
  187. package/dist/ui/skeleton.d.ts +2 -2
  188. package/dist/ui/slider.d.cts +2 -2
  189. package/dist/ui/slider.d.ts +2 -2
  190. package/dist/ui/sonner.d.cts +2 -2
  191. package/dist/ui/sonner.d.ts +2 -2
  192. package/dist/ui/switch.d.cts +2 -2
  193. package/dist/ui/switch.d.ts +2 -2
  194. package/dist/ui/table.d.cts +9 -9
  195. package/dist/ui/table.d.ts +9 -9
  196. package/dist/ui/tabs.d.cts +5 -5
  197. package/dist/ui/tabs.d.ts +5 -5
  198. package/dist/ui/textarea.d.cts +2 -2
  199. package/dist/ui/textarea.d.ts +2 -2
  200. package/dist/ui/toggle-group.d.cts +4 -4
  201. package/dist/ui/toggle-group.d.ts +4 -4
  202. package/dist/ui/toggle.d.cts +1 -1
  203. package/dist/ui/toggle.d.ts +1 -1
  204. package/dist/ui/tooltip.d.cts +1 -1
  205. package/dist/ui/tooltip.d.ts +1 -1
  206. package/package.json +6 -2
  207. package/styles/base.css +29 -0
  208. package/styles/loader.css +113 -0
  209. package/styles/theme.css +104 -0
  210. package/styles/typography.css +6 -0
  211. package/packages/components/cards/simple-card.tsx +0 -23
  212. package/packages/components/data-display/country.tsx +0 -53
  213. package/packages/components/data-display/data-list.tsx +0 -29
  214. package/packages/components/data-display/date-tooltip.tsx +0 -23
  215. package/packages/components/data-display/date.tsx +0 -157
  216. package/packages/components/data-display/empty.tsx +0 -13
  217. package/packages/components/data-display/name.tsx +0 -23
  218. package/packages/components/data-display/phone-number.tsx +0 -14
  219. package/packages/components/data-display/role-badge.tsx +0 -29
  220. package/packages/components/data-display/statistic.tsx +0 -139
  221. package/packages/components/dialogs/confirm-dialog.tsx +0 -44
  222. package/packages/components/dialogs/detail-dialog/component/header.tsx +0 -10
  223. package/packages/components/dialogs/detail-dialog/component/main.tsx +0 -35
  224. package/packages/components/dialogs/detail-dialog/component/sidebar.tsx +0 -618
  225. package/packages/components/dialogs/detail-dialog/component/wrapper.tsx +0 -15
  226. package/packages/components/dialogs/detail-dialog/index.tsx +0 -91
  227. package/packages/components/dialogs/error-dialog.tsx +0 -34
  228. package/packages/components/dialogs/form-dialog.tsx +0 -74
  229. package/packages/components/dialogs/loading-dialog.tsx +0 -20
  230. package/packages/components/forms/combobox-field.tsx +0 -104
  231. package/packages/components/forms/date-field.tsx +0 -62
  232. package/packages/components/forms/form-wrapper.tsx +0 -120
  233. package/packages/components/forms/multi-select-field.tsx +0 -56
  234. package/packages/components/forms/number-field.tsx +0 -54
  235. package/packages/components/forms/password-field.tsx +0 -38
  236. package/packages/components/forms/select-field.tsx +0 -58
  237. package/packages/components/forms/switch-field.tsx +0 -40
  238. package/packages/components/forms/text-field.tsx +0 -73
  239. package/packages/components/forms/textarea-field.tsx +0 -45
  240. package/packages/components/index.tsx +0 -0
  241. package/packages/components/layouts/app-layout/index.tsx +0 -74
  242. package/packages/components/layouts/app-layout/sidebar.tsx +0 -663
  243. package/packages/components/layouts/flex.tsx +0 -99
  244. package/packages/components/layouts/main/content.tsx +0 -11
  245. package/packages/components/layouts/main/header.tsx +0 -41
  246. package/packages/components/layouts/main/index.tsx +0 -3
  247. package/packages/components/layouts/main/wrapper.tsx +0 -5
  248. package/packages/components/table/data-table-pagination.tsx +0 -70
  249. package/packages/components/table/data-table.tsx +0 -241
  250. package/packages/components/table/index.tsx +0 -107
  251. package/packages/components/typography/paragraph.tsx +0 -29
  252. package/packages/components/typography/title.tsx +0 -31
  253. package/packages/components/ui/alert-dialog.tsx +0 -99
  254. package/packages/components/ui/alert.tsx +0 -44
  255. package/packages/components/ui/aspect-ratio.tsx +0 -11
  256. package/packages/components/ui/avatar.tsx +0 -25
  257. package/packages/components/ui/badge.tsx +0 -57
  258. package/packages/components/ui/breadcrumb.tsx +0 -74
  259. package/packages/components/ui/button.tsx +0 -205
  260. package/packages/components/ui/buttons/add-new.tsx +0 -19
  261. package/packages/components/ui/buttons/edit.tsx +0 -14
  262. package/packages/components/ui/buttons/refresh.tsx +0 -19
  263. package/packages/components/ui/buttons/trash.tsx +0 -14
  264. package/packages/components/ui/buttons/upload-image.tsx +0 -25
  265. package/packages/components/ui/calendar.tsx +0 -141
  266. package/packages/components/ui/card.tsx +0 -44
  267. package/packages/components/ui/carousel.tsx +0 -187
  268. package/packages/components/ui/checkbox.tsx +0 -34
  269. package/packages/components/ui/collapsible.tsx +0 -17
  270. package/packages/components/ui/command.tsx +0 -138
  271. package/packages/components/ui/context-menu.tsx +0 -196
  272. package/packages/components/ui/dialog.tsx +0 -119
  273. package/packages/components/ui/dropdown-menu.tsx +0 -249
  274. package/packages/components/ui/file-uploader.tsx +0 -314
  275. package/packages/components/ui/form.tsx +0 -104
  276. package/packages/components/ui/hover-card.tsx +0 -32
  277. package/packages/components/ui/input-otp.tsx +0 -67
  278. package/packages/components/ui/input.tsx +0 -59
  279. package/packages/components/ui/inputs/number-input.tsx +0 -317
  280. package/packages/components/ui/inputs/password-input.tsx +0 -29
  281. package/packages/components/ui/inputs/search-input.tsx +0 -24
  282. package/packages/components/ui/label.tsx +0 -26
  283. package/packages/components/ui/menubar.tsx +0 -212
  284. package/packages/components/ui/multi-select.tsx +0 -626
  285. package/packages/components/ui/navigation-menu.tsx +0 -124
  286. package/packages/components/ui/pagination.tsx +0 -70
  287. package/packages/components/ui/popover.tsx +0 -49
  288. package/packages/components/ui/progress.tsx +0 -19
  289. package/packages/components/ui/radio-group.tsx +0 -36
  290. package/packages/components/ui/resizable.tsx +0 -47
  291. package/packages/components/ui/scroll-area.tsx +0 -35
  292. package/packages/components/ui/select.tsx +0 -199
  293. package/packages/components/ui/separator.tsx +0 -25
  294. package/packages/components/ui/sheet.tsx +0 -119
  295. package/packages/components/ui/sidebar.tsx +0 -675
  296. package/packages/components/ui/skeleton.tsx +0 -8
  297. package/packages/components/ui/slider.tsx +0 -45
  298. package/packages/components/ui/sonner.tsx +0 -40
  299. package/packages/components/ui/switch.tsx +0 -46
  300. package/packages/components/ui/table.tsx +0 -66
  301. package/packages/components/ui/tabs.tsx +0 -53
  302. package/packages/components/ui/textarea.tsx +0 -46
  303. package/packages/components/ui/toggle-group.tsx +0 -63
  304. package/packages/components/ui/toggle.tsx +0 -34
  305. package/packages/components/ui/tooltip.tsx +0 -53
  306. package/packages/constants.tsx +0 -45
  307. package/packages/hooks/use-callback-ref.ts +0 -22
  308. package/packages/hooks/use-controllable-state.ts +0 -58
  309. package/packages/hooks/use-mobile.ts +0 -19
  310. package/packages/index.css +0 -133
  311. package/packages/lib/utils.ts +0 -24
  312. package/packages/stories/1.Guideline.mdx +0 -3
  313. package/packages/stories/2.Colors.mdx +0 -145
  314. package/packages/stories/3.Pypography.mdx +0 -51
  315. package/packages/stories/cards/simple-card.stories.tsx +0 -24
  316. package/packages/stories/data-display/data-list.stories.tsx +0 -22
  317. package/packages/stories/data-display/empty.stories.tsx +0 -13
  318. package/packages/stories/data-display/form-dialog.stories.tsx +0 -27
  319. package/packages/stories/data-display/name.stories.tsx +0 -25
  320. package/packages/stories/data-display/phone-number.stories.tsx +0 -17
  321. package/packages/stories/data-display/statistic.stories.tsx +0 -41
  322. package/packages/stories/dialogs/confirm-dialog.stories.tsx +0 -26
  323. package/packages/stories/dialogs/detail-dialog.stories.tsx +0 -34
  324. package/packages/stories/dialogs/error-dialog.stories.tsx +0 -27
  325. package/packages/stories/dialogs/loading-dialog.stories.tsx +0 -16
  326. package/packages/stories/forms/combobox-field.stories.tsx +0 -38
  327. package/packages/stories/forms/form-wrapper.stories.tsx +0 -59
  328. package/packages/stories/forms/multi-select-field.stories.tsx +0 -42
  329. package/packages/stories/forms/number-field.stories.tsx +0 -35
  330. package/packages/stories/forms/select-field.stories.tsx +0 -39
  331. package/packages/stories/forms/switch-field.stories.tsx +0 -36
  332. package/packages/stories/forms/text-field.stories.tsx +0 -41
  333. package/packages/stories/forms/textarea-field.stories.tsx +0 -34
  334. package/packages/stories/layouts/app-layout.stories.tsx +0 -49
  335. package/packages/stories/typography/paragraph.stories.tsx +0 -45
  336. package/packages/stories/typography/title.stories.tsx +0 -39
  337. package/packages/stories/ui/alert-dialog.stories.tsx +0 -49
  338. package/packages/stories/ui/alert.stories.tsx +0 -63
  339. package/packages/stories/ui/aspect-ratio.stories.tsx +0 -22
  340. package/packages/stories/ui/badge.stories.tsx +0 -170
  341. package/packages/stories/ui/breadcrumb.stories.tsx +0 -172
  342. package/packages/stories/ui/button.stories.tsx +0 -181
  343. package/packages/stories/ui/card.stories.tsx +0 -58
  344. package/packages/stories/ui/checkbox.stories.tsx +0 -48
  345. package/packages/stories/ui/command.stories.tsx +0 -58
  346. package/packages/stories/ui/dialog.stories.tsx +0 -55
  347. package/packages/stories/ui/dropdown-menu.stories.tsx +0 -89
  348. package/packages/stories/ui/file-uploader.stories.tsx +0 -18
  349. package/packages/stories/ui/input.stories.tsx +0 -38
  350. package/packages/stories/ui/label.stories.tsx +0 -17
  351. package/packages/stories/ui/multi-select.stories.tsx +0 -29
  352. package/packages/stories/ui/popover.stories.tsx +0 -52
  353. package/packages/stories/ui/progress.stories.tsx +0 -17
  354. package/packages/stories/ui/radio-group.stories.tsx +0 -31
  355. package/packages/stories/ui/select.stories.tsx +0 -31
  356. package/packages/stories/ui/separator.stories.tsx +0 -31
  357. package/packages/stories/ui/sheet.stories.tsx +0 -50
  358. package/packages/stories/ui/skeleton.stories.tsx +0 -27
  359. package/packages/stories/ui/switch.stories.tsx +0 -21
  360. package/packages/stories/ui/table.stories.tsx +0 -82
  361. package/packages/stories/ui/tabs.stories.tsx +0 -70
  362. package/packages/stories/ui/textarea.stories.tsx +0 -15
  363. package/packages/stories/ui/toaster.stories.tsx +0 -87
  364. package/packages/types.ts +0 -50
@@ -1,626 +0,0 @@
1
- 'use client'
2
- import React from 'react'
3
- import { Command as CommandPrimitive, useCommandState } from 'cmdk'
4
- import { PlusIcon, X } from 'lucide-react'
5
-
6
- import { Command, CommandGroup, CommandItem, CommandList, CommandSeparator } from '@/components/ui/command'
7
- import { Button } from '@/components/ui/button'
8
- import { cn } from '@/lib/utils'
9
-
10
- export interface Option {
11
- value: string
12
- label: string
13
- disable?: boolean
14
- /** fixed option that can‘t be removed. */
15
- fixed?: boolean
16
- /** Group the options by providing key. */
17
- [key: string]: string | boolean | undefined
18
- }
19
- interface GroupOption {
20
- [key: string]: Option[]
21
- }
22
-
23
- interface MultipleSelectorProps {
24
- value?: Option[]
25
- defaultOptions?: Option[]
26
- /** manually controlled options */
27
- options?: Option[]
28
- placeholder?: string
29
- /** Loading component. */
30
- loadingIndicator?: React.ReactNode
31
- /** Empty component. */
32
- emptyIndicator?: React.ReactNode
33
- /** Debounce time for async search. Only work with `onSearch`. */
34
- delay?: number
35
- /**
36
- * Only work with `onSearch` prop. Trigger search when `onFocus`.
37
- * For example, when user click on the input, it will trigger the search to get initial options.
38
- **/
39
- triggerSearchOnFocus?: boolean
40
- /** async search */
41
- onSearch?: (value: string) => Promise<Option[]>
42
- /**
43
- * sync search. This search will not showing loadingIndicator.
44
- * The rest props are the same as async search.
45
- * i.e.: creatable, groupBy, delay.
46
- **/
47
- onSearchSync?: (value: string) => Option[]
48
- onChange?: (options: Option[]) => void
49
- /** Limit the maximum number of selected options. */
50
- maxSelected?: number
51
- /** When the number of selected options exceeds the limit, the onMaxSelected will be called. */
52
- onMaxSelected?: (maxLimit: number) => void
53
- /** Hide the placeholder when there are options selected. */
54
- hidePlaceholderWhenSelected?: boolean
55
- disabled?: boolean
56
- /** Group the options base on provided key. */
57
- groupBy?: string
58
- className?: string
59
- badgeClassName?: string
60
- /**
61
- * First item selected is a default behavior by cmdk. That is why the default is true.
62
- * This is a workaround solution by add a dummy item.
63
- *
64
- * @reference: https://github.com/pacocoursey/cmdk/issues/171
65
- */
66
- selectFirstItem?: boolean
67
- /** Allow user to create option when there is no option matched. */
68
- creatable?: boolean
69
- /** Props of `Command` */
70
- commandProps?: React.ComponentPropsWithoutRef<typeof Command>
71
- /** Props of `CommandInput` */
72
- inputProps?: Omit<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>, 'value' | 'placeholder' | 'disabled'>
73
- /** hide the clear all button. */
74
- hideClearAllButton?: boolean
75
-
76
- /** Add new item event for select with search */
77
- onAddNewItem?: () => void
78
- }
79
-
80
- export interface MultipleSelectorRef {
81
- selectedValue: Option[]
82
- input: HTMLInputElement
83
- focus: () => void
84
- reset: () => void
85
- }
86
-
87
- // eslint-disable-next-line react-refresh/only-export-components
88
- export function useDebounce<T>(value: T, delay?: number): T {
89
- const [debouncedValue, setDebouncedValue] = React.useState<T>(value)
90
-
91
- React.useEffect(() => {
92
- const timer = setTimeout(() => setDebouncedValue(value), delay || 500)
93
-
94
- return () => {
95
- clearTimeout(timer)
96
- }
97
- }, [value, delay])
98
-
99
- return debouncedValue
100
- }
101
-
102
- function transToGroupOption(options: Option[], groupBy?: string) {
103
- if (options.length === 0) {
104
- return {}
105
- }
106
- if (!groupBy) {
107
- return {
108
- '': options,
109
- }
110
- }
111
-
112
- const groupOption: GroupOption = {}
113
- options.forEach((option) => {
114
- const key = (option[groupBy] as string) || ''
115
- if (!groupOption[key]) {
116
- groupOption[key] = []
117
- }
118
- groupOption[key].push(option)
119
- })
120
- return groupOption
121
- }
122
-
123
- function removePickedOption(groupOption: GroupOption, picked: Option[]) {
124
- const cloneOption = JSON.parse(JSON.stringify(groupOption)) as GroupOption
125
-
126
- for (const [key, value] of Object.entries(cloneOption)) {
127
- cloneOption[key] = value.filter((val) => !picked.find((p) => p.value === val.value))
128
- }
129
- return cloneOption
130
- }
131
-
132
- function isOptionsExist(groupOption: GroupOption, targetOption: Option[]) {
133
- for (const [, value] of Object.entries(groupOption)) {
134
- if (value.some((option) => targetOption.find((p) => p.value === option.value))) {
135
- return true
136
- }
137
- }
138
- return false
139
- }
140
-
141
- /**
142
- * The `CommandEmpty` of shadcn/ui will cause the cmdk empty not rendering correctly.
143
- * So we create one and copy the `Empty` implementation from `cmdk`.
144
- *
145
- * @reference: https://github.com/hsuanyi-chou/shadcn-ui-expansions/issues/34#issuecomment-1949561607
146
- **/
147
- const CommandEmpty = React.forwardRef<HTMLDivElement, React.ComponentProps<typeof CommandPrimitive.Empty>>(({ className, ...props }, forwardedRef) => {
148
- const render = useCommandState((state) => state.filtered.count === 0)
149
-
150
- if (!render) return null
151
-
152
- return <div ref={forwardedRef} className={cn('px-2 py-4 text-center text-sm', className)} cmdk-empty="" role="presentation" {...props} />
153
- })
154
-
155
- CommandEmpty.displayName = 'CommandEmpty'
156
-
157
- export const MultipleSelector = React.forwardRef<MultipleSelectorRef, MultipleSelectorProps>(
158
- (
159
- {
160
- value,
161
- onChange,
162
- placeholder,
163
- defaultOptions: arrayDefaultOptions = [],
164
- options: arrayOptions,
165
- delay,
166
- onSearch,
167
- onSearchSync,
168
- loadingIndicator: LoadingIndicator,
169
- emptyIndicator,
170
- maxSelected = Number.MAX_SAFE_INTEGER,
171
- onMaxSelected,
172
- hidePlaceholderWhenSelected,
173
- disabled,
174
- groupBy,
175
- className,
176
- badgeClassName,
177
- selectFirstItem = true,
178
- creatable = false,
179
- triggerSearchOnFocus = false,
180
- commandProps,
181
- inputProps,
182
- hideClearAllButton = false,
183
- onAddNewItem,
184
- }: MultipleSelectorProps,
185
- ref: React.Ref<MultipleSelectorRef>,
186
- ) => {
187
- const inputRef = React.useRef<HTMLInputElement>(null)
188
- const dropdownRef = React.useRef<HTMLDivElement>(null) // Added this
189
-
190
- const [open, setOpen] = React.useState(false)
191
- const [onScrollbar, setOnScrollbar] = React.useState(false)
192
- const [isLoading, setIsLoading] = React.useState(false)
193
-
194
- const [selected, setSelected] = React.useState<Option[]>(value || [])
195
- const [options, setOptions] = React.useState<GroupOption>(transToGroupOption(arrayDefaultOptions, groupBy))
196
- const [inputValue, setInputValue] = React.useState('')
197
-
198
- const debouncedSearchTerm = useDebounce(inputValue, delay || 500)
199
-
200
- React.useImperativeHandle(
201
- ref,
202
- () => ({
203
- selectedValue: [...selected],
204
- input: inputRef.current as HTMLInputElement,
205
- focus: () => inputRef?.current?.focus(),
206
- reset: () => setSelected([]),
207
- }),
208
- [selected],
209
- )
210
-
211
- const handleClickOutside = React.useCallback((event: MouseEvent | TouchEvent) => {
212
- if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node) && inputRef.current && !inputRef.current.contains(event.target as Node)) {
213
- setOpen(false)
214
- inputRef.current.blur()
215
- }
216
- }, [])
217
-
218
- const handleUnselect = React.useCallback(
219
- (option: Option) => {
220
- const newOptions = selected.filter((s) => s.value !== option.value)
221
- setSelected(newOptions)
222
- onChange?.(newOptions)
223
- },
224
- [onChange, selected],
225
- )
226
-
227
- const handleKeyDown = React.useCallback(
228
- (e: React.KeyboardEvent<HTMLDivElement>) => {
229
- const input = inputRef.current
230
- if (!input) return
231
-
232
- if (e.key === 'Delete' || e.key === 'Backspace') {
233
- if (input.value === '' && selected.length > 0) {
234
- const lastSelectOption = selected[selected.length - 1]
235
- // If last item is fixed, we should not remove it.
236
- if (!lastSelectOption.fixed) {
237
- handleUnselect(selected[selected.length - 1])
238
- }
239
- }
240
- }
241
-
242
- // This is not a default behavior of the <input /> field
243
- if (e.key === 'Escape') {
244
- input.blur()
245
- }
246
- },
247
- [handleUnselect, selected],
248
- )
249
-
250
- React.useEffect(() => {
251
- if (open) {
252
- document.addEventListener('mousedown', handleClickOutside)
253
- document.addEventListener('touchend', handleClickOutside)
254
- } else {
255
- document.removeEventListener('mousedown', handleClickOutside)
256
- document.removeEventListener('touchend', handleClickOutside)
257
- }
258
-
259
- return () => {
260
- document.removeEventListener('mousedown', handleClickOutside)
261
- document.removeEventListener('touchend', handleClickOutside)
262
- }
263
- // eslint-disable-next-line react-hooks/exhaustive-deps
264
- }, [open])
265
-
266
- React.useEffect(() => {
267
- if (value) {
268
- setSelected(value)
269
- }
270
- }, [value])
271
-
272
- React.useEffect(() => {
273
- /** If `onSearch` is provided, do not trigger options updated. */
274
- if (!arrayOptions || onSearch) {
275
- return
276
- }
277
- const newOption = transToGroupOption(arrayOptions || [], groupBy)
278
- if (JSON.stringify(newOption) !== JSON.stringify(options)) {
279
- setOptions(newOption)
280
- }
281
- }, [arrayDefaultOptions, arrayOptions, groupBy, onSearch, options])
282
-
283
- React.useEffect(() => {
284
- /** sync search */
285
-
286
- const doSearchSync = () => {
287
- const res = onSearchSync?.(debouncedSearchTerm)
288
- setOptions(transToGroupOption(res || [], groupBy))
289
- }
290
-
291
- const exec = async () => {
292
- if (!onSearchSync || !open) return
293
-
294
- if (triggerSearchOnFocus) {
295
- doSearchSync()
296
- }
297
-
298
- if (debouncedSearchTerm) {
299
- doSearchSync()
300
- }
301
- }
302
-
303
- void exec()
304
- // eslint-disable-next-line react-hooks/exhaustive-deps
305
- }, [debouncedSearchTerm, groupBy, open, triggerSearchOnFocus])
306
-
307
- React.useEffect(() => {
308
- /** async search */
309
-
310
- const doSearch = async () => {
311
- setIsLoading(true)
312
- const res = await onSearch?.(debouncedSearchTerm)
313
- setOptions(transToGroupOption(res || [], groupBy))
314
- setIsLoading(false)
315
- }
316
-
317
- const exec = async () => {
318
- if (!onSearch || !open) return
319
-
320
- if (triggerSearchOnFocus) {
321
- await doSearch()
322
- }
323
-
324
- if (debouncedSearchTerm) {
325
- await doSearch()
326
- }
327
- }
328
-
329
- void exec()
330
- // eslint-disable-next-line react-hooks/exhaustive-deps
331
- }, [debouncedSearchTerm, groupBy, open, triggerSearchOnFocus])
332
-
333
- const CreatableItem = () => {
334
- if (!creatable) return undefined
335
- if (isOptionsExist(options, [{ value: inputValue, label: inputValue }]) || selected.find((s) => s.value === inputValue)) {
336
- return undefined
337
- }
338
-
339
- const Item = (
340
- <CommandItem
341
- value={inputValue}
342
- className="cursor-pointer"
343
- onMouseDown={(e) => {
344
- e.preventDefault()
345
- e.stopPropagation()
346
- }}
347
- onSelect={(value: string) => {
348
- if (selected.length >= maxSelected) {
349
- onMaxSelected?.(selected.length)
350
- return
351
- }
352
- setInputValue('')
353
- const newOptions = [...selected, { value, label: value }]
354
- setSelected(newOptions)
355
- onChange?.(newOptions)
356
- }}
357
- >
358
- {`Create "${inputValue}"`}
359
- </CommandItem>
360
- )
361
-
362
- // For normal creatable
363
- if (!onSearch && inputValue.length > 0) {
364
- return Item
365
- }
366
-
367
- // For async search creatable. avoid showing creatable item before loading at first.
368
- if (onSearch && debouncedSearchTerm.length > 0 && !isLoading) {
369
- return Item
370
- }
371
-
372
- return undefined
373
- }
374
-
375
- const EmptyItem = React.useCallback(() => {
376
- if (!emptyIndicator) return undefined
377
-
378
- // For async search that showing emptyIndicator
379
- if (onSearch && !creatable && Object.keys(options).length === 0) {
380
- return (
381
- <CommandItem value="-" disabled>
382
- {emptyIndicator}
383
- </CommandItem>
384
- )
385
- }
386
-
387
- return <CommandEmpty>{emptyIndicator}</CommandEmpty>
388
- }, [creatable, emptyIndicator, onSearch, options])
389
-
390
- const selectables = React.useMemo<GroupOption>(() => removePickedOption(options, selected), [options, selected])
391
-
392
- /** Avoid Creatable Selector freezing or lagging when paste a long string. */
393
- const commandFilter = React.useCallback(() => {
394
- if (commandProps?.filter) {
395
- return commandProps.filter
396
- }
397
-
398
- if (creatable) {
399
- return (value: string, search: string) => {
400
- return value.toLowerCase().includes(search.toLowerCase()) ? 1 : -1
401
- }
402
- }
403
- // Using default filter in `cmdk`. We don&lsquo;t have to provide it.
404
- return undefined
405
- }, [creatable, commandProps?.filter])
406
-
407
- return (
408
- <Command
409
- ref={dropdownRef}
410
- {...commandProps}
411
- onKeyDown={(e) => {
412
- handleKeyDown(e)
413
- commandProps?.onKeyDown?.(e)
414
- }}
415
- className={cn('h-auto overflow-visible bg-transparent', commandProps?.className)}
416
- shouldFilter={commandProps?.shouldFilter !== undefined ? commandProps.shouldFilter : !onSearch} // When onSearch is provided, we don&lsquo;t want to filter the options. You can still override it.
417
- filter={commandFilter()}
418
- >
419
- <div
420
- className={cn(
421
- 'border-border-weak relative rounded-md border text-sm transition-shadow',
422
- 'focus-within:border-primary',
423
- 'focus-within:ring-primary-weak',
424
- 'focus-within:ring-4',
425
- 'focus-within:outline-hidden',
426
- 'has-disabled:bg-muted',
427
- 'has-disabled:text-muted-foreground',
428
- selected.length !== 0 && 'p-1',
429
- !disabled && selected.length !== 0 && 'cursor-text',
430
- !hideClearAllButton && 'pe-9',
431
- className,
432
- )}
433
- onClick={() => {
434
- if (disabled) return
435
- inputRef?.current?.focus()
436
- }}
437
- >
438
- <div className="flex flex-wrap gap-1">
439
- {selected.map((option) => {
440
- return (
441
- <div
442
- key={option.value}
443
- className={cn(
444
- 'animate-fadeIn',
445
- 'bg-background',
446
- 'hover:bg-background',
447
- 'border-border-weak border border-solid',
448
- 'text-text-positive-weak relative inline-flex h-7 cursor-default items-center rounded-md ps-2 pe-7 pl-2 text-xs font-medium transition-all',
449
- 'disabled:cursor-not-allowed',
450
- 'disabled:opacity-50',
451
- 'data-fixed:pe-2',
452
- badgeClassName,
453
- )}
454
- data-fixed={option.fixed}
455
- data-disabled={disabled || undefined}
456
- >
457
- {option.label}
458
- <button
459
- type="button"
460
- disabled={disabled || option.fixed}
461
- className={cn(
462
- 'text-text-positive-muted absolute -inset-y-px -end-px flex size-7 items-center justify-center rounded-e-lg border border-transparent p-0 outline-0 transition-colors',
463
- 'hover:text-foreground',
464
- 'focus-visible:outline',
465
- 'focus-visible:outline-2',
466
- 'focus-visible:outline-primary-weak',
467
- 'disabled:hover:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',
468
- )}
469
- onKeyDown={(e) => {
470
- if (e.key !== 'Enter') return
471
- handleUnselect(option)
472
- }}
473
- onMouseDown={(e) => {
474
- e.preventDefault()
475
- e.stopPropagation()
476
- }}
477
- onClick={() => handleUnselect(option)}
478
- aria-label="Remove"
479
- >
480
- <X size={14} strokeWidth={2} aria-hidden="true" />
481
- </button>
482
- </div>
483
- )
484
- })}
485
- {/* Avoid having the "Search" Icon */}
486
- <CommandPrimitive.Input
487
- {...inputProps}
488
- ref={inputRef}
489
- value={inputValue}
490
- disabled={disabled}
491
- onValueChange={(value) => {
492
- setInputValue(value)
493
- inputProps?.onValueChange?.(value)
494
- }}
495
- onBlur={(event) => {
496
- if (!onScrollbar) {
497
- setOpen(false)
498
- }
499
- inputProps?.onBlur?.(event)
500
- }}
501
- onFocus={(event) => {
502
- setOpen(true)
503
- if (triggerSearchOnFocus) {
504
- onSearch?.(debouncedSearchTerm)
505
- }
506
- inputProps?.onFocus?.(event)
507
- }}
508
- placeholder={hidePlaceholderWhenSelected && selected.length !== 0 ? '' : placeholder}
509
- className={cn(
510
- 'placeholder:text-text-positive-muted flex-1 bg-transparent outline-hidden',
511
- 'disabled:placeholder:text-transparent',
512
- {
513
- 'w-full': hidePlaceholderWhenSelected,
514
- 'px-3 py-2': selected.length === 0,
515
- 'ml-1': selected.length !== 0,
516
- },
517
- inputProps?.className,
518
- )}
519
- />
520
- <button
521
- type="button"
522
- onClick={() => {
523
- setSelected(selected.filter((s) => s.fixed))
524
- onChange?.(selected.filter((s) => s.fixed))
525
- }}
526
- className={cn(
527
- 'text-muted-foreground/80',
528
- 'absolute end-0 top-0 flex size-9 items-center justify-center rounded-lg border border-transparent transition-colors',
529
- 'focus-visible:outline-2',
530
- 'hover:text-text-positive',
531
- 'focus-visible:outline-primary-weak',
532
- (hideClearAllButton || disabled || selected.length < 1 || selected.filter(({ fixed }) => fixed).length === selected.length) && 'hidden',
533
- )}
534
- aria-label="Clear all"
535
- >
536
- <X size={16} strokeWidth={2} aria-hidden="true" />
537
- </button>
538
- </div>
539
- </div>
540
- <div className="relative">
541
- <div
542
- className={cn(
543
- 'shadow-dropdown absolute top-2 z-10 w-full overflow-hidden rounded-lg',
544
- 'data-[state=open]:animate-in',
545
- 'data-[state=closed]:animate-out',
546
- 'data-[state=closed]:fade-out-0',
547
- 'data-[state=open]:fade-in-0',
548
- 'data-[state=closed]:zoom-out-95',
549
- 'data-[state=open]:zoom-in-95',
550
- !open && 'hidden',
551
- )}
552
- data-state={open ? 'open' : 'closed'}
553
- >
554
- {open && (
555
- <CommandList
556
- className="shadow-lg outline-hidden"
557
- onMouseLeave={() => {
558
- setOnScrollbar(false)
559
- }}
560
- onMouseEnter={() => {
561
- setOnScrollbar(true)
562
- }}
563
- onMouseUp={() => {
564
- inputRef?.current?.focus()
565
- }}
566
- >
567
- {onAddNewItem && (
568
- <>
569
- <CommandSeparator />
570
- <CommandGroup>
571
- <Button type="button" variant="ghost" className="w-full font-normal [&_div]:justify-start" onClick={onAddNewItem}>
572
- <PlusIcon size={14} className="opacity-60" aria-hidden="true" />
573
- Thêm mới
574
- </Button>
575
- </CommandGroup>
576
- </>
577
- )}
578
- {isLoading ? (
579
- LoadingIndicator
580
- ) : (
581
- <React.Fragment>
582
- {EmptyItem()}
583
- {CreatableItem()}
584
- {!selectFirstItem && <CommandItem value="-" className="hidden" />}
585
- {Object.entries(selectables).map(([key, dropdowns]) => (
586
- <CommandGroup key={key} heading={key} className="h-full overflow-auto">
587
- {dropdowns.map((option) => {
588
- return (
589
- <CommandItem
590
- key={option.value}
591
- value={option.value}
592
- disabled={option.disable}
593
- onMouseDown={(e) => {
594
- e.preventDefault()
595
- e.stopPropagation()
596
- }}
597
- onSelect={() => {
598
- if (selected.length >= maxSelected) {
599
- onMaxSelected?.(selected.length)
600
- return
601
- }
602
- const newOptions = [...selected, option]
603
- setInputValue('')
604
- setSelected(newOptions)
605
- onChange?.(newOptions)
606
- }}
607
- className={cn('cursor-pointer', option.disable && 'cursor-not-allowed opacity-50')}
608
- >
609
- {option.label}
610
- </CommandItem>
611
- )
612
- })}
613
- </CommandGroup>
614
- ))}
615
- </React.Fragment>
616
- )}
617
- </CommandList>
618
- )}
619
- </div>
620
- </div>
621
- </Command>
622
- )
623
- },
624
- )
625
-
626
- MultipleSelector.displayName = 'MultipleSelector'