@yamada-ui/react 2.3.0-next-20261009073533 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/accordion/accordion.cjs +4 -3
- package/dist/cjs/components/accordion/accordion.cjs.map +1 -1
- package/dist/cjs/components/aspect-ratio/aspect-ratio.cjs +2 -2
- package/dist/cjs/components/aspect-ratio/aspect-ratio.cjs.map +1 -1
- package/dist/cjs/components/blockquote/blockquote.style.cjs +1 -1
- package/dist/cjs/components/blockquote/blockquote.style.cjs.map +1 -1
- package/dist/cjs/components/breadcrumb/use-breadcrumb.cjs +2 -1
- package/dist/cjs/components/breadcrumb/use-breadcrumb.cjs.map +1 -1
- package/dist/cjs/components/bubble/bubble.cjs +163 -0
- package/dist/cjs/components/bubble/bubble.cjs.map +1 -0
- package/dist/cjs/components/bubble/bubble.style.cjs +143 -0
- package/dist/cjs/components/bubble/bubble.style.cjs.map +1 -0
- package/dist/cjs/components/bubble/index.cjs +18 -0
- package/dist/cjs/components/bubble/namespace.cjs +28 -0
- package/dist/cjs/components/bubble/namespace.cjs.map +1 -0
- package/dist/cjs/components/button/button.cjs +11 -8
- package/dist/cjs/components/button/button.cjs.map +1 -1
- package/dist/cjs/components/calendar/calendar.cjs +3 -1
- package/dist/cjs/components/calendar/calendar.cjs.map +1 -1
- package/dist/cjs/components/calendar/use-calendar.cjs +11 -6
- package/dist/cjs/components/calendar/use-calendar.cjs.map +1 -1
- package/dist/cjs/components/code/code.style.cjs +2 -1
- package/dist/cjs/components/code/code.style.cjs.map +1 -1
- package/dist/cjs/components/date-picker/use-date-picker.cjs +10 -10
- package/dist/cjs/components/date-picker/use-date-picker.cjs.map +1 -1
- package/dist/cjs/components/drawer/drawer.cjs +13 -1
- package/dist/cjs/components/drawer/drawer.cjs.map +1 -1
- package/dist/cjs/components/drawer/index.cjs +1 -0
- package/dist/cjs/components/drawer/namespace.cjs +2 -0
- package/dist/cjs/components/drawer/namespace.cjs.map +1 -1
- package/dist/cjs/components/drawer/use-drawer.cjs +139 -11
- package/dist/cjs/components/drawer/use-drawer.cjs.map +1 -1
- package/dist/cjs/components/field/field.cjs +4 -3
- package/dist/cjs/components/field/field.cjs.map +1 -1
- package/dist/cjs/components/file-input/use-file-input.cjs.map +1 -1
- package/dist/cjs/components/icon/icons/armenian-dram-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/armenian-dram-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/bangladeshi-taka-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/bangladeshi-taka-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/belarusian-ruble-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/belarusian-ruble-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/calendar-chevrons-left-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/calendar-chevrons-left-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/certificate-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/certificate-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/circle-fading-play-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/circle-fading-play-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/cpu-ai-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/cpu-ai-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/door-closed-cog-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/door-closed-cog-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/eighth-note-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/eighth-note-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/eighth-notes-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/eighth-notes-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/folder-user-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/folder-user-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/folder-users-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/folder-users-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/graph-star-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/graph-star-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/groceries-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/groceries-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/guitar-electric-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/guitar-electric-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/half-note-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/half-note-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/handle-bottom-right-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/handle-bottom-right-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/hiking-stick-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/hiking-stick-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/index.cjs +123 -12
- package/dist/cjs/components/icon/icons/index.cjs.map +1 -1
- package/dist/cjs/components/icon/icons/kazakh-tenge-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/kazakh-tenge-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/layout-grid-circles-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/layout-grid-circles-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/lens-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/lens-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/letters-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/letters-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/mail-dot-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/mail-dot-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/message-circle-text-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/message-circle-text-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/perfume-bottle-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/perfume-bottle-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/phone-log-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/phone-log-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/printer3d-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/printer3d-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/rugby-ball-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/rugby-ball-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/scratch-blocks-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/scratch-blocks-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/screw-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/screw-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/server-nas-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/server-nas-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/shield-house-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/shield-house-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/sixteenth-notes-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/sixteenth-notes-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/text-align-justify-center-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/text-align-justify-center-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/text-align-justify-end-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/text-align-justify-end-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/text-align-justify-start-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/text-align-justify-start-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/user-round-star-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/user-round-star-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/users-collaboration-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/users-collaboration-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/users-round-collaboration-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/users-round-collaboration-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/wifi-lock-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/wifi-lock-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/wind-arrow-up-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/wind-arrow-up-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/index.cjs +82 -8
- package/dist/cjs/components/kbd/kbd.style.cjs +2 -1
- package/dist/cjs/components/kbd/kbd.style.cjs.map +1 -1
- package/dist/cjs/components/list/list.cjs +5 -3
- package/dist/cjs/components/list/list.cjs.map +1 -1
- package/dist/cjs/components/marquee/index.cjs +21 -0
- package/dist/cjs/components/marquee/marquee.cjs +74 -0
- package/dist/cjs/components/marquee/marquee.cjs.map +1 -0
- package/dist/cjs/components/marquee/marquee.style.cjs +121 -0
- package/dist/cjs/components/marquee/marquee.style.cjs.map +1 -0
- package/dist/cjs/components/marquee/namespace.cjs +26 -0
- package/dist/cjs/components/marquee/namespace.cjs.map +1 -0
- package/dist/cjs/components/marquee/use-marquee.cjs +183 -0
- package/dist/cjs/components/marquee/use-marquee.cjs.map +1 -0
- package/dist/cjs/components/native-accordion/native-accordion.cjs +4 -3
- package/dist/cjs/components/native-accordion/native-accordion.cjs.map +1 -1
- package/dist/cjs/components/prose/index.cjs +7 -0
- package/dist/cjs/components/prose/prose.cjs +17 -0
- package/dist/cjs/components/prose/prose.cjs.map +1 -0
- package/dist/cjs/components/prose/prose.style.cjs +205 -0
- package/dist/cjs/components/prose/prose.style.cjs.map +1 -0
- package/dist/cjs/components/reorder/use-reorder.cjs +2 -1
- package/dist/cjs/components/reorder/use-reorder.cjs.map +1 -1
- package/dist/cjs/components/resizable/index.cjs +6 -1
- package/dist/cjs/components/resizable/namespace.cjs +6 -1
- package/dist/cjs/components/resizable/use-resizable.cjs +6 -1
- package/dist/cjs/components/select/use-select.cjs.map +1 -1
- package/dist/cjs/components/sidebar/sidebar.cjs +4 -3
- package/dist/cjs/components/sidebar/sidebar.cjs.map +1 -1
- package/dist/cjs/components/slot/slot.cjs +10 -9
- package/dist/cjs/components/slot/slot.cjs.map +1 -1
- package/dist/cjs/components/stack/stack.cjs +2 -1
- package/dist/cjs/components/stack/stack.cjs.map +1 -1
- package/dist/cjs/components/table/index.cjs +6 -1
- package/dist/cjs/components/tree/tree.cjs +5 -3
- package/dist/cjs/components/tree/tree.cjs.map +1 -1
- package/dist/cjs/core/components/create-component.cjs +1 -1
- package/dist/cjs/core/components/create-component.cjs.map +1 -1
- package/dist/cjs/core/css/conditions.cjs +4 -4
- package/dist/cjs/core/css/conditions.cjs.map +1 -1
- package/dist/cjs/core/css/styles.cjs.map +1 -1
- package/dist/cjs/hooks/use-focus/index.cjs +7 -14
- package/dist/cjs/hooks/use-focus/index.cjs.map +1 -1
- package/dist/cjs/index.cjs +306 -112
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/utils/children.cjs +22 -9
- package/dist/cjs/utils/children.cjs.map +1 -1
- package/dist/cjs/utils/index.cjs +4 -0
- package/dist/esm/components/accordion/accordion.js +5 -4
- package/dist/esm/components/accordion/accordion.js.map +1 -1
- package/dist/esm/components/aspect-ratio/aspect-ratio.js +2 -2
- package/dist/esm/components/aspect-ratio/aspect-ratio.js.map +1 -1
- package/dist/esm/components/blockquote/blockquote.style.js +1 -1
- package/dist/esm/components/blockquote/blockquote.style.js.map +1 -1
- package/dist/esm/components/box/index.js +1 -2
- package/dist/esm/components/breadcrumb/use-breadcrumb.js +2 -1
- package/dist/esm/components/breadcrumb/use-breadcrumb.js.map +1 -1
- package/dist/esm/components/bubble/bubble.js +157 -0
- package/dist/esm/components/bubble/bubble.js.map +1 -0
- package/dist/esm/components/bubble/bubble.style.js +144 -0
- package/dist/esm/components/bubble/bubble.style.js.map +1 -0
- package/dist/esm/components/bubble/index.js +4 -0
- package/dist/esm/components/bubble/namespace.js +16 -0
- package/dist/esm/components/bubble/namespace.js.map +1 -0
- package/dist/esm/components/button/button.js +11 -8
- package/dist/esm/components/button/button.js.map +1 -1
- package/dist/esm/components/calendar/calendar.js +3 -1
- package/dist/esm/components/calendar/calendar.js.map +1 -1
- package/dist/esm/components/calendar/use-calendar.js +12 -7
- package/dist/esm/components/calendar/use-calendar.js.map +1 -1
- package/dist/esm/components/client-only/index.js +1 -2
- package/dist/esm/components/code/code.style.js +2 -1
- package/dist/esm/components/code/code.style.js.map +1 -1
- package/dist/esm/components/date-picker/use-date-picker.js +10 -10
- package/dist/esm/components/date-picker/use-date-picker.js.map +1 -1
- package/dist/esm/components/drawer/drawer.js +13 -2
- package/dist/esm/components/drawer/drawer.js.map +1 -1
- package/dist/esm/components/drawer/index.js +2 -2
- package/dist/esm/components/drawer/namespace.js +3 -2
- package/dist/esm/components/drawer/namespace.js.map +1 -1
- package/dist/esm/components/drawer/use-drawer.js +140 -12
- package/dist/esm/components/drawer/use-drawer.js.map +1 -1
- package/dist/esm/components/field/field.js +5 -4
- package/dist/esm/components/field/field.js.map +1 -1
- package/dist/esm/components/file-input/use-file-input.js.map +1 -1
- package/dist/esm/components/focus-lock/index.js +1 -2
- package/dist/esm/components/for/index.js +1 -2
- package/dist/esm/components/icon/icons/armenian-dram-icon.js +14 -0
- package/dist/esm/components/icon/icons/armenian-dram-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/bangladeshi-taka-icon.js +14 -0
- package/dist/esm/components/icon/icons/bangladeshi-taka-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/belarusian-ruble-icon.js +14 -0
- package/dist/esm/components/icon/icons/belarusian-ruble-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/calendar-chevrons-left-icon.js +14 -0
- package/dist/esm/components/icon/icons/calendar-chevrons-left-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/certificate-icon.js +14 -0
- package/dist/esm/components/icon/icons/certificate-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/circle-fading-play-icon.js +14 -0
- package/dist/esm/components/icon/icons/circle-fading-play-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/cpu-ai-icon.js +14 -0
- package/dist/esm/components/icon/icons/cpu-ai-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/door-closed-cog-icon.js +14 -0
- package/dist/esm/components/icon/icons/door-closed-cog-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/eighth-note-icon.js +14 -0
- package/dist/esm/components/icon/icons/eighth-note-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/eighth-notes-icon.js +14 -0
- package/dist/esm/components/icon/icons/eighth-notes-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/folder-user-icon.js +14 -0
- package/dist/esm/components/icon/icons/folder-user-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/folder-users-icon.js +14 -0
- package/dist/esm/components/icon/icons/folder-users-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/graph-star-icon.js +14 -0
- package/dist/esm/components/icon/icons/graph-star-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/groceries-icon.js +14 -0
- package/dist/esm/components/icon/icons/groceries-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/guitar-electric-icon.js +14 -0
- package/dist/esm/components/icon/icons/guitar-electric-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/half-note-icon.js +14 -0
- package/dist/esm/components/icon/icons/half-note-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/handle-bottom-right-icon.js +14 -0
- package/dist/esm/components/icon/icons/handle-bottom-right-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/hiking-stick-icon.js +14 -0
- package/dist/esm/components/icon/icons/hiking-stick-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/index.js +83 -9
- package/dist/esm/components/icon/icons/index.js.map +1 -1
- package/dist/esm/components/icon/icons/kazakh-tenge-icon.js +14 -0
- package/dist/esm/components/icon/icons/kazakh-tenge-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/layout-grid-circles-icon.js +14 -0
- package/dist/esm/components/icon/icons/layout-grid-circles-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/lens-icon.js +14 -0
- package/dist/esm/components/icon/icons/lens-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/letters-icon.js +14 -0
- package/dist/esm/components/icon/icons/letters-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/mail-dot-icon.js +14 -0
- package/dist/esm/components/icon/icons/mail-dot-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/message-circle-text-icon.js +14 -0
- package/dist/esm/components/icon/icons/message-circle-text-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/perfume-bottle-icon.js +14 -0
- package/dist/esm/components/icon/icons/perfume-bottle-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/phone-log-icon.js +14 -0
- package/dist/esm/components/icon/icons/phone-log-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/printer3d-icon.js +14 -0
- package/dist/esm/components/icon/icons/printer3d-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/rugby-ball-icon.js +14 -0
- package/dist/esm/components/icon/icons/rugby-ball-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/scratch-blocks-icon.js +14 -0
- package/dist/esm/components/icon/icons/scratch-blocks-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/screw-icon.js +14 -0
- package/dist/esm/components/icon/icons/screw-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/server-nas-icon.js +14 -0
- package/dist/esm/components/icon/icons/server-nas-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/shield-house-icon.js +14 -0
- package/dist/esm/components/icon/icons/shield-house-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/sixteenth-notes-icon.js +14 -0
- package/dist/esm/components/icon/icons/sixteenth-notes-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/text-align-justify-center-icon.js +14 -0
- package/dist/esm/components/icon/icons/text-align-justify-center-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/text-align-justify-end-icon.js +14 -0
- package/dist/esm/components/icon/icons/text-align-justify-end-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/text-align-justify-start-icon.js +14 -0
- package/dist/esm/components/icon/icons/text-align-justify-start-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/user-round-star-icon.js +14 -0
- package/dist/esm/components/icon/icons/user-round-star-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/users-collaboration-icon.js +14 -0
- package/dist/esm/components/icon/icons/users-collaboration-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/users-round-collaboration-icon.js +14 -0
- package/dist/esm/components/icon/icons/users-round-collaboration-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/wifi-lock-icon.js +14 -0
- package/dist/esm/components/icon/icons/wifi-lock-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/wind-arrow-up-icon.js +14 -0
- package/dist/esm/components/icon/icons/wind-arrow-up-icon.js.map +1 -0
- package/dist/esm/components/icon/index.js +42 -5
- package/dist/esm/components/kbd/kbd.style.js +2 -1
- package/dist/esm/components/kbd/kbd.style.js.map +1 -1
- package/dist/esm/components/list/list.js +5 -3
- package/dist/esm/components/list/list.js.map +1 -1
- package/dist/esm/components/marquee/index.js +5 -0
- package/dist/esm/components/marquee/marquee.js +69 -0
- package/dist/esm/components/marquee/marquee.js.map +1 -0
- package/dist/esm/components/marquee/marquee.style.js +122 -0
- package/dist/esm/components/marquee/marquee.style.js.map +1 -0
- package/dist/esm/components/marquee/namespace.js +15 -0
- package/dist/esm/components/marquee/namespace.js.map +1 -0
- package/dist/esm/components/marquee/use-marquee.js +181 -0
- package/dist/esm/components/marquee/use-marquee.js.map +1 -0
- package/dist/esm/components/native-accordion/native-accordion.js +5 -4
- package/dist/esm/components/native-accordion/native-accordion.js.map +1 -1
- package/dist/esm/components/picture/index.js +1 -2
- package/dist/esm/components/portal/index.js +1 -2
- package/dist/esm/components/prose/index.js +3 -0
- package/dist/esm/components/prose/prose.js +15 -0
- package/dist/esm/components/prose/prose.js.map +1 -0
- package/dist/esm/components/prose/prose.style.js +205 -0
- package/dist/esm/components/prose/prose.style.js.map +1 -0
- package/dist/esm/components/reorder/use-reorder.js +2 -1
- package/dist/esm/components/reorder/use-reorder.js.map +1 -1
- package/dist/esm/components/select/use-select.js.map +1 -1
- package/dist/esm/components/show/index.js +1 -2
- package/dist/esm/components/sidebar/sidebar.js +5 -4
- package/dist/esm/components/sidebar/sidebar.js.map +1 -1
- package/dist/esm/components/slot/index.js +1 -2
- package/dist/esm/components/slot/slot.js +11 -10
- package/dist/esm/components/slot/slot.js.map +1 -1
- package/dist/esm/components/stack/stack.js +2 -1
- package/dist/esm/components/stack/stack.js.map +1 -1
- package/dist/esm/components/table/index.js +1 -2
- package/dist/esm/components/tip/index.js +1 -2
- package/dist/esm/components/tree/tree.js +5 -3
- package/dist/esm/components/tree/tree.js.map +1 -1
- package/dist/esm/core/components/create-component.js +1 -1
- package/dist/esm/core/components/create-component.js.map +1 -1
- package/dist/esm/core/css/conditions.js +4 -4
- package/dist/esm/core/css/conditions.js.map +1 -1
- package/dist/esm/core/css/styles.js.map +1 -1
- package/dist/esm/hooks/use-focus/index.js +8 -15
- package/dist/esm/hooks/use-focus/index.js.map +1 -1
- package/dist/esm/index.js +215 -105
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/providers/ui-provider/index.js +1 -2
- package/dist/esm/utils/children.js +22 -11
- package/dist/esm/utils/children.js.map +1 -1
- package/dist/esm/utils/index.js +4 -2
- package/dist/types/components/alert/alert.d.ts +0 -1
- package/dist/types/components/alpha-slider/alpha-slider.d.ts +0 -1
- package/dist/types/components/autocomplete/autocomplete.d.ts +0 -1
- package/dist/types/components/breadcrumb/use-breadcrumb.d.ts +1 -1
- package/dist/types/components/bubble/bubble.d.ts +89 -0
- package/dist/types/components/bubble/bubble.style.d.ts +79 -0
- package/dist/types/components/bubble/index.d.ts +4 -0
- package/dist/types/components/bubble/namespace.d.ts +7 -0
- package/dist/types/components/button/button.d.ts +0 -1
- package/dist/types/components/calendar/calendar.d.ts +0 -1
- package/dist/types/components/calendar/use-calendar.d.ts +4 -3
- package/dist/types/components/color-picker/color-picker.d.ts +0 -3
- package/dist/types/components/color-selector/color-selector.d.ts +0 -1
- package/dist/types/components/color-selector/use-color-selector.d.ts +1 -0
- package/dist/types/components/date-picker/date-picker.d.ts +0 -3
- package/dist/types/components/date-picker/use-date-picker.d.ts +1 -0
- package/dist/types/components/drawer/drawer.d.ts +2 -0
- package/dist/types/components/drawer/index.d.ts +2 -2
- package/dist/types/components/drawer/namespace.d.ts +3 -3
- package/dist/types/components/drawer/use-drawer.d.ts +9 -2
- package/dist/types/components/dropzone/dropzone.d.ts +0 -1
- package/dist/types/components/hue-slider/hue-slider.d.ts +0 -1
- package/dist/types/components/icon/icons/armenian-dram-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/bangladeshi-taka-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/belarusian-ruble-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/calendar-chevrons-left-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/certificate-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/circle-fading-play-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/cpu-ai-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/door-closed-cog-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/eighth-note-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/eighth-notes-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/folder-user-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/folder-users-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/graph-star-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/groceries-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/guitar-electric-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/half-note-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/handle-bottom-right-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/hiking-stick-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/index.d.ts +43 -6
- package/dist/types/components/icon/icons/index.type.d.ts +1 -1
- package/dist/types/components/icon/icons/kazakh-tenge-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/layout-grid-circles-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/lens-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/letters-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/mail-dot-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/message-circle-text-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/perfume-bottle-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/phone-log-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/printer3d-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/rugby-ball-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/scratch-blocks-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/{music-icon.d.ts → screw-icon.d.ts} +4 -4
- package/dist/types/components/icon/icons/server-nas-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/shield-house-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/sixteenth-notes-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/text-align-justify-center-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/text-align-justify-end-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/text-align-justify-start-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/user-round-star-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/users-collaboration-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/users-round-collaboration-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/wifi-lock-icon.d.ts +12 -0
- package/dist/types/components/icon/icons/wind-arrow-up-icon.d.ts +12 -0
- package/dist/types/components/icon/index.d.ts +42 -5
- package/dist/types/components/loading/loading-provider.d.ts +1 -0
- package/dist/types/components/loading/use-loading-component.d.ts +0 -1
- package/dist/types/components/marquee/index.d.ts +5 -0
- package/dist/types/components/marquee/marquee.d.ts +50 -0
- package/dist/types/components/marquee/marquee.style.d.ts +8 -0
- package/dist/types/components/marquee/namespace.d.ts +8 -0
- package/dist/types/components/marquee/use-marquee.d.ts +127 -0
- package/dist/types/components/menu/menu.d.ts +0 -1
- package/dist/types/components/motion/factory.d.ts +1 -0
- package/dist/types/components/motion/index.type.d.ts +4 -3
- package/dist/types/components/native-select/native-select.d.ts +0 -1
- package/dist/types/components/native-select/use-native-select.d.ts +1 -0
- package/dist/types/components/notice/use-notice.d.ts +0 -1
- package/dist/types/components/number-input/number-input.d.ts +0 -1
- package/dist/types/components/pagination/pagination.d.ts +0 -1
- package/dist/types/components/password-input/password-input.d.ts +0 -1
- package/dist/types/components/prose/index.d.ts +3 -0
- package/dist/types/components/prose/prose.d.ts +17 -0
- package/dist/types/components/prose/prose.style.d.ts +121 -0
- package/dist/types/components/rating/rating.d.ts +1 -0
- package/dist/types/components/reorder/use-reorder.d.ts +1 -1
- package/dist/types/components/select/select.d.ts +0 -1
- package/dist/types/components/sidebar/sidebar.d.ts +0 -2
- package/dist/types/components/sidebar/sidebar.style.d.ts +1 -0
- package/dist/types/components/snacks/use-snacks.d.ts +1 -1
- package/dist/types/components/table/table.d.ts +0 -1
- package/dist/types/components/tree/tree.d.ts +0 -1
- package/dist/types/core/components/create-component.d.ts +1 -0
- package/dist/types/core/components/index.type.d.ts +4 -2
- package/dist/types/core/components/props.d.ts +1 -0
- package/dist/types/core/components/use-component-style.d.ts +1 -0
- package/dist/types/core/css/conditions.d.ts +10 -10
- package/dist/types/core/css/styles.d.ts +36 -16
- package/dist/types/core/system/breakpoint.d.ts +1 -0
- package/dist/types/core/system/config.d.ts +1 -0
- package/dist/types/core/system/create-system.d.ts +1 -0
- package/dist/types/core/system/factory.d.ts +1 -0
- package/dist/types/core/system/index.type.d.ts +1 -0
- package/dist/types/core/system/system-provider.d.ts +1 -0
- package/dist/types/hooks/use-async/index.d.ts +1 -0
- package/dist/types/hooks/use-async-callback/index.d.ts +1 -1
- package/dist/types/hooks/use-controllable-state/index.d.ts +1 -0
- package/dist/types/hooks/use-descendants/index.d.ts +1 -0
- package/dist/types/hooks/use-eye-dropper/index.d.ts +1 -0
- package/dist/types/hooks/use-popper/index.d.ts +1 -0
- package/dist/types/hooks/use-window-event/index.d.ts +1 -0
- package/dist/types/index.d.ts +103 -54
- package/dist/types/providers/i18n-provider/i18n-cache.d.ts +1 -0
- package/dist/types/providers/i18n-provider/icu.type.d.ts +1 -0
- package/dist/types/utils/children.d.ts +11 -2
- package/dist/types/utils/context.d.ts +1 -0
- package/dist/types/utils/dom.d.ts +1 -0
- package/dist/types/utils/index.d.ts +3 -3
- package/dist/types/utils/store.d.ts +1 -0
- package/package.json +21 -18
- package/dist/cjs/components/icon/icons/music-icon.cjs +0 -14
- package/dist/cjs/components/icon/icons/music-icon.cjs.map +0 -1
- package/dist/cjs/components/icon/icons/music2-icon.cjs +0 -14
- package/dist/cjs/components/icon/icons/music2-icon.cjs.map +0 -1
- package/dist/cjs/components/icon/icons/music3-icon.cjs +0 -14
- package/dist/cjs/components/icon/icons/music3-icon.cjs.map +0 -1
- package/dist/cjs/components/icon/icons/music4-icon.cjs +0 -14
- package/dist/cjs/components/icon/icons/music4-icon.cjs.map +0 -1
- package/dist/esm/components/icon/icons/music-icon.js +0 -14
- package/dist/esm/components/icon/icons/music-icon.js.map +0 -1
- package/dist/esm/components/icon/icons/music2-icon.js +0 -14
- package/dist/esm/components/icon/icons/music2-icon.js.map +0 -1
- package/dist/esm/components/icon/icons/music3-icon.js +0 -14
- package/dist/esm/components/icon/icons/music3-icon.js.map +0 -1
- package/dist/esm/components/icon/icons/music4-icon.js +0 -14
- package/dist/esm/components/icon/icons/music4-icon.js.map +0 -1
- package/dist/types/components/icon/icons/music2-icon.d.ts +0 -12
- package/dist/types/components/icon/icons/music3-icon.d.ts +0 -12
- package/dist/types/components/icon/icons/music4-icon.d.ts +0 -12
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from \"./core\"\nexport * from \"./theme\"\nexport * from \"./utils\"\n\nexport * from \"./components/accordion\"\nexport * from \"./components/action-bar\"\nexport * from \"./components/airy\"\nexport * from \"./components/alert\"\nexport * from \"./components/alpha-slider\"\nexport * from \"./components/aspect-ratio\"\nexport * from \"./components/autocomplete\"\nexport * from \"./components/avatar\"\nexport * from \"./components/badge\"\nexport * from \"./components/bleed\"\nexport * from \"./components/blockquote\"\nexport * from \"./components/box\"\nexport * from \"./components/breadcrumb\"\nexport * from \"./components/button\"\nexport * from \"./components/calendar\"\nexport * from \"./components/card\"\nexport * from \"./components/carousel\"\nexport * from \"./components/center\"\nexport * from \"./components/chart\"\nexport * from \"./components/checkbox\"\nexport * from \"./components/checkbox-card\"\nexport * from \"./components/circle-progress\"\nexport * from \"./components/client-only\"\nexport * from \"./components/close-button\"\nexport * from \"./components/code\"\nexport * from \"./components/collapse\"\nexport * from \"./components/color-picker\"\nexport * from \"./components/color-selector\"\nexport * from \"./components/color-swatch\"\nexport * from \"./components/container\"\nexport * from \"./components/data-list\"\nexport * from \"./components/date-picker\"\nexport * from \"./components/drawer\"\nexport * from \"./components/dropzone\"\nexport * from \"./components/editable\"\nexport * from \"./components/em\"\nexport * from \"./components/empty-state\"\nexport * from \"./components/fade\"\nexport * from \"./components/fade-scale\"\nexport * from \"./components/field\"\nexport * from \"./components/fieldset\"\nexport * from \"./components/file-button\"\nexport * from \"./components/file-input\"\nexport * from \"./components/flex\"\nexport * from \"./components/flip\"\nexport * from \"./components/float\"\nexport * from \"./components/focus-lock\"\nexport * from \"./components/for\"\nexport * from \"./components/form\"\nexport * from \"./components/format\"\nexport * from \"./components/grid\"\nexport * from \"./components/group\"\nexport * from \"./components/heading\"\nexport * from \"./components/highlight\"\nexport * from \"./components/hue-slider\"\nexport * from \"./components/icon\"\nexport * from \"./components/image\"\nexport * from \"./components/indicator\"\nexport * from \"./components/infinite-scroll-area\"\nexport * from \"./components/input\"\nexport * from \"./components/kbd\"\nexport * from \"./components/link\"\nexport * from \"./components/link-box\"\nexport * from \"./components/list\"\nexport * from \"./components/loading\"\nexport * from \"./components/mark\"\nexport * from \"./components/menu\"\nexport * from \"./components/modal\"\nexport * from \"./components/motion\"\nexport * from \"./components/native-accordion\"\nexport * from \"./components/native-popover\"\nexport * from \"./components/native-select\"\nexport * from \"./components/native-table\"\nexport * from \"./components/notice\"\nexport * from \"./components/number-input\"\nexport * from \"./components/pagination\"\nexport * from \"./components/password-input\"\nexport * from \"./components/picture\"\nexport * from \"./components/pin-input\"\nexport * from \"./components/popover\"\nexport * from \"./components/portal\"\nexport * from \"./components/progress\"\nexport * from \"./components/qr-code\"\nexport * from \"./components/radio\"\nexport * from \"./components/radio-card\"\nexport * from \"./components/rating\"\nexport * from \"./components/reorder\"\nexport * from \"./components/resizable\"\nexport * from \"./components/ripple\"\nexport * from \"./components/rotate\"\nexport * from \"./components/saturation-slider\"\nexport * from \"./components/scroll-area\"\nexport * from \"./components/segmented-control\"\nexport * from \"./components/select\"\nexport * from \"./components/separator\"\nexport * from \"./components/show\"\nexport * from \"./components/sidebar\"\nexport * from \"./components/simple-grid\"\nexport * from \"./components/skeleton\"\nexport * from \"./components/slide\"\nexport * from \"./components/slide-fade\"\nexport * from \"./components/slider\"\nexport * from \"./components/slot\"\nexport * from \"./components/snacks\"\nexport * from \"./components/stack\"\nexport * from \"./components/stat\"\nexport * from \"./components/status\"\nexport * from \"./components/steps\"\nexport * from \"./components/switch\"\nexport * from \"./components/table\"\nexport * from \"./components/tabs\"\nexport * from \"./components/tag\"\nexport * from \"./components/text\"\nexport * from \"./components/textarea\"\nexport * from \"./components/timeline\"\nexport * from \"./components/tip\"\nexport * from \"./components/toggle\"\nexport * from \"./components/tooltip\"\nexport * from \"./components/tree\"\nexport * from \"./components/visually-hidden\"\nexport * from \"./components/wrap\"\n\nexport * from \"./hooks/use-animation\"\nexport * from \"./hooks/use-async\"\nexport * from \"./hooks/use-async-callback\"\nexport * from \"./hooks/use-boolean\"\nexport * from \"./hooks/use-breakpoint\"\nexport * from \"./hooks/use-clickable\"\nexport * from \"./hooks/use-clipboard\"\nexport * from \"./hooks/use-combobox\"\nexport * from \"./hooks/use-controllable-state\"\nexport * from \"./hooks/use-counter\"\nexport * from \"./hooks/use-descendants\"\nexport * from \"./hooks/use-disclosure\"\nexport * from \"./hooks/use-event-listener\"\nexport * from \"./hooks/use-eye-dropper\"\nexport * from \"./hooks/use-field-sizing\"\nexport * from \"./hooks/use-focus\"\nexport * from \"./hooks/use-hover\"\nexport * from \"./hooks/use-idle\"\nexport * from \"./hooks/use-interval\"\nexport * from \"./hooks/use-lazy-mount\"\nexport * from \"./hooks/use-local-storage\"\nexport * from \"./hooks/use-media-query\"\nexport * from \"./hooks/use-mounted\"\nexport * from \"./hooks/use-online\"\nexport * from \"./hooks/use-os\"\nexport * from \"./hooks/use-outside-click\"\nexport * from \"./hooks/use-pan-event\"\nexport * from \"./hooks/use-popper\"\nexport * from \"./hooks/use-previous\"\nexport * from \"./hooks/use-processing\"\nexport * from \"./hooks/use-resize-observer\"\nexport * from \"./hooks/use-timeout\"\nexport * from \"./hooks/use-value\"\nexport * from \"./hooks/use-window-event\"\n\nexport * from \"./providers/i18n-provider\"\nexport * from \"./providers/ui-provider\"\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from \"./core\"\nexport * from \"./theme\"\nexport * from \"./utils\"\n\nexport * from \"./components/accordion\"\nexport * from \"./components/action-bar\"\nexport * from \"./components/airy\"\nexport * from \"./components/alert\"\nexport * from \"./components/alpha-slider\"\nexport * from \"./components/aspect-ratio\"\nexport * from \"./components/autocomplete\"\nexport * from \"./components/avatar\"\nexport * from \"./components/badge\"\nexport * from \"./components/bleed\"\nexport * from \"./components/blockquote\"\nexport * from \"./components/box\"\nexport * from \"./components/breadcrumb\"\nexport * from \"./components/bubble\"\nexport * from \"./components/button\"\nexport * from \"./components/calendar\"\nexport * from \"./components/card\"\nexport * from \"./components/carousel\"\nexport * from \"./components/center\"\nexport * from \"./components/chart\"\nexport * from \"./components/checkbox\"\nexport * from \"./components/checkbox-card\"\nexport * from \"./components/circle-progress\"\nexport * from \"./components/client-only\"\nexport * from \"./components/close-button\"\nexport * from \"./components/code\"\nexport * from \"./components/collapse\"\nexport * from \"./components/color-picker\"\nexport * from \"./components/color-selector\"\nexport * from \"./components/color-swatch\"\nexport * from \"./components/container\"\nexport * from \"./components/data-list\"\nexport * from \"./components/date-picker\"\nexport * from \"./components/drawer\"\nexport * from \"./components/dropzone\"\nexport * from \"./components/editable\"\nexport * from \"./components/em\"\nexport * from \"./components/empty-state\"\nexport * from \"./components/fade\"\nexport * from \"./components/fade-scale\"\nexport * from \"./components/field\"\nexport * from \"./components/fieldset\"\nexport * from \"./components/file-button\"\nexport * from \"./components/file-input\"\nexport * from \"./components/flex\"\nexport * from \"./components/flip\"\nexport * from \"./components/float\"\nexport * from \"./components/focus-lock\"\nexport * from \"./components/for\"\nexport * from \"./components/form\"\nexport * from \"./components/format\"\nexport * from \"./components/grid\"\nexport * from \"./components/group\"\nexport * from \"./components/heading\"\nexport * from \"./components/highlight\"\nexport * from \"./components/hue-slider\"\nexport * from \"./components/icon\"\nexport * from \"./components/image\"\nexport * from \"./components/indicator\"\nexport * from \"./components/infinite-scroll-area\"\nexport * from \"./components/input\"\nexport * from \"./components/kbd\"\nexport * from \"./components/link\"\nexport * from \"./components/link-box\"\nexport * from \"./components/list\"\nexport * from \"./components/loading\"\nexport * from \"./components/mark\"\nexport * from \"./components/marquee\"\nexport * from \"./components/menu\"\nexport * from \"./components/modal\"\nexport * from \"./components/motion\"\nexport * from \"./components/native-accordion\"\nexport * from \"./components/native-popover\"\nexport * from \"./components/native-select\"\nexport * from \"./components/native-table\"\nexport * from \"./components/notice\"\nexport * from \"./components/number-input\"\nexport * from \"./components/pagination\"\nexport * from \"./components/password-input\"\nexport * from \"./components/picture\"\nexport * from \"./components/pin-input\"\nexport * from \"./components/popover\"\nexport * from \"./components/portal\"\nexport * from \"./components/progress\"\nexport * from \"./components/prose\"\nexport * from \"./components/qr-code\"\nexport * from \"./components/radio\"\nexport * from \"./components/radio-card\"\nexport * from \"./components/rating\"\nexport * from \"./components/reorder\"\nexport * from \"./components/resizable\"\nexport * from \"./components/ripple\"\nexport * from \"./components/rotate\"\nexport * from \"./components/saturation-slider\"\nexport * from \"./components/scroll-area\"\nexport * from \"./components/segmented-control\"\nexport * from \"./components/select\"\nexport * from \"./components/separator\"\nexport * from \"./components/show\"\nexport * from \"./components/sidebar\"\nexport * from \"./components/simple-grid\"\nexport * from \"./components/skeleton\"\nexport * from \"./components/slide\"\nexport * from \"./components/slide-fade\"\nexport * from \"./components/slider\"\nexport * from \"./components/slot\"\nexport * from \"./components/snacks\"\nexport * from \"./components/stack\"\nexport * from \"./components/stat\"\nexport * from \"./components/status\"\nexport * from \"./components/steps\"\nexport * from \"./components/switch\"\nexport * from \"./components/table\"\nexport * from \"./components/tabs\"\nexport * from \"./components/tag\"\nexport * from \"./components/text\"\nexport * from \"./components/textarea\"\nexport * from \"./components/timeline\"\nexport * from \"./components/tip\"\nexport * from \"./components/toggle\"\nexport * from \"./components/tooltip\"\nexport * from \"./components/tree\"\nexport * from \"./components/visually-hidden\"\nexport * from \"./components/wrap\"\n\nexport * from \"./hooks/use-animation\"\nexport * from \"./hooks/use-async\"\nexport * from \"./hooks/use-async-callback\"\nexport * from \"./hooks/use-boolean\"\nexport * from \"./hooks/use-breakpoint\"\nexport * from \"./hooks/use-clickable\"\nexport * from \"./hooks/use-clipboard\"\nexport * from \"./hooks/use-combobox\"\nexport * from \"./hooks/use-controllable-state\"\nexport * from \"./hooks/use-counter\"\nexport * from \"./hooks/use-descendants\"\nexport * from \"./hooks/use-disclosure\"\nexport * from \"./hooks/use-event-listener\"\nexport * from \"./hooks/use-eye-dropper\"\nexport * from \"./hooks/use-field-sizing\"\nexport * from \"./hooks/use-focus\"\nexport * from \"./hooks/use-hover\"\nexport * from \"./hooks/use-idle\"\nexport * from \"./hooks/use-interval\"\nexport * from \"./hooks/use-lazy-mount\"\nexport * from \"./hooks/use-local-storage\"\nexport * from \"./hooks/use-media-query\"\nexport * from \"./hooks/use-mounted\"\nexport * from \"./hooks/use-online\"\nexport * from \"./hooks/use-os\"\nexport * from \"./hooks/use-outside-click\"\nexport * from \"./hooks/use-pan-event\"\nexport * from \"./hooks/use-popper\"\nexport * from \"./hooks/use-previous\"\nexport * from \"./hooks/use-processing\"\nexport * from \"./hooks/use-resize-observer\"\nexport * from \"./hooks/use-timeout\"\nexport * from \"./hooks/use-value\"\nexport * from \"./hooks/use-window-event\"\n\nexport * from \"./providers/i18n-provider\"\nexport * from \"./providers/ui-provider\"\n"],"mappings":""}
|
|
@@ -4,11 +4,8 @@ react = require_runtime.__toESM(react, 1);
|
|
|
4
4
|
let _yamada_ui_utils = require("@yamada-ui/utils");
|
|
5
5
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
6
|
//#region src/utils/children.tsx
|
|
7
|
-
function
|
|
8
|
-
return
|
|
9
|
-
}
|
|
10
|
-
function useValidChildren(children) {
|
|
11
|
-
return react.useMemo(() => getValidChildren(children), [children]);
|
|
7
|
+
function isLazy(value) {
|
|
8
|
+
return (0, _yamada_ui_utils.isObject)(value) && "$$typeof" in value && value.$$typeof === Symbol.for("react.lazy");
|
|
12
9
|
}
|
|
13
10
|
function isValidElement(child) {
|
|
14
11
|
return react.isValidElement(child) || (0, _yamada_ui_utils.isString)(child) || (0, _yamada_ui_utils.isNumber)(child);
|
|
@@ -37,6 +34,19 @@ function isSomeElement(a, b) {
|
|
|
37
34
|
if (isSomeDisplayName(a, b)) return true;
|
|
38
35
|
return false;
|
|
39
36
|
}
|
|
37
|
+
function getResolvedChild(value) {
|
|
38
|
+
while (isLazy(value)) {
|
|
39
|
+
const { _init, _payload } = value;
|
|
40
|
+
value = _init(_payload);
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
function getValidChildren(children) {
|
|
45
|
+
return react.Children.toArray(children).filter((child) => react.isValidElement(child));
|
|
46
|
+
}
|
|
47
|
+
function useValidChildren(children) {
|
|
48
|
+
return react.useMemo(() => getValidChildren(children), [children]);
|
|
49
|
+
}
|
|
40
50
|
function findChild(children, ...types) {
|
|
41
51
|
return children.find((child) => types.some((type) => isSomeElement(child.type, type)));
|
|
42
52
|
}
|
|
@@ -99,21 +109,24 @@ function useSplitChildren(children, ...types) {
|
|
|
99
109
|
return react.useMemo(() => splitChildren(children, ...typesRef.current), [children]);
|
|
100
110
|
}
|
|
101
111
|
const wrapOrPassProps = (Component, nodeOrProps, additionalProps) => {
|
|
102
|
-
|
|
103
|
-
|
|
112
|
+
const resolved = getResolvedChild(nodeOrProps);
|
|
113
|
+
if ((0, _yamada_ui_utils.isUndefined)(resolved)) return null;
|
|
114
|
+
else if (isValidElement(resolved)) {
|
|
104
115
|
additionalProps ??= {};
|
|
105
|
-
additionalProps.children =
|
|
116
|
+
additionalProps.children = resolved;
|
|
106
117
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, { ...additionalProps });
|
|
107
118
|
} else return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
|
|
108
119
|
...additionalProps,
|
|
109
|
-
...
|
|
120
|
+
...resolved
|
|
110
121
|
});
|
|
111
122
|
};
|
|
112
123
|
//#endregion
|
|
113
124
|
exports.findChild = findChild;
|
|
114
125
|
exports.findChildren = findChildren;
|
|
126
|
+
exports.getResolvedChild = getResolvedChild;
|
|
115
127
|
exports.getValidChildren = getValidChildren;
|
|
116
128
|
exports.includesChildren = includesChildren;
|
|
129
|
+
exports.isLazy = isLazy;
|
|
117
130
|
exports.isSomeDisplayName = isSomeDisplayName;
|
|
118
131
|
exports.isSomeElement = isSomeElement;
|
|
119
132
|
exports.isValidElement = isValidElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"children.cjs","names":["React","isString","isNumber","isUndefined","isArray","isEmpty"],"sources":["../../../src/utils/children.tsx"],"sourcesContent":["import {\n isArray,\n isEmpty,\n isNumber,\n isString,\n isUndefined,\n} from \"@yamada-ui/utils\"\nimport * as React from \"react\"\n\nexport function getValidChildren(\n children: React.ReactNode,\n): React.ReactElement<any>[] {\n return React.Children.toArray(children).filter((child) =>\n React.isValidElement(child),\n )\n}\n\nexport function useValidChildren(children: React.ReactNode) {\n return React.useMemo(() => getValidChildren(children), [children])\n}\n\nexport function isValidElement(child: any): child is React.ReactNode {\n return React.isValidElement(child) || isString(child) || isNumber(child)\n}\n\nexport function isSomeDisplayName(a: any, b: any): boolean {\n if (isUndefined(a) || isUndefined(b)) return false\n\n if (isArray(a)) {\n if (a.includes(b)) return true\n if (!!b.displayName && a.includes(b.displayName)) return true\n if (!!b.name && a.includes(b.name)) return true\n } else {\n if (a === b) return true\n if (!!a.displayName && !!b.displayName && a.displayName === b.displayName)\n return true\n if (!!a.name && !!b.name && a.name === b.name) return true\n if (!!a.displayName && !!b.name && a.displayName === b.name) return true\n if (!!a.name && !!b.displayName && a.name === b.displayName) return true\n }\n\n return false\n}\n\nexport function isSomeElement(a: any, b: any): boolean {\n if (isUndefined(a) || isUndefined(b)) return false\n if (a === b) return true\n if (isSomeDisplayName(a, b)) return true\n\n a = a._payload?.value\n\n if (isUndefined(a)) return false\n if (isSomeDisplayName(a, b)) return true\n\n return false\n}\n\nexport function findChild<Y = any>(\n children: React.ReactElement[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): React.ReactElement<Y> | undefined {\n const child = children.find((child) =>\n types.some((type) => isSomeElement(child.type, type)),\n )\n\n return child as React.ReactElement<Y> | undefined\n}\n\nexport function useFindChild<Y = any>(\n children: React.ReactElement[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): React.ReactElement<Y> | undefined {\n const typesRef = React.useRef(types)\n\n return React.useMemo(\n () => findChild<Y>(children, ...typesRef.current),\n [children],\n )\n}\n\nexport function findChildren<Y = any, M = any>(\n children: React.ReactElement[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): [React.ReactElement<Y> | undefined, ...React.ReactElement<M>[]] {\n const child = findChild(children, ...types)\n\n if (child)\n return children.sort((a, b) => {\n if (types.some((type) => isSomeElement(a.type, type))) return -1\n else if (types.some((type) => isSomeElement(b.type, type))) return 1\n else return 0\n }) as [React.ReactElement<Y> | undefined, ...React.ReactElement<M>[]]\n else return [undefined, ...(children as React.ReactElement<M>[])]\n}\n\nexport function useFindChildren<Y = any, M = any>(\n children: React.ReactElement<M>[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): [React.ReactElement<Y> | undefined, ...React.ReactElement<M>[]] {\n const typesRef = React.useRef(types)\n\n return React.useMemo(\n () => findChildren<Y, M>(children, ...typesRef.current),\n [children],\n )\n}\n\nexport function includesChildren(\n children: React.ReactElement<any>[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): boolean {\n return children.some((child) => {\n if (types.some((type) => isSomeElement(child.type, type))) return true\n\n const children = getValidChildren(child.props.children)\n\n return children.length ? includesChildren(children, ...types) : false\n })\n}\n\nexport function useIncludesChildren(\n children: React.ReactElement<any>[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): boolean {\n return React.useMemo(\n () => includesChildren(children, ...types),\n [children, types],\n )\n}\n\nexport function omitChildren<Y = any>(\n children: React.ReactElement[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): React.ReactElement<Y>[] {\n return children.filter((child) =>\n types.every((type) => !isSomeElement(child.type, type)),\n ) as React.ReactElement<Y>[]\n}\n\nexport function useOmitChildren<Y = any>(\n children: React.ReactElement<any>[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): React.ReactElement<Y>[] {\n const typesRef = React.useRef(types)\n\n return React.useMemo(\n () => omitChildren<Y>(children, ...typesRef.current),\n [children],\n )\n}\n\nexport function pickChildren<Y = any>(\n children: React.ReactElement[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): React.ReactElement<Y>[] {\n return children.filter((child) =>\n types.some((type) => isSomeElement(child.type, type)),\n ) as React.ReactElement<Y>[]\n}\n\nexport function usePickChildren<Y = any>(\n children: React.ReactElement<any>[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): React.ReactElement<Y>[] {\n const typesRef = React.useRef(types)\n\n return React.useMemo(\n () => pickChildren<Y>(children, ...typesRef.current),\n [children],\n )\n}\n\nexport function splitChildren<Y = any, M = any>(\n children: React.ReactNode,\n ...types: (\n | (React.JSXElementConstructor<any> | string)[]\n | React.JSXElementConstructor<any>\n | string\n )[]\n): [\n React.ReactElement<M>[] | React.ReactNode,\n ...(React.ReactElement<Y>[] | undefined)[],\n] {\n const validChildren = getValidChildren(children)\n\n if (isEmpty(validChildren)) return [children]\n\n const pickedChildren = types.map((types) => {\n if (isArray(types)) {\n const pickedChildren = pickChildren(validChildren, ...types)\n\n return !isEmpty(pickedChildren) ? pickedChildren : undefined\n } else {\n const pickedChildren = pickChildren(validChildren, types)\n\n return !isEmpty(pickedChildren) ? pickedChildren : undefined\n }\n })\n\n const omittedChildren = omitChildren(validChildren, ...types.flat())\n\n return [omittedChildren, ...pickedChildren] as const\n}\n\nexport function useSplitChildren<Y = any, M = any>(\n children: React.ReactNode,\n ...types: (\n | (React.JSXElementConstructor<any> | string)[]\n | React.JSXElementConstructor<any>\n | string\n )[]\n): [\n React.ReactElement<M>[] | React.ReactNode,\n ...(React.ReactElement<Y>[] | undefined)[],\n] {\n const typesRef = React.useRef(types)\n\n return React.useMemo(\n () => splitChildren<Y, M>(children, ...typesRef.current),\n [children],\n )\n}\n\nexport const wrapOrPassProps = <Y extends React.PropsWithChildren>(\n Component: React.FC<Y>,\n nodeOrProps: React.ReactNode | Y,\n additionalProps?: Y,\n) => {\n if (isUndefined(nodeOrProps)) {\n return null\n } else if (isValidElement(nodeOrProps)) {\n additionalProps ??= {} as Y\n additionalProps.children = nodeOrProps\n\n return <Component {...additionalPro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AO;GACL,MAAM,iBAAiB,aAAa,eAAe,KAAK;GAExD,OAAO,EAAA,GAACA,iBAAAA,QAAAA,CAAQ,cAAc,IAAI,iBAAiB,KAAA;EACrD;CACF,CAAC;CAID,OAAO,CAFiB,aAAa,eAAe,GAAG,MAAM,KAAK,CAE5C,GAAG,GAAG,cAAc;AAC5C;AAEA,SAAgB,iBACd,UACA,GAAG,OAQH;CACA,MAAM,WAAWL,MAAM,OAAO,KAAK;CAEnC,OAAOA,MAAM,cACL,cAAoB,UAAU,GAAG,SAAS,OAAO,GACvD,CAAC,QAAQ,CACX;AACF;AAEA,MAAa,mBACX,WACA,aACA,oBACG;CACH,KAAA,GAAIG,iBAAAA,YAAAA,CAAY,WAAW,GACzB,OAAO;MACF,IAAI,eAAe,WAAW,GAAG;EACtC,oBAAoB,CAAC;EACrB,gBAAgB,WAAW;EAE3B,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAD,EAAW,GAAI,gBAAkB,CAAA;CAC1C,OACE,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAD;EAAW,GAAI;EAAiB,GAAI;CAAc,CAAA;AAE7D"}
|
|
1
|
+
{"version":3,"file":"children.cjs","names":["isObject","React","isString","isNumber","isUndefined","isArray","isEmpty"],"sources":["../../../src/utils/children.tsx"],"sourcesContent":["import {\n isArray,\n isEmpty,\n isNumber,\n isObject,\n isString,\n isUndefined,\n} from \"@yamada-ui/utils\"\nimport * as React from \"react\"\n\nexport function isLazy(value: unknown): value is {\n $$typeof: symbol\n _payload: unknown\n _init: (payload: unknown) => unknown\n} {\n return (\n isObject(value) &&\n \"$$typeof\" in value &&\n value.$$typeof === Symbol.for(\"react.lazy\")\n )\n}\n\nexport function isValidElement(child: any): child is React.ReactNode {\n return React.isValidElement(child) || isString(child) || isNumber(child)\n}\n\nexport function isSomeDisplayName(a: any, b: any): boolean {\n if (isUndefined(a) || isUndefined(b)) return false\n\n if (isArray(a)) {\n if (a.includes(b)) return true\n if (!!b.displayName && a.includes(b.displayName)) return true\n if (!!b.name && a.includes(b.name)) return true\n } else {\n if (a === b) return true\n if (!!a.displayName && !!b.displayName && a.displayName === b.displayName)\n return true\n if (!!a.name && !!b.name && a.name === b.name) return true\n if (!!a.displayName && !!b.name && a.displayName === b.name) return true\n if (!!a.name && !!b.displayName && a.name === b.displayName) return true\n }\n\n return false\n}\n\nexport function isSomeElement(a: any, b: any): boolean {\n if (isUndefined(a) || isUndefined(b)) return false\n if (a === b) return true\n if (isSomeDisplayName(a, b)) return true\n\n a = a._payload?.value\n\n if (isUndefined(a)) return false\n if (isSomeDisplayName(a, b)) return true\n\n return false\n}\n\nexport function getResolvedChild(value: React.ReactNode): React.ReactNode\nexport function getResolvedChild<Y>(\n value: Y,\n): Y extends { $$typeof: symbol } ? unknown : Y\nexport function getResolvedChild(value: unknown): unknown {\n while (isLazy(value)) {\n const { _init, _payload } = value\n\n value = _init(_payload)\n }\n\n return value\n}\n\nexport function getValidChildren(\n children: React.ReactNode,\n): React.ReactElement<any>[] {\n return React.Children.toArray(children).filter((child) =>\n React.isValidElement(child),\n )\n}\n\nexport function useValidChildren(children: React.ReactNode) {\n return React.useMemo(() => getValidChildren(children), [children])\n}\n\nexport function findChild<Y = any>(\n children: React.ReactElement[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): React.ReactElement<Y> | undefined {\n const child = children.find((child) =>\n types.some((type) => isSomeElement(child.type, type)),\n )\n\n return child as React.ReactElement<Y> | undefined\n}\n\nexport function useFindChild<Y = any>(\n children: React.ReactElement[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): React.ReactElement<Y> | undefined {\n const typesRef = React.useRef(types)\n\n return React.useMemo(\n () => findChild<Y>(children, ...typesRef.current),\n [children],\n )\n}\n\nexport function findChildren<Y = any, M = any>(\n children: React.ReactElement[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): [React.ReactElement<Y> | undefined, ...React.ReactElement<M>[]] {\n const child = findChild(children, ...types)\n\n if (child)\n return children.sort((a, b) => {\n if (types.some((type) => isSomeElement(a.type, type))) return -1\n else if (types.some((type) => isSomeElement(b.type, type))) return 1\n else return 0\n }) as [React.ReactElement<Y> | undefined, ...React.ReactElement<M>[]]\n else return [undefined, ...(children as React.ReactElement<M>[])]\n}\n\nexport function useFindChildren<Y = any, M = any>(\n children: React.ReactElement<M>[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): [React.ReactElement<Y> | undefined, ...React.ReactElement<M>[]] {\n const typesRef = React.useRef(types)\n\n return React.useMemo(\n () => findChildren<Y, M>(children, ...typesRef.current),\n [children],\n )\n}\n\nexport function includesChildren(\n children: React.ReactElement<any>[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): boolean {\n return children.some((child) => {\n if (types.some((type) => isSomeElement(child.type, type))) return true\n\n const children = getValidChildren(child.props.children)\n\n return children.length ? includesChildren(children, ...types) : false\n })\n}\n\nexport function useIncludesChildren(\n children: React.ReactElement<any>[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): boolean {\n return React.useMemo(\n () => includesChildren(children, ...types),\n [children, types],\n )\n}\n\nexport function omitChildren<Y = any>(\n children: React.ReactElement[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): React.ReactElement<Y>[] {\n return children.filter((child) =>\n types.every((type) => !isSomeElement(child.type, type)),\n ) as React.ReactElement<Y>[]\n}\n\nexport function useOmitChildren<Y = any>(\n children: React.ReactElement<any>[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): React.ReactElement<Y>[] {\n const typesRef = React.useRef(types)\n\n return React.useMemo(\n () => omitChildren<Y>(children, ...typesRef.current),\n [children],\n )\n}\n\nexport function pickChildren<Y = any>(\n children: React.ReactElement[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): React.ReactElement<Y>[] {\n return children.filter((child) =>\n types.some((type) => isSomeElement(child.type, type)),\n ) as React.ReactElement<Y>[]\n}\n\nexport function usePickChildren<Y = any>(\n children: React.ReactElement<any>[],\n ...types: (React.JSXElementConstructor<any> | string)[]\n): React.ReactElement<Y>[] {\n const typesRef = React.useRef(types)\n\n return React.useMemo(\n () => pickChildren<Y>(children, ...typesRef.current),\n [children],\n )\n}\n\nexport function splitChildren<Y = any, M = any>(\n children: React.ReactNode,\n ...types: (\n | (React.JSXElementConstructor<any> | string)[]\n | React.JSXElementConstructor<any>\n | string\n )[]\n): [\n React.ReactElement<M>[] | React.ReactNode,\n ...(React.ReactElement<Y>[] | undefined)[],\n] {\n const validChildren = getValidChildren(children)\n\n if (isEmpty(validChildren)) return [children]\n\n const pickedChildren = types.map((types) => {\n if (isArray(types)) {\n const pickedChildren = pickChildren(validChildren, ...types)\n\n return !isEmpty(pickedChildren) ? pickedChildren : undefined\n } else {\n const pickedChildren = pickChildren(validChildren, types)\n\n return !isEmpty(pickedChildren) ? pickedChildren : undefined\n }\n })\n\n const omittedChildren = omitChildren(validChildren, ...types.flat())\n\n return [omittedChildren, ...pickedChildren] as const\n}\n\nexport function useSplitChildren<Y = any, M = any>(\n children: React.ReactNode,\n ...types: (\n | (React.JSXElementConstructor<any> | string)[]\n | React.JSXElementConstructor<any>\n | string\n )[]\n): [\n React.ReactElement<M>[] | React.ReactNode,\n ...(React.ReactElement<Y>[] | undefined)[],\n] {\n const typesRef = React.useRef(types)\n\n return React.useMemo(\n () => splitChildren<Y, M>(children, ...typesRef.current),\n [children],\n )\n}\n\nexport const wrapOrPassProps = <Y extends React.PropsWithChildren>(\n Component: React.FC<Y>,\n nodeOrProps: React.ReactNode | Y,\n additionalProps?: Y,\n) => {\n const resolved = getResolvedChild(nodeOrProps)\n\n if (isUndefined(resolved)) {\n return null\n } else if (isValidElement(resolved)) {\n additionalProps ??= {} as Y\n additionalProps.children = resolved\n\n return <Component {...additionalProps} />\n } else {\n return <Component {...additionalProps} {...(resolved as Y)} />\n }\n}\n"],"mappings":";;;;;;AAUA,SAAgB,OAAO,OAIrB;CACA,QAAA,GACEA,iBAAAA,SAAAA,CAAS,KAAK,KACd,cAAc,SACd,MAAM,aAAa,OA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Ae,GAAG,KAAK;GAE3D,OAAO,EAAA,GAACC,iBAAAA,QAAAA,CAAQ,cAAc,IAAI,iBAAiB,KAAA;EACrD,OAAO;GACL,MAAM,iBAAiB,aAAa,eAAe,KAAK;GAExD,OAAO,EAAA,GAACA,iBAAAA,QAAAA,CAAQ,cAAc,IAAI,iBAAiB,KAAA;EACrD;CACF,CAAC;CAID,OAAO,CAFiB,aAAa,eAAe,GAAG,MAAM,KAAK,CAE5C,GAAG,GAAG,cAAc;AAC5C;AAEA,SAAgB,iBACd,UACA,GAAG,OAQH;CACA,MAAM,WAAWL,MAAM,OAAO,KAAK;CAEnC,OAAOA,MAAM,cACL,cAAoB,UAAU,GAAG,SAAS,OAAO,GACvD,CAAC,QAAQ,CACX;AACF;AAEA,MAAa,mBACX,WACA,aACA,oBACG;CACH,MAAM,WAAW,iBAAiB,WAAW;CAE7C,KAAA,GAAIG,iBAAAA,YAAAA,CAAY,QAAQ,GACtB,OAAO;MACF,IAAI,eAAe,QAAQ,GAAG;EACnC,oBAAoB,CAAC;EACrB,gBAAgB,WAAW;EAE3B,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAD,EAAW,GAAI,gBAAkB,CAAA;CAC1C,OACE,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAD;EAAW,GAAI;EAAiB,GAAK;CAAiB,CAAA;AAEjE"}
|
package/dist/cjs/utils/index.cjs
CHANGED
|
@@ -15,9 +15,11 @@ var utils_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
|
15
15
|
findChild: () => require_children.findChild,
|
|
16
16
|
findChildren: () => require_children.findChildren,
|
|
17
17
|
getEventRelatedTarget: () => require_dom.getEventRelatedTarget,
|
|
18
|
+
getResolvedChild: () => require_children.getResolvedChild,
|
|
18
19
|
getValidChildren: () => require_children.getValidChildren,
|
|
19
20
|
includesChildren: () => require_children.includesChildren,
|
|
20
21
|
isComposing: () => require_dom.isComposing,
|
|
22
|
+
isLazy: () => require_children.isLazy,
|
|
21
23
|
isRefObject: () => require_ref.isRefObject,
|
|
22
24
|
isSomeDisplayName: () => require_children.isSomeDisplayName,
|
|
23
25
|
isSomeElement: () => require_children.isSomeElement,
|
|
@@ -53,9 +55,11 @@ exports.createStore = require_store.createStore;
|
|
|
53
55
|
exports.findChild = require_children.findChild;
|
|
54
56
|
exports.findChildren = require_children.findChildren;
|
|
55
57
|
exports.getEventRelatedTarget = require_dom.getEventRelatedTarget;
|
|
58
|
+
exports.getResolvedChild = require_children.getResolvedChild;
|
|
56
59
|
exports.getValidChildren = require_children.getValidChildren;
|
|
57
60
|
exports.includesChildren = require_children.includesChildren;
|
|
58
61
|
exports.isComposing = require_dom.isComposing;
|
|
62
|
+
exports.isLazy = require_children.isLazy;
|
|
59
63
|
exports.isRefObject = require_ref.isRefObject;
|
|
60
64
|
exports.isSomeDisplayName = require_children.isSomeDisplayName;
|
|
61
65
|
exports.isSomeElement = require_children.isSomeElement;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useSplitChildren } from "../../utils/children.js";
|
|
2
|
+
import { getResolvedChild, useSplitChildren } from "../../utils/children.js";
|
|
3
3
|
import { createContext as createContext$1 } from "../../utils/context.js";
|
|
4
4
|
import { utils_exports } from "../../utils/index.js";
|
|
5
5
|
import { styled } from "../../core/system/factory.js";
|
|
@@ -121,11 +121,12 @@ const AccordionIcon = withContext(({ children = /* @__PURE__ */ jsx(ChevronDownI
|
|
|
121
121
|
const { iconHidden } = useComponentContext();
|
|
122
122
|
const { getIconProps } = useAccordionItemContext();
|
|
123
123
|
if (iconHidden) return null;
|
|
124
|
-
|
|
124
|
+
const child = getResolvedChild(children);
|
|
125
|
+
if (isValidElement(child)) return cloneElement(child, getIconProps({
|
|
125
126
|
...rest,
|
|
126
|
-
...
|
|
127
|
+
...child.props
|
|
127
128
|
}));
|
|
128
|
-
return Children.count(
|
|
129
|
+
return Children.count(child) > 1 ? Children.only(null) : null;
|
|
129
130
|
}, "icon")();
|
|
130
131
|
const AccordionPanel = withContext(({ animationOpacity, children, delay, duration, endingHeight, startingHeight, transition, transitionEnd, unmountOnExit, ...rest }) => {
|
|
131
132
|
const { open, getPanelProps } = useAccordionItemContext();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.js","names":["createContext","runIfFn","isString"],"sources":["../../../../src/components/accordion/accordion.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ReactNodeOrFunction } from \"../../utils\"\nimport type { CollapseProps } from \"../collapse\"\nimport type { WithTransitionProps } from \"../motion\"\nimport type { AccordionStyle } from \"./accordion.style\"\nimport type { UseAccordionItemProps, UseAccordionProps } from \"./use-accordion\"\nimport { Children, cloneElement, isValidElement, useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { createContext, isString, runIfFn, useSplitChildren } from \"../../utils\"\nimport { Collapse } from \"../collapse\"\nimport { ChevronDownIcon } from \"../icon\"\nimport { accordionStyle } from \"./accordion.style\"\nimport {\n AccordionContext,\n AccordionDescendantsContext,\n AccordionItemContext,\n useAccordion,\n useAccordionItem,\n useAccordionItemContext,\n} from \"./use-accordion\"\n\ninterface AccordionCallBackProps {\n disabled?: boolean\n expanded?: boolean\n}\n\nexport interface AccordionItem extends Omit<AccordionItemProps, \"index\"> {}\n\ninterface ComponentContext extends Pick<\n AccordionRootProps,\n \"icon\" | \"iconHidden\"\n> {}\n\nexport interface AccordionRootProps\n extends\n Omit<HTMLStyledProps, \"onChange\">,\n ThemeProps<AccordionStyle>,\n UseAccordionProps {\n /**\n * The accordion icon for all items to use.\n */\n icon?: ReactNodeOrFunction<AccordionCallBackProps>\n /**\n * If `true`, hide the accordion icon for all items.\n *\n * @default false\n */\n iconHidden?: boolean\n /**\n * If provided, generate elements based on items.\n */\n items?: AccordionItem[]\n}\n\ninterface ItemComponentContext extends Pick<AccordionItemProps, \"icon\"> {}\n\nconst [ItemComponentContext, useItemComponentContext] =\n createContext<ItemComponentContext>({\n name: \"ItemComponentContext\",\n })\n\nconst {\n ComponentContext,\n PropsContext: AccordionPropsContext,\n useComponentContext,\n usePropsContext: useAccordionPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<AccordionRootProps, AccordionStyle, ComponentContext>(\n \"accordion\",\n accordionStyle,\n)\n\nexport { AccordionPropsContext, useAccordionPropsContext }\n\n/**\n * `Accordion` is a component for a list that displays information in an expandable or collapsible manner.\n *\n * @see https://yamada-ui.com/docs/components/accordion\n */\nexport const AccordionRoot = withProvider<\"div\", AccordionRootProps>(\n ({ children, icon, iconHidden, items, ...props }) => {\n const {\n descendants,\n focusedIndex,\n index,\n multiple,\n setFocusedIndex,\n setIndex,\n toggle,\n getRootProps,\n } = useAccordion(props)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items?.map((props, index) => (\n <AccordionItem key={index} index={index} {...props} />\n ))\n }, [children, items])\n const context = useMemo(\n () => ({\n focusedIndex,\n index,\n multiple,\n setFocusedIndex,\n setIndex,\n toggle,\n }),\n [focusedIndex, index, multiple, setFocusedIndex, setIndex, toggle],\n )\n const componentContext = useMemo(\n () => ({ icon, iconHidden }),\n [icon, iconHidden],\n )\n\n return (\n <AccordionDescendantsContext value={descendants}>\n <AccordionContext value={context}>\n <ComponentContext value={componentContext}>\n <styled.div {...getRootProps()}>{computedChildren}</styled.div>\n </ComponentContext>\n </AccordionContext>\n </AccordionDescendantsContext>\n )\n },\n \"root\",\n)()\n\nexport interface AccordionItemProps\n extends\n Omit<HTMLStyledProps, \"children\">,\n Omit<UseAccordionItemProps, \"children\"> {\n /**\n * The accordion button to use.\n */\n button?: ReactNodeOrFunction<AccordionCallBackProps>\n /**\n * The accordion children to use.\n */\n children?: ReactNodeOrFunction<AccordionCallBackProps>\n /**\n * The accordion icon to use.\n */\n icon?: ReactNodeOrFunction<AccordionCallBackProps>\n}\n\nexport const AccordionItem = withContext<\"div\", AccordionItemProps>(\n ({ button, children, icon, ...rest }) => {\n const {\n disabled,\n open,\n getButtonProps,\n getIconProps,\n getItemProps,\n getPanelProps,\n } = useAccordionItem(rest)\n const computedChildren = useMemo(\n () => runIfFn(children, { disabled, expanded: open }),\n [children, disabled, open],\n )\n const [omittedChildren, customAccordionButton, customAccordionPanel] =\n useSplitChildren(computedChildren, AccordionButton, AccordionPanel)\n const context = useMemo(\n () => ({\n disabled,\n icon,\n open,\n getButtonProps,\n getIconProps,\n getPanelProps,\n }),\n [disabled, getButtonProps, getPanelProps, getIconProps, icon, open],\n )\n const componentContext = useMemo(() => ({ icon }), [icon])\n\n return (\n <AccordionItemContext value={context}>\n <ItemComponentContext value={componentContext}>\n <styled.div {...getItemProps()}>\n {customAccordionButton ?? (\n <AccordionButton>\n {runIfFn(button, { disabled, expanded: open })}\n </AccordionButton>\n )}\n {customAccordionPanel ?? (\n <AccordionPanel>{omittedChildren}</AccordionPanel>\n )}\n </styled.div>\n </ItemComponentContext>\n </AccordionItemContext>\n )\n },\n \"item\",\n)()\n\nexport interface AccordionButtonProps extends HTMLStyledProps<\"button\"> {\n /**\n * The accordion icon to use.\n */\n icon?: ReactNodeOrFunction<AccordionCallBackProps>\n /**\n * Props the container element.\n */\n containerProps?: HTMLStyledProps\n}\n\nexport const AccordionButton = withContext<\"button\", AccordionButtonProps>(\n ({ children, icon: customIcon, containerProps, ...rest }) => {\n const { icon: rootIcon } = useComponentContext()\n const { icon: itemIcon } = useItemComponentContext()\n const { disabled, open, getButtonProps } = useAccordionItemContext()\n const props = { disabled, expanded: open }\n\n return (\n <styled.h3 {...containerProps}>\n <styled.button {...getButtonProps(rest)}>\n {children}\n\n <AccordionIcon>\n {runIfFn(customIcon, props) ??\n runIfFn(itemIcon, props) ??\n runIfFn(rootIcon, props)}\n </AccordionIcon>\n </styled.button>\n </styled.h3>\n )\n },\n \"button\",\n)()\n\ninterface AccordionIconProps extends HTMLStyledProps<\"svg\"> {}\n\nexport const AccordionIcon = withContext<\"svg\", AccordionIconProps>(\n ({ children = <ChevronDownIcon />, ...rest }) => {\n const { iconHidden } = useComponentContext()\n const { getIconProps } = useAccordionItemContext()\n\n if (iconHidden) return null\n\n if (isValidElement<HTMLProps<\"svg\">>(children))\n return cloneElement(\n children,\n getIconProps({\n ...rest,\n ...children.props,\n }),\n )\n\n return Children.count(children) > 1 ? Children.only(null) : null\n },\n \"icon\",\n)()\n\nexport interface AccordionPanelProps\n extends\n Omit<HTMLStyledProps, \"transition\">,\n Pick<\n CollapseProps,\n | \"animationOpacity\"\n | \"endingHeight\"\n | \"startingHeight\"\n | keyof WithTransitionProps\n > {}\n\nexport const AccordionPanel = withContext<\"div\", AccordionPanelProps>(\n ({\n animationOpacity,\n children,\n delay,\n duration,\n endingHeight,\n startingHeight,\n transition,\n transitionEnd,\n unmountOnExit,\n ...rest\n }) => {\n const { open, getPanelProps } = useAccordionItemContext()\n\n return (\n <Collapse\n {...{\n animationOpacity,\n delay,\n duration,\n endingHeight,\n open,\n startingHeight,\n transition,\n transitionEnd,\n unmountOnExit,\n }}\n >\n <styled.div {...getPanelProps(rest)}>\n {isString(children) ? <styled.p>{children}</styled.p> : children}\n </styled.div>\n </Collapse>\n )\n },\n \"panel\",\n)()\n"],"mappings":";;;;;;;;;;;;;AA0DA,MAAM,CAAC,sBAAsB,2BAC3BA,gBAAoC,EAClC,MAAM,uBACR,CAAC;AAEH,MAAM,EACJ,kBACA,cAAc,uBACd,qBACA,iBAAiB,0BACjB,aACA,iBACE,oBACF,aACA,cACF;;;;;;AASA,MAAa,gBAAgB,cAC1B,EAAE,UAAU,MAAM,YAAY,OAAO,GAAG,YAAY;CACnD,MAAM,EACJ,aACA,cACA,OACA,UACA,iBACA,UACA,QACA,iBACE,aAAa,KAAK;CACtB,MAAM,mBAAmB,cAAc;EACrC,IAAI,UAAU,OAAO;EAErB,OAAO,OAAO,KAAK,OAAO,UACxB,oBAAC,eAAD;GAAkC;GAAO,GAAI;EAAQ,GAAjC,KAAiC,CACtD;CACH,GAAG,CAAC,UAAU,KAA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A;EACA;EACA;EACA;EAGF,UAAA,oBAAC,OAAO,KAAR;GAAY,GAAI,cAAc,IAAI;GAC/BC,WAAAA,GAAAA,cAAAA,SAAAA,CAAS,QAAQ,IAAI,oBAAC,OAAO,GAAR,EAAW,SAAmB,CAAA,IAAI;EAC9C,CAAA;CACJ,CAAA;AAEd,GACA,OACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"accordion.js","names":["createContext","runIfFn","isString"],"sources":["../../../../src/components/accordion/accordion.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ReactNodeOrFunction } from \"../../utils\"\nimport type { CollapseProps } from \"../collapse\"\nimport type { WithTransitionProps } from \"../motion\"\nimport type { AccordionStyle } from \"./accordion.style\"\nimport type { UseAccordionItemProps, UseAccordionProps } from \"./use-accordion\"\nimport { Children, cloneElement, isValidElement, useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport {\n createContext,\n getResolvedChild,\n isString,\n runIfFn,\n useSplitChildren,\n} from \"../../utils\"\nimport { Collapse } from \"../collapse\"\nimport { ChevronDownIcon } from \"../icon\"\nimport { accordionStyle } from \"./accordion.style\"\nimport {\n AccordionContext,\n AccordionDescendantsContext,\n AccordionItemContext,\n useAccordion,\n useAccordionItem,\n useAccordionItemContext,\n} from \"./use-accordion\"\n\ninterface AccordionCallBackProps {\n disabled?: boolean\n expanded?: boolean\n}\n\nexport interface AccordionItem extends Omit<AccordionItemProps, \"index\"> {}\n\ninterface ComponentContext extends Pick<\n AccordionRootProps,\n \"icon\" | \"iconHidden\"\n> {}\n\nexport interface AccordionRootProps\n extends\n Omit<HTMLStyledProps, \"onChange\">,\n ThemeProps<AccordionStyle>,\n UseAccordionProps {\n /**\n * The accordion icon for all items to use.\n */\n icon?: ReactNodeOrFunction<AccordionCallBackProps>\n /**\n * If `true`, hide the accordion icon for all items.\n *\n * @default false\n */\n iconHidden?: boolean\n /**\n * If provided, generate elements based on items.\n */\n items?: AccordionItem[]\n}\n\ninterface ItemComponentContext extends Pick<AccordionItemProps, \"icon\"> {}\n\nconst [ItemComponentContext, useItemComponentContext] =\n createContext<ItemComponentContext>({\n name: \"ItemComponentContext\",\n })\n\nconst {\n ComponentContext,\n PropsContext: AccordionPropsContext,\n useComponentContext,\n usePropsContext: useAccordionPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<AccordionRootProps, AccordionStyle, ComponentContext>(\n \"accordion\",\n accordionStyle,\n)\n\nexport { AccordionPropsContext, useAccordionPropsContext }\n\n/**\n * `Accordion` is a component for a list that displays information in an expandable or collapsible manner.\n *\n * @see https://yamada-ui.com/docs/components/accordion\n */\nexport const AccordionRoot = withProvider<\"div\", AccordionRootProps>(\n ({ children, icon, iconHidden, items, ...props }) => {\n const {\n descendants,\n focusedIndex,\n index,\n multiple,\n setFocusedIndex,\n setIndex,\n toggle,\n getRootProps,\n } = useAccordion(props)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items?.map((props, index) => (\n <AccordionItem key={index} index={index} {...props} />\n ))\n }, [children, items])\n const context = useMemo(\n () => ({\n focusedIndex,\n index,\n multiple,\n setFocusedIndex,\n setIndex,\n toggle,\n }),\n [focusedIndex, index, multiple, setFocusedIndex, setIndex, toggle],\n )\n const componentContext = useMemo(\n () => ({ icon, iconHidden }),\n [icon, iconHidden],\n )\n\n return (\n <AccordionDescendantsContext value={descendants}>\n <AccordionContext value={context}>\n <ComponentContext value={componentContext}>\n <styled.div {...getRootProps()}>{computedChildren}</styled.div>\n </ComponentContext>\n </AccordionContext>\n </AccordionDescendantsContext>\n )\n },\n \"root\",\n)()\n\nexport interface AccordionItemProps\n extends\n Omit<HTMLStyledProps, \"children\">,\n Omit<UseAccordionItemProps, \"children\"> {\n /**\n * The accordion button to use.\n */\n button?: ReactNodeOrFunction<AccordionCallBackProps>\n /**\n * The accordion children to use.\n */\n children?: ReactNodeOrFunction<AccordionCallBackProps>\n /**\n * The accordion icon to use.\n */\n icon?: ReactNodeOrFunction<AccordionCallBackProps>\n}\n\nexport const AccordionItem = withContext<\"div\", AccordionItemProps>(\n ({ button, children, icon, ...rest }) => {\n const {\n disabled,\n open,\n getButtonProps,\n getIconProps,\n getItemProps,\n getPanelProps,\n } = useAccordionItem(rest)\n const computedChildren = useMemo(\n () => runIfFn(children, { disabled, expanded: open }),\n [children, disabled, open],\n )\n const [omittedChildren, customAccordionButton, customAccordionPanel] =\n useSplitChildren(computedChildren, AccordionButton, AccordionPanel)\n const context = useMemo(\n () => ({\n disabled,\n icon,\n open,\n getButtonProps,\n getIconProps,\n getPanelProps,\n }),\n [disabled, getButtonProps, getPanelProps, getIconProps, icon, open],\n )\n const componentContext = useMemo(() => ({ icon }), [icon])\n\n return (\n <AccordionItemContext value={context}>\n <ItemComponentContext value={componentContext}>\n <styled.div {...getItemProps()}>\n {customAccordionButton ?? (\n <AccordionButton>\n {runIfFn(button, { disabled, expanded: open })}\n </AccordionButton>\n )}\n {customAccordionPanel ?? (\n <AccordionPanel>{omittedChildren}</AccordionPanel>\n )}\n </styled.div>\n </ItemComponentContext>\n </AccordionItemContext>\n )\n },\n \"item\",\n)()\n\nexport interface AccordionButtonProps extends HTMLStyledProps<\"button\"> {\n /**\n * The accordion icon to use.\n */\n icon?: ReactNodeOrFunction<AccordionCallBackProps>\n /**\n * Props the container element.\n */\n containerProps?: HTMLStyledProps\n}\n\nexport const AccordionButton = withContext<\"button\", AccordionButtonProps>(\n ({ children, icon: customIcon, containerProps, ...rest }) => {\n const { icon: rootIcon } = useComponentContext()\n const { icon: itemIcon } = useItemComponentContext()\n const { disabled, open, getButtonProps } = useAccordionItemContext()\n const props = { disabled, expanded: open }\n\n return (\n <styled.h3 {...containerProps}>\n <styled.button {...getButtonProps(rest)}>\n {children}\n\n <AccordionIcon>\n {runIfFn(customIcon, props) ??\n runIfFn(itemIcon, props) ??\n runIfFn(rootIcon, props)}\n </AccordionIcon>\n </styled.button>\n </styled.h3>\n )\n },\n \"button\",\n)()\n\ninterface AccordionIconProps extends HTMLStyledProps<\"svg\"> {}\n\nexport const AccordionIcon = withContext<\"svg\", AccordionIconProps>(\n ({ children = <ChevronDownIcon />, ...rest }) => {\n const { iconHidden } = useComponentContext()\n const { getIconProps } = useAccordionItemContext()\n\n if (iconHidden) return null\n\n const child = getResolvedChild(children)\n\n if (isValidElement<HTMLProps<\"svg\">>(child))\n return cloneElement(child, getIconProps({ ...rest, ...child.props }))\n\n return Children.count(child) > 1 ? Children.only(null) : null\n },\n \"icon\",\n)()\n\nexport interface AccordionPanelProps\n extends\n Omit<HTMLStyledProps, \"transition\">,\n Pick<\n CollapseProps,\n | \"animationOpacity\"\n | \"endingHeight\"\n | \"startingHeight\"\n | keyof WithTransitionProps\n > {}\n\nexport const AccordionPanel = withContext<\"div\", AccordionPanelProps>(\n ({\n animationOpacity,\n children,\n delay,\n duration,\n endingHeight,\n startingHeight,\n transition,\n transitionEnd,\n unmountOnExit,\n ...rest\n }) => {\n const { open, getPanelProps } = useAccordionItemContext()\n\n return (\n <Collapse\n {...{\n animationOpacity,\n delay,\n duration,\n endingHeight,\n open,\n startingHeight,\n transition,\n transitionEnd,\n unmountOnExit,\n }}\n >\n <styled.div {...getPanelProps(rest)}>\n {isString(children) ? <styled.p>{children}</styled.p> : children}\n </styled.div>\n </Collapse>\n )\n },\n \"panel\",\n)()\n"],"mappings":";;;;;;;;;;;;;AAgEA,MAAM,CAAC,sBAAsB,2BAC3BA,gBAAoC,EAClC,MAAM,uBACR,CAAC;AAEH,MAAM,EACJ,kBACA,cAAc,uBACd,qBACA,iBAAiB,0BACjB,aACA,iBACE,oBACF,aACA,cACF;;;;;;AASA,MAAa,gBAAgB,cAC1B,EAAE,UAAU,MAAM,YAAY,OAAO,GAAG,YAAY;CACnD,MAAM,EACJ,aACA,cACA,OACA,UACA,iBACA,UACA,QACA,iBACE,aAAa,KAAK;CACtB,MAAM,mBAAmB,cAAc;EACrC,IAAI,UAAU,OAAO;EAErB,OAAO,OAAO,K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,UACA,OACA,UACA,cACA,gBACA,YACA,eACA,eACA,GAAG,WACC;CACJ,MAAM,EAAE,MAAM,kBAAkB,wBAAwB;CAExD,OACE,oBAAC,UAAD;EAEI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAGF,UAAA,oBAAC,OAAO,KAAR;GAAY,GAAI,cAAc,IAAI;GAC/BC,WAAAA,GAAAA,cAAAA,SAAAA,CAAS,QAAQ,IAAI,oBAAC,OAAO,GAAR,EAAW,SAAmB,CAAA,IAAI;EAC9C,CAAA;CACJ,CAAA;AAEd,GACA,OACF,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { getResolvedChild } from "../../utils/children.js";
|
|
2
3
|
import { utils_exports } from "../../utils/index.js";
|
|
3
4
|
import { createComponent } from "../../core/components/create-component.js";
|
|
4
5
|
import { aspectRatioStyle } from "./aspect-ratio.style.js";
|
|
@@ -11,10 +12,9 @@ const { PropsContext: AspectRatioPropsContext, usePropsContext: useAspectRatioPr
|
|
|
11
12
|
* @see https://yamada-ui.com/docs/components/aspect-ratio
|
|
12
13
|
*/
|
|
13
14
|
const AspectRatio = withContext("div")(void 0, ({ children, ratio = 4 / 3, ...rest }) => {
|
|
14
|
-
const child = Children.only(children);
|
|
15
15
|
return {
|
|
16
16
|
...rest,
|
|
17
|
-
children:
|
|
17
|
+
children: Children.only(getResolvedChild(children)),
|
|
18
18
|
_before: {
|
|
19
19
|
display: "block",
|
|
20
20
|
h: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aspect-ratio.js","names":["replaceObject"],"sources":["../../../../src/components/aspect-ratio/aspect-ratio.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLStyledProps, StyleValue } from \"../../core\"\nimport type { AspectRatioStyle } from \"./aspect-ratio.style\"\nimport { Children } from \"react\"\nimport { createComponent } from \"../../core\"\nimport { replaceObject } from \"../../utils\"\nimport { aspectRatioStyle } from \"./aspect-ratio.style\"\n\nexport interface AspectRatioProps extends HTMLStyledProps {\n /**\n * The aspect ratio of the Box.\n *\n * @default '4 / 3'\n */\n ratio?: StyleValue<number>\n}\n\nconst {\n PropsContext: AspectRatioPropsContext,\n usePropsContext: useAspectRatioPropsContext,\n withContext,\n} = createComponent<AspectRatioProps, AspectRatioStyle>(\n \"aspect-ratio\",\n aspectRatioStyle,\n)\n\nexport { AspectRatioPropsContext, useAspectRatioPropsContext }\n\n/**\n * `AspectRatio` is a component for embedding things like videos and maps while maintaining the aspect ratio.\n *\n * @see https://yamada-ui.com/docs/components/aspect-ratio\n */\nexport const AspectRatio = withContext(\"div\")(\n undefined,\n ({ children, ratio = 4 / 3, ...rest }) => {\n
|
|
1
|
+
{"version":3,"file":"aspect-ratio.js","names":["replaceObject"],"sources":["../../../../src/components/aspect-ratio/aspect-ratio.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLStyledProps, StyleValue } from \"../../core\"\nimport type { AspectRatioStyle } from \"./aspect-ratio.style\"\nimport { Children } from \"react\"\nimport { createComponent } from \"../../core\"\nimport { getResolvedChild, replaceObject } from \"../../utils\"\nimport { aspectRatioStyle } from \"./aspect-ratio.style\"\n\nexport interface AspectRatioProps extends HTMLStyledProps {\n /**\n * The aspect ratio of the Box.\n *\n * @default '4 / 3'\n */\n ratio?: StyleValue<number>\n}\n\nconst {\n PropsContext: AspectRatioPropsContext,\n usePropsContext: useAspectRatioPropsContext,\n withContext,\n} = createComponent<AspectRatioProps, AspectRatioStyle>(\n \"aspect-ratio\",\n aspectRatioStyle,\n)\n\nexport { AspectRatioPropsContext, useAspectRatioPropsContext }\n\n/**\n * `AspectRatio` is a component for embedding things like videos and maps while maintaining the aspect ratio.\n *\n * @see https://yamada-ui.com/docs/components/aspect-ratio\n */\nexport const AspectRatio = withContext(\"div\")(\n undefined,\n ({ children, ratio = 4 / 3, ...rest }) => {\n return {\n ...rest,\n children: Children.only(getResolvedChild(children)),\n _before: {\n display: \"block\",\n h: 0,\n pb: replaceObject(ratio, (r) => `${(1 / r) * 100}%`),\n },\n }\n },\n)\n"],"mappings":";;;;;;;AAkBA,MAAM,EACJ,cAAc,yBACd,iBAAiB,4BACjB,gBACE,gBACF,gBACA,gBACF;;;;;;AASA,MAAa,cAAc,YAAY,KAAK,CAAC,CAC3C,KAAA,IACC,EAAE,UAAU,QAAQ,IAAI,GAAG,GAAG,WAAW;CACxC,OAAO;EACL,GAAG;EACH,UAAU,SAAS,KAAK,iBAAiB,QAAQ,CAAC;EAClD,SAAS;GACP,SAAS;GACT,GAAG;GACH,KAAA,GAAIA,cAAAA,cAAAA,CAAc,QAAQ,MAAM,GAAI,IAAI,IAAK,IAAI,EAAE;EACrD;CACF;AACF,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blockquote.style.js","names":[],"sources":["../../../../src/components/blockquote/blockquote.style.ts"],"sourcesContent":["import { defineComponentSlotStyle } from \"../../core\"\n\nexport const blockquoteStyle = defineComponentSlotStyle({\n base: {\n caption: {\n color: \"muted\",\n fontSize: \"sm\",\n },\n cite: {},\n content: {},\n icon: {\n fontSize: \"xl\",\n left: \"0\",\n position: \"absolute\",\n top: \"0.5\",\n },\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"sm\",\n position: \"relative\",\n },\n },\n\n props: {\n /**\n * The alignment of the blockquote.\n *\n * @default 'start'\n */\n justify: {\n center: {\n root: {\n alignItems: \"center\",\n textAlign: \"center\",\n },\n },\n end: {\n root: {\n alignItems: \"end\",\n textAlign: \"end\",\n },\n },\n start: {\n root: {\n alignItems: \"start\",\n textAlign: \"start\",\n },\n },\n },\n },\n\n variants: {\n plain: {\n icon: {\n color: \"colorScheme.solid\",\n },\n root: {\n _hasIcon: {\n ps: \"lg\",\n },\n },\n },\n solid: {\n icon: {\n color: \"colorScheme.solid\",\n },\n root: {\n borderStart: \"4px solid {colorScheme.solid}\",\n px: \"md\",\n },\n },\n subtle: {\n icon: {\n color: \"colorScheme.fg\",\n },\n root: {\n borderStart: \"4px solid {colorScheme.muted}\",\n px: \"md\",\n },\n },\n },\n\n defaultProps: {\n variant: \"subtle\",\n justify: \"start\",\n },\n})\n\nexport type BlockquoteStyle = typeof blockquoteStyle\n"],"mappings":";;AAEA,MAAa,kBAAkB,yBAAyB;CACtD,MAAM;EACJ,SAAS;GACP,OAAO;GACP,UAAU;EACZ;EACA,MAAM,CAAC;EACP,SAAS,CAAC;EACV,MAAM;GACJ,UAAU;GACV,MAAM;GACN,UAAU;GACV,KAAK;EACP;EACA,MAAM;GACJ,SAAS;GACT,eAAe;GACf,KAAK;GACL,UAAU;EACZ;CACF;CAEA,OAAO;;;;;;AAML,SAAS;EACP,QAAQ,EACN,MAAM;GACJ,YAAY;GACZ,WAAW;EACb,EACF;EACA,KAAK,EACH,MAAM;GACJ,YAAY;GACZ,WAAW;EACb,EACF;EACA,OAAO,EACL,MAAM;GACJ,YAAY;GACZ,WAAW;EACb,EACF;CACF,EACF;CAEA,UAAU;EACR,OAAO;GACL,MAAM,EACJ,OAAO,oBACT;GACA,MAAM,EACJ,UAAU,EACR,IAAI,KACN,EACF;EACF;EACA,OAAO;GACL,MAAM,EACJ,OAAO,oBACT;GACA,MAAM;IACJ,aAAa;IACb,IAAI;GACN;EACF;EACA,QAAQ;GACN,MAAM,EACJ,OAAO,iBACT;GACA,MAAM;IACJ,aAAa;IACb,IAAI;GACN;EACF;CACF;CAEA,cAAc;EACZ,SAAS;EACT,SAAS;CACX;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"blockquote.style.js","names":[],"sources":["../../../../src/components/blockquote/blockquote.style.ts"],"sourcesContent":["import { defineComponentSlotStyle } from \"../../core\"\n\nexport const blockquoteStyle = defineComponentSlotStyle({\n base: {\n caption: {\n color: \"fg.muted\",\n fontSize: \"sm\",\n },\n cite: {},\n content: {},\n icon: {\n fontSize: \"xl\",\n left: \"0\",\n position: \"absolute\",\n top: \"0.5\",\n },\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"sm\",\n position: \"relative\",\n },\n },\n\n props: {\n /**\n * The alignment of the blockquote.\n *\n * @default 'start'\n */\n justify: {\n center: {\n root: {\n alignItems: \"center\",\n textAlign: \"center\",\n },\n },\n end: {\n root: {\n alignItems: \"end\",\n textAlign: \"end\",\n },\n },\n start: {\n root: {\n alignItems: \"start\",\n textAlign: \"start\",\n },\n },\n },\n },\n\n variants: {\n plain: {\n icon: {\n color: \"colorScheme.solid\",\n },\n root: {\n _hasIcon: {\n ps: \"lg\",\n },\n },\n },\n solid: {\n icon: {\n color: \"colorScheme.solid\",\n },\n root: {\n borderStart: \"4px solid {colorScheme.solid}\",\n px: \"md\",\n },\n },\n subtle: {\n icon: {\n color: \"colorScheme.fg\",\n },\n root: {\n borderStart: \"4px solid {colorScheme.muted}\",\n px: \"md\",\n },\n },\n },\n\n defaultProps: {\n variant: \"subtle\",\n justify: \"start\",\n },\n})\n\nexport type BlockquoteStyle = typeof blockquoteStyle\n"],"mappings":";;AAEA,MAAa,kBAAkB,yBAAyB;CACtD,MAAM;EACJ,SAAS;GACP,OAAO;GACP,UAAU;EACZ;EACA,MAAM,CAAC;EACP,SAAS,CAAC;EACV,MAAM;GACJ,UAAU;GACV,MAAM;GACN,UAAU;GACV,KAAK;EACP;EACA,MAAM;GACJ,SAAS;GACT,eAAe;GACf,KAAK;GACL,UAAU;EACZ;CACF;CAEA,OAAO;;;;;;AAML,SAAS;EACP,QAAQ,EACN,MAAM;GACJ,YAAY;GACZ,WAAW;EACb,EACF;EACA,KAAK,EACH,MAAM;GACJ,YAAY;GACZ,WAAW;EACb,EACF;EACA,OAAO,EACL,MAAM;GACJ,YAAY;GACZ,WAAW;EACb,EACF;CACF,EACF;CAEA,UAAU;EACR,OAAO;GACL,MAAM,EACJ,OAAO,oBACT;GACA,MAAM,EACJ,UAAU,EACR,IAAI,KACN,EACF;EACF;EACA,OAAO;GACL,MAAM,EACJ,OAAO,oBACT;GACA,MAAM;IACJ,aAAa;IACb,IAAI;GACN;EACF;EACA,QAAQ;GACN,MAAM,EACJ,OAAO,iBACT;GACA,MAAM;IACJ,aAAa;IACb,IAAI;GACN;EACF;CACF;CAEA,cAAc;EACZ,SAAS;EACT,SAAS;CACX;AACF,CAAC"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { Box };
|
|
1
|
+
export { Box } from "./box.js";
|
|
@@ -5,8 +5,9 @@ import { mergeProps } from "../../core/components/props.js";
|
|
|
5
5
|
import { useI18n } from "../../providers/i18n-provider/i18n-provider.js";
|
|
6
6
|
import { cloneElement, useCallback, useMemo } from "react";
|
|
7
7
|
//#region src/components/breadcrumb/use-breadcrumb.tsx
|
|
8
|
-
const useBreadcrumb = ({ children, ellipsis, endBoundaries = 0, items = [], link, startBoundaries = 0, ...rest } = {}) => {
|
|
8
|
+
const useBreadcrumb = ({ children, ellipsis, endBoundaries = 0, items = [], link: linkProp, startBoundaries = 0, ...rest } = {}) => {
|
|
9
9
|
const validChildren = useValidChildren(children);
|
|
10
|
+
const [link] = useValidChildren(linkProp);
|
|
10
11
|
const length = validChildren.length || items.length;
|
|
11
12
|
const { t } = useI18n("breadcrumb");
|
|
12
13
|
const hasBoundaries = startBoundaries + endBoundaries > 0 && length > startBoundaries + endBoundaries;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-breadcrumb.js","names":["runIfFn"],"sources":["../../../../src/components/breadcrumb/use-breadcrumb.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { ReactNodeOrFunction } from \"../../utils\"\nimport { cloneElement, useCallback, useMemo } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { runIfFn, useValidChildren } from \"../../utils\"\n\nexport interface BreadcrumbItem extends HTMLProps<\"a\"> {\n currentPage?: boolean\n label?: ReactNode\n}\n\nexport interface UseBreadcrumbProps extends HTMLProps<\"nav\"> {\n /**\n * The icon to be used in the ellipsis.\n */\n ellipsis?: ReactNodeOrFunction<{ items: BreadcrumbItem[] }>\n /**\n * Number of elements visible on the end(right) edges.\n *\n * @default 0\n */\n endBoundaries?: number\n /**\n * If provided, generate breadcrumb items based on items.\n */\n items?: BreadcrumbItem[]\n /**\n * The component to be used for the link.\n */\n link?: ReactElement<any>\n /**\n * Number of elements visible on the start(left) edges.\n *\n * @default 0\n */\n startBoundaries?: number\n}\n\nexport const useBreadcrumb = ({\n children,\n ellipsis,\n endBoundaries = 0,\n items = [],\n link,\n startBoundaries = 0,\n ...rest\n}: UseBreadcrumbProps = {}) => {\n const validChildren = useValidChildren(children)\n const length = validChildren.length || items.length\n const { t } = useI18n(\"breadcrumb\")\n\n const hasBoundaries =\n startBoundaries + endBoundaries > 0 &&\n length > startBoundaries + endBoundaries\n\n const renderLink = useCallback(\n (items: BreadcrumbItem[]) => {\n if (!link) return []\n\n return items.map(({ label, ...rest }) =>\n cloneElement<any>(link, { ...link.props, children: label, ...rest }),\n )\n },\n [link],\n )\n\n const renderEllipsis = useCallback(\n (items: BreadcrumbItem[]) => {\n if (!ellipsis) return null\n\n return runIfFn(ellipsis, { items })\n },\n [ellipsis],\n )\n\n const splitItems = useCallback(\n (items: BreadcrumbItem[]) => {\n const length = items.length\n const firstItems = items.slice(0, startBoundaries)\n const ellipsisItems = items.slice(startBoundaries, length - endBoundaries)\n const lastItems = items.slice(length - endBoundaries)\n\n return [firstItems, ellipsisItems, lastItems] as const\n },\n [startBoundaries, endBoundaries],\n )\n\n const cloneChildren = useMemo(() => {\n const hasChildren = !!validChildren.length\n\n if (hasChildren) {\n return validChildren\n } else if (hasBoundaries) {\n const [firstItems, ellipsisItems, lastItems] = splitItems(items)\n\n return [\n ...renderLink(firstItems),\n renderEllipsis(ellipsisItems),\n ...renderLink(lastItems),\n ]\n } else {\n return renderLink(items)\n }\n }, [\n validChildren,\n items,\n hasBoundaries,\n renderEllipsis,\n renderLink,\n splitItems,\n ])\n\n const getRootProps: PropGetter<\"nav\"> = useCallback(\n (props) => mergeProps({ \"aria-label\": t(\"Breadcrumb\") }, rest, props)(),\n [rest, t],\n )\n\n const getListProps: PropGetter<\"ol\"> = useCallback(\n (props) => ({ ...props }),\n [],\n )\n\n const getLinkProps: PropGetter<\"a\", { currentPage?: boolean }> = useCallback(\n ({ href, currentPage, ...props } = {}) => ({\n href: !currentPage ? href : undefined,\n \"aria-current\": currentPage ? \"page\" : undefined,\n ...props,\n }),\n [],\n )\n\n const getEllipsisProps: PropGetter<\"svg\"> = useCallback(\n (props) => ({\n \"aria-label\": t(\"Ellipsis\"),\n role: \"presentation\",\n ...props,\n }),\n [t],\n )\n\n return {\n children: cloneChildren,\n getEllipsisProps,\n getLinkProps,\n getListProps,\n getRootProps,\n }\n}\n\nexport type UseBreadcrumbReturn = ReturnType<typeof useBreadcrumb>\n"],"mappings":";;;;;;;AA0CA,MAAa,iBAAiB,EAC5B,UACA,UACA,gBAAgB,GAChB,QAAQ,CAAC,GACT,
|
|
1
|
+
{"version":3,"file":"use-breadcrumb.js","names":["runIfFn"],"sources":["../../../../src/components/breadcrumb/use-breadcrumb.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { ReactNodeOrFunction } from \"../../utils\"\nimport { cloneElement, useCallback, useMemo } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { runIfFn, useValidChildren } from \"../../utils\"\n\nexport interface BreadcrumbItem extends HTMLProps<\"a\"> {\n currentPage?: boolean\n label?: ReactNode\n}\n\nexport interface UseBreadcrumbProps extends HTMLProps<\"nav\"> {\n /**\n * The icon to be used in the ellipsis.\n */\n ellipsis?: ReactNodeOrFunction<{ items: BreadcrumbItem[] }>\n /**\n * Number of elements visible on the end(right) edges.\n *\n * @default 0\n */\n endBoundaries?: number\n /**\n * If provided, generate breadcrumb items based on items.\n */\n items?: BreadcrumbItem[]\n /**\n * The component to be used for the link.\n */\n link?: ReactElement<any>\n /**\n * Number of elements visible on the start(left) edges.\n *\n * @default 0\n */\n startBoundaries?: number\n}\n\nexport const useBreadcrumb = ({\n children,\n ellipsis,\n endBoundaries = 0,\n items = [],\n link: linkProp,\n startBoundaries = 0,\n ...rest\n}: UseBreadcrumbProps = {}) => {\n const validChildren = useValidChildren(children)\n const [link] = useValidChildren(linkProp)\n const length = validChildren.length || items.length\n const { t } = useI18n(\"breadcrumb\")\n\n const hasBoundaries =\n startBoundaries + endBoundaries > 0 &&\n length > startBoundaries + endBoundaries\n\n const renderLink = useCallback(\n (items: BreadcrumbItem[]) => {\n if (!link) return []\n\n return items.map(({ label, ...rest }) =>\n cloneElement<any>(link, { ...link.props, children: label, ...rest }),\n )\n },\n [link],\n )\n\n const renderEllipsis = useCallback(\n (items: BreadcrumbItem[]) => {\n if (!ellipsis) return null\n\n return runIfFn(ellipsis, { items })\n },\n [ellipsis],\n )\n\n const splitItems = useCallback(\n (items: BreadcrumbItem[]) => {\n const length = items.length\n const firstItems = items.slice(0, startBoundaries)\n const ellipsisItems = items.slice(startBoundaries, length - endBoundaries)\n const lastItems = items.slice(length - endBoundaries)\n\n return [firstItems, ellipsisItems, lastItems] as const\n },\n [startBoundaries, endBoundaries],\n )\n\n const cloneChildren = useMemo(() => {\n const hasChildren = !!validChildren.length\n\n if (hasChildren) {\n return validChildren\n } else if (hasBoundaries) {\n const [firstItems, ellipsisItems, lastItems] = splitItems(items)\n\n return [\n ...renderLink(firstItems),\n renderEllipsis(ellipsisItems),\n ...renderLink(lastItems),\n ]\n } else {\n return renderLink(items)\n }\n }, [\n validChildren,\n items,\n hasBoundaries,\n renderEllipsis,\n renderLink,\n splitItems,\n ])\n\n const getRootProps: PropGetter<\"nav\"> = useCallback(\n (props) => mergeProps({ \"aria-label\": t(\"Breadcrumb\") }, rest, props)(),\n [rest, t],\n )\n\n const getListProps: PropGetter<\"ol\"> = useCallback(\n (props) => ({ ...props }),\n [],\n )\n\n const getLinkProps: PropGetter<\"a\", { currentPage?: boolean }> = useCallback(\n ({ href, currentPage, ...props } = {}) => ({\n href: !currentPage ? href : undefined,\n \"aria-current\": currentPage ? \"page\" : undefined,\n ...props,\n }),\n [],\n )\n\n const getEllipsisProps: PropGetter<\"svg\"> = useCallback(\n (props) => ({\n \"aria-label\": t(\"Ellipsis\"),\n role: \"presentation\",\n ...props,\n }),\n [t],\n )\n\n return {\n children: cloneChildren,\n getEllipsisProps,\n getLinkProps,\n getListProps,\n getRootProps,\n }\n}\n\nexport type UseBreadcrumbReturn = ReturnType<typeof useBreadcrumb>\n"],"mappings":";;;;;;;AA0CA,MAAa,iBAAiB,EAC5B,UACA,UACA,gBAAgB,GAChB,QAAQ,CAAC,GACT,MAAM,UACN,kBAAkB,GAClB,GAAG,SACmB,CAAC,MAAM;CAC7B,MAAM,gBAAgB,iBAAiB,QAAQ;CAC/C,MAAM,CAAC,QAAQ,iBAAiB,QAAQ;CACxC,MAAM,SAAS,cAAc,UAAU,MAAM;CAC7C,MAAM,EAAE,MAAM,QAAQ,YAAY;CAElC,MAAM,gBACJ,kBAAkB,gBAAgB,KAClC,SAAS,kBAAkB;CAE7B,MAAM,aAAa,aAChB,UAA4B;EAC3B,IAAI,CAAC,MAAM,OAAO,CAAC;EAEnB,OAAO,MAAM,KAAK,EAAE,OAAO,GAAG,WAC5B,aAAkB,MAAM;GAAE,GAAG,KAAK;GAAO,UAAU;GAAO,GAAG;EAAK,CAAC,CACrE;CACF,GACA,CAAC,IAAI,CACP;CAEA,MAAM,iBAAiB,aACpB,UAA4B;EAC3B,IAAI,CAAC,UAAU,OAAO;EAEtB,QAAA,GAAOA,cAAAA,QAAAA,CAAQ,UAAU,EAAE,MAAM,CAAC;CACpC,GACA,CAAC,QAAQ,CACX;CAEA,MAAM,aAAa,aAChB,UAA4B;EAC3B,MAAM,SAAS,MAAM;EAKrB,OAAO;GAJY,MAAM,MAAM,GAAG,eAIjB;GAHK,MAAM,MAAM,iBAAiB,SAAS,aAG5B;GAFd,MAAM,MAAM,SAAS,aAEI;EAAC;CAC9C,GACA,CAAC,iBAAiB,aAAa,CACjC;CAEA,MAAM,gBAAgB,cAAc;EAGlC,IAAI,CAFiB,CAAC,cAAc,QAGlC,OAAO;OACF,IAAI,eAAe;GACxB,MAAM,CAAC,YAAY,eAAe,aAAa,WAAW,KAAK;GAE/D,OAAO;IACL,GAAG,WAAW,UAAU;IACxB,eAAe,aAAa;IAC5B,GAAG,WAAW,SAAS;GACzB;EACF,OACE,OAAO,WAAW,KAAK;CAE3B,GAAG;EACD;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,eAAkC,aACrC,UAAU,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,MAAM,KAAK,CAAC,CAAC,GACtE,CAAC,MAAM,CAAC,CACV;CAEA,MAAM,eAAiC,aACpC,WAAW,EAAE,GAAG,MAAM,IACvB,CAAC,CACH;CAEA,MAAM,eAA2D,aAC9D,EAAE,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO;EACzC,MAAM,CAAC,cAAc,OAAO,KAAA;EAC5B,gBAAgB,cAAc,SAAS,KAAA;EACvC,GAAG;CACL,IACA,CAAC,CACH;CAWA,OAAO;EACL,UAAU;EACV,kBAX0C,aACzC,WAAW;GACV,cAAc,EAAE,UAAU;GAC1B,MAAM;GACN,GAAG;EACL,IACA,CAAC,CAAC,CAKa;EACf;EACA;EACA;CACF;AACF"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSplitChildren } from "../../utils/children.js";
|
|
3
|
+
import { styled } from "../../core/system/factory.js";
|
|
4
|
+
import { mergeProps } from "../../core/components/props.js";
|
|
5
|
+
import { createSlotComponent } from "../../core/components/create-component.js";
|
|
6
|
+
import { bubbleStyle } from "./bubble.style.js";
|
|
7
|
+
import { useMemo } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/bubble/bubble.tsx
|
|
10
|
+
const { component, ComponentContext, PropsContext: BubblePropsContext, useComponentContext, usePropsContext: useBubblePropsContext, withContext, withProvider, useRootComponentProps } = createSlotComponent("bubble", bubbleStyle);
|
|
11
|
+
/**
|
|
12
|
+
* `Bubble` is a component that displays conversational content in a message bubble.
|
|
13
|
+
*
|
|
14
|
+
* @see https://yamada-ui.com/docs/components/bubble
|
|
15
|
+
*/
|
|
16
|
+
const BubbleRoot = component((props) => {
|
|
17
|
+
const [, { colorScheme, size, variant, children, items, contentProps, endGroupProps, endItemProps, groupProps, itemProps, reactionsProps, startGroupProps, startItemProps, ...rest }] = useRootComponentProps(props, "root", { transferProps: [
|
|
18
|
+
"variant",
|
|
19
|
+
"colorScheme",
|
|
20
|
+
"size"
|
|
21
|
+
] });
|
|
22
|
+
const computedChildren = useMemo(() => {
|
|
23
|
+
if (children) return children;
|
|
24
|
+
return items?.map((props, index) => {
|
|
25
|
+
if ("children" in props) {
|
|
26
|
+
const { children, reactions, contentProps, reactionsProps, ...rest } = props;
|
|
27
|
+
return /* @__PURE__ */ jsxs(BubbleItem, {
|
|
28
|
+
...rest,
|
|
29
|
+
children: [/* @__PURE__ */ jsx(BubbleContent, {
|
|
30
|
+
...contentProps,
|
|
31
|
+
children
|
|
32
|
+
}), reactions ? /* @__PURE__ */ jsx(BubbleReactions, {
|
|
33
|
+
...reactionsProps,
|
|
34
|
+
children: reactions
|
|
35
|
+
}) : null]
|
|
36
|
+
}, index);
|
|
37
|
+
} else return /* @__PURE__ */ jsx(BubbleGroup, { ...props }, index);
|
|
38
|
+
});
|
|
39
|
+
}, [children, items]);
|
|
40
|
+
const context = useMemo(() => ({
|
|
41
|
+
colorScheme,
|
|
42
|
+
size,
|
|
43
|
+
variant
|
|
44
|
+
}), [
|
|
45
|
+
colorScheme,
|
|
46
|
+
size,
|
|
47
|
+
variant
|
|
48
|
+
]);
|
|
49
|
+
const componentContext = useMemo(() => ({
|
|
50
|
+
contentProps,
|
|
51
|
+
endGroupProps,
|
|
52
|
+
endItemProps,
|
|
53
|
+
groupProps,
|
|
54
|
+
itemProps,
|
|
55
|
+
reactionsProps,
|
|
56
|
+
startGroupProps,
|
|
57
|
+
startItemProps
|
|
58
|
+
}), [
|
|
59
|
+
groupProps,
|
|
60
|
+
itemProps,
|
|
61
|
+
contentProps,
|
|
62
|
+
reactionsProps,
|
|
63
|
+
startItemProps,
|
|
64
|
+
endItemProps,
|
|
65
|
+
startGroupProps,
|
|
66
|
+
endGroupProps
|
|
67
|
+
]);
|
|
68
|
+
return /* @__PURE__ */ jsx(BubblePropsContext, {
|
|
69
|
+
value: context,
|
|
70
|
+
children: /* @__PURE__ */ jsx(ComponentContext, {
|
|
71
|
+
value: componentContext,
|
|
72
|
+
children: /* @__PURE__ */ jsx(styled.div, {
|
|
73
|
+
...rest,
|
|
74
|
+
children: computedChildren
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
}, "root")();
|
|
79
|
+
const BubbleGroup = component((props) => {
|
|
80
|
+
const [, { colorScheme, size, variant, children, direction, items, ...rest }] = useRootComponentProps(props, "group", { transferProps: [
|
|
81
|
+
"variant",
|
|
82
|
+
"colorScheme",
|
|
83
|
+
"size"
|
|
84
|
+
] });
|
|
85
|
+
const computedChildren = useMemo(() => {
|
|
86
|
+
if (children) return children;
|
|
87
|
+
return items?.map(({ children, reactions, contentProps, reactionsProps, ...rest }, index) => /* @__PURE__ */ jsxs(BubbleItem, {
|
|
88
|
+
...rest,
|
|
89
|
+
children: [/* @__PURE__ */ jsx(BubbleContent, {
|
|
90
|
+
...contentProps,
|
|
91
|
+
children
|
|
92
|
+
}), reactions ? /* @__PURE__ */ jsx(BubbleReactions, {
|
|
93
|
+
...reactionsProps,
|
|
94
|
+
children: reactions
|
|
95
|
+
}) : null]
|
|
96
|
+
}, index));
|
|
97
|
+
}, [children, items]);
|
|
98
|
+
const context = useMemo(() => ({
|
|
99
|
+
colorScheme,
|
|
100
|
+
size,
|
|
101
|
+
variant,
|
|
102
|
+
direction
|
|
103
|
+
}), [
|
|
104
|
+
colorScheme,
|
|
105
|
+
size,
|
|
106
|
+
variant,
|
|
107
|
+
direction
|
|
108
|
+
]);
|
|
109
|
+
return /* @__PURE__ */ jsx(BubblePropsContext, {
|
|
110
|
+
value: context,
|
|
111
|
+
children: /* @__PURE__ */ jsx(styled.div, {
|
|
112
|
+
...rest,
|
|
113
|
+
children: computedChildren
|
|
114
|
+
})
|
|
115
|
+
});
|
|
116
|
+
}, "group")(({ direction = "start", ...rest }) => {
|
|
117
|
+
const { endGroupProps, groupProps, startGroupProps } = useComponentContext();
|
|
118
|
+
return mergeProps(groupProps, direction === "start" ? startGroupProps : endGroupProps, {
|
|
119
|
+
direction,
|
|
120
|
+
...rest
|
|
121
|
+
})();
|
|
122
|
+
});
|
|
123
|
+
const BubbleItem = withProvider(({ children, direction, contentProps, ...rest }) => {
|
|
124
|
+
const [content, customContent, reactions] = useSplitChildren(children, BubbleContent, BubbleReactions);
|
|
125
|
+
return /* @__PURE__ */ jsxs(styled.div, {
|
|
126
|
+
"data-direction": direction,
|
|
127
|
+
...rest,
|
|
128
|
+
children: [customContent ?? /* @__PURE__ */ jsx(BubbleContent, {
|
|
129
|
+
...contentProps,
|
|
130
|
+
children: content
|
|
131
|
+
}), reactions]
|
|
132
|
+
});
|
|
133
|
+
}, "item")((props) => {
|
|
134
|
+
const contextProps = useBubblePropsContext();
|
|
135
|
+
const { endItemProps, itemProps, startItemProps } = useComponentContext();
|
|
136
|
+
const direction = props.direction ?? contextProps?.direction ?? "start";
|
|
137
|
+
return mergeProps(contextProps, itemProps, direction === "start" ? startItemProps : endItemProps, {
|
|
138
|
+
...props,
|
|
139
|
+
direction
|
|
140
|
+
})();
|
|
141
|
+
});
|
|
142
|
+
const BubbleContent = withContext("div", "content")(void 0, (props) => {
|
|
143
|
+
const { contentProps } = useComponentContext();
|
|
144
|
+
return mergeProps(contentProps, props)();
|
|
145
|
+
});
|
|
146
|
+
const BubbleReactions = withContext("div", "reactions")(void 0, (props) => {
|
|
147
|
+
const { reactionsProps } = useComponentContext();
|
|
148
|
+
const { placement = "end-end", ...rest } = mergeProps(reactionsProps, props)();
|
|
149
|
+
return {
|
|
150
|
+
"data-placement": placement,
|
|
151
|
+
...rest
|
|
152
|
+
};
|
|
153
|
+
});
|
|
154
|
+
//#endregion
|
|
155
|
+
export { BubbleContent, BubbleGroup, BubbleItem, BubblePropsContext, BubbleReactions, BubbleRoot, useBubblePropsContext };
|
|
156
|
+
|
|
157
|
+
//# sourceMappingURL=bubble.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bubble.js","names":[],"sources":["../../../../src/components/bubble/bubble.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type {\n Direction,\n HTMLStyledProps,\n SimpleDirection,\n ThemeProps,\n} from \"../../core\"\nimport type { Merge } from \"../../utils\"\nimport type { BubbleStyle } from \"./bubble.style\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport { useSplitChildren } from \"../../utils\"\nimport { bubbleStyle } from \"./bubble.style\"\n\nexport interface BubbleItemWithContent extends Omit<\n BubbleItemProps,\n \"children\"\n> {\n children: ReactNode\n reactions?: ReactNode\n reactionsProps?: Omit<BubbleReactionsProps, \"children\">\n}\n\nexport interface BubbleItemWithGroup\n extends\n Required<Pick<BubbleGroupProps, \"items\">>,\n Omit<BubbleGroupProps, \"children\" | \"items\"> {}\n\nexport type BubbleItem =\n | BubbleItemWithContent\n | Omit<BubbleGroupProps, \"children\" | \"direction\">\n\ninterface ComponentContext extends Pick<\n BubbleRootProps,\n | \"contentProps\"\n | \"endGroupProps\"\n | \"endItemProps\"\n | \"groupProps\"\n | \"itemProps\"\n | \"reactionsProps\"\n | \"startGroupProps\"\n | \"startItemProps\"\n> {}\n\nexport interface BubbleRootProps extends Merge<\n HTMLStyledProps,\n ThemeProps<BubbleStyle>\n> {\n /**\n * If provided, generate elements based on items.\n */\n items?: BubbleItem[]\n /**\n * The props for content component.\n */\n contentProps?: Omit<BubbleContentProps, \"children\">\n /**\n * The theme props for group component in end direction.\n */\n endGroupProps?: Omit<BubbleGroupProps, \"children\" | \"direction\" | \"items\">\n /**\n * The theme props for item component in end direction.\n */\n endItemProps?: Omit<BubbleItemProps, \"children\" | \"direction\">\n /**\n * The props for group component.\n */\n groupProps?: Omit<BubbleGroupProps, \"children\" | \"direction\" | \"items\">\n /**\n * The props for item component.\n */\n itemProps?: Omit<BubbleItemProps, \"children\" | \"direction\">\n /**\n * The props for reactions component.\n */\n reactionsProps?: Omit<BubbleReactionsProps, \"children\">\n /**\n * The theme props for group component in start direction.\n */\n startGroupProps?: Omit<BubbleGroupProps, \"children\" | \"direction\" | \"items\">\n /**\n * The theme props for item component in start direction.\n */\n startItemProps?: Omit<BubbleItemProps, \"children\" | \"direction\">\n}\n\nconst {\n component,\n ComponentContext,\n PropsContext: BubblePropsContext,\n useComponentContext,\n usePropsContext: useBubblePropsContext,\n withContext,\n withProvider,\n useRootComponentProps,\n} = createSlotComponent<BubbleItemProps, BubbleStyle, ComponentContext>(\n \"bubble\",\n bubbleStyle,\n)\n\nexport { BubblePropsContext, useBubblePropsContext }\n\n/**\n * `Bubble` is a component that displays conversational content in a message bubble.\n *\n * @see https://yamada-ui.com/docs/components/bubble\n */\nexport const BubbleRoot = component<\"div\", BubbleRootProps>((props) => {\n const [\n ,\n {\n colorScheme,\n size,\n variant,\n children,\n items,\n contentProps,\n endGroupProps,\n endItemProps,\n groupProps,\n itemProps,\n reactionsProps,\n startGroupProps,\n startItemProps,\n ...rest\n },\n ] = useRootComponentProps(props, \"root\", {\n transferProps: [\"variant\", \"colorScheme\", \"size\"],\n })\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items?.map((props, index) => {\n if (\"children\" in props) {\n const { children, reactions, contentProps, reactionsProps, ...rest } =\n props\n\n return (\n <BubbleItem key={index} {...rest}>\n <BubbleContent {...contentProps}>{children}</BubbleContent>\n {reactions ? (\n <BubbleReactions {...reactionsProps}>{reactions}</BubbleReactions>\n ) : null}\n </BubbleItem>\n )\n } else {\n return <BubbleGroup key={index} {...props} />\n }\n })\n }, [children, items])\n const context = useMemo(\n () => ({ colorScheme, size, variant }),\n [colorScheme, size, variant],\n )\n const componentContext = useMemo(\n () => ({\n contentProps,\n endGroupProps,\n endItemProps,\n groupProps,\n itemProps,\n reactionsProps,\n startGroupProps,\n startItemProps,\n }),\n [\n groupProps,\n itemProps,\n contentProps,\n reactionsProps,\n startItemProps,\n endItemProps,\n startGroupProps,\n endGroupProps,\n ],\n )\n\n return (\n <BubblePropsContext value={context}>\n <ComponentContext value={componentContext}>\n <styled.div {...rest}>{computedChildren}</styled.div>\n </ComponentContext>\n </BubblePropsContext>\n )\n}, \"root\")()\n\nexport interface BubbleGroupProps\n extends\n Merge<HTMLStyledProps, Pick<BubbleItemProps, \"direction\">>,\n ThemeProps<BubbleStyle> {\n /**\n * If provided, generate elements based on items.\n */\n items?: BubbleItemWithContent[]\n}\n\nexport const BubbleGroup = component<\"div\", BubbleGroupProps>((props) => {\n const [\n ,\n { colorScheme, size, variant, children, direction, items, ...rest },\n ] = useRootComponentProps(props, \"group\", {\n transferProps: [\"variant\", \"colorScheme\", \"size\"],\n })\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items?.map(\n (\n { children, reactions, contentProps, reactionsProps, ...rest },\n index,\n ) => (\n <BubbleItem key={index} {...rest}>\n <BubbleContent {...contentProps}>{children}</BubbleContent>\n {reactions ? (\n <BubbleReactions {...reactionsProps}>{reactions}</BubbleReactions>\n ) : null}\n </BubbleItem>\n ),\n )\n }, [children, items])\n\n const context = useMemo(\n () => ({ colorScheme, size, variant, direction }),\n [colorScheme, size, variant, direction],\n )\n\n return (\n <BubblePropsContext value={context}>\n <styled.div {...rest}>{computedChildren}</styled.div>\n </BubblePropsContext>\n )\n}, \"group\")(({ direction = \"start\", ...rest }) => {\n const { endGroupProps, groupProps, startGroupProps } = useComponentContext()\n const directionProps = direction === \"start\" ? startGroupProps : endGroupProps\n\n return mergeProps(groupProps, directionProps, { direction, ...rest })()\n})\n\nexport interface BubbleItemProps\n extends\n Omit<HTMLStyledProps, \"direction\">,\n Pick<BubbleRootProps, \"contentProps\">,\n ThemeProps<BubbleStyle> {\n /**\n * The inline direction of the bubble.\n *\n * @default 'start'\n */\n direction?: SimpleDirection\n}\n\nexport const BubbleItem = withProvider<\"div\", BubbleItemProps>(\n ({ children, direction, contentProps, ...rest }) => {\n const [content, customContent, reactions] = useSplitChildren(\n children,\n BubbleContent,\n BubbleReactions,\n )\n\n return (\n <styled.div data-direction={direction} {...rest}>\n {customContent ?? (\n <BubbleContent {...contentProps}>{content}</BubbleContent>\n )}\n\n {reactions}\n </styled.div>\n )\n },\n \"item\",\n)((props) => {\n const contextProps = useBubblePropsContext()\n const { endItemProps, itemProps, startItemProps } = useComponentContext()\n const direction = props.direction ?? contextProps?.direction ?? \"start\"\n const directionProps = direction === \"start\" ? startItemProps : endItemProps\n\n return mergeProps(contextProps, itemProps, directionProps, {\n ...props,\n direction,\n })()\n})\n\nexport interface BubbleContentProps extends HTMLStyledProps {}\n\nexport const BubbleContent = withContext<\"div\", BubbleContentProps>(\n \"div\",\n \"content\",\n)(undefined, (props) => {\n const { contentProps } = useComponentContext()\n\n return mergeProps(contentProps, props)()\n})\n\nexport interface BubbleReactionsProps extends HTMLStyledProps {\n /**\n * The placement of the reactions.\n *\n * @default 'end-end'\n */\n placement?: Exclude<Direction, \"end\" | \"start\" | `center-${string}`>\n}\n\nexport const BubbleReactions = withContext<\"div\", BubbleReactionsProps>(\n \"div\",\n \"reactions\",\n)(undefined, (props) => {\n const { reactionsProps } = useComponentContext()\n const { placement = \"end-end\", ...rest } = mergeProps(reactionsProps, props)()\n\n return { \"data-placement\": placement, ...rest }\n})\n"],"mappings":";;;;;;;;;AAwFA,MAAM,EACJ,WACA,kBACA,cAAc,oBACd,qB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