@yamada-ui/react 2.3.0-next-20261009073533 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (481) 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/tree/tree.cjs +5 -3
  155. package/dist/cjs/components/tree/tree.cjs.map +1 -1
  156. package/dist/cjs/core/components/create-component.cjs +1 -1
  157. package/dist/cjs/core/components/create-component.cjs.map +1 -1
  158. package/dist/cjs/core/css/conditions.cjs +4 -4
  159. package/dist/cjs/core/css/conditions.cjs.map +1 -1
  160. package/dist/cjs/core/css/styles.cjs.map +1 -1
  161. package/dist/cjs/hooks/use-focus/index.cjs +7 -14
  162. package/dist/cjs/hooks/use-focus/index.cjs.map +1 -1
  163. package/dist/cjs/index.cjs +306 -112
  164. package/dist/cjs/index.cjs.map +1 -1
  165. package/dist/cjs/utils/children.cjs +22 -9
  166. package/dist/cjs/utils/children.cjs.map +1 -1
  167. package/dist/cjs/utils/index.cjs +4 -0
  168. package/dist/esm/components/accordion/accordion.js +5 -4
  169. package/dist/esm/components/accordion/accordion.js.map +1 -1
  170. package/dist/esm/components/aspect-ratio/aspect-ratio.js +2 -2
  171. package/dist/esm/components/aspect-ratio/aspect-ratio.js.map +1 -1
  172. package/dist/esm/components/blockquote/blockquote.style.js +1 -1
  173. package/dist/esm/components/blockquote/blockquote.style.js.map +1 -1
  174. package/dist/esm/components/box/index.js +1 -2
  175. package/dist/esm/components/breadcrumb/use-breadcrumb.js +2 -1
  176. package/dist/esm/components/breadcrumb/use-breadcrumb.js.map +1 -1
  177. package/dist/esm/components/bubble/bubble.js +157 -0
  178. package/dist/esm/components/bubble/bubble.js.map +1 -0
  179. package/dist/esm/components/bubble/bubble.style.js +144 -0
  180. package/dist/esm/components/bubble/bubble.style.js.map +1 -0
  181. package/dist/esm/components/bubble/index.js +4 -0
  182. package/dist/esm/components/bubble/namespace.js +16 -0
  183. package/dist/esm/components/bubble/namespace.js.map +1 -0
  184. package/dist/esm/components/button/button.js +11 -8
  185. package/dist/esm/components/button/button.js.map +1 -1
  186. package/dist/esm/components/calendar/calendar.js +3 -1
  187. package/dist/esm/components/calendar/calendar.js.map +1 -1
  188. package/dist/esm/components/calendar/use-calendar.js +12 -7
  189. package/dist/esm/components/calendar/use-calendar.js.map +1 -1
  190. package/dist/esm/components/client-only/index.js +1 -2
  191. package/dist/esm/components/code/code.style.js +2 -1
  192. package/dist/esm/components/code/code.style.js.map +1 -1
  193. package/dist/esm/components/date-picker/use-date-picker.js +10 -10
  194. package/dist/esm/components/date-picker/use-date-picker.js.map +1 -1
  195. package/dist/esm/components/drawer/drawer.js +13 -2
  196. package/dist/esm/components/drawer/drawer.js.map +1 -1
  197. package/dist/esm/components/drawer/index.js +2 -2
  198. package/dist/esm/components/drawer/namespace.js +3 -2
  199. package/dist/esm/components/drawer/namespace.js.map +1 -1
  200. package/dist/esm/components/drawer/use-drawer.js +140 -12
  201. package/dist/esm/components/drawer/use-drawer.js.map +1 -1
  202. package/dist/esm/components/field/field.js +5 -4
  203. package/dist/esm/components/field/field.js.map +1 -1
  204. package/dist/esm/components/file-input/use-file-input.js.map +1 -1
  205. package/dist/esm/components/focus-lock/index.js +1 -2
  206. package/dist/esm/components/for/index.js +1 -2
  207. package/dist/esm/components/icon/icons/armenian-dram-icon.js +14 -0
  208. package/dist/esm/components/icon/icons/armenian-dram-icon.js.map +1 -0
  209. package/dist/esm/components/icon/icons/bangladeshi-taka-icon.js +14 -0
  210. package/dist/esm/components/icon/icons/bangladeshi-taka-icon.js.map +1 -0
  211. package/dist/esm/components/icon/icons/belarusian-ruble-icon.js +14 -0
  212. package/dist/esm/components/icon/icons/belarusian-ruble-icon.js.map +1 -0
  213. package/dist/esm/components/icon/icons/calendar-chevrons-left-icon.js +14 -0
  214. package/dist/esm/components/icon/icons/calendar-chevrons-left-icon.js.map +1 -0
  215. package/dist/esm/components/icon/icons/certificate-icon.js +14 -0
  216. package/dist/esm/components/icon/icons/certificate-icon.js.map +1 -0
  217. package/dist/esm/components/icon/icons/circle-fading-play-icon.js +14 -0
  218. package/dist/esm/components/icon/icons/circle-fading-play-icon.js.map +1 -0
  219. package/dist/esm/components/icon/icons/cpu-ai-icon.js +14 -0
  220. package/dist/esm/components/icon/icons/cpu-ai-icon.js.map +1 -0
  221. package/dist/esm/components/icon/icons/door-closed-cog-icon.js +14 -0
  222. package/dist/esm/components/icon/icons/door-closed-cog-icon.js.map +1 -0
  223. package/dist/esm/components/icon/icons/eighth-note-icon.js +14 -0
  224. package/dist/esm/components/icon/icons/eighth-note-icon.js.map +1 -0
  225. package/dist/esm/components/icon/icons/eighth-notes-icon.js +14 -0
  226. package/dist/esm/components/icon/icons/eighth-notes-icon.js.map +1 -0
  227. package/dist/esm/components/icon/icons/folder-user-icon.js +14 -0
  228. package/dist/esm/components/icon/icons/folder-user-icon.js.map +1 -0
  229. package/dist/esm/components/icon/icons/folder-users-icon.js +14 -0
  230. package/dist/esm/components/icon/icons/folder-users-icon.js.map +1 -0
  231. package/dist/esm/components/icon/icons/graph-star-icon.js +14 -0
  232. package/dist/esm/components/icon/icons/graph-star-icon.js.map +1 -0
  233. package/dist/esm/components/icon/icons/groceries-icon.js +14 -0
  234. package/dist/esm/components/icon/icons/groceries-icon.js.map +1 -0
  235. package/dist/esm/components/icon/icons/guitar-electric-icon.js +14 -0
  236. package/dist/esm/components/icon/icons/guitar-electric-icon.js.map +1 -0
  237. package/dist/esm/components/icon/icons/half-note-icon.js +14 -0
  238. package/dist/esm/components/icon/icons/half-note-icon.js.map +1 -0
  239. package/dist/esm/components/icon/icons/handle-bottom-right-icon.js +14 -0
  240. package/dist/esm/components/icon/icons/handle-bottom-right-icon.js.map +1 -0
  241. package/dist/esm/components/icon/icons/hiking-stick-icon.js +14 -0
  242. package/dist/esm/components/icon/icons/hiking-stick-icon.js.map +1 -0
  243. package/dist/esm/components/icon/icons/index.js +83 -9
  244. package/dist/esm/components/icon/icons/index.js.map +1 -1
  245. package/dist/esm/components/icon/icons/kazakh-tenge-icon.js +14 -0
  246. package/dist/esm/components/icon/icons/kazakh-tenge-icon.js.map +1 -0
  247. package/dist/esm/components/icon/icons/layout-grid-circles-icon.js +14 -0
  248. package/dist/esm/components/icon/icons/layout-grid-circles-icon.js.map +1 -0
  249. package/dist/esm/components/icon/icons/lens-icon.js +14 -0
  250. package/dist/esm/components/icon/icons/lens-icon.js.map +1 -0
  251. package/dist/esm/components/icon/icons/letters-icon.js +14 -0
  252. package/dist/esm/components/icon/icons/letters-icon.js.map +1 -0
  253. package/dist/esm/components/icon/icons/mail-dot-icon.js +14 -0
  254. package/dist/esm/components/icon/icons/mail-dot-icon.js.map +1 -0
  255. package/dist/esm/components/icon/icons/message-circle-text-icon.js +14 -0
  256. package/dist/esm/components/icon/icons/message-circle-text-icon.js.map +1 -0
  257. package/dist/esm/components/icon/icons/perfume-bottle-icon.js +14 -0
  258. package/dist/esm/components/icon/icons/perfume-bottle-icon.js.map +1 -0
  259. package/dist/esm/components/icon/icons/phone-log-icon.js +14 -0
  260. package/dist/esm/components/icon/icons/phone-log-icon.js.map +1 -0
  261. package/dist/esm/components/icon/icons/printer3d-icon.js +14 -0
  262. package/dist/esm/components/icon/icons/printer3d-icon.js.map +1 -0
  263. package/dist/esm/components/icon/icons/rugby-ball-icon.js +14 -0
  264. package/dist/esm/components/icon/icons/rugby-ball-icon.js.map +1 -0
  265. package/dist/esm/components/icon/icons/scratch-blocks-icon.js +14 -0
  266. package/dist/esm/components/icon/icons/scratch-blocks-icon.js.map +1 -0
  267. package/dist/esm/components/icon/icons/screw-icon.js +14 -0
  268. package/dist/esm/components/icon/icons/screw-icon.js.map +1 -0
  269. package/dist/esm/components/icon/icons/server-nas-icon.js +14 -0
  270. package/dist/esm/components/icon/icons/server-nas-icon.js.map +1 -0
  271. package/dist/esm/components/icon/icons/shield-house-icon.js +14 -0
  272. package/dist/esm/components/icon/icons/shield-house-icon.js.map +1 -0
  273. package/dist/esm/components/icon/icons/sixteenth-notes-icon.js +14 -0
  274. package/dist/esm/components/icon/icons/sixteenth-notes-icon.js.map +1 -0
  275. package/dist/esm/components/icon/icons/text-align-justify-center-icon.js +14 -0
  276. package/dist/esm/components/icon/icons/text-align-justify-center-icon.js.map +1 -0
  277. package/dist/esm/components/icon/icons/text-align-justify-end-icon.js +14 -0
  278. package/dist/esm/components/icon/icons/text-align-justify-end-icon.js.map +1 -0
  279. package/dist/esm/components/icon/icons/text-align-justify-start-icon.js +14 -0
  280. package/dist/esm/components/icon/icons/text-align-justify-start-icon.js.map +1 -0
  281. package/dist/esm/components/icon/icons/user-round-star-icon.js +14 -0
  282. package/dist/esm/components/icon/icons/user-round-star-icon.js.map +1 -0
  283. package/dist/esm/components/icon/icons/users-collaboration-icon.js +14 -0
  284. package/dist/esm/components/icon/icons/users-collaboration-icon.js.map +1 -0
  285. package/dist/esm/components/icon/icons/users-round-collaboration-icon.js +14 -0
  286. package/dist/esm/components/icon/icons/users-round-collaboration-icon.js.map +1 -0
  287. package/dist/esm/components/icon/icons/wifi-lock-icon.js +14 -0
  288. package/dist/esm/components/icon/icons/wifi-lock-icon.js.map +1 -0
  289. package/dist/esm/components/icon/icons/wind-arrow-up-icon.js +14 -0
  290. package/dist/esm/components/icon/icons/wind-arrow-up-icon.js.map +1 -0
  291. package/dist/esm/components/icon/index.js +42 -5
  292. package/dist/esm/components/kbd/kbd.style.js +2 -1
  293. package/dist/esm/components/kbd/kbd.style.js.map +1 -1
  294. package/dist/esm/components/list/list.js +5 -3
  295. package/dist/esm/components/list/list.js.map +1 -1
  296. package/dist/esm/components/marquee/index.js +5 -0
  297. package/dist/esm/components/marquee/marquee.js +69 -0
  298. package/dist/esm/components/marquee/marquee.js.map +1 -0
  299. package/dist/esm/components/marquee/marquee.style.js +122 -0
  300. package/dist/esm/components/marquee/marquee.style.js.map +1 -0
  301. package/dist/esm/components/marquee/namespace.js +15 -0
  302. package/dist/esm/components/marquee/namespace.js.map +1 -0
  303. package/dist/esm/components/marquee/use-marquee.js +181 -0
  304. package/dist/esm/components/marquee/use-marquee.js.map +1 -0
  305. package/dist/esm/components/native-accordion/native-accordion.js +5 -4
  306. package/dist/esm/components/native-accordion/native-accordion.js.map +1 -1
  307. package/dist/esm/components/picture/index.js +1 -2
  308. package/dist/esm/components/portal/index.js +1 -2
  309. package/dist/esm/components/prose/index.js +3 -0
  310. package/dist/esm/components/prose/prose.js +15 -0
  311. package/dist/esm/components/prose/prose.js.map +1 -0
  312. package/dist/esm/components/prose/prose.style.js +205 -0
  313. package/dist/esm/components/prose/prose.style.js.map +1 -0
  314. package/dist/esm/components/reorder/use-reorder.js +2 -1
  315. package/dist/esm/components/reorder/use-reorder.js.map +1 -1
  316. package/dist/esm/components/select/use-select.js.map +1 -1
  317. package/dist/esm/components/show/index.js +1 -2
  318. package/dist/esm/components/sidebar/sidebar.js +5 -4
  319. package/dist/esm/components/sidebar/sidebar.js.map +1 -1
  320. package/dist/esm/components/slot/index.js +1 -2
  321. package/dist/esm/components/slot/slot.js +11 -10
  322. package/dist/esm/components/slot/slot.js.map +1 -1
  323. package/dist/esm/components/stack/stack.js +2 -1
  324. package/dist/esm/components/stack/stack.js.map +1 -1
  325. package/dist/esm/components/table/index.js +1 -2
  326. package/dist/esm/components/tip/index.js +1 -2
  327. package/dist/esm/components/tree/tree.js +5 -3
  328. package/dist/esm/components/tree/tree.js.map +1 -1
  329. package/dist/esm/core/components/create-component.js +1 -1
  330. package/dist/esm/core/components/create-component.js.map +1 -1
  331. package/dist/esm/core/css/conditions.js +4 -4
  332. package/dist/esm/core/css/conditions.js.map +1 -1
  333. package/dist/esm/core/css/styles.js.map +1 -1
  334. package/dist/esm/hooks/use-focus/index.js +8 -15
  335. package/dist/esm/hooks/use-focus/index.js.map +1 -1
  336. package/dist/esm/index.js +215 -105
  337. package/dist/esm/index.js.map +1 -1
  338. package/dist/esm/providers/ui-provider/index.js +1 -2
  339. package/dist/esm/utils/children.js +22 -11
  340. package/dist/esm/utils/children.js.map +1 -1
  341. package/dist/esm/utils/index.js +4 -2
  342. package/dist/types/components/alert/alert.d.ts +0 -1
  343. package/dist/types/components/alpha-slider/alpha-slider.d.ts +0 -1
  344. package/dist/types/components/autocomplete/autocomplete.d.ts +0 -1
  345. package/dist/types/components/breadcrumb/use-breadcrumb.d.ts +1 -1
  346. package/dist/types/components/bubble/bubble.d.ts +89 -0
  347. package/dist/types/components/bubble/bubble.style.d.ts +79 -0
  348. package/dist/types/components/bubble/index.d.ts +4 -0
  349. package/dist/types/components/bubble/namespace.d.ts +7 -0
  350. package/dist/types/components/button/button.d.ts +0 -1
  351. package/dist/types/components/calendar/calendar.d.ts +0 -1
  352. package/dist/types/components/calendar/use-calendar.d.ts +4 -3
  353. package/dist/types/components/color-picker/color-picker.d.ts +0 -3
  354. package/dist/types/components/color-selector/color-selector.d.ts +0 -1
  355. package/dist/types/components/color-selector/use-color-selector.d.ts +1 -0
  356. package/dist/types/components/date-picker/date-picker.d.ts +0 -3
  357. package/dist/types/components/date-picker/use-date-picker.d.ts +1 -0
  358. package/dist/types/components/drawer/drawer.d.ts +2 -0
  359. package/dist/types/components/drawer/index.d.ts +2 -2
  360. package/dist/types/components/drawer/namespace.d.ts +3 -3
  361. package/dist/types/components/drawer/use-drawer.d.ts +9 -2
  362. package/dist/types/components/dropzone/dropzone.d.ts +0 -1
  363. package/dist/types/components/hue-slider/hue-slider.d.ts +0 -1
  364. package/dist/types/components/icon/icons/armenian-dram-icon.d.ts +12 -0
  365. package/dist/types/components/icon/icons/bangladeshi-taka-icon.d.ts +12 -0
  366. package/dist/types/components/icon/icons/belarusian-ruble-icon.d.ts +12 -0
  367. package/dist/types/components/icon/icons/calendar-chevrons-left-icon.d.ts +12 -0
  368. package/dist/types/components/icon/icons/certificate-icon.d.ts +12 -0
  369. package/dist/types/components/icon/icons/circle-fading-play-icon.d.ts +12 -0
  370. package/dist/types/components/icon/icons/cpu-ai-icon.d.ts +12 -0
  371. package/dist/types/components/icon/icons/door-closed-cog-icon.d.ts +12 -0
  372. package/dist/types/components/icon/icons/eighth-note-icon.d.ts +12 -0
  373. package/dist/types/components/icon/icons/eighth-notes-icon.d.ts +12 -0
  374. package/dist/types/components/icon/icons/folder-user-icon.d.ts +12 -0
  375. package/dist/types/components/icon/icons/folder-users-icon.d.ts +12 -0
  376. package/dist/types/components/icon/icons/graph-star-icon.d.ts +12 -0
  377. package/dist/types/components/icon/icons/groceries-icon.d.ts +12 -0
  378. package/dist/types/components/icon/icons/guitar-electric-icon.d.ts +12 -0
  379. package/dist/types/components/icon/icons/half-note-icon.d.ts +12 -0
  380. package/dist/types/components/icon/icons/handle-bottom-right-icon.d.ts +12 -0
  381. package/dist/types/components/icon/icons/hiking-stick-icon.d.ts +12 -0
  382. package/dist/types/components/icon/icons/index.d.ts +43 -6
  383. package/dist/types/components/icon/icons/index.type.d.ts +1 -1
  384. package/dist/types/components/icon/icons/kazakh-tenge-icon.d.ts +12 -0
  385. package/dist/types/components/icon/icons/layout-grid-circles-icon.d.ts +12 -0
  386. package/dist/types/components/icon/icons/lens-icon.d.ts +12 -0
  387. package/dist/types/components/icon/icons/letters-icon.d.ts +12 -0
  388. package/dist/types/components/icon/icons/mail-dot-icon.d.ts +12 -0
  389. package/dist/types/components/icon/icons/message-circle-text-icon.d.ts +12 -0
  390. package/dist/types/components/icon/icons/perfume-bottle-icon.d.ts +12 -0
  391. package/dist/types/components/icon/icons/phone-log-icon.d.ts +12 -0
  392. package/dist/types/components/icon/icons/printer3d-icon.d.ts +12 -0
  393. package/dist/types/components/icon/icons/rugby-ball-icon.d.ts +12 -0
  394. package/dist/types/components/icon/icons/scratch-blocks-icon.d.ts +12 -0
  395. package/dist/types/components/icon/icons/{music-icon.d.ts → screw-icon.d.ts} +4 -4
  396. package/dist/types/components/icon/icons/server-nas-icon.d.ts +12 -0
  397. package/dist/types/components/icon/icons/shield-house-icon.d.ts +12 -0
  398. package/dist/types/components/icon/icons/sixteenth-notes-icon.d.ts +12 -0
  399. package/dist/types/components/icon/icons/text-align-justify-center-icon.d.ts +12 -0
  400. package/dist/types/components/icon/icons/text-align-justify-end-icon.d.ts +12 -0
  401. package/dist/types/components/icon/icons/text-align-justify-start-icon.d.ts +12 -0
  402. package/dist/types/components/icon/icons/user-round-star-icon.d.ts +12 -0
  403. package/dist/types/components/icon/icons/users-collaboration-icon.d.ts +12 -0
  404. package/dist/types/components/icon/icons/users-round-collaboration-icon.d.ts +12 -0
  405. package/dist/types/components/icon/icons/wifi-lock-icon.d.ts +12 -0
  406. package/dist/types/components/icon/icons/wind-arrow-up-icon.d.ts +12 -0
  407. package/dist/types/components/icon/index.d.ts +42 -5
  408. package/dist/types/components/loading/loading-provider.d.ts +1 -0
  409. package/dist/types/components/loading/use-loading-component.d.ts +0 -1
  410. package/dist/types/components/marquee/index.d.ts +5 -0
  411. package/dist/types/components/marquee/marquee.d.ts +50 -0
  412. package/dist/types/components/marquee/marquee.style.d.ts +8 -0
  413. package/dist/types/components/marquee/namespace.d.ts +8 -0
  414. package/dist/types/components/marquee/use-marquee.d.ts +127 -0
  415. package/dist/types/components/menu/menu.d.ts +0 -1
  416. package/dist/types/components/motion/factory.d.ts +1 -0
  417. package/dist/types/components/motion/index.type.d.ts +4 -3
  418. package/dist/types/components/native-select/native-select.d.ts +0 -1
  419. package/dist/types/components/native-select/use-native-select.d.ts +1 -0
  420. package/dist/types/components/notice/use-notice.d.ts +0 -1
  421. package/dist/types/components/number-input/number-input.d.ts +0 -1
  422. package/dist/types/components/pagination/pagination.d.ts +0 -1
  423. package/dist/types/components/password-input/password-input.d.ts +0 -1
  424. package/dist/types/components/prose/index.d.ts +3 -0
  425. package/dist/types/components/prose/prose.d.ts +17 -0
  426. package/dist/types/components/prose/prose.style.d.ts +121 -0
  427. package/dist/types/components/rating/rating.d.ts +1 -0
  428. package/dist/types/components/reorder/use-reorder.d.ts +1 -1
  429. package/dist/types/components/select/select.d.ts +0 -1
  430. package/dist/types/components/sidebar/sidebar.d.ts +0 -2
  431. package/dist/types/components/sidebar/sidebar.style.d.ts +1 -0
  432. package/dist/types/components/snacks/use-snacks.d.ts +1 -1
  433. package/dist/types/components/table/table.d.ts +0 -1
  434. package/dist/types/components/tree/tree.d.ts +0 -1
  435. package/dist/types/core/components/create-component.d.ts +1 -0
  436. package/dist/types/core/components/index.type.d.ts +4 -2
  437. package/dist/types/core/components/props.d.ts +1 -0
  438. package/dist/types/core/components/use-component-style.d.ts +1 -0
  439. package/dist/types/core/css/conditions.d.ts +10 -10
  440. package/dist/types/core/css/styles.d.ts +36 -16
  441. package/dist/types/core/system/breakpoint.d.ts +1 -0
  442. package/dist/types/core/system/config.d.ts +1 -0
  443. package/dist/types/core/system/create-system.d.ts +1 -0
  444. package/dist/types/core/system/factory.d.ts +1 -0
  445. package/dist/types/core/system/index.type.d.ts +1 -0
  446. package/dist/types/core/system/system-provider.d.ts +1 -0
  447. package/dist/types/hooks/use-async/index.d.ts +1 -0
  448. package/dist/types/hooks/use-async-callback/index.d.ts +1 -1
  449. package/dist/types/hooks/use-controllable-state/index.d.ts +1 -0
  450. package/dist/types/hooks/use-descendants/index.d.ts +1 -0
  451. package/dist/types/hooks/use-eye-dropper/index.d.ts +1 -0
  452. package/dist/types/hooks/use-popper/index.d.ts +1 -0
  453. package/dist/types/hooks/use-window-event/index.d.ts +1 -0
  454. package/dist/types/index.d.ts +103 -54
  455. package/dist/types/providers/i18n-provider/i18n-cache.d.ts +1 -0
  456. package/dist/types/providers/i18n-provider/icu.type.d.ts +1 -0
  457. package/dist/types/utils/children.d.ts +11 -2
  458. package/dist/types/utils/context.d.ts +1 -0
  459. package/dist/types/utils/dom.d.ts +1 -0
  460. package/dist/types/utils/index.d.ts +3 -3
  461. package/dist/types/utils/store.d.ts +1 -0
  462. package/package.json +21 -18
  463. package/dist/cjs/components/icon/icons/music-icon.cjs +0 -14
  464. package/dist/cjs/components/icon/icons/music-icon.cjs.map +0 -1
  465. package/dist/cjs/components/icon/icons/music2-icon.cjs +0 -14
  466. package/dist/cjs/components/icon/icons/music2-icon.cjs.map +0 -1
  467. package/dist/cjs/components/icon/icons/music3-icon.cjs +0 -14
  468. package/dist/cjs/components/icon/icons/music3-icon.cjs.map +0 -1
  469. package/dist/cjs/components/icon/icons/music4-icon.cjs +0 -14
  470. package/dist/cjs/components/icon/icons/music4-icon.cjs.map +0 -1
  471. package/dist/esm/components/icon/icons/music-icon.js +0 -14
  472. package/dist/esm/components/icon/icons/music-icon.js.map +0 -1
  473. package/dist/esm/components/icon/icons/music2-icon.js +0 -14
  474. package/dist/esm/components/icon/icons/music2-icon.js.map +0 -1
  475. package/dist/esm/components/icon/icons/music3-icon.js +0 -14
  476. package/dist/esm/components/icon/icons/music3-icon.js.map +0 -1
  477. package/dist/esm/components/icon/icons/music4-icon.js +0 -14
  478. package/dist/esm/components/icon/icons/music4-icon.js.map +0 -1
  479. package/dist/types/components/icon/icons/music2-icon.d.ts +0 -12
  480. package/dist/types/components/icon/icons/music3-icon.d.ts +0 -12
  481. package/dist/types/components/icon/icons/music4-icon.d.ts +0 -12
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.js","names":["isArray","motion","cast"],"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,iBACE,oBACF,UACA,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,YAAY,SAAS,aAAa;CACxC,MAAM,CAAC,iBAAiB,aAAa,iBAAiB,iBACpD,UACA,mBACA,aACF;CACA,MAAM,eAAA,GAAcA,cAAAA,QAAAA,CAAQ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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.js","names":["isArray","motion","cast"],"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,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AAgB,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"}
@@ -1,5 +1,5 @@
1
1
  import { drawerStyle } from "./drawer.style.js";
2
2
  import { useDrawer } from "./use-drawer.js";
3
- import { DrawerBody, DrawerCloseButton, DrawerCloseTrigger, DrawerContent, DrawerDragBar, DrawerFooter, DrawerHeader, DrawerOpenTrigger, DrawerOverlay, DrawerPropsContext, DrawerRoot, DrawerTitle, useDrawerPropsContext } from "./drawer.js";
3
+ import { DrawerBody, DrawerCloseButton, DrawerCloseTrigger, DrawerContent, DrawerDragBar, DrawerDragTrigger, DrawerFooter, DrawerHeader, DrawerOpenTrigger, DrawerOverlay, DrawerPropsContext, DrawerRoot, DrawerTitle, useDrawerPropsContext } from "./drawer.js";
4
4
  import { namespace_exports } from "./namespace.js";
5
- export { namespace_exports as Drawer, DrawerBody, DrawerCloseButton, DrawerCloseTrigger, DrawerContent, DrawerDragBar, DrawerFooter, DrawerHeader, DrawerOpenTrigger, DrawerOverlay, DrawerPropsContext, DrawerRoot, DrawerTitle, drawerStyle, useDrawer, useDrawerPropsContext };
5
+ export { namespace_exports as Drawer, DrawerBody, DrawerCloseButton, DrawerCloseTrigger, DrawerContent, DrawerDragBar, DrawerDragTrigger, DrawerFooter, DrawerHeader, DrawerOpenTrigger, DrawerOverlay, DrawerPropsContext, DrawerRoot, DrawerTitle, drawerStyle, useDrawer, useDrawerPropsContext };
@@ -1,5 +1,5 @@
1
1
  import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
2
- import { DrawerBody, DrawerCloseButton, DrawerCloseTrigger, DrawerContent, DrawerDragBar, DrawerFooter, DrawerHeader, DrawerOpenTrigger, DrawerOverlay, DrawerPropsContext, DrawerRoot, DrawerTitle, useDrawerPropsContext } from "./drawer.js";
2
+ import { DrawerBody, DrawerCloseButton, DrawerCloseTrigger, DrawerContent, DrawerDragBar, DrawerDragTrigger, DrawerFooter, DrawerHeader, DrawerOpenTrigger, DrawerOverlay, DrawerPropsContext, DrawerRoot, DrawerTitle, useDrawerPropsContext } from "./drawer.js";
3
3
  //#region src/components/drawer/namespace.ts
4
4
  var namespace_exports = /* @__PURE__ */ __exportAll({
5
5
  Body: () => DrawerBody,
@@ -7,6 +7,7 @@ var namespace_exports = /* @__PURE__ */ __exportAll({
7
7
  CloseTrigger: () => DrawerCloseTrigger,
8
8
  Content: () => DrawerContent,
9
9
  DragBar: () => DrawerDragBar,
10
+ DragTrigger: () => DrawerDragTrigger,
10
11
  Footer: () => DrawerFooter,
11
12
  Header: () => DrawerHeader,
12
13
  OpenTrigger: () => DrawerOpenTrigger,
@@ -17,6 +18,6 @@ var namespace_exports = /* @__PURE__ */ __exportAll({
17
18
  usePropsContext: () => useDrawerPropsContext
18
19
  });
19
20
  //#endregion
20
- export { DrawerBody as Body, DrawerCloseButton as CloseButton, DrawerCloseTrigger as CloseTrigger, DrawerContent as Content, DrawerDragBar as DragBar, DrawerFooter as Footer, DrawerHeader as Header, DrawerOpenTrigger as OpenTrigger, DrawerOverlay as Overlay, DrawerPropsContext as PropsContext, DrawerRoot as Root, DrawerTitle as Title, namespace_exports, useDrawerPropsContext as usePropsContext };
21
+ export { DrawerBody as Body, DrawerCloseButton as CloseButton, DrawerCloseTrigger as CloseTrigger, DrawerContent as Content, DrawerDragBar as DragBar, DrawerDragTrigger as DragTrigger, DrawerFooter as Footer, DrawerHeader as Header, DrawerOpenTrigger as OpenTrigger, DrawerOverlay as Overlay, DrawerPropsContext as PropsContext, DrawerRoot as Root, DrawerTitle as Title, namespace_exports, useDrawerPropsContext as usePropsContext };
21
22
 
22
23
  //# sourceMappingURL=namespace.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"namespace.js","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.js","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
  import { utils_exports } from "../../utils/index.js";
3
+ import { useEnvironment } from "../../core/system/environment-provider.js";
4
+ import { mergeProps } from "../../core/components/props.js";
3
5
  import { useModal } from "../modal/use-modal.js";
4
- import { useCallback, useMemo } from "react";
6
+ import { useCallback, useEffect, useMemo, useRef } from "react";
7
+ import { useDragControls } from "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 } = 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 } = useEnvironment();
11
+ const { open, getContentProps: getModalContentProps, onClose, ...modalProps } = useModal({
8
12
  closeOnEsc,
9
13
  closeOnOverlay,
10
14
  onEsc,
11
15
  ...rest
12
16
  });
17
+ const dragControls = useDragControls();
18
+ const gesture = useRef(void 0);
19
+ const controller = useRef(void 0);
20
+ const axis = placement.startsWith("block") ? "y" : "x";
21
+ const direction = placement.endsWith("end") ? 1 : -1;
13
22
  const drag = 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 = useCallback(() => {
32
+ controller.current?.abort();
33
+ controller.current = void 0;
34
+ gesture.current = void 0;
35
+ }, []);
36
+ const canScroll = 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 = 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 = 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(utils_exports.isHTMLElement);
83
+ gesture.current = {
84
+ ev: ev.nativeEvent,
85
+ owner: "pending",
86
+ path
87
+ };
88
+ controller.current = new AbortController();
89
+ (0, 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 = 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 = 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 = useCallback((_, info) => {
131
+ const onDragEnd = 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 = useCallback((props = {}) => ({
152
+ useEffect(() => {
153
+ resetGesture();
154
+ return resetGesture;
155
+ }, [
156
+ closeOnDrag,
157
+ dragHandleOnly,
158
+ open,
159
+ placement,
160
+ resetGesture
161
+ ]);
162
+ const getContentProps = useCallback((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, utils_exports.cast)(getModalContentProps((0, utils_exports.cast)(props))),
56
- onDragEnd: (0, utils_exports.handlerAll)((ev, info) => props.onDragEnd?.(ev, info), onDragEnd)
57
- }), [
169
+ dragSnapToOrigin: true
170
+ }, (0, utils_exports.cast)(getModalContentProps((0, 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 = useCallback((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 = 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
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-drawer.js","names":["cast","handlerAll"],"sources":["../../../../src/components/drawer/use-drawer.ts"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, PropGetter, SimplePlacement } from \"../../core\"\nimport type { UseModalProps } from \"../modal\"\nimport type { HTMLMotionProps } from \"../motion\"\nimport { useCallback, useMemo } from \"react\"\nimport { cast, handlerAll } from \"../../utils\"\nimport { useModal } from \"../modal\"\n\ntype DragEndEventHandler = Required<HTMLMotionProps>[\"onDragEnd\"]\n\nexport interface UseDrawerProps extends UseModalProps {\n /**\n * If `true`, then the drawer will close on drag.\n *\n * @default false\n */\n closeOnDrag?: boolean\n /**\n * Applies constraints on the permitted draggable area.\n *\n * @default 0\n */\n dragConstraints?: number\n /**\n * The degree of movement allowed outside constraints. 0 = no movement, 1 = full movement.\n *\n * @default 0.1\n */\n dragElastic?: number\n /**\n * Offset from being dragged to closing.\n *\n * @default 80\n */\n dragOffset?: number\n /**\n * Velocity of the drag that triggers close.\n *\n * @default 100\n */\n dragVelocity?: number\n /**\n * The placement of the drawer.\n *\n * @default 'inline-end'\n */\n placement?: SimplePlacement\n}\n\nexport const useDrawer = ({\n closeOnDrag = false,\n closeOnEsc,\n closeOnOverlay,\n dragConstraints = 0,\n dragElastic = 0.1,\n dragOffset = 80,\n dragVelocity = 100,\n placement = \"inline-end\",\n onEsc,\n ...rest\n}: UseDrawerProps = {}) => {\n const {\n getContentProps: getModalContentProps,\n onClose,\n ...modalProps\n } = useModal({\n closeOnEsc,\n closeOnOverlay,\n onEsc,\n ...rest,\n })\n\n const drag = useMemo<HTMLMotionProps[\"drag\"]>(() => {\n if (!closeOnDrag) return false\n\n switch (placement) {\n case \"block-start\":\n case \"block-end\":\n return \"y\"\n case \"inline-start\":\n case \"inline-end\":\n return \"x\"\n }\n }, [placement, closeOnDrag])\n\n const getDragRestriction = useCallback(\n (value: number) => {\n switch (placement) {\n case \"block-start\":\n return { bottom: value }\n case \"block-end\":\n return { top: value }\n case \"inline-start\":\n return { right: value }\n case \"inline-end\":\n return { left: value }\n }\n },\n [placement],\n )\n\n const onDragEnd: DragEndEventHandler = useCallback(\n (_, info) => {\n switch (placement) {\n case \"block-start\":\n if (\n info.velocity.y <= dragVelocity * -1 ||\n info.offset.y <= dragOffset * -1\n )\n onClose()\n break\n\n case \"block-end\":\n if (info.velocity.y >= dragVelocity || info.offset.y >= dragOffset)\n onClose()\n break\n\n case \"inline-start\":\n if (\n info.velocity.x <= dragVelocity * -1 ||\n info.offset.x <= dragOffset * -1\n )\n onClose()\n break\n\n case \"inline-end\":\n if (info.velocity.x >= dragVelocity || info.offset.x >= dragOffset)\n onClose()\n break\n }\n },\n [placement, dragVelocity, dragOffset, onClose],\n )\n\n const getContentProps: PropGetter<HTMLMotionProps<\"section\">> = useCallback(\n (props = {}) => ({\n drag,\n dragConstraints: getDragRestriction(dragConstraints),\n dragElastic: getDragRestriction(dragElastic),\n dragMomentum: false,\n dragSnapToOrigin: true,\n ...cast<HTMLMotionProps<\"section\">>(\n getModalContentProps(cast<HTMLProps<\"section\">>(props)),\n ),\n onDragEnd: handlerAll(\n (ev, info) => props.onDragEnd?.(ev, info),\n onDragEnd,\n ),\n }),\n [\n drag,\n getDragRestriction,\n dragConstraints,\n dragElastic,\n onDragEnd,\n getModalContentProps,\n ],\n )\n\n const getDragBarProps: PropGetter = useCallback(\n (props) => ({\n ...props,\n }),\n [],\n )\n\n return {\n ...modalProps,\n closeOnDrag,\n getContentProps,\n getDragBarProps,\n onClose,\n }\n}\n\nexport type UseDrawerReturn = ReturnType<typeof useDrawer>\n"],"mappings":";;;;;AAkDA,MAAa,aAAa,EACxB,cAAc,OACd,YACA,gBACA,kBAAkB,GAClB,cAAc,IACd,aAAa,IACb,eAAe,KACf,YAAY,cACZ,OACA,GAAG,SACe,CAAC,MAAM;CACzB,MAAM,EACJ,iBAAiB,sBACjB,SACA,GAAG,eACD,SAAS;EACX;EACA;EACA;EACA,GAAG;CACL,CAAC;CAED,MAAM,OAAO,cAAuC;EAClD,IAAI,CAAC,aAAa,OAAO;EAEzB,QAAQ,WAAR;GACE,KAAK;GACL,KAAK,aACH,OAAO;GACT,KAAK;GACL,KAAK,cACH,OAAO;EACX;CACF,GAAG,CAAC,WAAW,WAAW,CAAC;CAE3B,MAAM,qBAAqB,aACxB,UAAkB;EACjB,QAAQ,WAAR;GACE,KAAK,eACH,OAAO,EAAE,QAAQ,MAAM;GACzB,KAAK,aACH,OAAO,EAAE,KAAK,MAAM;GACtB,KAAK,gBACH,OAAO,EAAE,OAAO,MAAM;GACxB,KAAK,cACH,OAAO,EAAE,MAAM,MAAM;EACzB;CACF,GACA,CAAC,SAAS,CACZ;CAEA,MAAM,YAAiC,aACpC,GAAG,SAAS;EACX,QAAQ,WAAR;GACE,KAAK;IACH,IACE,KAAK,SAAS,KAAK,eAAe,MAClC,KAAK,OAAO,KAAK,aAAa,IAE9B,QAAQ;IACV;GAEF,KAAK;IACH,IAAI,KAAK,SAAS,KAAK,gBAAgB,KAAK,OAAO,KAAK,YACtD,QAAQ;IACV;GAEF,KAAK;IACH,IACE,KAAK,SAAS,KAAK,eAAe,MAClC,KAAK,OAAO,KAAK,aAAa,IAE9B,QAAQ;IACV;GAEF,KAAK,cACH,IAAI,KAAK,SAAS,KAAK,gBAAgB,KAAK,OAAO,KAAK,YACtD,QAAQ;EAEd;CACF,GACA;EAAC;EAAW;EAAc;EAAY;CAAO,CAC/C;CAEA,MAAM,kBAA0D,aAC7D,QAAQ,CAAC,OAAO;EACf;EACA,iBAAiB,mBAAmB,eAAe;EACnD,aAAa,mBAAmB,WAAW;EAC3C,cAAc;EACd,kBAAkB;EAClB,IAAA,GAAGA,cAAAA,KAAAA,CACD,sBAAA,GAAqBA,cAAAA,KAAAA,CAA2B,KAAK,CAAC,CACxD;EACA,YAAA,GAAWC,cAAAA,WAAAA,EACR,IAAI,SAAS,MAAM,YAAY,IAAI,IAAI,GACxC,SACF;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAEA,MAAM,kBAA8B,aACjC,WAAW,EACV,GAAG,MACL,IACA,CAAC,CACH;CAEA,OAAO;EACL,GAAG;EACH;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"use-drawer.js","names":["isHTMLElement","cast"],"sources":["../../../../src/components/drawer/use-drawer.ts"],"sourcesContent":["\"use client\"\n\nimport type { PointerEvent as ReactPointerEvent } from \"react\"\nimport type { HTMLProps, PropGetter, SimplePlacement } from \"../../core\"\nimport type { UseModalProps } from \"../modal\"\nimport type { HTMLMotionProps } from \"../motion\"\nimport { useDragControls } from \"motion/react\"\nimport { useCallback, useEffect, useMemo, useRef } from \"react\"\nimport { mergeProps, useEnvironment } from \"../../core\"\nimport { addDomEvent, cast, isHTMLElement } from \"../../utils\"\nimport { useModal } from \"../modal\"\n\ntype DragEndEventHandler = Required<HTMLMotionProps>[\"onDragEnd\"]\n\ninterface DragGesture {\n ev: PointerEvent\n owner: \"drag\" | \"pending\" | \"scroll\"\n path: HTMLElement[]\n}\n\nexport interface UseDrawerProps extends UseModalProps {\n /**\n * If `true`, then the drawer will close on drag.\n *\n * @default false\n */\n closeOnDrag?: boolean\n /**\n * Applies constraints on the permitted draggable area.\n *\n * @default 0\n */\n dragConstraints?: number\n /**\n * The degree of movement allowed outside constraints. 0 = no movement, 1 = full movement.\n *\n * @default 0.1\n */\n dragElastic?: number\n /**\n * If `true`, only the drag bar and drag triggers can start dragging when `closeOnDrag` is `true`.\n *\n * @default false\n */\n dragHandleOnly?: boolean\n /**\n * Offset from being dragged to closing.\n *\n * @default 80\n */\n dragOffset?: number\n /**\n * Velocity of the drag that triggers close.\n *\n * @default 100\n */\n dragVelocity?: number\n /**\n * The placement of the drawer.\n *\n * @default 'inline-end'\n */\n placement?: SimplePlacement\n}\n\nexport const useDrawer = ({\n closeOnDrag = false,\n closeOnEsc,\n closeOnOverlay,\n dragConstraints = 0,\n dragElastic = 0.1,\n dragHandleOnly = false,\n dragOffset = 80,\n dragVelocity = 100,\n placement = \"inline-end\",\n onEsc,\n ...rest\n}: UseDrawerProps = {}) => {\n const { getWindow } = useEnvironment()\n const {\n open,\n getContentProps: getModalContentProps,\n onClose,\n ...modalProps\n } = useModal({\n closeOnEsc,\n closeOnOverlay,\n onEsc,\n ...rest,\n })\n const dragControls = useDragControls()\n const gesture = useRef<DragGesture | undefined>(undefined)\n const controller = useRef<AbortController | undefined>(undefined)\n const axis = placement.startsWith(\"block\") ? \"y\" : \"x\"\n const direction = placement.endsWith(\"end\") ? 1 : -1\n\n const drag = useMemo<HTMLMotionProps[\"drag\"]>(() => {\n if (!closeOnDrag) return false\n\n switch (placement) {\n case \"block-start\":\n case \"block-end\":\n return \"y\"\n case \"inline-start\":\n case \"inline-end\":\n return \"x\"\n }\n }, [placement, closeOnDrag])\n\n const resetGesture = useCallback(() => {\n controller.current?.abort()\n controller.current = undefined\n gesture.current = undefined\n }, [])\n\n const canScroll = useCallback(\n (path: HTMLElement[], axis: \"x\" | \"y\", delta: number) => {\n const win = getWindow()\n\n if (!win) return false\n\n return path.some((el) => {\n const style = win.getComputedStyle(el)\n const overflow = axis === \"x\" ? style.overflowX : style.overflowY\n\n if (!/auto|scroll|overlay/.test(overflow)) return false\n\n const size = axis === \"x\" ? el.scrollWidth : el.scrollHeight\n const clientSize = axis === \"x\" ? el.clientWidth : el.clientHeight\n const offset = axis === \"x\" ? el.scrollLeft : el.scrollTop\n const reversed =\n axis === \"x\"\n ? style.direction === \"rtl\"\n : style.flexDirection === \"column-reverse\"\n const min = reversed ? clientSize - size : 0\n const max = reversed ? 0 : size - clientSize\n\n if (size <= clientSize) return false\n\n return delta > 0 ? offset > min + 1 : offset < max - 1\n })\n },\n [getWindow],\n )\n\n const updateGesture = useCallback(\n (x: number, y: number) => {\n const current = gesture.current\n\n if (current?.owner !== \"pending\") return\n\n const dx = x - current.ev.clientX\n const dy = y - current.ev.clientY\n const delta = axis === \"x\" ? dx : dy\n const crossDelta = axis === \"x\" ? dy : dx\n\n if (Math.max(Math.abs(delta), Math.abs(crossDelta)) < 3) return\n\n if (\n Math.abs(crossDelta) > Math.abs(delta) ||\n delta * direction <= 0 ||\n canScroll(current.path, axis, delta)\n ) {\n current.owner = \"scroll\"\n } else {\n current.owner = \"drag\"\n dragControls.start(current.ev)\n }\n },\n [axis, canScroll, direction, dragControls],\n )\n\n const onPointerDown = useCallback(\n (ev: ReactPointerEvent<HTMLElement>) => {\n if (ev.defaultPrevented) return\n\n resetGesture()\n\n if (!open || !closeOnDrag || dragHandleOnly) return\n if (ev.button !== 0 || !ev.isPrimary) return\n\n if (ev.pointerType === \"mouse\") {\n dragControls.start(ev)\n } else {\n const win = getWindow()\n\n if (!win) return\n\n const targets = ev.nativeEvent.composedPath()\n const path = targets\n .slice(0, targets.indexOf(ev.currentTarget) + 1)\n .filter(isHTMLElement)\n\n gesture.current = { ev: ev.nativeEvent, owner: \"pending\", path }\n controller.current = new AbortController()\n\n addDomEvent(\n ev.currentTarget,\n \"touchmove\",\n (ev) => {\n if (ev.touches.length !== 1) {\n resetGesture()\n } else {\n if (!ev.touches[0]) return\n\n updateGesture(ev.touches[0].clientX, ev.touches[0].clientY)\n\n if (gesture.current?.owner === \"drag\" && ev.cancelable)\n ev.preventDefault()\n }\n },\n { passive: false, signal: controller.current.signal },\n )\n win.addEventListener(\"pointerup\", resetGesture, {\n signal: controller.current.signal,\n once: true,\n })\n win.addEventListener(\"pointercancel\", resetGesture, {\n signal: controller.current.signal,\n once: true,\n })\n }\n },\n [\n closeOnDrag,\n dragControls,\n dragHandleOnly,\n getWindow,\n open,\n resetGesture,\n updateGesture,\n ],\n )\n\n const onPointerMove = useCallback(\n (ev: ReactPointerEvent<HTMLElement>) => {\n if (ev.defaultPrevented) return\n if (ev.pointerId !== gesture.current?.ev.pointerId) return\n\n updateGesture(ev.clientX, ev.clientY)\n },\n [updateGesture],\n )\n\n const getDragRestriction = useCallback(\n (value: number) => {\n switch (placement) {\n case \"block-start\":\n return { bottom: value }\n case \"block-end\":\n return { top: value }\n case \"inline-start\":\n return { right: value }\n case \"inline-end\":\n return { left: value }\n }\n },\n [placement],\n )\n\n const onDragEnd: DragEndEventHandler = useCallback(\n (ev, info) => {\n if (ev.defaultPrevented) return\n if (ev.type === \"pointercancel\" || ev.type === \"touchcancel\") return\n\n switch (placement) {\n case \"block-start\":\n if (\n info.velocity.y <= dragVelocity * -1 ||\n info.offset.y <= dragOffset * -1\n )\n onClose()\n break\n\n case \"block-end\":\n if (info.velocity.y >= dragVelocity || info.offset.y >= dragOffset)\n onClose()\n break\n\n case \"inline-start\":\n if (\n info.velocity.x <= dragVelocity * -1 ||\n info.offset.x <= dragOffset * -1\n )\n onClose()\n break\n\n case \"inline-end\":\n if (info.velocity.x >= dragVelocity || info.offset.x >= dragOffset)\n onClose()\n break\n }\n },\n [placement, dragVelocity, dragOffset, onClose],\n )\n\n useEffect(() => {\n resetGesture()\n\n return resetGesture\n }, [closeOnDrag, dragHandleOnly, open, placement, resetGesture])\n\n const getContentProps: PropGetter<HTMLMotionProps<\"section\">> = useCallback(\n (props = {}) =>\n mergeProps(\n {\n drag,\n dragConstraints: getDragRestriction(dragConstraints),\n dragControls,\n dragElastic: getDragRestriction(dragElastic),\n dragListener: false,\n dragMomentum: false,\n dragSnapToOrigin: true,\n },\n cast<HTMLMotionProps<\"section\">>(\n getModalContentProps(cast<HTMLProps<\"section\">>(props)),\n ),\n {\n onDragEnd,\n onPointerDown,\n onPointerMove,\n },\n )(),\n [\n drag,\n dragControls,\n getDragRestriction,\n dragConstraints,\n dragElastic,\n onDragEnd,\n getModalContentProps,\n onPointerDown,\n onPointerMove,\n ],\n )\n\n const getDragTriggerProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n {\n style: {\n touchAction: closeOnDrag && dragHandleOnly ? \"none\" : undefined,\n },\n },\n props,\n {\n onPointerDown: (ev) => {\n if (closeOnDrag && dragHandleOnly) dragControls.start(ev)\n },\n },\n )(),\n [closeOnDrag, dragHandleOnly, dragControls],\n )\n\n return {\n ...modalProps,\n closeOnDrag,\n open,\n getContentProps,\n getDragBarProps: getDragTriggerProps,\n getDragTriggerProps,\n onClose,\n }\n}\n\nexport type UseDrawerReturn = ReturnType<typeof useDrawer>\n"],"mappings":";;;;;;;;AAiEA,MAAa,aAAa,EACxB,cAAc,OACd,YACA,gBACA,kBAAkB,GAClB,cAAc,IACd,iBAAiB,OACjB,aAAa,IACb,eAAe,KACf,YAAY,cACZ,OACA,GAAG,SACe,CAAC,MAAM;CACzB,MAAM,EAAE,cAAc,eAAe;CACrC,MAAM,EACJ,MACA,iBAAiB,sBACjB,SACA,GAAG,eACD,SAAS;EACX;EACA;EACA;EACA,GAAG;CACL,CAAC;CACD,MAAM,eAAe,gBAAgB;CACrC,MAAM,UAAU,OAAgC,KAAA,CAAS;CACzD,MAAM,aAAa,OAAoC,KAAA,CAAS;CAChE,MAAM,OAAO,UAAU,WAAW,OAAO,IAAI,MAAM;CACnD,MAAM,YAAY,UAAU,SAAS,KAAK,IAAI,IAAI;CAElD,MAAM,OAAO,cAAuC;EAClD,IAAI,CAAC,aAAa,OAAO;EAEzB,QAAQ,WAAR;GACE,KAAK;GACL,KAAK,aACH,OAAO;GACT,KAAK;GACL,KAAK,cACH,OAAO;EACX;CACF,G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,kBAAkB;CACpB,IAAA,GACAC,cAAAA,KAAAA,CACE,sBAAA,GAAqBA,cAAAA,KAAAA,CAA2B,KAAK,CAAC,CACxD,GACA;EACE;EACA;EACA;CACF,CACF,CAAC,CAAC,GACJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAEA,MAAM,sBAAkC,aACrC,QAAQ,CAAC,MACR,WACE,EACE,OAAO,EACL,aAAa,eAAe,iBAAiB,SAAS,KAAA,EACxD,EACF,GACA,OACA,EACE,gBAAgB,OAAO;EACrB,IAAI,eAAe,gBAAgB,aAAa,MAAM,EAAE;CAC1D,EACF,CACF,CAAC,CAAC,GACJ;EAAC;EAAa;EAAgB;CAAY,CAC5C;CAEA,OAAO;EACL,GAAG;EACH;EACA;EACA;EACA,iBAAiB;EACjB;EACA;CACF;AACF"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { useSplitChildren } from "../../utils/children.js";
2
+ import { getResolvedChild, useSplitChildren } from "../../utils/children.js";
3
3
  import { createContext as createContext$1 } from "../../utils/context.js";
4
4
  import { utils_exports } from "../../utils/index.js";
5
5
  import { styled } from "../../core/system/factory.js";
@@ -116,13 +116,14 @@ const FieldLabel = withContext(({ id, htmlFor, children, optionalIndicator = nul
116
116
  });
117
117
  }, "label")();
118
118
  const FieldRequiredIndicator = withContext(({ children, ...rest }) => {
119
- if (!isValidElement(children)) return /* @__PURE__ */ jsx(styled.span, {
119
+ const child = getResolvedChild(children);
120
+ if (!isValidElement(child)) return /* @__PURE__ */ jsx(styled.span, {
120
121
  "aria-hidden": true,
121
122
  role: "presentation",
122
123
  ...rest,
123
- children: children ?? /* @__PURE__ */ jsx(Fragment$1, { children: "*" })
124
+ children: child || /* @__PURE__ */ jsx(Fragment$1, { children: "*" })
124
125
  });
125
- else return children;
126
+ else return child;
126
127
  }, "requiredIndicator")();
127
128
  const FieldHelperMessage = withContext((props) => {
128
129
  const { helperMessageId, invalid, replace } = useFieldContext() ?? {};
@@ -1 +1 @@
1
- {"version":3,"file":"field.js","names":["createContext","isObject","dataAttr"],"sources":["../../../../src/components/field/field.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { FieldStyle } from \"./field.style\"\nimport { isValidElement, useId, useMemo, useState } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport {\n createContext,\n dataAttr,\n isObject,\n useSplitChildren,\n} from \"../../utils\"\nimport { useFieldsetContext } from \"../fieldset\"\nimport { useFormContext } from \"../form\"\nimport { fieldStyle } from \"./field.style\"\n\nexport interface FieldContext\n extends FieldProps, Pick<FieldRootProps, \"replace\"> {\n errorMessageId: string\n focused: boolean\n helperMessageId: string\n id: string\n labelId: string\n onBlur: () => void\n onFocus: () => void\n}\n\nconst [FieldContext, useFieldContext] = createContext<FieldContext>({\n name: \"FieldContext\",\n strict: false,\n})\n\nexport { FieldContext, useFieldContext }\n\nexport interface FieldProps {\n /**\n * If `true`, the field will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, the field will be invalid.\n *\n * @default false\n */\n invalid?: boolean\n /**\n * If `true`, the field will be readonly.\n *\n * @default false\n */\n readOnly?: boolean\n /**\n * If `true`, the field will be required.\n *\n * @default false\n */\n required?: boolean\n}\n\nexport interface FieldRootProps\n extends\n HTMLStyledProps,\n ThemeProps<FieldStyle>,\n Pick<FieldLabelProps, \"optionalIndicator\" | \"requiredIndicator\">,\n FieldProps {\n /**\n * The field error message to use.\n */\n errorMessage?: ReactNode\n /**\n * The field helper message to use.\n */\n helperMessage?: ReactNode\n /**\n * The field label to use.\n */\n label?: ReactNode\n /**\n * The name of the field.\n */\n name?: string\n /**\n * If `true`, switch between helper message and error message using invalid.\n *\n * @default true\n */\n replace?: boolean\n /**\n * Props the error message component.\n */\n errorMessageProps?: FieldErrorMessageProps\n /**\n * Props the helper message component.\n */\n helperMessageProps?: FieldHelperMessageProps\n /**\n * Props the label component.\n */\n labelProps?: FieldLabelProps\n}\n\nconst {\n PropsContext: FieldPropsContext,\n usePropsContext: useFieldPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<FieldRootProps, FieldStyle>(\"field\", fieldStyle)\n\nexport { FieldPropsContext, useFieldPropsContext }\n\n/**\n * `Field` is a component used to group form elements with label, helper message, error message, etc.\n *\n * @see https://yamada-ui.com/docs/components/field\n */\nexport const FieldRoot = withProvider<\"div\", FieldRootProps>(\n ({\n id,\n name,\n children,\n disabled,\n errorMessage,\n helperMessage,\n invalid,\n label,\n optionalIndicator,\n readOnly,\n replace,\n required,\n requiredIndicator,\n errorMessageProps,\n helperMessageProps,\n labelProps,\n ...rest\n }) => {\n const uuid = useId()\n const labelId = useId()\n const helperMessageId = useId()\n const errorMessageId = useId()\n const formContext = useFormContext()\n const fieldsetContext = useFieldsetContext()\n const [focused, setFocused] = useState<boolean>(false)\n const [\n omittedChildren,\n customLabel,\n customHelperMessage,\n customErrorMessage,\n ] = useSplitChildren(\n children,\n FieldLabel,\n FieldHelperMessage,\n FieldErrorMessage,\n )\n\n id ??= uuid\n optionalIndicator ??= formContext?.optionalIndicator\n requiredIndicator ??= formContext?.requiredIndicator\n\n disabled ??= fieldsetContext?.disabled\n invalid ??= fieldsetContext?.invalid\n readOnly ??= fieldsetContext?.readOnly\n required ??= fieldsetContext?.required\n\n if (name) {\n disabled ??= isObject(formContext?.disabled)\n ? formContext.disabled[name]\n : formContext?.disabled\n invalid ??= isObject(formContext?.invalid)\n ? formContext.invalid[name]\n : formContext?.invalid\n readOnly ??= isObject(formContext?.readOnly)\n ? formContext.readOnly[name]\n : formContext?.readOnly\n required ??= isObject(formContext?.required)\n ? formContext.required[name]\n : formContext?.required\n replace ??= isObject(formContext?.replace)\n ? (formContext.replace[name] ?? true)\n : (formContext?.replace ?? true)\n errorMessage ??= formContext?.errorMessage?.[name]\n helperMessage ??= formContext?.helperMessage?.[name]\n }\n\n const context = useMemo(\n () => ({\n id,\n disabled,\n errorMessageId,\n focused,\n helperMessageId,\n invalid,\n labelId,\n readOnly,\n replace,\n required,\n onBlur: () => setFocused(false),\n onFocus: () => setFocused(true),\n }),\n [\n id,\n disabled,\n labelId,\n focused,\n invalid,\n helperMessageId,\n errorMessageId,\n readOnly,\n replace,\n required,\n ],\n )\n\n return (\n <FieldContext value={context}>\n <styled.div\n data-disabled={dataAttr(disabled)}\n data-focus={dataAttr(focused)}\n data-invalid={dataAttr(invalid)}\n data-readonly={dataAttr(readOnly)}\n role=\"group\"\n {...rest}\n >\n {customLabel ||\n (label ? (\n <FieldLabel\n optionalIndicator={optionalIndicator}\n requiredIndicator={requiredIndicator}\n {...labelProps}\n >\n {label}\n </FieldLabel>\n ) : null)}\n\n {omittedChildren}\n\n {customHelperMessage ||\n (helperMessage ? (\n <FieldHelperMessage {...helperMessageProps}>\n {helperMessage}\n </FieldHelperMessage>\n ) : null)}\n\n {customErrorMessage ||\n (errorMessage ? (\n <FieldErrorMessage {...errorMessageProps}>\n {errorMessage}\n </FieldErrorMessage>\n ) : null)}\n </styled.div>\n </FieldContext>\n )\n },\n \"root\",\n)()\n\nexport interface FieldLabelProps extends HTMLStyledProps<\"label\"> {\n /**\n * The optional indicator to use.\n */\n optionalIndicator?: ReactNode\n /**\n * If `true`, the field will be required.\n *\n * @default false\n */\n required?: boolean\n /**\n * The required indicator to use.\n */\n requiredIndicator?: ReactNode\n}\n\nexport const FieldLabel = withContext<\"label\", FieldLabelProps>(\n ({\n id,\n htmlFor,\n children,\n optionalIndicator = null,\n required,\n requiredIndicator = null,\n ...rest\n }) => {\n const fieldContext = useFieldContext()\n\n id ??= fieldContext?.labelId\n htmlFor ??= fieldContext?.id\n required ??= fieldContext?.required\n\n return (\n <styled.label\n id={id}\n htmlFor={htmlFor}\n data-disabled={dataAttr(fieldContext?.disabled)}\n data-focus={dataAttr(fieldContext?.focused)}\n data-invalid={dataAttr(fieldContext?.invalid)}\n data-readonly={dataAttr(fieldContext?.readOnly)}\n {...rest}\n >\n {children}\n\n {required ? (\n requiredIndicator ? (\n <FieldRequiredIndicator>{requiredIndicator}</FieldRequiredIndicator>\n ) : (\n <FieldRequiredIndicator />\n )\n ) : (\n optionalIndicator\n )}\n </styled.label>\n )\n },\n \"label\",\n)()\n\ninterface FieldRequiredIndicatorProps extends HTMLStyledProps<\"span\"> {}\n\nconst FieldRequiredIndicator = withContext<\"span\", FieldRequiredIndicatorProps>(\n ({ children, ...rest }) => {\n if (!isValidElement(children))\n return (\n <styled.span aria-hidden role=\"presentation\" {...rest}>\n {children ?? <>*</>}\n </styled.span>\n )\n else return children\n },\n \"requiredIndicator\",\n)()\n\nexport interface FieldHelperMessageProps extends HTMLStyledProps<\"span\"> {}\n\nexport const FieldHelperMessage = withContext<\"span\", FieldHelperMessageProps>(\n (props) => {\n const { helperMessageId, invalid, replace } = useFieldContext() ?? {}\n\n return (\n <styled.span\n id={helperMessageId}\n hidden={replace && invalid ? true : false}\n {...props}\n />\n )\n },\n \"helperMessage\",\n)()\n\nexport interface FieldErrorMessageProps extends HTMLStyledProps<\"span\"> {}\n\nexport const FieldErrorMessage = withContext<\"span\", FieldErrorMessageProps>(\n (props) => {\n const { errorMessageId, invalid } = useFieldContext() ?? {}\n\n return (\n <styled.span\n id={errorMessageId}\n aria-live={invalid ? \"polite\" : undefined}\n hidden={!invalid}\n {...props}\n />\n )\n },\n \"errorMessage\",\n)()\n"],"mappings":";;;;;;;;;;;;AA4BA,MAAM,CAAC,cAAc,mBAAmBA,gBAA4B;CAClE,MAAM;CACN,QAAQ;AACV,CAAC;AAyED,MAAM,EACJ,cAAc,mBACd,iBAAiB,sBACjB,aACA,iBACE,oBAAgD,SAAS,UAAU;;;;;;AASvE,MAAa,YAAY,cACtB,EACC,IACA,MACA,UACA,UACA,cACA,eACA,SACA,OACA,mBACA,UACA,SACA,UACA,mBACA,mBACA,oBACA,YACA,GAAG,WACC;CACJ,MAAM,OAAO,MAAM;CACnB,MAAM,UAAU,MAAM;CACtB,MAAM,kBAAkB,MAA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,MAAa,qBAAqB,aAC/B,UAAU;CACT,MAAM,EAAE,iBAAiB,SAAS,YAAY,gBAAgB,KAAK,CAAC;CAEpE,OACE,oBAAC,OAAO,MAAR;EACE,IAAI;EACJ,QAAQ,WAAW,UAAU,OAAO;EACpC,GAAI;CACL,CAAA;AAEL,GACA,eACF,CAAC,CAAC;AAIF,MAAa,oBAAoB,aAC9B,UAAU;CACT,MAAM,EAAE,gBAAgB,YAAY,gBAAgB,KAAK,CAAC;CAE1D,OACE,oBAAC,OAAO,MAAR;EACE,IAAI;EACJ,aAAW,UAAU,WAAW,KAAA;EAChC,QAAQ,CAAC;EACT,GAAI;CACL,CAAA;AAEL,GACA,cACF,CAAC,CAAC"}
1
+ {"version":3,"file":"field.js","names":["createContext","isObject","dataAttr"],"sources":["../../../../src/components/field/field.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { FieldStyle } from \"./field.style\"\nimport { isValidElement, useId, useMemo, useState } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport {\n createContext,\n dataAttr,\n getResolvedChild,\n isObject,\n useSplitChildren,\n} from \"../../utils\"\nimport { useFieldsetContext } from \"../fieldset\"\nimport { useFormContext } from \"../form\"\nimport { fieldStyle } from \"./field.style\"\n\nexport interface FieldContext\n extends FieldProps, Pick<FieldRootProps, \"replace\"> {\n errorMessageId: string\n focused: boolean\n helperMessageId: string\n id: string\n labelId: string\n onBlur: () => void\n onFocus: () => void\n}\n\nconst [FieldContext, useFieldContext] = createContext<FieldContext>({\n name: \"FieldContext\",\n strict: false,\n})\n\nexport { FieldContext, useFieldContext }\n\nexport interface FieldProps {\n /**\n * If `true`, the field will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, the field will be invalid.\n *\n * @default false\n */\n invalid?: boolean\n /**\n * If `true`, the field will be readonly.\n *\n * @default false\n */\n readOnly?: boolean\n /**\n * If `true`, the field will be required.\n *\n * @default false\n */\n required?: boolean\n}\n\nexport interface FieldRootProps\n extends\n HTMLStyledProps,\n ThemeProps<FieldStyle>,\n Pick<FieldLabelProps, \"optionalIndicator\" | \"requiredIndicator\">,\n FieldProps {\n /**\n * The field error message to use.\n */\n errorMessage?: ReactNode\n /**\n * The field helper message to use.\n */\n helperMessage?: ReactNode\n /**\n * The field label to use.\n */\n label?: ReactNode\n /**\n * The name of the field.\n */\n name?: string\n /**\n * If `true`, switch between helper message and error message using invalid.\n *\n * @default true\n */\n replace?: boolean\n /**\n * Props the error message component.\n */\n errorMessageProps?: FieldErrorMessageProps\n /**\n * Props the helper message component.\n */\n helperMessageProps?: FieldHelperMessageProps\n /**\n * Props the label component.\n */\n labelProps?: FieldLabelProps\n}\n\nconst {\n PropsContext: FieldPropsContext,\n usePropsContext: useFieldPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<FieldRootProps, FieldStyle>(\"field\", fieldStyle)\n\nexport { FieldPropsContext, useFieldPropsContext }\n\n/**\n * `Field` is a component used to group form elements with label, helper message, error message, etc.\n *\n * @see https://yamada-ui.com/docs/components/field\n */\nexport const FieldRoot = withProvider<\"div\", FieldRootProps>(\n ({\n id,\n name,\n children,\n disabled,\n errorMessage,\n helperMessage,\n invalid,\n label,\n optionalIndicator,\n readOnly,\n replace,\n required,\n requiredIndicator,\n errorMessageProps,\n helperMessageProps,\n labelProps,\n ...rest\n }) => {\n const uuid = useId()\n const labelId = useId()\n const helperMessageId = useId()\n const errorMessageId = useId()\n const formContext = useFormContext()\n const fieldsetContext = useFieldsetContext()\n const [focused, setFocused] = useState<boolean>(false)\n const [\n omittedChildren,\n customLabel,\n customHelperMessage,\n customErrorMessage,\n ] = useSplitChildren(\n children,\n FieldLabel,\n FieldHelperMessage,\n FieldErrorMessage,\n )\n\n id ??= uuid\n optionalIndicator ??= formContext?.optionalIndicator\n requiredIndicator ??= formContext?.requiredIndicator\n\n disabled ??= fieldsetContext?.disabled\n invalid ??= fieldsetContext?.invalid\n readOnly ??= fieldsetContext?.readOnly\n required ??= fieldsetContext?.required\n\n if (name) {\n disabled ??= isObject(formContext?.disabled)\n ? formContext.disabled[name]\n : formContext?.disabled\n invalid ??= isObject(formContext?.invalid)\n ? formContext.invalid[name]\n : formContext?.invalid\n readOnly ??= isObject(formContext?.readOnly)\n ? formContext.readOnly[name]\n : formContext?.readOnly\n required ??= isObject(formContext?.required)\n ? formContext.required[name]\n : formContext?.required\n replace ??= isObject(formContext?.replace)\n ? (formContext.replace[name] ?? true)\n : (formContext?.replace ?? true)\n errorMessage ??= formContext?.errorMessage?.[name]\n helperMessage ??= formContext?.helperMessage?.[name]\n }\n\n const context = useMemo(\n () => ({\n id,\n disabled,\n errorMessageId,\n focused,\n helperMessageId,\n invalid,\n labelId,\n readOnly,\n replace,\n required,\n onBlur: () => setFocused(false),\n onFocus: () => setFocused(true),\n }),\n [\n id,\n disabled,\n labelId,\n focused,\n invalid,\n helperMessageId,\n errorMessageId,\n readOnly,\n replace,\n required,\n ],\n )\n\n return (\n <FieldContext value={context}>\n <styled.div\n data-disabled={dataAttr(disabled)}\n data-focus={dataAttr(focused)}\n data-invalid={dataAttr(invalid)}\n data-readonly={dataAttr(readOnly)}\n role=\"group\"\n {...rest}\n >\n {customLabel ||\n (label ? (\n <FieldLabel\n optionalIndicator={optionalIndicator}\n requiredIndicator={requiredIndicator}\n {...labelProps}\n >\n {label}\n </FieldLabel>\n ) : null)}\n\n {omittedChildren}\n\n {customHelperMessage ||\n (helperMessage ? (\n <FieldHelperMessage {...helperMessageProps}>\n {helperMessage}\n </FieldHelperMessage>\n ) : null)}\n\n {customErrorMessage ||\n (errorMessage ? (\n <FieldErrorMessage {...errorMessageProps}>\n {errorMessage}\n </FieldErrorMessage>\n ) : null)}\n </styled.div>\n </FieldContext>\n )\n },\n \"root\",\n)()\n\nexport interface FieldLabelProps extends HTMLStyledProps<\"label\"> {\n /**\n * The optional indicator to use.\n */\n optionalIndicator?: ReactNode\n /**\n * If `true`, the field will be required.\n *\n * @default false\n */\n required?: boolean\n /**\n * The required indicator to use.\n */\n requiredIndicator?: ReactNode\n}\n\nexport const FieldLabel = withContext<\"label\", FieldLabelProps>(\n ({\n id,\n htmlFor,\n children,\n optionalIndicator = null,\n required,\n requiredIndicator = null,\n ...rest\n }) => {\n const fieldContext = useFieldContext()\n\n id ??= fieldContext?.labelId\n htmlFor ??= fieldContext?.id\n required ??= fieldContext?.required\n\n return (\n <styled.label\n id={id}\n htmlFor={htmlFor}\n data-disabled={dataAttr(fieldContext?.disabled)}\n data-focus={dataAttr(fieldContext?.focused)}\n data-invalid={dataAttr(fieldContext?.invalid)}\n data-readonly={dataAttr(fieldContext?.readOnly)}\n {...rest}\n >\n {children}\n\n {required ? (\n requiredIndicator ? (\n <FieldRequiredIndicator>{requiredIndicator}</FieldRequiredIndicator>\n ) : (\n <FieldRequiredIndicator />\n )\n ) : (\n optionalIndicator\n )}\n </styled.label>\n )\n },\n \"label\",\n)()\n\ninterface FieldRequiredIndicatorProps extends HTMLStyledProps<\"span\"> {}\n\nconst FieldRequiredIndicator = withContext<\"span\", FieldRequiredIndicatorProps>(\n ({ children, ...rest }) => {\n const child = getResolvedChild(children)\n\n if (!isValidElement(child))\n return (\n <styled.span aria-hidden role=\"presentation\" {...rest}>\n {child || <>*</>}\n </styled.span>\n )\n else return child\n },\n \"requiredIndicator\",\n)()\n\nexport interface FieldHelperMessageProps extends HTMLStyledProps<\"span\"> {}\n\nexport const FieldHelperMessage = withContext<\"span\", FieldHelperMessageProps>(\n (props) => {\n const { helperMessageId, invalid, replace } = useFieldContext() ?? {}\n\n return (\n <styled.span\n id={helperMessageId}\n hidden={replace && invalid ? true : false}\n {...props}\n />\n )\n },\n \"helperMessage\",\n)()\n\nexport interface FieldErrorMessageProps extends HTMLStyledProps<\"span\"> {}\n\nexport const FieldErrorMessage = withContext<\"span\", FieldErrorMessageProps>(\n (props) => {\n const { errorMessageId, invalid } = useFieldContext() ?? {}\n\n return (\n <styled.span\n id={errorMessageId}\n aria-live={invalid ? \"polite\" : undefined}\n hidden={!invalid}\n {...props}\n />\n )\n },\n \"errorMessage\",\n)()\n"],"mappings":";;;;;;;;;;;;AA6BA,MAAM,CAAC,cAAc,mBAAmBA,gBAA4B;CAClE,MAAM;CACN,QAAQ;AACV,CAAC;AAyED,MAAM,EACJ,cAAc,mBACd,iBAAiB,sBACjB,aACA,iBACE,oBAAgD,SAAS,UAAU;;;;;;AASvE,MAAa,YAAY,cACtB,EACC,IACA,MACA,UACA,UACA,cACA,eACA,SACA,OACA,mBACA,UACA,SACA,UACA,mBACA,mBACA,oBACA,YACA,GAAG,WACC;CACJ,MAAM,OAAO,MAAM;CACnB,MAAM,UAAU,MAAM;CACtB,MAAM,kBAAkB,MAAM;CAC9B,MAAM,iBAAiB,MAAM;CAC7B,MAAM,cAAc,eAAe;CACnC,MAAM,kBAAkB,mBAAmB;CAC3C,MAAM,CAAC,SAAS,cAAc,SAAkB,KAAK;CACrD,MAAM,CACJ,iBACA,aACA,qBACA,sBACE,iBACF,UACA,YACA,oBACA,iBACF;CAEA,OAAO;CACP,sBAAsB,aAAa;CACnC,sBAAsB,aAAa;CAEnC,aAAa,iBAAiB;CAC9B,YAAY,iBAAiB;CAC7B,aAAa,iBAAiB;CAC9B,aAAa,iBAAiB;CAE9B,IAAI,MAAM;EACR,cAAA,GAAaC,cAAAA,SAAAA,CAAS,aAAa,QAAQ,IACvC,YAAY,SAAS,QACrB,aAAa;EACjB,aAAA,GAAYA,cAAAA,SAAAA,CAAS,aAAa,OAAO,IACrC,YAAY,QAAQ,QACpB,aAAa;EACjB,cAAA,GAAaA,cAAAA,SAAAA,CAAS,aAAa,QAAQ,IACvC,YAAY,SAAS,QACrB,aAAa;EACjB,cAAA,GAAaA,cAAAA,SAAAA,CAAS,aAAa,QAAQ,IACvC,YAAY,SAAS,QACrB,aAAa;EACjB,aAAA,GAAYA,cAAAA,SAAAA,CAAS,aAAa,OAAO,IACpC,YAAY,QAAQ,SAAS,OAC7B,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AAA,SAAAA,CAAS,cAAc,QAAQ;EAC9C,GAAI;EAPN,UAAA,CASG,UAEA,WACC,oBACE,oBAAC,wBAAD,EAAA,UAAyB,kBAA0C,CAAA,IAEnE,oBAAC,wBAAD,CAAyB,CAAA,IAG3B,iBAEU;;AAElB,GACA,OACF,CAAC,CAAC;AAIF,MAAM,yBAAyB,aAC5B,EAAE,UAAU,GAAG,WAAW;CACzB,MAAM,QAAQ,iBAAiB,QAAQ;CAEvC,IAAI,CAAC,eAAe,KAAK,GACvB,OACE,oBAAC,OAAO,MAAR;EAAa,eAAA;EAAY,MAAK;EAAe,GAAI;EAC9C,UAAA,SAAS,oBAAA,YAAA,EAAA,UAAE,IAAG,CAAA;CACJ,CAAA;MAEZ,OAAO;AACd,GACA,mBACF,CAAC,CAAC;AAIF,MAAa,qBAAqB,aAC/B,UAAU;CACT,MAAM,EAAE,iBAAiB,SAAS,YAAY,gBAAgB,KAAK,CAAC;CAEpE,OACE,oBAAC,OAAO,MAAR;EACE,IAAI;EACJ,QAAQ,WAAW,UAAU,OAAO;EACpC,GAAI;CACL,CAAA;AAEL,GACA,eACF,CAAC,CAAC;AAIF,MAAa,oBAAoB,aAC9B,UAAU;CACT,MAAM,EAAE,gBAAgB,YAAY,gBAAgB,KAAK,CAAC;CAE1D,OACE,oBAAC,OAAO,MAAR;EACE,IAAI;EACJ,aAAW,UAAU,WAAW,KAAA;EAChC,QAAQ,CAAC;EACT,GAAI;CACL,CAAA;AAEL,GACA,cACF,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-file-input.js","names":["isNull","cx","handlerAll","dataAttr"],"sources":["../../../../src/components/file-input/use-file-input.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent, RefObject } from \"react\"\nimport type { Dict } from \"../../utils\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useRef } from \"react\"\nimport { type HTMLProps, mergeProps, type PropGetter } from \"../../core\"\nimport { useClickable } from \"../../hooks/use-clickable\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport {\n assignRef,\n cx,\n dataAttr,\n handlerAll,\n isNull,\n mergeRefs,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nexport type UseFileInputProps<Y extends \"button\" | \"input\" = \"input\"> =\n FieldProps &\n Omit<HTMLProps<Y>, \"defaultValue\" | \"onChange\" | \"ref\" | \"value\"> &\n Pick<HTMLProps<\"input\">, \"accept\" | \"multiple\" | \"ref\"> & {\n /**\n * The initial value of the file input.\n */\n defaultValue?: File[]\n /**\n * Ref to a reset function.\n */\n resetRef?: RefObject<(() => void) | null>\n /**\n * The value of the file input.\n */\n value?: File[]\n /**\n * Function to be called when a file change event occurs.\n */\n onChange?: (files: File[] | undefined) => void\n }\n\nexport const useFileInput = <Y extends \"button\" | \"input\" = \"input\">(\n props: UseFileInputProps<Y>,\n) => {\n const {\n context: { labelId } = {},\n props: {\n id,\n ref,\n form,\n name,\n \"aria-labelledby\": ariaLabelledby,\n accept,\n defaultValue,\n disabled,\n multiple,\n readOnly,\n required,\n resetRef,\n value,\n onChange: onChangeProp,\n onClick: onClickProp,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps<HTMLElement, UseFileInputProps<Y>>({\n ...props,\n notSupportReadOnly: true,\n })\n const interactive = !(readOnly || disabled)\n const inputRef = useRef<HTMLInputElement>(null)\n const [values, setValues] = useControllableState<File[] | undefined>({\n defaultValue,\n value,\n onChange: onChangeProp,\n })\n const count = values?.length ?? 0\n\n const onClick = useCallback(() => {\n if (!interactive) return\n\n inputRef.current?.click()\n }, [interactive])\n\n const onReset = useCallback(() => {\n if (inputRef.current) inputRef.current.value = \"\"\n\n setValues(undefined)\n }, [setValues])\n\n const onChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n const files = !isNull(ev.currentTarget.files)\n ? Array.from(ev.currentTarget.files)\n : undefined\n\n setValues(files?.length ? files : undefined)\n },\n [setValues],\n )\n\n const clickableProps = useClickable<HTMLElement, Dict>({\n ...ariaProps,\n ...dataProps,\n ...eventProps,\n ...rest,\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n disabled: !interactive,\n focusable: readOnly && !disabled,\n focusOnClick: interactive,\n onClick: handlerAll(onClickProp, onClick),\n })\n\n assignRef(resetRef, onReset)\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) => ({\n ...visuallyHiddenAttributes,\n ...ariaProps,\n ...dataProps,\n id,\n form,\n type: \"file\",\n name,\n accept,\n disabled,\n multiple,\n readOnly,\n required,\n ...props,\n ref: mergeRefs(inputRef, props.ref, ref),\n onChange: handlerAll(props.onChange, onChange),\n }),\n [\n required,\n ariaProps,\n dataProps,\n id,\n form,\n name,\n accept,\n disabled,\n multiple,\n readOnly,\n ref,\n onChange,\n ],\n )\n\n const getFieldProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n {\n \"data-placeholder\": dataAttr(!count),\n ...clickableProps,\n \"aria-labelledby\": clickableProps[\"aria-labelledby\"],\n tabIndex: interactive ? 0 : clickableProps.tabIndex,\n },\n props,\n )(),\n [clickableProps, count, interactive],\n )\n\n return {\n disabled,\n interactive,\n readOnly,\n required,\n values,\n clickableProps,\n getFieldProps,\n getInputProps,\n }\n}\n\nexport type UseFileInputReturn = ReturnType<typeof useFileInput>\n"],"mappings":";;;;;;;;;;AA0CA,MAAa,gBACX,UACG;CACH,MAAM,EACJ,SAAS,EAAE,YAAY,CAAC,GACxB,OAAO,EACL,IACA,KACA,MACA,MACA,mBAAmB,gBACnB,QACA,cACA,UACA,UACA,UACA,UACA,UACA,OACA,UAAU,cACV,SAAS,aACT,GAAG,QAEL,WACA,WACA,eACE,cAAiD;EACnD,GAAG;EACH,oBAAoB;CACtB,CAAC;CACD,MAAM,cAAc,EAAE,YAAY;CAClC,MAAM,WAAW,OAAyB,IAAI;CAC9C,MAAM,CAAC,QAAQ,aAAa,qBAAyC;EACnE;EACA;EACA,UAAU;CACZ,CA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mBAAmB,eAAe;GAClC,UAAU,cAAc,IAAI,eAAe;EAC7C,GACA,KACF,CAAC,CAAC,GACJ;GAAC;GAAgB;GAAO;EAAW,CAUvB;EACZ;CACF;AACF"}
1
+ {"version":3,"file":"use-file-input.js","names":["isNull","cx","handlerAll","dataAttr"],"sources":["../../../../src/components/file-input/use-file-input.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent, RefObject } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { Dict } from \"../../utils\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useRef } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useClickable } from \"../../hooks/use-clickable\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport {\n assignRef,\n cx,\n dataAttr,\n handlerAll,\n isNull,\n mergeRefs,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nexport type UseFileInputProps<Y extends \"button\" | \"input\" = \"input\"> =\n FieldProps &\n Omit<HTMLProps<Y>, \"defaultValue\" | \"onChange\" | \"ref\" | \"value\"> &\n Pick<HTMLProps<\"input\">, \"accept\" | \"multiple\" | \"ref\"> & {\n /**\n * The initial value of the file input.\n */\n defaultValue?: File[]\n /**\n * Ref to a reset function.\n */\n resetRef?: RefObject<(() => void) | null>\n /**\n * The value of the file input.\n */\n value?: File[]\n /**\n * Function to be called when a file change event occurs.\n */\n onChange?: (files: File[] | undefined) => void\n }\n\nexport const useFileInput = <Y extends \"button\" | \"input\" = \"input\">(\n props: UseFileInputProps<Y>,\n) => {\n const {\n context: { labelId } = {},\n props: {\n id,\n ref,\n form,\n name,\n \"aria-labelledby\": ariaLabelledby,\n accept,\n defaultValue,\n disabled,\n multiple,\n readOnly,\n required,\n resetRef,\n value,\n onChange: onChangeProp,\n onClick: onClickProp,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps<HTMLElement, UseFileInputProps<Y>>({\n ...props,\n notSupportReadOnly: true,\n })\n const interactive = !(readOnly || disabled)\n const inputRef = useRef<HTMLInputElement>(null)\n const [values, setValues] = useControllableState<File[] | undefined>({\n defaultValue,\n value,\n onChange: onChangeProp,\n })\n const count = values?.length ?? 0\n\n const onClick = useCallback(() => {\n if (!interactive) return\n\n inputRef.current?.click()\n }, [interactive])\n\n const onReset = useCallback(() => {\n if (inputRef.current) inputRef.current.value = \"\"\n\n setValues(undefined)\n }, [setValues])\n\n const onChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n const files = !isNull(ev.currentTarget.files)\n ? Array.from(ev.currentTarget.files)\n : undefined\n\n setValues(files?.length ? files : undefined)\n },\n [setValues],\n )\n\n const clickableProps = useClickable<HTMLElement, Dict>({\n ...ariaProps,\n ...dataProps,\n ...eventProps,\n ...rest,\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n disabled: !interactive,\n focusable: readOnly && !disabled,\n focusOnClick: interactive,\n onClick: handlerAll(onClickProp, onClick),\n })\n\n assignRef(resetRef, onReset)\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) => ({\n ...visuallyHiddenAttributes,\n ...ariaProps,\n ...dataProps,\n id,\n form,\n type: \"file\",\n name,\n accept,\n disabled,\n multiple,\n readOnly,\n required,\n ...props,\n ref: mergeRefs(inputRef, props.ref, ref),\n onChange: handlerAll(props.onChange, onChange),\n }),\n [\n required,\n ariaProps,\n dataProps,\n id,\n form,\n name,\n accept,\n disabled,\n multiple,\n readOnly,\n ref,\n onChange,\n ],\n )\n\n const getFieldProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n {\n \"data-placeholder\": dataAttr(!count),\n ...clickableProps,\n \"aria-labelledby\": clickableProps[\"aria-labelledby\"],\n tabIndex: interactive ? 0 : clickableProps.tabIndex,\n },\n props,\n )(),\n [clickableProps, count, interactive],\n )\n\n return {\n disabled,\n interactive,\n readOnly,\n required,\n values,\n clickableProps,\n getFieldProps,\n getInputProps,\n }\n}\n\nexport type UseFile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;EACf,GAAG;EACH,GAAG;EACH,GAAG;EACH;EACA;EACA,MAAM;EACN;EACA;EACA;EACA;EACA;EACA;EACA,GAAG;EACH,KAAK,UAAU,UAAU,MAAM,KAAK,GAAG;EACvC,WAAA,GAAUA,cAAAA,WAAAA,CAAW,MAAM,UAAU,QAAQ;CAC/C,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAgBA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA,eArBgC,aAC/B,QAAQ,CAAC,MACR,WACE;GACE,qBAAA,GAAoBC,cAAAA,SAAAA,CAAS,CAAC,KAAK;GACnC,GAAG;GACH,mBAAmB,eAAe;GAClC,UAAU,cAAc,IAAI,eAAe;EAC7C,GACA,KACF,CAAC,CAAC,GACJ;GAAC;GAAgB;GAAO;EAAW,CAUvB;EACZ;CACF;AACF"}
@@ -1,2 +1 @@
1
- import { FocusLock, useFocusLockShard } from "./focus-lock.js";
2
- export { FocusLock, useFocusLockShard };
1
+ export { FocusLock, useFocusLockShard } from "./focus-lock.js";
@@ -1,2 +1 @@
1
- import { For } from "./for.js";
2
- export { For };
1
+ export { For } from "./for.js";
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { Icon as Icon$1, component } from "../icon.js";
3
+ import { ArmenianDram } from "lucide-react";
4
+ //#region src/components/icon/icons/armenian-dram-icon.tsx
5
+ /**
6
+ * `ArmenianDramIcon` is [Lucide](https://lucide.dev) SVG icon component.
7
+ *
8
+ * @see https://yamada-ui.com/docs/components/icon
9
+ */
10
+ const ArmenianDramIcon = component(Icon$1)({ as: ArmenianDram });
11
+ //#endregion
12
+ export { ArmenianDramIcon };
13
+
14
+ //# sourceMappingURL=armenian-dram-icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"armenian-dram-icon.js","names":["Icon","OriginalArmenianDramIcon"],"sources":["../../../../../src/components/icon/icons/armenian-dram-icon.tsx"],"sourcesContent":["\"use client\"\n\nimport type { Component } from \"../../../core\"\nimport type { IconProps } from \"../icon\"\nimport { ArmenianDram as OriginalArmenianDramIcon } from \"lucide-react\"\nimport { component, Icon } from \"../icon\"\n\n/**\n * `ArmenianDramIcon` is [Lucide](https://lucide.dev) SVG icon component.\n *\n * @see https://yamada-ui.com/docs/components/icon\n */\nexport const ArmenianDramIcon = component(Icon)({\n as: OriginalArmenianDramIcon,\n}) as Component<\"svg\", IconProps>\n"],"mappings":";;;;;;;;;AAYA,MAAa,mBAAmB,UAAUA,MAAI,CAAC,CAAC,EAC9C,IAAIC,aACN,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { Icon as Icon$1, component } from "../icon.js";
3
+ import { BangladeshiTaka } from "lucide-react";
4
+ //#region src/components/icon/icons/bangladeshi-taka-icon.tsx
5
+ /**
6
+ * `BangladeshiTakaIcon` is [Lucide](https://lucide.dev) SVG icon component.
7
+ *
8
+ * @see https://yamada-ui.com/docs/components/icon
9
+ */
10
+ const BangladeshiTakaIcon = component(Icon$1)({ as: BangladeshiTaka });
11
+ //#endregion
12
+ export { BangladeshiTakaIcon };
13
+
14
+ //# sourceMappingURL=bangladeshi-taka-icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bangladeshi-taka-icon.js","names":["Icon","OriginalBangladeshiTakaIcon"],"sources":["../../../../../src/components/icon/icons/bangladeshi-taka-icon.tsx"],"sourcesContent":["\"use client\"\n\nimport type { Component } from \"../../../core\"\nimport type { IconProps } from \"../icon\"\nimport { BangladeshiTaka as OriginalBangladeshiTakaIcon } from \"lucide-react\"\nimport { component, Icon } from \"../icon\"\n\n/**\n * `BangladeshiTakaIcon` is [Lucide](https://lucide.dev) SVG icon component.\n *\n * @see https://yamada-ui.com/docs/components/icon\n */\nexport const BangladeshiTakaIcon = component(Icon)({\n as: OriginalBangladeshiTakaIcon,\n}) as Component<\"svg\", IconProps>\n"],"mappings":";;;;;;;;;AAYA,MAAa,sBAAsB,UAAUA,MAAI,CAAC,CAAC,EACjD,IAAIC,gBACN,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { Icon as Icon$1, component } from "../icon.js";
3
+ import { BelarusianRuble } from "lucide-react";
4
+ //#region src/components/icon/icons/belarusian-ruble-icon.tsx
5
+ /**
6
+ * `BelarusianRubleIcon` is [Lucide](https://lucide.dev) SVG icon component.
7
+ *
8
+ * @see https://yamada-ui.com/docs/components/icon
9
+ */
10
+ const BelarusianRubleIcon = component(Icon$1)({ as: BelarusianRuble });
11
+ //#endregion
12
+ export { BelarusianRubleIcon };
13
+
14
+ //# sourceMappingURL=belarusian-ruble-icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"belarusian-ruble-icon.js","names":["Icon","OriginalBelarusianRubleIcon"],"sources":["../../../../../src/components/icon/icons/belarusian-ruble-icon.tsx"],"sourcesContent":["\"use client\"\n\nimport type { Component } from \"../../../core\"\nimport type { IconProps } from \"../icon\"\nimport { BelarusianRuble as OriginalBelarusianRubleIcon } from \"lucide-react\"\nimport { component, Icon } from \"../icon\"\n\n/**\n * `BelarusianRubleIcon` is [Lucide](https://lucide.dev) SVG icon component.\n *\n * @see https://yamada-ui.com/docs/components/icon\n */\nexport const BelarusianRubleIcon = component(Icon)({\n as: OriginalBelarusianRubleIcon,\n}) as Component<\"svg\", IconProps>\n"],"mappings":";;;;;;;;;AAYA,MAAa,sBAAsB,UAAUA,MAAI,CAAC,CAAC,EACjD,IAAIC,gBACN,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { Icon as Icon$1, component } from "../icon.js";
3
+ import { CalendarChevronsLeft } from "lucide-react";
4
+ //#region src/components/icon/icons/calendar-chevrons-left-icon.tsx
5
+ /**
6
+ * `CalendarChevronsLeftIcon` is [Lucide](https://lucide.dev) SVG icon component.
7
+ *
8
+ * @see https://yamada-ui.com/docs/components/icon
9
+ */
10
+ const CalendarChevronsLeftIcon = component(Icon$1)({ as: CalendarChevronsLeft });
11
+ //#endregion
12
+ export { CalendarChevronsLeftIcon };
13
+
14
+ //# sourceMappingURL=calendar-chevrons-left-icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar-chevrons-left-icon.js","names":["Icon","OriginalCalendarChevronsLeftIcon"],"sources":["../../../../../src/components/icon/icons/calendar-chevrons-left-icon.tsx"],"sourcesContent":["\"use client\"\n\nimport type { Component } from \"../../../core\"\nimport type { IconProps } from \"../icon\"\nimport { CalendarChevronsLeft as OriginalCalendarChevronsLeftIcon } from \"lucide-react\"\nimport { component, Icon } from \"../icon\"\n\n/**\n * `CalendarChevronsLeftIcon` is [Lucide](https://lucide.dev) SVG icon component.\n *\n * @see https://yamada-ui.com/docs/components/icon\n */\nexport const CalendarChevronsLeftIcon = component(Icon)({\n as: OriginalCalendarChevronsLeftIcon,\n}) as Component<\"svg\", IconProps>\n"],"mappings":";;;;;;;;;AAYA,MAAa,2BAA2B,UAAUA,MAAI,CAAC,CAAC,EACtD,IAAIC,qBACN,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { Icon as Icon$1, component } from "../icon.js";
3
+ import { Certificate } from "lucide-react";
4
+ //#region src/components/icon/icons/certificate-icon.tsx
5
+ /**
6
+ * `CertificateIcon` is [Lucide](https://lucide.dev) SVG icon component.
7
+ *
8
+ * @see https://yamada-ui.com/docs/components/icon
9
+ */
10
+ const CertificateIcon = component(Icon$1)({ as: Certificate });
11
+ //#endregion
12
+ export { CertificateIcon };
13
+
14
+ //# sourceMappingURL=certificate-icon.js.map