@sth87/shadcn-design-system 0.0.35 → 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 (421) hide show
  1. package/README.md +20 -2
  2. package/dist/AI_CONTEXT.md +212 -214
  3. package/dist/cjs/components/Accordion/Accordion.cjs +1 -1
  4. package/dist/cjs/components/Accordion/Accordion.cjs.map +1 -1
  5. package/dist/cjs/components/Avatar/Avatar.cjs +1 -1
  6. package/dist/cjs/components/Avatar/Avatar.cjs.map +1 -1
  7. package/dist/cjs/components/Badge/Badge.cjs +1 -1
  8. package/dist/cjs/components/Badge/Badge.cjs.map +1 -1
  9. package/dist/cjs/components/Breadcrumb/Breadcrumb.cjs +1 -1
  10. package/dist/cjs/components/Breadcrumb/Breadcrumb.cjs.map +1 -1
  11. package/dist/cjs/components/Button/Button.cjs +1 -1
  12. package/dist/cjs/components/Button/Button.cjs.map +1 -1
  13. package/dist/cjs/components/Calendar/Calendar.cjs +1 -1
  14. package/dist/cjs/components/Calendar/Calendar.cjs.map +1 -1
  15. package/dist/cjs/components/Carousel/Carousel.cjs +1 -1
  16. package/dist/cjs/components/Carousel/Carousel.cjs.map +1 -1
  17. package/dist/cjs/components/Checkbox/Checkbox.cjs +1 -1
  18. package/dist/cjs/components/Checkbox/Checkbox.cjs.map +1 -1
  19. package/dist/cjs/components/Collapsible/Collapsible.cjs +1 -1
  20. package/dist/cjs/components/Collapsible/Collapsible.cjs.map +1 -1
  21. package/dist/cjs/components/Command/Command.cjs +1 -1
  22. package/dist/cjs/components/Command/Command.cjs.map +1 -1
  23. package/dist/cjs/components/ContextMenu/ContextMenu.cjs +1 -1
  24. package/dist/cjs/components/ContextMenu/ContextMenu.cjs.map +1 -1
  25. package/dist/cjs/components/Cropper/Cropper.cjs +1 -1
  26. package/dist/cjs/components/Cropper/Cropper.cjs.map +1 -1
  27. package/dist/cjs/components/DatePicker/DatePicker.cjs +1 -1
  28. package/dist/cjs/components/DatePicker/DatePicker.cjs.map +1 -1
  29. package/dist/cjs/components/DatePicker/RangePicker.cjs +1 -1
  30. package/dist/cjs/components/DatePicker/RangePicker.cjs.map +1 -1
  31. package/dist/cjs/components/DatePicker/TimePicker.cjs +1 -1
  32. package/dist/cjs/components/DatePicker/TimePicker.cjs.map +1 -1
  33. package/dist/cjs/components/Dialog/Dialog.cjs +1 -1
  34. package/dist/cjs/components/Dialog/Dialog.cjs.map +1 -1
  35. package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs +1 -1
  36. package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs.map +1 -1
  37. package/dist/cjs/components/FloatLabel.cjs +1 -1
  38. package/dist/cjs/components/FloatLabel.cjs.map +1 -1
  39. package/dist/cjs/components/Glass/Glass.cjs +1 -1
  40. package/dist/cjs/components/Glass/Glass.cjs.map +1 -1
  41. package/dist/cjs/components/ImageViewer/ImageViewer.cjs +1 -1
  42. package/dist/cjs/components/ImageViewer/ImageViewer.cjs.map +1 -1
  43. package/dist/cjs/components/Input/Input.cjs +1 -1
  44. package/dist/cjs/components/Input/Input.cjs.map +1 -1
  45. package/dist/cjs/components/InputOTP/InputOTP.cjs +1 -1
  46. package/dist/cjs/components/InputOTP/InputOTP.cjs.map +1 -1
  47. package/dist/cjs/components/Interactive/CursorFollow.cjs +1 -1
  48. package/dist/cjs/components/Interactive/CursorFollow.cjs.map +1 -1
  49. package/dist/cjs/components/Marquee/Marquee.cjs +1 -1
  50. package/dist/cjs/components/Marquee/Marquee.cjs.map +1 -1
  51. package/dist/cjs/components/Pagination/Pagination.cjs +1 -1
  52. package/dist/cjs/components/Pagination/Pagination.cjs.map +1 -1
  53. package/dist/cjs/components/QrCode/QrCode.cjs +1 -1
  54. package/dist/cjs/components/QrCode/QrCode.cjs.map +1 -1
  55. package/dist/cjs/components/Radio/Radio.cjs +1 -1
  56. package/dist/cjs/components/Radio/Radio.cjs.map +1 -1
  57. package/dist/cjs/components/Rate/Rate.cjs +1 -1
  58. package/dist/cjs/components/Rate/Rate.cjs.map +1 -1
  59. package/dist/cjs/components/Resizable/Resizable.cjs +1 -1
  60. package/dist/cjs/components/Resizable/Resizable.cjs.map +1 -1
  61. package/dist/cjs/components/ScrollArea/ScrollArea.cjs +1 -1
  62. package/dist/cjs/components/ScrollArea/ScrollArea.cjs.map +1 -1
  63. package/dist/cjs/components/Select/Select.cjs +1 -1
  64. package/dist/cjs/components/Select/Select.cjs.map +1 -1
  65. package/dist/cjs/components/Sheet/Sheet.cjs +2 -2
  66. package/dist/cjs/components/Sheet/Sheet.cjs.map +1 -1
  67. package/dist/cjs/components/Slider/Slider.cjs +1 -1
  68. package/dist/cjs/components/Slider/Slider.cjs.map +1 -1
  69. package/dist/cjs/components/Stepper/Stepper.cjs +1 -1
  70. package/dist/cjs/components/Stepper/Stepper.cjs.map +1 -1
  71. package/dist/cjs/components/Stepper/StepperWrapper.cjs +1 -1
  72. package/dist/cjs/components/Stepper/StepperWrapper.cjs.map +1 -1
  73. package/dist/cjs/components/Switch/Switch.cjs +1 -1
  74. package/dist/cjs/components/Switch/Switch.cjs.map +1 -1
  75. package/dist/cjs/components/Table/TableFilter/data-table-date-filter.cjs +1 -1
  76. package/dist/cjs/components/Table/TableFilter/data-table-date-filter.cjs.map +1 -1
  77. package/dist/cjs/components/Table/TableFilter/data-table-filter-popover.cjs +1 -1
  78. package/dist/cjs/components/Table/TableFilter/data-table-filter-popover.cjs.map +1 -1
  79. package/dist/cjs/components/Table/TableFilter/data-table-slider-filter.cjs +1 -1
  80. package/dist/cjs/components/Table/TableFilter/data-table-slider-filter.cjs.map +1 -1
  81. package/dist/cjs/components/Table/data-table-column-header.cjs +1 -1
  82. package/dist/cjs/components/Table/data-table-column-header.cjs.map +1 -1
  83. package/dist/cjs/components/Table/data-table-pagination.cjs +1 -1
  84. package/dist/cjs/components/Table/data-table-pagination.cjs.map +1 -1
  85. package/dist/cjs/components/Table/data-table.cjs +1 -1
  86. package/dist/cjs/components/Table/data-table.cjs.map +1 -1
  87. package/dist/cjs/components/Tabs/Tabs.cjs +1 -1
  88. package/dist/cjs/components/Tabs/Tabs.cjs.map +1 -1
  89. package/dist/cjs/components/Tabs/classes.cjs +1 -1
  90. package/dist/cjs/components/Tabs/classes.cjs.map +1 -1
  91. package/dist/cjs/components/Textarea/Textarea.cjs +1 -1
  92. package/dist/cjs/components/Textarea/Textarea.cjs.map +1 -1
  93. package/dist/cjs/components/TimeGridView.cjs +1 -1
  94. package/dist/cjs/components/TimeGridView.cjs.map +1 -1
  95. package/dist/cjs/components/Toast/Toast.cjs +1 -1
  96. package/dist/cjs/components/Toast/Toast.cjs.map +1 -1
  97. package/dist/cjs/components/Tooltip/Tooltip.cjs +1 -1
  98. package/dist/cjs/components/Tooltip/Tooltip.cjs.map +1 -1
  99. package/dist/cjs/components/Tour/Tour.cjs +1 -1
  100. package/dist/cjs/components/Tour/Tour.cjs.map +1 -1
  101. package/dist/cjs/components/Tour/TourWrapper.cjs +1 -1
  102. package/dist/cjs/components/Tour/TourWrapper.cjs.map +1 -1
  103. package/dist/cjs/components/Upload/Upload.cjs +3 -3
  104. package/dist/cjs/components/Upload/Upload.cjs.map +1 -1
  105. package/dist/cjs/components/WheelColumn.cjs +1 -1
  106. package/dist/cjs/components/WheelColumn.cjs.map +1 -1
  107. package/dist/cjs/lib/TextAnimation/BlurText.cjs +1 -1
  108. package/dist/cjs/lib/TextAnimation/BlurText.cjs.map +1 -1
  109. package/dist/cjs/lib/TextAnimation/CircularText.cjs +1 -1
  110. package/dist/cjs/lib/TextAnimation/CircularText.cjs.map +1 -1
  111. package/dist/cjs/lib/TextAnimation/FlipWords.cjs +1 -1
  112. package/dist/cjs/lib/TextAnimation/FlipWords.cjs.map +1 -1
  113. package/dist/cjs/lib/TextAnimation/GradientText.cjs +1 -1
  114. package/dist/cjs/lib/TextAnimation/GradientText.cjs.map +1 -1
  115. package/dist/cjs/lib/TextAnimation/RollingText.cjs +1 -1
  116. package/dist/cjs/lib/TextAnimation/RollingText.cjs.map +1 -1
  117. package/dist/cjs/lib/TextAnimation/RotatingText.cjs +1 -1
  118. package/dist/cjs/lib/TextAnimation/RotatingText.cjs.map +1 -1
  119. package/dist/cjs/lib/TextAnimation/ShimmeringText.cjs +1 -1
  120. package/dist/cjs/lib/TextAnimation/ShimmeringText.cjs.map +1 -1
  121. package/dist/cjs/lib/TextAnimation/TextGenerateEffect.cjs +1 -1
  122. package/dist/cjs/lib/TextAnimation/TextGenerateEffect.cjs.map +1 -1
  123. package/dist/cjs/lib/TextAnimation/TextHoverEffect.cjs +1 -1
  124. package/dist/cjs/lib/TextAnimation/TextHoverEffect.cjs.map +1 -1
  125. package/dist/cjs/lib/TextAnimation/TextPressureEffect.cjs +2 -2
  126. package/dist/cjs/lib/TextAnimation/TextPressureEffect.cjs.map +1 -1
  127. package/dist/cjs/lib/TextAnimation/TypingText.cjs +1 -1
  128. package/dist/cjs/lib/TextAnimation/TypingText.cjs.map +1 -1
  129. package/dist/cjs/lib/TextAnimation/WritingText.cjs +1 -1
  130. package/dist/cjs/lib/TextAnimation/WritingText.cjs.map +1 -1
  131. package/dist/cjs/node_modules/.pnpm/nuqs@2.8.0_next@15.5.9_@babel_core@7.28.5_react-dom@19.1.1_react@19.1.1__react@19.1.1__react@19.1.1/node_modules/nuqs/dist/server.cjs.map +1 -0
  132. package/dist/cjs/packages/ui/src/components/accordion.cjs +1 -1
  133. package/dist/cjs/packages/ui/src/components/accordion.cjs.map +1 -1
  134. package/dist/cjs/packages/ui/src/components/alert-dialog.cjs +1 -1
  135. package/dist/cjs/packages/ui/src/components/alert-dialog.cjs.map +1 -1
  136. package/dist/cjs/packages/ui/src/components/avatar.cjs +1 -1
  137. package/dist/cjs/packages/ui/src/components/avatar.cjs.map +1 -1
  138. package/dist/cjs/packages/ui/src/components/badge.cjs +1 -1
  139. package/dist/cjs/packages/ui/src/components/badge.cjs.map +1 -1
  140. package/dist/cjs/packages/ui/src/components/breadcrumb.cjs +1 -1
  141. package/dist/cjs/packages/ui/src/components/breadcrumb.cjs.map +1 -1
  142. package/dist/cjs/packages/ui/src/components/button-group.cjs +1 -1
  143. package/dist/cjs/packages/ui/src/components/button-group.cjs.map +1 -1
  144. package/dist/cjs/packages/ui/src/components/button.cjs +1 -1
  145. package/dist/cjs/packages/ui/src/components/button.cjs.map +1 -1
  146. package/dist/cjs/packages/ui/src/components/calendar.cjs +1 -1
  147. package/dist/cjs/packages/ui/src/components/calendar.cjs.map +1 -1
  148. package/dist/cjs/packages/ui/src/components/checkbox.cjs +1 -1
  149. package/dist/cjs/packages/ui/src/components/checkbox.cjs.map +1 -1
  150. package/dist/cjs/packages/ui/src/components/combobox.cjs +1 -1
  151. package/dist/cjs/packages/ui/src/components/combobox.cjs.map +1 -1
  152. package/dist/cjs/packages/ui/src/components/command.cjs +1 -1
  153. package/dist/cjs/packages/ui/src/components/command.cjs.map +1 -1
  154. package/dist/cjs/packages/ui/src/components/context-menu.cjs +1 -1
  155. package/dist/cjs/packages/ui/src/components/context-menu.cjs.map +1 -1
  156. package/dist/cjs/packages/ui/src/components/dialog.cjs +1 -1
  157. package/dist/cjs/packages/ui/src/components/dialog.cjs.map +1 -1
  158. package/dist/cjs/packages/ui/src/components/drawer.cjs +1 -1
  159. package/dist/cjs/packages/ui/src/components/drawer.cjs.map +1 -1
  160. package/dist/cjs/packages/ui/src/components/dropdown-menu.cjs +1 -1
  161. package/dist/cjs/packages/ui/src/components/dropdown-menu.cjs.map +1 -1
  162. package/dist/cjs/packages/ui/src/components/input-otp.cjs +1 -1
  163. package/dist/cjs/packages/ui/src/components/input-otp.cjs.map +1 -1
  164. package/dist/cjs/packages/ui/src/components/input.cjs +1 -1
  165. package/dist/cjs/packages/ui/src/components/input.cjs.map +1 -1
  166. package/dist/cjs/packages/ui/src/components/label.cjs +1 -1
  167. package/dist/cjs/packages/ui/src/components/label.cjs.map +1 -1
  168. package/dist/cjs/packages/ui/src/components/pagination.cjs +1 -1
  169. package/dist/cjs/packages/ui/src/components/pagination.cjs.map +1 -1
  170. package/dist/cjs/packages/ui/src/components/popover.cjs +1 -1
  171. package/dist/cjs/packages/ui/src/components/popover.cjs.map +1 -1
  172. package/dist/cjs/packages/ui/src/components/radio-group.cjs +1 -1
  173. package/dist/cjs/packages/ui/src/components/radio-group.cjs.map +1 -1
  174. package/dist/cjs/packages/ui/src/components/resizable.cjs +1 -1
  175. package/dist/cjs/packages/ui/src/components/resizable.cjs.map +1 -1
  176. package/dist/cjs/packages/ui/src/components/scroll-area.cjs +1 -1
  177. package/dist/cjs/packages/ui/src/components/scroll-area.cjs.map +1 -1
  178. package/dist/cjs/packages/ui/src/components/select.cjs +1 -1
  179. package/dist/cjs/packages/ui/src/components/select.cjs.map +1 -1
  180. package/dist/cjs/packages/ui/src/components/separator.cjs +1 -1
  181. package/dist/cjs/packages/ui/src/components/separator.cjs.map +1 -1
  182. package/dist/cjs/packages/ui/src/components/sheet.cjs +1 -1
  183. package/dist/cjs/packages/ui/src/components/sheet.cjs.map +1 -1
  184. package/dist/cjs/packages/ui/src/components/sidebar.cjs +1 -1
  185. package/dist/cjs/packages/ui/src/components/sidebar.cjs.map +1 -1
  186. package/dist/cjs/packages/ui/src/components/skeleton.cjs +1 -1
  187. package/dist/cjs/packages/ui/src/components/skeleton.cjs.map +1 -1
  188. package/dist/cjs/packages/ui/src/components/switch.cjs +1 -1
  189. package/dist/cjs/packages/ui/src/components/switch.cjs.map +1 -1
  190. package/dist/cjs/packages/ui/src/components/table.cjs +1 -1
  191. package/dist/cjs/packages/ui/src/components/table.cjs.map +1 -1
  192. package/dist/cjs/packages/ui/src/components/tabs.cjs +1 -1
  193. package/dist/cjs/packages/ui/src/components/tabs.cjs.map +1 -1
  194. package/dist/cjs/packages/ui/src/components/textarea.cjs +1 -1
  195. package/dist/cjs/packages/ui/src/components/textarea.cjs.map +1 -1
  196. package/dist/cjs/packages/ui/src/components/toggle.cjs +1 -1
  197. package/dist/cjs/packages/ui/src/components/toggle.cjs.map +1 -1
  198. package/dist/cjs/packages/ui/src/components/tooltip.cjs +1 -1
  199. package/dist/cjs/packages/ui/src/components/tooltip.cjs.map +1 -1
  200. package/dist/cjs/packages/ui/src/components/tree-view.cjs +1 -1
  201. package/dist/cjs/packages/ui/src/components/tree-view.cjs.map +1 -1
  202. package/dist/cjs/styles/index.css +1 -1
  203. package/dist/cjs/utils/animations.cjs +1 -1
  204. package/dist/cjs/utils/animations.cjs.map +1 -1
  205. package/dist/cjs/utils/css.cjs +1 -1
  206. package/dist/cjs/utils/css.cjs.map +1 -1
  207. package/dist/cjs/utils/parsers.cjs +1 -1
  208. package/dist/cjs/utils/parsers.cjs.map +1 -1
  209. package/dist/esm/components/Accordion/Accordion.js +60 -60
  210. package/dist/esm/components/Accordion/Accordion.js.map +1 -1
  211. package/dist/esm/components/Avatar/Avatar.js +40 -40
  212. package/dist/esm/components/Avatar/Avatar.js.map +1 -1
  213. package/dist/esm/components/Badge/Badge.js +1 -1
  214. package/dist/esm/components/Badge/Badge.js.map +1 -1
  215. package/dist/esm/components/Breadcrumb/Breadcrumb.js +36 -36
  216. package/dist/esm/components/Breadcrumb/Breadcrumb.js.map +1 -1
  217. package/dist/esm/components/Button/Button.js +9 -9
  218. package/dist/esm/components/Button/Button.js.map +1 -1
  219. package/dist/esm/components/Calendar/Calendar.js +4 -4
  220. package/dist/esm/components/Calendar/Calendar.js.map +1 -1
  221. package/dist/esm/components/Carousel/Carousel.js +165 -165
  222. package/dist/esm/components/Carousel/Carousel.js.map +1 -1
  223. package/dist/esm/components/Checkbox/Checkbox.js +26 -26
  224. package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
  225. package/dist/esm/components/Collapsible/Collapsible.js +43 -43
  226. package/dist/esm/components/Collapsible/Collapsible.js.map +1 -1
  227. package/dist/esm/components/Command/Command.js +28 -28
  228. package/dist/esm/components/Command/Command.js.map +1 -1
  229. package/dist/esm/components/ContextMenu/ContextMenu.js +11 -11
  230. package/dist/esm/components/ContextMenu/ContextMenu.js.map +1 -1
  231. package/dist/esm/components/Cropper/Cropper.js +132 -132
  232. package/dist/esm/components/Cropper/Cropper.js.map +1 -1
  233. package/dist/esm/components/DatePicker/DatePicker.js +75 -75
  234. package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
  235. package/dist/esm/components/DatePicker/RangePicker.js +136 -136
  236. package/dist/esm/components/DatePicker/RangePicker.js.map +1 -1
  237. package/dist/esm/components/DatePicker/TimePicker.js +150 -150
  238. package/dist/esm/components/DatePicker/TimePicker.js.map +1 -1
  239. package/dist/esm/components/Dialog/Dialog.js +114 -114
  240. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  241. package/dist/esm/components/DropdownMenu/DropdownMenu.js +13 -13
  242. package/dist/esm/components/DropdownMenu/DropdownMenu.js.map +1 -1
  243. package/dist/esm/components/FloatLabel.js +44 -44
  244. package/dist/esm/components/FloatLabel.js.map +1 -1
  245. package/dist/esm/components/Glass/Glass.js +15 -15
  246. package/dist/esm/components/Glass/Glass.js.map +1 -1
  247. package/dist/esm/components/ImageViewer/ImageViewer.js +53 -53
  248. package/dist/esm/components/ImageViewer/ImageViewer.js.map +1 -1
  249. package/dist/esm/components/Input/Input.js +104 -104
  250. package/dist/esm/components/Input/Input.js.map +1 -1
  251. package/dist/esm/components/InputOTP/InputOTP.js +16 -16
  252. package/dist/esm/components/InputOTP/InputOTP.js.map +1 -1
  253. package/dist/esm/components/Interactive/CursorFollow.js +49 -49
  254. package/dist/esm/components/Interactive/CursorFollow.js.map +1 -1
  255. package/dist/esm/components/Marquee/Marquee.js +130 -130
  256. package/dist/esm/components/Marquee/Marquee.js.map +1 -1
  257. package/dist/esm/components/Pagination/Pagination.js +68 -68
  258. package/dist/esm/components/Pagination/Pagination.js.map +1 -1
  259. package/dist/esm/components/QrCode/QrCode.js +37 -37
  260. package/dist/esm/components/QrCode/QrCode.js.map +1 -1
  261. package/dist/esm/components/Radio/Radio.js +16 -16
  262. package/dist/esm/components/Radio/Radio.js.map +1 -1
  263. package/dist/esm/components/Rate/Rate.js +62 -62
  264. package/dist/esm/components/Rate/Rate.js.map +1 -1
  265. package/dist/esm/components/Resizable/Resizable.js +6 -6
  266. package/dist/esm/components/Resizable/Resizable.js.map +1 -1
  267. package/dist/esm/components/ScrollArea/ScrollArea.js +10 -10
  268. package/dist/esm/components/ScrollArea/ScrollArea.js.map +1 -1
  269. package/dist/esm/components/Select/Select.js +64 -64
  270. package/dist/esm/components/Select/Select.js.map +1 -1
  271. package/dist/esm/components/Sheet/Sheet.js +21 -21
  272. package/dist/esm/components/Sheet/Sheet.js.map +1 -1
  273. package/dist/esm/components/Slider/Slider.js +54 -54
  274. package/dist/esm/components/Slider/Slider.js.map +1 -1
  275. package/dist/esm/components/Stepper/Stepper.js +198 -198
  276. package/dist/esm/components/Stepper/Stepper.js.map +1 -1
  277. package/dist/esm/components/Stepper/StepperWrapper.js +15 -15
  278. package/dist/esm/components/Stepper/StepperWrapper.js.map +1 -1
  279. package/dist/esm/components/Switch/Switch.js +38 -38
  280. package/dist/esm/components/Switch/Switch.js.map +1 -1
  281. package/dist/esm/components/Table/TableFilter/data-table-date-filter.js +37 -37
  282. package/dist/esm/components/Table/TableFilter/data-table-date-filter.js.map +1 -1
  283. package/dist/esm/components/Table/TableFilter/data-table-filter-popover.js +25 -25
  284. package/dist/esm/components/Table/TableFilter/data-table-filter-popover.js.map +1 -1
  285. package/dist/esm/components/Table/TableFilter/data-table-slider-filter.js +64 -64
  286. package/dist/esm/components/Table/TableFilter/data-table-slider-filter.js.map +1 -1
  287. package/dist/esm/components/Table/data-table-column-header.js +18 -18
  288. package/dist/esm/components/Table/data-table-column-header.js.map +1 -1
  289. package/dist/esm/components/Table/data-table-pagination.js +21 -21
  290. package/dist/esm/components/Table/data-table-pagination.js.map +1 -1
  291. package/dist/esm/components/Table/data-table.js +18 -18
  292. package/dist/esm/components/Table/data-table.js.map +1 -1
  293. package/dist/esm/components/Tabs/Tabs.js +242 -242
  294. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  295. package/dist/esm/components/Tabs/classes.js +51 -51
  296. package/dist/esm/components/Tabs/classes.js.map +1 -1
  297. package/dist/esm/components/Textarea/Textarea.js +49 -49
  298. package/dist/esm/components/Textarea/Textarea.js.map +1 -1
  299. package/dist/esm/components/TimeGridView.js +12 -12
  300. package/dist/esm/components/TimeGridView.js.map +1 -1
  301. package/dist/esm/components/Toast/Toast.js +45 -45
  302. package/dist/esm/components/Toast/Toast.js.map +1 -1
  303. package/dist/esm/components/Tooltip/Tooltip.js +19 -19
  304. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  305. package/dist/esm/components/Tour/Tour.js +11 -11
  306. package/dist/esm/components/Tour/Tour.js.map +1 -1
  307. package/dist/esm/components/Tour/TourWrapper.js +15 -15
  308. package/dist/esm/components/Tour/TourWrapper.js.map +1 -1
  309. package/dist/esm/components/Upload/Upload.js +405 -405
  310. package/dist/esm/components/Upload/Upload.js.map +1 -1
  311. package/dist/esm/components/WheelColumn.js +47 -47
  312. package/dist/esm/components/WheelColumn.js.map +1 -1
  313. package/dist/esm/lib/TextAnimation/BlurText.js +18 -18
  314. package/dist/esm/lib/TextAnimation/BlurText.js.map +1 -1
  315. package/dist/esm/lib/TextAnimation/CircularText.js +7 -7
  316. package/dist/esm/lib/TextAnimation/CircularText.js.map +1 -1
  317. package/dist/esm/lib/TextAnimation/FlipWords.js +21 -21
  318. package/dist/esm/lib/TextAnimation/FlipWords.js.map +1 -1
  319. package/dist/esm/lib/TextAnimation/GradientText.js +4 -4
  320. package/dist/esm/lib/TextAnimation/GradientText.js.map +1 -1
  321. package/dist/esm/lib/TextAnimation/RollingText.js +24 -24
  322. package/dist/esm/lib/TextAnimation/RollingText.js.map +1 -1
  323. package/dist/esm/lib/TextAnimation/RotatingText.js +6 -6
  324. package/dist/esm/lib/TextAnimation/RotatingText.js.map +1 -1
  325. package/dist/esm/lib/TextAnimation/ShimmeringText.js +9 -9
  326. package/dist/esm/lib/TextAnimation/ShimmeringText.js.map +1 -1
  327. package/dist/esm/lib/TextAnimation/TextGenerateEffect.js +14 -14
  328. package/dist/esm/lib/TextAnimation/TextGenerateEffect.js.map +1 -1
  329. package/dist/esm/lib/TextAnimation/TextHoverEffect.js +9 -9
  330. package/dist/esm/lib/TextAnimation/TextHoverEffect.js.map +1 -1
  331. package/dist/esm/lib/TextAnimation/TextPressureEffect.js +3 -3
  332. package/dist/esm/lib/TextAnimation/TextPressureEffect.js.map +1 -1
  333. package/dist/esm/lib/TextAnimation/TypingText.js +17 -17
  334. package/dist/esm/lib/TextAnimation/TypingText.js.map +1 -1
  335. package/dist/esm/lib/TextAnimation/WritingText.js +10 -10
  336. package/dist/esm/lib/TextAnimation/WritingText.js.map +1 -1
  337. package/dist/esm/node_modules/.pnpm/nuqs@2.8.0_next@15.5.9_@babel_core@7.28.5_react-dom@19.1.1_react@19.1.1__react@19.1.1__react@19.1.1/node_modules/nuqs/dist/server.js.map +1 -0
  338. package/dist/esm/packages/ui/src/components/accordion.js +31 -31
  339. package/dist/esm/packages/ui/src/components/accordion.js.map +1 -1
  340. package/dist/esm/packages/ui/src/components/alert-dialog.js +33 -33
  341. package/dist/esm/packages/ui/src/components/alert-dialog.js.map +1 -1
  342. package/dist/esm/packages/ui/src/components/avatar.js +20 -20
  343. package/dist/esm/packages/ui/src/components/avatar.js.map +1 -1
  344. package/dist/esm/packages/ui/src/components/badge.js +53 -53
  345. package/dist/esm/packages/ui/src/components/badge.js.map +1 -1
  346. package/dist/esm/packages/ui/src/components/breadcrumb.js +20 -20
  347. package/dist/esm/packages/ui/src/components/breadcrumb.js.map +1 -1
  348. package/dist/esm/packages/ui/src/components/button-group.js +31 -31
  349. package/dist/esm/packages/ui/src/components/button-group.js.map +1 -1
  350. package/dist/esm/packages/ui/src/components/button.js +90 -90
  351. package/dist/esm/packages/ui/src/components/button.js.map +1 -1
  352. package/dist/esm/packages/ui/src/components/calendar.js +94 -94
  353. package/dist/esm/packages/ui/src/components/calendar.js.map +1 -1
  354. package/dist/esm/packages/ui/src/components/checkbox.js +47 -47
  355. package/dist/esm/packages/ui/src/components/checkbox.js.map +1 -1
  356. package/dist/esm/packages/ui/src/components/combobox.js +64 -64
  357. package/dist/esm/packages/ui/src/components/combobox.js.map +1 -1
  358. package/dist/esm/packages/ui/src/components/command.js +77 -77
  359. package/dist/esm/packages/ui/src/components/command.js.map +1 -1
  360. package/dist/esm/packages/ui/src/components/context-menu.js +76 -76
  361. package/dist/esm/packages/ui/src/components/context-menu.js.map +1 -1
  362. package/dist/esm/packages/ui/src/components/dialog.js +54 -54
  363. package/dist/esm/packages/ui/src/components/dialog.js.map +1 -1
  364. package/dist/esm/packages/ui/src/components/drawer.js +39 -39
  365. package/dist/esm/packages/ui/src/components/drawer.js.map +1 -1
  366. package/dist/esm/packages/ui/src/components/dropdown-menu.js +109 -109
  367. package/dist/esm/packages/ui/src/components/dropdown-menu.js.map +1 -1
  368. package/dist/esm/packages/ui/src/components/input-otp.js +30 -30
  369. package/dist/esm/packages/ui/src/components/input-otp.js.map +1 -1
  370. package/dist/esm/packages/ui/src/components/input.js +19 -19
  371. package/dist/esm/packages/ui/src/components/input.js.map +1 -1
  372. package/dist/esm/packages/ui/src/components/label.js +9 -9
  373. package/dist/esm/packages/ui/src/components/label.js.map +1 -1
  374. package/dist/esm/packages/ui/src/components/pagination.js +26 -26
  375. package/dist/esm/packages/ui/src/components/pagination.js.map +1 -1
  376. package/dist/esm/packages/ui/src/components/popover.js +13 -13
  377. package/dist/esm/packages/ui/src/components/popover.js.map +1 -1
  378. package/dist/esm/packages/ui/src/components/radio-group.js +45 -45
  379. package/dist/esm/packages/ui/src/components/radio-group.js.map +1 -1
  380. package/dist/esm/packages/ui/src/components/resizable.js +18 -18
  381. package/dist/esm/packages/ui/src/components/resizable.js.map +1 -1
  382. package/dist/esm/packages/ui/src/components/scroll-area.js +31 -31
  383. package/dist/esm/packages/ui/src/components/scroll-area.js.map +1 -1
  384. package/dist/esm/packages/ui/src/components/select.js +119 -119
  385. package/dist/esm/packages/ui/src/components/select.js.map +1 -1
  386. package/dist/esm/packages/ui/src/components/separator.js +86 -86
  387. package/dist/esm/packages/ui/src/components/separator.js.map +1 -1
  388. package/dist/esm/packages/ui/src/components/sheet.js +50 -50
  389. package/dist/esm/packages/ui/src/components/sheet.js.map +1 -1
  390. package/dist/esm/packages/ui/src/components/sidebar.js +198 -198
  391. package/dist/esm/packages/ui/src/components/sidebar.js.map +1 -1
  392. package/dist/esm/packages/ui/src/components/skeleton.js +3 -3
  393. package/dist/esm/packages/ui/src/components/skeleton.js.map +1 -1
  394. package/dist/esm/packages/ui/src/components/switch.js +57 -57
  395. package/dist/esm/packages/ui/src/components/switch.js.map +1 -1
  396. package/dist/esm/packages/ui/src/components/table.js +17 -17
  397. package/dist/esm/packages/ui/src/components/table.js.map +1 -1
  398. package/dist/esm/packages/ui/src/components/tabs.js +33 -33
  399. package/dist/esm/packages/ui/src/components/tabs.js.map +1 -1
  400. package/dist/esm/packages/ui/src/components/textarea.js +17 -17
  401. package/dist/esm/packages/ui/src/components/textarea.js.map +1 -1
  402. package/dist/esm/packages/ui/src/components/toggle.js +36 -36
  403. package/dist/esm/packages/ui/src/components/toggle.js.map +1 -1
  404. package/dist/esm/packages/ui/src/components/tooltip.js +20 -20
  405. package/dist/esm/packages/ui/src/components/tooltip.js.map +1 -1
  406. package/dist/esm/packages/ui/src/components/tree-view.js +218 -218
  407. package/dist/esm/packages/ui/src/components/tree-view.js.map +1 -1
  408. package/dist/esm/styles/index.css +1 -1
  409. package/dist/esm/utils/animations.js +55 -55
  410. package/dist/esm/utils/animations.js.map +1 -1
  411. package/dist/esm/utils/css.js +7 -7
  412. package/dist/esm/utils/css.js.map +1 -1
  413. package/dist/esm/utils/parsers.js +1 -1
  414. package/dist/types/components/DatePicker/RangePicker.d.ts.map +1 -1
  415. package/dist/types/lib/TextAnimation/TextPressureEffect.d.ts.map +1 -1
  416. package/dist/types/lib/TextAnimation/TypingText.d.ts.map +1 -1
  417. package/package.json +1 -1
  418. package/dist/cjs/node_modules/.pnpm/nuqs@2.8.0_next@15.5.9_react-dom@19.1.1_react@19.1.1__react@19.1.1__react@19.1.1/node_modules/nuqs/dist/server.cjs.map +0 -1
  419. package/dist/esm/node_modules/.pnpm/nuqs@2.8.0_next@15.5.9_react-dom@19.1.1_react@19.1.1__react@19.1.1__react@19.1.1/node_modules/nuqs/dist/server.js.map +0 -1
  420. /package/dist/cjs/node_modules/.pnpm/{nuqs@2.8.0_next@15.5.9_react-dom@19.1.1_react@19.1.1__react@19.1.1__react@19.1.1 → nuqs@2.8.0_next@15.5.9_@babel_core@7.28.5_react-dom@19.1.1_react@19.1.1__react@19.1.1__react@19.1.1}/node_modules/nuqs/dist/server.cjs +0 -0
  421. /package/dist/esm/node_modules/.pnpm/{nuqs@2.8.0_next@15.5.9_react-dom@19.1.1_react@19.1.1__react@19.1.1__react@19.1.1 → nuqs@2.8.0_next@15.5.9_@babel_core@7.28.5_react-dom@19.1.1_react@19.1.1__react@19.1.1__react@19.1.1}/node_modules/nuqs/dist/server.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.cjs","sources":["../../../../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n CalendarDayButton as SCalendarDayButton,\n type CalendarDayButtonProps as SCalendarDayButtonProps,\n Calendar,\n type CalendarProps,\n type CalendarColor,\n} from \"@dsui/ui/components/calendar\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@dsui/ui/components/popover\";\nimport {\n Drawer,\n DrawerContent,\n DrawerDescription,\n DrawerHeader,\n DrawerTitle,\n DrawerTrigger,\n} from \"@dsui/ui/components/drawer\";\nimport { cn } from \"@dsui/ui/index\";\nimport { Input, type InputProps } from \"../Input\";\nimport { Button } from \"../Button\";\nimport {\n TimePicker,\n type TimePickerMode,\n type DisabledTimeRange,\n} from \"./TimePicker\";\nimport { CalendarIcon } from \"lucide-react\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport { isMobile } from \"react-device-detect\";\nimport { format as dfFormat, parse, isValid, type Locale } from \"date-fns\";\nimport { vi, enUS } from \"date-fns/locale\";\nimport { DATE_FORMAT } from \"@/constants/common\";\n\nfunction formatDate(\n date: Date | undefined,\n outputFormat: string = DATE_FORMAT,\n locale?: Locale\n) {\n if (!date) return \"\";\n\n return dfFormat(date, outputFormat, locale ? { locale } : undefined);\n}\n\nconst parseDate = (\n str: string,\n inputFormat: string = DATE_FORMAT\n): Date | undefined => {\n const date = parse(str, inputFormat, new Date());\n return isValid(date) ? date : undefined;\n};\n\nfunction generateMaskFromFormat(format: string): string {\n return format\n .replace(/dd|MM|yyyy/g, (match) => {\n switch (match) {\n case \"dd\":\n case \"MM\":\n return \"99\";\n case \"yyyy\":\n return \"9999\";\n default:\n return match;\n }\n })\n .replace(/d|M|y/g, (match) => {\n switch (match) {\n case \"d\":\n case \"M\":\n return \"9\";\n case \"y\":\n return \"9\";\n default:\n return match;\n }\n });\n}\n\nexport type FormatType = string | { input: string; output: string };\n\nexport type DatePickerRenderProps = {\n value: string;\n date?: Date;\n onSelect: (date?: Date) => void;\n onChange: (text?: string) => void;\n};\n\nexport type DatePickerProps = Omit<\n InputProps,\n \"value\" | \"onChange\" | \"onSelect\" | \"mask\" | \"children\"\n> & {\n value?: string;\n onChange?: (\n event?: React.ChangeEvent<HTMLInputElement>,\n value?: string,\n date?: Date\n ) => void;\n onSelect?: (date?: Date, value?: string) => void;\n calendarClassName?: string;\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n align?: \"start\" | \"center\" | \"end\";\n size?: VariantProps<typeof Input>[\"size\"];\n format?: FormatType;\n language?: \"vi\" | \"en\";\n mask?: boolean | string;\n closeOnSelect?: boolean;\n calendarConfig?: CalendarProps;\n desktopMode?: \"popover\" | \"drawer\";\n mobileMode?: \"popover\" | \"drawer\";\n showOutsideDays?: boolean;\n children?: (props: DatePickerRenderProps) => React.ReactNode;\n showTime?: boolean;\n timeFormat?: \"HH:mm\" | \"HH:mm:ss\";\n hideDate?: boolean;\n numberOfMonths?: number;\n variant?: \"default\" | \"rounded\";\n color?: CalendarColor;\n\n // TimePicker configuration options\n timePickerMode?: TimePickerMode; // Display mode: 'wheel' (default), 'select', 'compact'\n hourInterval?: number; // Hour interval (e.g., 1, 2, 3) - defaults to 1\n minuteInterval?: number; // Minute interval (e.g., 5, 10, 15, 30) - defaults to 1\n secondInterval?: number; // Second interval (e.g., 5, 10, 15, 30) - defaults to 1\n disabledTimes?: string[]; // Array of disabled times in \"HH:mm\" or \"HH:mm:ss\" format\n disabledTimeRanges?: DisabledTimeRange[]; // Array of disabled time ranges\n showNowButton?: boolean; // Show \"Now\" button to select current time\n nowButtonLabel?: string; // Label for \"Now\" button (defaults to \"Now\")\n timePickerLabel?:\n | boolean\n | { hours?: string; minutes?: string; seconds?: string };\n openOnFocus?: boolean; // Auto open datepicker when input is focused (default: true)\n};\n\nexport function DatePicker({\n value,\n onChange,\n onSelect,\n calendarClassName,\n side = \"bottom\",\n align = \"end\",\n format = \"dd/MM/yyyy\",\n language = \"vi\",\n mask,\n closeOnSelect = false,\n calendarConfig,\n desktopMode = \"popover\",\n mobileMode = \"drawer\",\n showOutsideDays = true,\n children,\n showTime = false,\n timeFormat = \"HH:mm\",\n hideDate = false,\n numberOfMonths = 1,\n variant = \"default\",\n color = \"primary\",\n // TimePicker props\n timePickerMode = \"wheel\",\n hourInterval = 1,\n minuteInterval = 1,\n secondInterval = 1,\n disabledTimes,\n disabledTimeRanges,\n showNowButton = false,\n nowButtonLabel = \"Now\",\n timePickerLabel,\n openOnFocus = true,\n ...props\n}: DatePickerProps) {\n let inputFormat: string;\n let outputFormat: string;\n if (typeof format === \"string\") {\n inputFormat = format;\n outputFormat = format;\n } else {\n inputFormat = format.input;\n outputFormat = format.output;\n }\n\n // Determine the mask to use\n let maskToUse: string | undefined;\n if (mask === true) {\n maskToUse = generateMaskFromFormat(inputFormat);\n } else if (typeof mask === \"string\") {\n maskToUse = mask;\n }\n // If mask is false or undefined, maskToUse remains undefined\n\n // Parse initial value with correct format\n // - hideDate + showTime: time only (e.g., \"HH:mm\")\n // - showTime: date + time (e.g., \"dd/MM/yyyy HH:mm\")\n // - default: date only (e.g., \"dd/MM/yyyy\")\n const fullFormat =\n hideDate && showTime\n ? timeFormat\n : showTime\n ? `${inputFormat} ${timeFormat}`\n : inputFormat;\n\n const initialDate = value ? parseDate(value, fullFormat) : undefined;\n\n const [open, setOpen] = React.useState(false);\n const [date, setDate] = React.useState<Date | undefined>(initialDate);\n const [month, setMonth] = React.useState<Date | undefined>(initialDate);\n const [inputValue, setInputValue] = React.useState(value || \"\");\n const inputRef = React.useRef<HTMLInputElement>(null);\n const isUserTyping = React.useRef(false);\n\n const _locale: Locale = calendarConfig?.locale\n ? (calendarConfig?.locale as Locale)\n : language === \"en\"\n ? enUS\n : vi;\n\n const mode = isMobile ? mobileMode : desktopMode;\n\n // Sync inputValue when value prop changes from outside\n React.useEffect(() => {\n if (value !== inputValue && !isUserTyping.current) {\n setInputValue(value || \"\");\n const parsedDate = value ? parseDate(value, fullFormat) : undefined;\n if (parsedDate) {\n setDate(parsedDate);\n setMonth(parsedDate);\n } else if (!value) {\n // Clear states if value is empty\n setDate(undefined);\n setMonth(undefined);\n }\n }\n }, [value, inputValue, fullFormat]);\n\n // Helper to format date-time based on showTime and timeFormat\n const formatDateTimeValue = (d: Date | undefined): string => {\n if (!d) return \"\";\n let result = formatDate(d, outputFormat, _locale);\n if (showTime) {\n result += ` ${dfFormat(d, timeFormat)}`;\n }\n return result;\n };\n\n // Helper functions for render props\n const handleSelectForRenderProp = (date?: Date) => {\n setDate(date);\n setInputValue(formatDateTimeValue(date));\n onSelect?.(date, formatDateTimeValue(date));\n };\n\n const handleChangeForRenderProp = (text?: string) => {\n if (!text) {\n setInputValue(\"\");\n setDate(undefined);\n onSelect?.(undefined, undefined);\n return;\n }\n setInputValue(text);\n const parsedDate = parseDate(text, inputFormat);\n if (parsedDate) {\n setDate(parsedDate);\n setMonth(parsedDate);\n onSelect?.(parsedDate, formatDateTimeValue(parsedDate));\n } else {\n setDate(undefined);\n onSelect?.(undefined, undefined);\n }\n };\n\n const handleTimeChange = (\n event?: React.ChangeEvent<HTMLInputElement>,\n value?: string,\n newDate?: Date\n ) => {\n if (!newDate) {\n // Handle clear/invalid time\n onChange?.(event, value, undefined);\n return;\n }\n\n // Merge: keep date (year, month, day) from Calendar, take time (hours, minutes, seconds) from TimePicker\n const mergedDate = new Date(date || new Date());\n mergedDate.setHours(\n newDate.getHours(),\n newDate.getMinutes(),\n newDate.getSeconds(),\n 0\n );\n\n setDate(mergedDate);\n setInputValue(formatDateTimeValue(mergedDate));\n onSelect?.(mergedDate, formatDateTimeValue(mergedDate));\n onChange?.(event, formatDateTimeValue(mergedDate), mergedDate);\n };\n\n // Determine trigger component\n const triggerComponent = children ? (\n children({\n value: inputValue,\n date,\n onSelect: handleSelectForRenderProp,\n onChange: handleChangeForRenderProp,\n })\n ) : (\n <Button\n variant=\"ghost\"\n className=\"!p-1 !leading-0 h-auto rounded hover:bg-accent transition-colors\"\n size={props.size}\n >\n <CalendarIcon\n className={cn({\n \"size-3\": props.size === \"xs\" || props.size === \"sm\",\n \"size-3.5\": !props.size || props.size === \"normal\",\n \"size-4\": props.size === \"lg\" || props.size === \"xl\",\n })}\n />\n <span className=\"sr-only\">Select date</span>\n </Button>\n );\n\n const calendarSelection = (\n <div\n className={cn(\n \"flex items-stretch mx-auto w-full\",\n showTime && !hideDate ? \"gap-0 md:max-w-lg\" : \"\",\n // mode === \"drawer\" ? \"mb-6\" : \"\",\n isMobile ? \"max-w-md md:max-w-md lg:max-w-lg\" : \"\"\n )}\n >\n {!hideDate && (\n <Calendar\n {...calendarConfig}\n mode=\"single\"\n selected={date}\n captionLayout=\"dropdown\"\n month={month}\n onMonthChange={setMonth}\n numberOfMonths={isMobile ? 1 : numberOfMonths || 1}\n variant={variant}\n color={color}\n onSelect={(selectedDate) => {\n // Preserve time from current date when selecting new date\n let newDate = selectedDate;\n if (selectedDate && date && showTime) {\n newDate = new Date(selectedDate);\n newDate.setHours(\n date.getHours(),\n date.getMinutes(),\n date.getSeconds(),\n date.getMilliseconds()\n );\n }\n setDate(newDate);\n setInputValue(formatDateTimeValue(newDate));\n onSelect?.(newDate, formatDateTimeValue(newDate));\n if (closeOnSelect && !showTime) setOpen(false);\n }}\n locale={_locale}\n formatters={{\n formatMonthDropdown: (date) =>\n date.toLocaleString(_locale.code, { month: \"short\" }),\n }}\n showOutsideDays={showOutsideDays}\n className={cn(\n \"my-auto bg-transparent mx-auto\",\n {\n \"[--cell-size:clamp(0px,calc(100vw/7.5),52px)] mb-8 bg-transparent\":\n (isMobile && !showTime) || desktopMode === \"drawer\",\n \"[--cell-size:clamp(0px,calc(100vw/7.5),34px)]\":\n !isMobile && desktopMode !== \"drawer\",\n \"w-full\": mode === \"drawer\" && showTime,\n },\n calendarClassName\n )}\n />\n )}\n {showTime && (\n <div className=\"border-l border-border\">\n <TimePicker\n value={date ? dfFormat(date, timeFormat) : undefined}\n format={timeFormat}\n onChange={handleTimeChange}\n showHours\n showMinutes\n showSeconds={timeFormat === \"HH:mm:ss\"}\n mode={timePickerMode}\n hourInterval={hourInterval}\n minuteInterval={minuteInterval}\n secondInterval={secondInterval}\n disabledTimes={disabledTimes}\n disabledTimeRanges={disabledTimeRanges}\n showNowButton={showNowButton}\n nowButtonLabel={nowButtonLabel}\n timeLabel={timePickerLabel}\n standalone={false}\n color={color}\n isOpen={open}\n />\n </div>\n )}\n </div>\n );\n\n const popPicker = (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild disabled={props.disabled}>\n {triggerComponent}\n </PopoverTrigger>\n <PopoverContent\n className={cn(\n \"w-auto overflow-hidden p-0\",\n \"backdrop-blur bg-background/50\"\n )}\n side={side}\n align={align}\n >\n {calendarSelection}\n </PopoverContent>\n </Popover>\n );\n\n const drawPicker = (\n <Drawer open={open} onOpenChange={setOpen}>\n <DrawerTrigger asChild>{triggerComponent}</DrawerTrigger>\n <DrawerContent\n className={cn(\n \"w-auto overflow-hidden p-0\",\n \"backdrop-blur bg-background\"\n )}\n >\n <DrawerHeader className=\"sr-only\">\n <DrawerTitle>Select date</DrawerTitle>\n <DrawerDescription>Set date</DrawerDescription>\n </DrawerHeader>\n {calendarSelection}\n </DrawerContent>\n </Drawer>\n );\n\n // If children is provided, use render prop pattern with picker\n if (children) {\n return mode === \"drawer\" ? drawPicker : popPicker;\n }\n\n // Default input rendering\n return (\n <Input\n {...props}\n ref={inputRef}\n type=\"text\"\n clearable\n value={inputValue}\n mask={maskToUse}\n onChange={(e) => {\n isUserTyping.current = true;\n setInputValue(e.target.value);\n const date = parseDate(e.target.value, inputFormat);\n if (date) {\n setDate(date);\n setMonth(date);\n onSelect?.(date, formatDateTimeValue(date));\n onChange?.(e, formatDateTimeValue(date), date);\n } else {\n onSelect?.(undefined, undefined);\n onChange?.(e, undefined, undefined);\n }\n }}\n onFocus={(e) => {\n // Don't auto-open if mask is enabled - user wants to type directly\n if (openOnFocus && !open && !maskToUse) {\n setOpen(true);\n }\n props.onFocus?.(e);\n }}\n onBlur={(e) => {\n // Don't clear value when picker is open - user might be interacting with it\n // The onBlur fires when focus moves to the picker\n setTimeout(() => {\n isUserTyping.current = false;\n // Only validate and clear if picker is closed\n if (!open) {\n const parsedDate = parseDate(inputValue, inputFormat);\n if (!parsedDate && inputValue) {\n setInputValue(\"\");\n setDate(undefined);\n setMonth(undefined);\n onSelect?.(undefined, undefined);\n }\n }\n }, 150);\n props.onBlur?.(e);\n }}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setOpen(true);\n }\n props.onKeyDown?.(e);\n }}\n suffixIcon={mode === \"drawer\" ? drawPicker : popPicker}\n />\n );\n}\n"],"names":["formatDate","date","outputFormat","DATE_FORMAT","locale","dfFormat","parseDate","str","inputFormat","parse","isValid","generateMaskFromFormat","format","match","DatePicker","value","onChange","onSelect","calendarClassName","side","align","language","mask","closeOnSelect","calendarConfig","desktopMode","mobileMode","showOutsideDays","children","showTime","timeFormat","hideDate","numberOfMonths","variant","color","timePickerMode","hourInterval","minuteInterval","secondInterval","disabledTimes","disabledTimeRanges","showNowButton","nowButtonLabel","timePickerLabel","openOnFocus","props","maskToUse","fullFormat","initialDate","open","setOpen","React","setDate","month","setMonth","inputValue","setInputValue","inputRef","isUserTyping","_locale","enUS","vi","mode","isMobile","parsedDate","formatDateTimeValue","d","result","handleSelectForRenderProp","handleChangeForRenderProp","text","handleTimeChange","event","newDate","mergedDate","triggerComponent","jsxs","Button","jsx","CalendarIcon","cn","calendarSelection","Calendar","selectedDate","TimePicker","popPicker","Popover","PopoverTrigger","PopoverContent","drawPicker","Drawer","DrawerTrigger","DrawerContent","DrawerHeader","DrawerTitle","DrawerDescription","Input"],"mappings":"6nEAoCA,SAASA,GACPC,EACAC,EAAuBC,EAAAA,YACvBC,EACA,CACA,OAAKH,EAEEI,EAAAA,OAASJ,EAAMC,EAAcE,EAAS,CAAE,OAAAA,CAAA,EAAW,MAAS,EAFjD,EAGpB,CAEA,MAAME,EAAY,CAChBC,EACAC,EAAsBL,gBACD,CACrB,MAAMF,EAAOQ,EAAAA,MAAMF,EAAKC,EAAa,IAAI,IAAM,EAC/C,OAAOE,UAAQT,CAAI,EAAIA,EAAO,MAChC,EAEA,SAASU,GAAuBC,EAAwB,CACtD,OAAOA,EACJ,QAAQ,cAAgBC,GAAU,CACjC,OAAQA,EAAA,CACN,IAAK,KACL,IAAK,KACH,MAAO,KACT,IAAK,OACH,MAAO,OACT,QACE,OAAOA,CAAA,CAEb,CAAC,EACA,QAAQ,SAAWA,GAAU,CAC5B,OAAQA,EAAA,CACN,IAAK,IACL,IAAK,IACH,MAAO,IACT,IAAK,IACH,MAAO,IACT,QACE,OAAOA,CAAA,CAEb,CAAC,CACL,CAyDO,SAASC,GAAW,CACzB,MAAAC,EACA,SAAAC,EACA,SAAAC,EACA,kBAAAC,EACA,KAAAC,EAAO,SACP,MAAAC,EAAQ,MACR,OAAAR,EAAS,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aJ,CAAA,CAAA,CAGnD"}
1
+ {"version":3,"file":"DatePicker.cjs","sources":["../../../../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n CalendarDayButton as SCalendarDayButton,\n type CalendarDayButtonProps as SCalendarDayButtonProps,\n Calendar,\n type CalendarProps,\n type CalendarColor,\n} from \"@dsui/ui/components/calendar\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@dsui/ui/components/popover\";\nimport {\n Drawer,\n DrawerContent,\n DrawerDescription,\n DrawerHeader,\n DrawerTitle,\n DrawerTrigger,\n} from \"@dsui/ui/components/drawer\";\nimport { cn } from \"@dsui/ui/index\";\nimport { Input, type InputProps } from \"../Input\";\nimport { Button } from \"../Button\";\nimport {\n TimePicker,\n type TimePickerMode,\n type DisabledTimeRange,\n} from \"./TimePicker\";\nimport { CalendarIcon } from \"lucide-react\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport { isMobile } from \"react-device-detect\";\nimport { format as dfFormat, parse, isValid, type Locale } from \"date-fns\";\nimport { vi, enUS } from \"date-fns/locale\";\nimport { DATE_FORMAT } from \"@/constants/common\";\n\nfunction formatDate(\n date: Date | undefined,\n outputFormat: string = DATE_FORMAT,\n locale?: Locale\n) {\n if (!date) return \"\";\n\n return dfFormat(date, outputFormat, locale ? { locale } : undefined);\n}\n\nconst parseDate = (\n str: string,\n inputFormat: string = DATE_FORMAT\n): Date | undefined => {\n const date = parse(str, inputFormat, new Date());\n return isValid(date) ? date : undefined;\n};\n\nfunction generateMaskFromFormat(format: string): string {\n return format\n .replace(/dd|MM|yyyy/g, (match) => {\n switch (match) {\n case \"dd\":\n case \"MM\":\n return \"99\";\n case \"yyyy\":\n return \"9999\";\n default:\n return match;\n }\n })\n .replace(/d|M|y/g, (match) => {\n switch (match) {\n case \"d\":\n case \"M\":\n return \"9\";\n case \"y\":\n return \"9\";\n default:\n return match;\n }\n });\n}\n\nexport type FormatType = string | { input: string; output: string };\n\nexport type DatePickerRenderProps = {\n value: string;\n date?: Date;\n onSelect: (date?: Date) => void;\n onChange: (text?: string) => void;\n};\n\nexport type DatePickerProps = Omit<\n InputProps,\n \"value\" | \"onChange\" | \"onSelect\" | \"mask\" | \"children\"\n> & {\n value?: string;\n onChange?: (\n event?: React.ChangeEvent<HTMLInputElement>,\n value?: string,\n date?: Date\n ) => void;\n onSelect?: (date?: Date, value?: string) => void;\n calendarClassName?: string;\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n align?: \"start\" | \"center\" | \"end\";\n size?: VariantProps<typeof Input>[\"size\"];\n format?: FormatType;\n language?: \"vi\" | \"en\";\n mask?: boolean | string;\n closeOnSelect?: boolean;\n calendarConfig?: CalendarProps;\n desktopMode?: \"popover\" | \"drawer\";\n mobileMode?: \"popover\" | \"drawer\";\n showOutsideDays?: boolean;\n children?: (props: DatePickerRenderProps) => React.ReactNode;\n showTime?: boolean;\n timeFormat?: \"HH:mm\" | \"HH:mm:ss\";\n hideDate?: boolean;\n numberOfMonths?: number;\n variant?: \"default\" | \"rounded\";\n color?: CalendarColor;\n\n // TimePicker configuration options\n timePickerMode?: TimePickerMode; // Display mode: 'wheel' (default), 'select', 'compact'\n hourInterval?: number; // Hour interval (e.g., 1, 2, 3) - defaults to 1\n minuteInterval?: number; // Minute interval (e.g., 5, 10, 15, 30) - defaults to 1\n secondInterval?: number; // Second interval (e.g., 5, 10, 15, 30) - defaults to 1\n disabledTimes?: string[]; // Array of disabled times in \"HH:mm\" or \"HH:mm:ss\" format\n disabledTimeRanges?: DisabledTimeRange[]; // Array of disabled time ranges\n showNowButton?: boolean; // Show \"Now\" button to select current time\n nowButtonLabel?: string; // Label for \"Now\" button (defaults to \"Now\")\n timePickerLabel?:\n | boolean\n | { hours?: string; minutes?: string; seconds?: string };\n openOnFocus?: boolean; // Auto open datepicker when input is focused (default: true)\n};\n\nexport function DatePicker({\n value,\n onChange,\n onSelect,\n calendarClassName,\n side = \"bottom\",\n align = \"end\",\n format = \"dd/MM/yyyy\",\n language = \"vi\",\n mask,\n closeOnSelect = false,\n calendarConfig,\n desktopMode = \"popover\",\n mobileMode = \"drawer\",\n showOutsideDays = true,\n children,\n showTime = false,\n timeFormat = \"HH:mm\",\n hideDate = false,\n numberOfMonths = 1,\n variant = \"default\",\n color = \"primary\",\n // TimePicker props\n timePickerMode = \"wheel\",\n hourInterval = 1,\n minuteInterval = 1,\n secondInterval = 1,\n disabledTimes,\n disabledTimeRanges,\n showNowButton = false,\n nowButtonLabel = \"Now\",\n timePickerLabel,\n openOnFocus = true,\n ...props\n}: DatePickerProps) {\n let inputFormat: string;\n let outputFormat: string;\n if (typeof format === \"string\") {\n inputFormat = format;\n outputFormat = format;\n } else {\n inputFormat = format.input;\n outputFormat = format.output;\n }\n\n // Determine the mask to use\n let maskToUse: string | undefined;\n if (mask === true) {\n maskToUse = generateMaskFromFormat(inputFormat);\n } else if (typeof mask === \"string\") {\n maskToUse = mask;\n }\n // If mask is false or undefined, maskToUse remains undefined\n\n // Parse initial value with correct format\n // - hideDate + showTime: time only (e.g., \"HH:mm\")\n // - showTime: date + time (e.g., \"dd/MM/yyyy HH:mm\")\n // - default: date only (e.g., \"dd/MM/yyyy\")\n const fullFormat =\n hideDate && showTime\n ? timeFormat\n : showTime\n ? `${inputFormat} ${timeFormat}`\n : inputFormat;\n\n const initialDate = value ? parseDate(value, fullFormat) : undefined;\n\n const [open, setOpen] = React.useState(false);\n const [date, setDate] = React.useState<Date | undefined>(initialDate);\n const [month, setMonth] = React.useState<Date | undefined>(initialDate);\n const [inputValue, setInputValue] = React.useState(value || \"\");\n const inputRef = React.useRef<HTMLInputElement>(null);\n const isUserTyping = React.useRef(false);\n\n const _locale: Locale = calendarConfig?.locale\n ? (calendarConfig?.locale as Locale)\n : language === \"en\"\n ? enUS\n : vi;\n\n const mode = isMobile ? mobileMode : desktopMode;\n\n // Sync inputValue when value prop changes from outside\n React.useEffect(() => {\n if (value !== inputValue && !isUserTyping.current) {\n setInputValue(value || \"\");\n const parsedDate = value ? parseDate(value, fullFormat) : undefined;\n if (parsedDate) {\n setDate(parsedDate);\n setMonth(parsedDate);\n } else if (!value) {\n // Clear states if value is empty\n setDate(undefined);\n setMonth(undefined);\n }\n }\n }, [value, inputValue, fullFormat]);\n\n // Helper to format date-time based on showTime and timeFormat\n const formatDateTimeValue = (d: Date | undefined): string => {\n if (!d) return \"\";\n let result = formatDate(d, outputFormat, _locale);\n if (showTime) {\n result += ` ${dfFormat(d, timeFormat)}`;\n }\n return result;\n };\n\n // Helper functions for render props\n const handleSelectForRenderProp = (date?: Date) => {\n setDate(date);\n setInputValue(formatDateTimeValue(date));\n onSelect?.(date, formatDateTimeValue(date));\n };\n\n const handleChangeForRenderProp = (text?: string) => {\n if (!text) {\n setInputValue(\"\");\n setDate(undefined);\n onSelect?.(undefined, undefined);\n return;\n }\n setInputValue(text);\n const parsedDate = parseDate(text, inputFormat);\n if (parsedDate) {\n setDate(parsedDate);\n setMonth(parsedDate);\n onSelect?.(parsedDate, formatDateTimeValue(parsedDate));\n } else {\n setDate(undefined);\n onSelect?.(undefined, undefined);\n }\n };\n\n const handleTimeChange = (\n event?: React.ChangeEvent<HTMLInputElement>,\n value?: string,\n newDate?: Date\n ) => {\n if (!newDate) {\n // Handle clear/invalid time\n onChange?.(event, value, undefined);\n return;\n }\n\n // Merge: keep date (year, month, day) from Calendar, take time (hours, minutes, seconds) from TimePicker\n const mergedDate = new Date(date || new Date());\n mergedDate.setHours(\n newDate.getHours(),\n newDate.getMinutes(),\n newDate.getSeconds(),\n 0\n );\n\n setDate(mergedDate);\n setInputValue(formatDateTimeValue(mergedDate));\n onSelect?.(mergedDate, formatDateTimeValue(mergedDate));\n onChange?.(event, formatDateTimeValue(mergedDate), mergedDate);\n };\n\n // Determine trigger component\n const triggerComponent = children ? (\n children({\n value: inputValue,\n date,\n onSelect: handleSelectForRenderProp,\n onChange: handleChangeForRenderProp,\n })\n ) : (\n <Button\n variant=\"ghost\"\n className=\"ds:!p-1 ds:!leading-0 ds:h-auto ds:rounded ds:hover:bg-accent ds:transition-colors\"\n size={props.size}\n >\n <CalendarIcon\n className={cn({\n \"ds:size-3\": props.size === \"xs\" || props.size === \"sm\",\n \"ds:size-3.5\": !props.size || props.size === \"normal\",\n \"ds:size-4\": props.size === \"lg\" || props.size === \"xl\",\n })}\n />\n <span className=\"ds:sr-only\">Select date</span>\n </Button>\n );\n\n const calendarSelection = (\n <div\n className={cn(\n \"ds:flex ds:items-stretch ds:mx-auto ds:w-full\",\n showTime && !hideDate ? \"ds:gap-0 ds:md:max-w-lg\" : \"\",\n // mode === \"drawer\" ? \"mb-6\" : \"\",\n isMobile ? \"ds:max-w-md ds:md:max-w-md ds:lg:max-w-lg\" : \"\"\n )}\n >\n {!hideDate && (\n <Calendar\n {...calendarConfig}\n mode=\"single\"\n selected={date}\n captionLayout=\"dropdown\"\n month={month}\n onMonthChange={setMonth}\n numberOfMonths={isMobile ? 1 : numberOfMonths || 1}\n variant={variant}\n color={color}\n onSelect={(selectedDate) => {\n // Preserve time from current date when selecting new date\n let newDate = selectedDate;\n if (selectedDate && date && showTime) {\n newDate = new Date(selectedDate);\n newDate.setHours(\n date.getHours(),\n date.getMinutes(),\n date.getSeconds(),\n date.getMilliseconds()\n );\n }\n setDate(newDate);\n setInputValue(formatDateTimeValue(newDate));\n onSelect?.(newDate, formatDateTimeValue(newDate));\n if (closeOnSelect && !showTime) setOpen(false);\n }}\n locale={_locale}\n formatters={{\n formatMonthDropdown: (date) =>\n date.toLocaleString(_locale.code, { month: \"short\" }),\n }}\n showOutsideDays={showOutsideDays}\n className={cn(\n \"ds:my-auto ds:bg-transparent ds:mx-auto\",\n {\n \"ds:[--cell-size:clamp(0px,calc(100vw/7.5),52px)] ds:mb-8 ds:bg-transparent\":\n (isMobile && !showTime) || desktopMode === \"drawer\",\n \"ds:[--cell-size:clamp(0px,calc(100vw/7.5),34px)]\":\n !isMobile && desktopMode !== \"drawer\",\n \"ds:w-full\": mode === \"drawer\" && showTime,\n },\n calendarClassName\n )}\n />\n )}\n {showTime && (\n <div className=\"ds:border-l ds:border-border\">\n <TimePicker\n value={date ? dfFormat(date, timeFormat) : undefined}\n format={timeFormat}\n onChange={handleTimeChange}\n showHours\n showMinutes\n showSeconds={timeFormat === \"HH:mm:ss\"}\n mode={timePickerMode}\n hourInterval={hourInterval}\n minuteInterval={minuteInterval}\n secondInterval={secondInterval}\n disabledTimes={disabledTimes}\n disabledTimeRanges={disabledTimeRanges}\n showNowButton={showNowButton}\n nowButtonLabel={nowButtonLabel}\n timeLabel={timePickerLabel}\n standalone={false}\n color={color}\n isOpen={open}\n />\n </div>\n )}\n </div>\n );\n\n const popPicker = (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild disabled={props.disabled}>\n {triggerComponent}\n </PopoverTrigger>\n <PopoverContent\n className={cn(\n \"ds:w-auto ds:overflow-hidden ds:p-0\",\n \"ds:backdrop-blur ds:bg-background/50\"\n )}\n side={side}\n align={align}\n >\n {calendarSelection}\n </PopoverContent>\n </Popover>\n );\n\n const drawPicker = (\n <Drawer open={open} onOpenChange={setOpen}>\n <DrawerTrigger asChild>{triggerComponent}</DrawerTrigger>\n <DrawerContent\n className={cn(\n \"ds:w-auto ds:overflow-hidden ds:p-0\",\n \"ds:backdrop-blur ds:bg-background\"\n )}\n >\n <DrawerHeader className=\"ds:sr-only\">\n <DrawerTitle>Select date</DrawerTitle>\n <DrawerDescription>Set date</DrawerDescription>\n </DrawerHeader>\n {calendarSelection}\n </DrawerContent>\n </Drawer>\n );\n\n // If children is provided, use render prop pattern with picker\n if (children) {\n return mode === \"drawer\" ? drawPicker : popPicker;\n }\n\n // Default input rendering\n return (\n <Input\n {...props}\n ref={inputRef}\n type=\"text\"\n clearable\n value={inputValue}\n mask={maskToUse}\n onChange={(e) => {\n isUserTyping.current = true;\n setInputValue(e.target.value);\n const date = parseDate(e.target.value, inputFormat);\n if (date) {\n setDate(date);\n setMonth(date);\n onSelect?.(date, formatDateTimeValue(date));\n onChange?.(e, formatDateTimeValue(date), date);\n } else {\n onSelect?.(undefined, undefined);\n onChange?.(e, undefined, undefined);\n }\n }}\n onFocus={(e) => {\n // Don't auto-open if mask is enabled - user wants to type directly\n if (openOnFocus && !open && !maskToUse) {\n setOpen(true);\n }\n props.onFocus?.(e);\n }}\n onBlur={(e) => {\n // Don't clear value when picker is open - user might be interacting with it\n // The onBlur fires when focus moves to the picker\n setTimeout(() => {\n isUserTyping.current = false;\n // Only validate and clear if picker is closed\n if (!open) {\n const parsedDate = parseDate(inputValue, inputFormat);\n if (!parsedDate && inputValue) {\n setInputValue(\"\");\n setDate(undefined);\n setMonth(undefined);\n onSelect?.(undefined, undefined);\n }\n }\n }, 150);\n props.onBlur?.(e);\n }}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setOpen(true);\n }\n props.onKeyDown?.(e);\n }}\n suffixIcon={mode === \"drawer\" ? drawPicker : popPicker}\n />\n );\n}\n"],"names":["formatDate","date","outputFormat","DATE_FORMAT","locale","dfFormat","parseDate","str","inputFormat","parse","isValid","generateMaskFromFormat","format","match","DatePicker","value","onChange","onSelect","calendarClassName","side","align","language","mask","closeOnSelect","calendarConfig","desktopMode","mobileMode","showOutsideDays","children","showTime","timeFormat","hideDate","numberOfMonths","variant","color","timePickerMode","hourInterval","minuteInterval","secondInterval","disabledTimes","disabledTimeRanges","showNowButton","nowButtonLabel","timePickerLabel","openOnFocus","props","maskToUse","fullFormat","initialDate","open","setOpen","React","setDate","month","setMonth","inputValue","setInputValue","inputRef","isUserTyping","_locale","enUS","vi","mode","isMobile","parsedDate","formatDateTimeValue","d","result","handleSelectForRenderProp","handleChangeForRenderProp","text","handleTimeChange","event","newDate","mergedDate","triggerComponent","jsxs","Button","jsx","CalendarIcon","cn","calendarSelection","Calendar","selectedDate","TimePicker","popPicker","Popover","PopoverTrigger","PopoverContent","drawPicker","Drawer","DrawerTrigger","DrawerContent","DrawerHeader","DrawerTitle","DrawerDescription","Input"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KAAK,EAC5B,MAAMvD,EAAOK,EAAU,EAAE,OAAO,MAAOE,CAAW,EAC9CP,GACFmD,EAAQnD,CAAI,EACZqD,EAASrD,CAAI,EACbgB,IAAWhB,EAAMgE,EAAoBhE,CAAI,CAAC,EAC1Ce,IAAW,EAAGiD,EAAoBhE,CAAI,EAAGA,CAAI,IAE7CgB,IAAW,OAAW,MAAS,EAC/BD,IAAW,EAAG,OAAW,MAAS,EAEtC,EACA,QAAU,GAAM,CAEV4B,IAAe,CAACK,GAAQ,CAACH,GAC3BI,EAAQ,EAAI,EAEdL,EAAM,UAAU,CAAC,CACnB,EACA,OAAS,GAAM,CAGb,WAAW,IAAM,CACfa,EAAa,QAAU,GAElBT,GAEC,CADe3C,EAAUiD,EAAY/C,CAAW,GACjC+C,IACjBC,EAAc,EAAE,EAChBJ,EAAQ,MAAS,EACjBE,EAAS,MAAS,EAClBrC,IAAW,OAAW,MAAS,EAGrC,EAAG,GAAG,EACN4B,EAAM,SAAS,CAAC,CAClB,EACA,UAAY,GAAM,CACZ,EAAE,MAAQ,cACZ,EAAE,eAAA,EACFK,EAAQ,EAAI,GAEdL,EAAM,YAAY,CAAC,CACrB,EACA,WAAYiB,IAAS,SAAW2B,EAAaJ,CAAA,CAAA,CAGnD"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),Oe=require("react"),Se=require("../../packages/ui/src/components/calendar.cjs"),Z=require("../../packages/ui/src/components/popover.cjs"),P=require("../../packages/ui/src/components/drawer.cjs");require("@radix-ui/react-slot");require("../../packages/ui/src/components/button.cjs");require("../../packages/ui/src/components/button-group.cjs");require("../../packages/ui/src/components/input.cjs");require("../../packages/ui/src/components/textarea.cjs");require("@radix-ui/react-label");const z=require("../../packages/ui/src/lib/utils.cjs");require("../../packages/ui/src/components/select.cjs");require("../../packages/ui/src/components/combobox.cjs");require("@radix-ui/react-tooltip");require("@radix-ui/react-separator");require("../../packages/ui/src/components/switch.cjs");require("@radix-ui/react-scroll-area");require("../../packages/ui/src/components/tree-view.cjs");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-avatar");require("../../packages/ui/src/components/badge.cjs");const le=require("lucide-react");require("../../packages/ui/src/components/checkbox.cjs");require("@radix-ui/react-collapsible");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-dropdown-menu");require("../../packages/ui/src/components/input-otp.cjs");require("../../packages/ui/src/components/radio-group.cjs");require("../../packages/ui/src/components/sidebar.cjs");require("@radix-ui/react-slider");require("../../packages/ui/src/components/tabs.cjs");require("../../packages/ui/src/components/toggle.cjs");const fe=require("./TimePicker.cjs"),S=require("react-device-detect"),H=require("date-fns"),de=require("date-fns/locale"),me=require("../../constants/common.cjs"),Ie=require("../FloatLabel.cjs"),ke=require("../Button/Button.cjs"),Ve=require("../Input/Input.cjs");function Ce(u){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const f in u)if(f!=="default"){const w=Object.getOwnPropertyDescriptor(u,f);Object.defineProperty(a,f,w.get?w:{enumerable:!0,get:()=>u[f]})}}return a.default=u,Object.freeze(a)}const D=Ce(Oe);function $e(u,a=me.DATE_FORMAT,f){return u?H.format(u,a,f?{locale:f}:void 0):""}const j=(u,a=me.DATE_FORMAT)=>{const f=H.parse(u,a,new Date);return H.isValid(f)?f:void 0};function Le(u){return u.replace(/dd|MM|yyyy/g,a=>{switch(a){case"dd":case"MM":return"99";case"yyyy":return"9999";default:return a}}).replace(/d|M|y/g,a=>{switch(a){case"d":case"M":return"9";case"y":return"9";default:return a}})}function Ae({label:u,value:a,placeholder:f,onChange:w,onSelect:d,calendarClassName:ge,side:be="bottom",align:ve="end",format:O="dd/MM/yyyy",language:we="vi",mask:V,closeOnSelect:he=!1,showOutsideDays:qe=!0,calendarConfig:C,timeConfig:ee,desktopMode:I="popover",mobileMode:re="drawer",children:$,separator:pe=i.jsx(le.MoveRight,{className:"size-5"}),showTime:x=!1,timeFormat:h="HH:mm",hideDate:te=!1,numberOfMonths:De=1,variant:je="default",color:xe="primary",...s}){const oe=D.useId();let g,L;typeof O=="string"?(g=O,L=O):(g=O.input,L=O.output);let A;V===!0?A=Le(g):typeof V=="string"&&(A=V);const ne=a?.from?j(a.from,g):void 0,ye=a?.to?j(a.to,g):void 0,Me={from:ne,to:ye},[se,k]=D.useState(!1),[n,m]=D.useState(Me),[Te,E]=D.useState(ne||new Date),[F,q]=D.useState(a?.from||""),[R,p]=D.useState(a?.to||""),[_,B]=D.useState(void 0),[U,Y]=D.useState(void 0),K=D.useRef(null),G=D.useRef(null),ze=!!(F.trim()||R.trim()),J=C?.locale?C?.locale:we==="en"?de.enUS:de.vi,t=e=>{if(!e)return"";let r=$e(e,L,J);return x&&(r+=` ${H.format(e,h)}`),r},Fe=e=>{m(e);const r=t(e?.from),o=t(e?.to);q(r),p(o),d?.(e,{from:r,to:o})},Re=e=>{if(q(e),e.trim()===""){q(""),p("");const b={from:void 0,to:void 0};m(b),d?.(b,b);return}let r;x?r=j(e,`${g} ${h}`):r=j(e,g);const o={from:r,to:n?.to};r?(m(o),E(r),B(r),d?.(o,{from:t(r),to:t(n?.to)})):(m(o),d?.(o,{from:t(n?.from),to:t(n?.to)}))},Ne=e=>{if(p(e),e.trim()===""){q(""),p("");const b={from:void 0,to:void 0};m(b),d?.(b,b);return}let r;x?r=j(e,`${g} ${h}`):r=j(e,g);const o={from:n?.from,to:r};r?(m(o),Y(r),d?.(o,{from:t(n?.from),to:t(r)})):(m(o),d?.(o,{from:t(n?.from),to:void 0}))},Pe=e=>{if(e){B(e);const r=new Date(n?.from||new Date);r.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),0);const o={from:r,to:n?.to};m(o),q(t(r)),d?.(o,{from:t(r),to:t(n?.to)}),w?.(o,{from:t(r),to:t(n?.to)})}},He=e=>{if(e){Y(e);const r=new Date(n?.to||new Date);r.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),0);const o={from:n?.from,to:r};m(o),p(t(r)),d?.(o,{from:t(n?.from),to:t(r)}),w?.(o,{from:t(n?.from),to:t(r)})}},ie=$?$({fromValue:F,toValue:R,range:n,onSelect:Fe,onFromChange:Re,onToChange:Ne}):i.jsxs(ke.default,{variant:"ghost",className:"!p-1 !leading-0 h-auto rounded hover:bg-accent transition-colors",size:s?.size,children:[i.jsx(le.CalendarIcon,{className:z.cn({"size-3":s.size==="xs"||s.size==="sm","size-3.5":!s.size||s.size==="normal","size-4":s.size==="lg"||s.size==="xl"})}),i.jsx("span",{className:"sr-only",children:"Select date range"})]}),ae=i.jsxs("div",{className:z.cn("flex items-stretch",x&&!te?"gap-0":""),children:[!te&&i.jsx(Se.Calendar,{...C,mode:"range",selected:n,captionLayout:"dropdown",month:Te,onMonthChange:E,numberOfMonths:S.isMobile?1:De||1,variant:je,color:xe,onSelect:e=>{let r=e;if(x){const c=_,l=U;r={from:e?.from?new Date(e.from.getFullYear(),e.from.getMonth(),e.from.getDate(),c?.getHours()||0,c?.getMinutes()||0,c?.getSeconds()||0):void 0,to:e?.to?new Date(e.to.getFullYear(),e.to.getMonth(),e.to.getDate(),l?.getHours()||0,l?.getMinutes()||0,l?.getSeconds()||0):void 0}}m(r);const o=t(r?.from),b=t(r?.to);q(o),p(b),d?.(r,{from:o,to:b}),w?.(r,{from:o,to:b}),he&&r?.from&&r?.to&&!x&&k(!1)},locale:J,formatters:{formatMonthDropdown:e=>e.toLocaleString(J.code,{month:"short"})},showOutsideDays:qe,className:z.cn("mx-auto",{"[--cell-size:clamp(0px,calc(100vw/7.5),52px)] mb-8 bg-transparent":S.isMobile||I==="drawer","[--cell-size:clamp(0px,calc(100vw/7.5),34px)]":!S.isMobile&&I!=="drawer"},ge)}),x&&i.jsxs("div",{className:"flex gap-0 border-l border-border",children:[i.jsx(fe.TimePicker,{...ee?.[0],value:_?H.format(_,h):void 0,onSelect:Pe,format:h,showHours:!0,showMinutes:!0,showSeconds:h==="HH:mm:ss",standalone:!1}),i.jsx("div",{className:"border-l border-border"}),i.jsx(fe.TimePicker,{...ee?.[1],value:U?H.format(U,h):void 0,onSelect:He,format:h,showHours:!0,showMinutes:!0,showSeconds:h==="HH:mm:ss",standalone:!1})]})]}),Q=i.jsxs(Z.Popover,{open:se,onOpenChange:k,children:[i.jsx(Z.PopoverTrigger,{asChild:!0,disabled:s.disabled,children:ie}),i.jsx(Z.PopoverContent,{className:z.cn("w-auto overflow-hidden p-0","backdrop-blur bg-background/50"),side:be,align:ve,children:ae})]}),W=i.jsxs(P.Drawer,{open:se,onOpenChange:k,children:[i.jsx(P.DrawerTrigger,{asChild:!0,children:ie}),i.jsxs(P.DrawerContent,{className:z.cn("w-auto overflow-hidden p-0","backdrop-blur bg-background"),children:[i.jsxs(P.DrawerHeader,{className:"sr-only",children:[i.jsx(P.DrawerTitle,{children:"Select date range"}),i.jsx(P.DrawerDescription,{children:"Set your date range"})]}),ae]})]});if($)return(S.isMobile?re:I)==="drawer"?W:Q;const ce=(e,r,o,b)=>{const c=e==="from";return i.jsx(Ve.default,{...s,...b,ref:c?K:G,id:oe,size:s.isFloatLabel?s.size?s.size:"xl":s.size,className:z.cn(s.className,"relative peer border-0 focus:ring-0 rounded-none hover:bg-transparent active:bg-transparent focus-visible:ring-0 focus-visible:border-0",c?"pr-0":""),label:s.isFloatLabel&&typeof u=="object"?c?u?.from||"":u?.to||"":"",placeholder:typeof f=="object"?c?f?.from||"":f?.to||"":f,clearable:!c,value:r,mask:A,onChange:l=>{const y=l.target.value;if(o(y),y.trim()===""){q(""),p("");const M={from:void 0,to:void 0};m(M),d?.(M,M),w?.(M,M);return}let v;x?v=j(y,`${g} ${h}`):v=j(y,g);const N=c?{from:v,to:n?.to}:{from:n?.from,to:v};if(v){m(N),c&&E(v),c?B(v):Y(v);const M=t(c?v:n?.from),ue=t(c?n?.to:v);d?.(N,{from:M,to:ue}),w?.(N,{from:c?y:F,to:c?R:y})}else d?.(N,{from:t(n?.from),to:c?t(n?.to):void 0}),w?.(N,{from:t(n?.from),to:c?t(n?.to):void 0})},onClear:c?void 0:()=>{q(""),p("");const l={from:void 0,to:void 0};m(l),d?.(l,l),w?.(l,l)},onBlur:()=>{const l=document.activeElement;l!==K.current&&l!==G.current&&setTimeout(()=>{const y=document.activeElement;if(y!==K.current&&y!==G.current){const v=T=>{if(T.trim()==="")return!0;let X;return x?X=j(T,`${g} ${h}`):X=j(T,g),!!X},N=v(F),M=v(R);if(!N||!M||F.trim()&&!R.trim()||!F.trim()&&R.trim()){q(""),p("");const T={from:void 0,to:void 0};m(T),d?.(T,T),w?.(T,T)}}},100)},onKeyDown:l=>{l.key==="ArrowDown"&&(l.preventDefault(),k(!0))}})};return i.jsxs("div",{className:z.cn("group relative flex items-center border rounded-md focus-within:ring-2 focus-within:ring-offset-2 bg-background transition-[color,box-shadow]",{"border-input focus-within:ring-ring":!s.state,"border-success focus-within:ring-success":s.state==="success","border-warning focus-within:ring-warning":s.state==="warning","border-error focus-within:ring-error":s.state==="error"}),children:[ce("from",F,q),i.jsx("span",{className:z.cn("text-muted-foreground select-none pl-2",{"opacity-30":s.disabled}),children:pe}),ce("to",R,p,{suffixIcon:S.isMobile?re==="drawer"?W:Q:I==="drawer"?W:Q}),s.isFloatLabel&&typeof u=="string"&&i.jsx(Ie.FloatingLabel,{htmlFor:oe,size:s.size,infoTooltip:s.infoTooltip,className:"z-10",shouldFloat:ze,children:u})]})}exports.RangePicker=Ae;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),Oe=require("react"),Se=require("../../packages/ui/src/components/calendar.cjs"),Z=require("../../packages/ui/src/components/popover.cjs"),P=require("../../packages/ui/src/components/drawer.cjs");require("@radix-ui/react-slot");require("../../packages/ui/src/components/button.cjs");require("../../packages/ui/src/components/button-group.cjs");require("../../packages/ui/src/components/input.cjs");require("../../packages/ui/src/components/textarea.cjs");require("@radix-ui/react-label");const z=require("../../packages/ui/src/lib/utils.cjs");require("../../packages/ui/src/components/select.cjs");require("../../packages/ui/src/components/combobox.cjs");require("@radix-ui/react-tooltip");require("@radix-ui/react-separator");require("../../packages/ui/src/components/switch.cjs");require("@radix-ui/react-scroll-area");require("../../packages/ui/src/components/tree-view.cjs");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-avatar");require("../../packages/ui/src/components/badge.cjs");const ue=require("lucide-react");require("../../packages/ui/src/components/checkbox.cjs");require("@radix-ui/react-collapsible");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-dropdown-menu");require("../../packages/ui/src/components/input-otp.cjs");require("../../packages/ui/src/components/radio-group.cjs");require("../../packages/ui/src/components/sidebar.cjs");require("@radix-ui/react-slider");require("../../packages/ui/src/components/tabs.cjs");require("../../packages/ui/src/components/toggle.cjs");const le=require("./TimePicker.cjs"),S=require("react-device-detect"),H=require("date-fns"),fe=require("date-fns/locale"),me=require("../../constants/common.cjs"),Ie=require("../FloatLabel.cjs"),ke=require("../Button/Button.cjs"),Ve=require("../Input/Input.cjs");function Ce(c){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const l in c)if(l!=="default"){const w=Object.getOwnPropertyDescriptor(c,l);Object.defineProperty(a,l,w.get?w:{enumerable:!0,get:()=>c[l]})}}return a.default=c,Object.freeze(a)}const D=Ce(Oe);function $e(c,a=me.DATE_FORMAT,l){return c?H.format(c,a,l?{locale:l}:void 0):""}const j=(c,a=me.DATE_FORMAT)=>{const l=H.parse(c,a,new Date);return H.isValid(l)?l:void 0};function Le(c){return c.replace(/dd|MM|yyyy/g,a=>{switch(a){case"dd":case"MM":return"99";case"yyyy":return"9999";default:return a}}).replace(/d|M|y/g,a=>{switch(a){case"d":case"M":return"9";case"y":return"9";default:return a}})}function Ae({label:c,value:a,placeholder:l,onChange:w,onSelect:f,calendarClassName:ge,side:be="bottom",align:ve="end",format:O="dd/MM/yyyy",language:we="vi",mask:V,closeOnSelect:he=!1,showOutsideDays:qe=!0,calendarConfig:C,timeConfig:ee,desktopMode:I="popover",mobileMode:re="drawer",children:$,separator:pe=i.jsx(ue.MoveRight,{className:"ds:size-5"}),showTime:x=!1,timeFormat:h="HH:mm",hideDate:te=!1,numberOfMonths:De=1,variant:je="default",color:xe="primary",...n}){const oe=D.useId();let g,L;typeof O=="string"?(g=O,L=O):(g=O.input,L=O.output);let A;V===!0?A=Le(g):typeof V=="string"&&(A=V);const se=a?.from?j(a.from,g):void 0,ye=a?.to?j(a.to,g):void 0,Me={from:se,to:ye},[ne,k]=D.useState(!1),[s,m]=D.useState(Me),[Te,E]=D.useState(se||new Date),[F,q]=D.useState(a?.from||""),[R,p]=D.useState(a?.to||""),[_,B]=D.useState(void 0),[U,Y]=D.useState(void 0),K=D.useRef(null),G=D.useRef(null),ze=!!(F.trim()||R.trim()),J=C?.locale?C?.locale:we==="en"?fe.enUS:fe.vi,t=e=>{if(!e)return"";let r=$e(e,L,J);return x&&(r+=` ${H.format(e,h)}`),r},Fe=e=>{m(e);const r=t(e?.from),o=t(e?.to);q(r),p(o),f?.(e,{from:r,to:o})},Re=e=>{if(q(e),e.trim()===""){q(""),p("");const b={from:void 0,to:void 0};m(b),f?.(b,b);return}let r;x?r=j(e,`${g} ${h}`):r=j(e,g);const o={from:r,to:s?.to};r?(m(o),E(r),B(r),f?.(o,{from:t(r),to:t(s?.to)})):(m(o),f?.(o,{from:t(s?.from),to:t(s?.to)}))},Ne=e=>{if(p(e),e.trim()===""){q(""),p("");const b={from:void 0,to:void 0};m(b),f?.(b,b);return}let r;x?r=j(e,`${g} ${h}`):r=j(e,g);const o={from:s?.from,to:r};r?(m(o),Y(r),f?.(o,{from:t(s?.from),to:t(r)})):(m(o),f?.(o,{from:t(s?.from),to:void 0}))},Pe=e=>{if(e){B(e);const r=new Date(s?.from||new Date);r.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),0);const o={from:r,to:s?.to};m(o),q(t(r)),f?.(o,{from:t(r),to:t(s?.to)}),w?.(o,{from:t(r),to:t(s?.to)})}},He=e=>{if(e){Y(e);const r=new Date(s?.to||new Date);r.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),0);const o={from:s?.from,to:r};m(o),p(t(r)),f?.(o,{from:t(s?.from),to:t(r)}),w?.(o,{from:t(s?.from),to:t(r)})}},ie=$?$({fromValue:F,toValue:R,range:s,onSelect:Fe,onFromChange:Re,onToChange:Ne}):i.jsxs(ke.default,{variant:"ghost",className:"ds:!p-1 ds:!leading-0 ds:h-auto ds:rounded ds:hover:bg-accent ds:transition-colors",size:n?.size,children:[i.jsx(ue.CalendarIcon,{className:z.cn({"ds:size-3":n.size==="xs"||n.size==="sm","ds:size-3.5":!n.size||n.size==="normal","ds:size-4":n.size==="lg"||n.size==="xl"})}),i.jsx("span",{className:"ds:sr-only",children:"Select date range"})]}),ae=i.jsxs("div",{className:z.cn("ds:flex ds:items-stretch",x&&!te?"ds:gap-0":""),children:[!te&&i.jsx(Se.Calendar,{...C,mode:"range",selected:s,captionLayout:"dropdown",month:Te,onMonthChange:E,numberOfMonths:S.isMobile?1:De||1,variant:je,color:xe,onSelect:e=>{let r=e;if(x){const d=_,u=U;r={from:e?.from?new Date(e.from.getFullYear(),e.from.getMonth(),e.from.getDate(),d?.getHours()||0,d?.getMinutes()||0,d?.getSeconds()||0):void 0,to:e?.to?new Date(e.to.getFullYear(),e.to.getMonth(),e.to.getDate(),u?.getHours()||0,u?.getMinutes()||0,u?.getSeconds()||0):void 0}}m(r);const o=t(r?.from),b=t(r?.to);q(o),p(b),f?.(r,{from:o,to:b}),w?.(r,{from:o,to:b}),he&&r?.from&&r?.to&&!x&&k(!1)},locale:J,formatters:{formatMonthDropdown:e=>e.toLocaleString(J.code,{month:"short"})},showOutsideDays:qe,className:z.cn("ds:mx-auto",{"ds:[--cell-size:clamp(0px,calc(100vw/7.5),52px)] ds:mb-8 ds:bg-transparent":S.isMobile||I==="drawer","ds:[--cell-size:clamp(0px,calc(100vw/7.5),34px)]":!S.isMobile&&I!=="drawer"},ge)}),x&&i.jsxs("div",{className:"ds:flex ds:gap-0 ds:border-l ds:border-border",children:[i.jsx(le.TimePicker,{...ee?.[0],value:_?H.format(_,h):void 0,onSelect:Pe,format:h,showHours:!0,showMinutes:!0,showSeconds:h==="HH:mm:ss",standalone:!1}),i.jsx("div",{className:"ds:border-l ds:border-border"}),i.jsx(le.TimePicker,{...ee?.[1],value:U?H.format(U,h):void 0,onSelect:He,format:h,showHours:!0,showMinutes:!0,showSeconds:h==="HH:mm:ss",standalone:!1})]})]}),Q=i.jsxs(Z.Popover,{open:ne,onOpenChange:k,children:[i.jsx(Z.PopoverTrigger,{asChild:!0,disabled:n.disabled,children:ie}),i.jsx(Z.PopoverContent,{className:z.cn("ds:w-auto ds:overflow-hidden ds:p-0","ds:backdrop-blur ds:bg-background/50"),side:be,align:ve,children:ae})]}),W=i.jsxs(P.Drawer,{open:ne,onOpenChange:k,children:[i.jsx(P.DrawerTrigger,{asChild:!0,children:ie}),i.jsxs(P.DrawerContent,{className:z.cn("ds:w-auto ds:overflow-hidden ds:p-0","ds:backdrop-blur ds:bg-background"),children:[i.jsxs(P.DrawerHeader,{className:"ds:sr-only",children:[i.jsx(P.DrawerTitle,{children:"Select date range"}),i.jsx(P.DrawerDescription,{children:"Set your date range"})]}),ae]})]});if($)return(S.isMobile?re:I)==="drawer"?W:Q;const de=(e,r,o,b)=>{const d=e==="from";return i.jsx(Ve.default,{...n,...b,ref:d?K:G,id:oe,size:n.isFloatLabel?n.size?n.size:"xl":n.size,className:z.cn(n.className,"ds:relative ds:peer ds:border-0 ds:focus:ring-0 ds:rounded-none ds:hover:bg-transparent ds:active:bg-transparent ds:focus-visible:ring-0 ds:focus-visible:border-0",d?"ds:pr-0":""),label:n.isFloatLabel&&typeof c=="object"?d?c?.from||"":c?.to||"":"",placeholder:typeof l=="object"?d?l?.from||"":l?.to||"":l,clearable:!d,value:r,mask:A,onChange:u=>{const y=u.target.value;if(o(y),y.trim()===""){q(""),p("");const M={from:void 0,to:void 0};m(M),f?.(M,M),w?.(M,M);return}let v;x?v=j(y,`${g} ${h}`):v=j(y,g);const N=d?{from:v,to:s?.to}:{from:s?.from,to:v};if(v){m(N),d&&E(v),d?B(v):Y(v);const M=t(d?v:s?.from),ce=t(d?s?.to:v);f?.(N,{from:M,to:ce}),w?.(N,{from:d?y:F,to:d?R:y})}else f?.(N,{from:t(s?.from),to:d?t(s?.to):void 0}),w?.(N,{from:t(s?.from),to:d?t(s?.to):void 0})},onClear:d?void 0:()=>{q(""),p("");const u={from:void 0,to:void 0};m(u),f?.(u,u),w?.(u,u)},onBlur:()=>{const u=document.activeElement;u!==K.current&&u!==G.current&&setTimeout(()=>{const y=document.activeElement;if(y!==K.current&&y!==G.current){const v=T=>{if(T.trim()==="")return!0;let X;return x?X=j(T,`${g} ${h}`):X=j(T,g),!!X},N=v(F),M=v(R);if(!N||!M||F.trim()&&!R.trim()||!F.trim()&&R.trim()){q(""),p("");const T={from:void 0,to:void 0};m(T),f?.(T,T),w?.(T,T)}}},100)},onKeyDown:u=>{u.key==="ArrowDown"&&(u.preventDefault(),k(!0))}})};return i.jsxs("div",{className:z.cn("ds:group ds:relative ds:flex ds:items-center ds:border ds:rounded-md ds:focus-within:ring-2 ds:focus-within:ring-offset-2 ds:bg-background ds:transition-[color,box-shadow]",{"ds:border-input ds:focus-within:ring-ring":!n.state,"ds:border-success ds:focus-within:ring-success":n.state==="success","ds:border-warning ds:focus-within:ring-warning":n.state==="warning","ds:border-error ds:focus-within:ring-error":n.state==="error"}),children:[de("from",F,q),i.jsx("span",{className:z.cn("ds:text-muted-foreground ds:select-none ds:pl-2",{"ds:opacity-30":n.disabled}),children:pe}),de("to",R,p,{suffixIcon:S.isMobile?re==="drawer"?W:Q:I==="drawer"?W:Q}),n.isFloatLabel&&typeof c=="string"&&i.jsx(Ie.FloatingLabel,{htmlFor:oe,size:n.size,infoTooltip:n.infoTooltip,className:"ds:z-10",shouldFloat:ze,children:c})]})}exports.RangePicker=Ae;
2
2
  //# sourceMappingURL=RangePicker.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"RangePicker.cjs","sources":["../../../../src/components/DatePicker/RangePicker.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n CalendarDayButton as SCalendarDayButton,\n type CalendarDayButtonProps as SCalendarDayButtonProps,\n Calendar,\n type CalendarColor,\n} from \"@dsui/ui/components/calendar\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@dsui/ui/components/popover\";\nimport {\n Drawer,\n DrawerContent,\n DrawerDescription,\n DrawerHeader,\n DrawerTitle,\n DrawerTrigger,\n} from \"@dsui/ui/components/drawer\";\nimport { cn } from \"@dsui/ui/index\";\nimport { Input, type InputProps } from \"../Input\";\nimport { Button } from \"../Button\";\nimport { TimePicker } from \"./TimePicker\";\nimport { type DatePickerProps } from \"./DatePicker\";\nimport { CalendarIcon, MoveRight } from \"lucide-react\";\nimport { isMobile } from \"react-device-detect\";\nimport { format as dfFormat, parse, isValid, type Locale } from \"date-fns\";\nimport { vi, enUS } from \"date-fns/locale\";\nimport { DATE_FORMAT } from \"@/constants/common\";\nimport { FloatingLabel } from \"@/components/FloatLabel\";\n\nexport type DateRange = {\n from?: Date | undefined;\n to?: Date | undefined;\n};\n\nexport type DateRangeText = { from?: string; to?: string } | null;\n\nfunction formatDate(\n date: Date | undefined,\n outputFormat: string = DATE_FORMAT,\n locale?: Locale\n) {\n if (!date) return \"\";\n\n return dfFormat(date, outputFormat, locale ? { locale } : undefined);\n}\n\nconst parseDate = (\n str: string,\n inputFormat: string = DATE_FORMAT\n): Date | undefined => {\n const date = parse(str, inputFormat, new Date());\n return isValid(date) ? date : undefined;\n};\n\nfunction generateMaskFromFormat(format: string): string {\n return format\n .replace(/dd|MM|yyyy/g, (match) => {\n switch (match) {\n case \"dd\":\n case \"MM\":\n return \"99\";\n case \"yyyy\":\n return \"9999\";\n default:\n return match;\n }\n })\n .replace(/d|M|y/g, (match) => {\n switch (match) {\n case \"d\":\n case \"M\":\n return \"9\";\n case \"y\":\n return \"9\";\n default:\n return match;\n }\n });\n}\n\nexport type FormatType = string | { input: string; output: string };\n\nexport type RangePickerRenderProps = {\n fromValue: string;\n toValue: string;\n range?: DateRange;\n onSelect: (range?: DateRange) => void;\n onFromChange: (text: string) => void;\n onToChange: (text: string) => void;\n};\n\nexport type TimeConfig = Omit<\n React.ComponentProps<typeof TimePicker>,\n \"value\" | \"onSelect\" | \"format\"\n>;\n\nexport type RangePickerProps = Omit<\n DatePickerProps,\n \"value\" | \"onChange\" | \"onSelect\" | \"children\" | \"label\" | \"placeholder\"\n> & {\n label?: string | DateRangeText;\n placeholder?: string | DateRangeText;\n value?: DateRangeText;\n onChange?: (value?: DateRange, text?: DateRangeText) => void;\n onSelect?: (value?: DateRange, text?: DateRangeText) => void;\n children?: (props: RangePickerRenderProps) => React.ReactNode;\n separator?: React.ReactNode;\n timeConfig?: [TimeConfig, TimeConfig];\n numberOfMonths?: number;\n variant?: \"default\" | \"rounded\";\n color?: CalendarColor;\n};\n\nexport function RangePicker({\n label,\n value,\n placeholder,\n onChange,\n onSelect,\n calendarClassName,\n side = \"bottom\",\n align = \"end\",\n format = \"dd/MM/yyyy\",\n language = \"vi\",\n mask,\n closeOnSelect = false,\n showOutsideDays = true,\n calendarConfig,\n timeConfig,\n desktopMode = \"popover\",\n mobileMode = \"drawer\",\n children,\n separator = <MoveRight className=\"size-5\" />,\n showTime = false,\n timeFormat = \"HH:mm\",\n hideDate = false,\n numberOfMonths = 1,\n variant = \"default\",\n color = \"primary\",\n ...props\n}: RangePickerProps) {\n const inputId = React.useId();\n\n let inputFormat: string;\n let outputFormat: string;\n if (typeof format === \"string\") {\n inputFormat = format;\n outputFormat = format;\n } else {\n inputFormat = format.input;\n outputFormat = format.output;\n }\n\n // Determine the mask to use\n let maskToUse: string | undefined;\n if (mask === true) {\n maskToUse = generateMaskFromFormat(inputFormat);\n } else if (typeof mask === \"string\") {\n maskToUse = mask;\n }\n\n const initialFromDate = value?.from\n ? parseDate(value.from, inputFormat)\n : undefined;\n const initialToDate = value?.to\n ? parseDate(value.to, inputFormat)\n : undefined;\n const initialRange: DateRange = {\n from: initialFromDate,\n to: initialToDate,\n };\n\n const [open, setOpen] = React.useState(false);\n const [range, setRange] = React.useState<DateRange | undefined>(initialRange);\n const [month, setMonth] = React.useState<Date | undefined>(\n initialFromDate || new Date()\n );\n const [fromInputValue, setFromInputValue] = React.useState(value?.from || \"\");\n const [toInputValue, setToInputValue] = React.useState(value?.to || \"\");\n const [fromTime, setFromTime] = React.useState<Date | undefined>(undefined);\n const [toTime, setToTime] = React.useState<Date | undefined>(undefined);\n const fromInputRef = React.useRef<HTMLInputElement>(null);\n const toInputRef = React.useRef<HTMLInputElement>(null);\n\n const shouldFloat = !!(fromInputValue.trim() || toInputValue.trim());\n\n const _locale: Locale = calendarConfig?.locale\n ? (calendarConfig?.locale as Locale)\n : language === \"en\"\n ? enUS\n : vi;\n\n // Helper to format date-time based on showTime and timeFormat\n const formatDateTimeValue = (d: Date | undefined): string => {\n if (!d) return \"\";\n let result = formatDate(d, outputFormat, _locale);\n if (showTime) {\n result += ` ${dfFormat(d, timeFormat)}`;\n }\n return result;\n };\n\n // Helper functions for render props\n const handleSelectForRenderProp = (range?: DateRange) => {\n setRange(range);\n const fromFormatted = formatDateTimeValue(range?.from);\n const toFormatted = formatDateTimeValue(range?.to);\n setFromInputValue(fromFormatted);\n setToInputValue(toFormatted);\n onSelect?.(range, { from: fromFormatted, to: toFormatted });\n };\n\n const handleFromChangeForRenderProp = (text: string) => {\n setFromInputValue(text);\n\n // If the input is cleared (empty), clear both fields\n if (text.trim() === \"\") {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n return;\n }\n\n // Try to parse based on showTime\n let parsedDate: Date | undefined;\n if (showTime) {\n parsedDate = parseDate(text, `${inputFormat} ${timeFormat}`);\n } else {\n parsedDate = parseDate(text, inputFormat);\n }\n const newRange: DateRange = { from: parsedDate, to: range?.to };\n if (parsedDate) {\n setRange(newRange);\n setMonth(parsedDate);\n setFromTime(parsedDate);\n onSelect?.(newRange, {\n from: formatDateTimeValue(parsedDate),\n to: formatDateTimeValue(range?.to),\n });\n } else {\n setRange(newRange);\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(range?.to),\n });\n }\n };\n\n const handleToChangeForRenderProp = (text: string) => {\n setToInputValue(text);\n\n // If the input is cleared (empty), clear both fields\n if (text.trim() === \"\") {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n return;\n }\n\n // Try to parse based on showTime\n let parsedDate: Date | undefined;\n if (showTime) {\n parsedDate = parseDate(text, `${inputFormat} ${timeFormat}`);\n } else {\n parsedDate = parseDate(text, inputFormat);\n }\n const newRange: DateRange = {\n from: range?.from,\n to: parsedDate,\n };\n if (parsedDate) {\n setRange(newRange);\n setToTime(parsedDate);\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(parsedDate),\n });\n } else {\n setRange(newRange);\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: undefined,\n });\n }\n };\n\n const handleTimeChangeFrom = (date?: Date) => {\n if (date) {\n setFromTime(date);\n // Merge: keep date (year, month, day) from existing range.from, take time (hours, minutes, seconds) from TimePicker\n const mergedDate = new Date(range?.from || new Date());\n mergedDate.setHours(\n date.getHours(),\n date.getMinutes(),\n date.getSeconds(),\n 0\n );\n\n const newRange: DateRange = {\n from: mergedDate,\n to: range?.to,\n };\n setRange(newRange);\n setFromInputValue(formatDateTimeValue(mergedDate));\n onSelect?.(newRange, {\n from: formatDateTimeValue(mergedDate),\n to: formatDateTimeValue(range?.to),\n });\n onChange?.(newRange, {\n from: formatDateTimeValue(mergedDate),\n to: formatDateTimeValue(range?.to),\n });\n }\n };\n\n const handleTimeChangeTo = (date?: Date) => {\n if (date) {\n setToTime(date);\n // Merge: keep date (year, month, day) from existing range.to, take time (hours, minutes, seconds) from TimePicker\n const mergedDate = new Date(range?.to || new Date());\n mergedDate.setHours(\n date.getHours(),\n date.getMinutes(),\n date.getSeconds(),\n 0\n );\n\n const newRange: DateRange = {\n from: range?.from,\n to: mergedDate,\n };\n setRange(newRange);\n setToInputValue(formatDateTimeValue(mergedDate));\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(mergedDate),\n });\n onChange?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(mergedDate),\n });\n }\n };\n\n // Determine trigger component\n const triggerComponent = children ? (\n children({\n fromValue: fromInputValue,\n toValue: toInputValue,\n range,\n onSelect: handleSelectForRenderProp,\n onFromChange: handleFromChangeForRenderProp,\n onToChange: handleToChangeForRenderProp,\n })\n ) : (\n <Button\n variant=\"ghost\"\n className=\"!p-1 !leading-0 h-auto rounded hover:bg-accent transition-colors\"\n size={props?.size}\n >\n <CalendarIcon\n className={cn({\n \"size-3\": props.size === \"xs\" || props.size === \"sm\",\n \"size-3.5\": !props.size || props.size === \"normal\",\n \"size-4\": props.size === \"lg\" || props.size === \"xl\",\n })}\n />\n <span className=\"sr-only\">Select date range</span>\n </Button>\n );\n\n const calendarSelection = (\n <div\n className={cn(\"flex items-stretch\", showTime && !hideDate ? \"gap-0\" : \"\")}\n >\n {!hideDate && (\n <Calendar\n {...calendarConfig}\n mode=\"range\"\n selected={range as any}\n captionLayout=\"dropdown\"\n month={month}\n onMonthChange={setMonth}\n numberOfMonths={isMobile ? 1 : numberOfMonths || 1}\n variant={variant}\n color={color}\n onSelect={(selectedRange) => {\n // Preserve time from TimePicker values if showTime is enabled\n let preservedRange = selectedRange;\n if (showTime) {\n // Get current time from TimePicker state\n const fromTimeObj = fromTime;\n const toTimeObj = toTime;\n\n preservedRange = {\n from: selectedRange?.from\n ? new Date(\n selectedRange.from.getFullYear(),\n selectedRange.from.getMonth(),\n selectedRange.from.getDate(),\n fromTimeObj?.getHours() || 0,\n fromTimeObj?.getMinutes() || 0,\n fromTimeObj?.getSeconds() || 0\n )\n : undefined,\n to: selectedRange?.to\n ? new Date(\n selectedRange.to.getFullYear(),\n selectedRange.to.getMonth(),\n selectedRange.to.getDate(),\n toTimeObj?.getHours() || 0,\n toTimeObj?.getMinutes() || 0,\n toTimeObj?.getSeconds() || 0\n )\n : undefined,\n };\n }\n setRange(preservedRange);\n const fromFormatted = formatDateTimeValue(preservedRange?.from);\n const toFormatted = formatDateTimeValue(preservedRange?.to);\n setFromInputValue(fromFormatted);\n setToInputValue(toFormatted);\n onSelect?.(preservedRange, {\n from: fromFormatted,\n to: toFormatted,\n });\n onChange?.(preservedRange, {\n from: fromFormatted,\n to: toFormatted,\n });\n if (\n closeOnSelect &&\n preservedRange?.from &&\n preservedRange?.to &&\n !showTime\n ) {\n setOpen(false);\n }\n }}\n locale={_locale}\n formatters={{\n formatMonthDropdown: (date) =>\n date.toLocaleString(_locale.code, { month: \"short\" }),\n }}\n showOutsideDays={showOutsideDays}\n className={cn(\n \"mx-auto\",\n {\n \"[--cell-size:clamp(0px,calc(100vw/7.5),52px)] mb-8 bg-transparent\":\n isMobile || desktopMode === \"drawer\",\n \"[--cell-size:clamp(0px,calc(100vw/7.5),34px)]\":\n !isMobile && desktopMode !== \"drawer\",\n },\n calendarClassName\n )}\n />\n )}\n {showTime && (\n <div className=\"flex gap-0 border-l border-border\">\n <TimePicker\n {...timeConfig?.[0]}\n value={fromTime ? dfFormat(fromTime, timeFormat) : undefined}\n onSelect={handleTimeChangeFrom}\n format={timeFormat}\n showHours\n showMinutes\n showSeconds={timeFormat === \"HH:mm:ss\"}\n standalone={false}\n />\n <div className=\"border-l border-border\" />\n <TimePicker\n {...timeConfig?.[1]}\n value={toTime ? dfFormat(toTime, timeFormat) : undefined}\n onSelect={handleTimeChangeTo}\n format={timeFormat}\n showHours\n showMinutes\n showSeconds={timeFormat === \"HH:mm:ss\"}\n standalone={false}\n />\n </div>\n )}\n </div>\n );\n\n const popPicker = (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild disabled={props.disabled}>\n {triggerComponent}\n </PopoverTrigger>\n <PopoverContent\n className={cn(\n \"w-auto overflow-hidden p-0\",\n \"backdrop-blur bg-background/50\"\n )}\n side={side}\n align={align}\n >\n {calendarSelection}\n </PopoverContent>\n </Popover>\n );\n\n const drawPicker = (\n <Drawer open={open} onOpenChange={setOpen}>\n <DrawerTrigger asChild>{triggerComponent}</DrawerTrigger>\n <DrawerContent\n className={cn(\n \"w-auto overflow-hidden p-0\",\n \"backdrop-blur bg-background\"\n )}\n >\n <DrawerHeader className=\"sr-only\">\n <DrawerTitle>Select date range</DrawerTitle>\n <DrawerDescription>Set your date range</DrawerDescription>\n </DrawerHeader>\n {calendarSelection}\n </DrawerContent>\n </Drawer>\n );\n\n // If children is provided, use render prop pattern with picker\n if (children) {\n const mode = isMobile ? mobileMode : desktopMode;\n return mode === \"drawer\" ? drawPicker : popPicker;\n }\n\n // Helper function to render range input\n const renderRangeInput = (\n type: \"from\" | \"to\",\n inputValue: string,\n setInputValue: (value: string) => void,\n additionalProps?: Partial<InputProps>\n ) => {\n const isFrom = type === \"from\";\n\n return (\n <Input\n {...props}\n {...additionalProps}\n ref={isFrom ? fromInputRef : toInputRef}\n id={inputId}\n size={\n props.isFloatLabel ? (props.size ? props.size : \"xl\") : props.size\n }\n className={cn(\n props.className,\n \"relative peer border-0 focus:ring-0 rounded-none hover:bg-transparent active:bg-transparent focus-visible:ring-0 focus-visible:border-0\",\n isFrom ? \"pr-0\" : \"\"\n )}\n label={\n props.isFloatLabel && typeof label === \"object\"\n ? isFrom\n ? label?.from || \"\"\n : label?.to || \"\"\n : \"\"\n }\n placeholder={\n typeof placeholder === \"object\"\n ? isFrom\n ? placeholder?.from || \"\"\n : placeholder?.to || \"\"\n : placeholder\n }\n clearable={!isFrom}\n value={inputValue}\n mask={maskToUse}\n onChange={(e) => {\n const inputValue = e.target.value;\n setInputValue(inputValue);\n\n // If the input is cleared (empty), clear both fields\n if (inputValue.trim() === \"\") {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n onChange?.(newRange, newRange as DateRangeText);\n return;\n }\n\n // Try to parse based on showTime\n let date: Date | undefined;\n if (showTime) {\n date = parseDate(inputValue, `${inputFormat} ${timeFormat}`);\n } else {\n date = parseDate(inputValue, inputFormat);\n }\n const newRange: DateRange = isFrom\n ? { from: date, to: range?.to }\n : { from: range?.from, to: date };\n\n if (date) {\n setRange(newRange);\n if (isFrom) setMonth(date);\n // Update time state if time was parsed\n if (isFrom) {\n setFromTime(date);\n // setFromInputValue(formatDateTimeValue(date)); // Sync input value\n } else {\n setToTime(date);\n // setToInputValue(formatDateTimeValue(date)); // Sync input value\n }\n const fromFormatted = formatDateTimeValue(\n isFrom ? date : range?.from\n );\n const toFormatted = formatDateTimeValue(isFrom ? range?.to : date);\n onSelect?.(newRange, { from: fromFormatted, to: toFormatted });\n onChange?.(newRange, {\n from: isFrom ? inputValue : fromInputValue,\n to: isFrom ? toInputValue : inputValue,\n });\n\n // If from input and date is valid, auto-focus to to input if to is empty\n // if (isFrom && toInputRef.current && !toInputValue.trim()) {\n // requestAnimationFrame(() => toInputRef.current?.focus());\n // }\n } else {\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: isFrom ? formatDateTimeValue(range?.to) : undefined,\n });\n onChange?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: isFrom ? formatDateTimeValue(range?.to) : undefined,\n });\n }\n }}\n onClear={\n !isFrom\n ? () => {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n onChange?.(newRange, newRange as DateRangeText);\n }\n : undefined\n }\n onBlur={() => {\n // Check if blurring out of the entire range picker group\n const activeElement = document.activeElement;\n if (\n activeElement !== fromInputRef.current &&\n activeElement !== toInputRef.current\n ) {\n // Delay validation by 100ms\n setTimeout(() => {\n // Check again if still blurred out of the group\n const currentActiveElement = document.activeElement;\n if (\n currentActiveElement !== fromInputRef.current &&\n currentActiveElement !== toInputRef.current\n ) {\n // Blurred out of the group, validate both inputs\n const validateInput = (val: string) => {\n if (val.trim() === \"\") return true; // empty is valid (will clear)\n let parsed: Date | undefined;\n if (showTime) {\n parsed = parseDate(val, `${inputFormat} ${timeFormat}`);\n } else {\n parsed = parseDate(val, inputFormat);\n }\n return !!parsed;\n };\n\n const fromValid = validateInput(fromInputValue);\n const toValid = validateInput(toInputValue);\n\n // Clear if either is invalid, or if only one has value\n const shouldClear =\n !fromValid ||\n !toValid ||\n (fromInputValue.trim() && !toInputValue.trim()) ||\n (!fromInputValue.trim() && toInputValue.trim());\n\n if (shouldClear) {\n // If either is invalid, clear both\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = {\n from: undefined,\n to: undefined,\n };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n onChange?.(newRange, newRange as DateRangeText);\n }\n }\n }, 100);\n }\n }}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setOpen(true);\n }\n }}\n />\n );\n };\n\n // Default input rendering with two inputs\n return (\n <div\n className={cn(\n \"group relative flex items-center border rounded-md focus-within:ring-2 focus-within:ring-offset-2 bg-background transition-[color,box-shadow]\",\n {\n \"border-input focus-within:ring-ring\": !props.state,\n \"border-success focus-within:ring-success\": props.state === \"success\",\n \"border-warning focus-within:ring-warning\": props.state === \"warning\",\n \"border-error focus-within:ring-error\": props.state === \"error\",\n }\n )}\n >\n {renderRangeInput(\"from\", fromInputValue, setFromInputValue)}\n <span\n className={cn(\"text-muted-foreground select-none pl-2\", {\n \"opacity-30\": props.disabled,\n })}\n >\n {separator}\n </span>\n {renderRangeInput(\"to\", toInputValue, setToInputValue, {\n suffixIcon: isMobile\n ? mobileMode === \"drawer\"\n ? drawPicker\n : popPicker\n : desktopMode === \"drawer\"\n ? drawPicker\n : popPicker,\n })}\n {props.isFloatLabel && typeof label === \"string\" && (\n <FloatingLabel\n htmlFor={inputId}\n size={props.size}\n infoTooltip={props.infoTooltip}\n className=\"z-10\"\n shouldFloat={shouldFloat}\n >\n {label}\n </FloatingLabel>\n )}\n </div>\n );\n}\n"],"names":["formatDate","date","outputFormat","DATE_FORMAT","locale","dfFormat","parseDate","str","inputFormat","parse","isValid","generateMaskFromFormat","format","match","RangePicker","label","value","placeholder","onChange","onSelect","calendarClassName","side","align","language","mask","closeOnSelect","showOutsideDays","calendarConfig","timeConfig","desktopMode","mobileMode","children","separator","jsx","MoveRight","showTime","timeFormat","hideDate","numberOfMonths","variant","color","props","inputId","React","maskToUse","initialFromDate","initialToDate","initialRange","open","setOpen","range","setRange","month","setMonth","fromInputValue","setFromInputValue","toInputValue","setToInputValue","fromTime","setFromTime","toTime","setToTime","fromInputRef","toInputRef","shouldFloat","_locale","enUS","vi","formatDateTimeValue","d","result","handleSelectForRenderProp","fromFormatted","toFormatted","handleFromChangeForRenderProp","text","newRange","parsedDate","handleToChangeForRenderProp","handleTimeChangeFrom","mergedDate","handleTimeChangeTo","triggerComponent","jsxs","Button","CalendarIcon","cn","calendarSelection","Calendar","isMobile","selectedRange","preservedRange","fromTimeObj","toTimeObj","TimePicker","popPicker","Popover","PopoverTrigger","PopoverContent","drawPicker","Drawer","DrawerTrigger","DrawerContent","DrawerHeader","DrawerTitle","DrawerDescription","renderRangeInput","type","inputValue","setInputValue","additionalProps","isFrom","Input","e","activeElement","currentActiveElement","validateInput","val","parsed","fromValid","toValid","FloatingLabel"],"mappings":"+pEAuCA,SAASA,GACPC,EACAC,EAAuBC,GAAAA,YACvBC,EACA,CACA,OAAKH,EAEEI,EAAAA,OAASJ,EAAMC,EAAcE,EAAS,CAAE,OAAAA,CAAA,EAAW,MAAS,EAFjD,EAGpB,CAEA,MAAME,EAAY,CAChBC,EAC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C,EAAAA,KAAC,MAAA,CACC,UAAWG,EAAAA,GACT,gJACA,CACE,sCAAuC,CAAC7C,EAAM,MAC9C,2CAA4CA,EAAM,QAAU,UAC5D,2CAA4CA,EAAM,QAAU,UAC5D,uCAAwCA,EAAM,QAAU,OAAA,CAC1D,EAGD,SAAA,CAAAiE,GAAiB,OAAQpD,EAAgBC,CAAiB,EAC3DtB,EAAAA,IAAC,OAAA,CACC,UAAWqD,EAAAA,GAAG,yCAA0C,CACtD,aAAc7C,EAAM,QAAA,CACrB,EAEA,SAAAT,EAAA,CAAA,EAEF0E,GAAiB,KAAMlD,EAAcC,EAAiB,CACrD,WAAYgC,EAAAA,SACR3D,KAAe,SACbqE,EACAJ,EACFlE,IAAgB,SACdsE,EACAJ,CAAA,CACP,EACAtD,EAAM,cAAgB,OAAO1B,GAAU,UACtCkB,EAAAA,IAACwF,GAAAA,cAAA,CACC,QAAS/E,GACT,KAAMD,EAAM,KACZ,YAAaA,EAAM,YACnB,UAAU,OACV,YAAAuB,GAEC,SAAAjD,CAAA,CAAA,CACH,CAAA,CAAA,CAIR"}
1
+ {"version":3,"file":"RangePicker.cjs","sources":["../../../../src/components/DatePicker/RangePicker.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n CalendarDayButton as SCalendarDayButton,\n type CalendarDayButtonProps as SCalendarDayButtonProps,\n Calendar,\n type CalendarColor,\n} from \"@dsui/ui/components/calendar\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@dsui/ui/components/popover\";\nimport {\n Drawer,\n DrawerContent,\n DrawerDescription,\n DrawerHeader,\n DrawerTitle,\n DrawerTrigger,\n} from \"@dsui/ui/components/drawer\";\nimport { cn } from \"@dsui/ui/index\";\nimport { Input, type InputProps } from \"../Input\";\nimport { Button } from \"../Button\";\nimport { TimePicker } from \"./TimePicker\";\nimport { type DatePickerProps } from \"./DatePicker\";\nimport { CalendarIcon, MoveRight } from \"lucide-react\";\nimport { isMobile } from \"react-device-detect\";\nimport { format as dfFormat, parse, isValid, type Locale } from \"date-fns\";\nimport { vi, enUS } from \"date-fns/locale\";\nimport { DATE_FORMAT } from \"@/constants/common\";\nimport { FloatingLabel } from \"@/components/FloatLabel\";\n\nexport type DateRange = {\n from?: Date | undefined;\n to?: Date | undefined;\n};\n\nexport type DateRangeText = { from?: string; to?: string } | null;\n\nfunction formatDate(\n date: Date | undefined,\n outputFormat: string = DATE_FORMAT,\n locale?: Locale\n) {\n if (!date) return \"\";\n\n return dfFormat(date, outputFormat, locale ? { locale } : undefined);\n}\n\nconst parseDate = (\n str: string,\n inputFormat: string = DATE_FORMAT\n): Date | undefined => {\n const date = parse(str, inputFormat, new Date());\n return isValid(date) ? date : undefined;\n};\n\nfunction generateMaskFromFormat(format: string): string {\n return format\n .replace(/dd|MM|yyyy/g, (match) => {\n switch (match) {\n case \"dd\":\n case \"MM\":\n return \"99\";\n case \"yyyy\":\n return \"9999\";\n default:\n return match;\n }\n })\n .replace(/d|M|y/g, (match) => {\n switch (match) {\n case \"d\":\n case \"M\":\n return \"9\";\n case \"y\":\n return \"9\";\n default:\n return match;\n }\n });\n}\n\nexport type FormatType = string | { input: string; output: string };\n\nexport type RangePickerRenderProps = {\n fromValue: string;\n toValue: string;\n range?: DateRange;\n onSelect: (range?: DateRange) => void;\n onFromChange: (text: string) => void;\n onToChange: (text: string) => void;\n};\n\nexport type TimeConfig = Omit<\n React.ComponentProps<typeof TimePicker>,\n \"value\" | \"onSelect\" | \"format\"\n>;\n\nexport type RangePickerProps = Omit<\n DatePickerProps,\n \"value\" | \"onChange\" | \"onSelect\" | \"children\" | \"label\" | \"placeholder\"\n> & {\n label?: string | DateRangeText;\n placeholder?: string | DateRangeText;\n value?: DateRangeText;\n onChange?: (value?: DateRange, text?: DateRangeText) => void;\n onSelect?: (value?: DateRange, text?: DateRangeText) => void;\n children?: (props: RangePickerRenderProps) => React.ReactNode;\n separator?: React.ReactNode;\n timeConfig?: [TimeConfig, TimeConfig];\n numberOfMonths?: number;\n variant?: \"default\" | \"rounded\";\n color?: CalendarColor;\n};\n\nexport function RangePicker({\n label,\n value,\n placeholder,\n onChange,\n onSelect,\n calendarClassName,\n side = \"bottom\",\n align = \"end\",\n format = \"dd/MM/yyyy\",\n language = \"vi\",\n mask,\n closeOnSelect = false,\n showOutsideDays = true,\n calendarConfig,\n timeConfig,\n desktopMode = \"popover\",\n mobileMode = \"drawer\",\n children,\n separator = <MoveRight className=\"ds:size-5\" />,\n showTime = false,\n timeFormat = \"HH:mm\",\n hideDate = false,\n numberOfMonths = 1,\n variant = \"default\",\n color = \"primary\",\n ...props\n}: RangePickerProps) {\n const inputId = React.useId();\n\n let inputFormat: string;\n let outputFormat: string;\n if (typeof format === \"string\") {\n inputFormat = format;\n outputFormat = format;\n } else {\n inputFormat = format.input;\n outputFormat = format.output;\n }\n\n // Determine the mask to use\n let maskToUse: string | undefined;\n if (mask === true) {\n maskToUse = generateMaskFromFormat(inputFormat);\n } else if (typeof mask === \"string\") {\n maskToUse = mask;\n }\n\n const initialFromDate = value?.from\n ? parseDate(value.from, inputFormat)\n : undefined;\n const initialToDate = value?.to\n ? parseDate(value.to, inputFormat)\n : undefined;\n const initialRange: DateRange = {\n from: initialFromDate,\n to: initialToDate,\n };\n\n const [open, setOpen] = React.useState(false);\n const [range, setRange] = React.useState<DateRange | undefined>(initialRange);\n const [month, setMonth] = React.useState<Date | undefined>(\n initialFromDate || new Date()\n );\n const [fromInputValue, setFromInputValue] = React.useState(value?.from || \"\");\n const [toInputValue, setToInputValue] = React.useState(value?.to || \"\");\n const [fromTime, setFromTime] = React.useState<Date | undefined>(undefined);\n const [toTime, setToTime] = React.useState<Date | undefined>(undefined);\n const fromInputRef = React.useRef<HTMLInputElement>(null);\n const toInputRef = React.useRef<HTMLInputElement>(null);\n\n const shouldFloat = !!(fromInputValue.trim() || toInputValue.trim());\n\n const _locale: Locale = calendarConfig?.locale\n ? (calendarConfig?.locale as Locale)\n : language === \"en\"\n ? enUS\n : vi;\n\n // Helper to format date-time based on showTime and timeFormat\n const formatDateTimeValue = (d: Date | undefined): string => {\n if (!d) return \"\";\n let result = formatDate(d, outputFormat, _locale);\n if (showTime) {\n result += ` ${dfFormat(d, timeFormat)}`;\n }\n return result;\n };\n\n // Helper functions for render props\n const handleSelectForRenderProp = (range?: DateRange) => {\n setRange(range);\n const fromFormatted = formatDateTimeValue(range?.from);\n const toFormatted = formatDateTimeValue(range?.to);\n setFromInputValue(fromFormatted);\n setToInputValue(toFormatted);\n onSelect?.(range, { from: fromFormatted, to: toFormatted });\n };\n\n const handleFromChangeForRenderProp = (text: string) => {\n setFromInputValue(text);\n\n // If the input is cleared (empty), clear both fields\n if (text.trim() === \"\") {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n return;\n }\n\n // Try to parse based on showTime\n let parsedDate: Date | undefined;\n if (showTime) {\n parsedDate = parseDate(text, `${inputFormat} ${timeFormat}`);\n } else {\n parsedDate = parseDate(text, inputFormat);\n }\n const newRange: DateRange = { from: parsedDate, to: range?.to };\n if (parsedDate) {\n setRange(newRange);\n setMonth(parsedDate);\n setFromTime(parsedDate);\n onSelect?.(newRange, {\n from: formatDateTimeValue(parsedDate),\n to: formatDateTimeValue(range?.to),\n });\n } else {\n setRange(newRange);\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(range?.to),\n });\n }\n };\n\n const handleToChangeForRenderProp = (text: string) => {\n setToInputValue(text);\n\n // If the input is cleared (empty), clear both fields\n if (text.trim() === \"\") {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n return;\n }\n\n // Try to parse based on showTime\n let parsedDate: Date | undefined;\n if (showTime) {\n parsedDate = parseDate(text, `${inputFormat} ${timeFormat}`);\n } else {\n parsedDate = parseDate(text, inputFormat);\n }\n const newRange: DateRange = {\n from: range?.from,\n to: parsedDate,\n };\n if (parsedDate) {\n setRange(newRange);\n setToTime(parsedDate);\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(parsedDate),\n });\n } else {\n setRange(newRange);\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: undefined,\n });\n }\n };\n\n const handleTimeChangeFrom = (date?: Date) => {\n if (date) {\n setFromTime(date);\n // Merge: keep date (year, month, day) from existing range.from, take time (hours, minutes, seconds) from TimePicker\n const mergedDate = new Date(range?.from || new Date());\n mergedDate.setHours(\n date.getHours(),\n date.getMinutes(),\n date.getSeconds(),\n 0\n );\n\n const newRange: DateRange = {\n from: mergedDate,\n to: range?.to,\n };\n setRange(newRange);\n setFromInputValue(formatDateTimeValue(mergedDate));\n onSelect?.(newRange, {\n from: formatDateTimeValue(mergedDate),\n to: formatDateTimeValue(range?.to),\n });\n onChange?.(newRange, {\n from: formatDateTimeValue(mergedDate),\n to: formatDateTimeValue(range?.to),\n });\n }\n };\n\n const handleTimeChangeTo = (date?: Date) => {\n if (date) {\n setToTime(date);\n // Merge: keep date (year, month, day) from existing range.to, take time (hours, minutes, seconds) from TimePicker\n const mergedDate = new Date(range?.to || new Date());\n mergedDate.setHours(\n date.getHours(),\n date.getMinutes(),\n date.getSeconds(),\n 0\n );\n\n const newRange: DateRange = {\n from: range?.from,\n to: mergedDate,\n };\n setRange(newRange);\n setToInputValue(formatDateTimeValue(mergedDate));\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(mergedDate),\n });\n onChange?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(mergedDate),\n });\n }\n };\n\n // Determine trigger component\n const triggerComponent = children ? (\n children({\n fromValue: fromInputValue,\n toValue: toInputValue,\n range,\n onSelect: handleSelectForRenderProp,\n onFromChange: handleFromChangeForRenderProp,\n onToChange: handleToChangeForRenderProp,\n })\n ) : (\n <Button\n variant=\"ghost\"\n className=\"ds:!p-1 ds:!leading-0 ds:h-auto ds:rounded ds:hover:bg-accent ds:transition-colors\"\n size={props?.size}\n >\n <CalendarIcon\n className={cn({\n \"ds:size-3\": props.size === \"xs\" || props.size === \"sm\",\n \"ds:size-3.5\": !props.size || props.size === \"normal\",\n \"ds:size-4\": props.size === \"lg\" || props.size === \"xl\",\n })}\n />\n <span className=\"ds:sr-only\">Select date range</span>\n </Button>\n );\n\n const calendarSelection = (\n <div\n className={cn(\"ds:flex ds:items-stretch\", showTime && !hideDate ? \"ds:gap-0\" : \"\")}\n >\n {!hideDate && (\n <Calendar\n {...calendarConfig}\n mode=\"range\"\n selected={range as any}\n captionLayout=\"dropdown\"\n month={month}\n onMonthChange={setMonth}\n numberOfMonths={isMobile ? 1 : numberOfMonths || 1}\n variant={variant}\n color={color}\n onSelect={(selectedRange) => {\n // Preserve time from TimePicker values if showTime is enabled\n let preservedRange = selectedRange;\n if (showTime) {\n // Get current time from TimePicker state\n const fromTimeObj = fromTime;\n const toTimeObj = toTime;\n\n preservedRange = {\n from: selectedRange?.from\n ? new Date(\n selectedRange.from.getFullYear(),\n selectedRange.from.getMonth(),\n selectedRange.from.getDate(),\n fromTimeObj?.getHours() || 0,\n fromTimeObj?.getMinutes() || 0,\n fromTimeObj?.getSeconds() || 0\n )\n : undefined,\n to: selectedRange?.to\n ? new Date(\n selectedRange.to.getFullYear(),\n selectedRange.to.getMonth(),\n selectedRange.to.getDate(),\n toTimeObj?.getHours() || 0,\n toTimeObj?.getMinutes() || 0,\n toTimeObj?.getSeconds() || 0\n )\n : undefined,\n };\n }\n setRange(preservedRange);\n const fromFormatted = formatDateTimeValue(preservedRange?.from);\n const toFormatted = formatDateTimeValue(preservedRange?.to);\n setFromInputValue(fromFormatted);\n setToInputValue(toFormatted);\n onSelect?.(preservedRange, {\n from: fromFormatted,\n to: toFormatted,\n });\n onChange?.(preservedRange, {\n from: fromFormatted,\n to: toFormatted,\n });\n if (\n closeOnSelect &&\n preservedRange?.from &&\n preservedRange?.to &&\n !showTime\n ) {\n setOpen(false);\n }\n }}\n locale={_locale}\n formatters={{\n formatMonthDropdown: (date) =>\n date.toLocaleString(_locale.code, { month: \"short\" }),\n }}\n showOutsideDays={showOutsideDays}\n className={cn(\n \"ds:mx-auto\",\n {\n \"ds:[--cell-size:clamp(0px,calc(100vw/7.5),52px)] ds:mb-8 ds:bg-transparent\":\n isMobile || desktopMode === \"drawer\",\n \"ds:[--cell-size:clamp(0px,calc(100vw/7.5),34px)]\":\n !isMobile && desktopMode !== \"drawer\",\n },\n calendarClassName\n )}\n />\n )}\n {showTime && (\n <div className=\"ds:flex ds:gap-0 ds:border-l ds:border-border\">\n <TimePicker\n {...timeConfig?.[0]}\n value={fromTime ? dfFormat(fromTime, timeFormat) : undefined}\n onSelect={handleTimeChangeFrom}\n format={timeFormat}\n showHours\n showMinutes\n showSeconds={timeFormat === \"HH:mm:ss\"}\n standalone={false}\n />\n <div className=\"ds:border-l ds:border-border\" />\n <TimePicker\n {...timeConfig?.[1]}\n value={toTime ? dfFormat(toTime, timeFormat) : undefined}\n onSelect={handleTimeChangeTo}\n format={timeFormat}\n showHours\n showMinutes\n showSeconds={timeFormat === \"HH:mm:ss\"}\n standalone={false}\n />\n </div>\n )}\n </div>\n );\n\n const popPicker = (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild disabled={props.disabled}>\n {triggerComponent}\n </PopoverTrigger>\n <PopoverContent\n className={cn(\n \"ds:w-auto ds:overflow-hidden ds:p-0\",\n \"ds:backdrop-blur ds:bg-background/50\"\n )}\n side={side}\n align={align}\n >\n {calendarSelection}\n </PopoverContent>\n </Popover>\n );\n\n const drawPicker = (\n <Drawer open={open} onOpenChange={setOpen}>\n <DrawerTrigger asChild>{triggerComponent}</DrawerTrigger>\n <DrawerContent\n className={cn(\n \"ds:w-auto ds:overflow-hidden ds:p-0\",\n \"ds:backdrop-blur ds:bg-background\"\n )}\n >\n <DrawerHeader className=\"ds:sr-only\">\n <DrawerTitle>Select date range</DrawerTitle>\n <DrawerDescription>Set your date range</DrawerDescription>\n </DrawerHeader>\n {calendarSelection}\n </DrawerContent>\n </Drawer>\n );\n\n // If children is provided, use render prop pattern with picker\n if (children) {\n const mode = isMobile ? mobileMode : desktopMode;\n return mode === \"drawer\" ? drawPicker : popPicker;\n }\n\n // Helper function to render range input\n const renderRangeInput = (\n type: \"from\" | \"to\",\n inputValue: string,\n setInputValue: (value: string) => void,\n additionalProps?: Partial<InputProps>\n ) => {\n const isFrom = type === \"from\";\n\n return (\n <Input\n {...props}\n {...additionalProps}\n ref={isFrom ? fromInputRef : toInputRef}\n id={inputId}\n size={\n props.isFloatLabel ? (props.size ? props.size : \"xl\") : props.size\n }\n className={cn(\n props.className,\n \"ds:relative ds:peer ds:border-0 ds:focus:ring-0 ds:rounded-none ds:hover:bg-transparent ds:active:bg-transparent ds:focus-visible:ring-0 ds:focus-visible:border-0\",\n isFrom ? \"ds:pr-0\" : \"\"\n )}\n label={\n props.isFloatLabel && typeof label === \"object\"\n ? isFrom\n ? label?.from || \"\"\n : label?.to || \"\"\n : \"\"\n }\n placeholder={\n typeof placeholder === \"object\"\n ? isFrom\n ? placeholder?.from || \"\"\n : placeholder?.to || \"\"\n : placeholder\n }\n clearable={!isFrom}\n value={inputValue}\n mask={maskToUse}\n onChange={(e) => {\n const inputValue = e.target.value;\n setInputValue(inputValue);\n\n // If the input is cleared (empty), clear both fields\n if (inputValue.trim() === \"\") {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n onChange?.(newRange, newRange as DateRangeText);\n return;\n }\n\n // Try to parse based on showTime\n let date: Date | undefined;\n if (showTime) {\n date = parseDate(inputValue, `${inputFormat} ${timeFormat}`);\n } else {\n date = parseDate(inputValue, inputFormat);\n }\n const newRange: DateRange = isFrom\n ? { from: date, to: range?.to }\n : { from: range?.from, to: date };\n\n if (date) {\n setRange(newRange);\n if (isFrom) setMonth(date);\n // Update time state if time was parsed\n if (isFrom) {\n setFromTime(date);\n // setFromInputValue(formatDateTimeValue(date)); // Sync input value\n } else {\n setToTime(date);\n // setToInputValue(formatDateTimeValue(date)); // Sync input value\n }\n const fromFormatted = formatDateTimeValue(\n isFrom ? date : range?.from\n );\n const toFormatted = formatDateTimeValue(isFrom ? range?.to : date);\n onSelect?.(newRange, { from: fromFormatted, to: toFormatted });\n onChange?.(newRange, {\n from: isFrom ? inputValue : fromInputValue,\n to: isFrom ? toInputValue : inputValue,\n });\n\n // If from input and date is valid, auto-focus to to input if to is empty\n // if (isFrom && toInputRef.current && !toInputValue.trim()) {\n // requestAnimationFrame(() => toInputRef.current?.focus());\n // }\n } else {\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: isFrom ? formatDateTimeValue(range?.to) : undefined,\n });\n onChange?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: isFrom ? formatDateTimeValue(range?.to) : undefined,\n });\n }\n }}\n onClear={\n !isFrom\n ? () => {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n onChange?.(newRange, newRange as DateRangeText);\n }\n : undefined\n }\n onBlur={() => {\n // Check if blurring out of the entire range picker group\n const activeElement = document.activeElement;\n if (\n activeElement !== fromInputRef.current &&\n activeElement !== toInputRef.current\n ) {\n // Delay validation by 100ms\n setTimeout(() => {\n // Check again if still blurred out of the group\n const currentActiveElement = document.activeElement;\n if (\n currentActiveElement !== fromInputRef.current &&\n currentActiveElement !== toInputRef.current\n ) {\n // Blurred out of the group, validate both inputs\n const validateInput = (val: string) => {\n if (val.trim() === \"\") return true; // empty is valid (will clear)\n let parsed: Date | undefined;\n if (showTime) {\n parsed = parseDate(val, `${inputFormat} ${timeFormat}`);\n } else {\n parsed = parseDate(val, inputFormat);\n }\n return !!parsed;\n };\n\n const fromValid = validateInput(fromInputValue);\n const toValid = validateInput(toInputValue);\n\n // Clear if either is invalid, or if only one has value\n const shouldClear =\n !fromValid ||\n !toValid ||\n (fromInputValue.trim() && !toInputValue.trim()) ||\n (!fromInputValue.trim() && toInputValue.trim());\n\n if (shouldClear) {\n // If either is invalid, clear both\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = {\n from: undefined,\n to: undefined,\n };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n onChange?.(newRange, newRange as DateRangeText);\n }\n }\n }, 100);\n }\n }}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setOpen(true);\n }\n }}\n />\n );\n };\n\n // Default input rendering with two inputs\n return (\n <div\n className={cn(\n \"ds:group ds:relative ds:flex ds:items-center ds:border ds:rounded-md ds:focus-within:ring-2 ds:focus-within:ring-offset-2 ds:bg-background ds:transition-[color,box-shadow]\",\n {\n \"ds:border-input ds:focus-within:ring-ring\": !props.state,\n \"ds:border-success ds:focus-within:ring-success\": props.state === \"success\",\n \"ds:border-warning ds:focus-within:ring-warning\": props.state === \"warning\",\n \"ds:border-error ds:focus-within:ring-error\": props.state === \"error\",\n }\n )}\n >\n {renderRangeInput(\"from\", fromInputValue, setFromInputValue)}\n <span\n className={cn(\"ds:text-muted-foreground ds:select-none ds:pl-2\", {\n \"ds:opacity-30\": props.disabled,\n })}\n >\n {separator}\n </span>\n {renderRangeInput(\"to\", toInputValue, setToInputValue, {\n suffixIcon: isMobile\n ? mobileMode === \"drawer\"\n ? drawPicker\n : popPicker\n : desktopMode === \"drawer\"\n ? drawPicker\n : popPicker,\n })}\n {props.isFloatLabel && typeof label === \"string\" && (\n <FloatingLabel\n htmlFor={inputId}\n size={props.size}\n infoTooltip={props.infoTooltip}\n className=\"ds:z-10\"\n shouldFloat={shouldFloat}\n >\n {label}\n </FloatingLabel>\n )}\n </div>\n );\n}\n"],"names":["formatDate","date","outputFormat","DATE_FORMAT","locale","dfFormat","parseDate","str","inputFormat","parse","isValid","generateMaskFromFormat","format","match","RangePicker","label","value","placeholder","onChange","onSelect","calendarClassName","side","align","language","mask","closeOnSelect","showOutsideDays","calendarConfig","timeConfig","desktopMode","mobileMode","children","separator","jsx","MoveRight","showTime","timeFormat","hideDate","numberOfMonths","variant","color","props","inputId","React","maskToUse","initialFromDate","initialToDate","initialRange","open","setOpen","range","setRange","month","setMonth","fromInputValue","setFromInputValue","toInputValue","setToInputValue","fromTime","setFromTime","toTime","setToTime","fromInputRef","toInputRef","shouldFloat","_locale","enUS","vi","formatDateTimeValue","d","result","handleSelectForRenderProp","fromFormatted","toFormatted","handleFromChangeForRenderProp","text","newRange","parsedDate","handleToChangeForRenderProp","handleTimeChangeFrom","mergedDate","handleTimeChangeTo","triggerComponent","jsxs","Button","CalendarIcon","cn","calendarSelection","Calendar","isMobile","selectedRange","preservedRange","fromTimeObj","toTimeObj","TimePicker","popPicker","Popover","PopoverTrigger","PopoverContent","drawPicker","Drawer","DrawerTrigger","DrawerContent","DrawerHeader","DrawerTitle","DrawerDescription","renderRangeInput","type","inputValue","setInputValue","additionalProps","isFrom","Input","e","activeElement","currentActiveElement","validateInput","val","parsed","fromValid","toValid","FloatingLabel"],"mappings":"+pEAuCA,SAASA,GACPC,EACAC,EAAuBC,GAAAA,YACvBC,EACA,CACA,OAAKH,EAEEI,EAAAA,OAASJ,EAAMC,EAAcE,EAAS,CAAE,OAAAA,CAAA,EAAW,MAAS,EAFjD,EAGpB,CAEA,MAAME,EAAY,CAChBC,EACAC,EAAsBL,iBACD,CACrB,MAAMF,EAAOQ,EAAAA,MAAMF,EAAKC,EAAa,IAAI,IAAM,EAC/C,OAAOE,UAAQT,CAAI,EAAIA,EAAO,MAChC,EAEA,SAASU,GAAuBC,EAAwB,CACtD,OAAOA,EACJ,QAAQ,cAAgBC,GAAU,CACjC,OAAQA,EAAA,CACN,IAAK,KACL,IAAK,KACH,MAAO,KACT,IAAK,OACH,MAAO,OACT,QACE,OAAOA,CAAA,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CAC/D,gBAAiB7C,EAAM,QAAA,CACxB,EAEA,SAAAT,EAAA,CAAA,EAEF0E,GAAiB,KAAMlD,EAAcC,EAAiB,CACrD,WAAYgC,EAAAA,SACR3D,KAAe,SACbqE,EACAJ,EACFlE,IAAgB,SACdsE,EACAJ,CAAA,CACP,EACAtD,EAAM,cAAgB,OAAO1B,GAAU,UACtCkB,EAAAA,IAACwF,GAAAA,cAAA,CACC,QAAS/E,GACT,KAAMD,EAAM,KACZ,YAAaA,EAAM,YACnB,UAAU,UACV,YAAAuB,GAEC,SAAAjD,CAAA,CAAA,CACH,CAAA,CAAA,CAIR"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),o=require("react");require("@radix-ui/react-slot");require("../../packages/ui/src/components/button.cjs");require("../../packages/ui/src/components/button-group.cjs");require("../../packages/ui/src/components/input.cjs");require("../../packages/ui/src/components/textarea.cjs");require("@radix-ui/react-label");const j=require("../../packages/ui/src/lib/utils.cjs");require("../../packages/ui/src/components/select.cjs");require("../../packages/ui/src/components/combobox.cjs");require("@radix-ui/react-tooltip");const Oe=require("lucide-react");require("react-day-picker");const Z=require("../../packages/ui/src/components/popover.cjs");require("@radix-ui/react-separator");require("../../packages/ui/src/components/switch.cjs");const M=require("../../packages/ui/src/components/drawer.cjs");require("@radix-ui/react-scroll-area");require("../../packages/ui/src/components/tree-view.cjs");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-avatar");require("../../packages/ui/src/components/badge.cjs");require("../../packages/ui/src/components/checkbox.cjs");require("@radix-ui/react-collapsible");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-dropdown-menu");require("../../packages/ui/src/components/input-otp.cjs");require("../../packages/ui/src/components/radio-group.cjs");require("../../packages/ui/src/components/sidebar.cjs");require("@radix-ui/react-slider");require("../../packages/ui/src/components/tabs.cjs");require("../../packages/ui/src/components/toggle.cjs");const we=require("react-device-detect"),_=require("../WheelColumn.cjs"),Ie=require("../TimeGridView.cjs"),z=require("date-fns"),Ee=require("../Select/Select.cjs"),B=require("../Button/Button.cjs"),$e=require("../Input/Input.cjs"),L=(i,m=1)=>{const b=[];for(let v=0;v<i;v+=m)b.push(v);return b},$=i=>String(i).padStart(2,"0"),He=(i,m="HH:mm")=>!i||!z.isValid(i)?"":z.format(i,m),Te=(i,m="HH:mm")=>{if(!i)return;const b=new Date,v=z.parse(i,m,b);if(z.isValid(v))return v};function ze(i){return i.replace(/HH|mm|ss/g,m=>{switch(m){case"HH":case"mm":case"ss":return"99";default:return m}}).replace(/H|m|s/g,()=>"9")}function Ue({value:i,onChange:m,onSelect:b,showHours:v=!0,showMinutes:ee=!0,showSeconds:k=!1,disabled:q=!1,className:se,timeLabel:u,mask:U,format:N,mode:l="wheel",hourInterval:te=1,minuteInterval:re=1,secondInterval:ne=1,disabledTimes:oe=[],disabledTimeRanges:ie=[],showNowButton:ce=!1,nowButtonLabel:ue="Now",standalone:F=!0,desktopMode:le="popover",mobileMode:Se="drawer",color:O="primary",isOpen:ae,...Ne}){let C,w;typeof N=="string"?(C=N,w=N):N?(C=N.input,w=N.output):(C=k?"HH:mm:ss":"HH:mm",w=k?"HH:mm:ss":"HH:mm");const[h,H]=o.useState(void 0),[p,T]=o.useState(void 0),[x,S]=o.useState(void 0),[I,fe]=o.useState(!1);o.useEffect(()=>{if(i){const e=Te(i,C);e&&(H(e.getHours()),T(e.getMinutes()),S(e.getSeconds()))}else H(void 0),T(void 0),S(void 0)},[i,C]);const G=o.useRef(null),A=o.useRef(null),W=o.useRef(null),J=o.useRef(null),D=o.useMemo(()=>L(24,te),[te]),y=o.useMemo(()=>L(60,re),[re]),R=o.useMemo(()=>L(60,ne),[ne]),a=o.useCallback((e,s,t=0)=>{const n=`${$(e??0)}:${$(s??0)}${k?`:${$(t??0)}`:""}`;if(oe.includes(n))return!0;for(const f of ie){const[d,c,g=0]=f.from.split(":").map(Number),[E,Re,Ve=0]=f.to.split(":").map(Number),Ce=(e??0)*3600+(s??0)*60+(t??0),Pe=d*3600+c*60+g,Fe=E*3600+Re*60+Ve;if(Ce>=Pe&&Ce<=Fe)return!0}return!1},[oe,ie,k]),K=o.useCallback(e=>{if(u)return typeof u=="boolean"?u?e==="hours"?"Hour":e==="minutes"?"Minute":"Second":void 0:typeof u=="string"?u:e==="hours"?u.hours||"Hour":e==="minutes"?u.minutes||"Minute":u.seconds||"Second"},[u]),de=typeof u=="string"&&r.jsx("div",{className:"text-xs font-semibold text-muted-foreground uppercase p-2 border-b w-full text-center",children:u},"common-label"),De=o.useCallback((e,s,t=0)=>{const n=D.reduce((c,g)=>Math.abs(g-e)<Math.abs(c-e)?g:c),f=y.reduce((c,g)=>Math.abs(g-s)<Math.abs(c-s)?g:c),d=R.reduce((c,g)=>Math.abs(g-t)<Math.abs(c-t)?g:c);if(a(n,f,d)){for(const c of D)for(const g of y)for(const E of R)if(!a(c,g,E))return{h:c,m:g,s:E}}return{h:n,m:f,s:d}},[D,y,R,a]),V=o.useCallback((e,s,t)=>{const n=new Date;n.setHours(e,s,t,0);const f=He(n,w);m?.(void 0,f,n),b?.(n,f)},[w,m,b]),me=e=>{a(e,p,x)||(H(e),V(e,p??0,x??0))},he=e=>{a(h,e,x)||(T(e),V(h??0,e,x??0))},pe=e=>{a(h,p,e)||(S(e),V(h??0,p??0,e))},P=o.useCallback(e=>{if(e.current){const s=e.current.querySelector("[data-selected]");if(s){const t=e.current,n=t.clientHeight,f=s.offsetTop,d=s.clientHeight,c=f-n/2+d/2;t.scrollTo({top:c,behavior:"smooth"})}}},[]),Q=o.useCallback(()=>{l==="wheel"?(P(G),P(A),P(W)):l==="compact"&&P(J)},[G,A,W,J,l,P]),ge=()=>{const e=new Date,{h:s,m:t,s:n}=De(e.getHours(),e.getMinutes(),e.getSeconds());H(s),T(t),S(n),V(s,t,n),setTimeout(()=>Q(),100)};o.useEffect(()=>{if((F?I:ae)||(h!==void 0||p!==void 0||x!==void 0)){const t=setTimeout(()=>Q(),100);return()=>clearTimeout(t)}},[I,ae,F,l,Q,h,p,x]);const X=o.memo(({items:e,value:s,onChange:t,timeLabel:n,type:f})=>r.jsxs("div",{className:"flex flex-col gap-2",children:[n&&r.jsx("div",{className:"text-xs font-semibold text-muted-foreground uppercase p-2 border-b w-full text-center",children:n}),r.jsx("div",{className:"p-2",children:r.jsx(Ee.default,{value:s?.toString()||"",onValueChange:d=>t(Number(d)),disabled:q,clearable:!1,search:!1,options:e.map(d=>{const c=f==="hours"&&a(d,p,x)||f==="minutes"&&a(h,d,x)||f==="seconds"&&a(h,p,d);return{label:$(d),value:d.toString(),disabled:c}})})})]})),ye=(e,s)=>{a(e,s,0)||(H(e),T(s),S(0),V(e,s,0))},xe=()=>{const e=[];if(l==="compact")return r.jsx(Ie.TimeGridView,{HOURS:D,MINUTES:y,hours:h,minutes:p,disabled:q,isTimeDisabled:a,onTimeSelect:ye,ref:J,color:O});if(v){const s=typeof u=="string"?void 0:K("hours");l==="wheel"?e.push(r.jsx(_.TimeColumnwheel,{ref:G,items:D,value:h,onChange:me,timeLabel:s,isItemDisabled:t=>a(t,p,x),disabled:q,color:O},"hours")):l==="select"&&e.push(r.jsx(X,{items:D,value:h,onChange:me,timeLabel:s,type:"hours"},"hours"))}if(ee){const s=typeof u=="string"?void 0:K("minutes");l==="wheel"?e.push(r.jsx(_.TimeColumnwheel,{ref:A,items:y,value:p,onChange:he,timeLabel:s,itemClassName:v?"border-l":void 0,isItemDisabled:t=>a(h,t,x),disabled:q,color:O},"minutes")):l==="select"&&e.push(r.jsx(X,{items:y,value:p,onChange:he,timeLabel:s,type:"minutes"},"minutes"))}if(k){const s=typeof u=="string"?void 0:K("seconds");l==="wheel"?e.push(r.jsx(_.TimeColumnwheel,{ref:W,items:R,value:x,onChange:pe,timeLabel:s,itemClassName:ee||v?"border-l":void 0,isItemDisabled:t=>a(h,p,t),disabled:q,color:O},"seconds")):l==="select"&&e.push(r.jsx(X,{items:R,value:x,onChange:pe,timeLabel:s,type:"seconds"},"seconds"))}return e};if(!F)return r.jsxs("div",{className:j.cn("flex flex-col gap-2 h-full justify-between",se),children:[de,r.jsx("div",{className:j.cn("flex rounded overflow-clip mb-auto",l==="wheel"?"items-end justify-center p-0 h-72":"items-start justify-center"),children:xe()}),ce&&r.jsx(B.default,{type:"button",variant:"solid",size:"xs",onClick:ge,disabled:q,className:j.cn("rounded-none"),children:ue})]});const ve=r.jsxs("div",{className:j.cn("flex flex-col gap-4 h-full",se),children:[de,r.jsx("div",{className:j.cn("flex rounded overflow-clip my-auto mx-auto max-w-sm md:max-w-md lg:max-w-lg relative",l==="wheel"?"items-end justify-center p-0":"items-start justify-center",{"h-72":l==="wheel","w-xs":F&&(we.isMobile||le==="drawer")}),children:xe()}),ce&&r.jsx(B.default,{type:"button",variant:"solid",size:"xs",onClick:ge,disabled:q,className:j.cn("rounded-none"),children:ue})]}),qe=r.jsxs(B.default,{variant:"ghost",className:"!p-1 !leading-0 h-auto rounded hover:bg-accent transition-colors",disabled:q,children:[r.jsx(Oe.Clock,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Select time"})]}),be=r.jsxs(Z.Popover,{open:I,onOpenChange:fe,children:[r.jsx(Z.PopoverTrigger,{asChild:!0,disabled:q,children:qe}),r.jsx(Z.PopoverContent,{className:j.cn("w-auto overflow-hidden p-0","backdrop-blur bg-background/50"),children:ve})]}),je=r.jsxs(M.Drawer,{open:I,onOpenChange:fe,children:[r.jsx(M.DrawerTrigger,{asChild:!0,children:qe}),r.jsxs(M.DrawerContent,{className:j.cn("w-auto overflow-hidden p-0","backdrop-blur bg-background"),children:[r.jsxs(M.DrawerHeader,{className:"sr-only",children:[r.jsx(M.DrawerTitle,{children:"Select time"}),r.jsx(M.DrawerDescription,{children:"Choose a time"})]}),ve]})]}),Me=w;let Y;U===!0?Y=ze(C):typeof U=="string"&&(Y=U);const ke=e=>{const s=e.target.value,t=Te(s,C);if(t){H(t.getHours()),T(t.getMinutes()),S(t.getSeconds());const n=He(t,w);m?.(e,n,t),b?.(t,n)}else H(0),T(0),S(0),m?.(e,s,void 0),b?.(void 0,s)};return r.jsx($e.default,{...Ne,clearable:!0,value:i||"",placeholder:Me,mask:Y,disabled:q,className:"cursor-pointer",onChange:ke,suffixIcon:we.isMobile?Se==="drawer"?je:be:le==="drawer"?je:be})}exports.TimePicker=Ue;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),o=require("react");require("@radix-ui/react-slot");require("../../packages/ui/src/components/button.cjs");require("../../packages/ui/src/components/button-group.cjs");require("../../packages/ui/src/components/input.cjs");require("../../packages/ui/src/components/textarea.cjs");require("@radix-ui/react-label");const j=require("../../packages/ui/src/lib/utils.cjs");require("../../packages/ui/src/components/select.cjs");require("../../packages/ui/src/components/combobox.cjs");require("@radix-ui/react-tooltip");const Oe=require("lucide-react");require("react-day-picker");const Z=require("../../packages/ui/src/components/popover.cjs");require("@radix-ui/react-separator");require("../../packages/ui/src/components/switch.cjs");const M=require("../../packages/ui/src/components/drawer.cjs");require("@radix-ui/react-scroll-area");require("../../packages/ui/src/components/tree-view.cjs");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-avatar");require("../../packages/ui/src/components/badge.cjs");require("../../packages/ui/src/components/checkbox.cjs");require("@radix-ui/react-collapsible");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-dropdown-menu");require("../../packages/ui/src/components/input-otp.cjs");require("../../packages/ui/src/components/radio-group.cjs");require("../../packages/ui/src/components/sidebar.cjs");require("@radix-ui/react-slider");require("../../packages/ui/src/components/tabs.cjs");require("../../packages/ui/src/components/toggle.cjs");const we=require("react-device-detect"),_=require("../WheelColumn.cjs"),Ie=require("../TimeGridView.cjs"),z=require("date-fns"),Ee=require("../Select/Select.cjs"),B=require("../Button/Button.cjs"),$e=require("../Input/Input.cjs"),L=(i,m=1)=>{const b=[];for(let v=0;v<i;v+=m)b.push(v);return b},$=i=>String(i).padStart(2,"0"),He=(i,m="HH:mm")=>!i||!z.isValid(i)?"":z.format(i,m),Te=(i,m="HH:mm")=>{if(!i)return;const b=new Date,v=z.parse(i,m,b);if(z.isValid(v))return v};function ze(i){return i.replace(/HH|mm|ss/g,m=>{switch(m){case"HH":case"mm":case"ss":return"99";default:return m}}).replace(/H|m|s/g,()=>"9")}function Ue({value:i,onChange:m,onSelect:b,showHours:v=!0,showMinutes:ee=!0,showSeconds:k=!1,disabled:q=!1,className:se,timeLabel:u,mask:U,format:N,mode:l="wheel",hourInterval:te=1,minuteInterval:re=1,secondInterval:ne=1,disabledTimes:oe=[],disabledTimeRanges:ie=[],showNowButton:ce=!1,nowButtonLabel:ue="Now",standalone:F=!0,desktopMode:le="popover",mobileMode:Se="drawer",color:O="primary",isOpen:ae,...Ne}){let C,w;typeof N=="string"?(C=N,w=N):N?(C=N.input,w=N.output):(C=k?"HH:mm:ss":"HH:mm",w=k?"HH:mm:ss":"HH:mm");const[h,H]=o.useState(void 0),[p,T]=o.useState(void 0),[x,S]=o.useState(void 0),[I,de]=o.useState(!1);o.useEffect(()=>{if(i){const e=Te(i,C);e&&(H(e.getHours()),T(e.getMinutes()),S(e.getSeconds()))}else H(void 0),T(void 0),S(void 0)},[i,C]);const G=o.useRef(null),A=o.useRef(null),W=o.useRef(null),J=o.useRef(null),D=o.useMemo(()=>L(24,te),[te]),y=o.useMemo(()=>L(60,re),[re]),R=o.useMemo(()=>L(60,ne),[ne]),a=o.useCallback((e,s,t=0)=>{const n=`${$(e??0)}:${$(s??0)}${k?`:${$(t??0)}`:""}`;if(oe.includes(n))return!0;for(const d of ie){const[f,c,g=0]=d.from.split(":").map(Number),[E,Re,Ve=0]=d.to.split(":").map(Number),Ce=(e??0)*3600+(s??0)*60+(t??0),Pe=f*3600+c*60+g,Fe=E*3600+Re*60+Ve;if(Ce>=Pe&&Ce<=Fe)return!0}return!1},[oe,ie,k]),K=o.useCallback(e=>{if(u)return typeof u=="boolean"?u?e==="hours"?"Hour":e==="minutes"?"Minute":"Second":void 0:typeof u=="string"?u:e==="hours"?u.hours||"Hour":e==="minutes"?u.minutes||"Minute":u.seconds||"Second"},[u]),fe=typeof u=="string"&&r.jsx("div",{className:"ds:text-xs ds:font-semibold ds:text-muted-foreground ds:uppercase ds:p-2 ds:border-b ds:w-full ds:text-center",children:u},"common-label"),De=o.useCallback((e,s,t=0)=>{const n=D.reduce((c,g)=>Math.abs(g-e)<Math.abs(c-e)?g:c),d=y.reduce((c,g)=>Math.abs(g-s)<Math.abs(c-s)?g:c),f=R.reduce((c,g)=>Math.abs(g-t)<Math.abs(c-t)?g:c);if(a(n,d,f)){for(const c of D)for(const g of y)for(const E of R)if(!a(c,g,E))return{h:c,m:g,s:E}}return{h:n,m:d,s:f}},[D,y,R,a]),V=o.useCallback((e,s,t)=>{const n=new Date;n.setHours(e,s,t,0);const d=He(n,w);m?.(void 0,d,n),b?.(n,d)},[w,m,b]),me=e=>{a(e,p,x)||(H(e),V(e,p??0,x??0))},he=e=>{a(h,e,x)||(T(e),V(h??0,e,x??0))},pe=e=>{a(h,p,e)||(S(e),V(h??0,p??0,e))},P=o.useCallback(e=>{if(e.current){const s=e.current.querySelector("[data-selected]");if(s){const t=e.current,n=t.clientHeight,d=s.offsetTop,f=s.clientHeight,c=d-n/2+f/2;t.scrollTo({top:c,behavior:"smooth"})}}},[]),Q=o.useCallback(()=>{l==="wheel"?(P(G),P(A),P(W)):l==="compact"&&P(J)},[G,A,W,J,l,P]),ge=()=>{const e=new Date,{h:s,m:t,s:n}=De(e.getHours(),e.getMinutes(),e.getSeconds());H(s),T(t),S(n),V(s,t,n),setTimeout(()=>Q(),100)};o.useEffect(()=>{if((F?I:ae)||(h!==void 0||p!==void 0||x!==void 0)){const t=setTimeout(()=>Q(),100);return()=>clearTimeout(t)}},[I,ae,F,l,Q,h,p,x]);const X=o.memo(({items:e,value:s,onChange:t,timeLabel:n,type:d})=>r.jsxs("div",{className:"ds:flex ds:flex-col ds:gap-2",children:[n&&r.jsx("div",{className:"ds:text-xs ds:font-semibold ds:text-muted-foreground ds:uppercase ds:p-2 ds:border-b ds:w-full ds:text-center",children:n}),r.jsx("div",{className:"ds:p-2",children:r.jsx(Ee.default,{value:s?.toString()||"",onValueChange:f=>t(Number(f)),disabled:q,clearable:!1,search:!1,options:e.map(f=>{const c=d==="hours"&&a(f,p,x)||d==="minutes"&&a(h,f,x)||d==="seconds"&&a(h,p,f);return{label:$(f),value:f.toString(),disabled:c}})})})]})),ye=(e,s)=>{a(e,s,0)||(H(e),T(s),S(0),V(e,s,0))},xe=()=>{const e=[];if(l==="compact")return r.jsx(Ie.TimeGridView,{HOURS:D,MINUTES:y,hours:h,minutes:p,disabled:q,isTimeDisabled:a,onTimeSelect:ye,ref:J,color:O});if(v){const s=typeof u=="string"?void 0:K("hours");l==="wheel"?e.push(r.jsx(_.TimeColumnwheel,{ref:G,items:D,value:h,onChange:me,timeLabel:s,isItemDisabled:t=>a(t,p,x),disabled:q,color:O},"hours")):l==="select"&&e.push(r.jsx(X,{items:D,value:h,onChange:me,timeLabel:s,type:"hours"},"hours"))}if(ee){const s=typeof u=="string"?void 0:K("minutes");l==="wheel"?e.push(r.jsx(_.TimeColumnwheel,{ref:A,items:y,value:p,onChange:he,timeLabel:s,itemClassName:v?"ds:border-l":void 0,isItemDisabled:t=>a(h,t,x),disabled:q,color:O},"minutes")):l==="select"&&e.push(r.jsx(X,{items:y,value:p,onChange:he,timeLabel:s,type:"minutes"},"minutes"))}if(k){const s=typeof u=="string"?void 0:K("seconds");l==="wheel"?e.push(r.jsx(_.TimeColumnwheel,{ref:W,items:R,value:x,onChange:pe,timeLabel:s,itemClassName:ee||v?"ds:border-l":void 0,isItemDisabled:t=>a(h,p,t),disabled:q,color:O},"seconds")):l==="select"&&e.push(r.jsx(X,{items:R,value:x,onChange:pe,timeLabel:s,type:"seconds"},"seconds"))}return e};if(!F)return r.jsxs("div",{className:j.cn("ds:flex ds:flex-col ds:gap-2 ds:h-full ds:justify-between",se),children:[fe,r.jsx("div",{className:j.cn("ds:flex ds:rounded ds:overflow-clip ds:mb-auto",l==="wheel"?"ds:items-end ds:justify-center ds:p-0 ds:h-72":"ds:items-start ds:justify-center"),children:xe()}),ce&&r.jsx(B.default,{type:"button",variant:"solid",size:"xs",onClick:ge,disabled:q,className:j.cn("ds:rounded-none"),children:ue})]});const ve=r.jsxs("div",{className:j.cn("ds:flex ds:flex-col ds:gap-4 ds:h-full",se),children:[fe,r.jsx("div",{className:j.cn("ds:flex ds:rounded ds:overflow-clip ds:my-auto ds:mx-auto ds:max-w-sm ds:md:max-w-md ds:lg:max-w-lg ds:relative",l==="wheel"?"ds:items-end ds:justify-center ds:p-0":"ds:items-start ds:justify-center",{"ds:h-72":l==="wheel","ds:w-xs":F&&(we.isMobile||le==="drawer")}),children:xe()}),ce&&r.jsx(B.default,{type:"button",variant:"solid",size:"xs",onClick:ge,disabled:q,className:j.cn("ds:rounded-none"),children:ue})]}),qe=r.jsxs(B.default,{variant:"ghost",className:"ds:!p-1 ds:!leading-0 ds:h-auto ds:rounded ds:hover:bg-accent ds:transition-colors",disabled:q,children:[r.jsx(Oe.Clock,{className:"ds:size-4"}),r.jsx("span",{className:"ds:sr-only",children:"Select time"})]}),be=r.jsxs(Z.Popover,{open:I,onOpenChange:de,children:[r.jsx(Z.PopoverTrigger,{asChild:!0,disabled:q,children:qe}),r.jsx(Z.PopoverContent,{className:j.cn("ds:w-auto ds:overflow-hidden ds:p-0","ds:backdrop-blur ds:bg-background/50"),children:ve})]}),je=r.jsxs(M.Drawer,{open:I,onOpenChange:de,children:[r.jsx(M.DrawerTrigger,{asChild:!0,children:qe}),r.jsxs(M.DrawerContent,{className:j.cn("ds:w-auto ds:overflow-hidden ds:p-0","ds:backdrop-blur ds:bg-background"),children:[r.jsxs(M.DrawerHeader,{className:"ds:sr-only",children:[r.jsx(M.DrawerTitle,{children:"Select time"}),r.jsx(M.DrawerDescription,{children:"Choose a time"})]}),ve]})]}),Me=w;let Y;U===!0?Y=ze(C):typeof U=="string"&&(Y=U);const ke=e=>{const s=e.target.value,t=Te(s,C);if(t){H(t.getHours()),T(t.getMinutes()),S(t.getSeconds());const n=He(t,w);m?.(e,n,t),b?.(t,n)}else H(0),T(0),S(0),m?.(e,s,void 0),b?.(void 0,s)};return r.jsx($e.default,{...Ne,clearable:!0,value:i||"",placeholder:Me,mask:Y,disabled:q,className:"ds:cursor-pointer",onChange:ke,suffixIcon:we.isMobile?Se==="drawer"?je:be:le==="drawer"?je:be})}exports.TimePicker=Ue;
2
2
  //# sourceMappingURL=TimePicker.cjs.map