@yamada-ui/react 2.3.0-dev-20260724085908 → 2.3.0-dev-20260730080927

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 (350) hide show
  1. package/dist/cjs/components/accordion/accordion.cjs.map +1 -1
  2. package/dist/cjs/components/action-bar/action-bar.cjs.map +1 -1
  3. package/dist/cjs/components/airy/airy.cjs.map +1 -1
  4. package/dist/cjs/components/alert/alert.cjs.map +1 -1
  5. package/dist/cjs/components/alpha-slider/alpha-slider.cjs.map +1 -1
  6. package/dist/cjs/components/autocomplete/autocomplete.cjs.map +1 -1
  7. package/dist/cjs/components/autocomplete/use-autocomplete.cjs.map +1 -1
  8. package/dist/cjs/components/avatar/avatar-group.cjs.map +1 -1
  9. package/dist/cjs/components/avatar/avatar.cjs.map +1 -1
  10. package/dist/cjs/components/blockquote/blockquote.cjs.map +1 -1
  11. package/dist/cjs/components/breadcrumb/breadcrumb.cjs.map +1 -1
  12. package/dist/cjs/components/button/button-group.cjs.map +1 -1
  13. package/dist/cjs/components/button/button.cjs.map +1 -1
  14. package/dist/cjs/components/calendar/calendar.cjs.map +1 -1
  15. package/dist/cjs/components/calendar/use-calendar.cjs.map +1 -1
  16. package/dist/cjs/components/carousel/carousel.cjs.map +1 -1
  17. package/dist/cjs/components/chart/cartesian-chart.cjs.map +1 -1
  18. package/dist/cjs/components/chart/chart.cjs.map +1 -1
  19. package/dist/cjs/components/chart/polar-chart.cjs.map +1 -1
  20. package/dist/cjs/components/checkbox/checkbox-group.cjs.map +1 -1
  21. package/dist/cjs/components/checkbox/checkbox.cjs.map +1 -1
  22. package/dist/cjs/components/checkbox-card/checkbox-card-group.cjs.map +1 -1
  23. package/dist/cjs/components/checkbox-card/checkbox-card.cjs.map +1 -1
  24. package/dist/cjs/components/circle-progress/circle-progress.cjs.map +1 -1
  25. package/dist/cjs/components/collapse/collapse.cjs.map +1 -1
  26. package/dist/cjs/components/color-picker/color-picker.cjs.map +1 -1
  27. package/dist/cjs/components/color-selector/color-selector.cjs.map +1 -1
  28. package/dist/cjs/components/color-swatch/color-swatch-group.cjs.map +1 -1
  29. package/dist/cjs/components/color-swatch/color-swatch.cjs.map +1 -1
  30. package/dist/cjs/components/data-list/data-list.cjs.map +1 -1
  31. package/dist/cjs/components/date-picker/date-picker.cjs.map +1 -1
  32. package/dist/cjs/components/date-picker/use-date-picker.cjs.map +1 -1
  33. package/dist/cjs/components/drawer/drawer.cjs +1 -1
  34. package/dist/cjs/components/drawer/drawer.cjs.map +1 -1
  35. package/dist/cjs/components/dropzone/dropzone.cjs.map +1 -1
  36. package/dist/cjs/components/editable/editable.cjs.map +1 -1
  37. package/dist/cjs/components/editable/use-editable.cjs +4 -5
  38. package/dist/cjs/components/editable/use-editable.cjs.map +1 -1
  39. package/dist/cjs/components/empty-state/empty-state.cjs.map +1 -1
  40. package/dist/cjs/components/fade/fade.cjs.map +1 -1
  41. package/dist/cjs/components/fade-scale/fade-scale.cjs.map +1 -1
  42. package/dist/cjs/components/field/field.cjs.map +1 -1
  43. package/dist/cjs/components/fieldset/fieldset.cjs.map +1 -1
  44. package/dist/cjs/components/file-input/file-input.cjs.map +1 -1
  45. package/dist/cjs/components/flip/flip.cjs.map +1 -1
  46. package/dist/cjs/components/focus-lock/focus-lock.cjs +26 -9
  47. package/dist/cjs/components/focus-lock/focus-lock.cjs.map +1 -1
  48. package/dist/cjs/components/focus-lock/index.cjs +1 -0
  49. package/dist/cjs/components/form/form.cjs.map +1 -1
  50. package/dist/cjs/components/format/format-byte.cjs.map +1 -1
  51. package/dist/cjs/components/format/format-date-time.cjs.map +1 -1
  52. package/dist/cjs/components/format/format-number.cjs.map +1 -1
  53. package/dist/cjs/components/highlight/highlight.cjs.map +1 -1
  54. package/dist/cjs/components/hue-slider/hue-slider.cjs.map +1 -1
  55. package/dist/cjs/components/icon/icons/circle-euro-icon.cjs +14 -0
  56. package/dist/cjs/components/icon/icons/circle-euro-icon.cjs.map +1 -0
  57. package/dist/cjs/components/icon/icons/index.cjs +9 -3
  58. package/dist/cjs/components/icon/icons/index.cjs.map +1 -1
  59. package/dist/cjs/components/icon/icons/scan-box-icon.cjs +14 -0
  60. package/dist/cjs/components/icon/icons/scan-box-icon.cjs.map +1 -0
  61. package/dist/cjs/components/icon/icons/server-plus-icon.cjs +14 -0
  62. package/dist/cjs/components/icon/icons/server-plus-icon.cjs.map +1 -0
  63. package/dist/cjs/components/icon/index.cjs +6 -2
  64. package/dist/cjs/components/indicator/indicator.cjs.map +1 -1
  65. package/dist/cjs/components/infinite-scroll-area/infinite-scroll-area.cjs.map +1 -1
  66. package/dist/cjs/components/input/input-group.cjs.map +1 -1
  67. package/dist/cjs/components/link-box/link-box.cjs.map +1 -1
  68. package/dist/cjs/components/list/list.cjs.map +1 -1
  69. package/dist/cjs/components/loading/audio.cjs.map +1 -1
  70. package/dist/cjs/components/loading/background.cjs.map +1 -1
  71. package/dist/cjs/components/loading/circles.cjs.map +1 -1
  72. package/dist/cjs/components/loading/dots.cjs.map +1 -1
  73. package/dist/cjs/components/loading/grid.cjs.map +1 -1
  74. package/dist/cjs/components/loading/loading-provider.cjs.map +1 -1
  75. package/dist/cjs/components/loading/oval.cjs.map +1 -1
  76. package/dist/cjs/components/loading/page.cjs.map +1 -1
  77. package/dist/cjs/components/loading/puff.cjs.map +1 -1
  78. package/dist/cjs/components/loading/rings.cjs.map +1 -1
  79. package/dist/cjs/components/loading/screen.cjs.map +1 -1
  80. package/dist/cjs/components/loading/suspense.cjs.map +1 -1
  81. package/dist/cjs/components/menu/menu.cjs.map +1 -1
  82. package/dist/cjs/components/menu/use-menu.cjs.map +1 -1
  83. package/dist/cjs/components/modal/modal.cjs +39 -21
  84. package/dist/cjs/components/modal/modal.cjs.map +1 -1
  85. package/dist/cjs/components/native-accordion/native-accordion.cjs.map +1 -1
  86. package/dist/cjs/components/native-popover/native-popover.cjs.map +1 -1
  87. package/dist/cjs/components/native-select/native-select.cjs.map +1 -1
  88. package/dist/cjs/components/native-select/use-native-select.cjs.map +1 -1
  89. package/dist/cjs/components/native-table/native-table.cjs.map +1 -1
  90. package/dist/cjs/components/notice/notice-provider.cjs.map +1 -1
  91. package/dist/cjs/components/notice/notice.cjs.map +1 -1
  92. package/dist/cjs/components/notice/use-notice.cjs.map +1 -1
  93. package/dist/cjs/components/number-input/number-input.cjs.map +1 -1
  94. package/dist/cjs/components/number-input/use-number-input.cjs +2 -1
  95. package/dist/cjs/components/number-input/use-number-input.cjs.map +1 -1
  96. package/dist/cjs/components/pagination/pagination.cjs.map +1 -1
  97. package/dist/cjs/components/password-input/password-input.cjs.map +1 -1
  98. package/dist/cjs/components/password-input/strength-meter.cjs.map +1 -1
  99. package/dist/cjs/components/picture/picture.cjs.map +1 -1
  100. package/dist/cjs/components/pin-input/pin-input.cjs.map +1 -1
  101. package/dist/cjs/components/popover/popover.cjs +66 -24
  102. package/dist/cjs/components/popover/popover.cjs.map +1 -1
  103. package/dist/cjs/components/portal/portal.cjs +16 -0
  104. package/dist/cjs/components/portal/portal.cjs.map +1 -1
  105. package/dist/cjs/components/progress/progress.cjs.map +1 -1
  106. package/dist/cjs/components/qr-code/qr-code.cjs.map +1 -1
  107. package/dist/cjs/components/radio/radio-group.cjs.map +1 -1
  108. package/dist/cjs/components/radio/radio.cjs.map +1 -1
  109. package/dist/cjs/components/radio-card/radio-card-group.cjs.map +1 -1
  110. package/dist/cjs/components/radio-card/radio-card.cjs.map +1 -1
  111. package/dist/cjs/components/rating/rating.cjs.map +1 -1
  112. package/dist/cjs/components/reorder/reorder.cjs.map +1 -1
  113. package/dist/cjs/components/resizable/resizable.cjs.map +1 -1
  114. package/dist/cjs/components/ripple/ripple.cjs.map +1 -1
  115. package/dist/cjs/components/rotate/rotate.cjs.map +1 -1
  116. package/dist/cjs/components/saturation-slider/saturation-slider.cjs.map +1 -1
  117. package/dist/cjs/components/saturation-slider/use-saturation-slider.cjs.map +1 -1
  118. package/dist/cjs/components/segmented-control/segmented-control.cjs.map +1 -1
  119. package/dist/cjs/components/select/select.cjs.map +1 -1
  120. package/dist/cjs/components/select/use-select.cjs.map +1 -1
  121. package/dist/cjs/components/sidebar/sidebar.cjs.map +1 -1
  122. package/dist/cjs/components/skeleton/skeleton-text.cjs.map +1 -1
  123. package/dist/cjs/components/slide/slide.cjs.map +1 -1
  124. package/dist/cjs/components/slide-fade/slide-fade.cjs.map +1 -1
  125. package/dist/cjs/components/slider/slider.cjs.map +1 -1
  126. package/dist/cjs/components/slot/slot.cjs.map +1 -1
  127. package/dist/cjs/components/snacks/snacks.cjs.map +1 -1
  128. package/dist/cjs/components/stack/stack.cjs.map +1 -1
  129. package/dist/cjs/components/stack/z-stack.cjs.map +1 -1
  130. package/dist/cjs/components/stat/stat.cjs.map +1 -1
  131. package/dist/cjs/components/status/status.cjs.map +1 -1
  132. package/dist/cjs/components/steps/steps.cjs.map +1 -1
  133. package/dist/cjs/components/switch/switch.cjs.map +1 -1
  134. package/dist/cjs/components/table/table.cjs.map +1 -1
  135. package/dist/cjs/components/tabs/tabs.cjs.map +1 -1
  136. package/dist/cjs/components/tag/tag.cjs.map +1 -1
  137. package/dist/cjs/components/timeline/timeline.cjs.map +1 -1
  138. package/dist/cjs/components/tip/tip.cjs.map +1 -1
  139. package/dist/cjs/components/toggle/toggle-group.cjs.map +1 -1
  140. package/dist/cjs/components/tooltip/tooltip.cjs +2 -2
  141. package/dist/cjs/components/tooltip/tooltip.cjs.map +1 -1
  142. package/dist/cjs/components/tree/tree.cjs.map +1 -1
  143. package/dist/cjs/components/tree/use-tree.cjs.map +1 -1
  144. package/dist/cjs/core/components/create-component.cjs.map +1 -1
  145. package/dist/cjs/core/css/focus-ring.cjs +4 -1
  146. package/dist/cjs/core/css/focus-ring.cjs.map +1 -1
  147. package/dist/cjs/core/system/breakpoint.cjs.map +1 -1
  148. package/dist/cjs/core/system/environment-provider.cjs.map +1 -1
  149. package/dist/cjs/core/system/styled.cjs.map +1 -1
  150. package/dist/cjs/core/system/theme-provider.cjs.map +1 -1
  151. package/dist/cjs/hooks/use-async-callback/index.cjs.map +1 -1
  152. package/dist/cjs/hooks/use-breakpoint/use-breakpoint.cjs.map +1 -1
  153. package/dist/cjs/hooks/use-combobox/index.cjs.map +1 -1
  154. package/dist/cjs/hooks/use-field-sizing/index.cjs.map +1 -1
  155. package/dist/cjs/hooks/use-focus/index.cjs +8 -4
  156. package/dist/cjs/hooks/use-focus/index.cjs.map +1 -1
  157. package/dist/cjs/hooks/use-outside-click/index.cjs +4 -2
  158. package/dist/cjs/hooks/use-outside-click/index.cjs.map +1 -1
  159. package/dist/cjs/index.cjs +12 -4
  160. package/dist/cjs/providers/ui-provider/ui-provider.cjs.map +1 -1
  161. package/dist/cjs/utils/dom.cjs +4 -1
  162. package/dist/cjs/utils/dom.cjs.map +1 -1
  163. package/dist/cjs/utils/store.cjs.map +1 -1
  164. package/dist/esm/components/accordion/accordion.js.map +1 -1
  165. package/dist/esm/components/action-bar/action-bar.js.map +1 -1
  166. package/dist/esm/components/airy/airy.js.map +1 -1
  167. package/dist/esm/components/alert/alert.js.map +1 -1
  168. package/dist/esm/components/alpha-slider/alpha-slider.js.map +1 -1
  169. package/dist/esm/components/autocomplete/autocomplete.js.map +1 -1
  170. package/dist/esm/components/autocomplete/use-autocomplete.js.map +1 -1
  171. package/dist/esm/components/avatar/avatar-group.js.map +1 -1
  172. package/dist/esm/components/avatar/avatar.js.map +1 -1
  173. package/dist/esm/components/blockquote/blockquote.js.map +1 -1
  174. package/dist/esm/components/breadcrumb/breadcrumb.js.map +1 -1
  175. package/dist/esm/components/button/button-group.js.map +1 -1
  176. package/dist/esm/components/button/button.js.map +1 -1
  177. package/dist/esm/components/calendar/calendar.js.map +1 -1
  178. package/dist/esm/components/calendar/use-calendar.js.map +1 -1
  179. package/dist/esm/components/carousel/carousel.js.map +1 -1
  180. package/dist/esm/components/chart/cartesian-chart.js.map +1 -1
  181. package/dist/esm/components/chart/chart.js.map +1 -1
  182. package/dist/esm/components/chart/polar-chart.js.map +1 -1
  183. package/dist/esm/components/checkbox/checkbox-group.js.map +1 -1
  184. package/dist/esm/components/checkbox/checkbox.js.map +1 -1
  185. package/dist/esm/components/checkbox-card/checkbox-card-group.js.map +1 -1
  186. package/dist/esm/components/checkbox-card/checkbox-card.js.map +1 -1
  187. package/dist/esm/components/circle-progress/circle-progress.js.map +1 -1
  188. package/dist/esm/components/collapse/collapse.js.map +1 -1
  189. package/dist/esm/components/color-picker/color-picker.js.map +1 -1
  190. package/dist/esm/components/color-selector/color-selector.js.map +1 -1
  191. package/dist/esm/components/color-swatch/color-swatch-group.js.map +1 -1
  192. package/dist/esm/components/color-swatch/color-swatch.js.map +1 -1
  193. package/dist/esm/components/data-list/data-list.js.map +1 -1
  194. package/dist/esm/components/date-picker/date-picker.js.map +1 -1
  195. package/dist/esm/components/date-picker/use-date-picker.js.map +1 -1
  196. package/dist/esm/components/drawer/drawer.js +1 -1
  197. package/dist/esm/components/drawer/drawer.js.map +1 -1
  198. package/dist/esm/components/dropzone/dropzone.js.map +1 -1
  199. package/dist/esm/components/editable/editable.js.map +1 -1
  200. package/dist/esm/components/editable/use-editable.js +4 -5
  201. package/dist/esm/components/editable/use-editable.js.map +1 -1
  202. package/dist/esm/components/empty-state/empty-state.js.map +1 -1
  203. package/dist/esm/components/fade/fade.js.map +1 -1
  204. package/dist/esm/components/fade-scale/fade-scale.js.map +1 -1
  205. package/dist/esm/components/field/field.js.map +1 -1
  206. package/dist/esm/components/fieldset/fieldset.js.map +1 -1
  207. package/dist/esm/components/file-input/file-input.js.map +1 -1
  208. package/dist/esm/components/flip/flip.js.map +1 -1
  209. package/dist/esm/components/focus-lock/focus-lock.js +27 -11
  210. package/dist/esm/components/focus-lock/focus-lock.js.map +1 -1
  211. package/dist/esm/components/focus-lock/index.js +2 -2
  212. package/dist/esm/components/form/form.js.map +1 -1
  213. package/dist/esm/components/format/format-byte.js.map +1 -1
  214. package/dist/esm/components/format/format-date-time.js.map +1 -1
  215. package/dist/esm/components/format/format-number.js.map +1 -1
  216. package/dist/esm/components/highlight/highlight.js.map +1 -1
  217. package/dist/esm/components/hue-slider/hue-slider.js.map +1 -1
  218. package/dist/esm/components/icon/icons/circle-euro-icon.js +14 -0
  219. package/dist/esm/components/icon/icons/circle-euro-icon.js.map +1 -0
  220. package/dist/esm/components/icon/icons/index.js +7 -3
  221. package/dist/esm/components/icon/icons/index.js.map +1 -1
  222. package/dist/esm/components/icon/icons/scan-box-icon.js +14 -0
  223. package/dist/esm/components/icon/icons/scan-box-icon.js.map +1 -0
  224. package/dist/esm/components/icon/icons/server-plus-icon.js +14 -0
  225. package/dist/esm/components/icon/icons/server-plus-icon.js.map +1 -0
  226. package/dist/esm/components/icon/index.js +4 -2
  227. package/dist/esm/components/indicator/indicator.js.map +1 -1
  228. package/dist/esm/components/infinite-scroll-area/infinite-scroll-area.js.map +1 -1
  229. package/dist/esm/components/input/input-group.js.map +1 -1
  230. package/dist/esm/components/link-box/link-box.js.map +1 -1
  231. package/dist/esm/components/list/list.js.map +1 -1
  232. package/dist/esm/components/loading/audio.js.map +1 -1
  233. package/dist/esm/components/loading/background.js.map +1 -1
  234. package/dist/esm/components/loading/circles.js.map +1 -1
  235. package/dist/esm/components/loading/dots.js.map +1 -1
  236. package/dist/esm/components/loading/grid.js.map +1 -1
  237. package/dist/esm/components/loading/loading-provider.js.map +1 -1
  238. package/dist/esm/components/loading/oval.js.map +1 -1
  239. package/dist/esm/components/loading/page.js.map +1 -1
  240. package/dist/esm/components/loading/puff.js.map +1 -1
  241. package/dist/esm/components/loading/rings.js.map +1 -1
  242. package/dist/esm/components/loading/screen.js.map +1 -1
  243. package/dist/esm/components/loading/suspense.js.map +1 -1
  244. package/dist/esm/components/menu/menu.js.map +1 -1
  245. package/dist/esm/components/menu/use-menu.js.map +1 -1
  246. package/dist/esm/components/modal/modal.js +40 -21
  247. package/dist/esm/components/modal/modal.js.map +1 -1
  248. package/dist/esm/components/native-accordion/native-accordion.js.map +1 -1
  249. package/dist/esm/components/native-popover/native-popover.js.map +1 -1
  250. package/dist/esm/components/native-select/native-select.js.map +1 -1
  251. package/dist/esm/components/native-select/use-native-select.js.map +1 -1
  252. package/dist/esm/components/native-table/native-table.js.map +1 -1
  253. package/dist/esm/components/notice/notice-provider.js.map +1 -1
  254. package/dist/esm/components/notice/notice.js.map +1 -1
  255. package/dist/esm/components/notice/use-notice.js.map +1 -1
  256. package/dist/esm/components/number-input/number-input.js.map +1 -1
  257. package/dist/esm/components/number-input/use-number-input.js +2 -1
  258. package/dist/esm/components/number-input/use-number-input.js.map +1 -1
  259. package/dist/esm/components/pagination/pagination.js.map +1 -1
  260. package/dist/esm/components/password-input/password-input.js.map +1 -1
  261. package/dist/esm/components/password-input/strength-meter.js.map +1 -1
  262. package/dist/esm/components/picture/picture.js.map +1 -1
  263. package/dist/esm/components/pin-input/pin-input.js.map +1 -1
  264. package/dist/esm/components/popover/popover.js +67 -25
  265. package/dist/esm/components/popover/popover.js.map +1 -1
  266. package/dist/esm/components/portal/portal.js +17 -1
  267. package/dist/esm/components/portal/portal.js.map +1 -1
  268. package/dist/esm/components/progress/progress.js.map +1 -1
  269. package/dist/esm/components/qr-code/qr-code.js.map +1 -1
  270. package/dist/esm/components/radio/radio-group.js.map +1 -1
  271. package/dist/esm/components/radio/radio.js.map +1 -1
  272. package/dist/esm/components/radio-card/radio-card-group.js.map +1 -1
  273. package/dist/esm/components/radio-card/radio-card.js.map +1 -1
  274. package/dist/esm/components/rating/rating.js.map +1 -1
  275. package/dist/esm/components/reorder/reorder.js.map +1 -1
  276. package/dist/esm/components/resizable/resizable.js.map +1 -1
  277. package/dist/esm/components/ripple/ripple.js.map +1 -1
  278. package/dist/esm/components/rotate/rotate.js.map +1 -1
  279. package/dist/esm/components/saturation-slider/saturation-slider.js.map +1 -1
  280. package/dist/esm/components/saturation-slider/use-saturation-slider.js.map +1 -1
  281. package/dist/esm/components/segmented-control/segmented-control.js.map +1 -1
  282. package/dist/esm/components/select/select.js.map +1 -1
  283. package/dist/esm/components/select/use-select.js.map +1 -1
  284. package/dist/esm/components/sidebar/sidebar.js.map +1 -1
  285. package/dist/esm/components/skeleton/skeleton-text.js.map +1 -1
  286. package/dist/esm/components/slide/slide.js.map +1 -1
  287. package/dist/esm/components/slide-fade/slide-fade.js.map +1 -1
  288. package/dist/esm/components/slider/slider.js.map +1 -1
  289. package/dist/esm/components/slot/slot.js.map +1 -1
  290. package/dist/esm/components/snacks/snacks.js.map +1 -1
  291. package/dist/esm/components/stack/stack.js.map +1 -1
  292. package/dist/esm/components/stack/z-stack.js.map +1 -1
  293. package/dist/esm/components/stat/stat.js.map +1 -1
  294. package/dist/esm/components/status/status.js.map +1 -1
  295. package/dist/esm/components/steps/steps.js.map +1 -1
  296. package/dist/esm/components/switch/switch.js.map +1 -1
  297. package/dist/esm/components/table/table.js.map +1 -1
  298. package/dist/esm/components/tabs/tabs.js.map +1 -1
  299. package/dist/esm/components/tag/tag.js.map +1 -1
  300. package/dist/esm/components/timeline/timeline.js.map +1 -1
  301. package/dist/esm/components/tip/tip.js.map +1 -1
  302. package/dist/esm/components/toggle/toggle-group.js.map +1 -1
  303. package/dist/esm/components/tooltip/tooltip.js +2 -2
  304. package/dist/esm/components/tooltip/tooltip.js.map +1 -1
  305. package/dist/esm/components/tree/tree.js.map +1 -1
  306. package/dist/esm/components/tree/use-tree.js.map +1 -1
  307. package/dist/esm/core/components/create-component.js.map +1 -1
  308. package/dist/esm/core/css/focus-ring.js +4 -1
  309. package/dist/esm/core/css/focus-ring.js.map +1 -1
  310. package/dist/esm/core/system/breakpoint.js.map +1 -1
  311. package/dist/esm/core/system/environment-provider.js.map +1 -1
  312. package/dist/esm/core/system/styled.js.map +1 -1
  313. package/dist/esm/core/system/theme-provider.js.map +1 -1
  314. package/dist/esm/hooks/use-breakpoint/use-breakpoint.js.map +1 -1
  315. package/dist/esm/hooks/use-combobox/index.js.map +1 -1
  316. package/dist/esm/hooks/use-field-sizing/index.js.map +1 -1
  317. package/dist/esm/hooks/use-focus/index.js +8 -4
  318. package/dist/esm/hooks/use-focus/index.js.map +1 -1
  319. package/dist/esm/hooks/use-outside-click/index.js +4 -2
  320. package/dist/esm/hooks/use-outside-click/index.js.map +1 -1
  321. package/dist/esm/index.js +9 -4
  322. package/dist/esm/providers/ui-provider/ui-provider.js.map +1 -1
  323. package/dist/esm/utils/dom.js +4 -1
  324. package/dist/esm/utils/dom.js.map +1 -1
  325. package/dist/esm/utils/store.js.map +1 -1
  326. package/dist/types/components/avatar/avatar.d.ts +3 -3
  327. package/dist/types/components/avatar/avatar.style.d.ts +1 -1
  328. package/dist/types/components/chart/cartesian-chart.style.d.ts +1 -1
  329. package/dist/types/components/chart/polar-chart.style.d.ts +1 -1
  330. package/dist/types/components/focus-lock/focus-lock.d.ts +2 -1
  331. package/dist/types/components/focus-lock/index.d.ts +2 -2
  332. package/dist/types/components/icon/icons/circle-euro-icon.d.ts +13 -0
  333. package/dist/types/components/icon/icons/index.d.ts +5 -3
  334. package/dist/types/components/icon/icons/index.types.d.ts +1 -1
  335. package/dist/types/components/icon/icons/scan-box-icon.d.ts +13 -0
  336. package/dist/types/components/icon/icons/server-plus-icon.d.ts +13 -0
  337. package/dist/types/components/icon/index.d.ts +4 -2
  338. package/dist/types/components/menu/use-menu.d.ts +1 -1
  339. package/dist/types/components/modal/modal.d.ts +37 -1
  340. package/dist/types/components/popover/popover.d.ts +57 -2
  341. package/dist/types/components/tooltip/tooltip.d.ts +8 -1
  342. package/dist/types/core/css/focus-ring.d.ts +1 -0
  343. package/dist/types/index.d.ts +6 -4
  344. package/dist/types/providers/i18n-provider/i18n-provider.d.ts +1 -1
  345. package/package.json +6 -6
  346. package/dist/cjs/components/icon/icons/circle-euro-sign-icon.cjs +0 -14
  347. package/dist/cjs/components/icon/icons/circle-euro-sign-icon.cjs.map +0 -1
  348. package/dist/esm/components/icon/icons/circle-euro-sign-icon.js +0 -14
  349. package/dist/esm/components/icon/icons/circle-euro-sign-icon.js.map +0 -1
  350. package/dist/types/components/icon/icons/circle-euro-sign-icon.d.ts +0 -13
@@ -1 +1 @@
1
- {"version":3,"file":"color-swatch-group.js","names":[],"sources":["../../../../src/components/color-swatch/color-swatch-group.tsx"],"sourcesContent":["import type { Component, CSSProps } from \"../../core\"\nimport type { ColorSwatchProps } from \"./color-swatch\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { Grid } from \"../grid\"\nimport { ColorSwatch } from \"./color-swatch\"\n\nexport interface ColorSwatchGroupProps extends Omit<ColorSwatchProps, \"color\"> {\n /**\n * The color used for the swatch element.\n *\n * @default '#ffffff00'\n */\n items?: CSSProps[\"color\"][]\n /**\n * The props for the `ColorSwatch` component.\n */\n itemProps?: ColorSwatchProps\n}\n\n/**\n * `ColorSwatchGroup` is a component that displays color samples.\n *\n * @see https://yamada-ui.com/docs/components/color-swatch\n */\nexport const ColorSwatchGroup = (({\n items = [],\n layers,\n withShadow = true,\n itemProps,\n ...rest\n}: ColorSwatchGroupProps) => {\n const { t } = useI18n(\"colorSwatch\")\n\n if (items.length > 4)\n console.warn(\"ColorSwatchGroup: doesn't support more than 4 items\")\n\n const empty = items.length === 0\n const threeColors = items.length === 3\n\n if (empty)\n return (\n <ColorSwatch\n aria-label={t(\"Color swatch group\")}\n layers={layers}\n overflow=\"hidden\"\n withShadow={withShadow}\n {...rest}\n />\n )\n else\n return (\n <ColorSwatch\n aria-label={t(\"Color swatch group\")}\n layers={withShadow ? [{ boxShadow: \"inner\" }] : []}\n {...rest}\n >\n <Grid templateColumns=\"repeat(2, 1fr)\">\n {items.map((color, index) => (\n <ColorSwatch\n key={index}\n boxSize=\"inherit\"\n color={color}\n gridColumn={threeColors && !index ? \"1 / 3\" : undefined}\n rounded=\"0\"\n w={threeColors && !index ? \"unset\" : undefined}\n withShadow={false}\n {...itemProps}\n />\n ))}\n </Grid>\n </ColorSwatch>\n )\n}) as Component<\"div\", ColorSwatchGroupProps>\n"],"mappings":";;;;;;;;;;AAwBA,MAAa,qBAAqB,EAChC,QAAQ,CAAC,GACT,QACA,aAAa,MACb,WACA,GAAG,WACwB;CAC3B,MAAM,EAAE,MAAM,QAAQ,aAAa;CAEnC,IAAI,MAAM,SAAS,GACjB,QAAQ,KAAK,qDAAqD;CAEpE,MAAM,QAAQ,MAAM,WAAW;CAC/B,MAAM,cAAc,MAAM,WAAW;CAErC,IAAI,OACF,OACE,oBAAC,aAAD;EACE,cAAY,EAAE,oBAAoB;EAC1B;EACR,UAAS;EACG;EACZ,GAAI;CACL,CAAA;MAGH,OACE,oBAAC,aAAD;EACE,cAAY,EAAE,oBAAoB;EAClC,QAAQ,aAAa,CAAC,EAAE,WAAW,QAAQ,CAAC,IAAI,CAAC;EACjD,GAAI;YAEJ,oBAAC,MAAD;GAAM,iBAAgB;aACnB,MAAM,KAAK,OAAO,UACjB,oBAAC,aAAD;IAEE,SAAQ;IACD;IACP,YAAY,eAAe,CAAC,QAAQ,UAAU,KAAA;IAC9C,SAAQ;IACR,GAAG,eAAe,CAAC,QAAQ,UAAU,KAAA;IACrC,YAAY;IACZ,GAAI;GACL,GARM,KAQN,CACF;EACG,CAAA;CACK,CAAA;AAEnB"}
1
+ {"version":3,"file":"color-swatch-group.js","names":[],"sources":["../../../../src/components/color-swatch/color-swatch-group.tsx"],"sourcesContent":["import type { Component, CSSProps } from \"../../core\"\nimport type { ColorSwatchProps } from \"./color-swatch\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { Grid } from \"../grid\"\nimport { ColorSwatch } from \"./color-swatch\"\n\nexport interface ColorSwatchGroupProps extends Omit<ColorSwatchProps, \"color\"> {\n /**\n * The color used for the swatch element.\n *\n * @default '#ffffff00'\n */\n items?: CSSProps[\"color\"][]\n /**\n * The props for the `ColorSwatch` component.\n */\n itemProps?: ColorSwatchProps\n}\n\n/**\n * `ColorSwatchGroup` is a component that displays color samples.\n *\n * @see https://yamada-ui.com/docs/components/color-swatch\n */\nexport const ColorSwatchGroup = (({\n items = [],\n layers,\n withShadow = true,\n itemProps,\n ...rest\n}: ColorSwatchGroupProps) => {\n const { t } = useI18n(\"colorSwatch\")\n\n if (items.length > 4)\n console.warn(\"ColorSwatchGroup: doesn't support more than 4 items\")\n\n const empty = items.length === 0\n const threeColors = items.length === 3\n\n if (empty)\n return (\n <ColorSwatch\n aria-label={t(\"Color swatch group\")}\n layers={layers}\n overflow=\"hidden\"\n withShadow={withShadow}\n {...rest}\n />\n )\n else\n return (\n <ColorSwatch\n aria-label={t(\"Color swatch group\")}\n layers={withShadow ? [{ boxShadow: \"inner\" }] : []}\n {...rest}\n >\n <Grid templateColumns=\"repeat(2, 1fr)\">\n {items.map((color, index) => (\n <ColorSwatch\n key={index}\n boxSize=\"inherit\"\n color={color}\n gridColumn={threeColors && !index ? \"1 / 3\" : undefined}\n rounded=\"0\"\n w={threeColors && !index ? \"unset\" : undefined}\n withShadow={false}\n {...itemProps}\n />\n ))}\n </Grid>\n </ColorSwatch>\n )\n}) as Component<\"div\", ColorSwatchGroupProps>\n"],"mappings":";;;;;;;;;;AAwBA,MAAa,qBAAqB,EAChC,QAAQ,CAAC,GACT,QACA,aAAa,MACb,WACA,GAAG,WACwB;CAC3B,MAAM,EAAE,MAAM,QAAQ,aAAa;CAEnC,IAAI,MAAM,SAAS,GACjB,QAAQ,KAAK,qDAAqD;CAEpE,MAAM,QAAQ,MAAM,WAAW;CAC/B,MAAM,cAAc,MAAM,WAAW;CAErC,IAAI,OACF,OACE,oBAAC,aAAD;EACE,cAAY,EAAE,oBAAoB;EAC1B;EACR,UAAS;EACG;EACZ,GAAI;CACL,CAAA;MAGH,OACE,oBAAC,aAAD;EACE,cAAY,EAAE,oBAAoB;EAClC,QAAQ,aAAa,CAAC,EAAE,WAAW,QAAQ,CAAC,IAAI,CAAC;EACjD,GAAI;EAEJ,UAAA,oBAAC,MAAD;GAAM,iBAAgB;GACnB,UAAA,MAAM,KAAK,OAAO,UACjB,oBAAC,aAAD;IAEE,SAAQ;IACD;IACP,YAAY,eAAe,CAAC,QAAQ,UAAU,KAAA;IAC9C,SAAQ;IACR,GAAG,eAAe,CAAC,QAAQ,UAAU,KAAA;IACrC,YAAY;IACZ,GAAI;GACL,GARM,KAQN,CACF;EACG,CAAA;CACK,CAAA;AAEnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"color-swatch.js","names":[],"sources":["../../../../src/components/color-swatch/color-swatch.tsx"],"sourcesContent":["\"use client\"\n\nimport type { CSSProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ColorSwatchStyle } from \"./color-swatch.style\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { isString } from \"../../utils\"\nimport { colorSwatchStyle } from \"./color-swatch.style\"\n\nexport const checkersProps: HTMLStyledProps = {\n bgImage: [\n \"linear(45deg, {checkers-fg} 25%, transparent 25%)\",\n \"linear(-45deg, {checkers-fg} 25%, transparent 25%)\",\n \"linear(45deg, transparent 75%, {checkers-fg} 75%)\",\n \"linear(-45deg, {checkers-bg} 75%, {checkers-fg} 75%)\",\n ].join(\", \"),\n bgPosition: `0 0, 0 4px, 4px -4px, -4px 0`,\n bgSize: `8px 8px`,\n}\n\nconst defaultLayers = (\n background: CSSProps[\"color\"],\n withShadow: boolean,\n): HTMLStyledProps[] => {\n const layers: HTMLStyledProps[] = [checkersProps, { background }]\n\n if (withShadow) layers.push({ boxShadow: \"inner\" })\n\n return layers\n}\n\nexport interface ColorSwatchProps\n extends Omit<HTMLStyledProps, \"color\">, ThemeProps<ColorSwatchStyle> {\n /**\n * The color used for the swatch element.\n *\n * @default '#ffffff00'\n */\n color?: CSSProps[\"color\"]\n /**\n * The overlay used for the swatch element.\n */\n layers?: HTMLStyledProps[]\n /**\n * If `true`, the swatch element has an inner `box-shadow`.\n *\n * @default true\n */\n withShadow?: boolean\n}\n\nconst {\n PropsContext: ColorSwatchPropsContext,\n usePropsContext: useColorSwatchPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<ColorSwatchProps, ColorSwatchStyle>(\n \"color-swatch\",\n colorSwatchStyle,\n)\n\nexport { ColorSwatchPropsContext, useColorSwatchPropsContext }\n\n/**\n * `ColorSwatch` is a component that displays color samples.\n *\n * @see https://yamada-ui.com/docs/components/color-swatch\n */\nexport const ColorSwatch = withProvider<\"div\", ColorSwatchProps>(\n ({\n children,\n color = \"#ffffff00\",\n withShadow = true,\n layers = defaultLayers(color, withShadow),\n ...rest\n }) => {\n return (\n <styled.div\n aria-label={isString(color) ? color : undefined}\n aria-roledescription=\"color swatch\"\n role=\"img\"\n {...rest}\n >\n {children}\n {layers.map((props, index) => (\n <ColorSwatchOverlay key={index} {...props} />\n ))}\n </styled.div>\n )\n },\n \"root\",\n)()\n\nexport interface ColorSwatchOverlayProps extends HTMLStyledProps {}\n\nexport const ColorSwatchOverlay = withContext<\"div\", ColorSwatchOverlayProps>(\n \"div\",\n \"overlay\",\n)()\n"],"mappings":";;;;;;;AAQA,MAAa,gBAAiC;CAC5C,SAAS;EACP;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CACX,YAAY;CACZ,QAAQ;AACV;AAEA,MAAM,iBACJ,YACA,eACsB;CACtB,MAAM,SAA4B,CAAC,eAAe,EAAE,WAAW,CAAC;CAEhE,IAAI,YAAY,OAAO,KAAK,EAAE,WAAW,QAAQ,CAAC;CAElD,OAAO;AACT;AAsBA,MAAM,EACJ,cAAc,yBACd,iBAAiB,4BACjB,aACA,iBACE,oBACF,gBACA,gBACF;;;;;;AASA,MAAa,cAAc,cACxB,EACC,UACA,QAAQ,aACR,aAAa,MACb,SAAS,cAAc,OAAO,UAAU,GACxC,GAAG,WACC;CACJ,OACE,qBAAC,OAAO,KAAR;EACE,eAAA,GAAA,cAAA,SAAA,CAAqB,KAAK,IAAI,QAAQ,KAAA;EACtC,wBAAqB;EACrB,MAAK;EACL,GAAI;YAJN,CAMG,UACA,OAAO,KAAK,OAAO,UAClB,oBAAC,oBAAD,EAAgC,GAAI,MAAQ,GAAnB,KAAmB,CAC7C,CACS;;AAEhB,GACA,MACF,CAAC,CAAC;AAIF,MAAa,qBAAqB,YAChC,OACA,SACF,CAAC,CAAC"}
1
+ {"version":3,"file":"color-swatch.js","names":[],"sources":["../../../../src/components/color-swatch/color-swatch.tsx"],"sourcesContent":["\"use client\"\n\nimport type { CSSProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ColorSwatchStyle } from \"./color-swatch.style\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { isString } from \"../../utils\"\nimport { colorSwatchStyle } from \"./color-swatch.style\"\n\nexport const checkersProps: HTMLStyledProps = {\n bgImage: [\n \"linear(45deg, {checkers-fg} 25%, transparent 25%)\",\n \"linear(-45deg, {checkers-fg} 25%, transparent 25%)\",\n \"linear(45deg, transparent 75%, {checkers-fg} 75%)\",\n \"linear(-45deg, {checkers-bg} 75%, {checkers-fg} 75%)\",\n ].join(\", \"),\n bgPosition: `0 0, 0 4px, 4px -4px, -4px 0`,\n bgSize: `8px 8px`,\n}\n\nconst defaultLayers = (\n background: CSSProps[\"color\"],\n withShadow: boolean,\n): HTMLStyledProps[] => {\n const layers: HTMLStyledProps[] = [checkersProps, { background }]\n\n if (withShadow) layers.push({ boxShadow: \"inner\" })\n\n return layers\n}\n\nexport interface ColorSwatchProps\n extends Omit<HTMLStyledProps, \"color\">, ThemeProps<ColorSwatchStyle> {\n /**\n * The color used for the swatch element.\n *\n * @default '#ffffff00'\n */\n color?: CSSProps[\"color\"]\n /**\n * The overlay used for the swatch element.\n */\n layers?: HTMLStyledProps[]\n /**\n * If `true`, the swatch element has an inner `box-shadow`.\n *\n * @default true\n */\n withShadow?: boolean\n}\n\nconst {\n PropsContext: ColorSwatchPropsContext,\n usePropsContext: useColorSwatchPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<ColorSwatchProps, ColorSwatchStyle>(\n \"color-swatch\",\n colorSwatchStyle,\n)\n\nexport { ColorSwatchPropsContext, useColorSwatchPropsContext }\n\n/**\n * `ColorSwatch` is a component that displays color samples.\n *\n * @see https://yamada-ui.com/docs/components/color-swatch\n */\nexport const ColorSwatch = withProvider<\"div\", ColorSwatchProps>(\n ({\n children,\n color = \"#ffffff00\",\n withShadow = true,\n layers = defaultLayers(color, withShadow),\n ...rest\n }) => {\n return (\n <styled.div\n aria-label={isString(color) ? color : undefined}\n aria-roledescription=\"color swatch\"\n role=\"img\"\n {...rest}\n >\n {children}\n {layers.map((props, index) => (\n <ColorSwatchOverlay key={index} {...props} />\n ))}\n </styled.div>\n )\n },\n \"root\",\n)()\n\nexport interface ColorSwatchOverlayProps extends HTMLStyledProps {}\n\nexport const ColorSwatchOverlay = withContext<\"div\", ColorSwatchOverlayProps>(\n \"div\",\n \"overlay\",\n)()\n"],"mappings":";;;;;;;AAQA,MAAa,gBAAiC;CAC5C,SAAS;EACP;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CACX,YAAY;CACZ,QAAQ;AACV;AAEA,MAAM,iBACJ,YACA,eACsB;CACtB,MAAM,SAA4B,CAAC,eAAe,EAAE,WAAW,CAAC;CAEhE,IAAI,YAAY,OAAO,KAAK,EAAE,WAAW,QAAQ,CAAC;CAElD,OAAO;AACT;AAsBA,MAAM,EACJ,cAAc,yBACd,iBAAiB,4BACjB,aACA,iBACE,oBACF,gBACA,gBACF;;;;;;AASA,MAAa,cAAc,cACxB,EACC,UACA,QAAQ,aACR,aAAa,MACb,SAAS,cAAc,OAAO,UAAU,GACxC,GAAG,WACC;CACJ,OACE,qBAAC,OAAO,KAAR;EACE,eAAA,GAAA,cAAA,SAAA,CAAqB,KAAK,IAAI,QAAQ,KAAA;EACtC,wBAAqB;EACrB,MAAK;EACL,GAAI;EAJN,UAAA,CAMG,UACA,OAAO,KAAK,OAAO,UAClB,oBAAC,oBAAD,EAAgC,GAAI,MAAQ,GAAnB,KAAmB,CAC7C,CACS;;AAEhB,GACA,MACF,CAAC,CAAC;AAIF,MAAa,qBAAqB,YAChC,OACA,SACF,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"data-list.js","names":[],"sources":["../../../../src/components/data-list/data-list.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { DataListStyle } from \"./data-list.style\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport {\n getValidChildren,\n isArray,\n isEmpty,\n omitChildren,\n pickChildren,\n} from \"../../utils\"\nimport { dataListStyle } from \"./data-list.style\"\n\nexport interface DataListItem extends DataListItemProps {}\n\nexport interface DataListRootProps\n extends HTMLStyledProps<\"dl\">, ThemeProps<DataListStyle> {\n /**\n * If provided, generate elements based on items.\n */\n items?: DataListItem[]\n /**\n * The props for the data list description component.\n */\n descriptionProps?: DataListDescriptionProps\n /**\n * The props for the data list term component.\n */\n termProps?: DataListTermProps\n}\n\ninterface ComponentContext extends Pick<\n DataListRootProps,\n \"descriptionProps\" | \"termProps\"\n> {}\n\nconst {\n ComponentContext,\n PropsContext: DataListPropsContext,\n useComponentContext,\n usePropsContext: useDataListPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<DataListRootProps, DataListStyle, ComponentContext>(\n \"data-list\",\n dataListStyle,\n)\n\nexport { DataListPropsContext, useDataListPropsContext }\n\n/**\n * `DataList` is used to display a list of data items.\n *\n * @see https://yamada-ui.com/docs/components/data-list\n */\nexport const DataListRoot = withProvider<\"dl\", DataListRootProps>(\n ({ style, children, items = [], descriptionProps, termProps, ...rest }) => {\n const col = useMemo(() => {\n let col = 0\n\n if (children) {\n const validChildren = getValidChildren(children)\n const dataListItems = pickChildren(validChildren, DataListItem)\n\n dataListItems.forEach(({ props }) => {\n const validChildren = getValidChildren(props.children)\n const pickedChildren = pickChildren(\n validChildren,\n DataListTerm,\n DataListDescription,\n )\n\n col = Math.max(col, pickedChildren.length)\n })\n } else {\n items.forEach(({ description, term }) => {\n const termCount = !term ? 0 : isArray(term) ? term.length : 1\n const descriptionCount = !description\n ? 0\n : isArray(description)\n ? description.length\n : 1\n\n col = Math.max(col, termCount + descriptionCount)\n })\n }\n\n return col\n }, [children, items])\n const computedChildren = useMemo(\n () =>\n items.map((props, index) => <DataListItem key={index} {...props} />),\n [items],\n )\n const context = useMemo(\n () => ({\n descriptionProps,\n termProps,\n }),\n [descriptionProps, termProps],\n )\n\n return (\n <ComponentContext value={context}>\n <styled.dl style={{ \"--col\": col, ...style }} {...rest}>\n {children ?? computedChildren}\n </styled.dl>\n </ComponentContext>\n )\n },\n \"root\",\n)()\n\nexport interface DataListItemProps extends HTMLStyledProps {\n /**\n * The data list description to use.\n */\n description?: ReactNode | ReactNode[]\n /**\n * The data list term to use.\n */\n term?: ReactNode | ReactNode[]\n /**\n * The props for the data list description component.\n */\n descriptionProps?: DataListDescriptionProps\n /**\n * The props for the data list term component.\n */\n termProps?: DataListTermProps\n}\n\nexport const DataListItem = withContext<\"div\", DataListItemProps>(\n ({\n children,\n description,\n term,\n descriptionProps: customDescriptionProps,\n termProps: customTermProps,\n ...rest\n }) => {\n const { descriptionProps, termProps } = useComponentContext()\n\n const [omittedChildren, customTerms, customDescriptions] = useMemo(() => {\n const validChildren = getValidChildren(children)\n\n if (isEmpty(validChildren)) return [children]\n\n const customTerms = pickChildren(validChildren, DataListTerm)\n const customDescriptions = pickChildren(\n validChildren,\n DataListDescription,\n )\n const omittedChildren = omitChildren(\n validChildren,\n DataListTerm,\n DataListDescription,\n )\n\n return [omittedChildren, customTerms, customDescriptions] as const\n }, [children])\n\n return (\n <styled.div {...rest}>\n {!isEmpty(customTerms) ? (\n customTerms\n ) : isArray(term) ? (\n term.map((item, index) => (\n <DataListTerm\n key={index}\n {...mergeProps(termProps, customTermProps)()}\n >\n {item}\n </DataListTerm>\n ))\n ) : (\n <DataListTerm {...mergeProps(termProps, customTermProps)()}>\n {term}\n </DataListTerm>\n )}\n\n {!isEmpty(customDescriptions) ? (\n customDescriptions\n ) : isArray(description) ? (\n description.map((item, index) => (\n <DataListDescription\n key={index}\n {...mergeProps(descriptionProps, customDescriptionProps)()}\n >\n {item}\n </DataListDescription>\n ))\n ) : (\n <DataListDescription\n {...mergeProps(descriptionProps, customDescriptionProps)()}\n >\n {description}\n </DataListDescription>\n )}\n\n {omittedChildren}\n </styled.div>\n )\n },\n \"item\",\n)()\n\nexport interface DataListTermProps extends HTMLStyledProps<\"dt\"> {}\n\nexport const DataListTerm = withContext<\"dt\", DataListTermProps>(\"dt\", \"term\")()\n\nexport interface DataListDescriptionProps extends HTMLStyledProps<\"dd\"> {}\n\nexport const DataListDescription = withContext<\"dd\", DataListDescriptionProps>(\n \"dd\",\n \"description\",\n)()\n"],"mappings":";;;;;;;;;;AAuCA,MAAM,EACJ,kBACA,cAAc,sBACd,qBACA,iBAAiB,yBACjB,aACA,iBACE,oBACF,aACA,aACF;;;;;;AASA,MAAa,eAAe,cACzB,EAAE,OAAO,UAAU,QAAQ,CAAC,GAAG,kBAAkB,WAAW,GAAG,WAAW;CACzE,MAAM,MAAM,cAAc;EACxB,IAAI,MAAM;EAEV,IAAI,UAIF,aAHsB,iBAAiB,QACQ,GAAG,YAEtC,CAAC,CAAC,SAAS,EAAE,YAAY;GAEnC,MAAM,iBAAiB,aADD,iBAAiB,MAAM,QAE/B,GACZ,cACA,mBACF;GAEA,MAAM,KAAK,IAAI,KAAK,eAAe,MAAM;EAC3C,CAAC;OAED,MAAM,SAAS,EAAE,aAAa,WAAW;GACvC,MAAM,YAAY,CAAC,OAAO,KAAA,GAAA,cAAA,QAAA,CAAY,IAAI,IAAI,KAAK,SAAS;GAC5D,MAAM,mBAAmB,CAAC,cACtB,KAAA,GAAA,cAAA,QAAA,CACQ,WAAW,IACjB,YAAY,SACZ;GAEN,MAAM,KAAK,IAAI,KAAK,YAAY,gBAAgB;EAClD,CAAC;EAGH,OAAO;CACT,GAAG,CAAC,UAAU,KAAK,CAAC;CACpB,MAAM,mBAAmB,cAErB,MAAM,KAAK,OAAO,UAAU,oBAAC,cAAD,EAA0B,GAAI,MAAQ,GAAnB,KAAmB,CAAC,GACrE,CAAC,KAAK,CAC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ED,oBAAC,qBAAD;IACE,GAAI,WAAW,kBAAkB,sBAAsB,CAAC,CAAC;cAExD;GACkB,CAAA;GAGtB;EACS;;AAEhB,GACA,MACF,CAAC,CAAC;AAIF,MAAa,eAAe,YAAqC,MAAM,MAAM,CAAC,CAAC;AAI/E,MAAa,sBAAsB,YACjC,MACA,aACF,CAAC,CAAC"}
1
+ {"version":3,"file":"data-list.js","names":[],"sources":["../../../../src/components/data-list/data-list.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { DataListStyle } from \"./data-list.style\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport {\n getValidChildren,\n isArray,\n isEmpty,\n omitChildren,\n pickChildren,\n} from \"../../utils\"\nimport { dataListStyle } from \"./data-list.style\"\n\nexport interface DataListItem extends DataListItemProps {}\n\nexport interface DataListRootProps\n extends HTMLStyledProps<\"dl\">, ThemeProps<DataListStyle> {\n /**\n * If provided, generate elements based on items.\n */\n items?: DataListItem[]\n /**\n * The props for the data list description component.\n */\n descriptionProps?: DataListDescriptionProps\n /**\n * The props for the data list term component.\n */\n termProps?: DataListTermProps\n}\n\ninterface ComponentContext extends Pick<\n DataListRootProps,\n \"descriptionProps\" | \"termProps\"\n> {}\n\nconst {\n ComponentContext,\n PropsContext: DataListPropsContext,\n useComponentContext,\n usePropsContext: useDataListPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<DataListRootProps, DataListStyle, ComponentContext>(\n \"data-list\",\n dataListStyle,\n)\n\nexport { DataListPropsContext, useDataListPropsContext }\n\n/**\n * `DataList` is used to display a list of data items.\n *\n * @see https://yamada-ui.com/docs/components/data-list\n */\nexport const DataListRoot = withProvider<\"dl\", DataListRootProps>(\n ({ style, children, items = [], descriptionProps, termProps, ...rest }) => {\n const col = useMemo(() => {\n let col = 0\n\n if (children) {\n const validChildren = getValidChildren(children)\n const dataListItems = pickChildren(validChildren, DataListItem)\n\n dataListItems.forEach(({ props }) => {\n const validChildren = getValidChildren(props.children)\n const pickedChildren = pickChildren(\n validChildren,\n DataListTerm,\n DataListDescription,\n )\n\n col = Math.max(col, pickedChildren.length)\n })\n } else {\n items.forEach(({ description, term }) => {\n const termCount = !term ? 0 : isArray(term) ? term.length : 1\n const descriptionCount = !description\n ? 0\n : isArray(description)\n ? description.length\n : 1\n\n col = Math.max(col, termCount + descriptionCount)\n })\n }\n\n return col\n }, [children, items])\n const computedChildren = useMemo(\n () =>\n items.map((props, index) => <DataListItem key={index} {...props} />),\n [items],\n )\n const context = useMemo(\n () => ({\n descriptionProps,\n termProps,\n }),\n [descriptionProps, termProps],\n )\n\n return (\n <ComponentContext value={context}>\n <styled.dl style={{ \"--col\": col, ...style }} {...rest}>\n {children ?? computedChildren}\n </styled.dl>\n </ComponentContext>\n )\n },\n \"root\",\n)()\n\nexport interface DataListItemProps extends HTMLStyledProps {\n /**\n * The data list description to use.\n */\n description?: ReactNode | ReactNode[]\n /**\n * The data list term to use.\n */\n term?: ReactNode | ReactNode[]\n /**\n * The props for the data list description component.\n */\n descriptionProps?: DataListDescriptionProps\n /**\n * The props for the data list term component.\n */\n termProps?: DataListTermProps\n}\n\nexport const DataListItem = withContext<\"div\", DataListItemProps>(\n ({\n children,\n description,\n term,\n descriptionProps: customDescriptionProps,\n termProps: customTermProps,\n ...rest\n }) => {\n const { descriptionProps, termProps } = useComponentContext()\n\n const [omittedChildren, customTerms, customDescriptions] = useMemo(() => {\n const validChildren = getValidChildren(children)\n\n if (isEmpty(validChildren)) return [children]\n\n const customTerms = pickChildren(validChildren, DataListTerm)\n const customDescriptions = pickChildren(\n validChildren,\n DataListDescription,\n )\n const omittedChildren = omitChildren(\n validChildren,\n DataListTerm,\n DataListDescription,\n )\n\n return [omittedChildren, customTerms, customDescriptions] as const\n }, [children])\n\n return (\n <styled.div {...rest}>\n {!isEmpty(customTerms) ? (\n customTerms\n ) : isArray(term) ? (\n term.map((item, index) => (\n <DataListTerm\n key={index}\n {...mergeProps(termProps, customTermProps)()}\n >\n {item}\n </DataListTerm>\n ))\n ) : (\n <DataListTerm {...mergeProps(termProps, customTermProps)()}>\n {term}\n </DataListTerm>\n )}\n\n {!isEmpty(customDescriptions) ? (\n customDescriptions\n ) : isArray(description) ? (\n description.map((item, index) => (\n <DataListDescription\n key={index}\n {...mergeProps(descriptionProps, customDescriptionProps)()}\n >\n {item}\n </DataListDescription>\n ))\n ) : (\n <DataListDescription\n {...mergeProps(descriptionProps, customDescriptionProps)()}\n >\n {description}\n </DataListDescription>\n )}\n\n {omittedChildren}\n </styled.div>\n )\n },\n \"item\",\n)()\n\nexport interface DataListTermProps extends HTMLStyledProps<\"dt\"> {}\n\nexport const DataListTerm = withContext<\"dt\", DataListTermProps>(\"dt\", \"term\")()\n\nexport interface DataListDescriptionProps extends HTMLStyledProps<\"dd\"> {}\n\nexport const DataListDescription = withContext<\"dd\", DataListDescriptionProps>(\n \"dd\",\n \"description\",\n)()\n"],"mappings":";;;;;;;;;;AAuCA,MAAM,EACJ,kBACA,cAAc,sBACd,qBACA,iBAAiB,yBACjB,aACA,iBACE,oBACF,aACA,aACF;;;;;;AASA,MAAa,eAAe,cACzB,EAAE,OAAO,UAAU,QAAQ,CAAC,GAAG,kBAAkB,WAAW,GAAG,WAAW;CACzE,MAAM,MAAM,cAAc;EACxB,IAAI,MAAM;EAEV,IAAI,UAIF,aAHsB,iBAAiB,QACQ,GAAG,YAEtC,CAAC,CAAC,SAAS,EAAE,YAAY;GAEnC,MAAM,iBAAiB,aADD,iBAAiB,MAAM,QAE/B,GACZ,cACA,mBACF;GAEA,MAAM,KAAK,IAAI,KAAK,eAAe,MAAM;EAC3C,CAAC;OAED,MAAM,SAAS,EAAE,aAAa,WAAW;GACvC,MAAM,YAAY,CAAC,OAAO,KAAA,GAAA,cAAA,QAAA,CAAY,IAAI,IAAI,KAAK,SAAS;GAC5D,MAAM,mBAAmB,CAAC,cACtB,KAAA,GAAA,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,CACf,IAED,oBAAC,cAAD;IAAc,GAAI,WAAW,WAAW,eAAe,CAAC,CAAC;IACtD,UAAA;GACW,CAAA;GAGf,EAAA,GAAA,cAAA,QAAA,CAAS,kBAAkB,IAC1B,sBAAA,GAAA,cAAA,QAAA,CACU,WAAW,IACrB,YAAY,KAAK,MAAM,UACrB,oBAAC,qBAAD;IAEE,GAAI,WAAW,kBAAkB,sBAAsB,CAAC,CAAC;IAExD,UAAA;GACkB,GAJd,KAIc,CACtB,IAED,oBAAC,qBAAD;IACE,GAAI,WAAW,kBAAkB,sBAAsB,CAAC,CAAC;IAExD,UAAA;GACkB,CAAA;GAGtB;EACS;;AAEhB,GACA,MACF,CAAC,CAAC;AAIF,MAAa,eAAe,YAAqC,MAAM,MAAM,CAAC,CAAC;AAI/E,MAAa,sBAAsB,YACjC,MACA,aACF,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.js","names":["Popover.Root","InputGroup.Root","Popover.Trigger","InputGroup.Element","Calendar.Root","Popover.Content"],"sources":["../../../../src/components/date-picker/date-picker.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { Merge } from \"../../utils\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { UsePopoverStyleProps, UsePopupAnimationProps } from \"../popover\"\nimport type { DatePickerStyle } from \"./date-picker.style\"\nimport type { UseDatePickerProps, UseDatePickerReturn } from \"./use-date-picker\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport { useFieldSizing } from \"../../hooks/use-field-sizing\"\nimport { cast, isArray, isDate, isObject, mergeRefs } from \"../../utils\"\nimport { Calendar } from \"../calendar\"\nimport { useGroupItemProps } from \"../group\"\nimport { CalendarIcon, XIcon } from \"../icon\"\nimport { InputGroup, useInputBorder, useInputPropsContext } from \"../input\"\nimport { Popover, usePopoverStyleProps } from \"../popover\"\nimport { datePickerStyle } from \"./date-picker.style\"\nimport { useDatePicker } from \"./use-date-picker\"\n\ninterface ComponentContext\n extends\n Pick<UseDatePickerReturn, \"getInputProps\" | \"range\" | \"separator\">,\n Pick<DatePickerProps, \"inputProps\"> {}\n\nexport interface DatePickerProps<\n Multiple extends boolean = false,\n Range extends boolean = false,\n>\n extends\n Omit<\n HTMLStyledProps,\n \"defaultValue\" | \"offset\" | \"onChange\" | \"ref\" | \"value\"\n >,\n Merge<UseDatePickerProps<Multiple, Range>, UsePopoverStyleProps>,\n UsePopupAnimationProps,\n ThemeProps<DatePickerStyle>,\n UseInputBorderProps {\n /**\n * If `true`, display the clear icon.\n *\n * @default true\n */\n clearable?: boolean\n /**\n * The icon to be used in the clear button.\n */\n clearIcon?: ReactNode\n /**\n * The icon to be used in the date picker.\n */\n icon?: ReactNode\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end-start'\n */\n placement?: Popover.RootProps[\"placement\"]\n /**\n * The size of the calendar component.\n */\n calendarProps?: Calendar.RootProps<Multiple, Range>\n /**\n * Props for content element.\n */\n contentProps?: DatePickerContentProps\n /**\n * The props for the end element.\n */\n elementProps?: InputGroup.ElementProps\n /**\n * Props for icon element.\n */\n iconProps?: DatePickerIconProps\n /**\n * The props for the input element.\n */\n inputProps?: HTMLStyledProps<\"input\">\n /**\n * Props for root element.\n */\n rootProps?: InputGroup.RootProps\n}\n\nconst {\n ComponentContext,\n PropsContext: DatePickerPropsContext,\n useComponentContext,\n usePropsContext: useDatePickerPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<DatePickerProps, DatePickerStyle, ComponentContext>(\n \"date-picker\",\n datePickerStyle,\n)\n\nexport { DatePickerPropsContext, useDatePickerPropsContext }\n\n/**\n * `DatePicker` is a component used for users to select a date.\n *\n * @see https://yamada-ui.com/docs/components/date-picker\n */\nexport const DatePicker = withProvider(\n <Multiple extends boolean = false, Range extends boolean = false>(\n props: DatePickerProps<Multiple, Range>,\n ) => {\n const [\n groupItemProps,\n {\n className,\n css,\n colorScheme,\n size,\n animationScheme = \"block-start\",\n children,\n clearable = true,\n clearIcon = <XIcon />,\n duration,\n errorBorderColor,\n focusBorderColor,\n icon,\n calendarProps,\n contentProps,\n elementProps,\n iconProps,\n inputProps,\n rootProps,\n ...rest\n },\n ] = useGroupItemProps(props)\n const popoverStyleProps = usePopoverStyleProps(rest)\n const {\n children: fieldChildren,\n range,\n separator,\n value,\n getCalendarProps,\n getClearIconProps,\n getContentProps,\n getFieldProps,\n getIconProps,\n getInputProps,\n getRootProps,\n popoverProps,\n } = useDatePicker({ ...rest, ...popoverStyleProps })\n const mergedPopoverProps = useMemo<Popover.RootProps>(\n () => ({\n animationScheme,\n duration,\n ...popoverProps,\n }),\n [animationScheme, duration, popoverProps],\n )\n const varProps = useInputBorder({ errorBorderColor, focusBorderColor })\n const selectProps = useMemo<Calendar.RootProps[\"selectProps\"]>(\n () => ({ contentProps: { portalProps: { disabled: true } } }),\n [],\n )\n const componentContext = useMemo(\n () => ({ range, separator, getInputProps, inputProps }),\n [getInputProps, inputProps, range, separator],\n )\n const hasValue = isArray(value)\n ? !!value.length\n : isObject(value) && !isDate(value)\n ? !!value.end || !!value.start\n : !!value\n\n return (\n <ComponentContext value={componentContext}>\n <Popover.Root {...mergedPopoverProps}>\n <InputGroup.Root\n {...mergeProps(\n { className, css, colorScheme },\n getRootProps(groupItemProps),\n rootProps,\n )()}\n >\n <Popover.Trigger>\n <DatePickerField {...getFieldProps({ ...varProps })}>\n {fieldChildren}\n </DatePickerField>\n </Popover.Trigger>\n\n <InputGroup.Element\n {...{ clickable: clearable && hasValue, ...elementProps }}\n >\n {clearable && hasValue ? (\n <DatePickerIcon\n icon={clearIcon}\n {...getClearIconProps(iconProps)}\n />\n ) : (\n <DatePickerIcon icon={icon} {...getIconProps(iconProps)} />\n )}\n </InputGroup.Element>\n </InputGroup.Root>\n\n <DatePickerContent\n {...cast<DatePickerContentProps>(\n getContentProps(cast<HTMLProps>(contentProps)),\n )}\n >\n <Calendar.Root\n colorScheme={colorScheme}\n size={size}\n fixed={false}\n selectProps={selectProps}\n {...getCalendarProps(calendarProps)}\n >\n {children}\n </Calendar.Root>\n </DatePickerContent>\n </Popover.Root>\n </ComponentContext>\n )\n },\n \"root\",\n { transferProps: [\"size\"] },\n)((props) => {\n const context = useInputPropsContext()\n\n return mergeProps(context, props)()\n}) as GenericsComponent<{\n <Multiple extends boolean = false, Range extends boolean = false>(\n props: DatePickerProps<Multiple, Range>,\n ): ReactElement\n}>\n\ninterface DatePickerFieldProps extends HTMLStyledProps {}\n\nconst DatePickerField = withContext<\"div\", DatePickerFieldProps>(\n \"div\",\n \"field\",\n)({ \"data-group-propagate\": \"\" }, ({ children, ...rest }) => {\n const { range, separator, getInputProps, inputProps } = useComponentContext()\n const computedChildren = useMemo(() => {\n if (range)\n return (\n <>\n <DatePickerAdjustInput\n {...getInputProps({ align: \"start\", ...inputProps })}\n />\n <DatePickerSeparator>{separator}</DatePickerSeparator>\n <DatePickerAdjustInput\n {...getInputProps({ align: \"end\", ...inputProps })}\n />\n </>\n )\n else\n return (\n <>\n {children}\n <DatePickerInput {...getInputProps(inputProps)} />\n </>\n )\n }, [children, getInputProps, inputProps, range, separator])\n\n return {\n ...rest,\n children: computedChildren,\n }\n})\n\ninterface DatePickerInputProps extends HTMLStyledProps<\"input\"> {}\n\nconst DatePickerInput = withContext<\"input\", DatePickerInputProps>(\n \"input\",\n \"input\",\n)()\n\ninterface DatePickerAdjustInputProps extends HTMLStyledProps<\"input\"> {}\n\nconst DatePickerAdjustInput = withContext<\"input\", DatePickerAdjustInputProps>(\n ({ ref, placeholder, value, ...rest }) => {\n const { ref: inputRef, text } = useFieldSizing({\n value: value?.toString() || placeholder,\n })\n\n return (\n <>\n {text}\n\n <styled.input\n ref={mergeRefs(ref, inputRef)}\n placeholder={placeholder}\n value={value}\n {...rest}\n />\n </>\n )\n },\n [\"input\", \"adjust\"],\n)()\n\ninterface DatePickerSeparatorProps extends HTMLStyledProps<\"span\"> {}\n\nconst DatePickerSeparator = withContext<\"span\", DatePickerSeparatorProps>(\n \"span\",\n \"separator\",\n)()\n\ninterface DatePickerIconProps extends HTMLStyledProps {\n icon?: ReactNode\n}\n\nconst DatePickerIcon = withContext<\"div\", DatePickerIconProps>(\"div\", \"icon\")(\n undefined,\n ({ children, icon, ...rest }) => ({\n children: icon || children || <CalendarIcon />,\n ...rest,\n }),\n)\n\ninterface DatePickerContentProps extends Popover.ContentProps {}\n\nconst DatePickerContent = withContext<\"div\", DatePickerContentProps>(\n Popover.Content,\n \"content\",\n)()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0FA,MAAM,EACJ,kBACA,cAAc,wBACd,qBACA,iBAAiB,2BACjB,aACA,iBACE,oBACF,eACA,eACF;;;;;;AASA,MAAa,aAAa,cAEtB,UACG;CACH,MAAM,CACJ,gBACA,EACE,WACA,KACA,aACA,MACA,kBAAkB,eAClB,UACA,YAAY,MACZ,YAAY,oBAAC,OAAD,CAAQ,CAAA,GACpB,UACA,kBACA,kBACA,MACA,eACA,cACA,cACA,WACA,YACA,WACA,GAAG,UAEH,kBAAkB,KAAK;CAC3B,MAAM,oBAAoB,qBAAqB,IAAI;CACnD,MAAM,EACJ,UAAU,eACV,OACA,WACA,OACA,kBACA,mBACA,iBACA,eACA,cACA,eACA,cACA,iBACE,cAAc;EAAE,GAAG;EAAM,GAAG;CAAkB,CAAC;CACnD,MAAM,qBAAqB,eAClB;EACL;EACA;EACA,GAAG;CACL,IACA;EAAC;EAAiB;EAAU;CAAY,CAC1C;CACA,MAAM,WAAW,eAAe;EAAE;EAAkB;CAAiB,CAAC;CACtE,MAAM,cAAc,eACX,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE,IAC3D,CAAC,CACH;CACA,MAAM,mBAAmB,eAChB;EAAE;EAAO;EAAW;EAAe;CAAW,IACrD;EAAC;EAAe;EAAY;EAAO;CAAS,CAC9C;C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putGroup.Root","Popover.Trigger","InputGroup.Element","Calendar.Root","Popover.Content"],"sources":["../../../../src/components/date-picker/date-picker.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { Merge } from \"../../utils\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { UsePopoverStyleProps, UsePopupAnimationProps } from \"../popover\"\nimport type { DatePickerStyle } from \"./date-picker.style\"\nimport type { UseDatePickerProps, UseDatePickerReturn } from \"./use-date-picker\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport { useFieldSizing } from \"../../hooks/use-field-sizing\"\nimport { cast, isArray, isDate, isObject, mergeRefs } from \"../../utils\"\nimport { Calendar } from \"../calendar\"\nimport { useGroupItemProps } from \"../group\"\nimport { CalendarIcon, XIcon } from \"../icon\"\nimport { InputGroup, useInputBorder, useInputPropsContext } from \"../input\"\nimport { Popover, usePopoverStyleProps } from \"../popover\"\nimport { datePickerStyle } from \"./date-picker.style\"\nimport { useDatePicker } from \"./use-date-picker\"\n\ninterface ComponentContext\n extends\n Pick<UseDatePickerReturn, \"getInputProps\" | \"range\" | \"separator\">,\n Pick<DatePickerProps, \"inputProps\"> {}\n\nexport interface DatePickerProps<\n Multiple extends boolean = false,\n Range extends boolean = false,\n>\n extends\n Omit<\n HTMLStyledProps,\n \"defaultValue\" | \"offset\" | \"onChange\" | \"ref\" | \"value\"\n >,\n Merge<UseDatePickerProps<Multiple, Range>, UsePopoverStyleProps>,\n UsePopupAnimationProps,\n ThemeProps<DatePickerStyle>,\n UseInputBorderProps {\n /**\n * If `true`, display the clear icon.\n *\n * @default true\n */\n clearable?: boolean\n /**\n * The icon to be used in the clear button.\n */\n clearIcon?: ReactNode\n /**\n * The icon to be used in the date picker.\n */\n icon?: ReactNode\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end-start'\n */\n placement?: Popover.RootProps[\"placement\"]\n /**\n * The size of the calendar component.\n */\n calendarProps?: Calendar.RootProps<Multiple, Range>\n /**\n * Props for content element.\n */\n contentProps?: DatePickerContentProps\n /**\n * The props for the end element.\n */\n elementProps?: InputGroup.ElementProps\n /**\n * Props for icon element.\n */\n iconProps?: DatePickerIconProps\n /**\n * The props for the input element.\n */\n inputProps?: HTMLStyledProps<\"input\">\n /**\n * Props for root element.\n */\n rootProps?: InputGroup.RootProps\n}\n\nconst {\n ComponentContext,\n PropsContext: DatePickerPropsContext,\n useComponentContext,\n usePropsContext: useDatePickerPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<DatePickerProps, DatePickerStyle, ComponentContext>(\n \"date-picker\",\n datePickerStyle,\n)\n\nexport { DatePickerPropsContext, useDatePickerPropsContext }\n\n/**\n * `DatePicker` is a component used for users to select a date.\n *\n * @see https://yamada-ui.com/docs/components/date-picker\n */\nexport const DatePicker = withProvider(\n <Multiple extends boolean = false, Range extends boolean = false>(\n props: DatePickerProps<Multiple, Range>,\n ) => {\n const [\n groupItemProps,\n {\n className,\n css,\n colorScheme,\n size,\n animationScheme = \"block-start\",\n children,\n clearable = true,\n clearIcon = <XIcon />,\n duration,\n errorBorderColor,\n focusBorderColor,\n icon,\n calendarProps,\n contentProps,\n elementProps,\n iconProps,\n inputProps,\n rootProps,\n ...rest\n },\n ] = useGroupItemProps(props)\n const popoverStyleProps = usePopoverStyleProps(rest)\n const {\n children: fieldChildren,\n range,\n separator,\n value,\n getCalendarProps,\n getClearIconProps,\n getContentProps,\n getFieldProps,\n getIconProps,\n getInputProps,\n getRootProps,\n popoverProps,\n } = useDatePicker({ ...rest, ...popoverStyleProps })\n const mergedPopoverProps = useMemo<Popover.RootProps>(\n () => ({\n animationScheme,\n duration,\n ...popoverProps,\n }),\n [animationScheme, duration, popoverProps],\n )\n const varProps = useInputBorder({ errorBorderColor, focusBorderColor })\n const selectProps = useMemo<Calendar.RootProps[\"selectProps\"]>(\n () => ({ contentProps: { portalProps: { disabled: true } } }),\n [],\n )\n const componentContext = useMemo(\n () => ({ range, separator, getInputProps, inputProps }),\n [getInputProps, inputProps, range, separator],\n )\n const hasValue = isArray(value)\n ? !!value.length\n : isObject(value) && !isDate(value)\n ? !!value.end || !!value.start\n : !!value\n\n return (\n <ComponentContext value={componentContext}>\n <Popover.Root {...mergedPopoverProps}>\n <InputGroup.Root\n {...mergeProps(\n { className, css, colorScheme },\n getRootProps(groupItemProps),\n rootProps,\n )()}\n >\n <Popover.Trigger>\n <DatePickerField {...getFieldProps({ ...varProps })}>\n {fieldChildren}\n </DatePickerField>\n </Popover.Trigger>\n\n <InputGroup.Element\n {...{ clickable: clearable && hasValue, ...elementProps }}\n >\n {clearable && hasValue ? (\n <DatePickerIcon\n icon={clearIcon}\n {...getClearIconProps(iconProps)}\n />\n ) : (\n <DatePickerIcon icon={icon} {...getIconProps(iconProps)} />\n )}\n </InputGroup.Element>\n </InputGroup.Root>\n\n <DatePickerContent\n {...cast<DatePickerContentProps>(\n getContentProps(cast<HTMLProps>(contentProps)),\n )}\n >\n <Calendar.Root\n colorScheme={colorScheme}\n size={size}\n fixed={false}\n selectProps={selectProps}\n {...getCalendarProps(calendarProps)}\n >\n {children}\n </Calendar.Root>\n </DatePickerContent>\n </Popover.Root>\n </ComponentContext>\n )\n },\n \"root\",\n { transferProps: [\"size\"] },\n)((props) => {\n const context = useInputPropsContext()\n\n return mergeProps(context, props)()\n}) as GenericsComponent<{\n <Multiple extends boolean = false, Range extends boolean = false>(\n props: DatePickerProps<Multiple, Range>,\n ): ReactElement\n}>\n\ninterface DatePickerFieldProps extends HTMLStyledProps {}\n\nconst DatePickerField = withContext<\"div\", DatePickerFieldProps>(\n \"div\",\n \"field\",\n)({ \"data-group-propagate\": \"\" }, ({ children, ...rest }) => {\n const { range, separator, getInputProps, inputProps } = useComponentContext()\n const computedChildren = useMemo(() => {\n if (range)\n return (\n <>\n <DatePickerAdjustInput\n {...getInputProps({ align: \"start\", ...inputProps })}\n />\n <DatePickerSeparator>{separator}</DatePickerSeparator>\n <DatePickerAdjustInput\n {...getInputProps({ align: \"end\", ...inputProps })}\n />\n </>\n )\n else\n return (\n <>\n {children}\n <DatePickerInput {...getInputProps(inputProps)} />\n </>\n )\n }, [children, getInputProps, inputProps, range, separator])\n\n return {\n ...rest,\n children: computedChildren,\n }\n})\n\ninterface DatePickerInputProps extends HTMLStyledProps<\"input\"> {}\n\nconst DatePickerInput = withContext<\"input\", DatePickerInputProps>(\n \"input\",\n \"input\",\n)()\n\ninterface DatePickerAdjustInputProps extends HTMLStyledProps<\"input\"> {}\n\nconst DatePickerAdjustInput = withContext<\"input\", DatePickerAdjustInputProps>(\n ({ ref, placeholder, value, ...rest }) => {\n const { ref: inputRef, text } = useFieldSizing({\n value: value?.toString() || placeholder,\n })\n\n return (\n <>\n {text}\n\n <styled.input\n ref={mergeRefs(ref, inputRef)}\n placeholder={placeholder}\n value={value}\n {...rest}\n />\n </>\n )\n },\n [\"input\", \"adjust\"],\n)()\n\ninterface DatePickerSeparatorProps extends HTMLStyledProps<\"span\"> {}\n\nconst DatePickerSeparator = withContext<\"span\", DatePickerSeparatorProps>(\n \"span\",\n \"separator\",\n)()\n\ninterface DatePickerIconProps extends HTMLStyledProps {\n icon?: ReactNode\n}\n\nconst DatePickerIcon = withContext<\"div\", DatePickerIconProps>(\"div\", \"icon\")(\n undefined,\n ({ children, icon, ...rest }) => ({\n children: icon || children || <CalendarIcon />,\n ...rest,\n }),\n)\n\ninterface DatePickerContentProps extends Popover.ContentProps {}\n\nconst DatePickerContent = withContext<\"div\", DatePickerContentProps>(\n Popover.Content,\n \"content\",\n)()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0FA,MAAM,EACJ,kBACA,cAAc,wBACd,qBACA,iBAAiB,2BACjB,aACA,iBACE,oBACF,eACA,eACF;;;;;;AASA,MAAa,aAAa,cAEtB,UACG;CACH,MAAM,CACJ,gBACA,EACE,WACA,KACA,aACA,MACA,kB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,MAAM,kBAAkB,YACtB,SACA,OACF,CAAC,CAAC;AAIF,MAAM,wBAAwB,aAC3B,EAAE,KAAK,aAAa,OAAO,GAAG,WAAW;CACxC,MAAM,EAAE,KAAK,UAAU,SAAS,eAAe,EAC7C,OAAO,OAAO,SAAS,KAAK,YAC9B,CAAC;CAED,OACE,qBAAA,YAAA,EAAA,UAAA,CACG,MAED,oBAAC,OAAO,OAAR;EACE,KAAK,UAAU,KAAK,QAAQ;EACf;EACN;EACP,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,GACA,CAAC,SAAS,QAAQ,CACpB,CAAC,CAAC;AAIF,MAAM,sBAAsB,YAC1B,QACA,WACF,CAAC,CAAC;AAMF,MAAM,iBAAiB,YAAwC,OAAO,MAAM,CAAC,CAC3E,KAAA,IACC,EAAE,UAAU,MAAM,GAAG,YAAY;CAChC,UAAU,QAAQ,YAAY,oBAAC,cAAD,CAAe,CAAA;CAC7C,GAAG;AACL,EACF;AAIA,MAAM,oBAAoB,YACxBC,gBACA,SACF,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-date-picker.js","names":[],"sources":["../../../../src/components/date-picker/use-date-picker.tsx"],"sourcesContent":["\"use client\"\n\nimport type {\n ChangeEvent,\n FocusEvent,\n KeyboardEvent,\n MouseEvent,\n ReactNode,\n} from \"react\"\nimport type { HTMLProps, HTMLRefAttributes, PropGetter } from \"../../core\"\nimport type { UseComboboxProps } from \"../../hooks/use-combobox\"\nimport type { Dict } from \"../../utils\"\nimport type {\n CalendarFormat,\n MaybeDateValue,\n UseCalendarProps,\n} from \"../calendar\"\nimport type { FieldProps } from \"../field\"\nimport dayjs from \"dayjs\"\nimport {\n cloneElement,\n isValidElement,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\"\nimport { useEnvironment } from \"../../core\"\nimport { useCombobox } from \"../../hooks/use-combobox\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n cast,\n contains,\n dataAttr,\n focusTransfer,\n handlerAll,\n isActiveElement,\n isArray,\n isComposing,\n isDate,\n isNumber,\n isObject,\n mergeRefs,\n runIfFn,\n runKeyAction,\n useUpdateEffect,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport {\n DEFAULT_MAX_DATE,\n DEFAULT_MIN_DATE,\n getAdjustedMonth,\n isAfterDate,\n isBeforeDate,\n isIncludeDates,\n updateMaybeDateValue,\n useCalendarProps,\n} from \"../calendar\"\nimport { useFieldProps } from \"../field\"\nimport { useDateTimeFormat } from \"../format\"\n\nexport interface DatePickerFormat extends CalendarFormat {\n input?: Intl.DateTimeFormatOptions | null\n}\n\ntype InputAlign = \"end\" | \"start\"\ntype MaybeInputValue<Range extends boolean = false> = Range extends true\n ? { end?: string; start?: string }\n : string | undefined\n\ninterface DatePickerRenderProps {\n count: number\n date: Date\n focused: boolean\n index: number\n separator: string\n value: string\n onClear: () => void\n max?: number\n}\n\nexport interface DatePickerRender {\n (props: DatePickerRenderProps): ReactNode\n}\n\nconst defaultRender: DatePickerRender = ({\n count,\n focused,\n index,\n max,\n separator,\n value,\n}) => {\n const last = count - 1 === index\n\n return (\n <span style={{ marginInlineEnd: \"var(--gap)\" }}>\n {value}\n {((!isNumber(max) || count < max) && focused) || !last ? separator : null}\n </span>\n )\n}\n\nexport interface UseDatePickerProps<\n Multiple extends boolean = false,\n Range extends boolean = false,\n>\n extends\n Omit<UseCalendarProps<Multiple, Range>, \"format\" | \"ref\">,\n Omit<\n UseComboboxProps,\n \"defaultValue\" | \"initialFocusValue\" | \"onChange\" | \"ref\" | \"value\"\n >,\n HTMLRefAttributes<\"input\">,\n FieldProps {\n /**\n * If `true`, allows input.\n *\n * @default true\n */\n allowInput?: boolean\n /**\n * If `true`, allows input of dates beyond the `minDate` and `maxDate` restrictions.\n *\n * @default true\n */\n allowInputBeyond?: boolean\n /**\n * If `true`, the date picker will be closed when the input value changes.\n *\n * @default false\n */\n closeOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * The initial value of the input.\n */\n defaultInputValue?: MaybeInputValue<Range>\n /**\n * If `true`, the input will be focused when the clear icon is clicked.\n *\n * @default true\n */\n focusOnClear?: boolean\n /**\n * The format used for conversion.\n * Check the docs to see the format of possible modifiers you can pass.\n *\n * @see https://day.js.org/docs/en/display/format#list-of-localized-formats\n */\n format?: DatePickerFormat\n /**\n * The `id` attribute of the input element.\n */\n id?: string\n /**\n * The value of the input.\n */\n inputValue?: MaybeInputValue<Range>\n /**\n * The `name` attribute of the input element.\n */\n name?: string\n /**\n * If `true`, the date picker will be opened when the input value changes.\n *\n * @default true\n */\n openOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * If `true`, the date picker will be opened when the input is focused.\n *\n * @default true\n */\n openOnFocus?: boolean\n /**\n * The pattern used to check the input element.\n */\n pattern?: RegExp\n /**\n * The placeholder for date picker.\n */\n placeholder?: string\n /**\n * The visual separator between each value.\n *\n * @default ','\n */\n separator?: string\n /**\n * The callback invoked when input value state changes.\n */\n onInputChange?: (value: MaybeInputValue<Range>) => void\n /**\n * Function that converts the input value to Date type.\n */\n parseDate?: (value: string) => Date | undefined\n /**\n * The function to render the selected date.\n */\n render?: (props: DatePickerRenderProps) => ReactNode\n}\n\nexport const useDatePicker = <\n Multiple extends boolean = false,\n Range extends boolean = false,\n>({\n maxDate = DEFAULT_MAX_DATE,\n minDate = DEFAULT_MIN_DATE,\n ...props\n}: UseDatePickerProps<Multiple, Range> = {}) => {\n if (dayjs(minDate).isAfter(dayjs(maxDate))) maxDate = minDate\n\n const { getDocument } = useEnvironment()\n const { locale: defaultLocale, t } = useI18n(\"datePicker\")\n const {\n props: {\n id,\n ref,\n name,\n allowInput = true,\n allowInputBeyond = false,\n closeOnChange = false,\n multiple = false,\n closeOnSelect = !multiple,\n defaultInputValue,\n defaultMonth = new Date(),\n range = false,\n defaultValue = (range\n ? { end: undefined, start: undefined }\n : multiple\n ? []\n : undefined) as MaybeDateValue<Multiple, Range>,\n disabled,\n focusOnClear = true,\n format,\n inputValue: inputValueProp,\n locale = defaultLocale,\n max,\n month: monthProp,\n openOnChange = true,\n openOnClick = true,\n openOnFocus = true,\n parseDate,\n pattern,\n placeholder: placeholderProp,\n placement = \"end-start\",\n readOnly,\n render = defaultRender,\n required,\n separator = range ? \"-\" : \",\",\n value: valueProp,\n onChange: onChangeProp,\n onChangeMonth: onChangeMonthProp,\n onInputChange: onInputChangeProp,\n ...computedProps\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const dateTimeFormat = useDateTimeFormat({ locale })\n const { calendarFormat, inputFormat } = useMemo(() => {\n const { input: inputFormat, ...calendarFormat } = format ?? {}\n const defaultInputFormat: Intl.DateTimeFormatOptions = {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n }\n\n return {\n calendarFormat,\n inputFormat:\n inputFormat !== null ? (inputFormat ?? defaultInputFormat) : undefined,\n }\n }, [format])\n const [calendarProps, rest] = useCalendarProps<Multiple, Range>(computedProps)\n const { excludeDate } = calendarProps\n const fieldRef = useRef<HTMLDivElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const startInputRef = useRef<HTMLInputElement>(null)\n const endInputRef = useRef<HTMLInputElement>(null)\n const focusByClickRef = useRef<boolean>(false)\n const [focused, setFocused] = useState(false)\n const [value, setValue] = useControllableState({\n defaultValue: defaultValue as MaybeDateValue<Multiple, Range>,\n value: valueProp,\n onChange: onChangeProp,\n })\n const [month, setMonth] = useControllableState({\n defaultValue: () => {\n let value = defaultMonth\n\n if (dayjs(minDate).isAfter(dayjs(defaultMonth)))\n value = dayjs(minDate).set(\"date\", 1).toDate()\n\n if (valueProp) value = getAdjustedMonth(valueProp, value)\n else if (defaultValue) value = getAdjustedMonth(defaultValue, value)\n\n return value\n },\n value: monthProp,\n onChange: onChangeMonthProp,\n })\n const stringToDate = useCallback(\n (value: string, start: Date = minDate, end: Date = maxDate) => {\n let date = parseDate?.(value)\n\n if (!date && dayjs(value).isValid())\n date = dayjs(value).locale(locale).toDate()\n\n if (date == null) return undefined\n if (excludeDate?.(date)) return undefined\n\n if (!allowInputBeyond) {\n if (isBeforeDate(date, start)) date = start\n if (isAfterDate(date, end)) date = end\n }\n\n return date\n },\n [allowInputBeyond, excludeDate, locale, maxDate, minDate, parseDate],\n )\n const dateToString = useCallback(\n (date?: Date) => {\n if (date == null) return \"\"\n\n return dateTimeFormat(date, inputFormat)\n },\n [dateTimeFormat, inputFormat],\n )\n const [inputValue, setInputValue] = useControllableState({\n defaultValue: () => {\n if (defaultInputValue)\n if (isObject(defaultInputValue)) {\n if (dayjs(defaultInputValue.start).isValid())\n defaultInputValue.start = dateTimeFormat(\n dayjs(defaultInputValue.start).toDate(),\n inputFormat,\n )\n\n if (dayjs(defaultInputValue.end).isValid())\n defaultInputValue.end = dateTimeFormat(\n dayjs(defaultInputValue.end).toDate(),\n inputFormat,\n )\n\n return defaultInputValue\n } else {\n if (dayjs(defaultInputValue).isValid())\n return dateTimeFormat(\n dayjs(defaultInputValue).toDate(),\n inputFormat,\n ) as MaybeInputValue<Range>\n else return defaultInputValue\n }\n else if (isDate(value))\n return dateToString(value) as MaybeInputValue<Range>\n else if (isObject(value) && !isArray(value))\n return {\n end: dateToString(value.end),\n start: dateToString(value.start),\n } as MaybeInputValue<Range>\n else return \"\" as MaybeInputValue<Range>\n },\n value: inputValueProp,\n onChange: onInputChangeProp,\n })\n const {\n interactive,\n open,\n getContentProps: getComboboxContentProps,\n getTriggerProps,\n popoverProps,\n onClose,\n onOpen,\n } = useCombobox({\n disabled,\n matchWidth: false,\n openOnClick: false,\n openOnEnter: !allowInput,\n openOnSpace: !allowInput,\n placement,\n readOnly,\n transferFocus: false,\n ...ariaProps,\n ...dataProps,\n ...eventProps,\n ...rest,\n })\n const children = useMemo<ReactNode>(() => {\n if (!isArray(value)) return null\n\n const count = value.length\n\n return value.map((date, index) => {\n const value = dateToString(date)\n\n const onClear = (ev?: MouseEvent<HTMLElement>) => {\n ev?.preventDefault()\n ev?.stopPropagation()\n\n setValue(\n (prev) =>\n updateMaybeDateValue(date, max)(prev) as MaybeDateValue<\n Multiple,\n Range\n >,\n )\n }\n\n const component = render({\n count,\n date,\n focused,\n index,\n max,\n separator,\n value,\n onClear,\n })\n\n if (isValidElement<Dict>(component))\n return cloneElement(component, { ...component.props, key: index })\n else return component\n })\n }, [dateToString, focused, max, render, separator, setValue, value])\n const { endPlaceholder, startPlaceholder } = useMemo(() => {\n if (range) {\n const startPlaceholder =\n placeholderProp ?? dateTimeFormat(new Date(), inputFormat)\n const endPlaceholder =\n placeholderProp ??\n dateTimeFormat(dayjs().add(1, \"day\").toDate(), inputFormat)\n\n return { endPlaceholder, startPlaceholder }\n } else {\n const placeholder =\n placeholderProp ?? dateTimeFormat(new Date(), inputFormat)\n\n return { endPlaceholder: placeholder, startPlaceholder: placeholder }\n }\n }, [dateTimeFormat, inputFormat, placeholderProp, range])\n\n const onChange = useCallback(\n (value: MaybeDateValue<Multiple, Range>) => {\n setValue(value)\n\n if (isArray(value)) setInputValue(\"\" as MaybeInputValue<Range>)\n else if (isObject(value) && !isDate(value))\n setInputValue({\n end: dateToString(value.end),\n start: dateToString(value.start),\n } as MaybeInputValue<Range>)\n else setInputValue(dateToString(value) as MaybeInputValue<Range>)\n\n if (!closeOnSelect) return\n\n if (isObject(value) && !isArray(value) && !isDate(value)) {\n if (value.end && value.start) onClose()\n } else {\n onClose()\n }\n },\n [setValue, closeOnSelect, setInputValue, dateToString, onClose],\n )\n\n const onInputChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n if (!allowInput) return\n if (isArray(value) && value.length === max) return\n\n if (runIfFn(closeOnChange, ev)) onClose()\n else if (runIfFn(openOnChange, ev)) onOpen()\n\n let inputValue = ev.target.value\n\n if (pattern) inputValue = inputValue.replace(pattern, \"\")\n\n if (isArray(value)) {\n const date = stringToDate(inputValue)\n\n setInputValue(inputValue as MaybeInputValue<Range>)\n\n if (date) setMonth(dayjs(date).set(\"date\", 1).toDate())\n } else if (isObject(value) && !isDate(value)) {\n const align = contains(endInputRef.current, ev.target) ? \"end\" : \"start\"\n const minDate =\n value.start && align === \"end\"\n ? dayjs(value.start).add(1, \"day\").toDate()\n : undefined\n const maxDate =\n value.end && align === \"start\"\n ? dayjs(value.end).subtract(1, \"day\").toDate()\n : undefined\n const date = stringToDate(inputValue, minDate, maxDate)\n\n setInputValue((prev) =>\n isObject(prev)\n ? Object.assign({}, prev, { [align]: inputValue })\n : prev,\n )\n setValue((prev) =>\n isObject(prev) && !isDate(prev) ? { ...prev, [align]: date } : prev,\n )\n } else {\n const date = stringToDate(inputValue)\n\n setInputValue(inputValue as MaybeInputValue<Range>)\n setValue(date as MaybeDateValue<Multiple, Range>)\n }\n },\n [\n allowInput,\n closeOnChange,\n max,\n onClose,\n onOpen,\n openOnChange,\n pattern,\n setInputValue,\n setMonth,\n setValue,\n stringToDate,\n value,\n ],\n )\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLInputElement>) => {\n if (disabled || isComposing(ev)) return\n\n const inputValue = cast<HTMLInputElement>(ev.target).value\n\n runKeyAction(\n ev,\n {\n Backspace: (ev) => {\n if (isArray(value)) {\n if (inputValue.length) return\n\n ev.preventDefault()\n\n setValue((prev) =>\n isArray(prev)\n ? (prev.slice(0, -1) as MaybeDateValue<Multiple, Range>)\n : prev,\n )\n } else if (isObject(value) && !isDate(value)) {\n if (inputValue.length) return\n if (!contains(endInputRef.current, ev.target)) return\n\n ev.preventDefault()\n\n setInputValue({ end: \"\", start: \"\" } as MaybeInputValue<Range>)\n setValue({ end: undefined, start: undefined } as MaybeDateValue<\n Multiple,\n Range\n >)\n\n startInputRef.current?.focus()\n }\n },\n Enter: (ev) => {\n if (!open || !inputValue.length) return\n\n if (isObject(value) && !isArray(value) && !isDate(value)) {\n const align = contains(endInputRef.current, ev.target)\n ? \"end\"\n : \"start\"\n const minDate =\n value.start && align === \"end\"\n ? dayjs(value.start).add(1, \"day\").toDate()\n : undefined\n const maxDate =\n value.end && align === \"start\"\n ? dayjs(value.end).subtract(1, \"day\").toDate()\n : undefined\n const date = stringToDate(inputValue, minDate, maxDate)\n\n if (!date) return\n\n ev.preventDefault()\n\n setInputValue((prev) =>\n isObject(prev)\n ? Object.assign({}, prev, { [align]: dateToString(date) })\n : prev,\n )\n setValue((prev) =>\n isObject(prev) && !isDate(prev)\n ? { ...prev, [align]: date }\n : prev,\n )\n\n if (align === \"start\") endInputRef.current?.focus()\n } else {\n const date = stringToDate(inputValue)\n\n if (!date) return\n\n ev.preventDefault()\n\n if (isArray(value)) {\n setInputValue(\"\" as MaybeInputValue<Range>)\n\n setValue((prev) =>\n isArray(prev) &&\n !isIncludeDates(date, prev) &&\n (!isNumber(max) || prev.length < max)\n ? ([...prev, date] as MaybeDateValue<Multiple, Range>)\n : prev,\n )\n } else {\n setInputValue(dateToString(date) as MaybeInputValue<Range>)\n setValue(date as MaybeDateValue<Multiple, Range>)\n }\n }\n },\n },\n { preventDefault: false },\n )\n },\n [\n dateToString,\n disabled,\n max,\n open,\n setInputValue,\n setValue,\n stringToDate,\n value,\n ],\n )\n\n const onClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n if (!interactive) return\n\n focusByClickRef.current = true\n\n if (allowInput)\n if (isObject(value) && !isArray(value) && !isDate(value))\n if (\n startInputRef.current &&\n contains(startInputRef.current, ev.target)\n ) {\n if (!isActiveElement(startInputRef.current, getDocument()!))\n ev.defaultPrevented = true\n\n startInputRef.current.focus()\n } else if (\n endInputRef.current &&\n contains(endInputRef.current, ev.target)\n ) {\n if (!isActiveElement(endInputRef.current, getDocument()!))\n ev.defaultPrevented = true\n\n endInputRef.current.focus()\n } else {\n startInputRef.current?.focus()\n }\n else startInputRef.current?.focus()\n\n if (openOnClick) onOpen()\n },\n [allowInput, interactive, onOpen, openOnClick, value, getDocument],\n )\n\n const onMouseDown = useCallback(\n (ev: MouseEvent<HTMLDivElement | HTMLInputElement>) => {\n if (!openOnFocus) return\n\n ev.preventDefault()\n ev.stopPropagation()\n },\n [openOnFocus],\n )\n\n const onFieldFocus = useCallback(() => {\n if (allowInput) return\n\n if (openOnFocus) onOpen()\n\n focusByClickRef.current = false\n }, [allowInput, onOpen, openOnFocus])\n\n const onInputFocus = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n ev.preventDefault()\n ev.stopPropagation()\n\n setFocused(true)\n\n if (openOnFocus && !focusByClickRef.current) onOpen()\n\n focusByClickRef.current = false\n },\n [onOpen, openOnFocus],\n )\n\n const onBlur = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n setFocused(false)\n\n if (\n contains(fieldRef.current, ev.relatedTarget) ||\n contains(contentRef.current, ev.relatedTarget)\n )\n ev.preventDefault()\n else if (isArray(value)) setInputValue(\"\" as MaybeInputValue<Range>)\n else if (isObject(value) && !isDate(value))\n setInputValue((prev) =>\n isObject(prev)\n ? ({\n end: dateToString(value.end),\n start: dateToString(value.start),\n } as MaybeInputValue<Range>)\n : prev,\n )\n else setInputValue(dateToString(value) as MaybeInputValue<Range>)\n },\n [dateToString, setInputValue, value],\n )\n\n const onClear = useCallback(() => {\n if (!interactive) return\n\n setValue((prev) => {\n if (isDate(prev)) return undefined as MaybeDateValue<Multiple, Range>\n else if (isArray(prev))\n return [] as unknown as MaybeDateValue<Multiple, Range>\n else if (isObject(prev))\n return { end: undefined, start: undefined } as MaybeDateValue<\n Multiple,\n Range\n >\n else return prev\n })\n\n setInputValue(\n (range ? { end: \"\", start: \"\" } : \"\") as MaybeInputValue<Range>,\n )\n\n if (focusOnClear)\n if (allowInput) startInputRef.current?.focus()\n else fieldRef.current?.focus()\n }, [allowInput, focusOnClear, interactive, range, setInputValue, setValue])\n\n useEffect(() => {\n if (!open) return\n\n return focusTransfer(\n contentRef.current,\n allowInput ? startInputRef.current : fieldRef.current,\n )\n }, [allowInput, open])\n\n useUpdateEffect(() => {\n setMonth((prev) => getAdjustedMonth(value, prev))\n }, [value, range])\n\n useUpdateEffect(() => {\n if (isArray(valueProp)) return\n\n if (isObject(valueProp) && !isDate(valueProp))\n setInputValue({\n end: dateToString(valueProp.end),\n start: dateToString(valueProp.start),\n } as MaybeInputValue<Range>)\n else setInputValue(dateToString(valueProp) as MaybeInputValue<Range>)\n }, [valueProp])\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({\n \"data-range\": dataAttr(range),\n ...dataProps,\n ...props,\n }),\n [dataProps, range],\n )\n\n const getFieldProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getTriggerProps({\n ref: mergeRefs(ref, fieldRef),\n \"aria-haspopup\": \"dialog\",\n tabIndex: !allowInput ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onClick),\n onFocus: handlerAll(props.onFocus, onFieldFocus),\n onMouseDown: handlerAll(props.onMouseDown, onMouseDown),\n }),\n\n [allowInput, getTriggerProps, onClick, onFieldFocus, onMouseDown],\n )\n\n const getInputProps: PropGetter<\"input\", { align?: InputAlign }> =\n useCallback(\n ({ align = \"start\", ...props } = {}) => {\n const inputProps: HTMLProps<\"input\"> = {\n style: {\n ...(!allowInput ? { pointerEvents: \"none\" } : {}),\n ...props.style,\n },\n autoComplete: \"off\",\n disabled,\n readOnly,\n required,\n tabIndex: allowInput ? 0 : -1,\n ...dataProps,\n ...props,\n onBlur: handlerAll(props.onBlur, onBlur),\n onChange: handlerAll(props.onChange, onInputChange),\n onFocus: handlerAll(props.onFocus, onInputFocus),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n onMouseDown: handlerAll(props.onMouseDown, onMouseDown),\n }\n\n if (isObject(inputValue)) {\n if (align === \"start\") {\n inputProps.ref = mergeRefs(props.ref, ref, startInputRef)\n inputProps.value = inputValue.start\n inputProps.placeholder = startPlaceholder\n } else {\n inputProps.ref = mergeRefs(props.ref, ref, endInputRef)\n inputProps.value = inputValue.end\n inputProps.placeholder = endPlaceholder\n }\n\n if (!inputValue.start && align === \"start\") {\n inputProps.id = id\n inputProps.name = name\n }\n\n if (!!inputValue.start && align === \"end\") {\n inputProps.id = id\n inputProps.name = name\n }\n } else {\n inputProps.ref = mergeRefs(props.ref, ref, startInputRef)\n inputProps.value = inputValue\n inputProps.id = id\n inputProps.name = name\n\n if (isArray(value)) {\n inputProps.style = {\n ...(!focused && !!value.length\n ? visuallyHiddenAttributes.style\n : {}),\n ...inputProps.style,\n }\n inputProps.placeholder = !value.length\n ? startPlaceholder\n : undefined\n inputProps[\"data-max\"] = dataAttr(\n isNumber(max) && value.length >= max,\n )\n } else {\n inputProps.placeholder = startPlaceholder\n }\n }\n\n return inputProps\n },\n [\n allowInput,\n dataProps,\n disabled,\n endPlaceholder,\n focused,\n id,\n inputValue,\n max,\n name,\n onBlur,\n onInputFocus,\n onInputChange,\n onKeyDown,\n onMouseDown,\n readOnly,\n ref,\n required,\n startPlaceholder,\n value,\n ],\n )\n\n const getContentProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getComboboxContentProps({\n ref: mergeRefs(ref, contentRef),\n role: \"dialog\",\n ...props,\n }),\n [getComboboxContentProps],\n )\n\n const getCalendarProps: PropGetter<UseCalendarProps<Multiple, Range>> =\n useCallback(\n (props) =>\n ({\n disabled: !interactive,\n format: calendarFormat,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n value,\n onChange,\n onChangeMonth: setMonth,\n ...calendarProps,\n ...props,\n }) as UseCalendarProps<Multiple, Range>,\n [\n interactive,\n calendarFormat,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n value,\n onChange,\n setMonth,\n calendarProps,\n ],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props) => ({ ...dataProps, ...props }),\n [dataProps],\n )\n\n const getClearIconProps: PropGetter = useCallback(\n (props = {}) =>\n getIconProps({\n \"aria-disabled\": ariaAttr(!interactive),\n \"aria-label\": t(\"Clear value\"),\n role: \"button\",\n tabIndex: interactive ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onClear),\n onKeyDown: handlerAll(props.onKeyDown, (ev) =>\n runKeyAction(ev, { Enter: onClear, Space: onClear }),\n ),\n }),\n [getIconProps, interactive, onClear, t],\n )\n\n return {\n children,\n dateToString,\n inputValue,\n interactive,\n month,\n open,\n range,\n separator,\n setInputValue,\n setMonth,\n setValue,\n stringToDate,\n value,\n getCalendarProps,\n getClearIconProps,\n getContentProps,\n getFieldProps,\n getIconProps,\n getInputProps,\n getRootProps,\n popoverProps,\n onChange,\n onClose,\n onInputChange,\n onOpen,\n }\n}\n\nexport type UseDatePickerReturn = ReturnType<typeof useDatePicker>\n"],"mappings":";;;;;;;;;;;;;;;;AAwFA,MAAM,iBAAmC,EACvC,OACA,SACA,OACA,KACA,WACA,YACI;CACJ,MAAM,OAAO,QAAQ,MAAM;CAE3B,OACE,qBAAC,QAAD;EAAM,OAAO,EAAE,iBAAiB,aAAa;YAA7C,CACG,QACE,EAAA,GAAA,cAAA,SAAA,CAAU,GAAG,KAAK,QAAQ,QAAQ,WAAY,CAAC,OAAO,YAAY,IACjE;;AAEV;AAqGA,MAAa,iBAGX,EACA,UAAU,kBACV,UAAU,kBACV,GAAG,UACoC,CAAC,MAAM;CAC9C,IAAI,MAAM,OAAO,CAAC,CAAC,QAAQ,MAAM,OAAO,CAAC,GAAG,UAAU;CAEtD,MAAM,EAAE,gBAAgB,eAAe;CACvC,MAAM,EAAE,QAAQ,eAAe,MAAM,QAAQ,YAAY;CACzD,MAAM,EACJ,OAAO,EACL,IACA,KACA,MACA,aAAa,MACb,mBAAmB,OACnB,gBAAgB,OAChB,WAAW,OACX,gBAAgB,CAAC,UACjB,mBACA,+BAAe,IAAI,KAAK,GACxB,QAAQ,OACR,eAAgB,QACZ;EAAE,KAAK,KAAA;EAAW,OAAO,KAAA;CAAU,IACnC,WACE,CAAC,IACD,KAAA,GACN,UACA,eAAe,MACf,QACA,YAAY,gBACZ,SAAS,eACT,KACA,OAAO,WACP,eAAe,MACf,cAAc,M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,CAAC,CACrD;EACF,CAAC,GACH;GAAC;GAAc;GAAa;GAAS;EAAC,CAkBtB;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"use-date-picker.js","names":[],"sources":["../../../../src/components/date-picker/use-date-picker.tsx"],"sourcesContent":["\"use client\"\n\nimport type {\n ChangeEvent,\n FocusEvent,\n KeyboardEvent,\n MouseEvent,\n ReactNode,\n} from \"react\"\nimport type { HTMLProps, HTMLRefAttributes, PropGetter } from \"../../core\"\nimport type { UseComboboxProps } from \"../../hooks/use-combobox\"\nimport type { Dict } from \"../../utils\"\nimport type {\n CalendarFormat,\n MaybeDateValue,\n UseCalendarProps,\n} from \"../calendar\"\nimport type { FieldProps } from \"../field\"\nimport dayjs from \"dayjs\"\nimport {\n cloneElement,\n isValidElement,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\"\nimport { useEnvironment } from \"../../core\"\nimport { useCombobox } from \"../../hooks/use-combobox\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n cast,\n contains,\n dataAttr,\n focusTransfer,\n handlerAll,\n isActiveElement,\n isArray,\n isComposing,\n isDate,\n isNumber,\n isObject,\n mergeRefs,\n runIfFn,\n runKeyAction,\n useUpdateEffect,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport {\n DEFAULT_MAX_DATE,\n DEFAULT_MIN_DATE,\n getAdjustedMonth,\n isAfterDate,\n isBeforeDate,\n isIncludeDates,\n updateMaybeDateValue,\n useCalendarProps,\n} from \"../calendar\"\nimport { useFieldProps } from \"../field\"\nimport { useDateTimeFormat } from \"../format\"\n\nexport interface DatePickerFormat extends CalendarFormat {\n input?: Intl.DateTimeFormatOptions | null\n}\n\ntype InputAlign = \"end\" | \"start\"\ntype MaybeInputValue<Range extends boolean = false> = Range extends true\n ? { end?: string; start?: string }\n : string | undefined\n\ninterface DatePickerRenderProps {\n count: number\n date: Date\n focused: boolean\n index: number\n separator: string\n value: string\n onClear: () => void\n max?: number\n}\n\nexport interface DatePickerRender {\n (props: DatePickerRenderProps): ReactNode\n}\n\nconst defaultRender: DatePickerRender = ({\n count,\n focused,\n index,\n max,\n separator,\n value,\n}) => {\n const last = count - 1 === index\n\n return (\n <span style={{ marginInlineEnd: \"var(--gap)\" }}>\n {value}\n {((!isNumber(max) || count < max) && focused) || !last ? separator : null}\n </span>\n )\n}\n\nexport interface UseDatePickerProps<\n Multiple extends boolean = false,\n Range extends boolean = false,\n>\n extends\n Omit<UseCalendarProps<Multiple, Range>, \"format\" | \"ref\">,\n Omit<\n UseComboboxProps,\n \"defaultValue\" | \"initialFocusValue\" | \"onChange\" | \"ref\" | \"value\"\n >,\n HTMLRefAttributes<\"input\">,\n FieldProps {\n /**\n * If `true`, allows input.\n *\n * @default true\n */\n allowInput?: boolean\n /**\n * If `true`, allows input of dates beyond the `minDate` and `maxDate` restrictions.\n *\n * @default true\n */\n allowInputBeyond?: boolean\n /**\n * If `true`, the date picker will be closed when the input value changes.\n *\n * @default false\n */\n closeOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * The initial value of the input.\n */\n defaultInputValue?: MaybeInputValue<Range>\n /**\n * If `true`, the input will be focused when the clear icon is clicked.\n *\n * @default true\n */\n focusOnClear?: boolean\n /**\n * The format used for conversion.\n * Check the docs to see the format of possible modifiers you can pass.\n *\n * @see https://day.js.org/docs/en/display/format#list-of-localized-formats\n */\n format?: DatePickerFormat\n /**\n * The `id` attribute of the input element.\n */\n id?: string\n /**\n * The value of the input.\n */\n inputValue?: MaybeInputValue<Range>\n /**\n * The `name` attribute of the input element.\n */\n name?: string\n /**\n * If `true`, the date picker will be opened when the input value changes.\n *\n * @default true\n */\n openOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * If `true`, the date picker will be opened when the input is focused.\n *\n * @default true\n */\n openOnFocus?: boolean\n /**\n * The pattern used to check the input element.\n */\n pattern?: RegExp\n /**\n * The placeholder for date picker.\n */\n placeholder?: string\n /**\n * The visual separator between each value.\n *\n * @default ','\n */\n separator?: string\n /**\n * The callback invoked when input value state changes.\n */\n onInputChange?: (value: MaybeInputValue<Range>) => void\n /**\n * Function that converts the input value to Date type.\n */\n parseDate?: (value: string) => Date | undefined\n /**\n * The function to render the selected date.\n */\n render?: (props: DatePickerRenderProps) => ReactNode\n}\n\nexport const useDatePicker = <\n Multiple extends boolean = false,\n Range extends boolean = false,\n>({\n maxDate = DEFAULT_MAX_DATE,\n minDate = DEFAULT_MIN_DATE,\n ...props\n}: UseDatePickerProps<Multiple, Range> = {}) => {\n if (dayjs(minDate).isAfter(dayjs(maxDate))) maxDate = minDate\n\n const { getDocument } = useEnvironment()\n const { locale: defaultLocale, t } = useI18n(\"datePicker\")\n const {\n props: {\n id,\n ref,\n name,\n allowInput = true,\n allowInputBeyond = false,\n closeOnChange = false,\n multiple = false,\n closeOnSelect = !multiple,\n defaultInputValue,\n defaultMonth = new Date(),\n range = false,\n defaultValue = (range\n ? { end: undefined, start: undefined }\n : multiple\n ? []\n : undefined) as MaybeDateValue<Multiple, Range>,\n disabled,\n focusOnClear = true,\n format,\n inputValue: inputValueProp,\n locale = defaultLocale,\n max,\n month: monthProp,\n openOnChange = true,\n openOnClick = true,\n openOnFocus = true,\n parseDate,\n pattern,\n placeholder: placeholderProp,\n placement = \"end-start\",\n readOnly,\n render = defaultRender,\n required,\n separator = range ? \"-\" : \",\",\n value: valueProp,\n onChange: onChangeProp,\n onChangeMonth: onChangeMonthProp,\n onInputChange: onInputChangeProp,\n ...computedProps\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const dateTimeFormat = useDateTimeFormat({ locale })\n const { calendarFormat, inputFormat } = useMemo(() => {\n const { input: inputFormat, ...calendarFormat } = format ?? {}\n const defaultInputFormat: Intl.DateTimeFormatOptions = {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n }\n\n return {\n calendarFormat,\n inputFormat:\n inputFormat !== null ? (inputFormat ?? defaultInputFormat) : undefined,\n }\n }, [format])\n const [calendarProps, rest] = useCalendarProps<Multiple, Range>(computedProps)\n const { excludeDate } = calendarProps\n const fieldRef = useRef<HTMLDivElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const startInputRef = useRef<HTMLInputElement>(null)\n const endInputRef = useRef<HTMLInputElement>(null)\n const focusByClickRef = useRef<boolean>(false)\n const [focused, setFocused] = useState(false)\n const [value, setValue] = useControllableState({\n defaultValue: defaultValue as MaybeDateValue<Multiple, Range>,\n value: valueProp,\n onChange: onChangeProp,\n })\n const [month, setMonth] = useControllableState({\n defaultValue: () => {\n let value = defaultMonth\n\n if (dayjs(minDate).isAfter(dayjs(defaultMonth)))\n value = dayjs(minDate).set(\"date\", 1).toDate()\n\n if (valueProp) value = getAdjustedMonth(valueProp, value)\n else if (defaultValue) value = getAdjustedMonth(defaultValue, value)\n\n return value\n },\n value: monthProp,\n onChange: onChangeMonthProp,\n })\n const stringToDate = useCallback(\n (value: string, start: Date = minDate, end: Date = maxDate) => {\n let date = parseDate?.(value)\n\n if (!date && dayjs(value).isValid())\n date = dayjs(value).locale(locale).toDate()\n\n if (date == null) return undefined\n if (excludeDate?.(date)) return undefined\n\n if (!allowInputBeyond) {\n if (isBeforeDate(date, start)) date = start\n if (isAfterDate(date, end)) date = end\n }\n\n return date\n },\n [allowInputBeyond, excludeDate, locale, maxDate, minDate, parseDate],\n )\n const dateToString = useCallback(\n (date?: Date) => {\n if (date == null) return \"\"\n\n return dateTimeFormat(date, inputFormat)\n },\n [dateTimeFormat, inputFormat],\n )\n const [inputValue, setInputValue] = useControllableState({\n defaultValue: () => {\n if (defaultInputValue)\n if (isObject(defaultInputValue)) {\n if (dayjs(defaultInputValue.start).isValid())\n defaultInputValue.start = dateTimeFormat(\n dayjs(defaultInputValue.start).toDate(),\n inputFormat,\n )\n\n if (dayjs(defaultInputValue.end).isValid())\n defaultInputValue.end = dateTimeFormat(\n dayjs(defaultInputValue.end).toDate(),\n inputFormat,\n )\n\n return defaultInputValue\n } else {\n if (dayjs(defaultInputValue).isValid())\n return dateTimeFormat(\n dayjs(defaultInputValue).toDate(),\n inputFormat,\n ) as MaybeInputValue<Range>\n else return defaultInputValue\n }\n else if (isDate(value))\n return dateToString(value) as MaybeInputValue<Range>\n else if (isObject(value) && !isArray(value))\n return {\n end: dateToString(value.end),\n start: dateToString(value.start),\n } as MaybeInputValue<Range>\n else return \"\" as MaybeInputValue<Range>\n },\n value: inputValueProp,\n onChange: onInputChangeProp,\n })\n const {\n interactive,\n open,\n getContentProps: getComboboxContentProps,\n getTriggerProps,\n popoverProps,\n onClose,\n onOpen,\n } = useCombobox({\n disabled,\n matchWidth: false,\n openOnClick: false,\n openOnEnter: !allowInput,\n openOnSpace: !allowInput,\n placement,\n readOnly,\n transferFocus: false,\n ...ariaProps,\n ...dataProps,\n ...eventProps,\n ...rest,\n })\n const children = useMemo<ReactNode>(() => {\n if (!isArray(value)) return null\n\n const count = value.length\n\n return value.map((date, index) => {\n const value = dateToString(date)\n\n const onClear = (ev?: MouseEvent<HTMLElement>) => {\n ev?.preventDefault()\n ev?.stopPropagation()\n\n setValue(\n (prev) =>\n updateMaybeDateValue(date, max)(prev) as MaybeDateValue<\n Multiple,\n Range\n >,\n )\n }\n\n const component = render({\n count,\n date,\n focused,\n index,\n max,\n separator,\n value,\n onClear,\n })\n\n if (isValidElement<Dict>(component))\n return cloneElement(component, { ...component.props, key: index })\n else return component\n })\n }, [dateToString, focused, max, render, separator, setValue, value])\n const { endPlaceholder, startPlaceholder } = useMemo(() => {\n if (range) {\n const startPlaceholder =\n placeholderProp ?? dateTimeFormat(new Date(), inputFormat)\n const endPlaceholder =\n placeholderProp ??\n dateTimeFormat(dayjs().add(1, \"day\").toDate(), inputFormat)\n\n return { endPlaceholder, startPlaceholder }\n } else {\n const placeholder =\n placeholderProp ?? dateTimeFormat(new Date(), inputFormat)\n\n return { endPlaceholder: placeholder, startPlaceholder: placeholder }\n }\n }, [dateTimeFormat, inputFormat, placeholderProp, range])\n\n const onChange = useCallback(\n (value: MaybeDateValue<Multiple, Range>) => {\n setValue(value)\n\n if (isArray(value)) setInputValue(\"\" as MaybeInputValue<Range>)\n else if (isObject(value) && !isDate(value))\n setInputValue({\n end: dateToString(value.end),\n start: dateToString(value.start),\n } as MaybeInputValue<Range>)\n else setInputValue(dateToString(value) as MaybeInputValue<Range>)\n\n if (!closeOnSelect) return\n\n if (isObject(value) && !isArray(value) && !isDate(value)) {\n if (value.end && value.start) onClose()\n } else {\n onClose()\n }\n },\n [setValue, closeOnSelect, setInputValue, dateToString, onClose],\n )\n\n const onInputChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n if (!allowInput) return\n if (isArray(value) && value.length === max) return\n\n if (runIfFn(closeOnChange, ev)) onClose()\n else if (runIfFn(openOnChange, ev)) onOpen()\n\n let inputValue = ev.target.value\n\n if (pattern) inputValue = inputValue.replace(pattern, \"\")\n\n if (isArray(value)) {\n const date = stringToDate(inputValue)\n\n setInputValue(inputValue as MaybeInputValue<Range>)\n\n if (date) setMonth(dayjs(date).set(\"date\", 1).toDate())\n } else if (isObject(value) && !isDate(value)) {\n const align = contains(endInputRef.current, ev.target) ? \"end\" : \"start\"\n const minDate =\n value.start && align === \"end\"\n ? dayjs(value.start).add(1, \"day\").toDate()\n : undefined\n const maxDate =\n value.end && align === \"start\"\n ? dayjs(value.end).subtract(1, \"day\").toDate()\n : undefined\n const date = stringToDate(inputValue, minDate, maxDate)\n\n setInputValue((prev) =>\n isObject(prev)\n ? Object.assign({}, prev, { [align]: inputValue })\n : prev,\n )\n setValue((prev) =>\n isObject(prev) && !isDate(prev) ? { ...prev, [align]: date } : prev,\n )\n } else {\n const date = stringToDate(inputValue)\n\n setInputValue(inputValue as MaybeInputValue<Range>)\n setValue(date as MaybeDateValue<Multiple, Range>)\n }\n },\n [\n allowInput,\n closeOnChange,\n max,\n onClose,\n onOpen,\n openOnChange,\n pattern,\n setInputValue,\n setMonth,\n setValue,\n stringToDate,\n value,\n ],\n )\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLInputElement>) => {\n if (disabled || isComposing(ev)) return\n\n const inputValue = cast<HTMLInputElement>(ev.target).value\n\n runKeyAction(\n ev,\n {\n Backspace: (ev) => {\n if (isArray(value)) {\n if (inputValue.length) return\n\n ev.preventDefault()\n\n setValue((prev) =>\n isArray(prev)\n ? (prev.slice(0, -1) as MaybeDateValue<Multiple, Range>)\n : prev,\n )\n } else if (isObject(value) && !isDate(value)) {\n if (inputValue.length) return\n if (!contains(endInputRef.current, ev.target)) return\n\n ev.preventDefault()\n\n setInputValue({ end: \"\", start: \"\" } as MaybeInputValue<Range>)\n setValue({ end: undefined, start: undefined } as MaybeDateValue<\n Multiple,\n Range\n >)\n\n startInputRef.current?.focus()\n }\n },\n Enter: (ev) => {\n if (!open || !inputValue.length) return\n\n if (isObject(value) && !isArray(value) && !isDate(value)) {\n const align = contains(endInputRef.current, ev.target)\n ? \"end\"\n : \"start\"\n const minDate =\n value.start && align === \"end\"\n ? dayjs(value.start).add(1, \"day\").toDate()\n : undefined\n const maxDate =\n value.end && align === \"start\"\n ? dayjs(value.end).subtract(1, \"day\").toDate()\n : undefined\n const date = stringToDate(inputValue, minDate, maxDate)\n\n if (!date) return\n\n ev.preventDefault()\n\n setInputValue((prev) =>\n isObject(prev)\n ? Object.assign({}, prev, { [align]: dateToString(date) })\n : prev,\n )\n setValue((prev) =>\n isObject(prev) && !isDate(prev)\n ? { ...prev, [align]: date }\n : prev,\n )\n\n if (align === \"start\") endInputRef.current?.focus()\n } else {\n const date = stringToDate(inputValue)\n\n if (!date) return\n\n ev.preventDefault()\n\n if (isArray(value)) {\n setInputValue(\"\" as MaybeInputValue<Range>)\n\n setValue((prev) =>\n isArray(prev) &&\n !isIncludeDates(date, prev) &&\n (!isNumber(max) || prev.length < max)\n ? ([...prev, date] as MaybeDateValue<Multiple, Range>)\n : prev,\n )\n } else {\n setInputValue(dateToString(date) as MaybeInputValue<Range>)\n setValue(date as MaybeDateValue<Multiple, Range>)\n }\n }\n },\n },\n { preventDefault: false },\n )\n },\n [\n dateToString,\n disabled,\n max,\n open,\n setInputValue,\n setValue,\n stringToDate,\n value,\n ],\n )\n\n const onClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n if (!interactive) return\n\n focusByClickRef.current = true\n\n if (allowInput)\n if (isObject(value) && !isArray(value) && !isDate(value))\n if (\n startInputRef.current &&\n contains(startInputRef.current, ev.target)\n ) {\n if (!isActiveElement(startInputRef.current, getDocument()!))\n ev.defaultPrevented = true\n\n startInputRef.current.focus()\n } else if (\n endInputRef.current &&\n contains(endInputRef.current, ev.target)\n ) {\n if (!isActiveElement(endInputRef.current, getDocument()!))\n ev.defaultPrevented = true\n\n endInputRef.current.focus()\n } else {\n startInputRef.current?.focus()\n }\n else startInputRef.current?.focus()\n\n if (openOnClick) onOpen()\n },\n [allowInput, interactive, onOpen, openOnClick, value, getDocument],\n )\n\n const onMouseDown = useCallback(\n (ev: MouseEvent<HTMLDivElement | HTMLInputElement>) => {\n if (!openOnFocus) return\n\n ev.preventDefault()\n ev.stopPropagation()\n },\n [openOnFocus],\n )\n\n const onFieldFocus = useCallback(() => {\n if (allowInput) return\n\n if (openOnFocus) onOpen()\n\n focusByClickRef.current = false\n }, [allowInput, onOpen, openOnFocus])\n\n const onInputFocus = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n ev.preventDefault()\n ev.stopPropagation()\n\n setFocused(true)\n\n if (openOnFocus && !focusByClickRef.current) onOpen()\n\n focusByClickRef.current = false\n },\n [onOpen, openOnFocus],\n )\n\n const onBlur = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n setFocused(false)\n\n if (\n contains(fieldRef.current, ev.relatedTarget) ||\n contains(contentRef.current, ev.relatedTarget)\n )\n ev.preventDefault()\n else if (isArray(value)) setInputValue(\"\" as MaybeInputValue<Range>)\n else if (isObject(value) && !isDate(value))\n setInputValue((prev) =>\n isObject(prev)\n ? ({\n end: dateToString(value.end),\n start: dateToString(value.start),\n } as MaybeInputValue<Range>)\n : prev,\n )\n else setInputValue(dateToString(value) as MaybeInputValue<Range>)\n },\n [dateToString, setInputValue, value],\n )\n\n const onClear = useCallback(() => {\n if (!interactive) return\n\n setValue((prev) => {\n if (isDate(prev)) return undefined as MaybeDateValue<Multiple, Range>\n else if (isArray(prev))\n return [] as unknown as MaybeDateValue<Multiple, Range>\n else if (isObject(prev))\n return { end: undefined, start: undefined } as MaybeDateValue<\n Multiple,\n Range\n >\n else return prev\n })\n\n setInputValue(\n (range ? { end: \"\", start: \"\" } : \"\") as MaybeInputValue<Range>,\n )\n\n if (focusOnClear)\n if (allowInput) startInputRef.current?.focus()\n else fieldRef.current?.focus()\n }, [allowInput, focusOnClear, interactive, range, setInputValue, setValue])\n\n useEffect(() => {\n if (!open) return\n\n return focusTransfer(\n contentRef.current,\n allowInput ? startInputRef.current : fieldRef.current,\n )\n }, [allowInput, open])\n\n useUpdateEffect(() => {\n setMonth((prev) => getAdjustedMonth(value, prev))\n }, [value, range])\n\n useUpdateEffect(() => {\n if (isArray(valueProp)) return\n\n if (isObject(valueProp) && !isDate(valueProp))\n setInputValue({\n end: dateToString(valueProp.end),\n start: dateToString(valueProp.start),\n } as MaybeInputValue<Range>)\n else setInputValue(dateToString(valueProp) as MaybeInputValue<Range>)\n }, [valueProp])\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({\n \"data-range\": dataAttr(range),\n ...dataProps,\n ...props,\n }),\n [dataProps, range],\n )\n\n const getFieldProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getTriggerProps({\n ref: mergeRefs(ref, fieldRef),\n \"aria-haspopup\": \"dialog\",\n tabIndex: !allowInput ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onClick),\n onFocus: handlerAll(props.onFocus, onFieldFocus),\n onMouseDown: handlerAll(props.onMouseDown, onMouseDown),\n }),\n\n [allowInput, getTriggerProps, onClick, onFieldFocus, onMouseDown],\n )\n\n const getInputProps: PropGetter<\"input\", { align?: InputAlign }> =\n useCallback(\n ({ align = \"start\", ...props } = {}) => {\n const inputProps: HTMLProps<\"input\"> = {\n style: {\n ...(!allowInput ? { pointerEvents: \"none\" } : {}),\n ...props.style,\n },\n autoComplete: \"off\",\n disabled,\n readOnly,\n required,\n tabIndex: allowInput ? 0 : -1,\n ...dataProps,\n ...props,\n onBlur: handlerAll(props.onBlur, onBlur),\n onChange: handlerAll(props.onChange, onInputChange),\n onFocus: handlerAll(props.onFocus, onInputFocus),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n onMouseDown: handlerAll(props.onMouseDown, onMouseDown),\n }\n\n if (isObject(inputValue)) {\n if (align === \"start\") {\n inputProps.ref = mergeRefs(props.ref, ref, startInputRef)\n inputProps.value = inputValue.start\n inputProps.placeholder = startPlaceholder\n } else {\n inputProps.ref = mergeRefs(props.ref, ref, endInputRef)\n inputProps.value = inputValue.end\n inputProps.placeholder = endPlaceholder\n }\n\n if (!inputValue.start && align === \"start\") {\n inputProps.id = id\n inputProps.name = name\n }\n\n if (!!inputValue.start && align === \"end\") {\n inputProps.id = id\n inputProps.name = name\n }\n } else {\n inputProps.ref = mergeRefs(props.ref, ref, startInputRef)\n inputProps.value = inputValue\n inputProps.id = id\n inputProps.name = name\n\n if (isArray(value)) {\n inputProps.style = {\n ...(!focused && !!value.length\n ? visuallyHiddenAttributes.style\n : {}),\n ...inputProps.style,\n }\n inputProps.placeholder = !value.length\n ? startPlaceholder\n : undefined\n inputProps[\"data-max\"] = dataAttr(\n isNumber(max) && value.length >= max,\n )\n } else {\n inputProps.placeholder = startPlaceholder\n }\n }\n\n return inputProps\n },\n [\n allowInput,\n dataProps,\n disabled,\n endPlaceholder,\n focused,\n id,\n inputValue,\n max,\n name,\n onBlur,\n onInputFocus,\n onInputChange,\n onKeyDown,\n onMouseDown,\n readOnly,\n ref,\n required,\n startPlaceholder,\n value,\n ],\n )\n\n const getContentProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getComboboxContentProps({\n ref: mergeRefs(ref, contentRef),\n role: \"dialog\",\n ...props,\n }),\n [getComboboxContentProps],\n )\n\n const getCalendarProps: PropGetter<UseCalendarProps<Multiple, Range>> =\n useCallback(\n (props) =>\n ({\n disabled: !interactive,\n format: calendarFormat,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n value,\n onChange,\n onChangeMonth: setMonth,\n ...calendarProps,\n ...props,\n }) as UseCalendarProps<Multiple, Range>,\n [\n interactive,\n calendarFormat,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n value,\n onChange,\n setMonth,\n calendarProps,\n ],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props) => ({ ...dataProps, ...props }),\n [dataProps],\n )\n\n const getClearIconProps: PropGetter = useCallback(\n (props = {}) =>\n getIconProps({\n \"aria-disabled\": ariaAttr(!interactive),\n \"aria-label\": t(\"Clear value\"),\n role: \"button\",\n tabIndex: interactive ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onClear),\n onKeyDown: handlerAll(props.onKeyDown, (ev) =>\n runKeyAction(ev, { Enter: onClear, Space: onClear }),\n ),\n }),\n [getIconProps, interactive, onClear, t],\n )\n\n return {\n children,\n dateToString,\n inputValue,\n interactive,\n month,\n open,\n range,\n separator,\n setInputValue,\n setMonth,\n setValue,\n stringToDate,\n value,\n getCalendarProps,\n getClearIconProps,\n getContentProps,\n getFieldProps,\n getIconProps,\n getInputProps,\n getRootProps,\n popoverProps,\n onChange,\n onClose,\n onInputChange,\n onOpen,\n }\n}\n\nexport type UseDatePickerReturn = ReturnType<typeof useDatePicker>\n"],"mappings":";;;;;;;;;;;;;;;;AAwFA,MAAM,iBAAmC,EACvC,OACA,SACA,OACA,KACA,WACA,YACI;CACJ,MAAM,OAAO,QAAQ,MAAM;CAE3B,OACE,qBAAC,QAAD;EAA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AC1B;CAEA,MAAM,mBACJ,aACG,WACE;EACC,UAAU,CAAC;EACX,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf,GAAG;EACH,GAAG;CACL,IACF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAEF,MAAM,eAA2B,aAC9B,WAAW;EAAE,GAAG;EAAW,GAAG;CAAM,IACrC,CAAC,SAAS,CACZ;CAkBA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,mBA/BoC,aACnC,QAAQ,CAAC,MACR,aAAa;GACX,kBAAA,GAAA,cAAA,SAAA,CAA0B,CAAC,WAAW;GACtC,cAAc,EAAE,aAAa;GAC7B,MAAM;GACN,UAAU,cAAc,IAAI;GAC5B,GAAG;GACH,UAAA,GAAA,cAAA,WAAA,CAAoB,MAAM,SAAS,OAAO;GAC1C,YAAA,GAAA,cAAA,WAAA,CAAsB,MAAM,YAAY,OACtC,aAAa,IAAI;IAAE,OAAO;IAAS,OAAO;GAAQ,CAAC,CACrD;EACF,CAAC,GACH;GAAC;GAAc;GAAa;GAAS;EAAC,CAkBtB;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
@@ -5,11 +5,11 @@ import { styled } from "../../core/system/factory.js";
5
5
  import { createSlotComponent } from "../../core/components/create-component.js";
6
6
  import { motion as motion$1 } from "../motion/factory.js";
7
7
  import { useValue } from "../../hooks/use-value/index.js";
8
+ import { FocusLock } from "../focus-lock/focus-lock.js";
8
9
  import { Portal } from "../portal/portal.js";
9
10
  import { Button } from "../button/button.js";
10
11
  import { CloseButton } from "../close-button/close-button.js";
11
12
  import { fadeVariants } from "../fade/fade.js";
12
- import { FocusLock } from "../focus-lock/focus-lock.js";
13
13
  import { drawerStyle } from "./drawer.style.js";
14
14
  import { Slide } from "../slide/slide.js";
15
15
  import { useDrawer } from "./use-drawer.js";
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.js","names":["motion"],"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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B;CAE7C,OAAO,EAAE,GAAG,aAAa,KAAK,EAAE;AAClC,CACF;AAIA,MAAa,eAAe,YAC1B,UACA,QACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,mBAAmB,oBAAoB;CAE/C,OAAO,EAAE,GAAG,eAAe,KAAK,EAAE;AACpC,CAAC"}
1
+ {"version":3,"file":"drawer.js","names":["motion"],"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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AC,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 +1 @@
1
- {"version":3,"file":"dropzone.js","names":[],"sources":["../../../../src/components/dropzone/dropzone.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { Merge } from \"../../utils\"\nimport type { FadeProps } from \"../fade\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { Loading } from \"../loading\"\nimport type { DropzoneStyle } from \"./dropzone.style\"\nimport type { UseDropzoneProps, UseDropzoneReturn } from \"./use-dropzone\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { Fade } from \"../fade\"\nimport { useInputBorder } from \"../input\"\nimport { useLoadingComponent } from \"../loading\"\nimport { Portal } from \"../portal\"\nimport { dropzoneStyle } from \"./dropzone.style\"\nimport { useDropzone } from \"./use-dropzone\"\n\ninterface ComponentContext extends Pick<\n UseDropzoneReturn,\n \"dragAccept\" | \"dragIdle\" | \"dragReject\" | \"loading\"\n> {}\n\nexport interface DropzoneRootProps\n extends\n Merge<HTMLStyledProps, UseDropzoneProps>,\n UseInputBorderProps,\n ThemeProps<DropzoneStyle>,\n Pick<DropzoneLoadingProps, \"loadingScheme\"> {\n /**\n * Props for dropzone input element.\n */\n inputProps?: HTMLStyledProps<\"input\">\n /**\n * Props for dropzone loading icon element.\n */\n loadingProps?: DropzoneLoadingProps\n /**\n * Props for dropzone overlay element.\n */\n overlayProps?: DropzoneOverlayProps\n}\n\nconst {\n ComponentContext,\n PropsContext: DropzonePropsContext,\n useComponentContext,\n usePropsContext: useDropzonePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<DropzoneRootProps, DropzoneStyle>(\n \"dropzone\",\n dropzoneStyle,\n)\n\nexport { DropzonePropsContext, useDropzonePropsContext }\n\n/**\n * `Dropzone` is a component used for uploading files via drag and drop.\n *\n * @see https://yamada-ui.com/docs/components/dropzone\n */\nexport const DropzoneRoot = withProvider(\n ({\n children,\n errorBorderColor,\n focusBorderColor,\n loadingScheme,\n inputProps,\n loadingProps,\n overlayProps,\n ...rest\n }) => {\n const varProps = useInputBorder({ errorBorderColor, focusBorderColor })\n const {\n dragAccept,\n dragIdle,\n dragReject,\n loading,\n getInputProps,\n getRootProps,\n } = useDropzone(rest)\n const context = useMemo(\n () => ({\n dragAccept,\n dragIdle,\n dragReject,\n loading,\n }),\n [dragAccept, dragIdle, dragReject, loading],\n )\n\n return (\n <ComponentContext value={context}>\n <Portal>\n <styled.input {...getInputProps(inputProps)} />\n </Portal>\n\n <styled.div data-group {...varProps} {...getRootProps()}>\n <DropzoneOverlay {...overlayProps}>\n <DropzoneLoading loadingScheme={loadingScheme} {...loadingProps} />\n </DropzoneOverlay>\n\n {children}\n </styled.div>\n </ComponentContext>\n )\n },\n \"root\",\n)()\n\nexport interface DropzoneIconProps extends HTMLStyledProps<\"svg\"> {}\n\nexport const DropzoneIcon = withContext<\"svg\", DropzoneIconProps>(\n \"svg\",\n \"icon\",\n)()\n\nexport interface DropzoneTitleProps extends HTMLStyledProps<\"p\"> {}\n\nexport const DropzoneTitle = withContext<\"p\", DropzoneTitleProps>(\n \"p\",\n \"title\",\n)()\n\nexport interface DropzoneDescriptionProps extends HTMLStyledProps<\"p\"> {}\n\nexport const DropzoneDescription = withContext<\"p\", DropzoneDescriptionProps>(\n \"p\",\n \"description\",\n)()\n\ninterface DropzoneOverlayProps extends FadeProps {\n loadingProps?: DropzoneLoadingProps\n}\n\nconst DropzoneOverlay = withContext<\"div\", DropzoneOverlayProps>(\n Fade,\n \"overlay\",\n)(undefined, (props) => {\n const { loading } = useComponentContext()\n\n return { open: loading, unmountOnExit: true, ...props }\n})\n\ninterface DropzoneLoadingProps extends Loading.Props {\n /**\n * The loading scheme.\n *\n * @default 'oval'\n */\n loadingScheme?: Loading.Scheme\n}\n\nconst DropzoneLoading = withContext<\"svg\", DropzoneLoadingProps>(\n ({ loadingScheme = \"oval\", ...rest }) => {\n const Component = useLoadingComponent(loadingScheme)\n\n return <Component {...rest} />\n },\n \"loading\",\n)()\n\nexport interface DropzoneAcceptProps extends PropsWithChildren {}\n\nexport const DropzoneAccept: FC<DropzoneAcceptProps> = ({ children }) => {\n const { dragAccept } = useComponentContext()\n\n return dragAccept ? children : null\n}\n\nexport interface DropzoneRejectProps extends PropsWithChildren {}\n\nexport const DropzoneReject: FC<DropzoneRejectProps> = ({ children }) => {\n const { dragReject } = useComponentContext()\n\n return dragReject ? children : null\n}\n\nexport interface DropzoneIdleProps extends PropsWithChildren {}\n\nexport const DropzoneIdle: FC<DropzoneIdleProps> = ({ children }) => {\n const { dragIdle } = useComponentContext()\n\n return dragIdle ? children : null\n}\n"],"mappings":";;;;;;;;;;;;AA4CA,MAAM,EACJ,kBACA,cAAc,sBACd,qBACA,iBAAiB,yBACjB,aACA,iBACE,oBACF,YACA,aACF;;;;;;AASA,MAAa,eAAe,cACzB,EACC,UACA,kBACA,kBACA,eACA,YACA,cACA,cACA,GAAG,WACC;CACJ,MAAM,WAAW,eAAe;EAAE;EAAkB;CAAiB,CAAC;CACtE,MAAM,EACJ,YACA,UACA,YACA,SACA,eACA,iBACE,YAAY,IAAI;CACpB,MAAM,UAAU,eACP;EACL;EACA;EACA;EACA;CACF,IACA;EAAC;EAAY;EAAU;EAAY;CAAO,CAC5C;CAEA,OACE,qBAAC,kBAAD;EAAkB,OAAO;YAAzB,CACE,oBAAC,QAAD,EAAA,UACE,oBAAC,OAAO,OAAR,EAAc,GAAI,cAAc,UAAU,EAAI,CAAA,EACxC,CAAA,GAER,qBAAC,OAAO,KAAR;GAAY,cAAA;GAAW,GAAI;GAAU,GAAI,aAAa;aAAtD,CACE,oBAAC,iBAAD;IAAiB,GAAI;cACnB,oBAAC,iBAAD;KAAgC;KAAe,GAAI;IAAe,CAAA;GACnD,CAAA,GAEhB,QACS;IACI;;AAEtB,GACA,MACF,CAAC,CAAC;AAIF,MAAa,eAAe,YAC1B,OACA,MACF,CAAC,CAAC;AAIF,MAAa,gBAAgB,YAC3B,KACA,OACF,CAAC,CAAC;AAIF,MAAa,sBAAsB,YACjC,KACA,aACF,CAAC,CAAC;AAMF,MAAM,kBAAkB,YACtB,MACA,SACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,YAAY,oBAAoB;CAExC,OAAO;EAAE,MAAM;EAAS,eAAe;EAAM,GAAG;CAAM;AACxD,CAAC;AAWD,MAAM,kBAAkB,aACrB,EAAE,gBAAgB,QAAQ,GAAG,WAAW;CAGvC,OAAO,oBAFW,oBAAoB,aAEtB,GAAT,EAAW,GAAI,KAAO,CAAA;AAC/B,GACA,SACF,CAAC,CAAC;AAIF,MAAa,kBAA2C,EAAE,eAAe;CACvE,MAAM,EAAE,eAAe,oBAAoB;CAE3C,OAAO,aAAa,WAAW;AACjC;AAIA,MAAa,kBAA2C,EAAE,eAAe;CACvE,MAAM,EAAE,eAAe,oBAAoB;CAE3C,OAAO,aAAa,WAAW;AACjC;AAIA,MAAa,gBAAuC,EAAE,eAAe;CACnE,MAAM,EAAE,aAAa,oBAAoB;CAEzC,OAAO,WAAW,WAAW;AAC/B"}
1
+ {"version":3,"file":"dropzone.js","names":[],"sources":["../../../../src/components/dropzone/dropzone.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { Merge } from \"../../utils\"\nimport type { FadeProps } from \"../fade\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { Loading } from \"../loading\"\nimport type { DropzoneStyle } from \"./dropzone.style\"\nimport type { UseDropzoneProps, UseDropzoneReturn } from \"./use-dropzone\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { Fade } from \"../fade\"\nimport { useInputBorder } from \"../input\"\nimport { useLoadingComponent } from \"../loading\"\nimport { Portal } from \"../portal\"\nimport { dropzoneStyle } from \"./dropzone.style\"\nimport { useDropzone } from \"./use-dropzone\"\n\ninterface ComponentContext extends Pick<\n UseDropzoneReturn,\n \"dragAccept\" | \"dragIdle\" | \"dragReject\" | \"loading\"\n> {}\n\nexport interface DropzoneRootProps\n extends\n Merge<HTMLStyledProps, UseDropzoneProps>,\n UseInputBorderProps,\n ThemeProps<DropzoneStyle>,\n Pick<DropzoneLoadingProps, \"loadingScheme\"> {\n /**\n * Props for dropzone input element.\n */\n inputProps?: HTMLStyledProps<\"input\">\n /**\n * Props for dropzone loading icon element.\n */\n loadingProps?: DropzoneLoadingProps\n /**\n * Props for dropzone overlay element.\n */\n overlayProps?: DropzoneOverlayProps\n}\n\nconst {\n ComponentContext,\n PropsContext: DropzonePropsContext,\n useComponentContext,\n usePropsContext: useDropzonePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<DropzoneRootProps, DropzoneStyle>(\n \"dropzone\",\n dropzoneStyle,\n)\n\nexport { DropzonePropsContext, useDropzonePropsContext }\n\n/**\n * `Dropzone` is a component used for uploading files via drag and drop.\n *\n * @see https://yamada-ui.com/docs/components/dropzone\n */\nexport const DropzoneRoot = withProvider(\n ({\n children,\n errorBorderColor,\n focusBorderColor,\n loadingScheme,\n inputProps,\n loadingProps,\n overlayProps,\n ...rest\n }) => {\n const varProps = useInputBorder({ errorBorderColor, focusBorderColor })\n const {\n dragAccept,\n dragIdle,\n dragReject,\n loading,\n getInputProps,\n getRootProps,\n } = useDropzone(rest)\n const context = useMemo(\n () => ({\n dragAccept,\n dragIdle,\n dragReject,\n loading,\n }),\n [dragAccept, dragIdle, dragReject, loading],\n )\n\n return (\n <ComponentContext value={context}>\n <Portal>\n <styled.input {...getInputProps(inputProps)} />\n </Portal>\n\n <styled.div data-group {...varProps} {...getRootProps()}>\n <DropzoneOverlay {...overlayProps}>\n <DropzoneLoading loadingScheme={loadingScheme} {...loadingProps} />\n </DropzoneOverlay>\n\n {children}\n </styled.div>\n </ComponentContext>\n )\n },\n \"root\",\n)()\n\nexport interface DropzoneIconProps extends HTMLStyledProps<\"svg\"> {}\n\nexport const DropzoneIcon = withContext<\"svg\", DropzoneIconProps>(\n \"svg\",\n \"icon\",\n)()\n\nexport interface DropzoneTitleProps extends HTMLStyledProps<\"p\"> {}\n\nexport const DropzoneTitle = withContext<\"p\", DropzoneTitleProps>(\n \"p\",\n \"title\",\n)()\n\nexport interface DropzoneDescriptionProps extends HTMLStyledProps<\"p\"> {}\n\nexport const DropzoneDescription = withContext<\"p\", DropzoneDescriptionProps>(\n \"p\",\n \"description\",\n)()\n\ninterface DropzoneOverlayProps extends FadeProps {\n loadingProps?: DropzoneLoadingProps\n}\n\nconst DropzoneOverlay = withContext<\"div\", DropzoneOverlayProps>(\n Fade,\n \"overlay\",\n)(undefined, (props) => {\n const { loading } = useComponentContext()\n\n return { open: loading, unmountOnExit: true, ...props }\n})\n\ninterface DropzoneLoadingProps extends Loading.Props {\n /**\n * The loading scheme.\n *\n * @default 'oval'\n */\n loadingScheme?: Loading.Scheme\n}\n\nconst DropzoneLoading = withContext<\"svg\", DropzoneLoadingProps>(\n ({ loadingScheme = \"oval\", ...rest }) => {\n const Component = useLoadingComponent(loadingScheme)\n\n return <Component {...rest} />\n },\n \"loading\",\n)()\n\nexport interface DropzoneAcceptProps extends PropsWithChildren {}\n\nexport const DropzoneAccept: FC<DropzoneAcceptProps> = ({ children }) => {\n const { dragAccept } = useComponentContext()\n\n return dragAccept ? children : null\n}\n\nexport interface DropzoneRejectProps extends PropsWithChildren {}\n\nexport const DropzoneReject: FC<DropzoneRejectProps> = ({ children }) => {\n const { dragReject } = useComponentContext()\n\n return dragReject ? children : null\n}\n\nexport interface DropzoneIdleProps extends PropsWithChildren {}\n\nexport const DropzoneIdle: FC<DropzoneIdleProps> = ({ children }) => {\n const { dragIdle } = useComponentContext()\n\n return dragIdle ? children : null\n}\n"],"mappings":";;;;;;;;;;;;AA4CA,MAAM,EACJ,kBACA,cAAc,sBACd,qBACA,iBAAiB,yBACjB,aACA,iBACE,oBACF,YACA,aACF;;;;;;AASA,MAAa,eAAe,cACzB,EACC,UACA,kBACA,kBACA,eACA,YACA,cACA,cACA,GAAG,WACC;CACJ,MAAM,WAAW,eAAe;EAAE;EAAkB;CAAiB,CAAC;CACtE,MAAM,EACJ,YACA,UACA,YACA,SACA,eACA,iBACE,YAAY,IAAI;CACpB,MAAM,UAAU,eACP;EACL;EACA;EACA;EACA;CACF,IACA;EAAC;EAAY;EAAU;EAAY;CAAO,CAC5C;CAEA,OACE,qBAAC,kBAAD;EAAkB,OAAO;EAAzB,UAAA,CACE,oBAAC,QAAD,EAAA,UACE,oBAAC,OAAO,OAAR,EAAc,GAAI,cAAc,UAAU,EAAI,CAAA,EACxC,CAAA,GAER,qBAAC,OAAO,KAAR;GAAY,cAAA;GAAW,GAAI;GAAU,GAAI,aAAa;GAAtD,UAAA,CACE,oBAAC,iBAAD;IAAiB,GAAI;IACnB,UAAA,oBAAC,iBAAD;KAAgC;KAAe,GAAI;IAAe,CAAA;GACnD,CAAA,GAEhB,QACS;EACI,CAAA,CAAA;;AAEtB,GACA,MACF,CAAC,CAAC;AAIF,MAAa,eAAe,YAC1B,OACA,MACF,CAAC,CAAC;AAIF,MAAa,gBAAgB,YAC3B,KACA,OACF,CAAC,CAAC;AAIF,MAAa,sBAAsB,YACjC,KACA,aACF,CAAC,CAAC;AAMF,MAAM,kBAAkB,YACtB,MACA,SACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,YAAY,oBAAoB;CAExC,OAAO;EAAE,MAAM;EAAS,eAAe;EAAM,GAAG;CAAM;AACxD,CAAC;AAWD,MAAM,kBAAkB,aACrB,EAAE,gBAAgB,QAAQ,GAAG,WAAW;CAGvC,OAAO,oBAFW,oBAAoB,aAEtB,GAAT,EAAW,GAAI,KAAO,CAAA;AAC/B,GACA,SACF,CAAC,CAAC;AAIF,MAAa,kBAA2C,EAAE,eAAe;CACvE,MAAM,EAAE,eAAe,oBAAoB;CAE3C,OAAO,aAAa,WAAW;AACjC;AAIA,MAAa,kBAA2C,EAAE,eAAe;CACvE,MAAM,EAAE,eAAe,oBAAoB;CAE3C,OAAO,aAAa,WAAW;AACjC;AAIA,MAAa,gBAAuC,EAAE,eAAe;CACnE,MAAM,EAAE,aAAa,oBAAoB;CAEzC,OAAO,WAAW,WAAW;AAC/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"editable.js","names":[],"sources":["../../../../src/components/editable/editable.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ReactNodeOrFunction } from \"../../utils\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { EditableStyle } from \"./editable.style\"\nimport type { UseEditableProps, UseEditableReturn } from \"./use-editable\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { runIfFn } from \"../../utils\"\nimport { useInputBorder } from \"../input\"\nimport { editableStyle } from \"./editable.style\"\nimport {\n EditableContext,\n useEditable,\n useEditableContext,\n} from \"./use-editable\"\n\ninterface EditableElementProps extends Pick<\n UseEditableReturn,\n \"editing\" | \"onCancel\" | \"onEdit\" | \"onSubmit\"\n> {}\n\nexport interface EditableRootProps\n extends\n Omit<\n HTMLStyledProps,\n \"children\" | \"defaultValue\" | \"onChange\" | \"onSubmit\" | \"value\"\n >,\n ThemeProps<EditableStyle>,\n UseInputBorderProps,\n UseEditableProps {\n /**\n * The editable children to use.\n */\n children?: ReactNodeOrFunction<EditableElementProps>\n}\n\nconst {\n PropsContext: EditablePropsContext,\n usePropsContext: useEditablePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<EditableRootProps, EditableStyle>(\n \"editable\",\n editableStyle,\n)\n\nexport { EditablePropsContext, useEditablePropsContext }\n\n/**\n * `Editable` is a component used to obtain inline editable text input.\n *\n * @see https://yamada-ui.com/docs/components/editable\n */\nexport const EditableRoot = withProvider(\n ({ children, errorBorderColor, focusBorderColor, ...props }) => {\n const {\n editing,\n value: _value,\n getRootProps,\n onCancel,\n onEdit,\n onSubmit,\n ...rest\n } = useEditable(props)\n const varProps = useInputBorder({ errorBorderColor, focusBorderColor })\n const cloneChildren = runIfFn(children, {\n editing,\n onCancel,\n onEdit,\n onSubmit,\n })\n\n return (\n <EditableContext value={{ editing, ...rest }}>\n <styled.div {...getRootProps()} {...varProps}>\n {cloneChildren}\n </styled.div>\n </EditableContext>\n )\n },\n)()\n\nexport interface EditablePreviewProps extends HTMLStyledProps<\"span\"> {}\n\nexport const EditablePreview = withContext<\"span\", EditablePreviewProps>(\n \"span\",\n \"preview\",\n)(undefined, (props) => {\n const { getPreviewProps } = useEditableContext()\n\n return { ...getPreviewProps(props) }\n})\n\nexport interface EditableInputProps extends HTMLStyledProps<\"input\"> {}\n\nexport const EditableInput = withContext<\"input\", EditableInputProps>(\n \"input\",\n \"input\",\n)(undefined, (props) => {\n const { getInputProps } = useEditableContext()\n\n return { ...getInputProps(props) }\n})\n\nexport interface EditableTextareaProps extends HTMLStyledProps<\"textarea\"> {}\n\nexport const EditableTextarea = withContext<\"textarea\", EditableTextareaProps>(\n \"textarea\",\n \"textarea\",\n)(undefined, (props) => {\n const { getTextareaProps } = useEditableContext()\n\n return { ...getTextareaProps(props) }\n})\n\nexport interface EditableControlProps extends HTMLStyledProps {}\n\nexport const EditableControl = withContext<\"div\", EditableControlProps>(\n \"div\",\n \"control\",\n)(undefined, (props) => {\n const { getControlProps } = useEditableContext()\n\n return { ...getControlProps(props) }\n})\n\nexport interface EditableEditTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const EditableEditTrigger = withContext<\n \"button\",\n EditableEditTriggerProps\n>(\"button\", { name: \"EditTrigger\", slot: [\"trigger\", \"edit\"] })(\n undefined,\n (props) => {\n const { getEditProps } = useEditableContext()\n\n return { asChild: true, ...getEditProps(props) }\n },\n)\n\nexport interface EditableCancelTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const EditableCancelTrigger = withContext<\n \"button\",\n EditableCancelTriggerProps\n>(\"button\", { name: \"CancelTrigger\", slot: [\"trigger\", \"cancel\"] })(\n undefined,\n (props) => {\n const { getCancelProps } = useEditableContext()\n\n return { asChild: true, ...getCancelProps(props) }\n },\n)\n\nexport interface EditableSubmitTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const EditableSubmitTrigger = withContext<\n \"button\",\n EditableSubmitTriggerProps\n>(\"button\", { name: \"SubmitTrigger\", slot: [\"trigger\", \"submit\"] })(\n undefined,\n (props) => {\n const { getSubmitProps } = useEditableContext()\n\n return { asChild: true, ...getSubmitProps(props) }\n },\n)\n"],"mappings":";;;;;;;;;AAqCA,MAAM,EACJ,cAAc,sBACd,iBAAiB,yBACjB,aACA,iBACE,oBACF,YACA,aACF;;;;;;AASA,MAAa,eAAe,cACzB,EAAE,UAAU,kBAAkB,kBAAkB,GAAG,YAAY;CAC9D,MAAM,EACJ,SACA,OAAO,QACP,cACA,UACA,QACA,UACA,GAAG,SACD,YAAY,KAAK;CACrB,MAAM,WAAW,eAAe;EAAE;EAAkB;CAAiB,CAAC;CACtE,MAAM,iBAAA,GAAA,cAAA,QAAA,CAAwB,UAAU;EACtC;EACA;EACA;EACA;CACF,CAAC;CAED,OACE,oBAAC,iBAAD;EAAiB,OAAO;GAAE;GAAS,GAAG;EAAK;YACzC,oBAAC,OAAO,KAAR;GAAY,GAAI,aAAa;GAAG,GAAI;aACjC;EACS,CAAA;CACG,CAAA;AAErB,CACF,CAAC,CA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,OAAO;EAAE,SAAS;EAAM,GAAG,eAAe,KAAK;CAAE;AACnD,CACF"}
1
+ {"version":3,"file":"editable.js","names":[],"sources":["../../../../src/components/editable/editable.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ReactNodeOrFunction } from \"../../utils\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { EditableStyle } from \"./editable.style\"\nimport type { UseEditableProps, UseEditableReturn } from \"./use-editable\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { runIfFn } from \"../../utils\"\nimport { useInputBorder } from \"../input\"\nimport { editableStyle } from \"./editable.style\"\nimport {\n EditableContext,\n useEditable,\n useEditableContext,\n} from \"./use-editable\"\n\ninterface EditableElementProps extends Pick<\n UseEditableReturn,\n \"editing\" | \"onCancel\" | \"onEdit\" | \"onSubmit\"\n> {}\n\nexport interface EditableRootProps\n extends\n Omit<\n HTMLStyledProps,\n \"children\" | \"defaultValue\" | \"onChange\" | \"onSubmit\" | \"value\"\n >,\n ThemeProps<EditableStyle>,\n UseInputBorderProps,\n UseEditableProps {\n /**\n * The editable children to use.\n */\n children?: ReactNodeOrFunction<EditableElementProps>\n}\n\nconst {\n PropsContext: EditablePropsContext,\n usePropsContext: useEditablePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<EditableRootProps, EditableStyle>(\n \"editable\",\n editableStyle,\n)\n\nexport { EditablePropsContext, useEditablePropsContext }\n\n/**\n * `Editable` is a component used to obtain inline editable text input.\n *\n * @see https://yamada-ui.com/docs/components/editable\n */\nexport const EditableRoot = withProvider(\n ({ children, errorBorderColor, focusBorderColor, ...props }) => {\n const {\n editing,\n value: _value,\n getRootProps,\n onCancel,\n onEdit,\n onSubmit,\n ...rest\n } = useEditable(props)\n const varProps = useInputBorder({ errorBorderColor, focusBorderColor })\n const cloneChildren = runIfFn(children, {\n editing,\n onCancel,\n onEdit,\n onSubmit,\n })\n\n return (\n <EditableContext value={{ editing, ...rest }}>\n <styled.div {...getRootProps()} {...varProps}>\n {cloneChildren}\n </styled.div>\n </EditableContext>\n )\n },\n)()\n\nexport interface EditablePreviewProps extends HTMLStyledProps<\"span\"> {}\n\nexport const EditablePreview = withContext<\"span\", EditablePreviewProps>(\n \"span\",\n \"preview\",\n)(undefined, (props) => {\n const { getPreviewProps } = useEditableContext()\n\n return { ...getPreviewProps(props) }\n})\n\nexport interface EditableInputProps extends HTMLStyledProps<\"input\"> {}\n\nexport const EditableInput = withContext<\"input\", EditableInputProps>(\n \"input\",\n \"input\",\n)(undefined, (props) => {\n const { getInputProps } = useEditableContext()\n\n return { ...getInputProps(props) }\n})\n\nexport interface EditableTextareaProps extends HTMLStyledProps<\"textarea\"> {}\n\nexport const EditableTextarea = withContext<\"textarea\", EditableTextareaProps>(\n \"textarea\",\n \"textarea\",\n)(undefined, (props) => {\n const { getTextareaProps } = useEditableContext()\n\n return { ...getTextareaProps(props) }\n})\n\nexport interface EditableControlProps extends HTMLStyledProps {}\n\nexport const EditableControl = withContext<\"div\", EditableControlProps>(\n \"div\",\n \"control\",\n)(undefined, (props) => {\n const { getControlProps } = useEditableContext()\n\n return { ...getControlProps(props) }\n})\n\nexport interface EditableEditTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const EditableEditTrigger = withContext<\n \"button\",\n EditableEditTriggerProps\n>(\"button\", { name: \"EditTrigger\", slot: [\"trigger\", \"edit\"] })(\n undefined,\n (props) => {\n const { getEditProps } = useEditableContext()\n\n return { asChild: true, ...getEditProps(props) }\n },\n)\n\nexport interface EditableCancelTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const EditableCancelTrigger = withContext<\n \"button\",\n EditableCancelTriggerProps\n>(\"button\", { name: \"CancelTrigger\", slot: [\"trigger\", \"cancel\"] })(\n undefined,\n (props) => {\n const { getCancelProps } = useEditableContext()\n\n return { asChild: true, ...getCancelProps(props) }\n },\n)\n\nexport interface EditableSubmitTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const EditableSubmitTrigger = withContext<\n \"button\",\n EditableSubmitTriggerProps\n>(\"button\", { name: \"SubmitTrigger\", slot: [\"trigger\", \"submit\"] })(\n undefined,\n (props) => {\n const { getSubmitProps } = useEditableContext()\n\n return { asChild: true, ...getSubmitProps(props) }\n },\n)\n"],"mappings":";;;;;;;;;AAqCA,MAAM,EACJ,cAAc,sBACd,iBAAiB,yBACjB,aACA,iBACE,oBACF,YACA,aACF;;;;;;AASA,MAAa,eAAe,cACzB,EAAE,UAAU,kBAAkB,kBAAkB,GAAG,YAAY;CAC9D,MAAM,EACJ,SACA,OAAO,QACP,cACA,UACA,QACA,UACA,GAAG,SACD,YAAY,KAAK;CACrB,MAAM,WAAW,eAAe;EAAE;EAAkB;CAAiB,CAAC;CACtE,MAAM,iBAAA,GAAA,cAAA,QAAA,CAAwB,UAAU;EACtC;EACA;EACA;EACA;CACF,CAAC;CAED,OACE,oBAAC,iBAAD;EAAiB,OAAO;GAAE;GAAS,GAAG;EAAK;EACzC,UAAA,oBAAC,OAAO,KAAR;GAAY,GAAI,aAAa;GAAG,GAAI;GACjC,UAAA;EACS,CAAA;CACG,CAAA;AAErB,CACF,CAAC,CAAC;AAIF,MAAa,kBAAkB,YAC7B,QACA,SACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,oBAAoB,mBAAmB;CAE/C,OAAO,EAAE,GAAG,gBAAgB,KAAK,EAAE;AACrC,CAAC;AAID,MAAa,gBAAgB,YAC3B,SACA,OACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,kBAAkB,mBAAmB;CAE7C,OAAO,EAAE,GAAG,cAAc,KAAK,EAAE;AACnC,CAAC;AAID,MAAa,mBAAmB,YAC9B,YACA,UACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,qBAAqB,mBAAmB;CAEhD,OAAO,EAAE,GAAG,iBAAiB,KAAK,EAAE;AACtC,CAAC;AAID,MAAa,kBAAkB,YAC7B,OACA,SACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,oBAAoB,mBAAmB;CAE/C,OAAO,EAAE,GAAG,gBAAgB,KAAK,EAAE;AACrC,CAAC;AAID,MAAa,sBAAsB,YAGjC,UAAU;CAAE,MAAM;CAAe,MAAM,CAAC,WAAW,MAAM;AAAE,CAAC,CAAC,CAC7D,KAAA,IACC,UAAU;CACT,MAAM,EAAE,iBAAiB,mBAAmB;CAE5C,OAAO;EAAE,SAAS;EAAM,GAAG,aAAa,KAAK;CAAE;AACjD,CACF;AAIA,MAAa,wBAAwB,YAGnC,UAAU;CAAE,MAAM;CAAiB,MAAM,CAAC,WAAW,QAAQ;AAAE,CAAC,CAAC,CACjE,KAAA,IACC,UAAU;CACT,MAAM,EAAE,mBAAmB,mBAAmB;CAE9C,OAAO;EAAE,SAAS;EAAM,GAAG,eAAe,KAAK;CAAE;AACnD,CACF;AAIA,MAAa,wBAAwB,YAGnC,UAAU;CAAE,MAAM;CAAiB,MAAM,CAAC,WAAW,QAAQ;AAAE,CAAC,CAAC,CACjE,KAAA,IACC,UAAU;CACT,MAAM,EAAE,mBAAmB,mBAAmB;CAE9C,OAAO;EAAE,SAAS;EAAM,GAAG,eAAe,KAAK;CAAE;AACnD,CACF"}
@@ -65,8 +65,8 @@ const useEditable = (props = {}) => {
65
65
  }, [onCancel]);
66
66
  const onBlur = useCallback((ev) => {
67
67
  if (!editing) return;
68
- const ownerDocument = ev.currentTarget.ownerDocument;
69
- const relatedTarget = ev.relatedTarget ?? ownerDocument.activeElement;
68
+ const rootNode = ev.currentTarget.getRootNode();
69
+ const relatedTarget = (0, utils_exports.isShadowRoot)(rootNode) ? rootNode.activeElement ?? ev.relatedTarget : ev.relatedTarget ?? rootNode.activeElement;
70
70
  const targetIsCancel = (0, utils_exports.contains)(cancelRef.current, relatedTarget);
71
71
  const targetIsSubmit = (0, utils_exports.contains)(submitRef.current, relatedTarget);
72
72
  if (!(!targetIsCancel && !targetIsSubmit)) return;
@@ -102,9 +102,8 @@ const useEditable = (props = {}) => {
102
102
  selectAllOnFocus
103
103
  ]);
104
104
  useEffect(() => {
105
- if (editing) return;
106
- const el = inputRef.current;
107
- if (el?.ownerDocument.activeElement === el) el?.blur();
105
+ if (editing || !inputRef.current) return;
106
+ if ((0, utils_exports.isActiveElement)(inputRef.current, inputRef.current.getRootNode())) inputRef.current.blur();
108
107
  }, [editing]);
109
108
  const getRootProps = useCallback((props) => ({
110
109
  ...rest,