@yamada-ui/react 2.3.0-next-20261009073533 → 2.3.1-dev-20261030022105

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 (488) hide show
  1. package/dist/cjs/components/accordion/accordion.cjs +4 -3
  2. package/dist/cjs/components/accordion/accordion.cjs.map +1 -1
  3. package/dist/cjs/components/aspect-ratio/aspect-ratio.cjs +2 -2
  4. package/dist/cjs/components/aspect-ratio/aspect-ratio.cjs.map +1 -1
  5. package/dist/cjs/components/blockquote/blockquote.style.cjs +1 -1
  6. package/dist/cjs/components/blockquote/blockquote.style.cjs.map +1 -1
  7. package/dist/cjs/components/breadcrumb/use-breadcrumb.cjs +2 -1
  8. package/dist/cjs/components/breadcrumb/use-breadcrumb.cjs.map +1 -1
  9. package/dist/cjs/components/bubble/bubble.cjs +163 -0
  10. package/dist/cjs/components/bubble/bubble.cjs.map +1 -0
  11. package/dist/cjs/components/bubble/bubble.style.cjs +143 -0
  12. package/dist/cjs/components/bubble/bubble.style.cjs.map +1 -0
  13. package/dist/cjs/components/bubble/index.cjs +18 -0
  14. package/dist/cjs/components/bubble/namespace.cjs +28 -0
  15. package/dist/cjs/components/bubble/namespace.cjs.map +1 -0
  16. package/dist/cjs/components/button/button.cjs +11 -8
  17. package/dist/cjs/components/button/button.cjs.map +1 -1
  18. package/dist/cjs/components/calendar/calendar.cjs +3 -1
  19. package/dist/cjs/components/calendar/calendar.cjs.map +1 -1
  20. package/dist/cjs/components/calendar/use-calendar.cjs +11 -6
  21. package/dist/cjs/components/calendar/use-calendar.cjs.map +1 -1
  22. package/dist/cjs/components/code/code.style.cjs +2 -1
  23. package/dist/cjs/components/code/code.style.cjs.map +1 -1
  24. package/dist/cjs/components/date-picker/use-date-picker.cjs +10 -10
  25. package/dist/cjs/components/date-picker/use-date-picker.cjs.map +1 -1
  26. package/dist/cjs/components/drawer/drawer.cjs +13 -1
  27. package/dist/cjs/components/drawer/drawer.cjs.map +1 -1
  28. package/dist/cjs/components/drawer/index.cjs +1 -0
  29. package/dist/cjs/components/drawer/namespace.cjs +2 -0
  30. package/dist/cjs/components/drawer/namespace.cjs.map +1 -1
  31. package/dist/cjs/components/drawer/use-drawer.cjs +139 -11
  32. package/dist/cjs/components/drawer/use-drawer.cjs.map +1 -1
  33. package/dist/cjs/components/field/field.cjs +4 -3
  34. package/dist/cjs/components/field/field.cjs.map +1 -1
  35. package/dist/cjs/components/file-input/use-file-input.cjs.map +1 -1
  36. package/dist/cjs/components/icon/icons/armenian-dram-icon.cjs +14 -0
  37. package/dist/cjs/components/icon/icons/armenian-dram-icon.cjs.map +1 -0
  38. package/dist/cjs/components/icon/icons/bangladeshi-taka-icon.cjs +14 -0
  39. package/dist/cjs/components/icon/icons/bangladeshi-taka-icon.cjs.map +1 -0
  40. package/dist/cjs/components/icon/icons/belarusian-ruble-icon.cjs +14 -0
  41. package/dist/cjs/components/icon/icons/belarusian-ruble-icon.cjs.map +1 -0
  42. package/dist/cjs/components/icon/icons/calendar-chevrons-left-icon.cjs +14 -0
  43. package/dist/cjs/components/icon/icons/calendar-chevrons-left-icon.cjs.map +1 -0
  44. package/dist/cjs/components/icon/icons/certificate-icon.cjs +14 -0
  45. package/dist/cjs/components/icon/icons/certificate-icon.cjs.map +1 -0
  46. package/dist/cjs/components/icon/icons/circle-fading-play-icon.cjs +14 -0
  47. package/dist/cjs/components/icon/icons/circle-fading-play-icon.cjs.map +1 -0
  48. package/dist/cjs/components/icon/icons/cpu-ai-icon.cjs +14 -0
  49. package/dist/cjs/components/icon/icons/cpu-ai-icon.cjs.map +1 -0
  50. package/dist/cjs/components/icon/icons/door-closed-cog-icon.cjs +14 -0
  51. package/dist/cjs/components/icon/icons/door-closed-cog-icon.cjs.map +1 -0
  52. package/dist/cjs/components/icon/icons/eighth-note-icon.cjs +14 -0
  53. package/dist/cjs/components/icon/icons/eighth-note-icon.cjs.map +1 -0
  54. package/dist/cjs/components/icon/icons/eighth-notes-icon.cjs +14 -0
  55. package/dist/cjs/components/icon/icons/eighth-notes-icon.cjs.map +1 -0
  56. package/dist/cjs/components/icon/icons/folder-user-icon.cjs +14 -0
  57. package/dist/cjs/components/icon/icons/folder-user-icon.cjs.map +1 -0
  58. package/dist/cjs/components/icon/icons/folder-users-icon.cjs +14 -0
  59. package/dist/cjs/components/icon/icons/folder-users-icon.cjs.map +1 -0
  60. package/dist/cjs/components/icon/icons/graph-star-icon.cjs +14 -0
  61. package/dist/cjs/components/icon/icons/graph-star-icon.cjs.map +1 -0
  62. package/dist/cjs/components/icon/icons/groceries-icon.cjs +14 -0
  63. package/dist/cjs/components/icon/icons/groceries-icon.cjs.map +1 -0
  64. package/dist/cjs/components/icon/icons/guitar-electric-icon.cjs +14 -0
  65. package/dist/cjs/components/icon/icons/guitar-electric-icon.cjs.map +1 -0
  66. package/dist/cjs/components/icon/icons/half-note-icon.cjs +14 -0
  67. package/dist/cjs/components/icon/icons/half-note-icon.cjs.map +1 -0
  68. package/dist/cjs/components/icon/icons/handle-bottom-right-icon.cjs +14 -0
  69. package/dist/cjs/components/icon/icons/handle-bottom-right-icon.cjs.map +1 -0
  70. package/dist/cjs/components/icon/icons/hiking-stick-icon.cjs +14 -0
  71. package/dist/cjs/components/icon/icons/hiking-stick-icon.cjs.map +1 -0
  72. package/dist/cjs/components/icon/icons/index.cjs +123 -12
  73. package/dist/cjs/components/icon/icons/index.cjs.map +1 -1
  74. package/dist/cjs/components/icon/icons/kazakh-tenge-icon.cjs +14 -0
  75. package/dist/cjs/components/icon/icons/kazakh-tenge-icon.cjs.map +1 -0
  76. package/dist/cjs/components/icon/icons/layout-grid-circles-icon.cjs +14 -0
  77. package/dist/cjs/components/icon/icons/layout-grid-circles-icon.cjs.map +1 -0
  78. package/dist/cjs/components/icon/icons/lens-icon.cjs +14 -0
  79. package/dist/cjs/components/icon/icons/lens-icon.cjs.map +1 -0
  80. package/dist/cjs/components/icon/icons/letters-icon.cjs +14 -0
  81. package/dist/cjs/components/icon/icons/letters-icon.cjs.map +1 -0
  82. package/dist/cjs/components/icon/icons/mail-dot-icon.cjs +14 -0
  83. package/dist/cjs/components/icon/icons/mail-dot-icon.cjs.map +1 -0
  84. package/dist/cjs/components/icon/icons/message-circle-text-icon.cjs +14 -0
  85. package/dist/cjs/components/icon/icons/message-circle-text-icon.cjs.map +1 -0
  86. package/dist/cjs/components/icon/icons/perfume-bottle-icon.cjs +14 -0
  87. package/dist/cjs/components/icon/icons/perfume-bottle-icon.cjs.map +1 -0
  88. package/dist/cjs/components/icon/icons/phone-log-icon.cjs +14 -0
  89. package/dist/cjs/components/icon/icons/phone-log-icon.cjs.map +1 -0
  90. package/dist/cjs/components/icon/icons/printer3d-icon.cjs +14 -0
  91. package/dist/cjs/components/icon/icons/printer3d-icon.cjs.map +1 -0
  92. package/dist/cjs/components/icon/icons/rugby-ball-icon.cjs +14 -0
  93. package/dist/cjs/components/icon/icons/rugby-ball-icon.cjs.map +1 -0
  94. package/dist/cjs/components/icon/icons/scratch-blocks-icon.cjs +14 -0
  95. package/dist/cjs/components/icon/icons/scratch-blocks-icon.cjs.map +1 -0
  96. package/dist/cjs/components/icon/icons/screw-icon.cjs +14 -0
  97. package/dist/cjs/components/icon/icons/screw-icon.cjs.map +1 -0
  98. package/dist/cjs/components/icon/icons/server-nas-icon.cjs +14 -0
  99. package/dist/cjs/components/icon/icons/server-nas-icon.cjs.map +1 -0
  100. package/dist/cjs/components/icon/icons/shield-house-icon.cjs +14 -0
  101. package/dist/cjs/components/icon/icons/shield-house-icon.cjs.map +1 -0
  102. package/dist/cjs/components/icon/icons/sixteenth-notes-icon.cjs +14 -0
  103. package/dist/cjs/components/icon/icons/sixteenth-notes-icon.cjs.map +1 -0
  104. package/dist/cjs/components/icon/icons/text-align-justify-center-icon.cjs +14 -0
  105. package/dist/cjs/components/icon/icons/text-align-justify-center-icon.cjs.map +1 -0
  106. package/dist/cjs/components/icon/icons/text-align-justify-end-icon.cjs +14 -0
  107. package/dist/cjs/components/icon/icons/text-align-justify-end-icon.cjs.map +1 -0
  108. package/dist/cjs/components/icon/icons/text-align-justify-start-icon.cjs +14 -0
  109. package/dist/cjs/components/icon/icons/text-align-justify-start-icon.cjs.map +1 -0
  110. package/dist/cjs/components/icon/icons/user-round-star-icon.cjs +14 -0
  111. package/dist/cjs/components/icon/icons/user-round-star-icon.cjs.map +1 -0
  112. package/dist/cjs/components/icon/icons/users-collaboration-icon.cjs +14 -0
  113. package/dist/cjs/components/icon/icons/users-collaboration-icon.cjs.map +1 -0
  114. package/dist/cjs/components/icon/icons/users-round-collaboration-icon.cjs +14 -0
  115. package/dist/cjs/components/icon/icons/users-round-collaboration-icon.cjs.map +1 -0
  116. package/dist/cjs/components/icon/icons/wifi-lock-icon.cjs +14 -0
  117. package/dist/cjs/components/icon/icons/wifi-lock-icon.cjs.map +1 -0
  118. package/dist/cjs/components/icon/icons/wind-arrow-up-icon.cjs +14 -0
  119. package/dist/cjs/components/icon/icons/wind-arrow-up-icon.cjs.map +1 -0
  120. package/dist/cjs/components/icon/index.cjs +82 -8
  121. package/dist/cjs/components/kbd/kbd.style.cjs +2 -1
  122. package/dist/cjs/components/kbd/kbd.style.cjs.map +1 -1
  123. package/dist/cjs/components/list/list.cjs +5 -3
  124. package/dist/cjs/components/list/list.cjs.map +1 -1
  125. package/dist/cjs/components/marquee/index.cjs +21 -0
  126. package/dist/cjs/components/marquee/marquee.cjs +74 -0
  127. package/dist/cjs/components/marquee/marquee.cjs.map +1 -0
  128. package/dist/cjs/components/marquee/marquee.style.cjs +121 -0
  129. package/dist/cjs/components/marquee/marquee.style.cjs.map +1 -0
  130. package/dist/cjs/components/marquee/namespace.cjs +26 -0
  131. package/dist/cjs/components/marquee/namespace.cjs.map +1 -0
  132. package/dist/cjs/components/marquee/use-marquee.cjs +183 -0
  133. package/dist/cjs/components/marquee/use-marquee.cjs.map +1 -0
  134. package/dist/cjs/components/native-accordion/native-accordion.cjs +4 -3
  135. package/dist/cjs/components/native-accordion/native-accordion.cjs.map +1 -1
  136. package/dist/cjs/components/prose/index.cjs +7 -0
  137. package/dist/cjs/components/prose/prose.cjs +17 -0
  138. package/dist/cjs/components/prose/prose.cjs.map +1 -0
  139. package/dist/cjs/components/prose/prose.style.cjs +205 -0
  140. package/dist/cjs/components/prose/prose.style.cjs.map +1 -0
  141. package/dist/cjs/components/reorder/use-reorder.cjs +2 -1
  142. package/dist/cjs/components/reorder/use-reorder.cjs.map +1 -1
  143. package/dist/cjs/components/resizable/index.cjs +6 -1
  144. package/dist/cjs/components/resizable/namespace.cjs +6 -1
  145. package/dist/cjs/components/resizable/use-resizable.cjs +6 -1
  146. package/dist/cjs/components/select/use-select.cjs.map +1 -1
  147. package/dist/cjs/components/sidebar/sidebar.cjs +4 -3
  148. package/dist/cjs/components/sidebar/sidebar.cjs.map +1 -1
  149. package/dist/cjs/components/slot/slot.cjs +10 -9
  150. package/dist/cjs/components/slot/slot.cjs.map +1 -1
  151. package/dist/cjs/components/stack/stack.cjs +2 -1
  152. package/dist/cjs/components/stack/stack.cjs.map +1 -1
  153. package/dist/cjs/components/table/index.cjs +6 -1
  154. package/dist/cjs/components/toggle/toggle.style.cjs +2 -0
  155. package/dist/cjs/components/toggle/toggle.style.cjs.map +1 -1
  156. package/dist/cjs/components/tree/tree.cjs +5 -3
  157. package/dist/cjs/components/tree/tree.cjs.map +1 -1
  158. package/dist/cjs/core/components/create-component.cjs +1 -1
  159. package/dist/cjs/core/components/create-component.cjs.map +1 -1
  160. package/dist/cjs/core/css/conditions.cjs +4 -4
  161. package/dist/cjs/core/css/conditions.cjs.map +1 -1
  162. package/dist/cjs/core/css/styles.cjs.map +1 -1
  163. package/dist/cjs/hooks/use-focus/index.cjs +7 -14
  164. package/dist/cjs/hooks/use-focus/index.cjs.map +1 -1
  165. package/dist/cjs/index.cjs +306 -112
  166. package/dist/cjs/index.cjs.map +1 -1
  167. package/dist/cjs/utils/children.cjs +22 -9
  168. package/dist/cjs/utils/children.cjs.map +1 -1
  169. package/dist/cjs/utils/index.cjs +4 -0
  170. package/dist/esm/components/accordion/accordion.js +5 -4
  171. package/dist/esm/components/accordion/accordion.js.map +1 -1
  172. package/dist/esm/components/aspect-ratio/aspect-ratio.js +2 -2
  173. package/dist/esm/components/aspect-ratio/aspect-ratio.js.map +1 -1
  174. package/dist/esm/components/blockquote/blockquote.style.js +1 -1
  175. package/dist/esm/components/blockquote/blockquote.style.js.map +1 -1
  176. package/dist/esm/components/box/index.js +1 -2
  177. package/dist/esm/components/breadcrumb/use-breadcrumb.js +2 -1
  178. package/dist/esm/components/breadcrumb/use-breadcrumb.js.map +1 -1
  179. package/dist/esm/components/bubble/bubble.js +157 -0
  180. package/dist/esm/components/bubble/bubble.js.map +1 -0
  181. package/dist/esm/components/bubble/bubble.style.js +144 -0
  182. package/dist/esm/components/bubble/bubble.style.js.map +1 -0
  183. package/dist/esm/components/bubble/index.js +4 -0
  184. package/dist/esm/components/bubble/namespace.js +16 -0
  185. package/dist/esm/components/bubble/namespace.js.map +1 -0
  186. package/dist/esm/components/button/button.js +11 -8
  187. package/dist/esm/components/button/button.js.map +1 -1
  188. package/dist/esm/components/calendar/calendar.js +3 -1
  189. package/dist/esm/components/calendar/calendar.js.map +1 -1
  190. package/dist/esm/components/calendar/use-calendar.js +12 -7
  191. package/dist/esm/components/calendar/use-calendar.js.map +1 -1
  192. package/dist/esm/components/client-only/index.js +1 -2
  193. package/dist/esm/components/code/code.style.js +2 -1
  194. package/dist/esm/components/code/code.style.js.map +1 -1
  195. package/dist/esm/components/date-picker/use-date-picker.js +10 -10
  196. package/dist/esm/components/date-picker/use-date-picker.js.map +1 -1
  197. package/dist/esm/components/drawer/drawer.js +13 -2
  198. package/dist/esm/components/drawer/drawer.js.map +1 -1
  199. package/dist/esm/components/drawer/index.js +2 -2
  200. package/dist/esm/components/drawer/namespace.js +3 -2
  201. package/dist/esm/components/drawer/namespace.js.map +1 -1
  202. package/dist/esm/components/drawer/use-drawer.js +140 -12
  203. package/dist/esm/components/drawer/use-drawer.js.map +1 -1
  204. package/dist/esm/components/field/field.js +5 -4
  205. package/dist/esm/components/field/field.js.map +1 -1
  206. package/dist/esm/components/file-input/use-file-input.js.map +1 -1
  207. package/dist/esm/components/focus-lock/index.js +1 -2
  208. package/dist/esm/components/for/index.js +1 -2
  209. package/dist/esm/components/icon/icons/armenian-dram-icon.js +14 -0
  210. package/dist/esm/components/icon/icons/armenian-dram-icon.js.map +1 -0
  211. package/dist/esm/components/icon/icons/bangladeshi-taka-icon.js +14 -0
  212. package/dist/esm/components/icon/icons/bangladeshi-taka-icon.js.map +1 -0
  213. package/dist/esm/components/icon/icons/belarusian-ruble-icon.js +14 -0
  214. package/dist/esm/components/icon/icons/belarusian-ruble-icon.js.map +1 -0
  215. package/dist/esm/components/icon/icons/calendar-chevrons-left-icon.js +14 -0
  216. package/dist/esm/components/icon/icons/calendar-chevrons-left-icon.js.map +1 -0
  217. package/dist/esm/components/icon/icons/certificate-icon.js +14 -0
  218. package/dist/esm/components/icon/icons/certificate-icon.js.map +1 -0
  219. package/dist/esm/components/icon/icons/circle-fading-play-icon.js +14 -0
  220. package/dist/esm/components/icon/icons/circle-fading-play-icon.js.map +1 -0
  221. package/dist/esm/components/icon/icons/cpu-ai-icon.js +14 -0
  222. package/dist/esm/components/icon/icons/cpu-ai-icon.js.map +1 -0
  223. package/dist/esm/components/icon/icons/door-closed-cog-icon.js +14 -0
  224. package/dist/esm/components/icon/icons/door-closed-cog-icon.js.map +1 -0
  225. package/dist/esm/components/icon/icons/eighth-note-icon.js +14 -0
  226. package/dist/esm/components/icon/icons/eighth-note-icon.js.map +1 -0
  227. package/dist/esm/components/icon/icons/eighth-notes-icon.js +14 -0
  228. package/dist/esm/components/icon/icons/eighth-notes-icon.js.map +1 -0
  229. package/dist/esm/components/icon/icons/folder-user-icon.js +14 -0
  230. package/dist/esm/components/icon/icons/folder-user-icon.js.map +1 -0
  231. package/dist/esm/components/icon/icons/folder-users-icon.js +14 -0
  232. package/dist/esm/components/icon/icons/folder-users-icon.js.map +1 -0
  233. package/dist/esm/components/icon/icons/graph-star-icon.js +14 -0
  234. package/dist/esm/components/icon/icons/graph-star-icon.js.map +1 -0
  235. package/dist/esm/components/icon/icons/groceries-icon.js +14 -0
  236. package/dist/esm/components/icon/icons/groceries-icon.js.map +1 -0
  237. package/dist/esm/components/icon/icons/guitar-electric-icon.js +14 -0
  238. package/dist/esm/components/icon/icons/guitar-electric-icon.js.map +1 -0
  239. package/dist/esm/components/icon/icons/half-note-icon.js +14 -0
  240. package/dist/esm/components/icon/icons/half-note-icon.js.map +1 -0
  241. package/dist/esm/components/icon/icons/handle-bottom-right-icon.js +14 -0
  242. package/dist/esm/components/icon/icons/handle-bottom-right-icon.js.map +1 -0
  243. package/dist/esm/components/icon/icons/hiking-stick-icon.js +14 -0
  244. package/dist/esm/components/icon/icons/hiking-stick-icon.js.map +1 -0
  245. package/dist/esm/components/icon/icons/index.js +83 -9
  246. package/dist/esm/components/icon/icons/index.js.map +1 -1
  247. package/dist/esm/components/icon/icons/kazakh-tenge-icon.js +14 -0
  248. package/dist/esm/components/icon/icons/kazakh-tenge-icon.js.map +1 -0
  249. package/dist/esm/components/icon/icons/layout-grid-circles-icon.js +14 -0
  250. package/dist/esm/components/icon/icons/layout-grid-circles-icon.js.map +1 -0
  251. package/dist/esm/components/icon/icons/lens-icon.js +14 -0
  252. package/dist/esm/components/icon/icons/lens-icon.js.map +1 -0
  253. package/dist/esm/components/icon/icons/letters-icon.js +14 -0
  254. package/dist/esm/components/icon/icons/letters-icon.js.map +1 -0
  255. package/dist/esm/components/icon/icons/mail-dot-icon.js +14 -0
  256. package/dist/esm/components/icon/icons/mail-dot-icon.js.map +1 -0
  257. package/dist/esm/components/icon/icons/message-circle-text-icon.js +14 -0
  258. package/dist/esm/components/icon/icons/message-circle-text-icon.js.map +1 -0
  259. package/dist/esm/components/icon/icons/perfume-bottle-icon.js +14 -0
  260. package/dist/esm/components/icon/icons/perfume-bottle-icon.js.map +1 -0
  261. package/dist/esm/components/icon/icons/phone-log-icon.js +14 -0
  262. package/dist/esm/components/icon/icons/phone-log-icon.js.map +1 -0
  263. package/dist/esm/components/icon/icons/printer3d-icon.js +14 -0
  264. package/dist/esm/components/icon/icons/printer3d-icon.js.map +1 -0
  265. package/dist/esm/components/icon/icons/rugby-ball-icon.js +14 -0
  266. package/dist/esm/components/icon/icons/rugby-ball-icon.js.map +1 -0
  267. package/dist/esm/components/icon/icons/scratch-blocks-icon.js +14 -0
  268. package/dist/esm/components/icon/icons/scratch-blocks-icon.js.map +1 -0
  269. package/dist/esm/components/icon/icons/screw-icon.js +14 -0
  270. package/dist/esm/components/icon/icons/screw-icon.js.map +1 -0
  271. package/dist/esm/components/icon/icons/server-nas-icon.js +14 -0
  272. package/dist/esm/components/icon/icons/server-nas-icon.js.map +1 -0
  273. package/dist/esm/components/icon/icons/shield-house-icon.js +14 -0
  274. package/dist/esm/components/icon/icons/shield-house-icon.js.map +1 -0
  275. package/dist/esm/components/icon/icons/sixteenth-notes-icon.js +14 -0
  276. package/dist/esm/components/icon/icons/sixteenth-notes-icon.js.map +1 -0
  277. package/dist/esm/components/icon/icons/text-align-justify-center-icon.js +14 -0
  278. package/dist/esm/components/icon/icons/text-align-justify-center-icon.js.map +1 -0
  279. package/dist/esm/components/icon/icons/text-align-justify-end-icon.js +14 -0
  280. package/dist/esm/components/icon/icons/text-align-justify-end-icon.js.map +1 -0
  281. package/dist/esm/components/icon/icons/text-align-justify-start-icon.js +14 -0
  282. package/dist/esm/components/icon/icons/text-align-justify-start-icon.js.map +1 -0
  283. package/dist/esm/components/icon/icons/user-round-star-icon.js +14 -0
  284. package/dist/esm/components/icon/icons/user-round-star-icon.js.map +1 -0
  285. package/dist/esm/components/icon/icons/users-collaboration-icon.js +14 -0
  286. package/dist/esm/components/icon/icons/users-collaboration-icon.js.map +1 -0
  287. package/dist/esm/components/icon/icons/users-round-collaboration-icon.js +14 -0
  288. package/dist/esm/components/icon/icons/users-round-collaboration-icon.js.map +1 -0
  289. package/dist/esm/components/icon/icons/wifi-lock-icon.js +14 -0
  290. package/dist/esm/components/icon/icons/wifi-lock-icon.js.map +1 -0
  291. package/dist/esm/components/icon/icons/wind-arrow-up-icon.js +14 -0
  292. package/dist/esm/components/icon/icons/wind-arrow-up-icon.js.map +1 -0
  293. package/dist/esm/components/icon/index.js +42 -5
  294. package/dist/esm/components/kbd/kbd.style.js +2 -1
  295. package/dist/esm/components/kbd/kbd.style.js.map +1 -1
  296. package/dist/esm/components/list/list.js +5 -3
  297. package/dist/esm/components/list/list.js.map +1 -1
  298. package/dist/esm/components/marquee/index.js +5 -0
  299. package/dist/esm/components/marquee/marquee.js +69 -0
  300. package/dist/esm/components/marquee/marquee.js.map +1 -0
  301. package/dist/esm/components/marquee/marquee.style.js +122 -0
  302. package/dist/esm/components/marquee/marquee.style.js.map +1 -0
  303. package/dist/esm/components/marquee/namespace.js +15 -0
  304. package/dist/esm/components/marquee/namespace.js.map +1 -0
  305. package/dist/esm/components/marquee/use-marquee.js +181 -0
  306. package/dist/esm/components/marquee/use-marquee.js.map +1 -0
  307. package/dist/esm/components/native-accordion/native-accordion.js +5 -4
  308. package/dist/esm/components/native-accordion/native-accordion.js.map +1 -1
  309. package/dist/esm/components/picture/index.js +1 -2
  310. package/dist/esm/components/portal/index.js +1 -2
  311. package/dist/esm/components/prose/index.js +3 -0
  312. package/dist/esm/components/prose/prose.js +15 -0
  313. package/dist/esm/components/prose/prose.js.map +1 -0
  314. package/dist/esm/components/prose/prose.style.js +205 -0
  315. package/dist/esm/components/prose/prose.style.js.map +1 -0
  316. package/dist/esm/components/reorder/use-reorder.js +2 -1
  317. package/dist/esm/components/reorder/use-reorder.js.map +1 -1
  318. package/dist/esm/components/select/use-select.js.map +1 -1
  319. package/dist/esm/components/show/index.js +1 -2
  320. package/dist/esm/components/sidebar/sidebar.js +5 -4
  321. package/dist/esm/components/sidebar/sidebar.js.map +1 -1
  322. package/dist/esm/components/slot/index.js +1 -2
  323. package/dist/esm/components/slot/slot.js +11 -10
  324. package/dist/esm/components/slot/slot.js.map +1 -1
  325. package/dist/esm/components/stack/stack.js +2 -1
  326. package/dist/esm/components/stack/stack.js.map +1 -1
  327. package/dist/esm/components/table/index.js +1 -2
  328. package/dist/esm/components/tip/index.js +1 -2
  329. package/dist/esm/components/toggle/toggle.style.js +2 -0
  330. package/dist/esm/components/toggle/toggle.style.js.map +1 -1
  331. package/dist/esm/components/tree/tree.js +5 -3
  332. package/dist/esm/components/tree/tree.js.map +1 -1
  333. package/dist/esm/core/components/create-component.js +1 -1
  334. package/dist/esm/core/components/create-component.js.map +1 -1
  335. package/dist/esm/core/css/conditions.js +4 -4
  336. package/dist/esm/core/css/conditions.js.map +1 -1
  337. package/dist/esm/core/css/styles.js.map +1 -1
  338. package/dist/esm/hooks/use-focus/index.js +8 -15
  339. package/dist/esm/hooks/use-focus/index.js.map +1 -1
  340. package/dist/esm/index.js +215 -105
  341. package/dist/esm/index.js.map +1 -1
  342. package/dist/esm/providers/ui-provider/index.js +1 -2
  343. package/dist/esm/utils/children.js +22 -11
  344. package/dist/esm/utils/children.js.map +1 -1
  345. package/dist/esm/utils/index.js +4 -2
  346. package/dist/types/components/alert/alert.d.ts +0 -1
  347. package/dist/types/components/alpha-slider/alpha-slider.d.ts +0 -1
  348. package/dist/types/components/autocomplete/autocomplete.d.ts +0 -1
  349. package/dist/types/components/breadcrumb/use-breadcrumb.d.ts +1 -1
  350. package/dist/types/components/bubble/bubble.d.ts +89 -0
  351. package/dist/types/components/bubble/bubble.style.d.ts +79 -0
  352. package/dist/types/components/bubble/index.d.ts +4 -0
  353. package/dist/types/components/bubble/namespace.d.ts +7 -0
  354. package/dist/types/components/button/button.d.ts +0 -1
  355. package/dist/types/components/calendar/calendar.d.ts +0 -1
  356. package/dist/types/components/calendar/use-calendar.d.ts +4 -3
  357. package/dist/types/components/color-picker/color-picker.d.ts +0 -3
  358. package/dist/types/components/color-selector/color-selector.d.ts +0 -1
  359. package/dist/types/components/color-selector/use-color-selector.d.ts +1 -0
  360. package/dist/types/components/date-picker/date-picker.d.ts +0 -3
  361. package/dist/types/components/date-picker/use-date-picker.d.ts +1 -0
  362. package/dist/types/components/drawer/drawer.d.ts +2 -0
  363. package/dist/types/components/drawer/index.d.ts +2 -2
  364. package/dist/types/components/drawer/namespace.d.ts +3 -3
  365. package/dist/types/components/drawer/use-drawer.d.ts +9 -2
  366. package/dist/types/components/dropzone/dropzone.d.ts +0 -1
  367. package/dist/types/components/field/use-field-props.d.ts +1 -1
  368. package/dist/types/components/hue-slider/hue-slider.d.ts +0 -1
  369. package/dist/types/components/icon/icons/armenian-dram-icon.d.ts +12 -0
  370. package/dist/types/components/icon/icons/bangladeshi-taka-icon.d.ts +12 -0
  371. package/dist/types/components/icon/icons/belarusian-ruble-icon.d.ts +12 -0
  372. package/dist/types/components/icon/icons/calendar-chevrons-left-icon.d.ts +12 -0
  373. package/dist/types/components/icon/icons/certificate-icon.d.ts +12 -0
  374. package/dist/types/components/icon/icons/circle-fading-play-icon.d.ts +12 -0
  375. package/dist/types/components/icon/icons/cpu-ai-icon.d.ts +12 -0
  376. package/dist/types/components/icon/icons/door-closed-cog-icon.d.ts +12 -0
  377. package/dist/types/components/icon/icons/eighth-note-icon.d.ts +12 -0
  378. package/dist/types/components/icon/icons/eighth-notes-icon.d.ts +12 -0
  379. package/dist/types/components/icon/icons/folder-user-icon.d.ts +12 -0
  380. package/dist/types/components/icon/icons/folder-users-icon.d.ts +12 -0
  381. package/dist/types/components/icon/icons/graph-star-icon.d.ts +12 -0
  382. package/dist/types/components/icon/icons/groceries-icon.d.ts +12 -0
  383. package/dist/types/components/icon/icons/guitar-electric-icon.d.ts +12 -0
  384. package/dist/types/components/icon/icons/half-note-icon.d.ts +12 -0
  385. package/dist/types/components/icon/icons/handle-bottom-right-icon.d.ts +12 -0
  386. package/dist/types/components/icon/icons/hiking-stick-icon.d.ts +12 -0
  387. package/dist/types/components/icon/icons/index.d.ts +43 -6
  388. package/dist/types/components/icon/icons/index.type.d.ts +1 -1
  389. package/dist/types/components/icon/icons/kazakh-tenge-icon.d.ts +12 -0
  390. package/dist/types/components/icon/icons/layout-grid-circles-icon.d.ts +12 -0
  391. package/dist/types/components/icon/icons/lens-icon.d.ts +12 -0
  392. package/dist/types/components/icon/icons/letters-icon.d.ts +12 -0
  393. package/dist/types/components/icon/icons/mail-dot-icon.d.ts +12 -0
  394. package/dist/types/components/icon/icons/message-circle-text-icon.d.ts +12 -0
  395. package/dist/types/components/icon/icons/perfume-bottle-icon.d.ts +12 -0
  396. package/dist/types/components/icon/icons/phone-log-icon.d.ts +12 -0
  397. package/dist/types/components/icon/icons/printer3d-icon.d.ts +12 -0
  398. package/dist/types/components/icon/icons/rugby-ball-icon.d.ts +12 -0
  399. package/dist/types/components/icon/icons/scratch-blocks-icon.d.ts +12 -0
  400. package/dist/types/components/icon/icons/{music-icon.d.ts → screw-icon.d.ts} +4 -4
  401. package/dist/types/components/icon/icons/server-nas-icon.d.ts +12 -0
  402. package/dist/types/components/icon/icons/shield-house-icon.d.ts +12 -0
  403. package/dist/types/components/icon/icons/sixteenth-notes-icon.d.ts +12 -0
  404. package/dist/types/components/icon/icons/text-align-justify-center-icon.d.ts +12 -0
  405. package/dist/types/components/icon/icons/text-align-justify-end-icon.d.ts +12 -0
  406. package/dist/types/components/icon/icons/text-align-justify-start-icon.d.ts +12 -0
  407. package/dist/types/components/icon/icons/user-round-star-icon.d.ts +12 -0
  408. package/dist/types/components/icon/icons/users-collaboration-icon.d.ts +12 -0
  409. package/dist/types/components/icon/icons/users-round-collaboration-icon.d.ts +12 -0
  410. package/dist/types/components/icon/icons/wifi-lock-icon.d.ts +12 -0
  411. package/dist/types/components/icon/icons/wind-arrow-up-icon.d.ts +12 -0
  412. package/dist/types/components/icon/index.d.ts +42 -5
  413. package/dist/types/components/loading/loading-provider.d.ts +1 -0
  414. package/dist/types/components/loading/use-loading-component.d.ts +0 -1
  415. package/dist/types/components/marquee/index.d.ts +5 -0
  416. package/dist/types/components/marquee/marquee.d.ts +50 -0
  417. package/dist/types/components/marquee/marquee.style.d.ts +8 -0
  418. package/dist/types/components/marquee/namespace.d.ts +8 -0
  419. package/dist/types/components/marquee/use-marquee.d.ts +127 -0
  420. package/dist/types/components/menu/menu.d.ts +0 -1
  421. package/dist/types/components/motion/factory.d.ts +1 -0
  422. package/dist/types/components/motion/index.type.d.ts +4 -3
  423. package/dist/types/components/native-select/native-select.d.ts +0 -1
  424. package/dist/types/components/native-select/use-native-select.d.ts +1 -0
  425. package/dist/types/components/notice/use-notice.d.ts +0 -1
  426. package/dist/types/components/number-input/number-input.d.ts +0 -1
  427. package/dist/types/components/pagination/pagination.d.ts +0 -1
  428. package/dist/types/components/password-input/password-input.d.ts +0 -1
  429. package/dist/types/components/prose/index.d.ts +3 -0
  430. package/dist/types/components/prose/prose.d.ts +17 -0
  431. package/dist/types/components/prose/prose.style.d.ts +121 -0
  432. package/dist/types/components/rating/rating.d.ts +1 -0
  433. package/dist/types/components/reorder/use-reorder.d.ts +1 -1
  434. package/dist/types/components/select/select.d.ts +0 -1
  435. package/dist/types/components/sidebar/sidebar.d.ts +0 -2
  436. package/dist/types/components/sidebar/sidebar.style.d.ts +1 -0
  437. package/dist/types/components/snacks/use-snacks.d.ts +1 -1
  438. package/dist/types/components/table/table.d.ts +0 -1
  439. package/dist/types/components/toggle/toggle.d.ts +6 -0
  440. package/dist/types/components/toggle/toggle.style.d.ts +2 -0
  441. package/dist/types/components/tree/tree.d.ts +0 -1
  442. package/dist/types/core/components/create-component.d.ts +1 -0
  443. package/dist/types/core/components/index.type.d.ts +4 -2
  444. package/dist/types/core/components/props.d.ts +1 -0
  445. package/dist/types/core/components/use-component-style.d.ts +1 -0
  446. package/dist/types/core/css/conditions.d.ts +10 -10
  447. package/dist/types/core/css/styles.d.ts +36 -16
  448. package/dist/types/core/system/breakpoint.d.ts +1 -0
  449. package/dist/types/core/system/config.d.ts +1 -0
  450. package/dist/types/core/system/create-system.d.ts +1 -0
  451. package/dist/types/core/system/factory.d.ts +1 -0
  452. package/dist/types/core/system/index.type.d.ts +1 -0
  453. package/dist/types/core/system/system-provider.d.ts +1 -0
  454. package/dist/types/hooks/use-async/index.d.ts +1 -0
  455. package/dist/types/hooks/use-async-callback/index.d.ts +1 -1
  456. package/dist/types/hooks/use-controllable-state/index.d.ts +1 -0
  457. package/dist/types/hooks/use-descendants/index.d.ts +1 -0
  458. package/dist/types/hooks/use-eye-dropper/index.d.ts +1 -0
  459. package/dist/types/hooks/use-popper/index.d.ts +1 -0
  460. package/dist/types/hooks/use-window-event/index.d.ts +1 -0
  461. package/dist/types/index.d.ts +103 -54
  462. package/dist/types/providers/i18n-provider/i18n-cache.d.ts +1 -0
  463. package/dist/types/providers/i18n-provider/icu.type.d.ts +1 -0
  464. package/dist/types/utils/children.d.ts +11 -2
  465. package/dist/types/utils/context.d.ts +1 -0
  466. package/dist/types/utils/dom.d.ts +1 -0
  467. package/dist/types/utils/index.d.ts +3 -3
  468. package/dist/types/utils/store.d.ts +1 -0
  469. package/package.json +21 -18
  470. package/dist/cjs/components/icon/icons/music-icon.cjs +0 -14
  471. package/dist/cjs/components/icon/icons/music-icon.cjs.map +0 -1
  472. package/dist/cjs/components/icon/icons/music2-icon.cjs +0 -14
  473. package/dist/cjs/components/icon/icons/music2-icon.cjs.map +0 -1
  474. package/dist/cjs/components/icon/icons/music3-icon.cjs +0 -14
  475. package/dist/cjs/components/icon/icons/music3-icon.cjs.map +0 -1
  476. package/dist/cjs/components/icon/icons/music4-icon.cjs +0 -14
  477. package/dist/cjs/components/icon/icons/music4-icon.cjs.map +0 -1
  478. package/dist/esm/components/icon/icons/music-icon.js +0 -14
  479. package/dist/esm/components/icon/icons/music-icon.js.map +0 -1
  480. package/dist/esm/components/icon/icons/music2-icon.js +0 -14
  481. package/dist/esm/components/icon/icons/music2-icon.js.map +0 -1
  482. package/dist/esm/components/icon/icons/music3-icon.js +0 -14
  483. package/dist/esm/components/icon/icons/music3-icon.js.map +0 -1
  484. package/dist/esm/components/icon/icons/music4-icon.js +0 -14
  485. package/dist/esm/components/icon/icons/music4-icon.js.map +0 -1
  486. package/dist/types/components/icon/icons/music2-icon.d.ts +0 -12
  487. package/dist/types/components/icon/icons/music3-icon.d.ts +0 -12
  488. package/dist/types/components/icon/icons/music4-icon.d.ts +0 -12
@@ -1 +1 @@
1
- {"version":3,"file":"use-date-picker.cjs","names":["DEFAULT_MAX_DATE","DEFAULT_MIN_DATE","useEnvironment","useI18n","useFieldProps","useDateTimeFormat","useMemo","useCalendarProps","useRef","useState","useControllableState","getAdjustedMonth","useCallback","isBeforeDate","isAfterDate","useCombobox","updateMaybeDateValue","isValidElement","cloneElement","isComposing","isIncludeDates","mergeRefs","visuallyHiddenAttributes","runKeyAction"],"sources":["../../../../src/components/date-picker/use-date-picker.tsx"],"sourcesContent":["\"use client\"\n\nimport type {\n ChangeEvent,\n FocusEvent,\n KeyboardEvent,\n MouseEvent,\n ReactNode,\n} from \"react\"\nimport type { HTMLProps, HTMLRefAttributes, PropGetter } from \"../../core\"\nimport type { UseComboboxProps } from \"../../hooks/use-combobox\"\nimport type { Dict } from \"../../utils\"\nimport type {\n CalendarFormat,\n MaybeDateValue,\n UseCalendarProps,\n} from \"../calendar\"\nimport type { FieldProps } from \"../field\"\nimport dayjs from \"dayjs\"\nimport {\n cloneElement,\n isValidElement,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\"\nimport { useEnvironment } from \"../../core\"\nimport { useCombobox } from \"../../hooks/use-combobox\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n cast,\n contains,\n dataAttr,\n focusTransfer,\n handlerAll,\n isActiveElement,\n isArray,\n isComposing,\n isDate,\n isNumber,\n isObject,\n mergeRefs,\n runIfFn,\n runKeyAction,\n useUpdateEffect,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport {\n DEFAULT_MAX_DATE,\n DEFAULT_MIN_DATE,\n getAdjustedMonth,\n isAfterDate,\n isBeforeDate,\n isIncludeDates,\n updateMaybeDateValue,\n useCalendarProps,\n} from \"../calendar\"\nimport { useFieldProps } from \"../field\"\nimport { useDateTimeFormat } from \"../format\"\n\nexport interface DatePickerFormat extends CalendarFormat {\n input?: Intl.DateTimeFormatOptions | null\n}\n\ntype InputAlign = \"end\" | \"start\"\ntype MaybeInputValue<Range extends boolean = false> = Range extends true\n ? { end?: string; start?: string }\n : string | undefined\n\ninterface DatePickerRenderProps {\n count: number\n date: Date\n focused: boolean\n index: number\n separator: string\n value: string\n onClear: () => void\n max?: number\n}\n\nexport interface DatePickerRender {\n (props: DatePickerRenderProps): ReactNode\n}\n\nconst defaultRender: DatePickerRender = ({\n count,\n focused,\n index,\n max,\n separator,\n value,\n}) => {\n const last = count - 1 === index\n\n return (\n <span style={{ marginInlineEnd: \"var(--gap)\" }}>\n {value}\n {((!isNumber(max) || count < max) && focused) || !last ? separator : null}\n </span>\n )\n}\n\nexport interface UseDatePickerProps<\n Multiple extends boolean = false,\n Range extends boolean = false,\n>\n extends\n Omit<UseCalendarProps<Multiple, Range>, \"format\" | \"ref\">,\n Omit<\n UseComboboxProps,\n \"defaultValue\" | \"initialFocusValue\" | \"onChange\" | \"ref\" | \"value\"\n >,\n HTMLRefAttributes<\"input\">,\n FieldProps {\n /**\n * If `true`, allows input.\n *\n * @default true\n */\n allowInput?: boolean\n /**\n * If `true`, allows input of dates beyond the `minDate` and `maxDate` restrictions.\n *\n * @default true\n */\n allowInputBeyond?: boolean\n /**\n * If `true`, the date picker will be closed when the input value changes.\n *\n * @default false\n */\n closeOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * The initial value of the input.\n */\n defaultInputValue?: MaybeInputValue<Range>\n /**\n * If `true`, the input will be focused when the clear icon is clicked.\n *\n * @default true\n */\n focusOnClear?: boolean\n /**\n * The format used for conversion.\n * Check the docs to see the format of possible modifiers you can pass.\n *\n * @see https://day.js.org/docs/en/display/format#list-of-localized-formats\n */\n format?: DatePickerFormat\n /**\n * The `id` attribute of the input element.\n */\n id?: string\n /**\n * The value of the input.\n */\n inputValue?: MaybeInputValue<Range>\n /**\n * The `name` attribute of the input element.\n */\n name?: string\n /**\n * If `true`, the date picker will be opened when the input value changes.\n *\n * @default true\n */\n openOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * If `true`, the date picker will be opened when the input is focused.\n *\n * @default true\n */\n openOnFocus?: boolean\n /**\n * The pattern used to check the input element.\n */\n pattern?: RegExp\n /**\n * The placeholder for date picker.\n */\n placeholder?: string\n /**\n * The visual separator between each value.\n *\n * @default ','\n */\n separator?: string\n /**\n * The callback invoked when input value state changes.\n */\n onInputChange?: (value: MaybeInputValue<Range>) => void\n /**\n * Function that converts the input value to Date type.\n */\n parseDate?: (value: string) => Date | undefined\n /**\n * The function to render the selected date.\n */\n render?: (props: DatePickerRenderProps) => ReactNode\n}\n\nexport const useDatePicker = <\n Multiple extends boolean = false,\n Range extends boolean = false,\n>({\n maxDate = DEFAULT_MAX_DATE,\n minDate = DEFAULT_MIN_DATE,\n ...props\n}: UseDatePickerProps<Multiple, Range> = {}) => {\n if (dayjs(minDate).isAfter(dayjs(maxDate))) maxDate = minDate\n\n const { getDocument } = useEnvironment()\n const { locale: defaultLocale, t } = useI18n(\"datePicker\")\n const {\n props: {\n id,\n ref,\n name,\n allowInput = true,\n allowInputBeyond = false,\n closeOnChange = false,\n multiple = false,\n closeOnSelect = !multiple,\n defaultInputValue,\n defaultMonth = new Date(),\n range = false,\n defaultValue = (range\n ? { end: undefined, start: undefined }\n : multiple\n ? []\n : undefined) as MaybeDateValue<Multiple, Range>,\n disabled,\n focusOnClear = true,\n format,\n inputValue: inputValueProp,\n locale = defaultLocale,\n max,\n month: monthProp,\n openOnChange = true,\n openOnClick = true,\n openOnFocus = true,\n parseDate,\n pattern,\n placeholder: placeholderProp,\n placement = \"end-start\",\n readOnly,\n render = defaultRender,\n required,\n separator = range ? \"-\" : \",\",\n value: valueProp,\n onChange: onChangeProp,\n onChangeMonth: onChangeMonthProp,\n onInputChange: onInputChangeProp,\n ...computedProps\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const dateTimeFormat = useDateTimeFormat({ locale })\n const { calendarFormat, inputFormat } = useMemo(() => {\n const { input: inputFormat, ...calendarFormat } = format ?? {}\n const defaultInputFormat: Intl.DateTimeFormatOptions = {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n }\n\n return {\n calendarFormat,\n inputFormat:\n inputFormat !== null ? (inputFormat ?? defaultInputFormat) : undefined,\n }\n }, [format])\n const [calendarProps, rest] = useCalendarProps<Multiple, Range>(computedProps)\n const { excludeDate } = calendarProps\n const fieldRef = useRef<HTMLDivElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const startInputRef = useRef<HTMLInputElement>(null)\n const endInputRef = useRef<HTMLInputElement>(null)\n const focusByClickRef = useRef<boolean>(false)\n const [focused, setFocused] = useState(false)\n const [value, setValue] = useControllableState({\n defaultValue: defaultValue as MaybeDateValue<Multiple, Range>,\n value: valueProp,\n onChange: onChangeProp,\n })\n const [month, setMonth] = useControllableState({\n defaultValue: () => {\n let value = defaultMonth\n\n if (dayjs(minDate).isAfter(dayjs(defaultMonth)))\n value = dayjs(minDate).set(\"date\", 1).toDate()\n\n if (valueProp) value = getAdjustedMonth(valueProp, value)\n else if (defaultValue) value = getAdjustedMonth(defaultValue, value)\n\n return value\n },\n value: monthProp,\n onChange: onChangeMonthProp,\n })\n const stringToDate = useCallback(\n (value: string, start: Date = minDate, end: Date = maxDate) => {\n let date = parseDate?.(value)\n\n if (!date && dayjs(value).isValid())\n date = dayjs(value).locale(locale).toDate()\n\n if (date == null) return undefined\n if (excludeDate?.(date)) return undefined\n\n if (!allowInputBeyond) {\n if (isBeforeDate(date, start)) date = start\n if (isAfterDate(date, end)) date = end\n }\n\n return date\n },\n [allowInputBeyond, excludeDate, locale, maxDate, minDate, parseDate],\n )\n const dateToString = useCallback(\n (date?: Date) => {\n if (date == null) return \"\"\n\n return dateTimeFormat(date, inputFormat)\n },\n [dateTimeFormat, inputFormat],\n )\n const [inputValue, setInputValue] = useControllableState({\n defaultValue: () => {\n if (defaultInputValue)\n if (isObject(defaultInputValue)) {\n if (dayjs(defaultInputValue.start).isValid())\n defaultInputValue.start = dateTimeFormat(\n dayjs(defaultInputValue.start).toDate(),\n inputFormat,\n )\n\n if (dayjs(defaultInputValue.end).isValid())\n defaultInputValue.end = dateTimeFormat(\n dayjs(defaultInputValue.end).toDate(),\n inputFormat,\n )\n\n return defaultInputValue\n } else {\n if (dayjs(defaultInputValue).isValid())\n return dateTimeFormat(\n dayjs(defaultInputValue).toDate(),\n inputFormat,\n ) as MaybeInputValue<Range>\n else return defaultInputValue\n }\n else if (isDate(value))\n return dateToString(value) as MaybeInputValue<Range>\n else if (isObject(value) && !isArray(value))\n return {\n end: dateToString(value.end),\n start: dateToString(value.start),\n } as MaybeInputValue<Range>\n else return \"\" as MaybeInputValue<Range>\n },\n value: inputValueProp,\n onChange: onInputChangeProp,\n })\n const {\n interactive,\n open,\n getContentProps: getComboboxContentProps,\n getTriggerProps,\n popoverProps,\n onClose,\n onOpen,\n } = useCombobox({\n disabled,\n matchWidth: false,\n openOnClick: false,\n openOnEnter: !allowInput,\n openOnSpace: !allowInput,\n placement,\n readOnly,\n transferFocus: false,\n ...ariaProps,\n ...dataProps,\n ...eventProps,\n ...rest,\n })\n const children = useMemo<ReactNode>(() => {\n if (!isArray(value)) return null\n\n const count = value.length\n\n return value.map((date, index) => {\n const value = dateToString(date)\n\n const onClear = (ev?: MouseEvent<HTMLElement>) => {\n ev?.preventDefault()\n ev?.stopPropagation()\n\n setValue(\n (prev) =>\n updateMaybeDateValue(date, max)(prev) as MaybeDateValue<\n Multiple,\n Range\n >,\n )\n }\n\n const component = render({\n count,\n date,\n focused,\n index,\n max,\n separator,\n value,\n onClear,\n })\n\n if (isValidElement<Dict>(component))\n return cloneElement(component, { ...component.props, key: index })\n else return component\n })\n }, [dateToString, focused, max, render, separator, setValue, value])\n const { endPlaceholder, startPlaceholder } = useMemo(() => {\n if (range) {\n const startPlaceholder =\n placeholderProp ?? dateTimeFormat(new Date(), inputFormat)\n const endPlaceholder =\n placeholderProp ??\n dateTimeFormat(dayjs().add(1, \"day\").toDate(), inputFormat)\n\n return { endPlaceholder, startPlaceholder }\n } else {\n const placeholder =\n placeholderProp ?? dateTimeFormat(new Date(), inputFormat)\n\n return { endPlaceholder: placeholder, startPlaceholder: placeholder }\n }\n }, [dateTimeFormat, inputFormat, placeholderProp, range])\n\n const onChange = useCallback(\n (value: MaybeDateValue<Multiple, Range>) => {\n setValue(value)\n\n if (isArray(value)) setInputValue(\"\" as MaybeInputValue<Range>)\n else if (isObject(value) && !isDate(value))\n setInputValue({\n end: dateToString(value.end),\n start: dateToString(value.start),\n } as MaybeInputValue<Range>)\n else setInputValue(dateToString(value) as MaybeInputValue<Range>)\n\n if (!closeOnSelect) return\n\n if (isObject(value) && !isArray(value) && !isDate(value)) {\n if (value.end && value.start) onClose()\n } else {\n onClose()\n }\n },\n [setValue, closeOnSelect, setInputValue, dateToString, onClose],\n )\n\n const onInputChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n if (!allowInput) return\n if (isArray(value) && value.length === max) return\n\n if (runIfFn(closeOnChange, ev)) onClose()\n else if (runIfFn(openOnChange, ev)) onOpen()\n\n let inputValue = ev.target.value\n\n if (pattern) inputValue = inputValue.replace(pattern, \"\")\n\n if (isArray(value)) {\n const date = stringToDate(inputValue)\n\n setInputValue(inputValue as MaybeInputValue<Range>)\n\n if (date) setMonth(dayjs(date).set(\"date\", 1).toDate())\n } else if (isObject(value) && !isDate(value)) {\n const align = contains(endInputRef.current, ev.target) ? \"end\" : \"start\"\n const minDate =\n value.start && align === \"end\"\n ? dayjs(value.start).add(1, \"day\").toDate()\n : undefined\n const maxDate =\n value.end && align === \"start\"\n ? dayjs(value.end).subtract(1, \"day\").toDate()\n : undefined\n const date = stringToDate(inputValue, minDate, maxDate)\n\n setInputValue((prev) =>\n isObject(prev)\n ? Object.assign({}, prev, { [align]: inputValue })\n : prev,\n )\n setValue((prev) =>\n isObject(prev) && !isDate(prev) ? { ...prev, [align]: date } : prev,\n )\n } else {\n const date = stringToDate(inputValue)\n\n setInputValue(inputValue as MaybeInputValue<Range>)\n setValue(date as MaybeDateValue<Multiple, Range>)\n }\n },\n [\n allowInput,\n closeOnChange,\n max,\n onClose,\n onOpen,\n openOnChange,\n pattern,\n setInputValue,\n setMonth,\n setValue,\n stringToDate,\n value,\n ],\n )\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLInputElement>) => {\n if (disabled || isComposing(ev)) return\n\n const inputValue = cast<HTMLInputElement>(ev.target).value\n\n runKeyAction(\n ev,\n {\n Backspace: (ev) => {\n if (isArray(value)) {\n if (inputValue.length) return\n\n ev.preventDefault()\n\n setValue((prev) =>\n isArray(prev)\n ? (prev.slice(0, -1) as MaybeDateValue<Multiple, Range>)\n : prev,\n )\n } else if (isObject(value) && !isDate(value)) {\n if (inputValue.length) return\n if (!contains(endInputRef.current, ev.target)) return\n\n ev.preventDefault()\n\n setInputValue({ end: \"\", start: \"\" } as MaybeInputValue<Range>)\n setValue({ end: undefined, start: undefined } as MaybeDateValue<\n Multiple,\n Range\n >)\n\n startInputRef.current?.focus()\n }\n },\n Enter: (ev) => {\n if (!open || !inputValue.length) return\n\n if (isObject(value) && !isArray(value) && !isDate(value)) {\n const align = contains(endInputRef.current, ev.target)\n ? \"end\"\n : \"start\"\n const minDate =\n value.start && align === \"end\"\n ? dayjs(value.start).add(1, \"day\").toDate()\n : undefined\n const maxDate =\n value.end && align === \"start\"\n ? dayjs(value.end).subtract(1, \"day\").toDate()\n : undefined\n const date = stringToDate(inputValue, minDate, maxDate)\n\n if (!date) return\n\n ev.preventDefault()\n\n setInputValue((prev) =>\n isObject(prev)\n ? Object.assign({}, prev, { [align]: dateToString(date) })\n : prev,\n )\n setValue((prev) =>\n isObject(prev) && !isDate(prev)\n ? { ...prev, [align]: date }\n : prev,\n )\n\n if (align === \"start\") endInputRef.current?.focus()\n } else {\n const date = stringToDate(inputValue)\n\n if (!date) return\n\n ev.preventDefault()\n\n if (isArray(value)) {\n setInputValue(\"\" as MaybeInputValue<Range>)\n\n setValue((prev) =>\n isArray(prev) &&\n !isIncludeDates(date, prev) &&\n (!isNumber(max) || prev.length < max)\n ? ([...prev, date] as MaybeDateValue<Multiple, Range>)\n : prev,\n )\n } else {\n setInputValue(dateToString(date) as MaybeInputValue<Range>)\n setValue(date as MaybeDateValue<Multiple, Range>)\n }\n }\n },\n },\n { preventDefault: false },\n )\n },\n [\n dateToString,\n disabled,\n max,\n open,\n setInputValue,\n setValue,\n stringToDate,\n value,\n ],\n )\n\n const onClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n if (!interactive) return\n\n focusByClickRef.current = true\n\n if (allowInput)\n if (isObject(value) && !isArray(value) && !isDate(value))\n if (\n startInputRef.current &&\n contains(startInputRef.current, ev.target)\n ) {\n if (!isActiveElement(startInputRef.current, getDocument()!))\n ev.defaultPrevented = true\n\n startInputRef.current.focus()\n } else if (\n endInputRef.current &&\n contains(endInputRef.current, ev.target)\n ) {\n if (!isActiveElement(endInputRef.current, getDocument()!))\n ev.defaultPrevented = true\n\n endInputRef.current.focus()\n } else {\n startInputRef.current?.focus()\n }\n else startInputRef.current?.focus()\n\n if (openOnClick) onOpen()\n },\n [allowInput, interactive, onOpen, openOnClick, value, getDocument],\n )\n\n const onMouseDown = useCallback(\n (ev: MouseEvent<HTMLDivElement | HTMLInputElement>) => {\n if (!openOnFocus) return\n\n ev.preventDefault()\n ev.stopPropagation()\n },\n [openOnFocus],\n )\n\n const onFieldFocus = useCallback(() => {\n if (allowInput) return\n\n if (openOnFocus) onOpen()\n\n focusByClickRef.current = false\n }, [allowInput, onOpen, openOnFocus])\n\n const onInputFocus = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n ev.preventDefault()\n ev.stopPropagation()\n\n setFocused(true)\n\n if (openOnFocus && !focusByClickRef.current) onOpen()\n\n focusByClickRef.current = false\n },\n [onOpen, openOnFocus],\n )\n\n const onBlur = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n setFocused(false)\n\n if (\n contains(fieldRef.current, ev.relatedTarget) ||\n contains(contentRef.current, ev.relatedTarget)\n )\n ev.preventDefault()\n else if (isArray(value)) setInputValue(\"\" as MaybeInputValue<Range>)\n else if (isObject(value) && !isDate(value))\n setInputValue((prev) =>\n isObject(prev)\n ? ({\n end: dateToString(value.end),\n start: dateToString(value.start),\n } as MaybeInputValue<Range>)\n : prev,\n )\n else setInputValue(dateToString(value) as MaybeInputValue<Range>)\n },\n [dateToString, setInputValue, value],\n )\n\n const onClear = useCallback(() => {\n if (!interactive) return\n\n setValue((prev) => {\n if (isDate(prev)) return undefined as MaybeDateValue<Multiple, Range>\n else if (isArray(prev))\n return [] as unknown as MaybeDateValue<Multiple, Range>\n else if (isObject(prev))\n return { end: undefined, start: undefined } as MaybeDateValue<\n Multiple,\n Range\n >\n else return prev\n })\n\n setInputValue(\n (range ? { end: \"\", start: \"\" } : \"\") as MaybeInputValue<Range>,\n )\n\n if (focusOnClear)\n if (allowInput) startInputRef.current?.focus()\n else fieldRef.current?.focus()\n }, [allowInput, focusOnClear, interactive, range, setInputValue, setValue])\n\n useEffect(() => {\n if (!open) return\n\n return focusTransfer(\n contentRef.current,\n allowInput ? startInputRef.current : fieldRef.current,\n )\n }, [allowInput, open])\n\n useUpdateEffect(() => {\n setMonth((prev) => getAdjustedMonth(value, prev))\n }, [value, range])\n\n useUpdateEffect(() => {\n if (isArray(valueProp)) return\n\n if (isObject(valueProp) && !isDate(valueProp))\n setInputValue({\n end: dateToString(valueProp.end),\n start: dateToString(valueProp.start),\n } as MaybeInputValue<Range>)\n else setInputValue(dateToString(valueProp) as MaybeInputValue<Range>)\n }, [valueProp])\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({\n \"data-range\": dataAttr(range),\n ...dataProps,\n ...props,\n }),\n [dataProps, range],\n )\n\n const getFieldProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getTriggerProps({\n ref: mergeRefs(ref, fieldRef),\n \"aria-haspopup\": \"dialog\",\n tabIndex: !allowInput ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onClick),\n onFocus: handlerAll(props.onFocus, onFieldFocus),\n onMouseDown: handlerAll(props.onMouseDown, onMouseDown),\n }),\n\n [allowInput, getTriggerProps, onClick, onFieldFocus, onMouseDown],\n )\n\n const getInputProps: PropGetter<\"input\", { align?: InputAlign }> =\n useCallback(\n ({ align = \"start\", ...props } = {}) => {\n const inputProps: HTMLProps<\"input\"> = {\n style: {\n ...(!allowInput ? { pointerEvents: \"none\" } : {}),\n ...props.style,\n },\n autoComplete: \"off\",\n disabled,\n readOnly,\n required,\n tabIndex: allowInput ? 0 : -1,\n ...dataProps,\n ...props,\n onBlur: handlerAll(props.onBlur, onBlur),\n onChange: handlerAll(props.onChange, onInputChange),\n onFocus: handlerAll(props.onFocus, onInputFocus),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n onMouseDown: handlerAll(props.onMouseDown, onMouseDown),\n }\n\n if (isObject(inputValue)) {\n if (align === \"start\") {\n inputProps.ref = mergeRefs(props.ref, ref, startInputRef)\n inputProps.value = inputValue.start\n inputProps.placeholder = startPlaceholder\n } else {\n inputProps.ref = mergeRefs(props.ref, ref, endInputRef)\n inputProps.value = inputValue.end\n inputProps.placeholder = endPlaceholder\n }\n\n if (!inputValue.start && align === \"start\") {\n inputProps.id = id\n inputProps.name = name\n }\n\n if (!!inputValue.start && align === \"end\") {\n inputProps.id = id\n inputProps.name = name\n }\n } else {\n inputProps.ref = mergeRefs(props.ref, ref, startInputRef)\n inputProps.value = inputValue\n inputProps.id = id\n inputProps.name = name\n\n if (isArray(value)) {\n inputProps.style = {\n ...(!focused && !!value.length\n ? visuallyHiddenAttributes.style\n : {}),\n ...inputProps.style,\n }\n inputProps.placeholder = !value.length\n ? startPlaceholder\n : undefined\n inputProps[\"data-max\"] = dataAttr(\n isNumber(max) && value.length >= max,\n )\n } else {\n inputProps.placeholder = startPlaceholder\n }\n }\n\n return inputProps\n },\n [\n allowInput,\n dataProps,\n disabled,\n endPlaceholder,\n focused,\n id,\n inputValue,\n max,\n name,\n onBlur,\n onInputFocus,\n onInputChange,\n onKeyDown,\n onMouseDown,\n readOnly,\n ref,\n required,\n startPlaceholder,\n value,\n ],\n )\n\n const getContentProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getComboboxContentProps({\n ref: mergeRefs(ref, contentRef),\n role: \"dialog\",\n ...props,\n }),\n [getComboboxContentProps],\n )\n\n const getCalendarProps: PropGetter<UseCalendarProps<Multiple, Range>> =\n useCallback(\n (props) =>\n ({\n disabled: !interactive,\n format: calendarFormat,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n value,\n onChange,\n onChangeMonth: setMonth,\n ...calendarProps,\n ...props,\n }) as UseCalendarProps<Multiple, Range>,\n [\n interactive,\n calendarFormat,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n value,\n onChange,\n setMonth,\n calendarProps,\n ],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props) => ({ ...dataProps, ...props }),\n [dataProps],\n )\n\n const getClearIconProps: PropGetter = useCallback(\n (props = {}) =>\n getIconProps({\n \"aria-disabled\": ariaAttr(!interactive),\n \"aria-label\": t(\"Clear value\"),\n role: \"button\",\n tabIndex: interactive ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onClear),\n onKeyDown: handlerAll(props.onKeyDown, (ev) =>\n runKeyAction(ev, { Enter: onClear, Space: onClear }),\n ),\n }),\n [getIconProps, interactive, onClear, t],\n )\n\n return {\n children,\n dateToString,\n inputValue,\n interactive,\n month,\n open,\n range,\n separator,\n setInputValue,\n setMonth,\n setValue,\n stringToDate,\n value,\n getCalendarProps,\n getClearIconProps,\n getContentProps,\n getFieldProps,\n getIconProps,\n getInputProps,\n getRootProps,\n popoverProps,\n onChange,\n onClose,\n onInputChange,\n onOpen,\n }\n}\n\nexport type UseDatePickerReturn = ReturnType<typeof useDatePicker>\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwFA,MAAM,iBAAmC,EACvC,OACA,SACA,OACA,KACA,WACA,YACI;CACJ,MAAM,OAAO,QAAQ,MAAM;CAE3B,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;EAAM,OAAO,EAAE,iBAAiB,aAAa;EAA7C,UAAA,CACG,QACE,EAAA,GAAA,oBAAA,cAAC,SAAA,CAAS,GAAG,KAAK,QAAQ,QAAQ,WAAY,CAAC,OAAO,YAAY,IACjE;;AAEV;AAqGA,MAAa,iBAGX,EACA,UAAUA,qBAAAA,kBACV,UAAUC,qBAAAA,kBACV,GAAG,UACoC,CAAC,MAAM;CAC9C,KAAA,GAAI,MAAA,QAAA,CAAM,OAAO,CAAC,CAAC,SAAA,GAAQ,MAAA,QAAA,CAAM,OAAO,CAAC,GAAG,UAAU;CAEtD,MAAM,EAAE,gBAAgBC,6BAAAA,eAAe;CACvC,MAAM,EAAE,QAAQ,eAAe,MAAMC,sBAAAA,QAAQ,YAAY;CACzD,MAAM,EACJ,OAAO,EACL,IACA,KACA,MACA,aAAa,MACb,mBAAmB,OACnB,gBAAgB,OAChB,WAAW,OACX,gBAAgB,CAAC,UACjB,mBACA,+BAAe,IAAI,KAAK,GACxB,QAAQ,OACR,eAAgB,QACZ;EAAE,KAAK,KAAA;EAAW,OAAO,KAAA;CAAU,IACnC,WACE,CAAC,IACD,KAAA,GACN,UACA,eAAe,MACf,QACA,YAAY,gBACZ,SAAS,eACT,KACA,OAAO,WACP,eAAe,MACf,cAAc,MACd,cAAc,MACd,WACA,SACA,aAAa,iBACb,YAAY,aACZ,UACA,SAAS,eACT,UACA,YAAY,QAAQ,MAAM,KAC1B,OAAO,WACP,UAAU,cACV,eAAe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GA/BoCA,MAAAA,YAAAA,EACnC,QAAQ,CAAC,MACR,aAAa;GACX,kBAAA,GAAA,oBAAA,cAAiB,SAAA,CAAS,CAAC,WAAW;GACtC,cAAc,EAAE,aAAa;GAC7B,MAAM;GACN,UAAU,cAAc,IAAI;GAC5B,GAAG;GACH,UAAA,GAAA,oBAAA,cAAS,WAAA,CAAW,MAAM,SAAS,OAAO;GAC1C,YAAA,GAAA,oBAAA,cAAW,WAAA,CAAW,MAAM,YAAY,OACtCW,YAAAA,aAAa,IAAI;IAAE,OAAO;IAAS,OAAO;GAAQ,CAAC,CACrD;EACF,CAAC,GACH;GAAC;GAAc;GAAa;GAAS;EAAC,CAkBtB;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"use-date-picker.cjs","names":["DEFAULT_MAX_DATE","DEFAULT_MIN_DATE","useEnvironment","useI18n","useFieldProps","useDateTimeFormat","useMemo","useCalendarProps","useRef","useState","useControllableState","getAdjustedMonth","useCallback","isBeforeDate","isAfterDate","useCombobox","updateMaybeDateValue","isValidElement","cloneElement","isComposing","isIncludeDates","mergeRefs","visuallyHiddenAttributes","runKeyAction"],"sources":["../../../../src/components/date-picker/use-date-picker.tsx"],"sourcesContent":["\"use client\"\n\nimport type {\n ChangeEvent,\n FocusEvent,\n KeyboardEvent,\n MouseEvent,\n ReactNode,\n} from \"react\"\nimport type { HTMLProps, HTMLRefAttributes, PropGetter } from \"../../core\"\nimport type { UseComboboxProps } from \"../../hooks/use-combobox\"\nimport type { Dict } from \"../../utils\"\nimport type {\n CalendarFormat,\n MaybeDateValue,\n UseCalendarProps,\n} from \"../calendar\"\nimport type { FieldProps } from \"../field\"\nimport dayjs from \"dayjs\"\nimport {\n cloneElement,\n isValidElement,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\"\nimport { useEnvironment } from \"../../core\"\nimport { useCombobox } from \"../../hooks/use-combobox\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n cast,\n contains,\n dataAttr,\n focusTransfer,\n handlerAll,\n isActiveElement,\n isArray,\n isComposing,\n isDate,\n isNumber,\n isObject,\n mergeRefs,\n runIfFn,\n runKeyAction,\n useUpdateEffect,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport {\n DEFAULT_MAX_DATE,\n DEFAULT_MIN_DATE,\n getAdjustedMonth,\n isAfterDate,\n isBeforeDate,\n isIncludeDates,\n updateMaybeDateValue,\n useCalendarProps,\n} from \"../calendar\"\nimport { useFieldProps } from \"../field\"\nimport { useDateTimeFormat } from \"../format\"\n\nexport interface DatePickerFormat extends CalendarFormat {\n input?: Intl.DateTimeFormatOptions | null\n}\n\ntype InputAlign = \"end\" | \"start\"\ntype MaybeInputValue<Range extends boolean = false> = Range extends true\n ? { end?: string; start?: string }\n : string | undefined\n\ninterface DatePickerRenderProps {\n count: number\n date: Date\n focused: boolean\n index: number\n separator: string\n value: string\n onClear: () => void\n max?: number\n}\n\nexport interface DatePickerRender {\n (props: DatePickerRenderProps): ReactNode\n}\n\nconst defaultRender: DatePickerRender = ({\n count,\n focused,\n index,\n max,\n separator,\n value,\n}) => {\n const last = count - 1 === index\n\n return (\n <span style={{ marginInlineEnd: \"var(--gap)\" }}>\n {value}\n {((!isNumber(max) || count < max) && focused) || !last ? separator : null}\n </span>\n )\n}\n\nexport interface UseDatePickerProps<\n Multiple extends boolean = false,\n Range extends boolean = false,\n>\n extends\n Omit<UseCalendarProps<Multiple, Range>, \"format\" | \"ref\">,\n Omit<\n UseComboboxProps,\n \"defaultValue\" | \"initialFocusValue\" | \"onChange\" | \"ref\" | \"value\"\n >,\n HTMLRefAttributes<\"input\">,\n FieldProps {\n /**\n * If `true`, allows input.\n *\n * @default true\n */\n allowInput?: boolean\n /**\n * If `true`, allows input of dates beyond the `minDate` and `maxDate` restrictions.\n *\n * @default true\n */\n allowInputBeyond?: boolean\n /**\n * If `true`, the date picker will be closed when the input value changes.\n *\n * @default false\n */\n closeOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * The initial value of the input.\n */\n defaultInputValue?: MaybeInputValue<Range>\n /**\n * If `true`, the input will be focused when the clear icon is clicked.\n *\n * @default true\n */\n focusOnClear?: boolean\n /**\n * The format used for conversion.\n * Check the docs to see the format of possible modifiers you can pass.\n *\n * @see https://day.js.org/docs/en/display/format#list-of-localized-formats\n */\n format?: DatePickerFormat\n /**\n * The `id` attribute of the input element.\n */\n id?: string\n /**\n * The value of the input.\n */\n inputValue?: MaybeInputValue<Range>\n /**\n * The `name` attribute of the input element.\n */\n name?: string\n /**\n * If `true`, the date picker will be opened when the input value changes.\n *\n * @default true\n */\n openOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * If `true`, the date picker will be opened when the input is focused.\n *\n * @default true\n */\n openOnFocus?: boolean\n /**\n * The pattern used to check the input element.\n */\n pattern?: RegExp\n /**\n * The placeholder for date picker.\n */\n placeholder?: string\n /**\n * The visual separator between each value.\n *\n * @default ','\n */\n separator?: string\n /**\n * The callback invoked when input value state changes.\n */\n onInputChange?: (value: MaybeInputValue<Range>) => void\n /**\n * Function that converts the input value to Date type.\n */\n parseDate?: (value: string) => Date | undefined\n /**\n * The function to render the selected date.\n */\n render?: (props: DatePickerRenderProps) => ReactNode\n}\n\nexport const useDatePicker = <\n Multiple extends boolean = false,\n Range extends boolean = false,\n>({\n maxDate = DEFAULT_MAX_DATE,\n minDate = DEFAULT_MIN_DATE,\n ...props\n}: UseDatePickerProps<Multiple, Range> = {}) => {\n if (dayjs(minDate).isAfter(dayjs(maxDate))) maxDate = minDate\n\n const { getDocument } = useEnvironment()\n const { locale: defaultLocale, t } = useI18n(\"datePicker\")\n const {\n props: {\n id,\n ref,\n name,\n allowInput = true,\n allowInputBeyond = false,\n closeOnChange = false,\n multiple = false,\n closeOnSelect = !multiple,\n defaultInputValue,\n defaultMonth = () => new Date(),\n range = false,\n defaultValue = (range\n ? { end: undefined, start: undefined }\n : multiple\n ? []\n : undefined) as MaybeDateValue<Multiple, Range>,\n disabled,\n focusOnClear = true,\n format,\n inputValue: inputValueProp,\n locale = defaultLocale,\n max,\n month: monthProp,\n openOnChange = true,\n openOnClick = true,\n openOnFocus = true,\n parseDate,\n pattern,\n placeholder: placeholderProp,\n placement = \"end-start\",\n readOnly,\n render = defaultRender,\n required,\n separator = range ? \"-\" : \",\",\n value: valueProp,\n onChange: onChangeProp,\n onChangeMonth: onChangeMonthProp,\n onInputChange: onInputChangeProp,\n ...computedProps\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const dateTimeFormat = useDateTimeFormat({ locale })\n const { calendarFormat, inputFormat } = useMemo(() => {\n const { input: inputFormat, ...calendarFormat } = format ?? {}\n const defaultInputFormat: Intl.DateTimeFormatOptions = {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n }\n\n return {\n calendarFormat,\n inputFormat:\n inputFormat !== null ? (inputFormat ?? defaultInputFormat) : undefined,\n }\n }, [format])\n const [calendarProps, rest] = useCalendarProps<Multiple, Range>(computedProps)\n const { excludeDate } = calendarProps\n const fieldRef = useRef<HTMLDivElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const startInputRef = useRef<HTMLInputElement>(null)\n const endInputRef = useRef<HTMLInputElement>(null)\n const focusByClickRef = useRef<boolean>(false)\n const [currentDate] = useState<Date>(() => new Date())\n const [focused, setFocused] = useState(false)\n const [value, setValue] = useControllableState({\n defaultValue: defaultValue as MaybeDateValue<Multiple, Range>,\n value: valueProp,\n onChange: onChangeProp,\n })\n const [month, setMonth] = useControllableState({\n defaultValue: () => {\n let defaultValue = runIfFn(defaultMonth)\n\n if (dayjs(minDate).isAfter(dayjs(defaultValue)))\n defaultValue = dayjs(minDate).set(\"date\", 1).toDate()\n\n return getAdjustedMonth(value, defaultValue)\n },\n value: monthProp,\n onChange: onChangeMonthProp,\n })\n const stringToDate = useCallback(\n (value: string, start: Date = minDate, end: Date = maxDate) => {\n let date = parseDate?.(value)\n\n if (!date && dayjs(value).isValid())\n date = dayjs(value).locale(locale).toDate()\n\n if (date == null) return undefined\n if (excludeDate?.(date)) return undefined\n\n if (!allowInputBeyond) {\n if (isBeforeDate(date, start)) date = start\n if (isAfterDate(date, end)) date = end\n }\n\n return date\n },\n [allowInputBeyond, excludeDate, locale, maxDate, minDate, parseDate],\n )\n const dateToString = useCallback(\n (date?: Date) => {\n if (date == null) return \"\"\n\n return dateTimeFormat(date, inputFormat)\n },\n [dateTimeFormat, inputFormat],\n )\n const [inputValue, setInputValue] = useControllableState({\n defaultValue: () => {\n if (defaultInputValue)\n if (isObject(defaultInputValue)) {\n if (dayjs(defaultInputValue.start).isValid())\n defaultInputValue.start = dateTimeFormat(\n dayjs(defaultInputValue.start).toDate(),\n inputFormat,\n )\n\n if (dayjs(defaultInputValue.end).isValid())\n defaultInputValue.end = dateTimeFormat(\n dayjs(defaultInputValue.end).toDate(),\n inputFormat,\n )\n\n return defaultInputValue\n } else {\n if (dayjs(defaultInputValue).isValid())\n return dateTimeFormat(\n dayjs(defaultInputValue).toDate(),\n inputFormat,\n ) as MaybeInputValue<Range>\n else return defaultInputValue\n }\n else if (isDate(value))\n return dateToString(value) as MaybeInputValue<Range>\n else if (isObject(value) && !isArray(value))\n return {\n end: dateToString(value.end),\n start: dateToString(value.start),\n } as MaybeInputValue<Range>\n else return \"\" as MaybeInputValue<Range>\n },\n value: inputValueProp,\n onChange: onInputChangeProp,\n })\n const {\n interactive,\n open,\n getContentProps: getComboboxContentProps,\n getTriggerProps,\n popoverProps,\n onClose,\n onOpen,\n } = useCombobox({\n disabled,\n matchWidth: false,\n openOnClick: false,\n openOnEnter: !allowInput,\n openOnSpace: !allowInput,\n placement,\n readOnly,\n transferFocus: false,\n ...ariaProps,\n ...dataProps,\n ...eventProps,\n ...rest,\n })\n const children = useMemo<ReactNode>(() => {\n if (!isArray(value)) return null\n\n const count = value.length\n\n return value.map((date, index) => {\n const value = dateToString(date)\n\n const onClear = (ev?: MouseEvent<HTMLElement>) => {\n ev?.preventDefault()\n ev?.stopPropagation()\n\n setValue(\n (prev) =>\n updateMaybeDateValue(date, max)(prev) as MaybeDateValue<\n Multiple,\n Range\n >,\n )\n }\n\n const component = render({\n count,\n date,\n focused,\n index,\n max,\n separator,\n value,\n onClear,\n })\n\n if (isValidElement<Dict>(component))\n return cloneElement(component, { ...component.props, key: index })\n else return component\n })\n }, [dateToString, focused, max, render, separator, setValue, value])\n const { endPlaceholder, startPlaceholder } = useMemo(() => {\n if (range) {\n const startPlaceholder =\n placeholderProp ?? dateTimeFormat(currentDate, inputFormat)\n const endPlaceholder =\n placeholderProp ??\n dateTimeFormat(dayjs(currentDate).add(1, \"day\").toDate(), inputFormat)\n\n return { endPlaceholder, startPlaceholder }\n } else {\n const placeholder =\n placeholderProp ?? dateTimeFormat(currentDate, inputFormat)\n\n return { endPlaceholder: placeholder, startPlaceholder: placeholder }\n }\n }, [dateTimeFormat, inputFormat, placeholderProp, range, currentDate])\n\n const onChange = useCallback(\n (value: MaybeDateValue<Multiple, Range>) => {\n setValue(value)\n\n if (isArray(value)) setInputValue(\"\" as MaybeInputValue<Range>)\n else if (isObject(value) && !isDate(value))\n setInputValue({\n end: dateToString(value.end),\n start: dateToString(value.start),\n } as MaybeInputValue<Range>)\n else setInputValue(dateToString(value) as MaybeInputValue<Range>)\n\n if (!closeOnSelect) return\n\n if (isObject(value) && !isArray(value) && !isDate(value)) {\n if (value.end && value.start) onClose()\n } else {\n onClose()\n }\n },\n [setValue, closeOnSelect, setInputValue, dateToString, onClose],\n )\n\n const onInputChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n if (!allowInput) return\n if (isArray(value) && value.length === max) return\n\n if (runIfFn(closeOnChange, ev)) onClose()\n else if (runIfFn(openOnChange, ev)) onOpen()\n\n let inputValue = ev.target.value\n\n if (pattern) inputValue = inputValue.replace(pattern, \"\")\n\n if (isArray(value)) {\n const date = stringToDate(inputValue)\n\n setInputValue(inputValue as MaybeInputValue<Range>)\n\n if (date) setMonth(dayjs(date).set(\"date\", 1).toDate())\n } else if (isObject(value) && !isDate(value)) {\n const align = contains(endInputRef.current, ev.target) ? \"end\" : \"start\"\n const minDate =\n value.start && align === \"end\"\n ? dayjs(value.start).add(1, \"day\").toDate()\n : undefined\n const maxDate =\n value.end && align === \"start\"\n ? dayjs(value.end).subtract(1, \"day\").toDate()\n : undefined\n const date = stringToDate(inputValue, minDate, maxDate)\n\n setInputValue((prev) =>\n isObject(prev)\n ? Object.assign({}, prev, { [align]: inputValue })\n : prev,\n )\n setValue((prev) =>\n isObject(prev) && !isDate(prev) ? { ...prev, [align]: date } : prev,\n )\n } else {\n const date = stringToDate(inputValue)\n\n setInputValue(inputValue as MaybeInputValue<Range>)\n setValue(date as MaybeDateValue<Multiple, Range>)\n }\n },\n [\n allowInput,\n closeOnChange,\n max,\n onClose,\n onOpen,\n openOnChange,\n pattern,\n setInputValue,\n setMonth,\n setValue,\n stringToDate,\n value,\n ],\n )\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLInputElement>) => {\n if (disabled || isComposing(ev)) return\n\n const inputValue = cast<HTMLInputElement>(ev.target).value\n\n runKeyAction(\n ev,\n {\n Backspace: (ev) => {\n if (isArray(value)) {\n if (inputValue.length) return\n\n ev.preventDefault()\n\n setValue((prev) =>\n isArray(prev)\n ? (prev.slice(0, -1) as MaybeDateValue<Multiple, Range>)\n : prev,\n )\n } else if (isObject(value) && !isDate(value)) {\n if (inputValue.length) return\n if (!contains(endInputRef.current, ev.target)) return\n\n ev.preventDefault()\n\n setInputValue({ end: \"\", start: \"\" } as MaybeInputValue<Range>)\n setValue({ end: undefined, start: undefined } as MaybeDateValue<\n Multiple,\n Range\n >)\n\n startInputRef.current?.focus()\n }\n },\n Enter: (ev) => {\n if (!open || !inputValue.length) return\n\n if (isObject(value) && !isArray(value) && !isDate(value)) {\n const align = contains(endInputRef.current, ev.target)\n ? \"end\"\n : \"start\"\n const minDate =\n value.start && align === \"end\"\n ? dayjs(value.start).add(1, \"day\").toDate()\n : undefined\n const maxDate =\n value.end && align === \"start\"\n ? dayjs(value.end).subtract(1, \"day\").toDate()\n : undefined\n const date = stringToDate(inputValue, minDate, maxDate)\n\n if (!date) return\n\n ev.preventDefault()\n\n setInputValue((prev) =>\n isObject(prev)\n ? Object.assign({}, prev, { [align]: dateToString(date) })\n : prev,\n )\n setValue((prev) =>\n isObject(prev) && !isDate(prev)\n ? { ...prev, [align]: date }\n : prev,\n )\n\n if (align === \"start\") endInputRef.current?.focus()\n } else {\n const date = stringToDate(inputValue)\n\n if (!date) return\n\n ev.preventDefault()\n\n if (isArray(value)) {\n setInputValue(\"\" as MaybeInputValue<Range>)\n\n setValue((prev) =>\n isArray(prev) &&\n !isIncludeDates(date, prev) &&\n (!isNumber(max) || prev.length < max)\n ? ([...prev, date] as MaybeDateValue<Multiple, Range>)\n : prev,\n )\n } else {\n setInputValue(dateToString(date) as MaybeInputValue<Range>)\n setValue(date as MaybeDateValue<Multiple, Range>)\n }\n }\n },\n },\n { preventDefault: false },\n )\n },\n [\n dateToString,\n disabled,\n max,\n open,\n setInputValue,\n setValue,\n stringToDate,\n value,\n ],\n )\n\n const onClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n if (!interactive) return\n\n focusByClickRef.current = true\n\n if (allowInput)\n if (isObject(value) && !isArray(value) && !isDate(value))\n if (\n startInputRef.current &&\n contains(startInputRef.current, ev.target)\n ) {\n if (!isActiveElement(startInputRef.current, getDocument()!))\n ev.defaultPrevented = true\n\n startInputRef.current.focus()\n } else if (\n endInputRef.current &&\n contains(endInputRef.current, ev.target)\n ) {\n if (!isActiveElement(endInputRef.current, getDocument()!))\n ev.defaultPrevented = true\n\n endInputRef.current.focus()\n } else {\n startInputRef.current?.focus()\n }\n else startInputRef.current?.focus()\n\n if (openOnClick) onOpen()\n },\n [allowInput, interactive, onOpen, openOnClick, value, getDocument],\n )\n\n const onMouseDown = useCallback(\n (ev: MouseEvent<HTMLDivElement | HTMLInputElement>) => {\n if (!openOnFocus) return\n\n ev.preventDefault()\n ev.stopPropagation()\n },\n [openOnFocus],\n )\n\n const onFieldFocus = useCallback(() => {\n if (allowInput) return\n\n if (openOnFocus) onOpen()\n\n focusByClickRef.current = false\n }, [allowInput, onOpen, openOnFocus])\n\n const onInputFocus = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n ev.preventDefault()\n ev.stopPropagation()\n\n setFocused(true)\n\n if (openOnFocus && !focusByClickRef.current) onOpen()\n\n focusByClickRef.current = false\n },\n [onOpen, openOnFocus],\n )\n\n const onBlur = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n setFocused(false)\n\n if (\n contains(fieldRef.current, ev.relatedTarget) ||\n contains(contentRef.current, ev.relatedTarget)\n )\n ev.preventDefault()\n else if (isArray(value)) setInputValue(\"\" as MaybeInputValue<Range>)\n else if (isObject(value) && !isDate(value))\n setInputValue((prev) =>\n isObject(prev)\n ? ({\n end: dateToString(value.end),\n start: dateToString(value.start),\n } as MaybeInputValue<Range>)\n : prev,\n )\n else setInputValue(dateToString(value) as MaybeInputValue<Range>)\n },\n [dateToString, setInputValue, value],\n )\n\n const onClear = useCallback(() => {\n if (!interactive) return\n\n setValue((prev) => {\n if (isDate(prev)) return undefined as MaybeDateValue<Multiple, Range>\n else if (isArray(prev))\n return [] as unknown as MaybeDateValue<Multiple, Range>\n else if (isObject(prev))\n return { end: undefined, start: undefined } as MaybeDateValue<\n Multiple,\n Range\n >\n else return prev\n })\n\n setInputValue(\n (range ? { end: \"\", start: \"\" } : \"\") as MaybeInputValue<Range>,\n )\n\n if (focusOnClear)\n if (allowInput) startInputRef.current?.focus()\n else fieldRef.current?.focus()\n }, [allowInput, focusOnClear, interactive, range, setInputValue, setValue])\n\n useEffect(() => {\n if (!open) return\n\n return focusTransfer(\n contentRef.current,\n allowInput ? startInputRef.current : fieldRef.current,\n )\n }, [allowInput, open])\n\n useUpdateEffect(() => {\n setMonth((prev) => getAdjustedMonth(value, prev))\n }, [value, range])\n\n useUpdateEffect(() => {\n if (isArray(valueProp)) return\n\n if (isObject(valueProp) && !isDate(valueProp))\n setInputValue({\n end: dateToString(valueProp.end),\n start: dateToString(valueProp.start),\n } as MaybeInputValue<Range>)\n else setInputValue(dateToString(valueProp) as MaybeInputValue<Range>)\n }, [valueProp])\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({\n \"data-range\": dataAttr(range),\n ...dataProps,\n ...props,\n }),\n [dataProps, range],\n )\n\n const getFieldProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getTriggerProps({\n ref: mergeRefs(ref, fieldRef),\n \"aria-haspopup\": \"dialog\",\n tabIndex: !allowInput ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onClick),\n onFocus: handlerAll(props.onFocus, onFieldFocus),\n onMouseDown: handlerAll(props.onMouseDown, onMouseDown),\n }),\n\n [allowInput, getTriggerProps, onClick, onFieldFocus, onMouseDown],\n )\n\n const getInputProps: PropGetter<\"input\", { align?: InputAlign }> =\n useCallback(\n ({ align = \"start\", ...props } = {}) => {\n const inputProps: HTMLProps<\"input\"> = {\n style: {\n ...(!allowInput ? { pointerEvents: \"none\" } : {}),\n ...props.style,\n },\n autoComplete: \"off\",\n disabled,\n readOnly,\n required,\n tabIndex: allowInput ? 0 : -1,\n ...dataProps,\n ...props,\n onBlur: handlerAll(props.onBlur, onBlur),\n onChange: handlerAll(props.onChange, onInputChange),\n onFocus: handlerAll(props.onFocus, onInputFocus),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n onMouseDown: handlerAll(props.onMouseDown, onMouseDown),\n }\n\n if (isObject(inputValue)) {\n if (align === \"start\") {\n inputProps.ref = mergeRefs(props.ref, ref, startInputRef)\n inputProps.value = inputValue.start\n inputProps.placeholder = startPlaceholder\n } else {\n inputProps.ref = mergeRefs(props.ref, ref, endInputRef)\n inputProps.value = inputValue.end\n inputProps.placeholder = endPlaceholder\n }\n\n if (!inputValue.start && align === \"start\") {\n inputProps.id = id\n inputProps.name = name\n }\n\n if (!!inputValue.start && align === \"end\") {\n inputProps.id = id\n inputProps.name = name\n }\n } else {\n inputProps.ref = mergeRefs(props.ref, ref, startInputRef)\n inputProps.value = inputValue\n inputProps.id = id\n inputProps.name = name\n\n if (isArray(value)) {\n inputProps.style = {\n ...(!focused && !!value.length\n ? visuallyHiddenAttributes.style\n : {}),\n ...inputProps.style,\n }\n inputProps.placeholder = !value.length\n ? startPlaceholder\n : undefined\n inputProps[\"data-max\"] = dataAttr(\n isNumber(max) && value.length >= max,\n )\n } else {\n inputProps.placeholder = startPlaceholder\n }\n }\n\n return inputProps\n },\n [\n allowInput,\n dataProps,\n disabled,\n endPlaceholder,\n focused,\n id,\n inputValue,\n max,\n name,\n onBlur,\n onInputFocus,\n onInputChange,\n onKeyDown,\n onMouseDown,\n readOnly,\n ref,\n required,\n startPlaceholder,\n value,\n ],\n )\n\n const getContentProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getComboboxContentProps({\n ref: mergeRefs(ref, contentRef),\n role: \"dialog\",\n ...props,\n }),\n [getComboboxContentProps],\n )\n\n const getCalendarProps: PropGetter<UseCalendarProps<Multiple, Range>> =\n useCallback(\n (props) =>\n ({\n disabled: !interactive,\n format: calendarFormat,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n value,\n onChange,\n onChangeMonth: setMonth,\n ...calendarProps,\n ...props,\n }) as UseCalendarProps<Multiple, Range>,\n [\n interactive,\n calendarFormat,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n value,\n onChange,\n setMonth,\n calendarProps,\n ],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props) => ({ ...dataProps, ...props }),\n [dataProps],\n )\n\n const getClearIconProps: PropGetter = useCallback(\n (props = {}) =>\n getIconProps({\n \"aria-disabled\": ariaAttr(!interactive),\n \"aria-label\": t(\"Clear value\"),\n role: \"button\",\n tabIndex: interactive ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onClear),\n onKeyDown: handlerAll(props.onKeyDown, (ev) =>\n runKeyAction(ev, { Enter: onClear, Space: onClear }),\n ),\n }),\n [getIconProps, interactive, onClear, t],\n )\n\n return {\n children,\n dateToString,\n inputValue,\n interactive,\n month,\n open,\n range,\n separator,\n setInputValue,\n setMonth,\n setValue,\n stringToDate,\n value,\n getCalendarProps,\n getClearIconProps,\n getContentProps,\n getFieldProps,\n getIconProps,\n getInputProps,\n getRootProps,\n popoverProps,\n onChange,\n onClose,\n onInputChange,\n onOpen,\n }\n}\n\nexport type UseDatePickerReturn = ReturnType<typeof useDatePicker>\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwFA,MAAM,iBAAmC,EACvC,OACA,SACA,OACA,KACA,WACA,YACI;CACJ,MAAM,OAAO,QAAQ,MAAM;CAE3B,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;EAAM,OAAO,EAAE,iBAAiB,aAAa;EAA7C,UAAA,CACG,QACE,EAAA,GAAA,oBAAA,cAAC,SAAA,CAAS,GAAG,KAAK,QAAQ,QAAQ,WAAY,CAAC,OAAO,YAAY,IACjE;;AAEV;AAqGA,MAAa,iBAGX,EACA,UAAUA,qBAAAA,kBACV,UAAUC,qBAAAA,kBACV,GAAG,UACoC,CAAC,MAAM;CAC9C,KAAA,GAAI,MAAA,QAAA,CAAM,OAAO,CAAC,CAAC,SAAA,GAAQ,MAAA,QAAA,CAAM,OAAO,CAAC,GAAG,UAAU;CAEtD,MAAM,EAAE,gBAAgBC,6BAAAA,eAAe;CACvC,MAAM,EAAE,QAAQ,eAAe,MAAMC,sBAAAA,QAAQ,YAAY;CACzD,MAAM,EACJ,OAAO,EACL,IACA,KACA,MACA,aAAa,MACb,mBAAmB,OACnB,gBAAgB,OAChB,WAAW,OACX,gBAAgB,CAAC,UACjB,mBACA,qCAAqB,IAAI,KAAK,GAC9B,QAAQ,OACR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Ae;EACf,GAAG;EACH,GAAG;CACL,IACF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAEF,MAAM,gBAAA,GAA2BA,MAAAA,YAAAA,EAC9B,WAAW;EAAE,GAAG;EAAW,GAAG;CAAM,IACrC,CAAC,SAAS,CACZ;CAkBA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,oBAAA,GA/BoCA,MAAAA,YAAAA,EACnC,QAAQ,CAAC,MACR,aAAa;GACX,kBAAA,GAAA,oBAAA,cAAiB,SAAA,CAAS,CAAC,WAAW;GACtC,cAAc,EAAE,aAAa;GAC7B,MAAM;GACN,UAAU,cAAc,IAAI;GAC5B,GAAG;GACH,UAAA,GAAA,oBAAA,cAAS,WAAA,CAAW,MAAM,SAAS,OAAO;GAC1C,YAAA,GAAA,oBAAA,cAAW,WAAA,CAAW,MAAM,YAAY,OACtCW,YAAAA,aAAa,IAAI;IAAE,OAAO;IAAS,OAAO;GAAQ,CAAC,CACrD;EACF,CAAC,GACH;GAAC;GAAc;GAAa;GAAS;EAAC,CAkBtB;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
@@ -24,7 +24,7 @@ const { ComponentContext, PropsContext: DrawerPropsContext, useComponentContext,
24
24
  *
25
25
  * @see https://yamada-ui.com/docs/components/drawer
26
26
  */
27
- const DrawerRoot = withProvider(({ allowPinchZoom = false, autoFocus, blockScrollOnMount = true, body, cancel, children, closeOnDrag, dragConstraints, dragElastic, dragOffset, dragVelocity, duration = {
27
+ const DrawerRoot = withProvider(({ allowPinchZoom = false, autoFocus, blockScrollOnMount = true, body, cancel, children, closeOnDrag, dragConstraints, dragElastic, dragHandleOnly, dragOffset, dragVelocity, duration = {
28
28
  enter: .4,
29
29
  exit: .3
30
30
  }, finalFocusRef, footer, header, initialFocusRef, lockFocusAcrossFrames = true, middle, placement: placementProp, restoreFocus, success, title, trigger, withCloseButton = !closeOnDrag, withDragBar = true, withOverlay = true, portalProps, onCancel, onCloseComplete, onMiddle, onSuccess, ...props }) => {
@@ -35,6 +35,7 @@ const DrawerRoot = withProvider(({ allowPinchZoom = false, autoFocus, blockScrol
35
35
  closeOnDrag,
36
36
  dragConstraints,
37
37
  dragElastic,
38
+ dragHandleOnly,
38
39
  dragOffset,
39
40
  dragVelocity,
40
41
  placement,
@@ -177,6 +178,16 @@ const DrawerDragBar = withContext("div", "dragBar")(void 0, (props) => {
177
178
  const { getDragBarProps } = useComponentContext();
178
179
  return { ...getDragBarProps(props) };
179
180
  });
181
+ const DrawerDragTrigger = withContext("div", {
182
+ name: "DragTrigger",
183
+ slot: ["trigger", "drag"]
184
+ })(void 0, (props) => {
185
+ const { getDragTriggerProps } = useComponentContext();
186
+ return {
187
+ asChild: true,
188
+ ...getDragTriggerProps(props)
189
+ };
190
+ });
180
191
  const DrawerHeader = withContext("header", "header")(void 0, (props) => {
181
192
  const { getHeaderProps } = useComponentContext();
182
193
  return { ...getHeaderProps(props) };
@@ -199,6 +210,7 @@ exports.DrawerCloseButton = DrawerCloseButton;
199
210
  exports.DrawerCloseTrigger = DrawerCloseTrigger;
200
211
  exports.DrawerContent = DrawerContent;
201
212
  exports.DrawerDragBar = DrawerDragBar;
213
+ exports.DrawerDragTrigger = DrawerDragTrigger;
202
214
  exports.DrawerFooter = DrawerFooter;
203
215
  exports.DrawerHeader = DrawerHeader;
204
216
  exports.DrawerOpenTrigger = DrawerOpenTrigger;
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.cjs","names":["createSlotComponent","drawerStyle","useValue","useSplitChildren","useDrawer","useMemo","AnimatePresence","Portal","FocusLock","RemoveScroll","styled","CloseButton","motion","fadeVariants","Slide","wrapOrPassProps","Button"],"sources":["../../../../src/components/drawer/drawer.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, ReactNode } from \"react\"\nimport type { HTMLProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ButtonProps } from \"../button\"\nimport type { CloseButtonProps } from \"../close-button\"\nimport type { FocusLockProps } from \"../focus-lock\"\nimport type { HTMLMotionProps, MotionTransitionProps } from \"../motion\"\nimport type { PortalProps } from \"../portal\"\nimport type { SlideProps } from \"../slide\"\nimport type { DrawerStyle } from \"./drawer.style\"\nimport type { UseDrawerProps, UseDrawerReturn } from \"./use-drawer\"\nimport { AnimatePresence } from \"motion/react\"\nimport { useMemo } from \"react\"\nimport { RemoveScroll } from \"react-remove-scroll\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { useValue } from \"../../hooks/use-value\"\nimport { cast, isArray, useSplitChildren, wrapOrPassProps } from \"../../utils\"\nimport { Button } from \"../button\"\nimport { CloseButton } from \"../close-button\"\nimport { fadeVariants } from \"../fade\"\nimport { FocusLock } from \"../focus-lock\"\nimport { motion } from \"../motion\"\nimport { Portal } from \"../portal\"\nimport { Slide } from \"../slide\"\nimport { drawerStyle } from \"./drawer.style\"\nimport { useDrawer } from \"./use-drawer\"\n\ninterface ComponentContext\n extends\n Omit<UseDrawerReturn, \"getRootProps\">,\n Pick<\n DrawerRootProps,\n \"duration\" | \"placement\" | \"withCloseButton\" | \"withDragBar\"\n > {}\n\nexport interface DrawerRootProps\n extends\n ThemeProps<DrawerStyle>,\n Omit<UseDrawerProps, \"placement\" | \"title\">,\n Pick<\n FocusLockProps,\n | \"autoFocus\"\n | \"finalFocusRef\"\n | \"initialFocusRef\"\n | \"lockFocusAcrossFrames\"\n | \"restoreFocus\"\n >,\n ShorthandDrawerContentProps {\n /**\n * Handle zoom or pinch gestures on iOS devices when scroll locking is enabled.\n *\n * @default false.\n */\n allowPinchZoom?: boolean\n /**\n * If `true`, scrolling will be disabled on the `body` when the drawer opens.\n *\n * @default true\n */\n blockScrollOnMount?: boolean\n /**\n * The animation duration.\n */\n duration?: MotionTransitionProps[\"duration\"]\n /**\n * The modal trigger to use.\n */\n trigger?: ReactNode\n /**\n * If `true`, display the drawer close button.\n *\n * @default true\n */\n withCloseButton?: boolean\n /**\n * If `true`, display the drag bar when `closeOnDrag` is `true`.\n *\n * @default true\n */\n withDragBar?: boolean\n /**\n * If `true`, display the drawer overlay.\n *\n * @default true\n */\n withOverlay?: boolean\n /**\n * Props to be forwarded to the portal component.\n */\n portalProps?: Omit<PortalProps, \"children\">\n /**\n * Callback function to run side effects after the drawer has closed.\n */\n onCloseComplete?: () => void\n}\n\nconst {\n ComponentContext,\n PropsContext: DrawerPropsContext,\n useComponentContext,\n usePropsContext: useDrawerPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<DrawerRootProps, DrawerStyle, ComponentContext>(\n \"drawer\",\n drawerStyle,\n)\n\nexport { DrawerPropsContext, useDrawerPropsContext }\n\n/**\n * `Drawer` is a component for a panel that appears from the edge of the screen.\n *\n * @see https://yamada-ui.com/docs/components/drawer\n */\nexport const DrawerRoot = withProvider<\"div\", DrawerRootProps, \"placement\">(\n ({\n allowPinchZoom = false,\n autoFocus,\n blockScrollOnMount = true,\n body,\n cancel,\n children,\n closeOnDrag,\n dragConstraints,\n dragElastic,\n dragOffset,\n dragVelocity,\n duration = { enter: 0.4, exit: 0.3 },\n finalFocusRef,\n footer,\n header,\n initialFocusRef,\n lockFocusAcrossFrames = true,\n middle,\n placement: placementProp,\n restoreFocus,\n success,\n title,\n trigger,\n withCloseButton = !closeOnDrag,\n withDragBar = true,\n withOverlay = true,\n portalProps,\n onCancel,\n onCloseComplete,\n onMiddle,\n onSuccess,\n ...props\n }) => {\n const placement = useValue(placementProp)\n const [omittedChildren, openTrigger, customOverlay] = useSplitChildren(\n children,\n DrawerOpenTrigger,\n DrawerOverlay,\n )\n const hasChildren = isArray(omittedChildren) && !!omittedChildren.length\n const { open, getRootProps, ...rest } = useDrawer({\n closeOnDrag,\n dragConstraints,\n dragElastic,\n dragOffset,\n dragVelocity,\n placement,\n ...props,\n })\n const customOpenTrigger = trigger ? (\n <DrawerOpenTrigger>{trigger}</DrawerOpenTrigger>\n ) : null\n\n const context = useMemo(\n () => ({\n duration,\n open,\n placement,\n withCloseButton,\n withDragBar,\n ...rest,\n }),\n [duration, open, withDragBar, placement, withCloseButton, rest],\n )\n\n return (\n <ComponentContext value={context}>\n {openTrigger ?? customOpenTrigger}\n\n <AnimatePresence onExitComplete={onCloseComplete}>\n {open ? (\n <Portal {...portalProps}>\n <FocusLock\n autoFocus={autoFocus}\n finalFocusRef={finalFocusRef}\n initialFocusRef={initialFocusRef}\n lockFocusAcrossFrames={lockFocusAcrossFrames}\n restoreFocus={restoreFocus}\n >\n <RemoveScroll\n allowPinchZoom={allowPinchZoom}\n enabled={blockScrollOnMount}\n forwardProps\n >\n <styled.div {...getRootProps()}>\n {customOverlay ?? (withOverlay ? <DrawerOverlay /> : null)}\n\n {hasChildren ? (\n omittedChildren\n ) : (\n <ShorthandDrawerContent\n body={body}\n cancel={cancel}\n footer={footer}\n header={header}\n middle={middle}\n success={success}\n title={title}\n onCancel={onCancel}\n onMiddle={onMiddle}\n onSuccess={onSuccess}\n />\n )}\n </styled.div>\n </RemoveScroll>\n </FocusLock>\n </Portal>\n ) : null}\n </AnimatePresence>\n </ComponentContext>\n )\n },\n \"root\",\n { transferProps: [\"placement\"] },\n)()\n\nexport interface DrawerOpenTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const DrawerOpenTrigger = withContext<\"button\", DrawerOpenTriggerProps>(\n \"button\",\n { name: \"OpenTrigger\", slot: [\"trigger\", \"open\"] },\n)(undefined, (props) => {\n const { getOpenTriggerProps } = useComponentContext()\n\n return { asChild: true, ...getOpenTriggerProps(props) }\n})\n\nexport interface DrawerCloseTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const DrawerCloseTrigger = withContext<\n \"button\",\n DrawerCloseTriggerProps\n>(\"button\", { name: \"CloseTrigger\", slot: [\"trigger\", \"close\"] })(\n undefined,\n (props) => {\n const { getCloseTriggerProps } = useComponentContext()\n\n return { asChild: true, ...getCloseTriggerProps(props) }\n },\n)\n\nexport interface DrawerCloseButtonProps extends CloseButtonProps {}\n\nexport const DrawerCloseButton = withContext<\"button\", DrawerCloseButtonProps>(\n CloseButton,\n \"closeButton\",\n)(undefined, (props) => {\n const { getCloseButtonProps } = useComponentContext()\n\n return { ...getCloseButtonProps(props) }\n})\n\nexport interface DrawerOverlayProps extends HTMLMotionProps {}\n\nexport const DrawerOverlay = withContext<\"div\", DrawerOverlayProps>((props) => {\n const { duration, getOverlayProps } = useComponentContext()\n\n return (\n <motion.div\n animate=\"enter\"\n custom={{ duration }}\n exit=\"exit\"\n initial=\"exit\"\n variants={fadeVariants}\n {...cast<HTMLMotionProps>(getOverlayProps(cast<HTMLProps>(props)))}\n />\n )\n}, \"overlay\")()\n\nexport interface DrawerContentProps\n extends Omit<HTMLMotionProps<\"section\">, \"children\">, PropsWithChildren {}\n\nexport const DrawerContent = withContext<\"div\", DrawerContentProps>(\n ({ children, ...rest }) => {\n const {\n closeOnDrag,\n duration,\n open,\n placement,\n withCloseButton,\n withDragBar,\n getContentProps,\n } = useComponentContext()\n const [omittedChildren, customCloseButton, customDragBar] =\n useSplitChildren(children, DrawerCloseButton, DrawerDragBar)\n\n return (\n <Slide\n as=\"section\"\n duration={duration}\n open={open}\n placement={placement}\n {...(getContentProps(rest) as SlideProps)}\n >\n {customCloseButton ?? (withCloseButton ? <DrawerCloseButton /> : null)}\n {customDragBar ??\n (withDragBar && closeOnDrag ? <DrawerDragBar /> : null)}\n\n {omittedChildren}\n </Slide>\n )\n },\n \"content\",\n)()\n\ninterface ShorthandDrawerContentProps {\n /**\n * The drawer body to use.\n */\n body?: DrawerBodyProps | ReactNode\n /**\n * The drawer cancel button to use.\n */\n cancel?: ButtonProps | ReactNode\n /**\n * The drawer footer to use.\n */\n footer?: DrawerFooterProps | ReactNode\n /**\n * The drawer header to use.\n */\n header?: DrawerHeaderProps | ReactNode\n /**\n * The drawer middle button to use.\n */\n middle?: ButtonProps | ReactNode\n /**\n * The drawer success button to use.\n */\n success?: ButtonProps | ReactNode\n /**\n * The drawer title to use.\n */\n title?: DrawerTitleProps | ReactNode\n /**\n * The callback invoked when cancel button clicked.\n */\n onCancel?: (onClose: () => void) => void\n /**\n * The callback invoked when middle button clicked.\n */\n onMiddle?: (onClose: () => void) => void\n /**\n * The callback invoked when success button clicked.\n */\n onSuccess?: (onClose: () => void) => void\n}\n\nexport const ShorthandDrawerContent: FC<ShorthandDrawerContentProps> = ({\n body,\n cancel,\n footer,\n header,\n middle,\n success,\n title,\n onCancel,\n onMiddle,\n onSuccess,\n}) => {\n const { onClose } = useComponentContext()\n const customHeader = wrapOrPassProps(DrawerHeader, header)\n const customTitle = wrapOrPassProps(DrawerTitle, title)\n const customBody = wrapOrPassProps(DrawerBody, body)\n const customFooter = wrapOrPassProps(DrawerFooter, footer)\n const customCancel = wrapOrPassProps(Button, cancel, {\n colorScheme: \"mono\",\n variant: \"ghost\",\n onClick: () => (onCancel ? onCancel(onClose) : onClose()),\n })\n const customMiddle = wrapOrPassProps(Button, middle, {\n colorScheme: \"secondary\",\n onClick: () => (onMiddle ? onMiddle(onClose) : onClose()),\n })\n const customSuccess = wrapOrPassProps(Button, success, {\n colorScheme: \"primary\",\n onClick: () => (onSuccess ? onSuccess(onClose) : onClose()),\n })\n\n return (\n <DrawerContent>\n {customHeader ??\n (customTitle ? <DrawerHeader>{customTitle}</DrawerHeader> : null)}\n {customBody}\n {customFooter ??\n (customCancel || customMiddle || customSuccess ? (\n <DrawerFooter>\n {customCancel}\n {customMiddle}\n {customSuccess}\n </DrawerFooter>\n ) : null)}\n </DrawerContent>\n )\n}\n\nexport interface DrawerDragBarProps extends HTMLStyledProps {}\n\nexport const DrawerDragBar = withContext<\"div\", DrawerDragBarProps>(\n \"div\",\n \"dragBar\",\n)(undefined, (props) => {\n const { getDragBarProps } = useComponentContext()\n\n return { ...getDragBarProps(props) }\n})\n\nexport interface DrawerHeaderProps extends HTMLStyledProps<\"header\"> {}\n\nexport const DrawerHeader = withContext<\"header\", DrawerHeaderProps>(\n \"header\",\n \"header\",\n)(undefined, (props) => {\n const { getHeaderProps } = useComponentContext()\n\n return { ...getHeaderProps(props) }\n})\n\nexport interface DrawerTitleProps extends HTMLStyledProps<\"h2\"> {}\n\nexport const DrawerTitle = withContext<\"h2\", DrawerTitleProps>(\"h2\", \"title\")(\n undefined,\n (props) => {\n const { getTitleProps } = useComponentContext()\n\n return { ...getTitleProps(props) }\n },\n)\n\nexport interface DrawerBodyProps extends HTMLStyledProps {}\n\nexport const DrawerBody = withContext<\"div\", DrawerBodyProps>(\"div\", \"body\")(\n undefined,\n (props) => {\n const { getBodyProps } = useComponentContext()\n\n return { ...getBodyProps(props) }\n },\n)\n\nexport interface DrawerFooterProps extends HTMLStyledProps<\"footer\"> {}\n\nexport const DrawerFooter = withContext<\"footer\", DrawerFooterProps>(\n \"footer\",\n \"footer\",\n)(undefined, (props) => {\n const { getFooterProps } = useComponentContext()\n\n return { ...getFooterProps(props) }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiGA,MAAM,EACJ,kBACA,cAAc,oBACd,qBACA,iBAAiB,uBACjB,aACA,iBACEA,yBAAAA,oBACF,UACAC,qBAAAA,WACF;;;;;;AASA,MAAa,aAAa,cACvB,EACC,iBAAiB,OACjB,WACA,qBAAqB,MACrB,MACA,QACA,UACA,aACA,iBACA,aACA,YACA,cACA,WAAW;CAAE,OAAO;CAAK,MAAM;AAAI,GACnC,eACA,QACA,QACA,iBACA,wBAAwB,MACxB,QACA,WAAW,eACX,cACA,SACA,OACA,SACA,kBAAkB,CAAC,aACnB,cAAc,MACd,cAAc,MACd,aACA,UACA,iBACA,UACA,WACA,GAAG,YACC;CACJ,MAAM,YAAYC,8BAAAA,SAAS,aAAa;CACxC,MAAM,CAAC,iBAAiB,aAAa,iBAAiBC,iBAAAA,iBACpD,UACA,mBACA,aACF;CACA,MAAM,eAAA,GAAA,oBAAA,cAAc,QAAA,CAAQ,eAAe,KAAK,CAAC,CAAC,gBAAgB;CA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CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,oBAAoB,oBAAoB;CAEhD,OAAO,EAAE,GAAG,gBAAgB,KAAK,EAAE;AACrC,CAAC;AAID,MAAa,eAAe,YAC1B,UACA,QACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,mBAAmB,oBAAoB;CAE/C,OAAO,EAAE,GAAG,eAAe,KAAK,EAAE;AACpC,CAAC;AAID,MAAa,cAAc,YAAoC,MAAM,OAAO,CAAC,CAC3E,KAAA,IACC,UAAU;CACT,MAAM,EAAE,kBAAkB,oBAAoB;CAE9C,OAAO,EAAE,GAAG,cAAc,KAAK,EAAE;AACnC,CACF;AAIA,MAAa,aAAa,YAAoC,OAAO,MAAM,CAAC,CAC1E,KAAA,IACC,UAAU;CACT,MAAM,EAAE,iBAAiB,oBAAoB;CAE7C,OAAO,EAAE,GAAG,aAAa,KAAK,EAAE;AAClC,CACF;AAIA,MAAa,eAAe,YAC1B,UACA,QACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,mBAAmB,oBAAoB;CAE/C,OAAO,EAAE,GAAG,eAAe,KAAK,EAAE;AACpC,CAAC"}
1
+ {"version":3,"file":"drawer.cjs","names":["createSlotComponent","drawerStyle","useValue","useSplitChildren","useDrawer","useMemo","AnimatePresence","Portal","FocusLock","RemoveScroll","styled","CloseButton","motion","fadeVariants","Slide","wrapOrPassProps","Button"],"sources":["../../../../src/components/drawer/drawer.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, ReactNode } from \"react\"\nimport type { HTMLProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ButtonProps } from \"../button\"\nimport type { CloseButtonProps } from \"../close-button\"\nimport type { FocusLockProps } from \"../focus-lock\"\nimport type { HTMLMotionProps, MotionTransitionProps } from \"../motion\"\nimport type { PortalProps } from \"../portal\"\nimport type { SlideProps } from \"../slide\"\nimport type { DrawerStyle } from \"./drawer.style\"\nimport type { UseDrawerProps, UseDrawerReturn } from \"./use-drawer\"\nimport { AnimatePresence } from \"motion/react\"\nimport { useMemo } from \"react\"\nimport { RemoveScroll } from \"react-remove-scroll\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { useValue } from \"../../hooks/use-value\"\nimport { cast, isArray, useSplitChildren, wrapOrPassProps } from \"../../utils\"\nimport { Button } from \"../button\"\nimport { CloseButton } from \"../close-button\"\nimport { fadeVariants } from \"../fade\"\nimport { FocusLock } from \"../focus-lock\"\nimport { motion } from \"../motion\"\nimport { Portal } from \"../portal\"\nimport { Slide } from \"../slide\"\nimport { drawerStyle } from \"./drawer.style\"\nimport { useDrawer } from \"./use-drawer\"\n\ninterface ComponentContext\n extends\n Omit<UseDrawerReturn, \"getRootProps\">,\n Pick<\n DrawerRootProps,\n \"duration\" | \"placement\" | \"withCloseButton\" | \"withDragBar\"\n > {}\n\nexport interface DrawerRootProps\n extends\n ThemeProps<DrawerStyle>,\n Omit<UseDrawerProps, \"placement\" | \"title\">,\n Pick<\n FocusLockProps,\n | \"autoFocus\"\n | \"finalFocusRef\"\n | \"initialFocusRef\"\n | \"lockFocusAcrossFrames\"\n | \"restoreFocus\"\n >,\n ShorthandDrawerContentProps {\n /**\n * Handle zoom or pinch gestures on iOS devices when scroll locking is enabled.\n *\n * @default false.\n */\n allowPinchZoom?: boolean\n /**\n * If `true`, scrolling will be disabled on the `body` when the drawer opens.\n *\n * @default true\n */\n blockScrollOnMount?: boolean\n /**\n * The animation duration.\n */\n duration?: MotionTransitionProps[\"duration\"]\n /**\n * The modal trigger to use.\n */\n trigger?: ReactNode\n /**\n * If `true`, display the drawer close button.\n *\n * @default true\n */\n withCloseButton?: boolean\n /**\n * If `true`, display the drag bar when `closeOnDrag` is `true`.\n *\n * @default true\n */\n withDragBar?: boolean\n /**\n * If `true`, display the drawer overlay.\n *\n * @default true\n */\n withOverlay?: boolean\n /**\n * Props to be forwarded to the portal component.\n */\n portalProps?: Omit<PortalProps, \"children\">\n /**\n * Callback function to run side effects after the drawer has closed.\n */\n onCloseComplete?: () => void\n}\n\nconst {\n ComponentContext,\n PropsContext: DrawerPropsContext,\n useComponentContext,\n usePropsContext: useDrawerPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<DrawerRootProps, DrawerStyle, ComponentContext>(\n \"drawer\",\n drawerStyle,\n)\n\nexport { DrawerPropsContext, useDrawerPropsContext }\n\n/**\n * `Drawer` is a component for a panel that appears from the edge of the screen.\n *\n * @see https://yamada-ui.com/docs/components/drawer\n */\nexport const DrawerRoot = withProvider<\"div\", DrawerRootProps, \"placement\">(\n ({\n allowPinchZoom = false,\n autoFocus,\n blockScrollOnMount = true,\n body,\n cancel,\n children,\n closeOnDrag,\n dragConstraints,\n dragElastic,\n dragHandleOnly,\n dragOffset,\n dragVelocity,\n duration = { enter: 0.4, exit: 0.3 },\n finalFocusRef,\n footer,\n header,\n initialFocusRef,\n lockFocusAcrossFrames = true,\n middle,\n placement: placementProp,\n restoreFocus,\n success,\n title,\n trigger,\n withCloseButton = !closeOnDrag,\n withDragBar = true,\n withOverlay = true,\n portalProps,\n onCancel,\n onCloseComplete,\n onMiddle,\n onSuccess,\n ...props\n }) => {\n const placement = useValue(placementProp)\n const [omittedChildren, openTrigger, customOverlay] = useSplitChildren(\n children,\n DrawerOpenTrigger,\n DrawerOverlay,\n )\n const hasChildren = isArray(omittedChildren) && !!omittedChildren.length\n const { open, getRootProps, ...rest } = useDrawer({\n closeOnDrag,\n dragConstraints,\n dragElastic,\n dragHandleOnly,\n dragOffset,\n dragVelocity,\n placement,\n ...props,\n })\n const customOpenTrigger = trigger ? (\n <DrawerOpenTrigger>{trigger}</DrawerOpenTrigger>\n ) : null\n\n const context = useMemo(\n () => ({\n duration,\n open,\n placement,\n withCloseButton,\n withDragBar,\n ...rest,\n }),\n [duration, open, withDragBar, placement, withCloseButton, rest],\n )\n\n return (\n <ComponentContext value={context}>\n {openTrigger ?? customOpenTrigger}\n\n <AnimatePresence onExitComplete={onCloseComplete}>\n {open ? (\n <Portal {...portalProps}>\n <FocusLock\n autoFocus={autoFocus}\n finalFocusRef={finalFocusRef}\n initialFocusRef={initialFocusRef}\n lockFocusAcrossFrames={lockFocusAcrossFrames}\n restoreFocus={restoreFocus}\n >\n <RemoveScroll\n allowPinchZoom={allowPinchZoom}\n enabled={blockScrollOnMount}\n forwardProps\n >\n <styled.div {...getRootProps()}>\n {customOverlay ?? (withOverlay ? <DrawerOverlay /> : null)}\n\n {hasChildren ? (\n omittedChildren\n ) : (\n <ShorthandDrawerContent\n body={body}\n cancel={cancel}\n footer={footer}\n header={header}\n middle={middle}\n success={success}\n title={title}\n onCancel={onCancel}\n onMiddle={onMiddle}\n onSuccess={onSuccess}\n />\n )}\n </styled.div>\n </RemoveScroll>\n </FocusLock>\n </Portal>\n ) : null}\n </AnimatePresence>\n </ComponentContext>\n )\n },\n \"root\",\n { transferProps: [\"placement\"] },\n)()\n\nexport interface DrawerOpenTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const DrawerOpenTrigger = withContext<\"button\", DrawerOpenTriggerProps>(\n \"button\",\n { name: \"OpenTrigger\", slot: [\"trigger\", \"open\"] },\n)(undefined, (props) => {\n const { getOpenTriggerProps } = useComponentContext()\n\n return { asChild: true, ...getOpenTriggerProps(props) }\n})\n\nexport interface DrawerCloseTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const DrawerCloseTrigger = withContext<\n \"button\",\n DrawerCloseTriggerProps\n>(\"button\", { name: \"CloseTrigger\", slot: [\"trigger\", \"close\"] })(\n undefined,\n (props) => {\n const { getCloseTriggerProps } = useComponentContext()\n\n return { asChild: true, ...getCloseTriggerProps(props) }\n },\n)\n\nexport interface DrawerCloseButtonProps extends CloseButtonProps {}\n\nexport const DrawerCloseButton = withContext<\"button\", DrawerCloseButtonProps>(\n CloseButton,\n \"closeButton\",\n)(undefined, (props) => {\n const { getCloseButtonProps } = useComponentContext()\n\n return { ...getCloseButtonProps(props) }\n})\n\nexport interface DrawerOverlayProps extends HTMLMotionProps {}\n\nexport const DrawerOverlay = withContext<\"div\", DrawerOverlayProps>((props) => {\n const { duration, getOverlayProps } = useComponentContext()\n\n return (\n <motion.div\n animate=\"enter\"\n custom={{ duration }}\n exit=\"exit\"\n initial=\"exit\"\n variants={fadeVariants}\n {...cast<HTMLMotionProps>(getOverlayProps(cast<HTMLProps>(props)))}\n />\n )\n}, \"overlay\")()\n\nexport interface DrawerContentProps\n extends Omit<HTMLMotionProps<\"section\">, \"children\">, PropsWithChildren {}\n\nexport const DrawerContent = withContext<\"div\", DrawerContentProps>(\n ({ children, ...rest }) => {\n const {\n closeOnDrag,\n duration,\n open,\n placement,\n withCloseButton,\n withDragBar,\n getContentProps,\n } = useComponentContext()\n const [omittedChildren, customCloseButton, customDragBar] =\n useSplitChildren(children, DrawerCloseButton, DrawerDragBar)\n\n return (\n <Slide\n as=\"section\"\n duration={duration}\n open={open}\n placement={placement}\n {...(getContentProps(rest) as SlideProps)}\n >\n {customCloseButton ?? (withCloseButton ? <DrawerCloseButton /> : null)}\n {customDragBar ??\n (withDragBar && closeOnDrag ? <DrawerDragBar /> : null)}\n\n {omittedChildren}\n </Slide>\n )\n },\n \"content\",\n)()\n\ninterface ShorthandDrawerContentProps {\n /**\n * The drawer body to use.\n */\n body?: DrawerBodyProps | ReactNode\n /**\n * The drawer cancel button to use.\n */\n cancel?: ButtonProps | ReactNode\n /**\n * The drawer footer to use.\n */\n footer?: DrawerFooterProps | ReactNode\n /**\n * The drawer header to use.\n */\n header?: DrawerHeaderProps | ReactNode\n /**\n * The drawer middle button to use.\n */\n middle?: ButtonProps | ReactNode\n /**\n * The drawer success button to use.\n */\n success?: ButtonProps | ReactNode\n /**\n * The drawer title to use.\n */\n title?: DrawerTitleProps | ReactNode\n /**\n * The callback invoked when cancel button clicked.\n */\n onCancel?: (onClose: () => void) => void\n /**\n * The callback invoked when middle button clicked.\n */\n onMiddle?: (onClose: () => void) => void\n /**\n * The callback invoked when success button clicked.\n */\n onSuccess?: (onClose: () => void) => void\n}\n\nexport const ShorthandDrawerContent: FC<ShorthandDrawerContentProps> = ({\n body,\n cancel,\n footer,\n header,\n middle,\n success,\n title,\n onCancel,\n onMiddle,\n onSuccess,\n}) => {\n const { onClose } = useComponentContext()\n const customHeader = wrapOrPassProps(DrawerHeader, header)\n const customTitle = wrapOrPassProps(DrawerTitle, title)\n const customBody = wrapOrPassProps(DrawerBody, body)\n const customFooter = wrapOrPassProps(DrawerFooter, footer)\n const customCancel = wrapOrPassProps(Button, cancel, {\n colorScheme: \"mono\",\n variant: \"ghost\",\n onClick: () => (onCancel ? onCancel(onClose) : onClose()),\n })\n const customMiddle = wrapOrPassProps(Button, middle, {\n colorScheme: \"secondary\",\n onClick: () => (onMiddle ? onMiddle(onClose) : onClose()),\n })\n const customSuccess = wrapOrPassProps(Button, success, {\n colorScheme: \"primary\",\n onClick: () => (onSuccess ? onSuccess(onClose) : onClose()),\n })\n\n return (\n <DrawerContent>\n {customHeader ??\n (customTitle ? <DrawerHeader>{customTitle}</DrawerHeader> : null)}\n {customBody}\n {customFooter ??\n (customCancel || customMiddle || customSuccess ? (\n <DrawerFooter>\n {customCancel}\n {customMiddle}\n {customSuccess}\n </DrawerFooter>\n ) : null)}\n </DrawerContent>\n )\n}\n\nexport interface DrawerDragBarProps extends HTMLStyledProps {}\n\nexport const DrawerDragBar = withContext<\"div\", DrawerDragBarProps>(\n \"div\",\n \"dragBar\",\n)(undefined, (props) => {\n const { getDragBarProps } = useComponentContext()\n\n return { ...getDragBarProps(props) }\n})\n\nexport interface DrawerDragTriggerProps extends HTMLStyledProps {}\n\nexport const DrawerDragTrigger = withContext<\"div\", DrawerDragTriggerProps>(\n \"div\",\n { name: \"DragTrigger\", slot: [\"trigger\", \"drag\"] },\n)(undefined, (props) => {\n const { getDragTriggerProps } = useComponentContext()\n\n return { asChild: true, ...getDragTriggerProps(props) }\n})\n\nexport interface DrawerHeaderProps extends HTMLStyledProps<\"header\"> {}\n\nexport const DrawerHeader = withContext<\"header\", DrawerHeaderProps>(\n \"header\",\n \"header\",\n)(undefined, (props) => {\n const { getHeaderProps } = useComponentContext()\n\n return { ...getHeaderProps(props) }\n})\n\nexport interface DrawerTitleProps extends HTMLStyledProps<\"h2\"> {}\n\nexport const DrawerTitle = withContext<\"h2\", DrawerTitleProps>(\"h2\", \"title\")(\n undefined,\n (props) => {\n const { getTitleProps } = useComponentContext()\n\n return { ...getTitleProps(props) }\n },\n)\n\nexport interface DrawerBodyProps extends HTMLStyledProps {}\n\nexport const DrawerBody = withContext<\"div\", DrawerBodyProps>(\"div\", \"body\")(\n undefined,\n (props) => {\n const { getBodyProps } = useComponentContext()\n\n return { ...getBodyProps(props) }\n },\n)\n\nexport interface DrawerFooterProps extends HTMLStyledProps<\"footer\"> {}\n\nexport const DrawerFooter = withContext<\"footer\", DrawerFooterProps>(\n \"footer\",\n \"footer\",\n)(undefined, (props) => {\n const { getFooterProps } = useComponentContext()\n\n return { ...getFooterProps(props) }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiGA,MAAM,EACJ,kBACA,cAAc,oBACd,qBACA,iBAAiB,uBACjB,aACA,iBACEA,yBAAAA,oBACF,UACAC,qBAAAA,WACF;;;;;;AASA,MAAa,aAAa,cACvB,EACC,iBAAiB,OACjB,WACA,qBAAqB,MACrB,MACA,QACA,UACA,aACA,iBACA,aACA,gBACA,YACA,cACA,WAAW;CAAE,OAAO;CAAK,MAAM;AAAI,GACnC,eACA,QACA,QACA,iBACA,wBAAwB,MACxB,QACA,WAAW,eACX,cACA,SACA,OACA,SACA,kBAAkB,CAAC,aACnB,cAAc,MACd,cAAc,MACd,aACA,UACA,iBACA,UACA,WACA,GAAG,YACC;CACJ,MAAM,YAAYC,8BAAAA,SAAS,aAAa;CACxC,MAAM,CAAC,iBAAiB,aAAa,iBAAiBC,iBAAAA,iBACpD,UACA,mBACA,aACF;CACA,MAAM,eAAA,GAAA,oBAAA,cAAc,QAAA,CAAQ,eAAe,KAAK,C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,gBAAgB,YAC3B,OACA,SACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,oBAAoB,oBAAoB;CAEhD,OAAO,EAAE,GAAG,gBAAgB,KAAK,EAAE;AACrC,CAAC;AAID,MAAa,oBAAoB,YAC/B,OACA;CAAE,MAAM;CAAe,MAAM,CAAC,WAAW,MAAM;AAAE,CACnD,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,wBAAwB,oBAAoB;CAEpD,OAAO;EAAE,SAAS;EAAM,GAAG,oBAAoB,KAAK;CAAE;AACxD,CAAC;AAID,MAAa,eAAe,YAC1B,UACA,QACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,mBAAmB,oBAAoB;CAE/C,OAAO,EAAE,GAAG,eAAe,KAAK,EAAE;AACpC,CAAC;AAID,MAAa,cAAc,YAAoC,MAAM,OAAO,CAAC,CAC3E,KAAA,IACC,UAAU;CACT,MAAM,EAAE,kBAAkB,oBAAoB;CAE9C,OAAO,EAAE,GAAG,cAAc,KAAK,EAAE;AACnC,CACF;AAIA,MAAa,aAAa,YAAoC,OAAO,MAAM,CAAC,CAC1E,KAAA,IACC,UAAU;CACT,MAAM,EAAE,iBAAiB,oBAAoB;CAE7C,OAAO,EAAE,GAAG,aAAa,KAAK,EAAE;AAClC,CACF;AAIA,MAAa,eAAe,YAC1B,UACA,QACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,mBAAmB,oBAAoB;CAE/C,OAAO,EAAE,GAAG,eAAe,KAAK,EAAE;AACpC,CAAC"}
@@ -14,6 +14,7 @@ exports.DrawerCloseButton = require_drawer.DrawerCloseButton;
14
14
  exports.DrawerCloseTrigger = require_drawer.DrawerCloseTrigger;
15
15
  exports.DrawerContent = require_drawer.DrawerContent;
16
16
  exports.DrawerDragBar = require_drawer.DrawerDragBar;
17
+ exports.DrawerDragTrigger = require_drawer.DrawerDragTrigger;
17
18
  exports.DrawerFooter = require_drawer.DrawerFooter;
18
19
  exports.DrawerHeader = require_drawer.DrawerHeader;
19
20
  exports.DrawerOpenTrigger = require_drawer.DrawerOpenTrigger;
@@ -7,6 +7,7 @@ var namespace_exports = /* @__PURE__ */ require_runtime.__exportAll({
7
7
  CloseTrigger: () => require_drawer.DrawerCloseTrigger,
8
8
  Content: () => require_drawer.DrawerContent,
9
9
  DragBar: () => require_drawer.DrawerDragBar,
10
+ DragTrigger: () => require_drawer.DrawerDragTrigger,
10
11
  Footer: () => require_drawer.DrawerFooter,
11
12
  Header: () => require_drawer.DrawerHeader,
12
13
  OpenTrigger: () => require_drawer.DrawerOpenTrigger,
@@ -22,6 +23,7 @@ exports.CloseButton = require_drawer.DrawerCloseButton;
22
23
  exports.CloseTrigger = require_drawer.DrawerCloseTrigger;
23
24
  exports.Content = require_drawer.DrawerContent;
24
25
  exports.DragBar = require_drawer.DrawerDragBar;
26
+ exports.DragTrigger = require_drawer.DrawerDragTrigger;
25
27
  exports.Footer = require_drawer.DrawerFooter;
26
28
  exports.Header = require_drawer.DrawerHeader;
27
29
  exports.OpenTrigger = require_drawer.DrawerOpenTrigger;
@@ -1 +1 @@
1
- {"version":3,"file":"namespace.cjs","names":[],"sources":["../../../../src/components/drawer/namespace.ts"],"sourcesContent":["export {\n DrawerBody as Body,\n DrawerCloseButton as CloseButton,\n DrawerCloseTrigger as CloseTrigger,\n DrawerContent as Content,\n DrawerDragBar as DragBar,\n DrawerFooter as Footer,\n DrawerHeader as Header,\n DrawerOpenTrigger as OpenTrigger,\n DrawerOverlay as Overlay,\n DrawerPropsContext as PropsContext,\n DrawerRoot as Root,\n DrawerTitle as Title,\n useDrawerPropsContext as usePropsContext,\n} from \"./drawer\"\nexport type {\n DrawerCloseButtonProps as CloseButtonProps,\n DrawerCloseTriggerProps as CloseTriggerProps,\n DrawerContentProps as ContentProps,\n DrawerDragBarProps as DragBarProps,\n DrawerFooterProps as FooterProps,\n DrawerHeaderProps as HeaderProps,\n DrawerOpenTriggerProps as OpenTriggerProps,\n DrawerOverlayProps as OverlayProps,\n DrawerRootProps as RootProps,\n DrawerTitleProps as TitleProps,\n} from \"./drawer\"\n"],"mappings":""}
1
+ {"version":3,"file":"namespace.cjs","names":[],"sources":["../../../../src/components/drawer/namespace.ts"],"sourcesContent":["export {\n DrawerBody as Body,\n DrawerCloseButton as CloseButton,\n DrawerCloseTrigger as CloseTrigger,\n DrawerContent as Content,\n DrawerDragBar as DragBar,\n DrawerDragTrigger as DragTrigger,\n DrawerFooter as Footer,\n DrawerHeader as Header,\n DrawerOpenTrigger as OpenTrigger,\n DrawerOverlay as Overlay,\n DrawerPropsContext as PropsContext,\n DrawerRoot as Root,\n DrawerTitle as Title,\n useDrawerPropsContext as usePropsContext,\n} from \"./drawer\"\nexport type {\n DrawerCloseButtonProps as CloseButtonProps,\n DrawerCloseTriggerProps as CloseTriggerProps,\n DrawerContentProps as ContentProps,\n DrawerDragBarProps as DragBarProps,\n DrawerDragTriggerProps as DragTriggerProps,\n DrawerFooterProps as FooterProps,\n DrawerHeaderProps as HeaderProps,\n DrawerOpenTriggerProps as OpenTriggerProps,\n DrawerOverlayProps as OverlayProps,\n DrawerRootProps as RootProps,\n DrawerTitleProps as TitleProps,\n} from \"./drawer\"\n"],"mappings":""}
@@ -1,15 +1,24 @@
1
1
  "use client";
2
2
  const require_utils_index = require("../../utils/index.cjs");
3
+ const require_environment_provider = require("../../core/system/environment-provider.cjs");
4
+ const require_props = require("../../core/components/props.cjs");
3
5
  const require_use_modal = require("../modal/use-modal.cjs");
4
6
  let react = require("react");
7
+ let motion_react = require("motion/react");
5
8
  //#region src/components/drawer/use-drawer.ts
6
- const useDrawer = ({ closeOnDrag = false, closeOnEsc, closeOnOverlay, dragConstraints = 0, dragElastic = .1, dragOffset = 80, dragVelocity = 100, placement = "inline-end", onEsc, ...rest } = {}) => {
7
- const { getContentProps: getModalContentProps, onClose, ...modalProps } = require_use_modal.useModal({
9
+ const useDrawer = ({ closeOnDrag = false, closeOnEsc, closeOnOverlay, dragConstraints = 0, dragElastic = .1, dragHandleOnly = false, dragOffset = 80, dragVelocity = 100, placement = "inline-end", onEsc, ...rest } = {}) => {
10
+ const { getWindow } = require_environment_provider.useEnvironment();
11
+ const { open, getContentProps: getModalContentProps, onClose, ...modalProps } = require_use_modal.useModal({
8
12
  closeOnEsc,
9
13
  closeOnOverlay,
10
14
  onEsc,
11
15
  ...rest
12
16
  });
17
+ const dragControls = (0, motion_react.useDragControls)();
18
+ const gesture = (0, react.useRef)(void 0);
19
+ const controller = (0, react.useRef)(void 0);
20
+ const axis = placement.startsWith("block") ? "y" : "x";
21
+ const direction = placement.endsWith("end") ? 1 : -1;
13
22
  const drag = (0, react.useMemo)(() => {
14
23
  if (!closeOnDrag) return false;
15
24
  switch (placement) {
@@ -19,6 +28,98 @@ const useDrawer = ({ closeOnDrag = false, closeOnEsc, closeOnOverlay, dragConstr
19
28
  case "inline-end": return "x";
20
29
  }
21
30
  }, [placement, closeOnDrag]);
31
+ const resetGesture = (0, react.useCallback)(() => {
32
+ controller.current?.abort();
33
+ controller.current = void 0;
34
+ gesture.current = void 0;
35
+ }, []);
36
+ const canScroll = (0, react.useCallback)((path, axis, delta) => {
37
+ const win = getWindow();
38
+ if (!win) return false;
39
+ return path.some((el) => {
40
+ const style = win.getComputedStyle(el);
41
+ const overflow = axis === "x" ? style.overflowX : style.overflowY;
42
+ if (!/auto|scroll|overlay/.test(overflow)) return false;
43
+ const size = axis === "x" ? el.scrollWidth : el.scrollHeight;
44
+ const clientSize = axis === "x" ? el.clientWidth : el.clientHeight;
45
+ const offset = axis === "x" ? el.scrollLeft : el.scrollTop;
46
+ const reversed = axis === "x" ? style.direction === "rtl" : style.flexDirection === "column-reverse";
47
+ const min = reversed ? clientSize - size : 0;
48
+ const max = reversed ? 0 : size - clientSize;
49
+ if (size <= clientSize) return false;
50
+ return delta > 0 ? offset > min + 1 : offset < max - 1;
51
+ });
52
+ }, [getWindow]);
53
+ const updateGesture = (0, react.useCallback)((x, y) => {
54
+ const current = gesture.current;
55
+ if (current?.owner !== "pending") return;
56
+ const dx = x - current.ev.clientX;
57
+ const dy = y - current.ev.clientY;
58
+ const delta = axis === "x" ? dx : dy;
59
+ const crossDelta = axis === "x" ? dy : dx;
60
+ if (Math.max(Math.abs(delta), Math.abs(crossDelta)) < 3) return;
61
+ if (Math.abs(crossDelta) > Math.abs(delta) || delta * direction <= 0 || canScroll(current.path, axis, delta)) current.owner = "scroll";
62
+ else {
63
+ current.owner = "drag";
64
+ dragControls.start(current.ev);
65
+ }
66
+ }, [
67
+ axis,
68
+ canScroll,
69
+ direction,
70
+ dragControls
71
+ ]);
72
+ const onPointerDown = (0, react.useCallback)((ev) => {
73
+ if (ev.defaultPrevented) return;
74
+ resetGesture();
75
+ if (!open || !closeOnDrag || dragHandleOnly) return;
76
+ if (ev.button !== 0 || !ev.isPrimary) return;
77
+ if (ev.pointerType === "mouse") dragControls.start(ev);
78
+ else {
79
+ const win = getWindow();
80
+ if (!win) return;
81
+ const targets = ev.nativeEvent.composedPath();
82
+ const path = targets.slice(0, targets.indexOf(ev.currentTarget) + 1).filter(require_utils_index.utils_exports.isHTMLElement);
83
+ gesture.current = {
84
+ ev: ev.nativeEvent,
85
+ owner: "pending",
86
+ path
87
+ };
88
+ controller.current = new AbortController();
89
+ (0, require_utils_index.utils_exports.addDomEvent)(ev.currentTarget, "touchmove", (ev) => {
90
+ if (ev.touches.length !== 1) resetGesture();
91
+ else {
92
+ if (!ev.touches[0]) return;
93
+ updateGesture(ev.touches[0].clientX, ev.touches[0].clientY);
94
+ if (gesture.current?.owner === "drag" && ev.cancelable) ev.preventDefault();
95
+ }
96
+ }, {
97
+ passive: false,
98
+ signal: controller.current.signal
99
+ });
100
+ win.addEventListener("pointerup", resetGesture, {
101
+ signal: controller.current.signal,
102
+ once: true
103
+ });
104
+ win.addEventListener("pointercancel", resetGesture, {
105
+ signal: controller.current.signal,
106
+ once: true
107
+ });
108
+ }
109
+ }, [
110
+ closeOnDrag,
111
+ dragControls,
112
+ dragHandleOnly,
113
+ getWindow,
114
+ open,
115
+ resetGesture,
116
+ updateGesture
117
+ ]);
118
+ const onPointerMove = (0, react.useCallback)((ev) => {
119
+ if (ev.defaultPrevented) return;
120
+ if (ev.pointerId !== gesture.current?.ev.pointerId) return;
121
+ updateGesture(ev.clientX, ev.clientY);
122
+ }, [updateGesture]);
22
123
  const getDragRestriction = (0, react.useCallback)((value) => {
23
124
  switch (placement) {
24
125
  case "block-start": return { bottom: value };
@@ -27,7 +128,9 @@ const useDrawer = ({ closeOnDrag = false, closeOnEsc, closeOnOverlay, dragConstr
27
128
  case "inline-end": return { left: value };
28
129
  }
29
130
  }, [placement]);
30
- const onDragEnd = (0, react.useCallback)((_, info) => {
131
+ const onDragEnd = (0, react.useCallback)((ev, info) => {
132
+ if (ev.defaultPrevented) return;
133
+ if (ev.type === "pointercancel" || ev.type === "touchcancel") return;
31
134
  switch (placement) {
32
135
  case "block-start":
33
136
  if (info.velocity.y <= dragVelocity * -1 || info.offset.y <= dragOffset * -1) onClose();
@@ -46,28 +149,53 @@ const useDrawer = ({ closeOnDrag = false, closeOnEsc, closeOnOverlay, dragConstr
46
149
  dragOffset,
47
150
  onClose
48
151
  ]);
49
- const getContentProps = (0, react.useCallback)((props = {}) => ({
152
+ (0, react.useEffect)(() => {
153
+ resetGesture();
154
+ return resetGesture;
155
+ }, [
156
+ closeOnDrag,
157
+ dragHandleOnly,
158
+ open,
159
+ placement,
160
+ resetGesture
161
+ ]);
162
+ const getContentProps = (0, react.useCallback)((props = {}) => require_props.mergeProps({
50
163
  drag,
51
164
  dragConstraints: getDragRestriction(dragConstraints),
165
+ dragControls,
52
166
  dragElastic: getDragRestriction(dragElastic),
167
+ dragListener: false,
53
168
  dragMomentum: false,
54
- dragSnapToOrigin: true,
55
- ...(0, require_utils_index.utils_exports.cast)(getModalContentProps((0, require_utils_index.utils_exports.cast)(props))),
56
- onDragEnd: (0, require_utils_index.utils_exports.handlerAll)((ev, info) => props.onDragEnd?.(ev, info), onDragEnd)
57
- }), [
169
+ dragSnapToOrigin: true
170
+ }, (0, require_utils_index.utils_exports.cast)(getModalContentProps((0, require_utils_index.utils_exports.cast)(props))), {
171
+ onDragEnd,
172
+ onPointerDown,
173
+ onPointerMove
174
+ })(), [
58
175
  drag,
176
+ dragControls,
59
177
  getDragRestriction,
60
178
  dragConstraints,
61
179
  dragElastic,
62
180
  onDragEnd,
63
- getModalContentProps
181
+ getModalContentProps,
182
+ onPointerDown,
183
+ onPointerMove
184
+ ]);
185
+ const getDragTriggerProps = (0, react.useCallback)((props = {}) => require_props.mergeProps({ style: { touchAction: closeOnDrag && dragHandleOnly ? "none" : void 0 } }, props, { onPointerDown: (ev) => {
186
+ if (closeOnDrag && dragHandleOnly) dragControls.start(ev);
187
+ } })(), [
188
+ closeOnDrag,
189
+ dragHandleOnly,
190
+ dragControls
64
191
  ]);
65
- const getDragBarProps = (0, react.useCallback)((props) => ({ ...props }), []);
66
192
  return {
67
193
  ...modalProps,
68
194
  closeOnDrag,
195
+ open,
69
196
  getContentProps,
70
- getDragBarProps,
197
+ getDragBarProps: getDragTriggerProps,
198
+ getDragTriggerProps,
71
199
  onClose
72
200
  };
73
201
  };