@sth87/shadcn-design-system 0.0.36 → 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 (420) hide show
  1. package/dist/AI_CONTEXT.md +212 -214
  2. package/dist/cjs/components/Accordion/Accordion.cjs +1 -1
  3. package/dist/cjs/components/Accordion/Accordion.cjs.map +1 -1
  4. package/dist/cjs/components/Avatar/Avatar.cjs +1 -1
  5. package/dist/cjs/components/Avatar/Avatar.cjs.map +1 -1
  6. package/dist/cjs/components/Badge/Badge.cjs +1 -1
  7. package/dist/cjs/components/Badge/Badge.cjs.map +1 -1
  8. package/dist/cjs/components/Breadcrumb/Breadcrumb.cjs +1 -1
  9. package/dist/cjs/components/Breadcrumb/Breadcrumb.cjs.map +1 -1
  10. package/dist/cjs/components/Button/Button.cjs +1 -1
  11. package/dist/cjs/components/Button/Button.cjs.map +1 -1
  12. package/dist/cjs/components/Calendar/Calendar.cjs +1 -1
  13. package/dist/cjs/components/Calendar/Calendar.cjs.map +1 -1
  14. package/dist/cjs/components/Carousel/Carousel.cjs +1 -1
  15. package/dist/cjs/components/Carousel/Carousel.cjs.map +1 -1
  16. package/dist/cjs/components/Checkbox/Checkbox.cjs +1 -1
  17. package/dist/cjs/components/Checkbox/Checkbox.cjs.map +1 -1
  18. package/dist/cjs/components/Collapsible/Collapsible.cjs +1 -1
  19. package/dist/cjs/components/Collapsible/Collapsible.cjs.map +1 -1
  20. package/dist/cjs/components/Command/Command.cjs +1 -1
  21. package/dist/cjs/components/Command/Command.cjs.map +1 -1
  22. package/dist/cjs/components/ContextMenu/ContextMenu.cjs +1 -1
  23. package/dist/cjs/components/ContextMenu/ContextMenu.cjs.map +1 -1
  24. package/dist/cjs/components/Cropper/Cropper.cjs +1 -1
  25. package/dist/cjs/components/Cropper/Cropper.cjs.map +1 -1
  26. package/dist/cjs/components/DatePicker/DatePicker.cjs +1 -1
  27. package/dist/cjs/components/DatePicker/DatePicker.cjs.map +1 -1
  28. package/dist/cjs/components/DatePicker/RangePicker.cjs +1 -1
  29. package/dist/cjs/components/DatePicker/RangePicker.cjs.map +1 -1
  30. package/dist/cjs/components/DatePicker/TimePicker.cjs +1 -1
  31. package/dist/cjs/components/DatePicker/TimePicker.cjs.map +1 -1
  32. package/dist/cjs/components/Dialog/Dialog.cjs +1 -1
  33. package/dist/cjs/components/Dialog/Dialog.cjs.map +1 -1
  34. package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs +1 -1
  35. package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs.map +1 -1
  36. package/dist/cjs/components/FloatLabel.cjs +1 -1
  37. package/dist/cjs/components/FloatLabel.cjs.map +1 -1
  38. package/dist/cjs/components/Glass/Glass.cjs +1 -1
  39. package/dist/cjs/components/Glass/Glass.cjs.map +1 -1
  40. package/dist/cjs/components/ImageViewer/ImageViewer.cjs +1 -1
  41. package/dist/cjs/components/ImageViewer/ImageViewer.cjs.map +1 -1
  42. package/dist/cjs/components/Input/Input.cjs +1 -1
  43. package/dist/cjs/components/Input/Input.cjs.map +1 -1
  44. package/dist/cjs/components/InputOTP/InputOTP.cjs +1 -1
  45. package/dist/cjs/components/InputOTP/InputOTP.cjs.map +1 -1
  46. package/dist/cjs/components/Interactive/CursorFollow.cjs +1 -1
  47. package/dist/cjs/components/Interactive/CursorFollow.cjs.map +1 -1
  48. package/dist/cjs/components/Marquee/Marquee.cjs +1 -1
  49. package/dist/cjs/components/Marquee/Marquee.cjs.map +1 -1
  50. package/dist/cjs/components/Pagination/Pagination.cjs +1 -1
  51. package/dist/cjs/components/Pagination/Pagination.cjs.map +1 -1
  52. package/dist/cjs/components/QrCode/QrCode.cjs +1 -1
  53. package/dist/cjs/components/QrCode/QrCode.cjs.map +1 -1
  54. package/dist/cjs/components/Radio/Radio.cjs +1 -1
  55. package/dist/cjs/components/Radio/Radio.cjs.map +1 -1
  56. package/dist/cjs/components/Rate/Rate.cjs +1 -1
  57. package/dist/cjs/components/Rate/Rate.cjs.map +1 -1
  58. package/dist/cjs/components/Resizable/Resizable.cjs +1 -1
  59. package/dist/cjs/components/Resizable/Resizable.cjs.map +1 -1
  60. package/dist/cjs/components/ScrollArea/ScrollArea.cjs +1 -1
  61. package/dist/cjs/components/ScrollArea/ScrollArea.cjs.map +1 -1
  62. package/dist/cjs/components/Select/Select.cjs +1 -1
  63. package/dist/cjs/components/Select/Select.cjs.map +1 -1
  64. package/dist/cjs/components/Sheet/Sheet.cjs +2 -2
  65. package/dist/cjs/components/Sheet/Sheet.cjs.map +1 -1
  66. package/dist/cjs/components/Slider/Slider.cjs +1 -1
  67. package/dist/cjs/components/Slider/Slider.cjs.map +1 -1
  68. package/dist/cjs/components/Stepper/Stepper.cjs +1 -1
  69. package/dist/cjs/components/Stepper/Stepper.cjs.map +1 -1
  70. package/dist/cjs/components/Stepper/StepperWrapper.cjs +1 -1
  71. package/dist/cjs/components/Stepper/StepperWrapper.cjs.map +1 -1
  72. package/dist/cjs/components/Switch/Switch.cjs +1 -1
  73. package/dist/cjs/components/Switch/Switch.cjs.map +1 -1
  74. package/dist/cjs/components/Table/TableFilter/data-table-date-filter.cjs +1 -1
  75. package/dist/cjs/components/Table/TableFilter/data-table-date-filter.cjs.map +1 -1
  76. package/dist/cjs/components/Table/TableFilter/data-table-filter-popover.cjs +1 -1
  77. package/dist/cjs/components/Table/TableFilter/data-table-filter-popover.cjs.map +1 -1
  78. package/dist/cjs/components/Table/TableFilter/data-table-slider-filter.cjs +1 -1
  79. package/dist/cjs/components/Table/TableFilter/data-table-slider-filter.cjs.map +1 -1
  80. package/dist/cjs/components/Table/data-table-column-header.cjs +1 -1
  81. package/dist/cjs/components/Table/data-table-column-header.cjs.map +1 -1
  82. package/dist/cjs/components/Table/data-table-pagination.cjs +1 -1
  83. package/dist/cjs/components/Table/data-table-pagination.cjs.map +1 -1
  84. package/dist/cjs/components/Table/data-table.cjs +1 -1
  85. package/dist/cjs/components/Table/data-table.cjs.map +1 -1
  86. package/dist/cjs/components/Tabs/Tabs.cjs +1 -1
  87. package/dist/cjs/components/Tabs/Tabs.cjs.map +1 -1
  88. package/dist/cjs/components/Tabs/classes.cjs +1 -1
  89. package/dist/cjs/components/Tabs/classes.cjs.map +1 -1
  90. package/dist/cjs/components/Textarea/Textarea.cjs +1 -1
  91. package/dist/cjs/components/Textarea/Textarea.cjs.map +1 -1
  92. package/dist/cjs/components/TimeGridView.cjs +1 -1
  93. package/dist/cjs/components/TimeGridView.cjs.map +1 -1
  94. package/dist/cjs/components/Toast/Toast.cjs +1 -1
  95. package/dist/cjs/components/Toast/Toast.cjs.map +1 -1
  96. package/dist/cjs/components/Tooltip/Tooltip.cjs +1 -1
  97. package/dist/cjs/components/Tooltip/Tooltip.cjs.map +1 -1
  98. package/dist/cjs/components/Tour/Tour.cjs +1 -1
  99. package/dist/cjs/components/Tour/Tour.cjs.map +1 -1
  100. package/dist/cjs/components/Tour/TourWrapper.cjs +1 -1
  101. package/dist/cjs/components/Tour/TourWrapper.cjs.map +1 -1
  102. package/dist/cjs/components/Upload/Upload.cjs +3 -3
  103. package/dist/cjs/components/Upload/Upload.cjs.map +1 -1
  104. package/dist/cjs/components/WheelColumn.cjs +1 -1
  105. package/dist/cjs/components/WheelColumn.cjs.map +1 -1
  106. package/dist/cjs/lib/TextAnimation/BlurText.cjs +1 -1
  107. package/dist/cjs/lib/TextAnimation/BlurText.cjs.map +1 -1
  108. package/dist/cjs/lib/TextAnimation/CircularText.cjs +1 -1
  109. package/dist/cjs/lib/TextAnimation/CircularText.cjs.map +1 -1
  110. package/dist/cjs/lib/TextAnimation/FlipWords.cjs +1 -1
  111. package/dist/cjs/lib/TextAnimation/FlipWords.cjs.map +1 -1
  112. package/dist/cjs/lib/TextAnimation/GradientText.cjs +1 -1
  113. package/dist/cjs/lib/TextAnimation/GradientText.cjs.map +1 -1
  114. package/dist/cjs/lib/TextAnimation/RollingText.cjs +1 -1
  115. package/dist/cjs/lib/TextAnimation/RollingText.cjs.map +1 -1
  116. package/dist/cjs/lib/TextAnimation/RotatingText.cjs +1 -1
  117. package/dist/cjs/lib/TextAnimation/RotatingText.cjs.map +1 -1
  118. package/dist/cjs/lib/TextAnimation/ShimmeringText.cjs +1 -1
  119. package/dist/cjs/lib/TextAnimation/ShimmeringText.cjs.map +1 -1
  120. package/dist/cjs/lib/TextAnimation/TextGenerateEffect.cjs +1 -1
  121. package/dist/cjs/lib/TextAnimation/TextGenerateEffect.cjs.map +1 -1
  122. package/dist/cjs/lib/TextAnimation/TextHoverEffect.cjs +1 -1
  123. package/dist/cjs/lib/TextAnimation/TextHoverEffect.cjs.map +1 -1
  124. package/dist/cjs/lib/TextAnimation/TextPressureEffect.cjs +2 -2
  125. package/dist/cjs/lib/TextAnimation/TextPressureEffect.cjs.map +1 -1
  126. package/dist/cjs/lib/TextAnimation/TypingText.cjs +1 -1
  127. package/dist/cjs/lib/TextAnimation/TypingText.cjs.map +1 -1
  128. package/dist/cjs/lib/TextAnimation/WritingText.cjs +1 -1
  129. package/dist/cjs/lib/TextAnimation/WritingText.cjs.map +1 -1
  130. 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
  131. package/dist/cjs/packages/ui/src/components/accordion.cjs +1 -1
  132. package/dist/cjs/packages/ui/src/components/accordion.cjs.map +1 -1
  133. package/dist/cjs/packages/ui/src/components/alert-dialog.cjs +1 -1
  134. package/dist/cjs/packages/ui/src/components/alert-dialog.cjs.map +1 -1
  135. package/dist/cjs/packages/ui/src/components/avatar.cjs +1 -1
  136. package/dist/cjs/packages/ui/src/components/avatar.cjs.map +1 -1
  137. package/dist/cjs/packages/ui/src/components/badge.cjs +1 -1
  138. package/dist/cjs/packages/ui/src/components/badge.cjs.map +1 -1
  139. package/dist/cjs/packages/ui/src/components/breadcrumb.cjs +1 -1
  140. package/dist/cjs/packages/ui/src/components/breadcrumb.cjs.map +1 -1
  141. package/dist/cjs/packages/ui/src/components/button-group.cjs +1 -1
  142. package/dist/cjs/packages/ui/src/components/button-group.cjs.map +1 -1
  143. package/dist/cjs/packages/ui/src/components/button.cjs +1 -1
  144. package/dist/cjs/packages/ui/src/components/button.cjs.map +1 -1
  145. package/dist/cjs/packages/ui/src/components/calendar.cjs +1 -1
  146. package/dist/cjs/packages/ui/src/components/calendar.cjs.map +1 -1
  147. package/dist/cjs/packages/ui/src/components/checkbox.cjs +1 -1
  148. package/dist/cjs/packages/ui/src/components/checkbox.cjs.map +1 -1
  149. package/dist/cjs/packages/ui/src/components/combobox.cjs +1 -1
  150. package/dist/cjs/packages/ui/src/components/combobox.cjs.map +1 -1
  151. package/dist/cjs/packages/ui/src/components/command.cjs +1 -1
  152. package/dist/cjs/packages/ui/src/components/command.cjs.map +1 -1
  153. package/dist/cjs/packages/ui/src/components/context-menu.cjs +1 -1
  154. package/dist/cjs/packages/ui/src/components/context-menu.cjs.map +1 -1
  155. package/dist/cjs/packages/ui/src/components/dialog.cjs +1 -1
  156. package/dist/cjs/packages/ui/src/components/dialog.cjs.map +1 -1
  157. package/dist/cjs/packages/ui/src/components/drawer.cjs +1 -1
  158. package/dist/cjs/packages/ui/src/components/drawer.cjs.map +1 -1
  159. package/dist/cjs/packages/ui/src/components/dropdown-menu.cjs +1 -1
  160. package/dist/cjs/packages/ui/src/components/dropdown-menu.cjs.map +1 -1
  161. package/dist/cjs/packages/ui/src/components/input-otp.cjs +1 -1
  162. package/dist/cjs/packages/ui/src/components/input-otp.cjs.map +1 -1
  163. package/dist/cjs/packages/ui/src/components/input.cjs +1 -1
  164. package/dist/cjs/packages/ui/src/components/input.cjs.map +1 -1
  165. package/dist/cjs/packages/ui/src/components/label.cjs +1 -1
  166. package/dist/cjs/packages/ui/src/components/label.cjs.map +1 -1
  167. package/dist/cjs/packages/ui/src/components/pagination.cjs +1 -1
  168. package/dist/cjs/packages/ui/src/components/pagination.cjs.map +1 -1
  169. package/dist/cjs/packages/ui/src/components/popover.cjs +1 -1
  170. package/dist/cjs/packages/ui/src/components/popover.cjs.map +1 -1
  171. package/dist/cjs/packages/ui/src/components/radio-group.cjs +1 -1
  172. package/dist/cjs/packages/ui/src/components/radio-group.cjs.map +1 -1
  173. package/dist/cjs/packages/ui/src/components/resizable.cjs +1 -1
  174. package/dist/cjs/packages/ui/src/components/resizable.cjs.map +1 -1
  175. package/dist/cjs/packages/ui/src/components/scroll-area.cjs +1 -1
  176. package/dist/cjs/packages/ui/src/components/scroll-area.cjs.map +1 -1
  177. package/dist/cjs/packages/ui/src/components/select.cjs +1 -1
  178. package/dist/cjs/packages/ui/src/components/select.cjs.map +1 -1
  179. package/dist/cjs/packages/ui/src/components/separator.cjs +1 -1
  180. package/dist/cjs/packages/ui/src/components/separator.cjs.map +1 -1
  181. package/dist/cjs/packages/ui/src/components/sheet.cjs +1 -1
  182. package/dist/cjs/packages/ui/src/components/sheet.cjs.map +1 -1
  183. package/dist/cjs/packages/ui/src/components/sidebar.cjs +1 -1
  184. package/dist/cjs/packages/ui/src/components/sidebar.cjs.map +1 -1
  185. package/dist/cjs/packages/ui/src/components/skeleton.cjs +1 -1
  186. package/dist/cjs/packages/ui/src/components/skeleton.cjs.map +1 -1
  187. package/dist/cjs/packages/ui/src/components/switch.cjs +1 -1
  188. package/dist/cjs/packages/ui/src/components/switch.cjs.map +1 -1
  189. package/dist/cjs/packages/ui/src/components/table.cjs +1 -1
  190. package/dist/cjs/packages/ui/src/components/table.cjs.map +1 -1
  191. package/dist/cjs/packages/ui/src/components/tabs.cjs +1 -1
  192. package/dist/cjs/packages/ui/src/components/tabs.cjs.map +1 -1
  193. package/dist/cjs/packages/ui/src/components/textarea.cjs +1 -1
  194. package/dist/cjs/packages/ui/src/components/textarea.cjs.map +1 -1
  195. package/dist/cjs/packages/ui/src/components/toggle.cjs +1 -1
  196. package/dist/cjs/packages/ui/src/components/toggle.cjs.map +1 -1
  197. package/dist/cjs/packages/ui/src/components/tooltip.cjs +1 -1
  198. package/dist/cjs/packages/ui/src/components/tooltip.cjs.map +1 -1
  199. package/dist/cjs/packages/ui/src/components/tree-view.cjs +1 -1
  200. package/dist/cjs/packages/ui/src/components/tree-view.cjs.map +1 -1
  201. package/dist/cjs/styles/index.css +1 -1
  202. package/dist/cjs/utils/animations.cjs +1 -1
  203. package/dist/cjs/utils/animations.cjs.map +1 -1
  204. package/dist/cjs/utils/css.cjs +1 -1
  205. package/dist/cjs/utils/css.cjs.map +1 -1
  206. package/dist/cjs/utils/parsers.cjs +1 -1
  207. package/dist/cjs/utils/parsers.cjs.map +1 -1
  208. package/dist/esm/components/Accordion/Accordion.js +60 -60
  209. package/dist/esm/components/Accordion/Accordion.js.map +1 -1
  210. package/dist/esm/components/Avatar/Avatar.js +40 -40
  211. package/dist/esm/components/Avatar/Avatar.js.map +1 -1
  212. package/dist/esm/components/Badge/Badge.js +1 -1
  213. package/dist/esm/components/Badge/Badge.js.map +1 -1
  214. package/dist/esm/components/Breadcrumb/Breadcrumb.js +36 -36
  215. package/dist/esm/components/Breadcrumb/Breadcrumb.js.map +1 -1
  216. package/dist/esm/components/Button/Button.js +9 -9
  217. package/dist/esm/components/Button/Button.js.map +1 -1
  218. package/dist/esm/components/Calendar/Calendar.js +4 -4
  219. package/dist/esm/components/Calendar/Calendar.js.map +1 -1
  220. package/dist/esm/components/Carousel/Carousel.js +165 -165
  221. package/dist/esm/components/Carousel/Carousel.js.map +1 -1
  222. package/dist/esm/components/Checkbox/Checkbox.js +26 -26
  223. package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
  224. package/dist/esm/components/Collapsible/Collapsible.js +43 -43
  225. package/dist/esm/components/Collapsible/Collapsible.js.map +1 -1
  226. package/dist/esm/components/Command/Command.js +28 -28
  227. package/dist/esm/components/Command/Command.js.map +1 -1
  228. package/dist/esm/components/ContextMenu/ContextMenu.js +11 -11
  229. package/dist/esm/components/ContextMenu/ContextMenu.js.map +1 -1
  230. package/dist/esm/components/Cropper/Cropper.js +132 -132
  231. package/dist/esm/components/Cropper/Cropper.js.map +1 -1
  232. package/dist/esm/components/DatePicker/DatePicker.js +75 -75
  233. package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
  234. package/dist/esm/components/DatePicker/RangePicker.js +136 -136
  235. package/dist/esm/components/DatePicker/RangePicker.js.map +1 -1
  236. package/dist/esm/components/DatePicker/TimePicker.js +150 -150
  237. package/dist/esm/components/DatePicker/TimePicker.js.map +1 -1
  238. package/dist/esm/components/Dialog/Dialog.js +114 -114
  239. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  240. package/dist/esm/components/DropdownMenu/DropdownMenu.js +13 -13
  241. package/dist/esm/components/DropdownMenu/DropdownMenu.js.map +1 -1
  242. package/dist/esm/components/FloatLabel.js +44 -44
  243. package/dist/esm/components/FloatLabel.js.map +1 -1
  244. package/dist/esm/components/Glass/Glass.js +15 -15
  245. package/dist/esm/components/Glass/Glass.js.map +1 -1
  246. package/dist/esm/components/ImageViewer/ImageViewer.js +53 -53
  247. package/dist/esm/components/ImageViewer/ImageViewer.js.map +1 -1
  248. package/dist/esm/components/Input/Input.js +104 -104
  249. package/dist/esm/components/Input/Input.js.map +1 -1
  250. package/dist/esm/components/InputOTP/InputOTP.js +16 -16
  251. package/dist/esm/components/InputOTP/InputOTP.js.map +1 -1
  252. package/dist/esm/components/Interactive/CursorFollow.js +49 -49
  253. package/dist/esm/components/Interactive/CursorFollow.js.map +1 -1
  254. package/dist/esm/components/Marquee/Marquee.js +130 -130
  255. package/dist/esm/components/Marquee/Marquee.js.map +1 -1
  256. package/dist/esm/components/Pagination/Pagination.js +68 -68
  257. package/dist/esm/components/Pagination/Pagination.js.map +1 -1
  258. package/dist/esm/components/QrCode/QrCode.js +37 -37
  259. package/dist/esm/components/QrCode/QrCode.js.map +1 -1
  260. package/dist/esm/components/Radio/Radio.js +16 -16
  261. package/dist/esm/components/Radio/Radio.js.map +1 -1
  262. package/dist/esm/components/Rate/Rate.js +62 -62
  263. package/dist/esm/components/Rate/Rate.js.map +1 -1
  264. package/dist/esm/components/Resizable/Resizable.js +6 -6
  265. package/dist/esm/components/Resizable/Resizable.js.map +1 -1
  266. package/dist/esm/components/ScrollArea/ScrollArea.js +10 -10
  267. package/dist/esm/components/ScrollArea/ScrollArea.js.map +1 -1
  268. package/dist/esm/components/Select/Select.js +64 -64
  269. package/dist/esm/components/Select/Select.js.map +1 -1
  270. package/dist/esm/components/Sheet/Sheet.js +21 -21
  271. package/dist/esm/components/Sheet/Sheet.js.map +1 -1
  272. package/dist/esm/components/Slider/Slider.js +54 -54
  273. package/dist/esm/components/Slider/Slider.js.map +1 -1
  274. package/dist/esm/components/Stepper/Stepper.js +198 -198
  275. package/dist/esm/components/Stepper/Stepper.js.map +1 -1
  276. package/dist/esm/components/Stepper/StepperWrapper.js +15 -15
  277. package/dist/esm/components/Stepper/StepperWrapper.js.map +1 -1
  278. package/dist/esm/components/Switch/Switch.js +38 -38
  279. package/dist/esm/components/Switch/Switch.js.map +1 -1
  280. package/dist/esm/components/Table/TableFilter/data-table-date-filter.js +37 -37
  281. package/dist/esm/components/Table/TableFilter/data-table-date-filter.js.map +1 -1
  282. package/dist/esm/components/Table/TableFilter/data-table-filter-popover.js +25 -25
  283. package/dist/esm/components/Table/TableFilter/data-table-filter-popover.js.map +1 -1
  284. package/dist/esm/components/Table/TableFilter/data-table-slider-filter.js +64 -64
  285. package/dist/esm/components/Table/TableFilter/data-table-slider-filter.js.map +1 -1
  286. package/dist/esm/components/Table/data-table-column-header.js +18 -18
  287. package/dist/esm/components/Table/data-table-column-header.js.map +1 -1
  288. package/dist/esm/components/Table/data-table-pagination.js +21 -21
  289. package/dist/esm/components/Table/data-table-pagination.js.map +1 -1
  290. package/dist/esm/components/Table/data-table.js +18 -18
  291. package/dist/esm/components/Table/data-table.js.map +1 -1
  292. package/dist/esm/components/Tabs/Tabs.js +242 -242
  293. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  294. package/dist/esm/components/Tabs/classes.js +51 -51
  295. package/dist/esm/components/Tabs/classes.js.map +1 -1
  296. package/dist/esm/components/Textarea/Textarea.js +49 -49
  297. package/dist/esm/components/Textarea/Textarea.js.map +1 -1
  298. package/dist/esm/components/TimeGridView.js +12 -12
  299. package/dist/esm/components/TimeGridView.js.map +1 -1
  300. package/dist/esm/components/Toast/Toast.js +45 -45
  301. package/dist/esm/components/Toast/Toast.js.map +1 -1
  302. package/dist/esm/components/Tooltip/Tooltip.js +19 -19
  303. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  304. package/dist/esm/components/Tour/Tour.js +11 -11
  305. package/dist/esm/components/Tour/Tour.js.map +1 -1
  306. package/dist/esm/components/Tour/TourWrapper.js +15 -15
  307. package/dist/esm/components/Tour/TourWrapper.js.map +1 -1
  308. package/dist/esm/components/Upload/Upload.js +405 -405
  309. package/dist/esm/components/Upload/Upload.js.map +1 -1
  310. package/dist/esm/components/WheelColumn.js +47 -47
  311. package/dist/esm/components/WheelColumn.js.map +1 -1
  312. package/dist/esm/lib/TextAnimation/BlurText.js +18 -18
  313. package/dist/esm/lib/TextAnimation/BlurText.js.map +1 -1
  314. package/dist/esm/lib/TextAnimation/CircularText.js +7 -7
  315. package/dist/esm/lib/TextAnimation/CircularText.js.map +1 -1
  316. package/dist/esm/lib/TextAnimation/FlipWords.js +21 -21
  317. package/dist/esm/lib/TextAnimation/FlipWords.js.map +1 -1
  318. package/dist/esm/lib/TextAnimation/GradientText.js +4 -4
  319. package/dist/esm/lib/TextAnimation/GradientText.js.map +1 -1
  320. package/dist/esm/lib/TextAnimation/RollingText.js +24 -24
  321. package/dist/esm/lib/TextAnimation/RollingText.js.map +1 -1
  322. package/dist/esm/lib/TextAnimation/RotatingText.js +6 -6
  323. package/dist/esm/lib/TextAnimation/RotatingText.js.map +1 -1
  324. package/dist/esm/lib/TextAnimation/ShimmeringText.js +9 -9
  325. package/dist/esm/lib/TextAnimation/ShimmeringText.js.map +1 -1
  326. package/dist/esm/lib/TextAnimation/TextGenerateEffect.js +14 -14
  327. package/dist/esm/lib/TextAnimation/TextGenerateEffect.js.map +1 -1
  328. package/dist/esm/lib/TextAnimation/TextHoverEffect.js +9 -9
  329. package/dist/esm/lib/TextAnimation/TextHoverEffect.js.map +1 -1
  330. package/dist/esm/lib/TextAnimation/TextPressureEffect.js +3 -3
  331. package/dist/esm/lib/TextAnimation/TextPressureEffect.js.map +1 -1
  332. package/dist/esm/lib/TextAnimation/TypingText.js +17 -17
  333. package/dist/esm/lib/TextAnimation/TypingText.js.map +1 -1
  334. package/dist/esm/lib/TextAnimation/WritingText.js +10 -10
  335. package/dist/esm/lib/TextAnimation/WritingText.js.map +1 -1
  336. 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
  337. package/dist/esm/packages/ui/src/components/accordion.js +31 -31
  338. package/dist/esm/packages/ui/src/components/accordion.js.map +1 -1
  339. package/dist/esm/packages/ui/src/components/alert-dialog.js +33 -33
  340. package/dist/esm/packages/ui/src/components/alert-dialog.js.map +1 -1
  341. package/dist/esm/packages/ui/src/components/avatar.js +20 -20
  342. package/dist/esm/packages/ui/src/components/avatar.js.map +1 -1
  343. package/dist/esm/packages/ui/src/components/badge.js +53 -53
  344. package/dist/esm/packages/ui/src/components/badge.js.map +1 -1
  345. package/dist/esm/packages/ui/src/components/breadcrumb.js +20 -20
  346. package/dist/esm/packages/ui/src/components/breadcrumb.js.map +1 -1
  347. package/dist/esm/packages/ui/src/components/button-group.js +31 -31
  348. package/dist/esm/packages/ui/src/components/button-group.js.map +1 -1
  349. package/dist/esm/packages/ui/src/components/button.js +90 -90
  350. package/dist/esm/packages/ui/src/components/button.js.map +1 -1
  351. package/dist/esm/packages/ui/src/components/calendar.js +94 -94
  352. package/dist/esm/packages/ui/src/components/calendar.js.map +1 -1
  353. package/dist/esm/packages/ui/src/components/checkbox.js +47 -47
  354. package/dist/esm/packages/ui/src/components/checkbox.js.map +1 -1
  355. package/dist/esm/packages/ui/src/components/combobox.js +64 -64
  356. package/dist/esm/packages/ui/src/components/combobox.js.map +1 -1
  357. package/dist/esm/packages/ui/src/components/command.js +77 -77
  358. package/dist/esm/packages/ui/src/components/command.js.map +1 -1
  359. package/dist/esm/packages/ui/src/components/context-menu.js +76 -76
  360. package/dist/esm/packages/ui/src/components/context-menu.js.map +1 -1
  361. package/dist/esm/packages/ui/src/components/dialog.js +54 -54
  362. package/dist/esm/packages/ui/src/components/dialog.js.map +1 -1
  363. package/dist/esm/packages/ui/src/components/drawer.js +39 -39
  364. package/dist/esm/packages/ui/src/components/drawer.js.map +1 -1
  365. package/dist/esm/packages/ui/src/components/dropdown-menu.js +109 -109
  366. package/dist/esm/packages/ui/src/components/dropdown-menu.js.map +1 -1
  367. package/dist/esm/packages/ui/src/components/input-otp.js +30 -30
  368. package/dist/esm/packages/ui/src/components/input-otp.js.map +1 -1
  369. package/dist/esm/packages/ui/src/components/input.js +19 -19
  370. package/dist/esm/packages/ui/src/components/input.js.map +1 -1
  371. package/dist/esm/packages/ui/src/components/label.js +9 -9
  372. package/dist/esm/packages/ui/src/components/label.js.map +1 -1
  373. package/dist/esm/packages/ui/src/components/pagination.js +26 -26
  374. package/dist/esm/packages/ui/src/components/pagination.js.map +1 -1
  375. package/dist/esm/packages/ui/src/components/popover.js +13 -13
  376. package/dist/esm/packages/ui/src/components/popover.js.map +1 -1
  377. package/dist/esm/packages/ui/src/components/radio-group.js +45 -45
  378. package/dist/esm/packages/ui/src/components/radio-group.js.map +1 -1
  379. package/dist/esm/packages/ui/src/components/resizable.js +18 -18
  380. package/dist/esm/packages/ui/src/components/resizable.js.map +1 -1
  381. package/dist/esm/packages/ui/src/components/scroll-area.js +31 -31
  382. package/dist/esm/packages/ui/src/components/scroll-area.js.map +1 -1
  383. package/dist/esm/packages/ui/src/components/select.js +119 -119
  384. package/dist/esm/packages/ui/src/components/select.js.map +1 -1
  385. package/dist/esm/packages/ui/src/components/separator.js +86 -86
  386. package/dist/esm/packages/ui/src/components/separator.js.map +1 -1
  387. package/dist/esm/packages/ui/src/components/sheet.js +50 -50
  388. package/dist/esm/packages/ui/src/components/sheet.js.map +1 -1
  389. package/dist/esm/packages/ui/src/components/sidebar.js +198 -198
  390. package/dist/esm/packages/ui/src/components/sidebar.js.map +1 -1
  391. package/dist/esm/packages/ui/src/components/skeleton.js +3 -3
  392. package/dist/esm/packages/ui/src/components/skeleton.js.map +1 -1
  393. package/dist/esm/packages/ui/src/components/switch.js +57 -57
  394. package/dist/esm/packages/ui/src/components/switch.js.map +1 -1
  395. package/dist/esm/packages/ui/src/components/table.js +17 -17
  396. package/dist/esm/packages/ui/src/components/table.js.map +1 -1
  397. package/dist/esm/packages/ui/src/components/tabs.js +33 -33
  398. package/dist/esm/packages/ui/src/components/tabs.js.map +1 -1
  399. package/dist/esm/packages/ui/src/components/textarea.js +17 -17
  400. package/dist/esm/packages/ui/src/components/textarea.js.map +1 -1
  401. package/dist/esm/packages/ui/src/components/toggle.js +36 -36
  402. package/dist/esm/packages/ui/src/components/toggle.js.map +1 -1
  403. package/dist/esm/packages/ui/src/components/tooltip.js +20 -20
  404. package/dist/esm/packages/ui/src/components/tooltip.js.map +1 -1
  405. package/dist/esm/packages/ui/src/components/tree-view.js +218 -218
  406. package/dist/esm/packages/ui/src/components/tree-view.js.map +1 -1
  407. package/dist/esm/styles/index.css +1 -1
  408. package/dist/esm/utils/animations.js +55 -55
  409. package/dist/esm/utils/animations.js.map +1 -1
  410. package/dist/esm/utils/css.js +7 -7
  411. package/dist/esm/utils/css.js.map +1 -1
  412. package/dist/esm/utils/parsers.js +1 -1
  413. package/dist/types/components/DatePicker/RangePicker.d.ts.map +1 -1
  414. package/dist/types/lib/TextAnimation/TextPressureEffect.d.ts.map +1 -1
  415. package/dist/types/lib/TextAnimation/TypingText.d.ts.map +1 -1
  416. package/package.json +1 -1
  417. 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
  418. 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
  419. /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
  420. /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,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),F=require("lucide-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 I=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("react-day-picker");require("../../packages/ui/src/components/popover.cjs");require("@radix-ui/react-separator");require("../../packages/ui/src/components/switch.cjs");require("vaul");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");typeof window<"u"&&Promise.resolve().then(()=>require("../../_virtual/index.cjs")).then(s=>s.index).then(s=>{s.default});const v=({images:s,visible:d=!1,onClose:i,activeIndex:o=0,onIndexChange:l,zoomSpeed:h=.1,disableKeyboardSupport:c=!1,noNavbar:u=!1,noToolbar:f=!1,rotatable:b=!0,scalable:g=!0,changeable:V=!0,noClose:N=!1,minScale:x=.1,maxScale:q=50,defaultScale:p=1,className:j,downloadable:P=!1,noImgDetails:C=!1,noResetZoomAfterChange:L=!1,drag:S=!1})=>{const[m,k]=r.useState(o),[w,U]=r.useState(null);r.useEffect(()=>{typeof window<"u"&&!w&&Promise.resolve().then(()=>require("../../_virtual/index.cjs")).then(t=>t.index).then(t=>{U(()=>t.default)})},[w]),r.useEffect(()=>{k(o)},[o]);const y=r.useCallback(()=>{i?.()},[i]),R=r.useCallback((t,n)=>{k(n),l?.(n)},[l]),T=r.useCallback(()=>{const t=s[m],n=t.downloadUrl||t.src,a=document.createElement("a");a.href=n,a.download=t.alt||`image-${m+1}`,fetch(n).then(E=>E.blob()).then(E=>{const O=window.URL.createObjectURL(E);a.href=O,document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(O)}).catch(()=>{})},[s,m]),D=s.map(t=>({src:t.src,alt:t.alt||"",downloadUrl:t.downloadUrl||t.src}));return w?e.jsx(w,{visible:d,onClose:y,onMaskClick:y,images:D,activeIndex:m,onChange:R,zoomSpeed:h,disableKeyboardSupport:c,noNavbar:u,noToolbar:f,rotatable:b,scalable:g,changeable:V,noClose:N,minScale:x,maxScale:q,defaultScale:p,className:I.cn("image-viewer-antd-style",j),downloadable:P,noImgDetails:C,noResetZoomAfterChange:L,showTotal:!0,drag:S,customToolbar:t=>t.map(n=>n.key==="download"?{...n,actionType:void 0,onClick:void 0,render:e.jsx("button",{type:"button",className:"react-viewer-icon react-viewer-download",title:"Download",style:{background:"none",border:"none",cursor:"pointer",padding:0},onClick:a=>{a.preventDefault(),a.stopPropagation(),T()},children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M10 3v10m0 0l-4-4m4 4l4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("rect",{x:"4",y:"17",width:"12",height:"2",rx:"1",fill:"currentColor"})]})})}:n)}):null};v.displayName="ImageViewer";const G=({src:s,alt:d="",width:i,height:o,preview:l=!0,previewSrc:h,fallback:c,placeholder:u,className:f,wrapperClassName:b,onPreviewClick:g,onError:V,...N})=>{const[x,q]=r.useState(!0),[p,j]=r.useState(!1),[P,C]=r.useState(!1),L=()=>{q(!1),j(!1)},S=R=>{q(!1),j(!0),V?.(R)},m=()=>{l&&(C(!0),g?.())},k=()=>{C(!1)},w=x&&u,U=p&&c,y=l&&!x&&!p;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:I.cn("ds-image-viewer-root relative inline-block",b),children:e.jsxs("div",{className:"relative inline-block",children:[w&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-muted animate-pulse",style:{width:i,height:o},children:u===!0?e.jsx("div",{className:"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin"}):u}),e.jsx("img",{src:U?c:s,alt:d,width:i,height:o,className:I.cn("ds-image-viewer-img max-w-full h-auto align-middle",x&&"opacity-0",f),onLoad:L,onError:S,...N}),y&&e.jsx("div",{onClick:m,className:I.cn("ds-image-viewer-mask absolute inset-0 flex items-center justify-center opacity-0 hover:opacity-100 transition-opacity cursor-pointer","bg-black/50 backdrop-blur-sm"),children:e.jsxs("div",{className:"text-white text-sm flex items-center gap-2",children:[e.jsx(F.ZoomIn,{className:"w-5 h-5"}),e.jsx("span",{children:"Preview"})]})})]})}),e.jsx(v,{images:[{src:h||s,alt:d}],visible:P,onClose:k,rotatable:!0,scalable:!0,downloadable:!0})]})};G.displayName="ImageViewer.Image";const M=({children:s,images:d,preview:i=!0})=>{const[o,l]=r.useState(!1),[h,c]=r.useState(0),u=r.useCallback(g=>{c(g),l(!0)},[]),f=r.useCallback(()=>{l(!1)},[]),b=r.useMemo(()=>({handlePreview:u,preview:i}),[u,i]);return e.jsxs(e.Fragment,{children:[e.jsx(B.Provider,{value:b,children:s}),e.jsx(v,{images:d,visible:o,onClose:f,activeIndex:h,onIndexChange:c,rotatable:!0,scalable:!0,downloadable:!0})]})};M.displayName="ImageViewer.Group";const B=r.createContext(null);Object.assign(v,{Image:G,Group:M});exports.ImageViewer=v;exports.ImageViewerGroup=M;exports.ImageViewerImage=G;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),F=require("lucide-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 I=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("react-day-picker");require("../../packages/ui/src/components/popover.cjs");require("@radix-ui/react-separator");require("../../packages/ui/src/components/switch.cjs");require("vaul");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");typeof window<"u"&&Promise.resolve().then(()=>require("../../_virtual/index.cjs")).then(t=>t.index).then(t=>{t.default});const v=({images:t,visible:c=!1,onClose:i,activeIndex:o=0,onIndexChange:l,zoomSpeed:h=.1,disableKeyboardSupport:u=!1,noNavbar:d=!1,noToolbar:f=!1,rotatable:b=!0,scalable:g=!0,changeable:V=!0,noClose:N=!1,minScale:x=.1,maxScale:q=50,defaultScale:p=1,className:j,downloadable:P=!1,noImgDetails:C=!1,noResetZoomAfterChange:L=!1,drag:S=!1})=>{const[m,k]=r.useState(o),[w,U]=r.useState(null);r.useEffect(()=>{typeof window<"u"&&!w&&Promise.resolve().then(()=>require("../../_virtual/index.cjs")).then(s=>s.index).then(s=>{U(()=>s.default)})},[w]),r.useEffect(()=>{k(o)},[o]);const y=r.useCallback(()=>{i?.()},[i]),R=r.useCallback((s,n)=>{k(n),l?.(n)},[l]),T=r.useCallback(()=>{const s=t[m],n=s.downloadUrl||s.src,a=document.createElement("a");a.href=n,a.download=s.alt||`image-${m+1}`,fetch(n).then(E=>E.blob()).then(E=>{const O=window.URL.createObjectURL(E);a.href=O,document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(O)}).catch(()=>{})},[t,m]),D=t.map(s=>({src:s.src,alt:s.alt||"",downloadUrl:s.downloadUrl||s.src}));return w?e.jsx(w,{visible:c,onClose:y,onMaskClick:y,images:D,activeIndex:m,onChange:R,zoomSpeed:h,disableKeyboardSupport:u,noNavbar:d,noToolbar:f,rotatable:b,scalable:g,changeable:V,noClose:N,minScale:x,maxScale:q,defaultScale:p,className:I.cn("ds:image-viewer-antd-style",j),downloadable:P,noImgDetails:C,noResetZoomAfterChange:L,showTotal:!0,drag:S,customToolbar:s=>s.map(n=>n.key==="download"?{...n,actionType:void 0,onClick:void 0,render:e.jsx("button",{type:"button",className:"ds:react-viewer-icon ds:react-viewer-download",title:"Download",style:{background:"none",border:"none",cursor:"pointer",padding:0},onClick:a=>{a.preventDefault(),a.stopPropagation(),T()},children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M10 3v10m0 0l-4-4m4 4l4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("rect",{x:"4",y:"17",width:"12",height:"2",rx:"1",fill:"currentColor"})]})})}:n)}):null};v.displayName="ImageViewer";const G=({src:t,alt:c="",width:i,height:o,preview:l=!0,previewSrc:h,fallback:u,placeholder:d,className:f,wrapperClassName:b,onPreviewClick:g,onError:V,...N})=>{const[x,q]=r.useState(!0),[p,j]=r.useState(!1),[P,C]=r.useState(!1),L=()=>{q(!1),j(!1)},S=R=>{q(!1),j(!0),V?.(R)},m=()=>{l&&(C(!0),g?.())},k=()=>{C(!1)},w=x&&d,U=p&&u,y=l&&!x&&!p;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:I.cn("ds:ds-image-viewer-root ds:relative ds:inline-block",b),children:e.jsxs("div",{className:"ds:relative ds:inline-block",children:[w&&e.jsx("div",{className:"ds:absolute ds:inset-0 ds:flex ds:items-center ds:justify-center ds:bg-muted ds:animate-pulse",style:{width:i,height:o},children:d===!0?e.jsx("div",{className:"ds:w-8 ds:h-8 ds:border-2 ds:border-primary ds:border-t-transparent ds:rounded-full ds:animate-spin"}):d}),e.jsx("img",{src:U?u:t,alt:c,width:i,height:o,className:I.cn("ds:ds-image-viewer-img ds:max-w-full ds:h-auto ds:align-middle",x&&"ds:opacity-0",f),onLoad:L,onError:S,...N}),y&&e.jsx("div",{onClick:m,className:I.cn("ds:ds-image-viewer-mask ds:absolute ds:inset-0 ds:flex ds:items-center ds:justify-center ds:opacity-0 ds:hover:opacity-100 ds:transition-opacity ds:cursor-pointer","ds:bg-black/50 ds:backdrop-blur-sm"),children:e.jsxs("div",{className:"ds:text-white ds:text-sm ds:flex ds:items-center ds:gap-2",children:[e.jsx(F.ZoomIn,{className:"ds:w-5 ds:h-5"}),e.jsx("span",{children:"Preview"})]})})]})}),e.jsx(v,{images:[{src:h||t,alt:c}],visible:P,onClose:k,rotatable:!0,scalable:!0,downloadable:!0})]})};G.displayName="ImageViewer.Image";const M=({children:t,images:c,preview:i=!0})=>{const[o,l]=r.useState(!1),[h,u]=r.useState(0),d=r.useCallback(g=>{u(g),l(!0)},[]),f=r.useCallback(()=>{l(!1)},[]),b=r.useMemo(()=>({handlePreview:d,preview:i}),[d,i]);return e.jsxs(e.Fragment,{children:[e.jsx(B.Provider,{value:b,children:t}),e.jsx(v,{images:c,visible:o,onClose:f,activeIndex:h,onIndexChange:u,rotatable:!0,scalable:!0,downloadable:!0})]})};M.displayName="ImageViewer.Group";const B=r.createContext(null);Object.assign(v,{Image:G,Group:M});exports.ImageViewer=v;exports.ImageViewerGroup=M;exports.ImageViewerImage=G;
2
2
  //# sourceMappingURL=ImageViewer.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ImageViewer.cjs","sources":["../../../../src/components/ImageViewer/ImageViewer.tsx"],"sourcesContent":["import React, { useState, useCallback, useEffect } from \"react\";\nimport { ZoomIn } from \"lucide-react\";\nimport { cn } from \"@dsui/ui/index\";\n\n// Dynamic import for react-viewer to avoid SSR issues\nlet Viewer: any = null;\nif (typeof window !== \"undefined\") {\n import(\"react-viewer\").then((module) => {\n Viewer = module.default;\n });\n}\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface ImageInfo {\n src: string;\n alt?: string;\n downloadUrl?: string;\n}\n\nexport interface ImageViewerProps {\n images: ImageInfo[];\n visible?: boolean;\n onClose?: () => void;\n activeIndex?: number;\n onIndexChange?: (_index: number) => void;\n zoomSpeed?: number;\n disableKeyboardSupport?: boolean;\n noNavbar?: boolean;\n noToolbar?: boolean;\n rotatable?: boolean;\n scalable?: boolean;\n changeable?: boolean;\n noClose?: boolean;\n minScale?: number;\n maxScale?: number;\n defaultScale?: number;\n className?: string;\n downloadable?: boolean;\n noImgDetails?: boolean;\n noResetZoomAfterChange?: boolean;\n drag?: boolean;\n}\n\nexport interface ImageViewerImageProps\n extends React.ImgHTMLAttributes<HTMLImageElement> {\n src: string;\n alt?: string;\n width?: string | number;\n height?: string | number;\n preview?: boolean;\n previewSrc?: string;\n fallback?: string;\n placeholder?: React.ReactNode | boolean;\n className?: string;\n wrapperClassName?: string;\n onPreviewClick?: () => void;\n}\n\n// ============================================================================\n// ImageViewer Component\n// ============================================================================\n\nexport const ImageViewer: React.FC<ImageViewerProps> = ({\n images,\n visible = false,\n onClose,\n activeIndex = 0,\n onIndexChange,\n zoomSpeed = 0.1,\n disableKeyboardSupport = false,\n noNavbar = false,\n noToolbar = false,\n rotatable = true,\n scalable = true,\n changeable = true,\n noClose = false,\n minScale = 0.1,\n maxScale = 50,\n defaultScale = 1,\n className,\n downloadable = false,\n noImgDetails = false,\n noResetZoomAfterChange = false,\n drag = false,\n}) => {\n const [currentIndex, setCurrentIndex] = useState(activeIndex);\n const [ViewerComponent, setViewerComponent] = useState<any>(null);\n\n // Load Viewer dynamically on client-side only\n useEffect(() => {\n if (typeof window !== \"undefined\" && !ViewerComponent) {\n import(\"react-viewer\").then((module) => {\n setViewerComponent(() => module.default);\n });\n }\n }, [ViewerComponent]);\n\n useEffect(() => {\n setCurrentIndex(activeIndex);\n }, [activeIndex]);\n\n const handleClose = useCallback(() => {\n onClose?.();\n }, [onClose]);\n\n const handleIndexChange = useCallback(\n (_activeImage: any, index: number) => {\n setCurrentIndex(index);\n onIndexChange?.(index);\n },\n [onIndexChange]\n );\n\n // Handle download to save file locally\n const handleDownload = useCallback(() => {\n const currentImage = images[currentIndex];\n const downloadUrl = currentImage.downloadUrl || currentImage.src;\n\n // Create a temporary anchor element to trigger download\n const link = document.createElement(\"a\");\n link.href = downloadUrl;\n link.download = currentImage.alt || `image-${currentIndex + 1}`;\n\n // For cross-origin images, try to download via fetch\n fetch(downloadUrl)\n .then((response) => response.blob())\n .then((blob) => {\n const url = window.URL.createObjectURL(blob);\n link.href = url;\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n window.URL.revokeObjectURL(url);\n })\n .catch(() => {\n // Fallback: do nothing if fetch fails\n });\n }, [images, currentIndex]);\n\n // Transform images to include downloadUrl\n const viewerImages = images.map((img) => ({\n src: img.src,\n alt: img.alt || \"\",\n downloadUrl: img.downloadUrl || img.src,\n }));\n\n // Don't render until Viewer is loaded\n if (!ViewerComponent) {\n return null;\n }\n\n return (\n <ViewerComponent\n visible={visible}\n onClose={handleClose}\n onMaskClick={handleClose}\n images={viewerImages}\n activeIndex={currentIndex}\n onChange={handleIndexChange}\n zoomSpeed={zoomSpeed}\n disableKeyboardSupport={disableKeyboardSupport}\n noNavbar={noNavbar}\n noToolbar={noToolbar}\n rotatable={rotatable}\n scalable={scalable}\n changeable={changeable}\n noClose={noClose}\n minScale={minScale}\n maxScale={maxScale}\n defaultScale={defaultScale}\n className={cn(\"image-viewer-antd-style\", className)}\n downloadable={downloadable}\n noImgDetails={noImgDetails}\n noResetZoomAfterChange={noResetZoomAfterChange}\n showTotal={true}\n drag={drag}\n customToolbar={(toolbars: any) => {\n // Replace download button with a custom-rendered button to prevent viewer state change\n return toolbars.map((toolbar: any) => {\n if (toolbar.key === \"download\") {\n return {\n ...toolbar,\n actionType: undefined, // Remove default action\n onClick: undefined,\n render: (\n <button\n type=\"button\"\n className=\"react-viewer-icon react-viewer-download\"\n title=\"Download\"\n style={{\n background: \"none\",\n border: \"none\",\n cursor: \"pointer\",\n padding: 0,\n }}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n handleDownload();\n }}\n >\n {/* SVG icon for download (Ant Design style) */}\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M10 3v10m0 0l-4-4m4 4l4-4\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <rect\n x=\"4\"\n y=\"17\"\n width=\"12\"\n height=\"2\"\n rx=\"1\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n ),\n };\n }\n return toolbar;\n });\n }}\n />\n );\n};\n\nImageViewer.displayName = \"ImageViewer\";\n\n// ============================================================================\n// ImageViewerImage Component (Wrapper for single image with preview)\n// ============================================================================\n\nexport const ImageViewerImage: React.FC<ImageViewerImageProps> = ({\n src,\n alt = \"\",\n width,\n height,\n preview = true,\n previewSrc,\n fallback,\n placeholder,\n className,\n wrapperClassName,\n onPreviewClick,\n onError,\n ...props\n}) => {\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState(false);\n const [viewerVisible, setViewerVisible] = useState(false);\n\n const handleLoad = () => {\n setLoading(false);\n setError(false);\n };\n\n const handleError = (e: React.SyntheticEvent<HTMLImageElement, Event>) => {\n setLoading(false);\n setError(true);\n onError?.(e);\n };\n\n const handlePreview = () => {\n if (!preview) return;\n setViewerVisible(true);\n onPreviewClick?.();\n };\n\n const handleCloseViewer = () => {\n setViewerVisible(false);\n };\n\n const showPlaceholder = loading && placeholder;\n const showFallback = error && fallback;\n const showPreviewMask = preview && !loading && !error;\n\n return (\n <>\n <div\n className={cn(\n \"ds-image-viewer-root relative inline-block\",\n wrapperClassName\n )}\n >\n <div className=\"relative inline-block\">\n {showPlaceholder && (\n <div\n className=\"absolute inset-0 flex items-center justify-center bg-muted animate-pulse\"\n style={{ width, height }}\n >\n {placeholder === true ? (\n <div className=\"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin\" />\n ) : (\n placeholder\n )}\n </div>\n )}\n\n <img\n src={showFallback ? fallback : src}\n alt={alt}\n width={width}\n height={height}\n className={cn(\n \"ds-image-viewer-img max-w-full h-auto align-middle\",\n loading && \"opacity-0\",\n className\n )}\n onLoad={handleLoad}\n onError={handleError}\n {...props}\n />\n\n {showPreviewMask && (\n <div\n onClick={handlePreview}\n className={cn(\n \"ds-image-viewer-mask absolute inset-0 flex items-center justify-center opacity-0 hover:opacity-100 transition-opacity cursor-pointer\",\n \"bg-black/50 backdrop-blur-sm\"\n )}\n >\n <div className=\"text-white text-sm flex items-center gap-2\">\n <ZoomIn className=\"w-5 h-5\" />\n <span>Preview</span>\n </div>\n </div>\n )}\n </div>\n </div>\n\n {/* Viewer Modal */}\n <ImageViewer\n images={[{ src: previewSrc || src, alt }]}\n visible={viewerVisible}\n onClose={handleCloseViewer}\n rotatable\n scalable\n downloadable\n />\n </>\n );\n};\n\nImageViewerImage.displayName = \"ImageViewer.Image\";\n\n// ============================================================================\n// ImageViewerGroup Component\n// ============================================================================\n\ninterface ImageViewerGroupProps {\n children: React.ReactNode;\n images: ImageInfo[];\n preview?: boolean;\n}\n\nexport const ImageViewerGroup: React.FC<ImageViewerGroupProps> = ({\n children,\n images,\n preview = true,\n}) => {\n const [viewerVisible, setViewerVisible] = useState(false);\n const [currentIndex, setCurrentIndex] = useState(0);\n\n const handlePreview = useCallback((index: number) => {\n setCurrentIndex(index);\n setViewerVisible(true);\n }, []);\n\n const handleClose = useCallback(() => {\n setViewerVisible(false);\n }, []);\n\n const contextValue = React.useMemo(\n () => ({\n handlePreview,\n preview,\n }),\n [handlePreview, preview]\n );\n\n return (\n <>\n <ImageViewerGroupContext.Provider value={contextValue}>\n {children}\n </ImageViewerGroupContext.Provider>\n\n <ImageViewer\n images={images}\n visible={viewerVisible}\n onClose={handleClose}\n activeIndex={currentIndex}\n onIndexChange={setCurrentIndex}\n rotatable\n scalable\n downloadable\n />\n </>\n );\n};\n\nImageViewerGroup.displayName = \"ImageViewer.Group\";\n\n// Context for Group\nconst ImageViewerGroupContext = React.createContext<{\n handlePreview?: (_index: number) => void;\n preview?: boolean;\n} | null>(null);\n\n// Export with namespace\nconst ImageViewerNamespace = Object.assign(ImageViewer, {\n Image: ImageViewerImage,\n Group: ImageViewerGroup,\n});\n\nexport default ImageViewerNamespace;\n"],"names":["n","module","ImageViewer","images","visible","onClose","activeIndex","onIndexChange","zoomSpeed","disableKeyboardSupport","noNavbar","noToolbar","rotatable","scalable","changeable","noClose","minScale","maxScale","defaultScale","className","downloadable","noImgDetails","noResetZoomAfterChange","drag","currentIndex","setCurrentIndex","useState","ViewerComponent","setViewerComponent","useEffect","handleClose","useCallback","handleIndexChange","_activeImage","index","handleDownload","currentImage","downloadUrl","link","response","blob","url","viewerImages","img","jsx","cn","toolbars","toolbar","e","jsxs","ImageViewerImage","src","alt","width","height","preview","previewSrc","fallback","placeholder","wrapperClassName","onPreviewClick","onError","props","loading","setLoading","error","setError","viewerVisible","setViewerVisible","handleLoad","handleError","handlePreview","handleCloseViewer","showPlaceholder","showFallback","showPreviewMask","Fragment","ZoomIn","ImageViewerGroup","children","contextValue","React","ImageViewerGroupContext"],"mappings":"wiDAMI,OAAO,OAAW,KACpB,QAAA,QAAA,EAAA,KAAA,IAAA,QAAO,0BAAc,CAAA,EAAA,KAAAA,GAAAA,EAAA,KAAA,EAAE,KAAMC,GAAW,CAC7BA,EAAO,OAClB,CAAC,EAwDI,MAAMC,EAA0C,CAAC,CACtD,OAAAC,EACA,QAAAC,EAAU,GACV,QAAAC,EACA,YAAAC,EAAc,EACd,cAAAC,EACA,UAAAC,EAAY,GACZ,uBAAAC,EAAyB,GACzB,SAAAC,EAAW,GACX,UAAAC,EAAY,GACZ,UAAAC,EAAY,GACZ,SAAAC,EAAW,GACX,WAAAC,EAAa,GACb,QAAAC,EAAU,GACV,SAAAC,EAAW,GACX,SAAAC,EAAW,GACX,aAAAC,EAAe,EACf,UAAAC,EACA,aAAAC,EAAe,GACf,aAAAC,EAAe,GACf,uBAAAC,EAAyB,GACzB,KAAAC,EAAO,EACT,IAAM,CACJ,KAAM,CAACC,EAAcC,CAAe,EAAIC,EAAAA,SAASpB,CAAW,EACtD,CAACqB,EAAiBC,CAAkB,EAAIF,EAAAA,SAAc,IAAI,EAGhEG,EAAAA,UAAU,IAAM,CACV,OAAO,OAAW,KAAe,CAACF,GACpC,Q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AAA,CAAO,CAAA,CAAA,CACf,CAAA,CAAA,CACF,CAAA,CAEJ,CAAA,CAAA,EAIFA,EAAAA,IAAC1C,EAAA,CACC,OAAQ,CAAC,CAAE,IAAKsD,GAAcL,EAAK,IAAAC,EAAK,EACxC,QAASe,EACT,QAASK,EACT,UAAS,GACT,SAAQ,GACR,aAAY,EAAA,CAAA,CACd,EACF,CAEJ,EAEAtB,EAAiB,YAAc,oBAYxB,MAAM4B,EAAoD,CAAC,CAChE,SAAAC,EACA,OAAA5E,EACA,QAAAoD,EAAU,EACZ,IAAM,CACJ,KAAM,CAACY,EAAeC,CAAgB,EAAI1C,EAAAA,SAAS,EAAK,EAClD,CAACF,EAAcC,CAAe,EAAIC,EAAAA,SAAS,CAAC,EAE5C6C,EAAgBxC,cAAaG,GAAkB,CACnDT,EAAgBS,CAAK,EACrBkC,EAAiB,EAAI,CACvB,EAAG,CAAA,CAAE,EAECtC,EAAcC,EAAAA,YAAY,IAAM,CACpCqC,EAAiB,EAAK,CACxB,EAAG,CAAA,CAAE,EAECY,EAAeC,EAAM,QACzB,KAAO,CACL,cAAAV,EACA,QAAAhB,CAAA,GAEF,CAACgB,EAAehB,CAAO,CAAA,EAGzB,OACEN,EAAAA,KAAA2B,WAAA,CACE,SAAA,CAAAhC,EAAAA,IAACsC,EAAwB,SAAxB,CAAiC,MAAOF,EACtC,SAAAD,EACH,EAEAnC,EAAAA,IAAC1C,EAAA,CACC,OAAAC,EACA,QAASgE,EACT,QAASrC,EACT,YAAaN,EACb,cAAeC,EACf,UAAS,GACT,SAAQ,GACR,aAAY,EAAA,CAAA,CACd,EACF,CAEJ,EAEAqD,EAAiB,YAAc,oBAG/B,MAAMI,EAA0BD,EAAM,cAG5B,IAAI,EAGe,OAAO,OAAO/E,EAAa,CACtD,MAAOgD,EACP,MAAO4B,CACT,CAAC"}
1
+ {"version":3,"file":"ImageViewer.cjs","sources":["../../../../src/components/ImageViewer/ImageViewer.tsx"],"sourcesContent":["import React, { useState, useCallback, useEffect } from \"react\";\nimport { ZoomIn } from \"lucide-react\";\nimport { cn } from \"@dsui/ui/index\";\n\n// Dynamic import for react-viewer to avoid SSR issues\nlet Viewer: any = null;\nif (typeof window !== \"undefined\") {\n import(\"react-viewer\").then((module) => {\n Viewer = module.default;\n });\n}\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface ImageInfo {\n src: string;\n alt?: string;\n downloadUrl?: string;\n}\n\nexport interface ImageViewerProps {\n images: ImageInfo[];\n visible?: boolean;\n onClose?: () => void;\n activeIndex?: number;\n onIndexChange?: (_index: number) => void;\n zoomSpeed?: number;\n disableKeyboardSupport?: boolean;\n noNavbar?: boolean;\n noToolbar?: boolean;\n rotatable?: boolean;\n scalable?: boolean;\n changeable?: boolean;\n noClose?: boolean;\n minScale?: number;\n maxScale?: number;\n defaultScale?: number;\n className?: string;\n downloadable?: boolean;\n noImgDetails?: boolean;\n noResetZoomAfterChange?: boolean;\n drag?: boolean;\n}\n\nexport interface ImageViewerImageProps\n extends React.ImgHTMLAttributes<HTMLImageElement> {\n src: string;\n alt?: string;\n width?: string | number;\n height?: string | number;\n preview?: boolean;\n previewSrc?: string;\n fallback?: string;\n placeholder?: React.ReactNode | boolean;\n className?: string;\n wrapperClassName?: string;\n onPreviewClick?: () => void;\n}\n\n// ============================================================================\n// ImageViewer Component\n// ============================================================================\n\nexport const ImageViewer: React.FC<ImageViewerProps> = ({\n images,\n visible = false,\n onClose,\n activeIndex = 0,\n onIndexChange,\n zoomSpeed = 0.1,\n disableKeyboardSupport = false,\n noNavbar = false,\n noToolbar = false,\n rotatable = true,\n scalable = true,\n changeable = true,\n noClose = false,\n minScale = 0.1,\n maxScale = 50,\n defaultScale = 1,\n className,\n downloadable = false,\n noImgDetails = false,\n noResetZoomAfterChange = false,\n drag = false,\n}) => {\n const [currentIndex, setCurrentIndex] = useState(activeIndex);\n const [ViewerComponent, setViewerComponent] = useState<any>(null);\n\n // Load Viewer dynamically on client-side only\n useEffect(() => {\n if (typeof window !== \"undefined\" && !ViewerComponent) {\n import(\"react-viewer\").then((module) => {\n setViewerComponent(() => module.default);\n });\n }\n }, [ViewerComponent]);\n\n useEffect(() => {\n setCurrentIndex(activeIndex);\n }, [activeIndex]);\n\n const handleClose = useCallback(() => {\n onClose?.();\n }, [onClose]);\n\n const handleIndexChange = useCallback(\n (_activeImage: any, index: number) => {\n setCurrentIndex(index);\n onIndexChange?.(index);\n },\n [onIndexChange]\n );\n\n // Handle download to save file locally\n const handleDownload = useCallback(() => {\n const currentImage = images[currentIndex];\n const downloadUrl = currentImage.downloadUrl || currentImage.src;\n\n // Create a temporary anchor element to trigger download\n const link = document.createElement(\"a\");\n link.href = downloadUrl;\n link.download = currentImage.alt || `image-${currentIndex + 1}`;\n\n // For cross-origin images, try to download via fetch\n fetch(downloadUrl)\n .then((response) => response.blob())\n .then((blob) => {\n const url = window.URL.createObjectURL(blob);\n link.href = url;\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n window.URL.revokeObjectURL(url);\n })\n .catch(() => {\n // Fallback: do nothing if fetch fails\n });\n }, [images, currentIndex]);\n\n // Transform images to include downloadUrl\n const viewerImages = images.map((img) => ({\n src: img.src,\n alt: img.alt || \"\",\n downloadUrl: img.downloadUrl || img.src,\n }));\n\n // Don't render until Viewer is loaded\n if (!ViewerComponent) {\n return null;\n }\n\n return (\n <ViewerComponent\n visible={visible}\n onClose={handleClose}\n onMaskClick={handleClose}\n images={viewerImages}\n activeIndex={currentIndex}\n onChange={handleIndexChange}\n zoomSpeed={zoomSpeed}\n disableKeyboardSupport={disableKeyboardSupport}\n noNavbar={noNavbar}\n noToolbar={noToolbar}\n rotatable={rotatable}\n scalable={scalable}\n changeable={changeable}\n noClose={noClose}\n minScale={minScale}\n maxScale={maxScale}\n defaultScale={defaultScale}\n className={cn(\"ds:image-viewer-antd-style\", className)}\n downloadable={downloadable}\n noImgDetails={noImgDetails}\n noResetZoomAfterChange={noResetZoomAfterChange}\n showTotal={true}\n drag={drag}\n customToolbar={(toolbars: any) => {\n // Replace download button with a custom-rendered button to prevent viewer state change\n return toolbars.map((toolbar: any) => {\n if (toolbar.key === \"download\") {\n return {\n ...toolbar,\n actionType: undefined, // Remove default action\n onClick: undefined,\n render: (\n <button\n type=\"button\"\n className=\"ds:react-viewer-icon ds:react-viewer-download\"\n title=\"Download\"\n style={{\n background: \"none\",\n border: \"none\",\n cursor: \"pointer\",\n padding: 0,\n }}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n handleDownload();\n }}\n >\n {/* SVG icon for download (Ant Design style) */}\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M10 3v10m0 0l-4-4m4 4l4-4\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <rect\n x=\"4\"\n y=\"17\"\n width=\"12\"\n height=\"2\"\n rx=\"1\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n ),\n };\n }\n return toolbar;\n });\n }}\n />\n );\n};\n\nImageViewer.displayName = \"ImageViewer\";\n\n// ============================================================================\n// ImageViewerImage Component (Wrapper for single image with preview)\n// ============================================================================\n\nexport const ImageViewerImage: React.FC<ImageViewerImageProps> = ({\n src,\n alt = \"\",\n width,\n height,\n preview = true,\n previewSrc,\n fallback,\n placeholder,\n className,\n wrapperClassName,\n onPreviewClick,\n onError,\n ...props\n}) => {\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState(false);\n const [viewerVisible, setViewerVisible] = useState(false);\n\n const handleLoad = () => {\n setLoading(false);\n setError(false);\n };\n\n const handleError = (e: React.SyntheticEvent<HTMLImageElement, Event>) => {\n setLoading(false);\n setError(true);\n onError?.(e);\n };\n\n const handlePreview = () => {\n if (!preview) return;\n setViewerVisible(true);\n onPreviewClick?.();\n };\n\n const handleCloseViewer = () => {\n setViewerVisible(false);\n };\n\n const showPlaceholder = loading && placeholder;\n const showFallback = error && fallback;\n const showPreviewMask = preview && !loading && !error;\n\n return (\n <>\n <div\n className={cn(\n \"ds:ds-image-viewer-root ds:relative ds:inline-block\",\n wrapperClassName\n )}\n >\n <div className=\"ds:relative ds:inline-block\">\n {showPlaceholder && (\n <div\n className=\"ds:absolute ds:inset-0 ds:flex ds:items-center ds:justify-center ds:bg-muted ds:animate-pulse\"\n style={{ width, height }}\n >\n {placeholder === true ? (\n <div className=\"ds:w-8 ds:h-8 ds:border-2 ds:border-primary ds:border-t-transparent ds:rounded-full ds:animate-spin\" />\n ) : (\n placeholder\n )}\n </div>\n )}\n\n <img\n src={showFallback ? fallback : src}\n alt={alt}\n width={width}\n height={height}\n className={cn(\n \"ds:ds-image-viewer-img ds:max-w-full ds:h-auto ds:align-middle\",\n loading && \"ds:opacity-0\",\n className\n )}\n onLoad={handleLoad}\n onError={handleError}\n {...props}\n />\n\n {showPreviewMask && (\n <div\n onClick={handlePreview}\n className={cn(\n \"ds:ds-image-viewer-mask ds:absolute ds:inset-0 ds:flex ds:items-center ds:justify-center ds:opacity-0 ds:hover:opacity-100 ds:transition-opacity ds:cursor-pointer\",\n \"ds:bg-black/50 ds:backdrop-blur-sm\"\n )}\n >\n <div className=\"ds:text-white ds:text-sm ds:flex ds:items-center ds:gap-2\">\n <ZoomIn className=\"ds:w-5 ds:h-5\" />\n <span>Preview</span>\n </div>\n </div>\n )}\n </div>\n </div>\n\n {/* Viewer Modal */}\n <ImageViewer\n images={[{ src: previewSrc || src, alt }]}\n visible={viewerVisible}\n onClose={handleCloseViewer}\n rotatable\n scalable\n downloadable\n />\n </>\n );\n};\n\nImageViewerImage.displayName = \"ImageViewer.Image\";\n\n// ============================================================================\n// ImageViewerGroup Component\n// ============================================================================\n\ninterface ImageViewerGroupProps {\n children: React.ReactNode;\n images: ImageInfo[];\n preview?: boolean;\n}\n\nexport const ImageViewerGroup: React.FC<ImageViewerGroupProps> = ({\n children,\n images,\n preview = true,\n}) => {\n const [viewerVisible, setViewerVisible] = useState(false);\n const [currentIndex, setCurrentIndex] = useState(0);\n\n const handlePreview = useCallback((index: number) => {\n setCurrentIndex(index);\n setViewerVisible(true);\n }, []);\n\n const handleClose = useCallback(() => {\n setViewerVisible(false);\n }, []);\n\n const contextValue = React.useMemo(\n () => ({\n handlePreview,\n preview,\n }),\n [handlePreview, preview]\n );\n\n return (\n <>\n <ImageViewerGroupContext.Provider value={contextValue}>\n {children}\n </ImageViewerGroupContext.Provider>\n\n <ImageViewer\n images={images}\n visible={viewerVisible}\n onClose={handleClose}\n activeIndex={currentIndex}\n onIndexChange={setCurrentIndex}\n rotatable\n scalable\n downloadable\n />\n </>\n );\n};\n\nImageViewerGroup.displayName = \"ImageViewer.Group\";\n\n// Context for Group\nconst ImageViewerGroupContext = React.createContext<{\n handlePreview?: (_index: number) => void;\n preview?: boolean;\n} | null>(null);\n\n// Export with namespace\nconst ImageViewerNamespace = Object.assign(ImageViewer, {\n Image: ImageViewerImage,\n Group: ImageViewerGroup,\n});\n\nexport default ImageViewerNamespace;\n"],"names":["n","module","ImageViewer","images","visible","onClose","activeIndex","onIndexChange","zoomSpeed","disableKeyboardSupport","noNavbar","noToolbar","rotatable","scalable","changeable","noClose","minScale","maxScale","defaultScale","className","downloadable","noImgDetails","noResetZoomAfterChange","drag","currentIndex","setCurrentIndex","useState","ViewerComponent","setViewerComponent","useEffect","handleClose","useCallback","handleIndexChange","_activeImage","index","handleDownload","currentImage","downloadUrl","link","response","blob","url","viewerImages","img","jsx","cn","toolbars","toolbar","e","jsxs","ImageViewerImage","src","alt","width","height","preview","previewSrc","fallback","placeholder","wrapperClassName","onPreviewClick","onError","props","loading","setLoading","error","setError","viewerVisible","setViewerVisible","handleLoad","handleError","handlePreview","handleCloseViewer","showPlaceholder","showFallback","showPreviewMask","Fragment","ZoomIn","ImageViewerGroup","children","contextValue","React","ImageViewerGroupContext"],"mappings":"wiDAMI,OAAO,OAAW,KACpB,QAAA,QAAA,EAAA,KAAA,IA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AAG,CAAA,CAAE,EAECtC,EAAcC,EAAAA,YAAY,IAAM,CACpCqC,EAAiB,EAAK,CACxB,EAAG,CAAA,CAAE,EAECY,EAAeC,EAAM,QACzB,KAAO,CACL,cAAAV,EACA,QAAAhB,CAAA,GAEF,CAACgB,EAAehB,CAAO,CAAA,EAGzB,OACEN,EAAAA,KAAA2B,WAAA,CACE,SAAA,CAAAhC,EAAAA,IAACsC,EAAwB,SAAxB,CAAiC,MAAOF,EACtC,SAAAD,EACH,EAEAnC,EAAAA,IAAC1C,EAAA,CACC,OAAAC,EACA,QAASgE,EACT,QAASrC,EACT,YAAaN,EACb,cAAeC,EACf,UAAS,GACT,SAAQ,GACR,aAAY,EAAA,CAAA,CACd,EACF,CAEJ,EAEAqD,EAAiB,YAAc,oBAG/B,MAAMI,EAA0BD,EAAM,cAG5B,IAAI,EAGe,OAAO,OAAO/E,EAAa,CACtD,MAAOgD,EACP,MAAO4B,CACT,CAAC"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),a=require("react"),Q=require("../../packages/ui/src/components/input.cjs"),l=require("../../packages/ui/src/lib/utils.cjs"),W=require("../FloatLabel.cjs"),m=require("lucide-react"),Y=require("use-mask-input"),Z=require("../Tooltip/Tooltip.cjs"),F=require("../../packages/ui/src/components/label.cjs"),D=a.forwardRef(({className:_,label:v,helperText:p,state:N,size:i,isFloatLabel:o,type:r,mask:f,maskOptions:E,maxLength:x,showCharCount:M,infoTooltip:j,clearable:b,onClear:P,prefixIcon:u,suffixIcon:c,placeholder:B=" ",required:w,...e},H)=>{const[g,R]=a.useState(()=>typeof e.value=="string"?e.value.length:typeof e.defaultValue=="string"?e.defaultValue.length:0),O=n=>{R(n.target.value.length),e.onChange&&e.onChange(n)},T=()=>{if(s.current){s.current.value="",R(0);const n={target:s.current,currentTarget:s.current};e.onChange?.(n),P&&P()}},C=a.useId(),s=a.useRef(null),U=a.useCallback(n=>{if(s&&(s.current=n),f&&n){const d=Y.withMask(f,E);typeof d=="function"&&d(n)}},[f,E]);a.useImperativeHandle(H,()=>s.current);const[V,X]=a.useState(!1),A={default:"text-muted-foreground",success:"text-success",warning:"text-warning",error:"text-error"},y=o?i==="xl"||i==="lg"?i:"xl":i||"normal",k=(()=>{const n={xs:{prefix:"pl-8",suffix:"pr-8"},sm:{prefix:"pl-9",suffix:"pr-9"},normal:{prefix:"pl-10",suffix:"pr-10"},lg:{prefix:"pl-11",suffix:"pr-11"},xl:{prefix:"pl-12",suffix:"pr-12"}};return n[y]||n.normal})(),q={xs:"size-3",sm:"size-3.5",normal:"size-4",lg:"size-4",xl:"size-4"}[y]||"size-4",G=()=>{const n=r==="number"||r==="password"||r==="datetime"||b&&(g>0||e?.value);return n&&c?r==="password"&&b&&(g>0||e?.value)?"pr-20":"pr-16":n?r==="password"&&b&&(g>0||e?.value)?"pr-16":"pr-10":c?k.suffix:""},I=(()=>{const n={xs:{left:"left-2.5",right:"right-2.5"},sm:{left:"left-3",right:"right-3"},normal:{left:"left-3",right:"right-3"},lg:{left:"left-3.5",right:"right-3.5"},xl:{left:"left-4",right:"right-4"}};return n[y]||n.normal})(),J=()=>{if(s.current){const n=Number(e.step||1),d=e.max?Number(e.max):1/0,z=Number(s.current.value||0),S=Math.min(z+n,d);s.current.value=String(S);const h=new Event("input",{bubbles:!0});s.current.dispatchEvent(h),e.onChange?.(h)}},K=()=>{if(s.current){const n=Number(e.step||1),d=e.min?Number(e.min):-1/0,z=Number(s.current.value||0),S=Math.max(z-n,d);s.current.value=String(S);const h=new Event("input",{bubbles:!0});s.current.dispatchEvent(h),e.onChange?.(h)}};return t.jsx("div",{className:_,children:t.jsxs("div",{className:l.cn("flex flex-col gap-1.5 relative flex-auto",{"floating-label relative":o}),children:[!o&&v&&t.jsxs(F.Label,{htmlFor:C,className:"flex gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:[t.jsxs("span",{children:[v,w&&t.jsx("span",{className:"text-error ml-0.5",children:"*"})]}),j&&t.jsx(Z.Tooltip,{content:j,children:t.jsx(m.Info,{className:"size-3.5 min-w-3.5"})})]}),t.jsxs("div",{className:"relative",children:[u&&t.jsx("div",{className:l.cn("absolute top-1/2 -translate-y-1/2 text-muted-foreground leading-0",I.left),children:a.isValidElement(u)?a.cloneElement(u,{className:l.cn(q,u.props?.className)}):u}),t.jsx(Q.Input,{ref:U,id:C,className:l.cn("peer",{"pt-5 pb-1":o&&i!=="lg","[&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none [-moz-appearance:textfield] pr-8":r==="number"},u&&k.prefix,f&&"placeholder:text-slate-400 placeholder:opacity-100",G()),state:N,size:o?i==="xl"||i==="lg"?i:"xl":i,type:r==="password"?V?"text":"password":r,placeholder:B,maxLength:x,onChange:O,required:w,...e}),o&&t.jsx(W.FloatingLabel,{htmlFor:C,size:i,infoTooltip:j,required:w,children:v}),r==="number"&&t.jsxs("div",{className:"absolute right-1 top-0 h-full flex flex-col gap-0.5",children:[t.jsx("button",{type:"button",onClick:J,disabled:e.disabled,className:l.cn("h-1/2 w-6 flex items-center justify-center rounded cursor-pointer hover:scale-150 transition-transform","disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent"),tabIndex:-1,children:t.jsx(m.ChevronUp,{className:"size-3"})}),t.jsx("button",{type:"button",onClick:K,disabled:e.disabled,className:l.cn("h-1/2 w-6 flex items-center justify-center rounded cursor-pointer hover:scale-150 transition-transform","disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent"),tabIndex:-1,children:t.jsx(m.ChevronDown,{className:"size-3"})})]}),b&&(g>0||e?.value)&&!e.disabled&&r!=="number"&&t.jsx("button",{type:"button",tabIndex:-1,className:l.cn("absolute top-1/2 -translate-y-1/2 p-1 rounded hover:bg-accent transition-colors cursor-pointer",r==="password"?c?"right-14":"right-10":c?"right-10":"right-2"),onClick:T,disabled:e.disabled,children:t.jsx(m.X,{className:"size-4"})}),r==="password"&&t.jsx("button",{type:"button",tabIndex:-1,className:l.cn("absolute top-1/2 -translate-y-1/2 p-1 rounded hover:bg-accent transition-colors",c?"right-10":"right-2"),onClick:()=>X(n=>!n),disabled:e.disabled,children:V?t.jsx(m.EyeOff,{className:"size-4"}):t.jsx(m.Eye,{className:"size-4"})}),c&&t.jsx("div",{className:l.cn("absolute top-1/2 -translate-y-1/2 text-muted-foreground leading-0",I.right),children:a.isValidElement(c)?a.cloneElement(c,{className:l.cn(q,c.props?.className)}):c})]}),(p||M&&typeof x=="number")&&t.jsxs("div",{className:"flex items-center justify-between text-xs gap-2",children:[p&&t.jsx("p",{className:l.cn("text-xs",N?A?.[N]:""),children:p}),M&&typeof x=="number"&&t.jsxs("span",{className:"ml-auto text-muted-foreground",children:[g," / ",x]})]})]})})});D.displayName="Input";exports.default=D;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),r=require("react"),Q=require("../../packages/ui/src/components/input.cjs"),a=require("../../packages/ui/src/lib/utils.cjs"),W=require("../FloatLabel.cjs"),m=require("lucide-react"),Y=require("use-mask-input"),Z=require("../Tooltip/Tooltip.cjs"),F=require("../../packages/ui/src/components/label.cjs"),D=r.forwardRef(({className:_,label:v,helperText:p,state:N,size:l,isFloatLabel:c,type:d,mask:f,maskOptions:E,maxLength:x,showCharCount:M,infoTooltip:j,clearable:b,onClear:P,prefixIcon:o,suffixIcon:i,placeholder:B=" ",required:w,...e},H)=>{const[g,R]=r.useState(()=>typeof e.value=="string"?e.value.length:typeof e.defaultValue=="string"?e.defaultValue.length:0),O=t=>{R(t.target.value.length),e.onChange&&e.onChange(t)},T=()=>{if(n.current){n.current.value="",R(0);const t={target:n.current,currentTarget:n.current};e.onChange?.(t),P&&P()}},C=r.useId(),n=r.useRef(null),U=r.useCallback(t=>{if(n&&(n.current=t),f&&t){const u=Y.withMask(f,E);typeof u=="function"&&u(t)}},[f,E]);r.useImperativeHandle(H,()=>n.current);const[V,X]=r.useState(!1),A={default:"ds:text-muted-foreground",success:"ds:text-success",warning:"ds:text-warning",error:"ds:text-error"},y=c?l==="xl"||l==="lg"?l:"xl":l||"normal",k=(()=>{const t={xs:{prefix:"pl-8",suffix:"pr-8"},sm:{prefix:"pl-9",suffix:"pr-9"},normal:{prefix:"pl-10",suffix:"pr-10"},lg:{prefix:"pl-11",suffix:"pr-11"},xl:{prefix:"pl-12",suffix:"pr-12"}};return t[y]||t.normal})(),q={xs:"size-3",sm:"size-3.5",normal:"size-4",lg:"size-4",xl:"size-4"}[y]||"size-4",G=()=>{const t=d==="number"||d==="password"||d==="datetime"||b&&(g>0||e?.value);return t&&i?d==="password"&&b&&(g>0||e?.value)?"pr-20":"pr-16":t?d==="password"&&b&&(g>0||e?.value)?"pr-16":"pr-10":i?k.suffix:""},I=(()=>{const t={xs:{left:"left-2.5",right:"right-2.5"},sm:{left:"left-3",right:"right-3"},normal:{left:"left-3",right:"right-3"},lg:{left:"left-3.5",right:"right-3.5"},xl:{left:"left-4",right:"right-4"}};return t[y]||t.normal})(),J=()=>{if(n.current){const t=Number(e.step||1),u=e.max?Number(e.max):1/0,z=Number(n.current.value||0),S=Math.min(z+t,u);n.current.value=String(S);const h=new Event("input",{bubbles:!0});n.current.dispatchEvent(h),e.onChange?.(h)}},K=()=>{if(n.current){const t=Number(e.step||1),u=e.min?Number(e.min):-1/0,z=Number(n.current.value||0),S=Math.max(z-t,u);n.current.value=String(S);const h=new Event("input",{bubbles:!0});n.current.dispatchEvent(h),e.onChange?.(h)}};return s.jsx("div",{className:_,children:s.jsxs("div",{className:a.cn("ds:flex ds:flex-col ds:gap-1.5 ds:relative ds:flex-auto",{"ds:floating-label ds:relative":c}),children:[!c&&v&&s.jsxs(F.Label,{htmlFor:C,className:"ds:flex ds:gap-2 ds:text-sm ds:font-medium ds:leading-none ds:peer-disabled:cursor-not-allowed ds:peer-disabled:opacity-70",children:[s.jsxs("span",{children:[v,w&&s.jsx("span",{className:"ds:text-error ds:ml-0.5",children:"*"})]}),j&&s.jsx(Z.Tooltip,{content:j,children:s.jsx(m.Info,{className:"ds:size-3.5 ds:min-w-3.5"})})]}),s.jsxs("div",{className:"ds:relative",children:[o&&s.jsx("div",{className:a.cn("ds:absolute ds:top-1/2 ds:-translate-y-1/2 ds:text-muted-foreground ds:leading-0",I.left),children:r.isValidElement(o)?r.cloneElement(o,{className:a.cn(q,o.props?.className)}):o}),s.jsx(Q.Input,{ref:U,id:C,className:a.cn("ds:peer",{"ds:pt-5 ds:pb-1":c&&l!=="lg","ds:[&::-webkit-outer-spin-button]:appearance-none ds:[&::-webkit-inner-spin-button]:appearance-none ds:[-moz-appearance:textfield] ds:pr-8":d==="number"},o&&k.prefix,f&&"ds:placeholder:text-slate-400 ds:placeholder:opacity-100",G()),state:N,size:c?l==="xl"||l==="lg"?l:"xl":l,type:d==="password"?V?"text":"password":d,placeholder:B,maxLength:x,onChange:O,required:w,...e}),c&&s.jsx(W.FloatingLabel,{htmlFor:C,size:l,infoTooltip:j,required:w,children:v}),d==="number"&&s.jsxs("div",{className:"ds:absolute ds:right-1 ds:top-0 ds:h-full ds:flex ds:flex-col ds:gap-0.5",children:[s.jsx("button",{type:"button",onClick:J,disabled:e.disabled,className:a.cn("ds:h-1/2 ds:w-6 ds:flex ds:items-center ds:justify-center ds:rounded ds:cursor-pointer ds:hover:scale-150 ds:transition-transform","ds:disabled:opacity-50 ds:disabled:cursor-not-allowed ds:disabled:hover:bg-transparent"),tabIndex:-1,children:s.jsx(m.ChevronUp,{className:"ds:size-3"})}),s.jsx("button",{type:"button",onClick:K,disabled:e.disabled,className:a.cn("ds:h-1/2 ds:w-6 ds:flex ds:items-center ds:justify-center ds:rounded ds:cursor-pointer ds:hover:scale-150 ds:transition-transform","ds:disabled:opacity-50 ds:disabled:cursor-not-allowed ds:disabled:hover:bg-transparent"),tabIndex:-1,children:s.jsx(m.ChevronDown,{className:"ds:size-3"})})]}),b&&(g>0||e?.value)&&!e.disabled&&d!=="number"&&s.jsx("button",{type:"button",tabIndex:-1,className:a.cn("ds:absolute ds:top-1/2 ds:-translate-y-1/2 ds:p-1 ds:rounded ds:hover:bg-accent ds:transition-colors ds:cursor-pointer",d==="password"?i?"ds:right-14":"ds:right-10":i?"ds:right-10":"ds:right-2"),onClick:T,disabled:e.disabled,children:s.jsx(m.X,{className:"ds:size-4"})}),d==="password"&&s.jsx("button",{type:"button",tabIndex:-1,className:a.cn("ds:absolute ds:top-1/2 ds:-translate-y-1/2 ds:p-1 ds:rounded ds:hover:bg-accent ds:transition-colors",i?"ds:right-10":"ds:right-2"),onClick:()=>X(t=>!t),disabled:e.disabled,children:V?s.jsx(m.EyeOff,{className:"ds:size-4"}):s.jsx(m.Eye,{className:"ds:size-4"})}),i&&s.jsx("div",{className:a.cn("ds:absolute ds:top-1/2 ds:-translate-y-1/2 ds:text-muted-foreground ds:leading-0",I.right),children:r.isValidElement(i)?r.cloneElement(i,{className:a.cn(q,i.props?.className)}):i})]}),(p||M&&typeof x=="number")&&s.jsxs("div",{className:"ds:flex ds:items-center ds:justify-between ds:text-xs ds:gap-2",children:[p&&s.jsx("p",{className:a.cn("ds:text-xs",N?A?.[N]:""),children:p}),M&&typeof x=="number"&&s.jsxs("span",{className:"ds:ml-auto ds:text-muted-foreground",children:[g," / ",x]})]})]})})});D.displayName="Input";exports.default=D;
2
2
  //# sourceMappingURL=Input.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Input.cjs","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import React, { type ChangeEvent } from \"react\";\nimport {\n Input as SInput,\n type InputProps as SInputProps,\n} from \"@dsui/ui/components/input\";\nimport { cn } from \"@dsui/ui/lib/utils\";\nimport { FloatingLabel } from \"@/components/FloatLabel\";\nimport { Eye, EyeOff, ChevronDown, ChevronUp, Info, X } from \"lucide-react\";\nimport { withMask, type Options } from \"use-mask-input\";\nimport { Tooltip } from \"../Tooltip/Tooltip\";\nimport { Label } from \"../Label\";\n\n// Re-export base input props to avoid external dependency issues\nexport type BaseInputProps = Omit<React.ComponentProps<\"input\">, \"size\"> & {\n size?: \"normal\" | \"sm\" | \"xs\" | \"lg\" | \"xl\";\n state?: \"default\" | \"success\" | \"error\" | \"warning\";\n};\n\nexport type InputProps = BaseInputProps & {\n label?: string;\n helperText?: React.ReactNode;\n isFloatLabel?: boolean;\n mask?: string;\n maskOptions?: {\n placeholder?: string;\n inputFormat?: string;\n outputFormat?: string;\n showMaskOnHover?: boolean;\n showMaskOnFocus?: boolean;\n separate?: boolean;\n } & Options;\n maxLength?: number;\n showCharCount?: boolean;\n infoTooltip?: React.ReactNode;\n clearable?: boolean;\n onClear?: () => void;\n prefixIcon?: React.ReactNode;\n suffixIcon?: React.ReactNode;\n required?: boolean;\n};\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(\n (\n {\n className,\n label,\n helperText,\n state,\n size,\n isFloatLabel,\n type,\n mask,\n maskOptions,\n maxLength,\n showCharCount,\n infoTooltip,\n clearable,\n onClear,\n prefixIcon,\n suffixIcon,\n placeholder = \" \",\n required,\n ...props\n },\n ref\n ) => {\n // Character count state\n const [charCount, setCharCount] = React.useState(() => {\n if (typeof props.value === \"string\") return props.value.length;\n if (typeof props.defaultValue === \"string\")\n return props.defaultValue.length;\n return 0;\n });\n\n const handleInput = (e: React.ChangeEvent<HTMLInputElement>) => {\n setCharCount(e.target.value.length);\n if (props.onChange) props.onChange(e);\n };\n\n const handleClear = () => {\n if (innerRef.current) {\n innerRef.current.value = \"\";\n setCharCount(0);\n const event = {\n target: innerRef.current,\n currentTarget: innerRef.current,\n } as React.ChangeEvent<HTMLInputElement>;\n props.onChange?.(event);\n if (onClear) onClear();\n }\n };\n\n const inputId = React.useId();\n const innerRef = React.useRef<HTMLInputElement>(null);\n\n // Combine refs\n const combinedRef = React.useCallback(\n (element: HTMLInputElement | null) => {\n // Set innerRef\n if (innerRef) {\n (\n innerRef as React.MutableRefObject<HTMLInputElement | null>\n ).current = element;\n }\n\n // Apply mask if provided\n if (mask && element) {\n const maskRefCallback = withMask(mask, maskOptions);\n if (typeof maskRefCallback === \"function\") {\n maskRefCallback(element);\n }\n }\n },\n [mask, maskOptions]\n );\n\n // Expose ref to parent\n React.useImperativeHandle(ref, () => innerRef.current!);\n\n const [showPassword, setShowPassword] = React.useState(false);\n\n // State\n const helperTextStyles = {\n default: \"text-muted-foreground\",\n success: \"text-success\",\n warning: \"text-warning\",\n error: \"text-error\",\n };\n\n // Calculate current size\n const currentSize = isFloatLabel\n ? size === \"xl\" || size === \"lg\"\n ? size\n : \"xl\"\n : size || \"normal\";\n\n // Calculate padding based on size and icons\n const getPadding = () => {\n const sizeMap = {\n xs: { prefix: \"pl-8\", suffix: \"pr-8\" },\n sm: { prefix: \"pl-9\", suffix: \"pr-9\" },\n normal: { prefix: \"pl-10\", suffix: \"pr-10\" },\n lg: { prefix: \"pl-11\", suffix: \"pr-11\" },\n xl: { prefix: \"pl-12\", suffix: \"pr-12\" },\n };\n\n return sizeMap[currentSize as keyof typeof sizeMap] || sizeMap.normal;\n };\n\n const padding = getPadding();\n\n // Get icon size class based on current size\n const getIconSizeClass = () => {\n const sizeMap = {\n xs: \"size-3\",\n sm: \"size-3.5\",\n normal: \"size-4\",\n lg: \"size-4\",\n xl: \"size-4\",\n };\n return sizeMap[currentSize as keyof typeof sizeMap] || \"size-4\";\n };\n\n const iconSizeClass = getIconSizeClass();\n\n // Calculate right padding considering built-in icons\n const getRightPadding = () => {\n const hasBuiltInSuffix =\n type === \"number\" ||\n type === \"password\" ||\n type === \"datetime\" ||\n (clearable && (charCount > 0 || props?.value));\n\n if (hasBuiltInSuffix && suffixIcon) {\n return type === \"password\" &&\n clearable &&\n (charCount > 0 || props?.value)\n ? \"pr-20\" // password + clear + custom icon\n : \"pr-16\"; // one built-in + custom icon\n }\n\n if (hasBuiltInSuffix) {\n return type === \"password\" &&\n clearable &&\n (charCount > 0 || props?.value)\n ? \"pr-16\" // password + clear\n : \"pr-10\"; // single built-in icon\n }\n\n if (suffixIcon) {\n return padding.suffix;\n }\n\n return \"\";\n };\n\n // Icon position calculations\n const getIconPosition = () => {\n const sizeMap = {\n xs: { left: \"left-2.5\", right: \"right-2.5\" },\n sm: { left: \"left-3\", right: \"right-3\" },\n normal: { left: \"left-3\", right: \"right-3\" },\n lg: { left: \"left-3.5\", right: \"right-3.5\" },\n xl: { left: \"left-4\", right: \"right-4\" },\n };\n\n return sizeMap[currentSize as keyof typeof sizeMap] || sizeMap.normal;\n };\n\n const iconPosition = getIconPosition();\n\n /* Spinner Button Handlers */\n const handleIncrement = () => {\n if (innerRef.current) {\n const step = Number(props.step || 1);\n const max = props.max ? Number(props.max) : Infinity;\n const currentValue = Number(innerRef.current.value || 0);\n const newValue = Math.min(currentValue + step, max);\n\n innerRef.current.value = String(newValue);\n const event = new Event(\"input\", { bubbles: true });\n innerRef.current.dispatchEvent(event);\n props.onChange?.(event as unknown as ChangeEvent<HTMLInputElement>);\n }\n };\n\n const handleDecrement = () => {\n if (innerRef.current) {\n const step = Number(props.step || 1);\n const min = props.min ? Number(props.min) : -Infinity;\n const currentValue = Number(innerRef.current.value || 0);\n const newValue = Math.max(currentValue - step, min);\n\n innerRef.current.value = String(newValue);\n const event = new Event(\"input\", { bubbles: true });\n innerRef.current.dispatchEvent(event);\n props.onChange?.(event as unknown as ChangeEvent<HTMLInputElement>);\n }\n };\n /* End Spinner Button Handlers */\n\n return (\n <div className={className}>\n <div\n className={cn(\"flex flex-col gap-1.5 relative flex-auto\", {\n \"floating-label relative\": isFloatLabel,\n })}\n >\n {!isFloatLabel && label && (\n <Label\n htmlFor={inputId}\n className=\"flex gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n >\n <span>\n {label}\n {required && <span className=\"text-error ml-0.5\">*</span>}\n </span>\n {infoTooltip && (\n <Tooltip content={infoTooltip}>\n <Info className=\"size-3.5 min-w-3.5\" />\n </Tooltip>\n )}\n </Label>\n )}\n\n <div className=\"relative\">\n {/* Prefix Icon */}\n {prefixIcon && (\n <div\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 text-muted-foreground leading-0\",\n iconPosition.left\n )}\n >\n {React.isValidElement(prefixIcon)\n ? React.cloneElement(prefixIcon, {\n className: cn(\n iconSizeClass,\n (prefixIcon.props as any)?.className\n ),\n } as Partial<unknown>)\n : prefixIcon}\n </div>\n )}\n\n <SInput\n ref={combinedRef}\n id={inputId}\n className={cn(\n \"peer\",\n {\n \"pt-5 pb-1\": isFloatLabel && size !== \"lg\",\n \"[&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none [-moz-appearance:textfield] pr-8\":\n type === \"number\",\n // \"[-webkit-text-fill-color:var(--foreground)]\": mask,\n },\n prefixIcon && padding.prefix,\n mask && \"placeholder:text-slate-400 placeholder:opacity-100\",\n getRightPadding()\n // className,\n )}\n state={state}\n size={\n isFloatLabel\n ? size === \"xl\" || size === \"lg\"\n ? size\n : \"xl\"\n : size\n }\n type={\n type === \"password\"\n ? showPassword\n ? \"text\"\n : \"password\"\n : type\n }\n placeholder={placeholder}\n maxLength={maxLength}\n onChange={handleInput}\n required={required}\n {...props}\n />\n {isFloatLabel && (\n <FloatingLabel\n htmlFor={inputId}\n size={size}\n infoTooltip={infoTooltip}\n required={required}\n >\n {label}\n </FloatingLabel>\n )}\n\n {/* Spinner Buttons */}\n {type === \"number\" && (\n <div className=\"absolute right-1 top-0 h-full flex flex-col gap-0.5\">\n <button\n type=\"button\"\n onClick={handleIncrement}\n disabled={props.disabled}\n className={cn(\n \"h-1/2 w-6 flex items-center justify-center rounded cursor-pointer hover:scale-150 transition-transform\",\n \"disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent\"\n )}\n tabIndex={-1}\n >\n <ChevronUp className=\"size-3\" />\n </button>\n <button\n type=\"button\"\n onClick={handleDecrement}\n disabled={props.disabled}\n className={cn(\n \"h-1/2 w-6 flex items-center justify-center rounded cursor-pointer hover:scale-150 transition-transform\",\n \"disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent\"\n )}\n tabIndex={-1}\n >\n <ChevronDown className=\"size-3\" />\n </button>\n </div>\n )}\n\n {/* Clear Button */}\n {clearable &&\n (charCount > 0 || props?.value) &&\n !props.disabled &&\n type !== \"number\" && (\n <button\n type=\"button\"\n tabIndex={-1}\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 p-1 rounded hover:bg-accent transition-colors cursor-pointer\",\n type === \"password\"\n ? suffixIcon\n ? \"right-14\"\n : \"right-10\"\n : suffixIcon\n ? \"right-10\"\n : \"right-2\"\n )}\n onClick={handleClear}\n disabled={props.disabled}\n >\n <X className=\"size-4\" />\n </button>\n )}\n\n {/* Show/Hide Password Button */}\n {type === \"password\" && (\n <button\n type=\"button\"\n tabIndex={-1}\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 p-1 rounded hover:bg-accent transition-colors\",\n suffixIcon ? \"right-10\" : \"right-2\"\n )}\n onClick={() => setShowPassword((prev) => !prev)}\n disabled={props.disabled}\n >\n {showPassword ? (\n <EyeOff className=\"size-4\" />\n ) : (\n <Eye className=\"size-4\" />\n )}\n </button>\n )}\n\n {/* Suffix Icon */}\n {suffixIcon && (\n <div\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 text-muted-foreground leading-0\",\n iconPosition.right\n )}\n >\n {React.isValidElement(suffixIcon)\n ? React.cloneElement(suffixIcon, {\n className: cn(\n iconSizeClass,\n (suffixIcon.props as any)?.className\n ),\n } as Partial<unknown>)\n : suffixIcon}\n </div>\n )}\n </div>\n\n {(helperText || (showCharCount && typeof maxLength === \"number\")) && (\n <div className=\"flex items-center justify-between text-xs gap-2\">\n {helperText && (\n <p\n className={cn(\n \"text-xs\",\n state ? helperTextStyles?.[state] : \"\"\n )}\n >\n {helperText}\n </p>\n )}\n {showCharCount && typeof maxLength === \"number\" && (\n <span className=\"ml-auto text-muted-foreground\">\n {charCount} / {maxLength}\n </span>\n )}\n </div>\n )}\n </div>\n </div>\n );\n }\n);\n\nInput.displayName = \"Input\";\nexport default Input;\n"],"names":["Input","React","className","label","helperText","state","size","isFloatLabel","type","mask","maskOptions","maxLength","showCharCount","infoTooltip","clearable","onClear","prefixIcon","suffixIcon","placeholder","required","props","ref","charCount","setCharCount","handleInput","e","handleClear","innerRef","event","inputId","combinedRef","element","maskRefCallback","withMask","showPassword","setShowPassword","helperTextStyles","currentSize","padding","sizeMap","iconSizeClass","getRightPadding","hasBuiltInSuffix","iconPosition","handleIncrement","step","max","currentValue","newValue","handleDecrement","min","jsx","jsxs","cn","Label","Tooltip","Info","SInput","FloatingLabel","ChevronUp","ChevronDown","X","prev","EyeOff","Eye"],"mappings":"8bAyCMA,EAAQC,EAAM,WAClB,CACE,CACE,UAAAC,EAAA,MACAC,EACA,WAAAC,EACA,MAAAC,EACA,KAAAC,EACA,aAAAC,EACA,KAAAC,EACA,KAAAC,EACA,YAAAC,EACA,UAAAC,EACA,cAAAC,EACA,YAAAC,EACA,UAAAC,EACA,QAAAC,EACA,WAAAC,EACA,WAAAC,EACA,YAAAC,EAAc,IACd,SAAAC,EACA,GAAGC,CAAA,EAELC,IACG,CAEH,KAAM,CAACC,EAAWC,CAAY,EAAItB,EAAM,SAAS,IAC3C,OAAOmB,EAAM,OAAU,SAAiBA,EAAM,MAAM,OACpD,OAAOA,EAAM,cAAiB,SACzBA,EAAM,aAAa,OACrB,CACR,EAEKI,EAAeC,GAA2C,CAC9DF,EAAaE,EAAE,OAAO,MAAM,MAAM,EAC9BL,EAAM,UAAUA,EAAM,SAASK,CAAC,CACtC,EAEMC,EAAc,IAAM,CACxB,GAAIC,EAAS,QAAS,CACpBA,EAAS,QAAQ,MAAQ,GACzBJ,EAAa,CAAC,EACd,MAAMK,EAAQ,CACZ,OAAQD,EAAS,QACjB,cAAeA,EAAS,OAAA,EAE1BP,EAAM,WAAWQ,CAAK,EAClBb,GAASA,EAAA,CACf,CACF,EAEMc,E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W,OAAe,SAAA,CAC7B,CACmB,EACrBA,CAAA,CAAA,CACN,EAEJ,GAEEb,GAAeQ,GAAiB,OAAOD,GAAc,WACrDyC,OAAC,MAAA,CAAI,UAAU,kDACZ,SAAA,CAAAhD,GACC+C,EAAAA,IAAC,IAAA,CACC,UAAWE,EAAAA,GACT,UACAhD,EAAQ+B,IAAmB/B,CAAK,EAAI,EAAA,EAGrC,SAAAD,CAAA,CAAA,EAGJQ,GAAiB,OAAOD,GAAc,UACrCyC,EAAAA,KAAC,OAAA,CAAK,UAAU,gCACb,SAAA,CAAA9B,EAAU,MAAIX,CAAA,CAAA,CACjB,CAAA,CAAA,CAEJ,CAAA,CAAA,CAAA,EAGN,CAEJ,CACF,EAEAX,EAAM,YAAc"}
1
+ {"version":3,"file":"Input.cjs","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import React, { type ChangeEvent } from \"react\";\nimport {\n Input as SInput,\n type InputProps as SInputProps,\n} from \"@dsui/ui/components/input\";\nimport { cn } from \"@dsui/ui/lib/utils\";\nimport { FloatingLabel } from \"@/components/FloatLabel\";\nimport { Eye, EyeOff, ChevronDown, ChevronUp, Info, X } from \"lucide-react\";\nimport { withMask, type Options } from \"use-mask-input\";\nimport { Tooltip } from \"../Tooltip/Tooltip\";\nimport { Label } from \"../Label\";\n\n// Re-export base input props to avoid external dependency issues\nexport type BaseInputProps = Omit<React.ComponentProps<\"input\">, \"size\"> & {\n size?: \"normal\" | \"sm\" | \"xs\" | \"lg\" | \"xl\";\n state?: \"default\" | \"success\" | \"error\" | \"warning\";\n};\n\nexport type InputProps = BaseInputProps & {\n label?: string;\n helperText?: React.ReactNode;\n isFloatLabel?: boolean;\n mask?: string;\n maskOptions?: {\n placeholder?: string;\n inputFormat?: string;\n outputFormat?: string;\n showMaskOnHover?: boolean;\n showMaskOnFocus?: boolean;\n separate?: boolean;\n } & Options;\n maxLength?: number;\n showCharCount?: boolean;\n infoTooltip?: React.ReactNode;\n clearable?: boolean;\n onClear?: () => void;\n prefixIcon?: React.ReactNode;\n suffixIcon?: React.ReactNode;\n required?: boolean;\n};\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(\n (\n {\n className,\n label,\n helperText,\n state,\n size,\n isFloatLabel,\n type,\n mask,\n maskOptions,\n maxLength,\n showCharCount,\n infoTooltip,\n clearable,\n onClear,\n prefixIcon,\n suffixIcon,\n placeholder = \" \",\n required,\n ...props\n },\n ref\n ) => {\n // Character count state\n const [charCount, setCharCount] = React.useState(() => {\n if (typeof props.value === \"string\") return props.value.length;\n if (typeof props.defaultValue === \"string\")\n return props.defaultValue.length;\n return 0;\n });\n\n const handleInput = (e: React.ChangeEvent<HTMLInputElement>) => {\n setCharCount(e.target.value.length);\n if (props.onChange) props.onChange(e);\n };\n\n const handleClear = () => {\n if (innerRef.current) {\n innerRef.current.value = \"\";\n setCharCount(0);\n const event = {\n target: innerRef.current,\n currentTarget: innerRef.current,\n } as React.ChangeEvent<HTMLInputElement>;\n props.onChange?.(event);\n if (onClear) onClear();\n }\n };\n\n const inputId = React.useId();\n const innerRef = React.useRef<HTMLInputElement>(null);\n\n // Combine refs\n const combinedRef = React.useCallback(\n (element: HTMLInputElement | null) => {\n // Set innerRef\n if (innerRef) {\n (\n innerRef as React.MutableRefObject<HTMLInputElement | null>\n ).current = element;\n }\n\n // Apply mask if provided\n if (mask && element) {\n const maskRefCallback = withMask(mask, maskOptions);\n if (typeof maskRefCallback === \"function\") {\n maskRefCallback(element);\n }\n }\n },\n [mask, maskOptions]\n );\n\n // Expose ref to parent\n React.useImperativeHandle(ref, () => innerRef.current!);\n\n const [showPassword, setShowPassword] = React.useState(false);\n\n // State\n const helperTextStyles = {\n default: \"ds:text-muted-foreground\",\n success: \"ds:text-success\",\n warning: \"ds:text-warning\",\n error: \"ds:text-error\",\n };\n\n // Calculate current size\n const currentSize = isFloatLabel\n ? size === \"xl\" || size === \"lg\"\n ? size\n : \"xl\"\n : size || \"normal\";\n\n // Calculate padding based on size and icons\n const getPadding = () => {\n const sizeMap = {\n xs: { prefix: \"pl-8\", suffix: \"pr-8\" },\n sm: { prefix: \"pl-9\", suffix: \"pr-9\" },\n normal: { prefix: \"pl-10\", suffix: \"pr-10\" },\n lg: { prefix: \"pl-11\", suffix: \"pr-11\" },\n xl: { prefix: \"pl-12\", suffix: \"pr-12\" },\n };\n\n return sizeMap[currentSize as keyof typeof sizeMap] || sizeMap.normal;\n };\n\n const padding = getPadding();\n\n // Get icon size class based on current size\n const getIconSizeClass = () => {\n const sizeMap = {\n xs: \"size-3\",\n sm: \"size-3.5\",\n normal: \"size-4\",\n lg: \"size-4\",\n xl: \"size-4\",\n };\n return sizeMap[currentSize as keyof typeof sizeMap] || \"size-4\";\n };\n\n const iconSizeClass = getIconSizeClass();\n\n // Calculate right padding considering built-in icons\n const getRightPadding = () => {\n const hasBuiltInSuffix =\n type === \"number\" ||\n type === \"password\" ||\n type === \"datetime\" ||\n (clearable && (charCount > 0 || props?.value));\n\n if (hasBuiltInSuffix && suffixIcon) {\n return type === \"password\" &&\n clearable &&\n (charCount > 0 || props?.value)\n ? \"pr-20\" // password + clear + custom icon\n : \"pr-16\"; // one built-in + custom icon\n }\n\n if (hasBuiltInSuffix) {\n return type === \"password\" &&\n clearable &&\n (charCount > 0 || props?.value)\n ? \"pr-16\" // password + clear\n : \"pr-10\"; // single built-in icon\n }\n\n if (suffixIcon) {\n return padding.suffix;\n }\n\n return \"\";\n };\n\n // Icon position calculations\n const getIconPosition = () => {\n const sizeMap = {\n xs: { left: \"left-2.5\", right: \"right-2.5\" },\n sm: { left: \"left-3\", right: \"right-3\" },\n normal: { left: \"left-3\", right: \"right-3\" },\n lg: { left: \"left-3.5\", right: \"right-3.5\" },\n xl: { left: \"left-4\", right: \"right-4\" },\n };\n\n return sizeMap[currentSize as keyof typeof sizeMap] || sizeMap.normal;\n };\n\n const iconPosition = getIconPosition();\n\n /* Spinner Button Handlers */\n const handleIncrement = () => {\n if (innerRef.current) {\n const step = Number(props.step || 1);\n const max = props.max ? Number(props.max) : Infinity;\n const currentValue = Number(innerRef.current.value || 0);\n const newValue = Math.min(currentValue + step, max);\n\n innerRef.current.value = String(newValue);\n const event = new Event(\"input\", { bubbles: true });\n innerRef.current.dispatchEvent(event);\n props.onChange?.(event as unknown as ChangeEvent<HTMLInputElement>);\n }\n };\n\n const handleDecrement = () => {\n if (innerRef.current) {\n const step = Number(props.step || 1);\n const min = props.min ? Number(props.min) : -Infinity;\n const currentValue = Number(innerRef.current.value || 0);\n const newValue = Math.max(currentValue - step, min);\n\n innerRef.current.value = String(newValue);\n const event = new Event(\"input\", { bubbles: true });\n innerRef.current.dispatchEvent(event);\n props.onChange?.(event as unknown as ChangeEvent<HTMLInputElement>);\n }\n };\n /* End Spinner Button Handlers */\n\n return (\n <div className={className}>\n <div\n className={cn(\"ds:flex ds:flex-col ds:gap-1.5 ds:relative ds:flex-auto\", {\n \"ds:floating-label ds:relative\": isFloatLabel,\n })}\n >\n {!isFloatLabel && label && (\n <Label\n htmlFor={inputId}\n className=\"ds:flex ds:gap-2 ds:text-sm ds:font-medium ds:leading-none ds:peer-disabled:cursor-not-allowed ds:peer-disabled:opacity-70\"\n >\n <span>\n {label}\n {required && <span className=\"ds:text-error ds:ml-0.5\">*</span>}\n </span>\n {infoTooltip && (\n <Tooltip content={infoTooltip}>\n <Info className=\"ds:size-3.5 ds:min-w-3.5\" />\n </Tooltip>\n )}\n </Label>\n )}\n\n <div className=\"ds:relative\">\n {/* Prefix Icon */}\n {prefixIcon && (\n <div\n className={cn(\n \"ds:absolute ds:top-1/2 ds:-translate-y-1/2 ds:text-muted-foreground ds:leading-0\",\n iconPosition.left\n )}\n >\n {React.isValidElement(prefixIcon)\n ? React.cloneElement(prefixIcon, {\n className: cn(\n iconSizeClass,\n (prefixIcon.props as any)?.className\n ),\n } as Partial<unknown>)\n : prefixIcon}\n </div>\n )}\n\n <SInput\n ref={combinedRef}\n id={inputId}\n className={cn(\n \"ds:peer\",\n {\n \"ds:pt-5 ds:pb-1\": isFloatLabel && size !== \"lg\",\n \"ds:[&::-webkit-outer-spin-button]:appearance-none ds:[&::-webkit-inner-spin-button]:appearance-none ds:[-moz-appearance:textfield] ds:pr-8\":\n type === \"number\",\n // \"[-webkit-text-fill-color:var(--foreground)]\": mask,\n },\n prefixIcon && padding.prefix,\n mask && \"ds:placeholder:text-slate-400 ds:placeholder:opacity-100\",\n getRightPadding()\n // className,\n )}\n state={state}\n size={\n isFloatLabel\n ? size === \"xl\" || size === \"lg\"\n ? size\n : \"xl\"\n : size\n }\n type={\n type === \"password\"\n ? showPassword\n ? \"text\"\n : \"password\"\n : type\n }\n placeholder={placeholder}\n maxLength={maxLength}\n onChange={handleInput}\n required={required}\n {...props}\n />\n {isFloatLabel && (\n <FloatingLabel\n htmlFor={inputId}\n size={size}\n infoTooltip={infoTooltip}\n required={required}\n >\n {label}\n </FloatingLabel>\n )}\n\n {/* Spinner Buttons */}\n {type === \"number\" && (\n <div className=\"ds:absolute ds:right-1 ds:top-0 ds:h-full ds:flex ds:flex-col ds:gap-0.5\">\n <button\n type=\"button\"\n onClick={handleIncrement}\n disabled={props.disabled}\n className={cn(\n \"ds:h-1/2 ds:w-6 ds:flex ds:items-center ds:justify-center ds:rounded ds:cursor-pointer ds:hover:scale-150 ds:transition-transform\",\n \"ds:disabled:opacity-50 ds:disabled:cursor-not-allowed ds:disabled:hover:bg-transparent\"\n )}\n tabIndex={-1}\n >\n <ChevronUp className=\"ds:size-3\" />\n </button>\n <button\n type=\"button\"\n onClick={handleDecrement}\n disabled={props.disabled}\n className={cn(\n \"ds:h-1/2 ds:w-6 ds:flex ds:items-center ds:justify-center ds:rounded ds:cursor-pointer ds:hover:scale-150 ds:transition-transform\",\n \"ds:disabled:opacity-50 ds:disabled:cursor-not-allowed ds:disabled:hover:bg-transparent\"\n )}\n tabIndex={-1}\n >\n <ChevronDown className=\"ds:size-3\" />\n </button>\n </div>\n )}\n\n {/* Clear Button */}\n {clearable &&\n (charCount > 0 || props?.value) &&\n !props.disabled &&\n type !== \"number\" && (\n <button\n type=\"button\"\n tabIndex={-1}\n className={cn(\n \"ds:absolute ds:top-1/2 ds:-translate-y-1/2 ds:p-1 ds:rounded ds:hover:bg-accent ds:transition-colors ds:cursor-pointer\",\n type === \"password\"\n ? suffixIcon\n ? \"ds:right-14\"\n : \"ds:right-10\"\n : suffixIcon\n ? \"ds:right-10\"\n : \"ds:right-2\"\n )}\n onClick={handleClear}\n disabled={props.disabled}\n >\n <X className=\"ds:size-4\" />\n </button>\n )}\n\n {/* Show/Hide Password Button */}\n {type === \"password\" && (\n <button\n type=\"button\"\n tabIndex={-1}\n className={cn(\n \"ds:absolute ds:top-1/2 ds:-translate-y-1/2 ds:p-1 ds:rounded ds:hover:bg-accent ds:transition-colors\",\n suffixIcon ? \"ds:right-10\" : \"ds:right-2\"\n )}\n onClick={() => setShowPassword((prev) => !prev)}\n disabled={props.disabled}\n >\n {showPassword ? (\n <EyeOff className=\"ds:size-4\" />\n ) : (\n <Eye className=\"ds:size-4\" />\n )}\n </button>\n )}\n\n {/* Suffix Icon */}\n {suffixIcon && (\n <div\n className={cn(\n \"ds:absolute ds:top-1/2 ds:-translate-y-1/2 ds:text-muted-foreground ds:leading-0\",\n iconPosition.right\n )}\n >\n {React.isValidElement(suffixIcon)\n ? React.cloneElement(suffixIcon, {\n className: cn(\n iconSizeClass,\n (suffixIcon.props as any)?.className\n ),\n } as Partial<unknown>)\n : suffixIcon}\n </div>\n )}\n </div>\n\n {(helperText || (showCharCount && typeof maxLength === \"number\")) && (\n <div className=\"ds:flex ds:items-center ds:justify-between ds:text-xs ds:gap-2\">\n {helperText && (\n <p\n className={cn(\n \"ds:text-xs\",\n state ? helperTextStyles?.[state] : \"\"\n )}\n >\n {helperText}\n </p>\n )}\n {showCharCount && typeof maxLength === \"number\" && (\n <span className=\"ds:ml-auto ds:text-muted-foreground\">\n {charCount} / {maxLength}\n </span>\n )}\n </div>\n )}\n </div>\n </div>\n );\n }\n);\n\nInput.displayName = \"Input\";\nexport default Input;\n"],"names":["Input","React","className","label","helperText","state","size","isFloatLabel","type","mask","maskOptions","maxLength","showCharCount","infoTooltip","clearable","onClear","prefixIcon","suffixIcon","placeholder","required","props","ref","charCount","setCharCount","handleInput","e","handleClear","innerRef","event","inputId","combinedRef","element","maskRefCallback","withMask","showPassword","setShowPassword","helperTextStyles","currentSize","padding","sizeMap","iconSizeClass","getRightPadding","hasBuiltInSuffix","iconPosition","handleIncrement","step","max","currentValue","newValue","handleDecrement","min","jsx","jsxs","cn","Label","Tooltip","Info","SInput","FloatingLabel","ChevronUp","ChevronDown","X","prev","EyeOff","Eye"],"mappings":"8bAyCMA,EAAQC,EAAM,WAClB,CACE,CACE,UAAAC,EAAA,MACAC,EACA,WAAAC,EACA,MAAAC,EACA,KAAAC,EACA,aAAAC,EACA,KAAAC,EACA,KAAAC,EACA,YAAAC,EACA,UAAAC,EACA,cAAAC,EACA,YAAAC,EACA,UAAAC,EACA,QAAAC,EACA,WAAAC,EACA,WAAAC,EACA,YAAAC,EAAc,IACd,SAAAC,EACA,GAAGC,CAAA,EAELC,IACG,CAEH,KAAM,CAACC,EAAWC,CAAY,EAAItB,EAAM,SAAS,IAC3C,OAAOmB,EAAM,OAAU,SAAiBA,EAAM,MAAM,OACpD,OAAOA,EAAM,cAAiB,SACzBA,EAAM,aAAa,OACrB,CACR,EAEKI,EAAeC,GAA2C,CAC9DF,EAAaE,EAAE,OAAO,MAAM,MAAM,EAC9BL,EAAM,UAAUA,EAAM,SAASK,CAAC,CACtC,EAEMC,EAAc,IAAM,CACxB,GAAIC,EAAS,QAAS,CACpBA,EAAS,QAAQ,MAAQ,GACzBJ,EAAa,CAAC,EACd,MAAMK,EAAQ,CACZ,OAAQD,EAAS,QACjB,cAAeA,EAAS,OAAA,EAE1BP,EAAM,WAAWQ,CAAK,EAClBb,GAASA,EAAA,CACf,CACF,EAEMc,EAAU5B,EAAM,MAAA,EAChB0B,EAAW1B,EAAM,OAAyB,IAAI,EAG9C6B,EA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GAEEb,GAAeQ,GAAiB,OAAOD,GAAc,WACrDyC,OAAC,MAAA,CAAI,UAAU,iEACZ,SAAA,CAAAhD,GACC+C,EAAAA,IAAC,IAAA,CACC,UAAWE,EAAAA,GACT,aACAhD,EAAQ+B,IAAmB/B,CAAK,EAAI,EAAA,EAGrC,SAAAD,CAAA,CAAA,EAGJQ,GAAiB,OAAOD,GAAc,UACrCyC,EAAAA,KAAC,OAAA,CAAK,UAAU,sCACb,SAAA,CAAA9B,EAAU,MAAIX,CAAA,CAAA,CACjB,CAAA,CAAA,CAEJ,CAAA,CAAA,CAAA,EAGN,CAEJ,CACF,EAEAX,EAAM,YAAc"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),d=require("react"),i=require("../../packages/ui/src/components/input-otp.cjs"),N=require("../../packages/ui/src/components/label.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("../../packages/ui/src/components/select.cjs");require("../../packages/ui/src/components/combobox.cjs");require("@radix-ui/react-tooltip");const s=require("../../packages/ui/src/lib/utils.cjs");require("lucide-react");require("react-day-picker");require("../../packages/ui/src/components/popover.cjs");require("@radix-ui/react-separator");require("../../packages/ui/src/components/switch.cjs");require("vaul");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/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 n=require("input-otp"),P=d.forwardRef(({label:p,inputType:r="digits",regexPattern:x,length:o,size:m="normal",state:t="default",helperText:l,gapSize:u=4,variant:q="outlined",className:_,rootClassName:f,childClassName:g,...O},h)=>{const a=d.useId(),I=r==="digits"?n.REGEXP_ONLY_DIGITS:r==="chars"?n.REGEXP_ONLY_CHARS:r==="digits-and-chars"?n.REGEXP_ONLY_DIGITS_AND_CHARS:void 0,j={default:"text-muted-foreground",success:"text-success",warning:"text-warning",error:"text-error"};return e.jsxs("div",{className:s.cn("flex flex-col gap-1.5 relative",f),children:[e.jsx(N.Label,{htmlFor:a,children:p}),e.jsx(i.InputOTP,{id:a,maxLength:o??4,pattern:x??I,ref:h,...O,children:e.jsx(i.InputOTPGroup,{className:s.cn({"gap-2 *:data-[slot=input-otp-slot]:rounded-md *:data-[slot=input-otp-slot]:border":q==="outlined"&&u>0},_),style:u>0?{gap:`${u}px`}:void 0,children:Array.from({length:o??4}).map((R,c)=>e.jsx(i.InputOTPSlot,{index:c,size:m,state:t??void 0,variant:q,className:g},c))})}),l&&e.jsx("p",{className:s.cn("text-xs",t?j?.[t]:""),children:l})]})});exports.default=P;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),c=require("react"),s=require("../../packages/ui/src/components/input-otp.cjs"),N=require("../../packages/ui/src/components/label.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("../../packages/ui/src/components/select.cjs");require("../../packages/ui/src/components/combobox.cjs");require("@radix-ui/react-tooltip");const i=require("../../packages/ui/src/lib/utils.cjs");require("lucide-react");require("react-day-picker");require("../../packages/ui/src/components/popover.cjs");require("@radix-ui/react-separator");require("../../packages/ui/src/components/switch.cjs");require("vaul");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/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 d=require("input-otp"),P=c.forwardRef(({label:p,inputType:r="digits",regexPattern:x,length:n,size:m="normal",state:t="default",helperText:o,gapSize:u=4,variant:l="outlined",className:_,rootClassName:f,childClassName:g,...O},h)=>{const q=c.useId(),I=r==="digits"?d.REGEXP_ONLY_DIGITS:r==="chars"?d.REGEXP_ONLY_CHARS:r==="digits-and-chars"?d.REGEXP_ONLY_DIGITS_AND_CHARS:void 0,j={default:"ds:text-muted-foreground",success:"ds:text-success",warning:"ds:text-warning",error:"ds:text-error"};return e.jsxs("div",{className:i.cn("ds:flex ds:flex-col ds:gap-1.5 ds:relative",f),children:[e.jsx(N.Label,{htmlFor:q,children:p}),e.jsx(s.InputOTP,{id:q,maxLength:n??4,pattern:x??I,ref:h,...O,children:e.jsx(s.InputOTPGroup,{className:i.cn({"ds:gap-2 ds:*:data-[slot=input-otp-slot]:rounded-md ds:*:data-[slot=input-otp-slot]:border":l==="outlined"&&u>0},_),style:u>0?{gap:`${u}px`}:void 0,children:Array.from({length:n??4}).map((R,a)=>e.jsx(s.InputOTPSlot,{index:a,size:m,state:t??void 0,variant:l,className:g},a))})}),o&&e.jsx("p",{className:i.cn("ds:text-xs",t?j?.[t]:""),children:o})]})});exports.default=P;
2
2
  //# sourceMappingURL=InputOTP.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"InputOTP.cjs","sources":["../../../../src/components/InputOTP/InputOTP.tsx"],"sourcesContent":["import React, { useId } from \"react\";\n\nimport {\n InputOTP as SInputOTP,\n InputOTPGroup,\n InputOTPSlot,\n type InputOTPProps as SInputOTPProps,\n REGEXP_ONLY_DIGITS,\n REGEXP_ONLY_CHARS,\n REGEXP_ONLY_DIGITS_AND_CHARS,\n inputOTPSlotVariants,\n} from \"@dsui/ui/components/input-otp\";\nimport { Label } from \"@dsui/ui/components/label\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport { cn } from \"@dsui/ui/index\";\n\nexport type InputOTPProps = Omit<\n SInputOTPProps,\n \"size\" | \"render\" | \"maxLength\"\n> & {\n label?: React.ReactNode;\n length?: number;\n inputType?: \"digits\" | \"chars\" | \"digits-and-chars\";\n size?: VariantProps<typeof inputOTPSlotVariants>[\"size\"];\n state?: VariantProps<typeof inputOTPSlotVariants>[\"state\"];\n variant?: VariantProps<typeof inputOTPSlotVariants>[\"variant\"];\n regexPattern?: string;\n helperText?: React.ReactNode;\n gapSize?: number;\n className?: string;\n rootClassName?: string;\n childClassName?: string;\n};\n\nconst InputOTP = React.forwardRef<\n React.ElementRef<typeof SInputOTP>,\n InputOTPProps\n>(\n (\n {\n label,\n inputType = \"digits\",\n regexPattern,\n length,\n size = \"normal\",\n state = \"default\",\n helperText,\n gapSize = 4,\n variant = \"outlined\",\n className,\n rootClassName,\n childClassName,\n ...rest\n },\n ref\n ) => {\n const id = useId();\n\n const pattern =\n inputType === \"digits\"\n ? REGEXP_ONLY_DIGITS\n : inputType === \"chars\"\n ? REGEXP_ONLY_CHARS\n : inputType === \"digits-and-chars\"\n ? REGEXP_ONLY_DIGITS_AND_CHARS\n : undefined;\n\n const helperTextStyles = {\n default: \"text-muted-foreground\",\n success: \"text-success\",\n warning: \"text-warning\",\n error: \"text-error\",\n };\n\n return (\n <div className={cn(\"flex flex-col gap-1.5 relative\", rootClassName)}>\n <Label htmlFor={id}>{label}</Label>\n <SInputOTP\n id={id}\n maxLength={length ?? 4}\n pattern={regexPattern ?? pattern}\n ref={ref}\n {...rest}\n >\n <InputOTPGroup\n className={cn(\n {\n \"gap-2 *:data-[slot=input-otp-slot]:rounded-md *:data-[slot=input-otp-slot]:border\":\n variant === \"outlined\" && gapSize > 0,\n },\n className\n )}\n style={gapSize > 0 ? { gap: `${gapSize}px` } : undefined}\n >\n {Array.from({ length: length ?? 4 }).map((_, index) => (\n <InputOTPSlot\n key={index}\n index={index}\n size={size}\n state={state ?? undefined}\n variant={variant}\n className={childClassName}\n />\n ))}\n </InputOTPGroup>\n </SInputOTP>\n {helperText && (\n <p className={cn(\"text-xs\", state ? helperTextStyles?.[state] : \"\")}>\n {helperText}\n </p>\n )}\n </div>\n );\n }\n);\n\nexport default InputOTP;\n"],"names":["InputOTP","React","label","inputType","regexPattern","length","size","state","helperText","gapSize","variant","className","rootClassName","childClassName","rest","ref","id","useId","pattern","REGEXP_ONLY_DIGITS","REGEXP_ONLY_CHARS","REGEXP_ONLY_DIGITS_AND_CHARS","helperTextStyles","cn","jsx","Label","SInputOTP","InputOTPGroup","_","index","InputOTPSlot"],"mappings":"wnDAkCMA,EAAWC,EAAM,WAIrB,CACE,CAAA,MACEC,EACA,UAAAC,EAAY,SACZ,aAAAC,EACA,OAAAC,EACA,KAAAC,EAAO,SACP,MAAAC,EAAQ,UACR,WAAAC,EACA,QAAAC,EAAU,EACV,QAAAC,EAAU,WACV,UAAAC,EACA,cAAAC,EACA,eAAAC,EACA,GAAGC,CAAA,EAELC,IACG,CACH,MAAMC,EAAKC,EAAAA,MAAA,EAELC,EACJf,IAAc,SACVgB,qBACAhB,IAAc,QACZiB,oBACAjB,IAAc,mBACZkB,EAAAA,6BACA,OAEJC,EAAmB,CACvB,QAAS,wBACT,QAAS,eACT,QAAS,eACT,MAAO,YAAA,EAGT,cACG,MAAA,CAAI,UAAWC,EAAAA,GAAG,iCAAkCX,CAAa,EAChE,SAAA,CAAAY,EAAAA,IAACC,EAAAA,MAAA,CAAM,QAAST,EAAK,SAAAd,EAAM,EAC3BsB,EAAAA,IAACE,EAAAA,SAAA,CACC,GAAAV,EACA,UAAWX,GAAU,EACrB,QAASD,GAAgBc,EACzB,IAAAH,EACC,GAAGD,EAEJ,SAAAU,EAAAA,IAACG,EAAAA,cAAA,CACC,UAAWJ,EAAAA,GACT,CACE,oFACEb,IAAY,YAAcD,EAAU,CAAA,EAExCE,CAAA,EAEF,MAAOF,EAAU,EAAI,CAAE,IAAK,GAAGA,CAAO,MAAS,OAE9C,SAAA,MAAM,KAAK,CAAE,OAAQJ,GAAU,CAAA,CAAG,EAAE,IAAI,CAACuB,EAAGC,IAC3CL,EAAAA,IAACM,EAAAA,aAAA,CAEC,MAAAD,EACA,KAAAvB,EACA,MAAOC,GAAS,OAChB,QAAAG,EACA,UAAWG,CAAA,EALNgB,CAAA,CAOR,CAAA,CAAA,CACH,CAAA,EAEDrB,GACCgB,EAAAA,IAAC,IAAA,CAAE,UAAWD,EAAAA,GAAG,UAAWhB,EAAQe,IAAmBf,CAAK,EAAI,EAAE,EAC/D,SAAAC,CAAA,CACH,CAAA,EAEJ,CAEJ,CACF"}
1
+ {"version":3,"file":"InputOTP.cjs","sources":["../../../../src/components/InputOTP/InputOTP.tsx"],"sourcesContent":["import React, { useId } from \"react\";\n\nimport {\n InputOTP as SInputOTP,\n InputOTPGroup,\n InputOTPSlot,\n type InputOTPProps as SInputOTPProps,\n REGEXP_ONLY_DIGITS,\n REGEXP_ONLY_CHARS,\n REGEXP_ONLY_DIGITS_AND_CHARS,\n inputOTPSlotVariants,\n} from \"@dsui/ui/components/input-otp\";\nimport { Label } from \"@dsui/ui/components/label\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport { cn } from \"@dsui/ui/index\";\n\nexport type InputOTPProps = Omit<\n SInputOTPProps,\n \"size\" | \"render\" | \"maxLength\"\n> & {\n label?: React.ReactNode;\n length?: number;\n inputType?: \"digits\" | \"chars\" | \"digits-and-chars\";\n size?: VariantProps<typeof inputOTPSlotVariants>[\"size\"];\n state?: VariantProps<typeof inputOTPSlotVariants>[\"state\"];\n variant?: VariantProps<typeof inputOTPSlotVariants>[\"variant\"];\n regexPattern?: string;\n helperText?: React.ReactNode;\n gapSize?: number;\n className?: string;\n rootClassName?: string;\n childClassName?: string;\n};\n\nconst InputOTP = React.forwardRef<\n React.ElementRef<typeof SInputOTP>,\n InputOTPProps\n>(\n (\n {\n label,\n inputType = \"digits\",\n regexPattern,\n length,\n size = \"normal\",\n state = \"default\",\n helperText,\n gapSize = 4,\n variant = \"outlined\",\n className,\n rootClassName,\n childClassName,\n ...rest\n },\n ref\n ) => {\n const id = useId();\n\n const pattern =\n inputType === \"digits\"\n ? REGEXP_ONLY_DIGITS\n : inputType === \"chars\"\n ? REGEXP_ONLY_CHARS\n : inputType === \"digits-and-chars\"\n ? REGEXP_ONLY_DIGITS_AND_CHARS\n : undefined;\n\n const helperTextStyles = {\n default: \"ds:text-muted-foreground\",\n success: \"ds:text-success\",\n warning: \"ds:text-warning\",\n error: \"ds:text-error\",\n };\n\n return (\n <div className={cn(\"ds:flex ds:flex-col ds:gap-1.5 ds:relative\", rootClassName)}>\n <Label htmlFor={id}>{label}</Label>\n <SInputOTP\n id={id}\n maxLength={length ?? 4}\n pattern={regexPattern ?? pattern}\n ref={ref}\n {...rest}\n >\n <InputOTPGroup\n className={cn(\n {\n \"ds:gap-2 ds:*:data-[slot=input-otp-slot]:rounded-md ds:*:data-[slot=input-otp-slot]:border\":\n variant === \"outlined\" && gapSize > 0,\n },\n className\n )}\n style={gapSize > 0 ? { gap: `${gapSize}px` } : undefined}\n >\n {Array.from({ length: length ?? 4 }).map((_, index) => (\n <InputOTPSlot\n key={index}\n index={index}\n size={size}\n state={state ?? undefined}\n variant={variant}\n className={childClassName}\n />\n ))}\n </InputOTPGroup>\n </SInputOTP>\n {helperText && (\n <p className={cn(\"ds:text-xs\", state ? helperTextStyles?.[state] : \"\")}>\n {helperText}\n </p>\n )}\n </div>\n );\n }\n);\n\nexport default InputOTP;\n"],"names":["InputOTP","React","label","inputType","regexPattern","length","size","state","helperText","gapSize","variant","className","rootClassName","childClassName","rest","ref","id","useId","pattern","REGEXP_ONLY_DIGITS","REGEXP_ONLY_CHARS","REGEXP_ONLY_DIGITS_AND_CHARS","helperTextStyles","cn","jsx","Label","SInputOTP","InputOTPGroup","_","index","InputOTPSlot"],"mappings":"wnDAkCMA,EAAWC,EAAM,WAIrB,CACE,CAAA,MACEC,EACA,UAAAC,EAAY,SACZ,aAAAC,EACA,OAAAC,EACA,KAAAC,EAAO,SACP,MAAAC,EAAQ,UACR,WAAAC,EACA,QAAAC,EAAU,EACV,QAAAC,EAAU,WACV,UAAAC,EACA,cAAAC,EACA,eAAAC,EACA,GAAGC,CAAA,EAELC,IACG,CACH,MAAMC,EAAKC,EAAAA,MAAA,EAELC,EACJf,IAAc,SACVgB,qBACAhB,IAAc,QACZiB,oBACAjB,IAAc,mBACZkB,EAAAA,6BACA,OAEJC,EAAmB,CACvB,QAAS,2BACT,QAAS,kBACT,QAAS,kBACT,MAAO,eAAA,EAGT,cACG,MAAA,CAAI,UAAWC,EAAAA,GAAG,6CAA8CX,CAAa,EAC5E,SAAA,CAAAY,EAAAA,IAACC,EAAAA,MAAA,CAAM,QAAST,EAAK,SAAAd,EAAM,EAC3BsB,EAAAA,IAACE,EAAAA,SAAA,CACC,GAAAV,EACA,UAAWX,GAAU,EACrB,QAASD,GAAgBc,EACzB,IAAAH,EACC,GAAGD,EAEJ,SAAAU,EAAAA,IAACG,EAAAA,cAAA,CACC,UAAWJ,EAAAA,GACT,CACE,6FACEb,IAAY,YAAcD,EAAU,CAAA,EAExCE,CAAA,EAEF,MAAOF,EAAU,EAAI,CAAE,IAAK,GAAGA,CAAO,MAAS,OAE9C,SAAA,MAAM,KAAK,CAAE,OAAQJ,GAAU,CAAA,CAAG,EAAE,IAAI,CAACuB,EAAGC,IAC3CL,EAAAA,IAACM,EAAAA,aAAA,CAEC,MAAAD,EACA,KAAAvB,EACA,MAAOC,GAAS,OAChB,QAAAG,EACA,UAAWG,CAAA,EALNgB,CAAA,CAOR,CAAA,CAAA,CACH,CAAA,EAEDrB,GACCgB,EAAAA,IAAC,IAAA,CAAE,UAAWD,EAAAA,GAAG,aAAchB,EAAQe,IAAmBf,CAAK,EAAI,EAAE,EAClE,SAAAC,CAAA,CACH,CAAA,EAEJ,CAEJ,CACF"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),I=require("react"),h=require("motion/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 P=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("lucide-react");require("react-day-picker");require("../../packages/ui/src/components/popover.cjs");require("@radix-ui/react-separator");require("../../packages/ui/src/components/switch.cjs");require("vaul");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");function H(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const n in o)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(o,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:()=>o[n]})}}return e.default=o,Object.freeze(e)}const t=H(I),k={slow:{stiffness:100,damping:20,bounce:0},normal:{stiffness:500,damping:50,bounce:0},fast:{stiffness:1e3,damping:80,bounce:0},realtime:{stiffness:2e3,damping:100,bounce:0}},M=t.createContext(void 0),N=()=>{const o=t.useContext(M);if(!o)throw new Error("useCursor must be used within a CursorProvider");return o},F={default:null,pointer:u.jsx("div",{className:"h-5 w-5 rounded-full bg-white/30 border-2 border-white"})};function V({ref:o,children:e,cursorType:n="default",followText:i,showFollow:b,followAlign:q="bottom-right",followSideOffset:c=15,followTransition:y="normal",...R}){const[x,v]=t.useState({x:0,y:0}),[a,C]=t.useState(!1),r=t.useRef(null),p=t.useRef(null);t.useImperativeHandle(o,()=>r.current),t.useEffect(()=>{if(!r.current)return;const f=r.current.parentElement;if(!f)return;getComputedStyle(f).position==="static"&&(f.style.position="relative");const w=g=>{const m=f.getBoundingClientRect();v({x:g.clientX-m.left,y:g.clientY-m.top}),C(!0)},S=()=>C(!1);return f.addEventListener("mousemove",w),f.addEventListener("mouseleave",S),()=>{f.removeEventListener("mousemove",w),f.removeEventListener("mouseleave",S)}},[]);const l=n!==void 0,j=b??i!==void 0,s=k[y];return u.jsx(M.Provider,{value:{cursorPos:x,isActive:a,containerRef:r,cursorRef:p},children:u.jsxs("div",{ref:r,"data-slot":"cursor-provider",...R,children:[e,l&&u.jsx(A,{cursorType:n}),j&&u.jsx(L,{followText:i,align:q,sideOffset:c,transition:s})]})})}function A({ref:o,children:e,cursorType:n="default",className:i,style:b,...q}){const{cursorPos:c,isActive:y,containerRef:R,cursorRef:x}=N();t.useImperativeHandle(o,()=>x.current);const v=h.useMotionValue(0),a=h.useMotionValue(0),r=e||(typeof n=="string"&&n in F?F[n]:n),p=r!==null;return t.useEffect(()=>{const l=R.current?.parentElement;return l&&y&&p&&(l.style.cursor="none"),()=>{l&&(l.style.cursor="default")}},[R,y,p]),t.useEffect(()=>{v.set(c.x),a.set(c.y)},[c,v,a]),r?u.jsx(h.AnimatePresence,{children:y&&u.jsx(h.motion.div,{ref:x,"data-slot":"cursor",className:P.cn("transform-[translate(-50%,-50%)] pointer-events-none z-9999 absolute",i),style:{top:a,left:v,...b},initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},...q,children:r})}):null}function L({ref:o,sideOffset:e=15,align:n="bottom-right",children:i,className:b,style:q,followText:c,transition:y,transitionPreset:R="normal",...x}){const{cursorPos:v,isActive:a,cursorRef:C}=N(),r=t.useRef(null);t.useImperativeHandle(o,()=>r.current);const p=h.useMotionValue(0),l=h.useMotionValue(0),j=y||k[R],s=h.useSpring(p,j),f=h.useSpring(l,j),w=t.useCallback(()=>{const g=r.current?.getBoundingClientRect(),m=g?.width??0,E=g?.height??0;let d;switch(n){case"center":d={x:m/2,y:E/2};break;case"top":d={x:m/2,y:E+e};break;case"top-left":d={x:m+e,y:E+e};break;case"top-right":d={x:-e,y:E+e};break;case"bottom":d={x:m/2,y:-e};break;case"bottom-left":d={x:m+e,y:-e};break;case"bottom-right":d={x:-e,y:-e};break;case"left":d={x:m+e,y:E/2};break;case"right":d={x:-e,y:E/2};break;default:d={x:0,y:0}}return d},[n,e]);t.useEffect(()=>{const g=w(),m=C.current?.getBoundingClientRect(),E=m?.width??20,d=m?.height??20;p.set(v.x-g.x+E/2),l.set(v.y-g.y+d/2)},[w,v,C,p,l]);const S=()=>i||(c?typeof c=="string"?u.jsx("div",{className:"px-4 py-2 bg-white rounded-md shadow-lg text-sm font-medium",children:c}):c:null);return u.jsx(h.AnimatePresence,{children:a&&u.jsx(h.motion.div,{ref:r,"data-slot":"cursor-follow",className:P.cn("transform-[translate(-50%,-50%)] pointer-events-none z-9998 absolute",b),style:{top:f,left:s,...q},initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},...x,children:S()})})}function _(o={}){const{cursorType:e="default",followText:n,showFollow:i,align:b="bottom-right",sideOffset:q=15,transitionPreset:c="normal",className:y,style:R}=o,[x,v]=t.useState({x:0,y:0}),[a,C]=t.useState(!1),r=t.useRef(null),p=t.useRef(null);t.useEffect(()=>{if(!r.current)return;const s=r.current;getComputedStyle(s).position==="static"&&(s.style.position="relative");const f=S=>{const g=s.getBoundingClientRect();v({x:S.clientX-g.left,y:S.clientY-g.top}),C(!0)},w=()=>C(!1);return s.addEventListener("mousemove",f),s.addEventListener("mouseleave",w),()=>{s.removeEventListener("mousemove",f),s.removeEventListener("mouseleave",w)}},[]);const l=e!=="default";t.useEffect(()=>{if(!r.current||!a||!l)return;const s=r.current;return s.style.cursor="none",()=>{s.style.cursor="default"}},[a,l]);const j=t.useCallback(()=>a?u.jsxs(M.Provider,{value:{cursorPos:x,isActive:a,containerRef:r,cursorRef:p},children:[u.jsx(A,{cursorType:e}),(i??n!==void 0)&&u.jsx(L,{followText:n,align:b,sideOffset:q,transitionPreset:c})]}):null,[a,x,e,n,i,b,q,c]);return{ref:r,className:P.cn("relative",y),style:{...R},"data-cursor-container":!0,children:s=>u.jsxs(u.Fragment,{children:[s,j()]})}}exports.Cursor=A;exports.CursorFollow=L;exports.CursorProvider=V;exports.TRANSITION_PRESETS=k;exports.useCursor=N;exports.useCursorFollow=_;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),I=require("react"),h=require("motion/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 P=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("lucide-react");require("react-day-picker");require("../../packages/ui/src/components/popover.cjs");require("@radix-ui/react-separator");require("../../packages/ui/src/components/switch.cjs");require("vaul");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");function H(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const s in n)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>n[s]})}}return e.default=n,Object.freeze(e)}const t=H(I),k={slow:{stiffness:100,damping:20,bounce:0},normal:{stiffness:500,damping:50,bounce:0},fast:{stiffness:1e3,damping:80,bounce:0},realtime:{stiffness:2e3,damping:100,bounce:0}},M=t.createContext(void 0),N=()=>{const n=t.useContext(M);if(!n)throw new Error("useCursor must be used within a CursorProvider");return n},F={default:null,pointer:u.jsx("div",{className:"ds:h-5 ds:w-5 ds:rounded-full ds:bg-white/30 ds:border-2 ds:border-white"})};function V({ref:n,children:e,cursorType:s="default",followText:i,showFollow:b,followAlign:q="bottom-right",followSideOffset:c=15,followTransition:y="normal",...R}){const[x,v]=t.useState({x:0,y:0}),[a,C]=t.useState(!1),r=t.useRef(null),p=t.useRef(null);t.useImperativeHandle(n,()=>r.current),t.useEffect(()=>{if(!r.current)return;const d=r.current.parentElement;if(!d)return;getComputedStyle(d).position==="static"&&(d.style.position="relative");const w=g=>{const m=d.getBoundingClientRect();v({x:g.clientX-m.left,y:g.clientY-m.top}),C(!0)},S=()=>C(!1);return d.addEventListener("mousemove",w),d.addEventListener("mouseleave",S),()=>{d.removeEventListener("mousemove",w),d.removeEventListener("mouseleave",S)}},[]);const l=s!==void 0,j=b??i!==void 0,o=k[y];return u.jsx(M.Provider,{value:{cursorPos:x,isActive:a,containerRef:r,cursorRef:p},children:u.jsxs("div",{ref:r,"data-slot":"cursor-provider",...R,children:[e,l&&u.jsx(A,{cursorType:s}),j&&u.jsx(L,{followText:i,align:q,sideOffset:c,transition:o})]})})}function A({ref:n,children:e,cursorType:s="default",className:i,style:b,...q}){const{cursorPos:c,isActive:y,containerRef:R,cursorRef:x}=N();t.useImperativeHandle(n,()=>x.current);const v=h.useMotionValue(0),a=h.useMotionValue(0),r=e||(typeof s=="string"&&s in F?F[s]:s),p=r!==null;return t.useEffect(()=>{const l=R.current?.parentElement;return l&&y&&p&&(l.style.cursor="none"),()=>{l&&(l.style.cursor="default")}},[R,y,p]),t.useEffect(()=>{v.set(c.x),a.set(c.y)},[c,v,a]),r?u.jsx(h.AnimatePresence,{children:y&&u.jsx(h.motion.div,{ref:x,"data-slot":"cursor",className:P.cn("ds:transform-[translate(-50%,-50%)] ds:pointer-events-none ds:z-9999 ds:absolute",i),style:{top:a,left:v,...b},initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},...q,children:r})}):null}function L({ref:n,sideOffset:e=15,align:s="bottom-right",children:i,className:b,style:q,followText:c,transition:y,transitionPreset:R="normal",...x}){const{cursorPos:v,isActive:a,cursorRef:C}=N(),r=t.useRef(null);t.useImperativeHandle(n,()=>r.current);const p=h.useMotionValue(0),l=h.useMotionValue(0),j=y||k[R],o=h.useSpring(p,j),d=h.useSpring(l,j),w=t.useCallback(()=>{const g=r.current?.getBoundingClientRect(),m=g?.width??0,E=g?.height??0;let f;switch(s){case"center":f={x:m/2,y:E/2};break;case"top":f={x:m/2,y:E+e};break;case"top-left":f={x:m+e,y:E+e};break;case"top-right":f={x:-e,y:E+e};break;case"bottom":f={x:m/2,y:-e};break;case"bottom-left":f={x:m+e,y:-e};break;case"bottom-right":f={x:-e,y:-e};break;case"left":f={x:m+e,y:E/2};break;case"right":f={x:-e,y:E/2};break;default:f={x:0,y:0}}return f},[s,e]);t.useEffect(()=>{const g=w(),m=C.current?.getBoundingClientRect(),E=m?.width??20,f=m?.height??20;p.set(v.x-g.x+E/2),l.set(v.y-g.y+f/2)},[w,v,C,p,l]);const S=()=>i||(c?typeof c=="string"?u.jsx("div",{className:"ds:px-4 ds:py-2 ds:bg-white ds:rounded-md ds:shadow-lg ds:text-sm ds:font-medium",children:c}):c:null);return u.jsx(h.AnimatePresence,{children:a&&u.jsx(h.motion.div,{ref:r,"data-slot":"cursor-follow",className:P.cn("ds:transform-[translate(-50%,-50%)] ds:pointer-events-none ds:z-9998 ds:absolute",b),style:{top:d,left:o,...q},initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},...x,children:S()})})}function _(n={}){const{cursorType:e="default",followText:s,showFollow:i,align:b="bottom-right",sideOffset:q=15,transitionPreset:c="normal",className:y,style:R}=n,[x,v]=t.useState({x:0,y:0}),[a,C]=t.useState(!1),r=t.useRef(null),p=t.useRef(null);t.useEffect(()=>{if(!r.current)return;const o=r.current;getComputedStyle(o).position==="static"&&(o.style.position="relative");const d=S=>{const g=o.getBoundingClientRect();v({x:S.clientX-g.left,y:S.clientY-g.top}),C(!0)},w=()=>C(!1);return o.addEventListener("mousemove",d),o.addEventListener("mouseleave",w),()=>{o.removeEventListener("mousemove",d),o.removeEventListener("mouseleave",w)}},[]);const l=e!=="default";t.useEffect(()=>{if(!r.current||!a||!l)return;const o=r.current;return o.style.cursor="none",()=>{o.style.cursor="default"}},[a,l]);const j=t.useCallback(()=>a?u.jsxs(M.Provider,{value:{cursorPos:x,isActive:a,containerRef:r,cursorRef:p},children:[u.jsx(A,{cursorType:e}),(i??s!==void 0)&&u.jsx(L,{followText:s,align:b,sideOffset:q,transitionPreset:c})]}):null,[a,x,e,s,i,b,q,c]);return{ref:r,className:P.cn("ds:relative",y),style:{...R},"data-cursor-container":!0,children:o=>u.jsxs(u.Fragment,{children:[o,j()]})}}exports.Cursor=A;exports.CursorFollow=L;exports.CursorProvider=V;exports.TRANSITION_PRESETS=k;exports.useCursor=N;exports.useCursorFollow=_;
2
2
  //# sourceMappingURL=CursorFollow.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"CursorFollow.cjs","sources":["../../../../src/components/Interactive/CursorFollow.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n motion,\n useMotionValue,\n useSpring,\n AnimatePresence,\n type HTMLMotionProps,\n type SpringOptions,\n} from \"motion/react\";\n\nimport { cn } from \"@dsui/ui/index\";\n\n// Transition presets\ntype TransitionPreset = \"slow\" | \"normal\" | \"fast\" | \"realtime\";\n\nconst TRANSITION_PRESETS: Record<TransitionPreset, SpringOptions> = {\n slow: { stiffness: 100, damping: 20, bounce: 0 },\n normal: { stiffness: 500, damping: 50, bounce: 0 },\n fast: { stiffness: 1000, damping: 80, bounce: 0 },\n realtime: { stiffness: 2000, damping: 100, bounce: 0 },\n};\n\ntype CursorContextType = {\n cursorPos: { x: number; y: number };\n isActive: boolean;\n containerRef: React.RefObject<HTMLDivElement | null>;\n cursorRef: React.RefObject<HTMLDivElement | null>;\n};\n\nconst CursorContext = React.createContext<CursorContextType | undefined>(\n undefined\n);\n\nconst useCursor = (): CursorContextType => {\n const context = React.useContext(CursorContext);\n if (!context) {\n throw new Error(\"useCursor must be used within a CursorProvider\");\n }\n return context;\n};\n\ntype Align =\n | \"top\"\n | \"top-left\"\n | \"top-right\"\n | \"bottom\"\n | \"bottom-left\"\n | \"bottom-right\"\n | \"left\"\n | \"right\"\n | \"center\";\n\ntype CursorVariantKey = \"default\" | \"pointer\";\ntype CursorVariant = CursorVariantKey | React.ReactNode;\n\n// Predefined cursor variants\nconst cursorVariants: Record<CursorVariantKey, React.ReactNode> = {\n default: null, // Use system cursor\n pointer: (\n <div className=\"h-5 w-5 rounded-full bg-white/30 border-2 border-white\" />\n ),\n};\n\ntype CursorProviderProps = React.ComponentProps<\"div\"> & {\n children: React.ReactNode;\n /** Auto-setup cursor with variant (preset key or custom ReactNode) */\n cursorType?: CursorVariant;\n /** Auto-setup follow element with content */\n followText?: React.ReactNode;\n /** Show follow element (default: true when followText is provided) */\n showFollow?: boolean;\n /** Follow element alignment */\n followAlign?: Align;\n /** Follow element side offset */\n followSideOffset?: number;\n /** Follow element transition preset */\n followTransition?: TransitionPreset;\n};\n\nfunction CursorProvider({\n ref,\n children,\n cursorType = \"default\",\n followText,\n showFollow,\n followAlign = \"bottom-right\",\n followSideOffset = 15,\n followTransition = \"normal\",\n ...props\n}: CursorProviderProps) {\n const [cursorPos, setCursorPos] = React.useState({ x: 0, y: 0 });\n const [isActive, setIsActive] = React.useState(false);\n const containerRef = React.useRef<HTMLDivElement>(null);\n const cursorRef = React.useRef<HTMLDivElement>(null);\n React.useImperativeHandle(ref as React.Ref<HTMLDivElement>, () => containerRef.current as HTMLDivElement);\n\n React.useEffect(() => {\n if (!containerRef.current) return;\n\n const parent = containerRef.current.parentElement;\n if (!parent) return;\n\n if (getComputedStyle(parent).position === \"static\") {\n parent.style.position = \"relative\";\n }\n\n const handleMouseMove = (e: MouseEvent) => {\n const rect = parent.getBoundingClientRect();\n setCursorPos({ x: e.clientX - rect.left, y: e.clientY - rect.top });\n setIsActive(true);\n };\n const handleMouseLeave = () => setIsActive(false);\n\n parent.addEventListener(\"mousemove\", handleMouseMove);\n parent.addEventListener(\"mouseleave\", handleMouseLeave);\n\n return () => {\n parent.removeEventListener(\"mousemove\", handleMouseMove);\n parent.removeEventListener(\"mouseleave\", handleMouseLeave);\n };\n }, []);\n\n // Auto-setup: determine if we should show cursor and follow\n const shouldShowCursor = cursorType !== undefined;\n const shouldShowFollowElement = showFollow ?? followText !== undefined;\n\n // Convert preset to SpringOptions\n const transitionConfig = TRANSITION_PRESETS[followTransition];\n\n return (\n <CursorContext.Provider\n value={{ cursorPos, isActive, containerRef, cursorRef }}\n >\n <div ref={containerRef} data-slot=\"cursor-provider\" {...props}>\n {children}\n\n {/* Auto-setup Cursor */}\n {shouldShowCursor && <Cursor cursorType={cursorType} />}\n\n {/* Auto-setup CursorFollow */}\n {shouldShowFollowElement && (\n <CursorFollow\n followText={followText}\n align={followAlign}\n sideOffset={followSideOffset}\n transition={transitionConfig}\n />\n )}\n </div>\n </CursorContext.Provider>\n );\n}\n\ntype CursorProps = HTMLMotionProps<\"div\"> & {\n children?: React.ReactNode;\n cursorType?: CursorVariant;\n};\n\nfunction Cursor({\n ref,\n children,\n cursorType = \"default\",\n className,\n style,\n ...props\n}: CursorProps) {\n const { cursorPos, isActive, containerRef, cursorRef } = useCursor();\n React.useImperativeHandle(ref as React.Ref<HTMLDivElement>, () => cursorRef.current as HTMLDivElement);\n\n const x = useMotionValue(0);\n const y = useMotionValue(0);\n\n // Determine which content to render\n const getCursorContent = () => {\n if (children) return children;\n\n // Check if cursorType is a preset key\n if (typeof cursorType === \"string\" && cursorType in cursorVariants) {\n return cursorVariants[cursorType as CursorVariantKey];\n }\n\n // Otherwise treat it as custom ReactNode\n return cursorType;\n };\n\n const cursorContent = getCursorContent();\n\n // Only hide system cursor if we have custom content to show\n const shouldHideSystemCursor = cursorContent !== null;\n\n React.useEffect(() => {\n const parentElement = containerRef.current?.parentElement;\n\n if (parentElement && isActive && shouldHideSystemCursor) {\n parentElement.style.cursor = \"none\";\n }\n\n return () => {\n if (parentElement) parentElement.style.cursor = \"default\";\n };\n }, [containerRef, isActive, shouldHideSystemCursor]);\n\n React.useEffect(() => {\n x.set(cursorPos.x);\n y.set(cursorPos.y);\n }, [cursorPos, x, y]);\n\n // Only render if we have content to show\n if (!cursorContent) return null;\n\n return (\n <AnimatePresence>\n {isActive && (\n <motion.div\n ref={cursorRef}\n data-slot=\"cursor\"\n className={cn(\n \"transform-[translate(-50%,-50%)] pointer-events-none z-9999 absolute\",\n className\n )}\n style={{ top: y, left: x, ...style }}\n initial={{ scale: 0, opacity: 0 }}\n animate={{ scale: 1, opacity: 1 }}\n exit={{ scale: 0, opacity: 0 }}\n {...props}\n >\n {cursorContent}\n </motion.div>\n )}\n </AnimatePresence>\n );\n}\n\ntype CursorFollowProps = HTMLMotionProps<\"div\"> & {\n sideOffset?: number;\n align?: Align;\n transition?: SpringOptions;\n transitionPreset?: TransitionPreset;\n children?: React.ReactNode;\n followText?: React.ReactNode;\n};\n\nfunction CursorFollow({\n ref,\n sideOffset = 15,\n align = \"bottom-right\",\n children,\n className,\n style,\n followText,\n transition,\n transitionPreset = \"normal\",\n ...props\n}: CursorFollowProps) {\n const { cursorPos, isActive, cursorRef } = useCursor();\n const cursorFollowRef = React.useRef<HTMLDivElement>(null);\n React.useImperativeHandle(\n ref as React.Ref<HTMLDivElement>,\n () => cursorFollowRef.current as HTMLDivElement\n );\n\n const x = useMotionValue(0);\n const y = useMotionValue(0);\n\n // Use custom transition if provided, otherwise use preset\n const finalTransition = transition || TRANSITION_PRESETS[transitionPreset];\n\n const springX = useSpring(x, finalTransition);\n const springY = useSpring(y, finalTransition);\n\n const calculateOffset = React.useCallback(() => {\n const rect = cursorFollowRef.current?.getBoundingClientRect();\n const width = rect?.width ?? 0;\n const height = rect?.height ?? 0;\n\n let newOffset;\n\n switch (align) {\n case \"center\":\n newOffset = { x: width / 2, y: height / 2 };\n break;\n case \"top\":\n newOffset = { x: width / 2, y: height + sideOffset };\n break;\n case \"top-left\":\n newOffset = { x: width + sideOffset, y: height + sideOffset };\n break;\n case \"top-right\":\n newOffset = { x: -sideOffset, y: height + sideOffset };\n break;\n case \"bottom\":\n newOffset = { x: width / 2, y: -sideOffset };\n break;\n case \"bottom-left\":\n newOffset = { x: width + sideOffset, y: -sideOffset };\n break;\n case \"bottom-right\":\n newOffset = { x: -sideOffset, y: -sideOffset };\n break;\n case \"left\":\n newOffset = { x: width + sideOffset, y: height / 2 };\n break;\n case \"right\":\n newOffset = { x: -sideOffset, y: height / 2 };\n break;\n default:\n newOffset = { x: 0, y: 0 };\n }\n\n return newOffset;\n }, [align, sideOffset]);\n\n React.useEffect(() => {\n const offset = calculateOffset();\n const cursorRect = cursorRef.current?.getBoundingClientRect();\n const cursorWidth = cursorRect?.width ?? 20;\n const cursorHeight = cursorRect?.height ?? 20;\n\n x.set(cursorPos.x - offset.x + cursorWidth / 2);\n y.set(cursorPos.y - offset.y + cursorHeight / 2);\n }, [calculateOffset, cursorPos, cursorRef, x, y]);\n\n // Determine follow content based on children or followText\n const getFollowContent = () => {\n if (children) return children;\n\n if (followText) {\n // If followText is a string, wrap it with default styling\n if (typeof followText === \"string\") {\n return (\n <div className=\"px-4 py-2 bg-white rounded-md shadow-lg text-sm font-medium\">\n {followText}\n </div>\n );\n }\n // If it's a ReactNode, render it directly\n return followText;\n }\n\n return null;\n };\n\n return (\n <AnimatePresence>\n {isActive && (\n <motion.div\n ref={cursorFollowRef}\n data-slot=\"cursor-follow\"\n className={cn(\n \"transform-[translate(-50%,-50%)] pointer-events-none z-9998 absolute\",\n className\n )}\n style={{ top: springY, left: springX, ...style }}\n initial={{ scale: 0, opacity: 0 }}\n animate={{ scale: 1, opacity: 1 }}\n exit={{ scale: 0, opacity: 0 }}\n {...props}\n >\n {getFollowContent()}\n </motion.div>\n )}\n </AnimatePresence>\n );\n}\n\n// Hook for easy cursor setup (Method 2)\ntype useCursorFollowOptions = {\n /** Cursor variant type (preset key or custom ReactNode) */\n cursorType?: CursorVariant;\n /** Follow element content */\n followText?: React.ReactNode;\n /** Show follow element */\n showFollow?: boolean;\n /** Follow element alignment */\n align?: Align;\n /** Follow element side offset */\n sideOffset?: number;\n /** Follow element transition preset */\n transitionPreset?: TransitionPreset;\n /** Additional className for the container */\n className?: string;\n /** Additional style for the container */\n style?: React.CSSProperties;\n};\n\ntype UseCursorFollowType = {\n ref: React.RefObject<HTMLDivElement | null>;\n className: string;\n style: React.CSSProperties;\n \"data-cursor-container\": true;\n children: (children: React.ReactNode) => React.ReactElement;\n};\n\nfunction useCursorFollow(\n options: useCursorFollowOptions = {}\n): UseCursorFollowType {\n const {\n cursorType = \"default\",\n followText,\n showFollow,\n align = \"bottom-right\",\n sideOffset = 15,\n transitionPreset = \"normal\",\n className,\n style,\n } = options;\n\n const [cursorPos, setCursorPos] = React.useState({ x: 0, y: 0 });\n const [isActive, setIsActive] = React.useState(false);\n const containerRef = React.useRef<HTMLDivElement>(null);\n const cursorRef = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n if (!containerRef.current) return;\n\n const element = containerRef.current;\n if (getComputedStyle(element).position === \"static\") {\n element.style.position = \"relative\";\n }\n\n const handleMouseMove = (e: MouseEvent) => {\n const rect = element.getBoundingClientRect();\n setCursorPos({ x: e.clientX - rect.left, y: e.clientY - rect.top });\n setIsActive(true);\n };\n const handleMouseLeave = () => setIsActive(false);\n\n element.addEventListener(\"mousemove\", handleMouseMove);\n element.addEventListener(\"mouseleave\", handleMouseLeave);\n\n return () => {\n element.removeEventListener(\"mousemove\", handleMouseMove);\n element.removeEventListener(\"mouseleave\", handleMouseLeave);\n };\n }, []);\n\n // Only hide system cursor if cursorType is not 'default'\n const shouldHideSystemCursor = cursorType !== \"default\";\n\n React.useEffect(() => {\n if (!containerRef.current || !isActive || !shouldHideSystemCursor) return;\n const element = containerRef.current;\n element.style.cursor = \"none\";\n return () => {\n element.style.cursor = \"default\";\n };\n }, [isActive, shouldHideSystemCursor]);\n\n // Render function for cursor elements\n const renderCursorElements = React.useCallback(() => {\n if (!isActive) return null;\n\n return (\n <CursorContext.Provider\n value={{ cursorPos, isActive, containerRef, cursorRef }}\n >\n <Cursor cursorType={cursorType} />\n {(showFollow ?? followText !== undefined) && (\n <CursorFollow\n followText={followText}\n align={align}\n sideOffset={sideOffset}\n transitionPreset={transitionPreset}\n />\n )}\n </CursorContext.Provider>\n );\n }, [\n isActive,\n cursorPos,\n cursorType,\n followText,\n showFollow,\n align,\n sideOffset,\n transitionPreset,\n ]);\n\n // Return props that can be spread on the container element\n return {\n ref: containerRef,\n className: cn(\"relative\", className),\n style: { ...style },\n \"data-cursor-container\": true as const,\n children: (children: React.ReactNode) => (\n <>\n {children}\n {renderCursorElements()}\n </>\n ),\n };\n}\n\nexport {\n CursorProvider,\n Cursor,\n CursorFollow,\n useCursor,\n useCursorFollow,\n TRANSITION_PRESETS,\n type CursorContextType,\n type CursorProviderProps,\n type CursorProps,\n type CursorFollowProps,\n type CursorVariant,\n type CursorVariantKey,\n type Align,\n type useCursorFollowOptions,\n type TransitionPreset,\n};\n"],"names":["TRANSITION_PRESETS","CursorContext","React","useCursor","context","cursorVariants","jsx","CursorProvider","ref","children","cursorType","followText","showFollow","followAlign","followSideOffset","followTransition","props","cursorPos","setCursorPos","isActive","setIsActive","containerRef","cursorRef","parent","handleMouseMove","e","rect","handleMouseLeave","shouldShowCursor","shouldShowFollowElement","transitionConfig","Cursor","CursorFollow","className","style","x","useMotionValue","y","cursorContent","shouldHideSystemCursor","parentElement","AnimatePresence","motion","cn","sideOffset","align","transition","transitionPreset","cursorFollowRef","finalTransition","springX","useSpring","springY","calculateOffset","width","height","newOffset","offset","cursorRect","cursorWidth","cursorHeight","getFollowContent","useCursorFollow","options","element","renderCursorElements","jsxs","Fragment"],"mappings":"01DAiBMA,EAA8D,CAClE,KAAM,CAAE,UAAW,IAAK,QAAS,GAAI,OAAQ,CAAA,EAC7C,OAAQ,CAAE,UAAW,IAAK,QAAS,GAAI,OAAQ,CAAA,EAC/C,KAAM,CAAE,UAAW,IAAM,QAAS,GAAI,OAAQ,CAAA,EAC9C,SAAU,CAAE,UAAW,IAAM,QAAS,IAAK,OAAQ,CAAA,CACrD,EASMC,EAAgBC,EAAM,cAC1B,MACF,EAEMC,EAAY,IAAyB,CACzC,MAAMC,EAAUF,EAAM,WAAWD,CAAa,EAC9C,GAAI,CAACG,EACH,MAAM,IAAI,MAAM,gDAAgD,EAElE,OAAOA,CACT,EAiBMC,EAA4D,CAChE,QAAS,KACT,QACEC,EAAAA,IAAC,MAAA,CAAI,UAAU,wDAAA,CAAyD,CAE5E,EAkBA,SAASC,EAAe,CACtB,IAAAC,EACA,SAAAC,EACA,WAAAC,EAAa,UACb,WAAAC,EACA,WAAAC,EACA,YAAAC,EAAc,eACd,iBAAAC,EAAmB,GACnB,iBAAAC,EAAmB,SACnB,GAAGC,CACL,EAAwB,CACtB,KAAM,CAACC,EAAWC,CAAY,EAAIhB,EAAM,SAAS,CAAE,EAAG,EAAG,EAAG,EAAG,EACzD,CAACiB,EAAUC,CAAW,EAAIlB,EAAM,SAAS,EAAK,EAC9CmB,EAAenB,EAAM,OAAuB,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IAAC0B,EAAA,CACC,WAAArB,EACA,MAAAkC,EACA,WAAAD,EACA,iBAAAG,CAAA,CAAA,CACF,CAAA,CAAA,EAbgB,KAiBrB,CACD5B,EACAF,EACAP,EACAC,EACAC,EACAiC,EACAD,EACAG,CAAA,CACD,EAGD,MAAO,CACL,IAAK1B,EACL,UAAWsB,EAAAA,GAAG,WAAYV,CAAS,EACnC,MAAO,CAAE,GAAGC,CAAA,EACZ,wBAAyB,GACzB,SAAWzB,GACTyD,EAAAA,KAAAC,EAAAA,SAAA,CACG,SAAA,CAAA1D,EACAwD,EAAA,CAAqB,CAAA,CACxB,CAAA,CAGN"}
1
+ {"version":3,"file":"CursorFollow.cjs","sources":["../../../../src/components/Interactive/CursorFollow.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n motion,\n useMotionValue,\n useSpring,\n AnimatePresence,\n type HTMLMotionProps,\n type SpringOptions,\n} from \"motion/react\";\n\nimport { cn } from \"@dsui/ui/index\";\n\n// Transition presets\ntype TransitionPreset = \"slow\" | \"normal\" | \"fast\" | \"realtime\";\n\nconst TRANSITION_PRESETS: Record<TransitionPreset, SpringOptions> = {\n slow: { stiffness: 100, damping: 20, bounce: 0 },\n normal: { stiffness: 500, damping: 50, bounce: 0 },\n fast: { stiffness: 1000, damping: 80, bounce: 0 },\n realtime: { stiffness: 2000, damping: 100, bounce: 0 },\n};\n\ntype CursorContextType = {\n cursorPos: { x: number; y: number };\n isActive: boolean;\n containerRef: React.RefObject<HTMLDivElement | null>;\n cursorRef: React.RefObject<HTMLDivElement | null>;\n};\n\nconst CursorContext = React.createContext<CursorContextType | undefined>(\n undefined\n);\n\nconst useCursor = (): CursorContextType => {\n const context = React.useContext(CursorContext);\n if (!context) {\n throw new Error(\"useCursor must be used within a CursorProvider\");\n }\n return context;\n};\n\ntype Align =\n | \"top\"\n | \"top-left\"\n | \"top-right\"\n | \"bottom\"\n | \"bottom-left\"\n | \"bottom-right\"\n | \"left\"\n | \"right\"\n | \"center\";\n\ntype CursorVariantKey = \"default\" | \"pointer\";\ntype CursorVariant = CursorVariantKey | React.ReactNode;\n\n// Predefined cursor variants\nconst cursorVariants: Record<CursorVariantKey, React.ReactNode> = {\n default: null, // Use system cursor\n pointer: (\n <div className=\"ds:h-5 ds:w-5 ds:rounded-full ds:bg-white/30 ds:border-2 ds:border-white\" />\n ),\n};\n\ntype CursorProviderProps = React.ComponentProps<\"div\"> & {\n children: React.ReactNode;\n /** Auto-setup cursor with variant (preset key or custom ReactNode) */\n cursorType?: CursorVariant;\n /** Auto-setup follow element with content */\n followText?: React.ReactNode;\n /** Show follow element (default: true when followText is provided) */\n showFollow?: boolean;\n /** Follow element alignment */\n followAlign?: Align;\n /** Follow element side offset */\n followSideOffset?: number;\n /** Follow element transition preset */\n followTransition?: TransitionPreset;\n};\n\nfunction CursorProvider({\n ref,\n children,\n cursorType = \"default\",\n followText,\n showFollow,\n followAlign = \"bottom-right\",\n followSideOffset = 15,\n followTransition = \"normal\",\n ...props\n}: CursorProviderProps) {\n const [cursorPos, setCursorPos] = React.useState({ x: 0, y: 0 });\n const [isActive, setIsActive] = React.useState(false);\n const containerRef = React.useRef<HTMLDivElement>(null);\n const cursorRef = React.useRef<HTMLDivElement>(null);\n React.useImperativeHandle(ref as React.Ref<HTMLDivElement>, () => containerRef.current as HTMLDivElement);\n\n React.useEffect(() => {\n if (!containerRef.current) return;\n\n const parent = containerRef.current.parentElement;\n if (!parent) return;\n\n if (getComputedStyle(parent).position === \"static\") {\n parent.style.position = \"relative\";\n }\n\n const handleMouseMove = (e: MouseEvent) => {\n const rect = parent.getBoundingClientRect();\n setCursorPos({ x: e.clientX - rect.left, y: e.clientY - rect.top });\n setIsActive(true);\n };\n const handleMouseLeave = () => setIsActive(false);\n\n parent.addEventListener(\"mousemove\", handleMouseMove);\n parent.addEventListener(\"mouseleave\", handleMouseLeave);\n\n return () => {\n parent.removeEventListener(\"mousemove\", handleMouseMove);\n parent.removeEventListener(\"mouseleave\", handleMouseLeave);\n };\n }, []);\n\n // Auto-setup: determine if we should show cursor and follow\n const shouldShowCursor = cursorType !== undefined;\n const shouldShowFollowElement = showFollow ?? followText !== undefined;\n\n // Convert preset to SpringOptions\n const transitionConfig = TRANSITION_PRESETS[followTransition];\n\n return (\n <CursorContext.Provider\n value={{ cursorPos, isActive, containerRef, cursorRef }}\n >\n <div ref={containerRef} data-slot=\"cursor-provider\" {...props}>\n {children}\n\n {/* Auto-setup Cursor */}\n {shouldShowCursor && <Cursor cursorType={cursorType} />}\n\n {/* Auto-setup CursorFollow */}\n {shouldShowFollowElement && (\n <CursorFollow\n followText={followText}\n align={followAlign}\n sideOffset={followSideOffset}\n transition={transitionConfig}\n />\n )}\n </div>\n </CursorContext.Provider>\n );\n}\n\ntype CursorProps = HTMLMotionProps<\"div\"> & {\n children?: React.ReactNode;\n cursorType?: CursorVariant;\n};\n\nfunction Cursor({\n ref,\n children,\n cursorType = \"default\",\n className,\n style,\n ...props\n}: CursorProps) {\n const { cursorPos, isActive, containerRef, cursorRef } = useCursor();\n React.useImperativeHandle(ref as React.Ref<HTMLDivElement>, () => cursorRef.current as HTMLDivElement);\n\n const x = useMotionValue(0);\n const y = useMotionValue(0);\n\n // Determine which content to render\n const getCursorContent = () => {\n if (children) return children;\n\n // Check if cursorType is a preset key\n if (typeof cursorType === \"string\" && cursorType in cursorVariants) {\n return cursorVariants[cursorType as CursorVariantKey];\n }\n\n // Otherwise treat it as custom ReactNode\n return cursorType;\n };\n\n const cursorContent = getCursorContent();\n\n // Only hide system cursor if we have custom content to show\n const shouldHideSystemCursor = cursorContent !== null;\n\n React.useEffect(() => {\n const parentElement = containerRef.current?.parentElement;\n\n if (parentElement && isActive && shouldHideSystemCursor) {\n parentElement.style.cursor = \"none\";\n }\n\n return () => {\n if (parentElement) parentElement.style.cursor = \"default\";\n };\n }, [containerRef, isActive, shouldHideSystemCursor]);\n\n React.useEffect(() => {\n x.set(cursorPos.x);\n y.set(cursorPos.y);\n }, [cursorPos, x, y]);\n\n // Only render if we have content to show\n if (!cursorContent) return null;\n\n return (\n <AnimatePresence>\n {isActive && (\n <motion.div\n ref={cursorRef}\n data-slot=\"cursor\"\n className={cn(\n \"ds:transform-[translate(-50%,-50%)] ds:pointer-events-none ds:z-9999 ds:absolute\",\n className\n )}\n style={{ top: y, left: x, ...style }}\n initial={{ scale: 0, opacity: 0 }}\n animate={{ scale: 1, opacity: 1 }}\n exit={{ scale: 0, opacity: 0 }}\n {...props}\n >\n {cursorContent}\n </motion.div>\n )}\n </AnimatePresence>\n );\n}\n\ntype CursorFollowProps = HTMLMotionProps<\"div\"> & {\n sideOffset?: number;\n align?: Align;\n transition?: SpringOptions;\n transitionPreset?: TransitionPreset;\n children?: React.ReactNode;\n followText?: React.ReactNode;\n};\n\nfunction CursorFollow({\n ref,\n sideOffset = 15,\n align = \"bottom-right\",\n children,\n className,\n style,\n followText,\n transition,\n transitionPreset = \"normal\",\n ...props\n}: CursorFollowProps) {\n const { cursorPos, isActive, cursorRef } = useCursor();\n const cursorFollowRef = React.useRef<HTMLDivElement>(null);\n React.useImperativeHandle(\n ref as React.Ref<HTMLDivElement>,\n () => cursorFollowRef.current as HTMLDivElement\n );\n\n const x = useMotionValue(0);\n const y = useMotionValue(0);\n\n // Use custom transition if provided, otherwise use preset\n const finalTransition = transition || TRANSITION_PRESETS[transitionPreset];\n\n const springX = useSpring(x, finalTransition);\n const springY = useSpring(y, finalTransition);\n\n const calculateOffset = React.useCallback(() => {\n const rect = cursorFollowRef.current?.getBoundingClientRect();\n const width = rect?.width ?? 0;\n const height = rect?.height ?? 0;\n\n let newOffset;\n\n switch (align) {\n case \"center\":\n newOffset = { x: width / 2, y: height / 2 };\n break;\n case \"top\":\n newOffset = { x: width / 2, y: height + sideOffset };\n break;\n case \"top-left\":\n newOffset = { x: width + sideOffset, y: height + sideOffset };\n break;\n case \"top-right\":\n newOffset = { x: -sideOffset, y: height + sideOffset };\n break;\n case \"bottom\":\n newOffset = { x: width / 2, y: -sideOffset };\n break;\n case \"bottom-left\":\n newOffset = { x: width + sideOffset, y: -sideOffset };\n break;\n case \"bottom-right\":\n newOffset = { x: -sideOffset, y: -sideOffset };\n break;\n case \"left\":\n newOffset = { x: width + sideOffset, y: height / 2 };\n break;\n case \"right\":\n newOffset = { x: -sideOffset, y: height / 2 };\n break;\n default:\n newOffset = { x: 0, y: 0 };\n }\n\n return newOffset;\n }, [align, sideOffset]);\n\n React.useEffect(() => {\n const offset = calculateOffset();\n const cursorRect = cursorRef.current?.getBoundingClientRect();\n const cursorWidth = cursorRect?.width ?? 20;\n const cursorHeight = cursorRect?.height ?? 20;\n\n x.set(cursorPos.x - offset.x + cursorWidth / 2);\n y.set(cursorPos.y - offset.y + cursorHeight / 2);\n }, [calculateOffset, cursorPos, cursorRef, x, y]);\n\n // Determine follow content based on children or followText\n const getFollowContent = () => {\n if (children) return children;\n\n if (followText) {\n // If followText is a string, wrap it with default styling\n if (typeof followText === \"string\") {\n return (\n <div className=\"ds:px-4 ds:py-2 ds:bg-white ds:rounded-md ds:shadow-lg ds:text-sm ds:font-medium\">\n {followText}\n </div>\n );\n }\n // If it's a ReactNode, render it directly\n return followText;\n }\n\n return null;\n };\n\n return (\n <AnimatePresence>\n {isActive && (\n <motion.div\n ref={cursorFollowRef}\n data-slot=\"cursor-follow\"\n className={cn(\n \"ds:transform-[translate(-50%,-50%)] ds:pointer-events-none ds:z-9998 ds:absolute\",\n className\n )}\n style={{ top: springY, left: springX, ...style }}\n initial={{ scale: 0, opacity: 0 }}\n animate={{ scale: 1, opacity: 1 }}\n exit={{ scale: 0, opacity: 0 }}\n {...props}\n >\n {getFollowContent()}\n </motion.div>\n )}\n </AnimatePresence>\n );\n}\n\n// Hook for easy cursor setup (Method 2)\ntype useCursorFollowOptions = {\n /** Cursor variant type (preset key or custom ReactNode) */\n cursorType?: CursorVariant;\n /** Follow element content */\n followText?: React.ReactNode;\n /** Show follow element */\n showFollow?: boolean;\n /** Follow element alignment */\n align?: Align;\n /** Follow element side offset */\n sideOffset?: number;\n /** Follow element transition preset */\n transitionPreset?: TransitionPreset;\n /** Additional className for the container */\n className?: string;\n /** Additional style for the container */\n style?: React.CSSProperties;\n};\n\ntype UseCursorFollowType = {\n ref: React.RefObject<HTMLDivElement | null>;\n className: string;\n style: React.CSSProperties;\n \"data-cursor-container\": true;\n children: (children: React.ReactNode) => React.ReactElement;\n};\n\nfunction useCursorFollow(\n options: useCursorFollowOptions = {}\n): UseCursorFollowType {\n const {\n cursorType = \"default\",\n followText,\n showFollow,\n align = \"bottom-right\",\n sideOffset = 15,\n transitionPreset = \"normal\",\n className,\n style,\n } = options;\n\n const [cursorPos, setCursorPos] = React.useState({ x: 0, y: 0 });\n const [isActive, setIsActive] = React.useState(false);\n const containerRef = React.useRef<HTMLDivElement>(null);\n const cursorRef = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n if (!containerRef.current) return;\n\n const element = containerRef.current;\n if (getComputedStyle(element).position === \"static\") {\n element.style.position = \"relative\";\n }\n\n const handleMouseMove = (e: MouseEvent) => {\n const rect = element.getBoundingClientRect();\n setCursorPos({ x: e.clientX - rect.left, y: e.clientY - rect.top });\n setIsActive(true);\n };\n const handleMouseLeave = () => setIsActive(false);\n\n element.addEventListener(\"mousemove\", handleMouseMove);\n element.addEventListener(\"mouseleave\", handleMouseLeave);\n\n return () => {\n element.removeEventListener(\"mousemove\", handleMouseMove);\n element.removeEventListener(\"mouseleave\", handleMouseLeave);\n };\n }, []);\n\n // Only hide system cursor if cursorType is not 'default'\n const shouldHideSystemCursor = cursorType !== \"default\";\n\n React.useEffect(() => {\n if (!containerRef.current || !isActive || !shouldHideSystemCursor) return;\n const element = containerRef.current;\n element.style.cursor = \"none\";\n return () => {\n element.style.cursor = \"default\";\n };\n }, [isActive, shouldHideSystemCursor]);\n\n // Render function for cursor elements\n const renderCursorElements = React.useCallback(() => {\n if (!isActive) return null;\n\n return (\n <CursorContext.Provider\n value={{ cursorPos, isActive, containerRef, cursorRef }}\n >\n <Cursor cursorType={cursorType} />\n {(showFollow ?? followText !== undefined) && (\n <CursorFollow\n followText={followText}\n align={align}\n sideOffset={sideOffset}\n transitionPreset={transitionPreset}\n />\n )}\n </CursorContext.Provider>\n );\n }, [\n isActive,\n cursorPos,\n cursorType,\n followText,\n showFollow,\n align,\n sideOffset,\n transitionPreset,\n ]);\n\n // Return props that can be spread on the container element\n return {\n ref: containerRef,\n className: cn(\"ds:relative\", className),\n style: { ...style },\n \"data-cursor-container\": true as const,\n children: (children: React.ReactNode) => (\n <>\n {children}\n {renderCursorElements()}\n </>\n ),\n };\n}\n\nexport {\n CursorProvider,\n Cursor,\n CursorFollow,\n useCursor,\n useCursorFollow,\n TRANSITION_PRESETS,\n type CursorContextType,\n type CursorProviderProps,\n type CursorProps,\n type CursorFollowProps,\n type CursorVariant,\n type CursorVariantKey,\n type Align,\n type useCursorFollowOptions,\n type TransitionPreset,\n};\n"],"names":["TRANSITION_PRESETS","CursorContext","React","useCursor","context","cursorVariants","jsx","CursorProvider","ref","children","cursorType","followText","showFollow","followAlign","followSideOffset","followTransition","props","cursorPos","setCursorPos","isActive","setIsActive","containerRef","cursorRef","parent","handleMouseMove","e","rect","handleMouseLeave","shouldShowCursor","shouldShowFollowElement","transitionConfig","Cursor","CursorFollow","className","style","x","useMotionValue","y","cursorContent","shouldHideSystemCursor","parentElement","AnimatePresence","motion","cn","sideOffset","align","transition","transitionPreset","cursorFollowRef","finalTransition","springX","useSpring","springY","calculateOffset","width","height","newOffset","offset","cursorRect","cursorWidth","cursorHeight","getFollowContent","useCursorFollow","options","element","renderCursorElements","jsxs","Fragment"],"mappings":"01DAiBMA,EAA8D,CAClE,KAAM,CAAE,UAAW,IAAK,QAAS,GAAI,OAAQ,CAAA,EAC7C,OAAQ,CAAE,UAAW,IAAK,QAAS,GAAI,OAAQ,CAAA,EAC/C,KAAM,CAAE,UAAW,IAAM,QAAS,GAAI,OAAQ,CAAA,EAC9C,SAAU,CAAE,UAAW,IAAM,QAAS,I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,IAAM,CACXqC,EAAQ,oBAAoB,YAAaxC,CAAe,EACxDwC,EAAQ,oBAAoB,aAAcrC,CAAgB,CAC5D,CACF,EAAG,CAAA,CAAE,EAGL,MAAMY,EAAyB7B,IAAe,UAE9CR,EAAM,UAAU,IAAM,CACpB,GAAI,CAACmB,EAAa,SAAW,CAACF,GAAY,CAACoB,EAAwB,OACnE,MAAMyB,EAAU3C,EAAa,QAC7B,OAAA2C,EAAQ,MAAM,OAAS,OAChB,IAAM,CACXA,EAAQ,MAAM,OAAS,SACzB,CACF,EAAG,CAAC7C,EAAUoB,CAAsB,CAAC,EAGrC,MAAM0B,EAAuB/D,EAAM,YAAY,IACxCiB,EAGH+C,EAAAA,KAACjE,EAAc,SAAd,CACC,MAAO,CAAE,UAAAgB,EAAW,SAAAE,EAAU,aAAAE,EAAc,UAAAC,CAAA,EAE5C,SAAA,CAAAhB,MAACyB,GAAO,WAAArB,EAAwB,GAC9BE,GAAcD,IAAe,SAC7BL,EAAAA,IAAC0B,EAAA,CACC,WAAArB,EACA,MAAAkC,EACA,WAAAD,EACA,iBAAAG,CAAA,CAAA,CACF,CAAA,CAAA,EAbgB,KAiBrB,CACD5B,EACAF,EACAP,EACAC,EACAC,EACAiC,EACAD,EACAG,CAAA,CACD,EAGD,MAAO,CACL,IAAK1B,EACL,UAAWsB,EAAAA,GAAG,cAAeV,CAAS,EACtC,MAAO,CAAE,GAAGC,CAAA,EACZ,wBAAyB,GACzB,SAAWzB,GACTyD,EAAAA,KAAAC,EAAAA,SAAA,CACG,SAAA,CAAA1D,EACAwD,EAAA,CAAqB,CAAA,CACxB,CAAA,CAGN"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react/jsx-runtime"),P=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 D=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 L=require("react");require("lucide-react");require("react-day-picker");require("../../packages/ui/src/components/popover.cjs");require("@radix-ui/react-separator");require("../../packages/ui/src/components/switch.cjs");require("vaul");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 I=require("../../packages/ui/src/lib/compose-refs.cjs"),_=require("class-variance-authority");function Q(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const i in s)if(i!=="default"){const n=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:()=>s[i]})}}return e.default=s,Object.freeze(e)}const u=Q(L),U="Marquee",X="MarqueeContent";function Y(){const s=new Set;let e=null;const i=new Map,n=new Map,d=typeof ResizeObserver<"u";let c=!1;const q=new WeakMap;function t(){c||(c=!0,queueMicrotask(()=>{c=!1;for(const r of s)r()}))}function x(){e&&(e.disconnect(),e=null),i.clear(),n.clear()}function v(r){return s.add(r),()=>{s.delete(r),s.size===0&&x()}}function p(r,o,f){if(!r||!o)return null;const a=i.get(r),l=i.get(o);if(!a||!l)return null;const m=f==="vertical"?a.height:a.width,R=f==="vertical"?l.height:l.width;let b=q.get(r);b||(b=new WeakMap,q.set(r,b));let h=b.get(o);h||(h={horizontal:{rootSize:-1,contentSize:-1},vertical:{rootSize:-1,contentSize:-1}},b.set(o,h));const S=h[f];if(S.rootSize===m&&S.contentSize===R)return S;const w={rootSize:m,contentSize:R};return h[f]=w,w}function C(r,o){if(!d||!r||!o)return;e||(e=new ResizeObserver(R=>{let b=!1;for(const h of R){const S=h.target,{width:w,height:y}=h.contentRect,N=i.get(S);(!N||N.width!==w||N.height!==y)&&(i.set(S,{width:w,height:y}),b=!0)}b&&t()})),n.set(r,(n.get(r)??0)+1),n.set(o,(n.get(o)??0)+1),e.observe(r),e.observe(o);const f=r.getBoundingClientRect(),a=o.getBoundingClientRect(),l={width:f.width,height:f.height},m={width:a.width,height:a.height};i.set(r,l),i.set(o,m),l.width>0&&l.height>0&&m.width>0&&m.height>0&&t()}function M(r,o){if(!e||!r||!o)return;const f=(n.get(r)??1)-1,a=(n.get(o)??1)-1;f<=0?(e.unobserve(r),i.delete(r),n.delete(r)):n.set(r,f),a<=0?(e.unobserve(o),i.delete(o),n.delete(o)):n.set(o,a)}return{subscribe:v,getSnapshot:p,observe:C,unobserve:M}}const k=Y();function F(s,e,i){const n=u.useCallback(c=>k.subscribe(c),[]),d=u.useCallback(()=>k.getSnapshot(s.current,e.current,i),[s,e,i]);return u.useSyncExternalStore(n,d,d)}const Z=u.createContext(void 0);function E(s){const e=u.useContext(Z);return s??e??"ltr"}const T=u.createContext(null);function ee(s){const e=u.useContext(T);if(!e)throw new Error(`\`${s}\` must be used within \`${U}\``);return e}function A(s){const{side:e="left",dir:i,speed:n=50,delay:d=0,loopCount:c=0,gap:q="1rem",asChild:t,autoFill:x=!1,pauseOnHover:v=!1,pauseOnKeyboard:p=!1,reverse:C=!1,className:M,style:r,ref:o,...f}=s,a=e==="top"||e==="bottom"?"vertical":"horizontal",l=E(i),m=u.useRef(null),R=u.useRef(null),b=I.useComposedRefs(o,m),[h,S]=u.useState(!1),w=u.useCallback(z=>{p&&z.key===" "&&(z.preventDefault(),S(O=>!O))},[p]),y=F(m,R,a),N=u.useMemo(()=>{const z=Math.max(.001,n);if(!y)return(x?1e3:2e3)/z;const{rootSize:O,contentSize:j}=y;if(x){const V=j<O?Math.ceil(O/j):1;return j*V/z}else return j<O?O/z:j/z},[y,n,x]),W=u.useMemo(()=>({"--marquee-duration":`${N}s`,"--marquee-gap":q,"--marquee-delay":`${d}s`,"--marquee-loop-count":c===0||c===1/0?"infinite":c.toString(),...r}),[N,q,d,c,r]),G=u.useMemo(()=>({side:e,orientation:a,dir:l,speed:n,loopCount:c,contentRef:R,rootRef:m,autoFill:x,paused:h,pauseOnHover:v,pauseOnKeyboard:p,reverse:C}),[e,a,l,n,c,x,h,v,p,C]),J=t?P.Slot:"div";return g.jsx(T.Provider,{value:G,children:g.jsx("div",{"data-slot":"marquee-wrapper",className:"grid",children:g.jsx(J,{role:"marquee","aria-live":"off","data-orientation":a,"data-slot":"marquee",dir:l,tabIndex:p?0:void 0,...f,ref:b,className:D.cn("relative flex overflow-hidden motion-reduce:animate-none",a==="vertical"&&"h-full flex-col",a==="horizontal"&&"w-full",h&&"[&_*]:[animation-play-state:paused]",v&&"group",p&&"rounded-md focus-visible:border-ring focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",M),style:W,onKeyDown:p?w:void 0})})})}const H=_.cva("flex min-w-full shrink-0 gap-(--marquee-gap)",{variants:{side:{left:"animate-marquee-left",right:"animate-marquee-right",top:"min-h-full min-w-auto animate-marquee-up flex-col",bottom:"min-h-full min-w-auto animate-marquee-down flex-col"},dir:{ltr:"",rtl:""},pauseOnHover:{true:"group-hover:[animation-play-state:paused]",false:""},reverse:{true:"[animation-direction:reverse]",false:""}},compoundVariants:[{side:"left",dir:"rtl",className:"animate-marquee-left-rtl"},{side:"right",dir:"rtl",className:"animate-marquee-right-rtl"}],defaultVariants:{side:"left",dir:"ltr",pauseOnHover:!1,reverse:!1}});function $(s){const{className:e,asChild:i,ref:n,children:d,style:c,...q}=s,t=ee(X),x=I.useComposedRefs(n,t.contentRef),v=t.orientation==="vertical",p=t.dir==="rtl",C=F(t.rootRef,t.contentRef,t.orientation);u.useEffect(()=>{if(t.rootRef.current&&t.contentRef.current)return k.observe(t.rootRef.current,t.contentRef.current),()=>{k.unobserve(t.rootRef.current,t.contentRef.current)}},[t.rootRef,t.contentRef]);const M=u.useMemo(()=>{if(!t.autoFill||!C)return 1;const{rootSize:a,contentSize:l}=C;return l===0?1:l<a?Math.ceil(a/l):1},[t.autoFill,C]),r=u.useCallback(a=>Array.from({length:Math.max(0,a)}).map((l,m)=>g.jsx(u.Fragment,{children:d},m)),[d]),o=u.useMemo(()=>({...c,animationDuration:"var(--marquee-duration)",animationDelay:"var(--marquee-delay)",animationIterationCount:"var(--marquee-loop-count)",animationDirection:t.reverse?"reverse":"normal"}),[c,t.reverse]),f=i?P.Slot:"div";return g.jsxs(g.Fragment,{children:[g.jsxs(f,{"data-orientation":t.orientation,"data-slot":"marquee-content",...q,style:o,className:D.cn(H({side:t.side,dir:t.dir,pauseOnHover:t.pauseOnHover,reverse:t.reverse,className:e}),v&&"flex-col",v?"mb-(--marquee-gap)":p?"ml-(--marquee-gap)":"mr-(--marquee-gap)"),children:[g.jsx("div",{ref:x,className:D.cn("flex shrink-0 gap-(--marquee-gap)",v&&"flex-col"),children:d}),r(M-1)]}),g.jsx(f,{role:"presentation","aria-hidden":"true",...q,style:o,className:D.cn(H({side:t.side,dir:t.dir,pauseOnHover:t.pauseOnHover,reverse:t.reverse,className:e}),v&&"flex-col"),children:r(M)})]})}function K(s){const{className:e,asChild:i,...n}=s,d=i?P.Slot:"div";return g.jsx(d,{"data-slot":"marquee-item",...n,className:D.cn("shrink-0",e)})}const te=_.cva("pointer-events-none absolute z-10",{variants:{side:{left:"top-0 left-0 h-full bg-gradient-to-r from-background to-transparent",right:"top-0 right-0 h-full bg-gradient-to-l from-background to-transparent",top:"top-0 left-0 w-full bg-gradient-to-b from-background to-transparent",bottom:"bottom-0 left-0 w-full bg-gradient-to-t from-background to-transparent"},size:{default:"",sm:"",lg:""}},compoundVariants:[{side:["left","right"],size:"default",className:"w-1/4"},{side:["left","right"],size:"sm",className:"w-1/6"},{side:["left","right"],size:"lg",className:"w-1/3"},{side:["top","bottom"],size:"default",className:"h-1/4"},{side:["top","bottom"],size:"sm",className:"h-1/6"},{side:["top","bottom"],size:"lg",className:"h-1/3"}],defaultVariants:{size:"default"}});function B(s){const{side:e,size:i,className:n,asChild:d,...c}=s,q=d?P.Slot:"div";return g.jsx(q,{"data-size":i,"data-slot":"marquee-edge",...c,className:D.cn(te({side:e,size:i,className:n}))})}exports.Content=$;exports.Edge=B;exports.Item=K;exports.Marquee=A;exports.MarqueeContent=$;exports.MarqueeEdge=B;exports.MarqueeItem=K;exports.Root=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react/jsx-runtime"),P=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 D=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 L=require("react");require("lucide-react");require("react-day-picker");require("../../packages/ui/src/components/popover.cjs");require("@radix-ui/react-separator");require("../../packages/ui/src/components/switch.cjs");require("vaul");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 I=require("../../packages/ui/src/lib/compose-refs.cjs"),_=require("class-variance-authority");function Q(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const n in i)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(i,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:()=>i[n]})}}return e.default=i,Object.freeze(e)}const u=Q(L),U="Marquee",X="MarqueeContent";function Y(){const i=new Set;let e=null;const n=new Map,s=new Map,l=typeof ResizeObserver<"u";let d=!1;const q=new WeakMap;function t(){d||(d=!0,queueMicrotask(()=>{d=!1;for(const r of i)r()}))}function x(){e&&(e.disconnect(),e=null),n.clear(),s.clear()}function v(r){return i.add(r),()=>{i.delete(r),i.size===0&&x()}}function p(r,o,f){if(!r||!o)return null;const a=n.get(r),c=n.get(o);if(!a||!c)return null;const m=f==="vertical"?a.height:a.width,R=f==="vertical"?c.height:c.width;let b=q.get(r);b||(b=new WeakMap,q.set(r,b));let h=b.get(o);h||(h={horizontal:{rootSize:-1,contentSize:-1},vertical:{rootSize:-1,contentSize:-1}},b.set(o,h));const S=h[f];if(S.rootSize===m&&S.contentSize===R)return S;const w={rootSize:m,contentSize:R};return h[f]=w,w}function C(r,o){if(!l||!r||!o)return;e||(e=new ResizeObserver(R=>{let b=!1;for(const h of R){const S=h.target,{width:w,height:y}=h.contentRect,N=n.get(S);(!N||N.width!==w||N.height!==y)&&(n.set(S,{width:w,height:y}),b=!0)}b&&t()})),s.set(r,(s.get(r)??0)+1),s.set(o,(s.get(o)??0)+1),e.observe(r),e.observe(o);const f=r.getBoundingClientRect(),a=o.getBoundingClientRect(),c={width:f.width,height:f.height},m={width:a.width,height:a.height};n.set(r,c),n.set(o,m),c.width>0&&c.height>0&&m.width>0&&m.height>0&&t()}function M(r,o){if(!e||!r||!o)return;const f=(s.get(r)??1)-1,a=(s.get(o)??1)-1;f<=0?(e.unobserve(r),n.delete(r),s.delete(r)):s.set(r,f),a<=0?(e.unobserve(o),n.delete(o),s.delete(o)):s.set(o,a)}return{subscribe:v,getSnapshot:p,observe:C,unobserve:M}}const k=Y();function F(i,e,n){const s=u.useCallback(d=>k.subscribe(d),[]),l=u.useCallback(()=>k.getSnapshot(i.current,e.current,n),[i,e,n]);return u.useSyncExternalStore(s,l,l)}const Z=u.createContext(void 0);function E(i){const e=u.useContext(Z);return i??e??"ltr"}const T=u.createContext(null);function ee(i){const e=u.useContext(T);if(!e)throw new Error(`\`${i}\` must be used within \`${U}\``);return e}function A(i){const{side:e="left",dir:n,speed:s=50,delay:l=0,loopCount:d=0,gap:q="1rem",asChild:t,autoFill:x=!1,pauseOnHover:v=!1,pauseOnKeyboard:p=!1,reverse:C=!1,className:M,style:r,ref:o,...f}=i,a=e==="top"||e==="bottom"?"vertical":"horizontal",c=E(n),m=u.useRef(null),R=u.useRef(null),b=I.useComposedRefs(o,m),[h,S]=u.useState(!1),w=u.useCallback(z=>{p&&z.key===" "&&(z.preventDefault(),S(O=>!O))},[p]),y=F(m,R,a),N=u.useMemo(()=>{const z=Math.max(.001,s);if(!y)return(x?1e3:2e3)/z;const{rootSize:O,contentSize:j}=y;if(x){const V=j<O?Math.ceil(O/j):1;return j*V/z}else return j<O?O/z:j/z},[y,s,x]),W=u.useMemo(()=>({"--marquee-duration":`${N}s`,"--marquee-gap":q,"--marquee-delay":`${l}s`,"--marquee-loop-count":d===0||d===1/0?"infinite":d.toString(),...r}),[N,q,l,d,r]),G=u.useMemo(()=>({side:e,orientation:a,dir:c,speed:s,loopCount:d,contentRef:R,rootRef:m,autoFill:x,paused:h,pauseOnHover:v,pauseOnKeyboard:p,reverse:C}),[e,a,c,s,d,x,h,v,p,C]),J=t?P.Slot:"div";return g.jsx(T.Provider,{value:G,children:g.jsx("div",{"data-slot":"marquee-wrapper",className:"ds:grid",children:g.jsx(J,{role:"marquee","aria-live":"off","data-orientation":a,"data-slot":"marquee",dir:c,tabIndex:p?0:void 0,...f,ref:b,className:D.cn("ds:relative ds:flex ds:overflow-hidden ds:motion-reduce:animate-none",a==="vertical"&&"ds:h-full ds:flex-col",a==="horizontal"&&"ds:w-full",h&&"ds:[&_*]:[animation-play-state:paused]",v&&"ds:group",p&&"ds:rounded-md ds:focus-visible:border-ring ds:focus-visible:outline-none ds:focus-visible:ring-[3px] ds:focus-visible:ring-ring/50",M),style:W,onKeyDown:p?w:void 0})})})}const H=_.cva("ds:flex ds:min-w-full ds:shrink-0 ds:gap-(--marquee-gap)",{variants:{side:{left:"ds:animate-marquee-left",right:"ds:animate-marquee-right",top:"ds:min-h-full ds:min-w-auto ds:animate-marquee-up ds:flex-col",bottom:"ds:min-h-full ds:min-w-auto ds:animate-marquee-down ds:flex-col"},dir:{ltr:"",rtl:""},pauseOnHover:{true:"ds:group-hover:[animation-play-state:paused]",false:""},reverse:{true:"ds:[animation-direction:reverse]",false:""}},compoundVariants:[{side:"left",dir:"rtl",className:"ds:animate-marquee-left-rtl"},{side:"right",dir:"rtl",className:"ds:animate-marquee-right-rtl"}],defaultVariants:{side:"left",dir:"ltr",pauseOnHover:!1,reverse:!1}});function $(i){const{className:e,asChild:n,ref:s,children:l,style:d,...q}=i,t=ee(X),x=I.useComposedRefs(s,t.contentRef),v=t.orientation==="vertical",p=t.dir==="rtl",C=F(t.rootRef,t.contentRef,t.orientation);u.useEffect(()=>{if(t.rootRef.current&&t.contentRef.current)return k.observe(t.rootRef.current,t.contentRef.current),()=>{k.unobserve(t.rootRef.current,t.contentRef.current)}},[t.rootRef,t.contentRef]);const M=u.useMemo(()=>{if(!t.autoFill||!C)return 1;const{rootSize:a,contentSize:c}=C;return c===0?1:c<a?Math.ceil(a/c):1},[t.autoFill,C]),r=u.useCallback(a=>Array.from({length:Math.max(0,a)}).map((c,m)=>g.jsx(u.Fragment,{children:l},m)),[l]),o=u.useMemo(()=>({...d,animationDuration:"var(--marquee-duration)",animationDelay:"var(--marquee-delay)",animationIterationCount:"var(--marquee-loop-count)",animationDirection:t.reverse?"reverse":"normal"}),[d,t.reverse]),f=n?P.Slot:"div";return g.jsxs(g.Fragment,{children:[g.jsxs(f,{"data-orientation":t.orientation,"data-slot":"marquee-content",...q,style:o,className:D.cn(H({side:t.side,dir:t.dir,pauseOnHover:t.pauseOnHover,reverse:t.reverse,className:e}),v&&"ds:flex-col",v?"ds:mb-(--marquee-gap)":p?"ds:ml-(--marquee-gap)":"ds:mr-(--marquee-gap)"),children:[g.jsx("div",{ref:x,className:D.cn("ds:flex ds:shrink-0 ds:gap-(--marquee-gap)",v&&"ds:flex-col"),children:l}),r(M-1)]}),g.jsx(f,{role:"presentation","aria-hidden":"true",...q,style:o,className:D.cn(H({side:t.side,dir:t.dir,pauseOnHover:t.pauseOnHover,reverse:t.reverse,className:e}),v&&"ds:flex-col"),children:r(M)})]})}function K(i){const{className:e,asChild:n,...s}=i,l=n?P.Slot:"div";return g.jsx(l,{"data-slot":"marquee-item",...s,className:D.cn("ds:shrink-0",e)})}const te=_.cva("ds:pointer-events-none ds:absolute ds:z-10",{variants:{side:{left:"ds:top-0 ds:left-0 ds:h-full ds:bg-gradient-to-r ds:from-background ds:to-transparent",right:"ds:top-0 ds:right-0 ds:h-full ds:bg-gradient-to-l ds:from-background ds:to-transparent",top:"ds:top-0 ds:left-0 ds:w-full ds:bg-gradient-to-b ds:from-background ds:to-transparent",bottom:"ds:bottom-0 ds:left-0 ds:w-full ds:bg-gradient-to-t ds:from-background ds:to-transparent"},size:{default:"",sm:"",lg:""}},compoundVariants:[{side:["left","right"],size:"default",className:"ds:w-1/4"},{side:["left","right"],size:"sm",className:"ds:w-1/6"},{side:["left","right"],size:"lg",className:"ds:w-1/3"},{side:["top","bottom"],size:"default",className:"ds:h-1/4"},{side:["top","bottom"],size:"sm",className:"ds:h-1/6"},{side:["top","bottom"],size:"lg",className:"ds:h-1/3"}],defaultVariants:{size:"default"}});function B(i){const{side:e,size:n,className:s,asChild:l,...d}=i,q=l?P.Slot:"div";return g.jsx(q,{"data-size":n,"data-slot":"marquee-edge",...d,className:D.cn(te({side:e,size:n,className:s}))})}exports.Content=$;exports.Edge=B;exports.Item=K;exports.Marquee=A;exports.MarqueeContent=$;exports.MarqueeEdge=B;exports.MarqueeItem=K;exports.Root=A;
2
2
  //# sourceMappingURL=Marquee.cjs.map