@yamada-ui/react 2.1.1-dev-20260303170810 → 2.1.1-dev-20260303175135
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/chart/area-chart.cjs +3 -8
- package/dist/cjs/components/chart/area-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/area-chart.style.cjs +2 -4
- package/dist/cjs/components/chart/area-chart.style.cjs.map +1 -1
- package/dist/cjs/components/chart/bar-chart.cjs +3 -8
- package/dist/cjs/components/chart/bar-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/bar-chart.style.cjs +2 -2
- package/dist/cjs/components/chart/bar-chart.style.cjs.map +1 -1
- package/dist/cjs/components/chart/cartesian-chart.cjs +14 -3
- package/dist/cjs/components/chart/cartesian-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/cartesian-chart.style.cjs +12 -5
- package/dist/cjs/components/chart/cartesian-chart.style.cjs.map +1 -1
- package/dist/cjs/components/chart/chart.cjs.map +1 -1
- package/dist/cjs/components/chart/composed-chart.cjs +67 -0
- package/dist/cjs/components/chart/composed-chart.cjs.map +1 -0
- package/dist/cjs/components/chart/composed-chart.namespace.cjs +32 -0
- package/dist/cjs/components/chart/composed-chart.namespace.cjs.map +1 -0
- package/dist/cjs/components/chart/composed-chart.style.cjs +14 -0
- package/dist/cjs/components/chart/composed-chart.style.cjs.map +1 -0
- package/dist/cjs/components/chart/donut-chart.cjs +3 -8
- package/dist/cjs/components/chart/donut-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/index.cjs +12 -13
- package/dist/cjs/components/chart/line-chart.cjs +3 -8
- package/dist/cjs/components/chart/line-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/pie-chart.cjs +3 -8
- package/dist/cjs/components/chart/pie-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/polar-chart.cjs +7 -2
- package/dist/cjs/components/chart/polar-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/radar-chart.cjs +3 -8
- package/dist/cjs/components/chart/radar-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/radial-chart.cjs +7 -14
- package/dist/cjs/components/chart/radial-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/use-cartesian-chart.cjs +32 -0
- package/dist/cjs/components/chart/use-cartesian-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/use-polar-chart.cjs +54 -0
- package/dist/cjs/components/chart/use-polar-chart.cjs.map +1 -1
- package/dist/cjs/components/icon/icons/fishing-rod-icon.cjs +17 -0
- package/dist/cjs/components/icon/icons/fishing-rod-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/index.cjs +42 -0
- package/dist/cjs/components/icon/icons/index.cjs.map +1 -1
- package/dist/cjs/components/icon/icons/zodiac-aquarius-icon.cjs +17 -0
- package/dist/cjs/components/icon/icons/zodiac-aquarius-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/zodiac-aries-icon.cjs +17 -0
- package/dist/cjs/components/icon/icons/zodiac-aries-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/zodiac-cancer-icon.cjs +17 -0
- package/dist/cjs/components/icon/icons/zodiac-cancer-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/zodiac-capricorn-icon.cjs +17 -0
- package/dist/cjs/components/icon/icons/zodiac-capricorn-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/zodiac-gemini-icon.cjs +17 -0
- package/dist/cjs/components/icon/icons/zodiac-gemini-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/zodiac-leo-icon.cjs +17 -0
- package/dist/cjs/components/icon/icons/zodiac-leo-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/zodiac-libra-icon.cjs +17 -0
- package/dist/cjs/components/icon/icons/zodiac-libra-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/zodiac-ophiuchus-icon.cjs +17 -0
- package/dist/cjs/components/icon/icons/zodiac-ophiuchus-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/zodiac-pisces-icon.cjs +17 -0
- package/dist/cjs/components/icon/icons/zodiac-pisces-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/zodiac-sagittarius-icon.cjs +17 -0
- package/dist/cjs/components/icon/icons/zodiac-sagittarius-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/zodiac-scorpio-icon.cjs +17 -0
- package/dist/cjs/components/icon/icons/zodiac-scorpio-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/zodiac-taurus-icon.cjs +17 -0
- package/dist/cjs/components/icon/icons/zodiac-taurus-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/zodiac-virgo-icon.cjs +17 -0
- package/dist/cjs/components/icon/icons/zodiac-virgo-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/index.cjs +28 -0
- package/dist/cjs/index.cjs +58 -19
- package/dist/esm/components/chart/area-chart.js +3 -8
- package/dist/esm/components/chart/area-chart.js.map +1 -1
- package/dist/esm/components/chart/area-chart.style.js +2 -4
- package/dist/esm/components/chart/area-chart.style.js.map +1 -1
- package/dist/esm/components/chart/bar-chart.js +3 -8
- package/dist/esm/components/chart/bar-chart.js.map +1 -1
- package/dist/esm/components/chart/bar-chart.style.js +2 -2
- package/dist/esm/components/chart/bar-chart.style.js.map +1 -1
- package/dist/esm/components/chart/cartesian-chart.js +15 -4
- package/dist/esm/components/chart/cartesian-chart.js.map +1 -1
- package/dist/esm/components/chart/cartesian-chart.style.js +12 -5
- package/dist/esm/components/chart/cartesian-chart.style.js.map +1 -1
- package/dist/esm/components/chart/chart.js.map +1 -1
- package/dist/esm/components/chart/composed-chart.js +63 -0
- package/dist/esm/components/chart/composed-chart.js.map +1 -0
- package/dist/esm/components/chart/composed-chart.namespace.js +27 -0
- package/dist/esm/components/chart/composed-chart.namespace.js.map +1 -0
- package/dist/esm/components/chart/composed-chart.style.js +14 -0
- package/dist/esm/components/chart/composed-chart.style.js.map +1 -0
- package/dist/esm/components/chart/donut-chart.js +3 -8
- package/dist/esm/components/chart/donut-chart.js.map +1 -1
- package/dist/esm/components/chart/index.js +6 -10
- package/dist/esm/components/chart/line-chart.js +3 -8
- package/dist/esm/components/chart/line-chart.js.map +1 -1
- package/dist/esm/components/chart/pie-chart.js +3 -8
- package/dist/esm/components/chart/pie-chart.js.map +1 -1
- package/dist/esm/components/chart/polar-chart.js +8 -3
- package/dist/esm/components/chart/polar-chart.js.map +1 -1
- package/dist/esm/components/chart/radar-chart.js +3 -8
- package/dist/esm/components/chart/radar-chart.js.map +1 -1
- package/dist/esm/components/chart/radial-chart.js +7 -14
- package/dist/esm/components/chart/radial-chart.js.map +1 -1
- package/dist/esm/components/chart/use-cartesian-chart.js +32 -1
- package/dist/esm/components/chart/use-cartesian-chart.js.map +1 -1
- package/dist/esm/components/chart/use-polar-chart.js +54 -1
- package/dist/esm/components/chart/use-polar-chart.js.map +1 -1
- package/dist/esm/components/icon/icons/fishing-rod-icon.js +16 -0
- package/dist/esm/components/icon/icons/fishing-rod-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/index.js +29 -1
- package/dist/esm/components/icon/icons/index.js.map +1 -1
- package/dist/esm/components/icon/icons/zodiac-aquarius-icon.js +16 -0
- package/dist/esm/components/icon/icons/zodiac-aquarius-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/zodiac-aries-icon.js +16 -0
- package/dist/esm/components/icon/icons/zodiac-aries-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/zodiac-cancer-icon.js +16 -0
- package/dist/esm/components/icon/icons/zodiac-cancer-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/zodiac-capricorn-icon.js +16 -0
- package/dist/esm/components/icon/icons/zodiac-capricorn-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/zodiac-gemini-icon.js +16 -0
- package/dist/esm/components/icon/icons/zodiac-gemini-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/zodiac-leo-icon.js +16 -0
- package/dist/esm/components/icon/icons/zodiac-leo-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/zodiac-libra-icon.js +16 -0
- package/dist/esm/components/icon/icons/zodiac-libra-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/zodiac-ophiuchus-icon.js +16 -0
- package/dist/esm/components/icon/icons/zodiac-ophiuchus-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/zodiac-pisces-icon.js +16 -0
- package/dist/esm/components/icon/icons/zodiac-pisces-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/zodiac-sagittarius-icon.js +16 -0
- package/dist/esm/components/icon/icons/zodiac-sagittarius-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/zodiac-scorpio-icon.js +16 -0
- package/dist/esm/components/icon/icons/zodiac-scorpio-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/zodiac-taurus-icon.js +16 -0
- package/dist/esm/components/icon/icons/zodiac-taurus-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/zodiac-virgo-icon.js +16 -0
- package/dist/esm/components/icon/icons/zodiac-virgo-icon.js.map +1 -0
- package/dist/esm/components/icon/index.js +15 -1
- package/dist/esm/index.js +38 -16
- package/dist/types/components/accordion/accordion.d.ts +4 -2
- package/dist/types/components/accordion/use-accordion.d.ts +11 -11
- package/dist/types/components/airy/airy.d.ts +3 -2
- package/dist/types/components/alert/alert.d.ts +5 -2
- package/dist/types/components/alert/alert.style.d.ts +1 -1
- package/dist/types/components/alpha-slider/alpha-slider.d.ts +3 -2
- package/dist/types/components/aspect-ratio/aspect-ratio.d.ts +2 -2
- package/dist/types/components/autocomplete/autocomplete.d.ts +4 -2
- package/dist/types/components/autocomplete/autocomplete.style.d.ts +1 -1
- package/dist/types/components/autocomplete/use-autocomplete.d.ts +7 -5
- package/dist/types/components/avatar/avatar.d.ts +3 -3
- package/dist/types/components/avatar/use-avatar-group.d.ts +2 -2
- package/dist/types/components/badge/badge.d.ts +2 -2
- package/dist/types/components/bleed/bleed.d.ts +2 -2
- package/dist/types/components/blockquote/blockquote.d.ts +2 -2
- package/dist/types/components/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/types/components/breadcrumb/use-breadcrumb.d.ts +2 -2
- package/dist/types/components/button/button-group.d.ts +1 -0
- package/dist/types/components/button/button.d.ts +3 -2
- package/dist/types/components/button/icon-button.d.ts +2 -2
- package/dist/types/components/calendar/calendar.d.ts +3 -2
- package/dist/types/components/calendar/calendar.style.d.ts +2 -2
- package/dist/types/components/calendar/use-calendar.d.ts +9 -8
- package/dist/types/components/card/card.d.ts +2 -2
- package/dist/types/components/carousel/carousel.d.ts +3 -2
- package/dist/types/components/carousel/carousel.style.d.ts +2 -2
- package/dist/types/components/carousel/use-carousel.d.ts +3 -3
- package/dist/types/components/center/center.d.ts +2 -2
- package/dist/types/components/chart/area-chart.d.ts +2 -8
- package/dist/types/components/chart/bar-chart.d.ts +2 -8
- package/dist/types/components/chart/cartesian-chart.d.ts +34 -18
- package/dist/types/components/chart/cartesian-chart.style.d.ts +1 -1
- package/dist/types/components/chart/chart.d.ts +8 -8
- package/dist/types/components/chart/composed-chart.d.ts +32 -0
- package/dist/types/components/chart/composed-chart.namespace.d.ts +11 -0
- package/dist/types/components/chart/composed-chart.style.d.ts +10 -0
- package/dist/types/components/chart/donut-chart.d.ts +4 -10
- package/dist/types/components/chart/index.d.ts +5 -9
- package/dist/types/components/chart/line-chart.d.ts +4 -10
- package/dist/types/components/chart/pie-chart.d.ts +4 -10
- package/dist/types/components/chart/polar-chart.d.ts +9 -4
- package/dist/types/components/chart/polar-chart.style.d.ts +1 -1
- package/dist/types/components/chart/radar-chart.d.ts +1 -2
- package/dist/types/components/chart/radial-chart.d.ts +4 -10
- package/dist/types/components/chart/use-cartesian-chart.d.ts +23 -2
- package/dist/types/components/chart/use-chart.d.ts +2 -2
- package/dist/types/components/chart/use-polar-chart.d.ts +33 -1
- package/dist/types/components/checkbox/checkbox-group.d.ts +2 -0
- package/dist/types/components/checkbox/checkbox.d.ts +5 -4
- package/dist/types/components/checkbox/use-checkbox-group.d.ts +3 -2
- package/dist/types/components/checkbox/use-checkbox.d.ts +1 -0
- package/dist/types/components/checkbox-card/checkbox-card-group.d.ts +3 -0
- package/dist/types/components/checkbox-card/checkbox-card.d.ts +7 -5
- package/dist/types/components/checkbox-card/checkbox-card.style.d.ts +1 -1
- package/dist/types/components/circle-progress/circle-progress.d.ts +3 -2
- package/dist/types/components/close-button/close-button.d.ts +3 -2
- package/dist/types/components/code/code.d.ts +2 -2
- package/dist/types/components/collapse/collapse.d.ts +3 -2
- package/dist/types/components/color-picker/color-picker.d.ts +6 -2
- package/dist/types/components/color-picker/color-picker.style.d.ts +1 -1
- package/dist/types/components/color-picker/use-color-picker.d.ts +5 -2
- package/dist/types/components/color-selector/color-selector.d.ts +6 -2
- package/dist/types/components/color-selector/color-selector.style.d.ts +2 -2
- package/dist/types/components/color-selector/use-color-selector.d.ts +5 -3
- package/dist/types/components/color-swatch/color-swatch.d.ts +2 -2
- package/dist/types/components/container/container.d.ts +2 -2
- package/dist/types/components/data-list/data-list.d.ts +2 -2
- package/dist/types/components/data-list/data-list.style.d.ts +1 -1
- package/dist/types/components/date-picker/date-picker.d.ts +5 -2
- package/dist/types/components/date-picker/date-picker.style.d.ts +1 -1
- package/dist/types/components/date-picker/use-date-picker.d.ts +7 -4
- package/dist/types/components/drawer/drawer.d.ts +5 -2
- package/dist/types/components/drawer/use-drawer.d.ts +2 -0
- package/dist/types/components/dropzone/dropzone.d.ts +8 -5
- package/dist/types/components/dropzone/dropzone.style.d.ts +1 -1
- package/dist/types/components/dropzone/use-dropzone.d.ts +1 -0
- package/dist/types/components/editable/editable.d.ts +3 -2
- package/dist/types/components/editable/use-editable.d.ts +3 -2
- package/dist/types/components/em/em.d.ts +2 -2
- package/dist/types/components/empty-state/empty-state.d.ts +2 -2
- package/dist/types/components/empty-state/empty-state.style.d.ts +2 -2
- package/dist/types/components/fade/fade.d.ts +3 -2
- package/dist/types/components/fade-scale/fade-scale.d.ts +1 -0
- package/dist/types/components/field/field.d.ts +3 -3
- package/dist/types/components/field/field.style.d.ts +2 -2
- package/dist/types/components/field/use-field-props.d.ts +4 -4
- package/dist/types/components/fieldset/fieldset.d.ts +4 -3
- package/dist/types/components/fieldset/fieldset.style.d.ts +1 -1
- package/dist/types/components/file-button/file-button.d.ts +4 -2
- package/dist/types/components/file-button/use-file-button.d.ts +20 -18
- package/dist/types/components/file-input/file-input.d.ts +4 -2
- package/dist/types/components/file-input/use-file-input.d.ts +16 -15
- package/dist/types/components/flex/flex.d.ts +2 -2
- package/dist/types/components/flip/flip.d.ts +5 -4
- package/dist/types/components/float/float.d.ts +2 -2
- package/dist/types/components/form/form.d.ts +4 -3
- package/dist/types/components/form/form.style.d.ts +1 -1
- package/dist/types/components/format/format-byte.d.ts +4 -4
- package/dist/types/components/format/format-date-time.d.ts +4 -4
- package/dist/types/components/format/format-number.d.ts +2 -2
- package/dist/types/components/format/use-format-byte.d.ts +1 -0
- package/dist/types/components/format/use-format-date-time.d.ts +1 -0
- package/dist/types/components/format/use-format-number.d.ts +1 -0
- package/dist/types/components/grid/grid-item.d.ts +2 -2
- package/dist/types/components/grid/grid.d.ts +2 -2
- package/dist/types/components/group/group.d.ts +3 -2
- package/dist/types/components/group/use-group.d.ts +2 -2
- package/dist/types/components/heading/heading.d.ts +2 -2
- package/dist/types/components/highlight/highlight.d.ts +2 -0
- package/dist/types/components/hue-slider/hue-slider.d.ts +4 -3
- package/dist/types/components/icon/icon.d.ts +4 -4
- package/dist/types/components/icon/icons/fishing-rod-icon.d.ts +15 -0
- package/dist/types/components/icon/icons/index.d.ts +16 -2
- package/dist/types/components/icon/icons/index.types.d.ts +1 -1
- package/dist/types/components/icon/icons/zodiac-aquarius-icon.d.ts +15 -0
- package/dist/types/components/icon/icons/zodiac-aries-icon.d.ts +15 -0
- package/dist/types/components/icon/icons/zodiac-cancer-icon.d.ts +15 -0
- package/dist/types/components/icon/icons/zodiac-capricorn-icon.d.ts +15 -0
- package/dist/types/components/icon/icons/zodiac-gemini-icon.d.ts +15 -0
- package/dist/types/components/icon/icons/zodiac-leo-icon.d.ts +15 -0
- package/dist/types/components/icon/icons/zodiac-libra-icon.d.ts +15 -0
- package/dist/types/components/icon/icons/zodiac-ophiuchus-icon.d.ts +15 -0
- package/dist/types/components/icon/icons/zodiac-pisces-icon.d.ts +15 -0
- package/dist/types/components/icon/icons/zodiac-sagittarius-icon.d.ts +15 -0
- package/dist/types/components/icon/icons/zodiac-scorpio-icon.d.ts +15 -0
- package/dist/types/components/icon/icons/zodiac-taurus-icon.d.ts +15 -0
- package/dist/types/components/icon/icons/zodiac-virgo-icon.d.ts +15 -0
- package/dist/types/components/icon/index.d.ts +15 -1
- package/dist/types/components/image/image.d.ts +2 -2
- package/dist/types/components/indicator/indicator.d.ts +5 -4
- package/dist/types/components/infinite-scroll-area/infinite-scroll-area.d.ts +2 -2
- package/dist/types/components/input/input-addon.d.ts +2 -2
- package/dist/types/components/input/input-element.d.ts +2 -2
- package/dist/types/components/input/input-group.d.ts +2 -0
- package/dist/types/components/input/input.d.ts +3 -2
- package/dist/types/components/kbd/kbd.d.ts +2 -2
- package/dist/types/components/link/link.d.ts +2 -2
- package/dist/types/components/link-box/link-box.d.ts +2 -2
- package/dist/types/components/list/list.d.ts +2 -2
- package/dist/types/components/loading/loading-provider.d.ts +2 -2
- package/dist/types/components/loading/loading.d.ts +4 -3
- package/dist/types/components/loading/use-loading-component.d.ts +1 -0
- package/dist/types/components/mark/mark.d.ts +2 -2
- package/dist/types/components/menu/menu.d.ts +3 -2
- package/dist/types/components/menu/use-menu.d.ts +11 -11
- package/dist/types/components/modal/modal.d.ts +6 -2
- package/dist/types/components/native-accordion/native-accordion.d.ts +2 -2
- package/dist/types/components/native-accordion/use-native-accordion.d.ts +2 -2
- package/dist/types/components/native-popover/native-popover.d.ts +2 -2
- package/dist/types/components/native-select/native-select.d.ts +4 -2
- package/dist/types/components/native-select/native-select.style.d.ts +1 -1
- package/dist/types/components/native-select/use-native-select.d.ts +1 -0
- package/dist/types/components/native-table/native-table.d.ts +4 -4
- package/dist/types/components/notice/use-notice.d.ts +3 -0
- package/dist/types/components/number-input/number-input.d.ts +3 -2
- package/dist/types/components/number-input/number-input.style.d.ts +1 -1
- package/dist/types/components/number-input/use-number-input.d.ts +1 -0
- package/dist/types/components/pagination/pagination.d.ts +3 -2
- package/dist/types/components/pagination/use-pagination.d.ts +2 -2
- package/dist/types/components/password-input/password-input.d.ts +3 -2
- package/dist/types/components/password-input/password-input.style.d.ts +1 -1
- package/dist/types/components/password-input/strength-meter.d.ts +2 -2
- package/dist/types/components/password-input/use-password-input.d.ts +3 -2
- package/dist/types/components/picture/picture.d.ts +1 -0
- package/dist/types/components/pin-input/pin-input.d.ts +4 -2
- package/dist/types/components/pin-input/pin-input.style.d.ts +1 -1
- package/dist/types/components/pin-input/use-pin-input.d.ts +8 -7
- package/dist/types/components/popover/popover.d.ts +3 -2
- package/dist/types/components/progress/progress.d.ts +4 -4
- package/dist/types/components/progress/use-progress.d.ts +706 -706
- package/dist/types/components/qr-code/qr-code.d.ts +2 -2
- package/dist/types/components/radio/radio-group.d.ts +2 -0
- package/dist/types/components/radio/radio.d.ts +4 -3
- package/dist/types/components/radio/use-radio-group.d.ts +3 -2
- package/dist/types/components/radio/use-radio.d.ts +1 -0
- package/dist/types/components/radio-card/radio-card-group.d.ts +3 -0
- package/dist/types/components/radio-card/radio-card.d.ts +6 -4
- package/dist/types/components/radio-card/radio-card.style.d.ts +1 -1
- package/dist/types/components/rating/use-rating.d.ts +8 -7
- package/dist/types/components/reorder/reorder.d.ts +3 -2
- package/dist/types/components/reorder/use-reorder.d.ts +3 -3
- package/dist/types/components/resizable/resizable.d.ts +2 -2
- package/dist/types/components/resizable/use-resizable.d.ts +2 -2
- package/dist/types/components/ripple/ripple.d.ts +3 -2
- package/dist/types/components/ripple/use-ripple.d.ts +2 -2
- package/dist/types/components/rotate/rotate.d.ts +3 -2
- package/dist/types/components/saturation-slider/saturation-slider.d.ts +2 -2
- package/dist/types/components/saturation-slider/use-saturation-slider.d.ts +3 -2
- package/dist/types/components/scroll-area/scroll-area.d.ts +2 -2
- package/dist/types/components/segmented-control/segmented-control.d.ts +3 -2
- package/dist/types/components/segmented-control/use-segmented-control.d.ts +10 -9
- package/dist/types/components/select/select.d.ts +4 -2
- package/dist/types/components/select/select.style.d.ts +1 -1
- package/dist/types/components/select/use-select.d.ts +6 -4
- package/dist/types/components/separator/separator.d.ts +2 -2
- package/dist/types/components/simple-grid/simple-grid.d.ts +3 -2
- package/dist/types/components/skeleton/skeleton.d.ts +2 -2
- package/dist/types/components/slide/slide.d.ts +3 -2
- package/dist/types/components/slide-fade/slide-fade.d.ts +3 -2
- package/dist/types/components/slider/slider.d.ts +2 -2
- package/dist/types/components/slider/use-slider.d.ts +3 -2
- package/dist/types/components/snacks/snacks.d.ts +2 -0
- package/dist/types/components/snacks/use-snacks.d.ts +1 -0
- package/dist/types/components/stack/h-stack.d.ts +2 -2
- package/dist/types/components/stack/stack.d.ts +2 -2
- package/dist/types/components/stack/v-stack.d.ts +2 -2
- package/dist/types/components/stack/z-stack.d.ts +2 -2
- package/dist/types/components/stat/stat.d.ts +2 -2
- package/dist/types/components/stat/stat.style.d.ts +2 -2
- package/dist/types/components/status/status.d.ts +2 -2
- package/dist/types/components/steps/steps.d.ts +2 -2
- package/dist/types/components/steps/steps.style.d.ts +1 -1
- package/dist/types/components/steps/use-steps.d.ts +10 -10
- package/dist/types/components/switch/switch.d.ts +2 -2
- package/dist/types/components/switch/use-switch.d.ts +1 -0
- package/dist/types/components/table/table.d.ts +4 -2
- package/dist/types/components/tabs/tabs.d.ts +2 -2
- package/dist/types/components/tabs/use-tabs.d.ts +16 -16
- package/dist/types/components/tag/tag.d.ts +2 -2
- package/dist/types/components/text/text.d.ts +2 -2
- package/dist/types/components/textarea/textarea.d.ts +4 -2
- package/dist/types/components/textarea/use-autosize.d.ts +2 -2
- package/dist/types/components/timeline/timeline.d.ts +5 -5
- package/dist/types/components/timeline/timeline.style.d.ts +2 -2
- package/dist/types/components/tip/tip.d.ts +2 -0
- package/dist/types/components/toggle/toggle-group.d.ts +1 -1
- package/dist/types/components/toggle/toggle.d.ts +5 -3
- package/dist/types/components/toggle/use-toggle-group.d.ts +2 -2
- package/dist/types/components/toggle/use-toggle.d.ts +3 -2
- package/dist/types/components/tooltip/tooltip.d.ts +4 -2
- package/dist/types/components/visually-hidden/visually-hidden.d.ts +2 -2
- package/dist/types/components/wrap/wrap.d.ts +3 -2
- package/dist/types/core/components/create-component.d.ts +7 -9
- package/dist/types/core/components/index.types.d.ts +0 -1
- package/dist/types/core/components/use-component-style.d.ts +0 -2
- package/dist/types/core/components/utils.d.ts +0 -1
- package/dist/types/core/constant.d.ts +0 -1
- package/dist/types/core/css/calc.d.ts +0 -1
- package/dist/types/core/css/config.d.ts +0 -1
- package/dist/types/core/css/css.d.ts +0 -1
- package/dist/types/core/css/index.types.d.ts +0 -1
- package/dist/types/core/css/styles.d.ts +0 -1
- package/dist/types/core/css/token.d.ts +0 -1
- package/dist/types/core/css/use-css.d.ts +0 -1
- package/dist/types/core/css/utils.d.ts +0 -2
- package/dist/types/core/generated-theme-tokens.types.d.ts +0 -1
- package/dist/types/core/index.d.ts +0 -2
- package/dist/types/core/system/color-mode-provider.d.ts +2 -2
- package/dist/types/core/system/config.d.ts +0 -1
- package/dist/types/core/system/factory.d.ts +0 -1
- package/dist/types/core/system/index.types.d.ts +0 -1
- package/dist/types/core/system/storage-script.d.ts +3 -3
- package/dist/types/core/system/styled.d.ts +2 -3
- package/dist/types/core/system/system-provider.d.ts +2 -2
- package/dist/types/core/system/var.d.ts +0 -2
- package/dist/types/hooks/use-async-callback/index.d.ts +1 -0
- package/dist/types/hooks/use-breakpoint/use-breakpoint-state.d.ts +2 -2
- package/dist/types/hooks/use-clipboard/index.d.ts +2 -2
- package/dist/types/hooks/use-combobox/index.d.ts +13 -12
- package/dist/types/hooks/use-counter/index.d.ts +2 -2
- package/dist/types/hooks/use-descendants/index.d.ts +2 -2
- package/dist/types/hooks/use-field-sizing/index.d.ts +2 -2
- package/dist/types/hooks/use-popper/index.d.ts +2 -2
- package/dist/types/hooks/use-resize-observer/index.d.ts +3 -3
- package/dist/types/index.d.ts +123 -10
- package/dist/types/providers/i18n-provider/i18n-provider.d.ts +3 -3
- package/dist/types/providers/ui-provider/ui-provider.d.ts +3 -2
- package/package.json +5 -5
- package/dist/cjs/components/chart/use-area-chart.cjs +0 -41
- package/dist/cjs/components/chart/use-area-chart.cjs.map +0 -1
- package/dist/cjs/components/chart/use-bar-chart.cjs +0 -41
- package/dist/cjs/components/chart/use-bar-chart.cjs.map +0 -1
- package/dist/cjs/components/chart/use-line-chart.cjs +0 -41
- package/dist/cjs/components/chart/use-line-chart.cjs.map +0 -1
- package/dist/cjs/components/chart/use-pie-chart.cjs +0 -43
- package/dist/cjs/components/chart/use-pie-chart.cjs.map +0 -1
- package/dist/cjs/components/chart/use-radar-chart.cjs +0 -45
- package/dist/cjs/components/chart/use-radar-chart.cjs.map +0 -1
- package/dist/cjs/components/chart/use-radial-chart.cjs +0 -63
- package/dist/cjs/components/chart/use-radial-chart.cjs.map +0 -1
- package/dist/esm/components/chart/use-area-chart.js +0 -40
- package/dist/esm/components/chart/use-area-chart.js.map +0 -1
- package/dist/esm/components/chart/use-bar-chart.js +0 -40
- package/dist/esm/components/chart/use-bar-chart.js.map +0 -1
- package/dist/esm/components/chart/use-line-chart.js +0 -40
- package/dist/esm/components/chart/use-line-chart.js.map +0 -1
- package/dist/esm/components/chart/use-pie-chart.js +0 -42
- package/dist/esm/components/chart/use-pie-chart.js.map +0 -1
- package/dist/esm/components/chart/use-radar-chart.js +0 -44
- package/dist/esm/components/chart/use-radar-chart.js.map +0 -1
- package/dist/esm/components/chart/use-radial-chart.js +0 -62
- package/dist/esm/components/chart/use-radial-chart.js.map +0 -1
- package/dist/types/components/chart/use-area-chart.d.ts +0 -29
- package/dist/types/components/chart/use-bar-chart.d.ts +0 -29
- package/dist/types/components/chart/use-line-chart.d.ts +0 -29
- package/dist/types/components/chart/use-pie-chart.d.ts +0 -30
- package/dist/types/components/chart/use-radar-chart.d.ts +0 -31
- package/dist/types/components/chart/use-radial-chart.d.ts +0 -40
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.cjs","names":["createSlotComponent","chartStyle","useChart","useSplitChildren","ChartContext","styled","ResponsiveContainer","Fragment","varAttr","createContext","useChartLegend","Legend","useChartTooltip","Tooltip","useChartLabelList","LabelList","useChartLabel","Label"],"sources":["../../../../src/components/chart/chart.tsx"],"sourcesContent":["\"use client\"\n\nimport type {\n JSXElementConstructor,\n PropsWithChildren,\n ReactElement,\n ReactNode,\n RefObject,\n} from \"react\"\nimport type {\n ActiveDotProps,\n DataKey,\n DefaultLegendContentProps,\n DotItemDotProps,\n DotProps,\n LabelProps,\n RenderableText,\n ResponsiveContainerProps,\n TooltipContentProps,\n} from \"recharts\"\nimport type { CSSProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { Dict, Merge } from \"../../utils\"\nimport type { ChartStyle } from \"./chart.style\"\nimport type {\n UseChartLabelListProps,\n UseChartLabelProps,\n UseChartLegendProps,\n UseChartLegendReturn,\n UseChartTooltipProps,\n} from \"./use-chart\"\nimport { Fragment, isValidElement, useMemo, useRef } from \"react\"\nimport {\n Label,\n LabelList,\n Legend,\n ResponsiveContainer,\n Tooltip,\n} from \"recharts\"\nimport { createSlotComponent, styled, varAttr } from \"../../core\"\nimport {\n createContext,\n isArray,\n isNull,\n isNumber,\n isObject,\n isString,\n isUndefined,\n useSplitChildren,\n} from \"../../utils\"\nimport { chartStyle } from \"./chart.style\"\nimport {\n ChartContext,\n useChart,\n useChartLabel,\n useChartLabelList,\n useChartLegend,\n useChartTooltip,\n} from \"./use-chart\"\n\nexport type ChartDot =\n | ((props: DotItemDotProps) => ReactNode)\n | boolean\n | Merge<Partial<DotProps>, HTMLStyledProps<\"circle\">>\n | ReactElement\n\nexport type ChartActiveDot =\n | ((props: ActiveDotProps) => ReactNode)\n | boolean\n | Merge<Partial<ActiveDotProps>, HTMLStyledProps<\"circle\">>\n | ReactElement\n\nexport type ChartLabel =\n | ((props: any) => ReactElement | RenderableText)\n | boolean\n | (Merge<\n HTMLStyledProps<\"text\">,\n Pick<\n LabelProps,\n | \"angle\"\n | \"content\"\n | \"formatter\"\n | \"index\"\n | \"labelRef\"\n | \"offset\"\n | \"parentViewBox\"\n | \"position\"\n | \"textBreakAll\"\n | \"value\"\n | \"viewBox\"\n | \"zIndex\"\n >\n > & { dataKey?: DataKey<any> })\n | number\n | ReactElement\n | string\n\nexport type ChartLabelList =\n | ((props: LabelProps) => ReactElement | RenderableText)\n | boolean\n | ChartLabelListProps\n | ReactElement\n\nexport type ChartTickLine = boolean | HTMLStyledProps<\"line\">\n\ntype GradientStrategy = \"invert\" | \"shade\" | \"tint\"\n\nexport function mergeSeries<Y>(\n series: Y[],\n color: CSSProps[\"color\"] = \"mono\",\n strategy: GradientStrategy = \"invert\",\n): (Y & { color: CSSProps[\"fill\"] })[] {\n const colors = gradients(series.length, color, strategy)\n\n return series.map((item, index) => ({ ...item, color: colors[index] }))\n}\n\nexport function mergeData<Y>(\n data: Y[],\n color: CSSProps[\"fill\"] = \"mono\",\n strategy: GradientStrategy = \"invert\",\n): (Y & { fill: CSSProps[\"fill\"] })[] {\n const colors = gradients(data.length, color, strategy)\n\n return data.map((item, index) => ({ ...item, fill: colors[index] }))\n}\n\nexport function gradients(\n length: number,\n color: CSSProps[\"color\"] = \"mono\",\n strategy: GradientStrategy = \"invert\",\n): CSSProps[\"fill\"][] {\n return Array.from({ length }, (_, index) => {\n const value = Math.floor(100 - (100 / length) * index)\n const percent = `${value}%`\n\n if (strategy === \"invert\") {\n return [\n `tint(colors.${color}, ${percent})`,\n `shade(colors.${color}, ${percent})`,\n ]\n } else {\n return `${strategy}(colors.${color}, ${percent})`\n }\n })\n}\n\nfunction parseJSON(value: any) {\n try {\n return JSON.parse(value)\n } catch {\n return value\n }\n}\n\ninterface ComponentContext extends Pick<\n ChartProps,\n \"legendProps\" | \"tooltipProps\"\n> {\n nameKeyRef: RefObject<string | undefined>\n}\n\nexport interface ChartProps extends HTMLStyledProps, ThemeProps<ChartStyle> {\n /**\n * The components to render the chart components.\n */\n components: {\n component: JSXElementConstructor<any>\n fallback: ReactNode\n }[]\n /**\n * The function to render the chart.\n */\n render: (props: PropsWithChildren) => ReactNode\n /**\n * The color of the label list.\n */\n labelListColor?: CSSProps[\"color\"]\n /**\n * The fill of the label list.\n */\n labelListFill?: CSSProps[\"fill\"]\n /**\n * The fill of the tooltip cursor.\n */\n tooltipCursorFill?: CSSProps[\"fill\"]\n /**\n * The fill opacity of the tooltip cursor.\n */\n tooltipCursorFillOpacity?: CSSProps[\"fillOpacity\"]\n /**\n * The stroke of the tooltip cursor.\n */\n tooltipCursorStroke?: CSSProps[\"stroke\"]\n /**\n * If `true`, legend is visible.\n *\n * @default false\n */\n withLegend?: boolean\n /**\n * If `true`, tooltip is visible.\n *\n * @default true\n */\n withTooltip?: boolean\n /**\n * Props for the legend component.\n */\n legendProps?: ChartLegendProps\n /**\n * Props for the responsive container component.\n */\n responsiveContainerProps?: ResponsiveContainerProps\n /**\n * Props for the tooltip component.\n */\n tooltipProps?: ChartTooltipProps\n}\n\nconst {\n ComponentContext,\n PropsContext: ChartPropsContext,\n useComponentContext: useChartComponentContext,\n usePropsContext: useChartPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<ChartProps, ChartStyle, ComponentContext>(\n \"chart\",\n chartStyle,\n)\n\nexport { ChartPropsContext, useChartComponentContext, useChartPropsContext }\n\nexport const Chart = withProvider(\n ({\n children,\n components: componentsProp,\n render,\n withLegend = false,\n withTooltip = true,\n legendProps,\n responsiveContainerProps,\n tooltipProps,\n ...rest\n }: ChartProps) => {\n const { highlightedDataKey, onHighlight } = useChart()\n const nameKeyRef = useRef<string | undefined>(undefined)\n const components = useMemo(\n () => [\n ...componentsProp,\n {\n component: ChartLegend,\n fallback: withLegend ? <ChartLegend /> : null,\n },\n {\n component: ChartTooltip,\n fallback: withTooltip ? <ChartTooltip /> : null,\n },\n ],\n [componentsProp, withLegend, withTooltip],\n )\n const [omittedChildren, ...customComponents] = useSplitChildren(\n children,\n ...components.map(({ component }) => component),\n )\n const context = useMemo(\n () => ({\n highlightedDataKey,\n onHighlight,\n }),\n [highlightedDataKey, onHighlight],\n )\n const componentContext = useMemo(\n () => ({\n nameKeyRef,\n legendProps,\n tooltipProps,\n }),\n [legendProps, tooltipProps],\n )\n\n return (\n <ChartContext value={context}>\n <ComponentContext value={componentContext}>\n <styled.div {...rest}>\n <ResponsiveContainer {...responsiveContainerProps}>\n {render({\n children: (\n <>\n {components.map(({ fallback }, index) => (\n <Fragment key={index}>\n {customComponents[index] ?? fallback}\n </Fragment>\n ))}\n\n {omittedChildren}\n </>\n ),\n })}\n </ResponsiveContainer>\n </styled.div>\n </ComponentContext>\n </ChartContext>\n )\n },\n \"root\",\n)(\n undefined,\n ({\n labelListColor,\n labelListFill,\n tooltipCursorFill,\n tooltipCursorFillOpacity,\n tooltipCursorStroke,\n ...rest\n }) => ({\n \"--label-list-color\": varAttr(labelListColor, \"colors\"),\n \"--label-list-fill\": varAttr(labelListFill, \"colors\"),\n \"--tooltip-cursor-fill\": varAttr(tooltipCursorFill, \"colors\"),\n \"--tooltip-cursor-fill-opacity\": tooltipCursorFillOpacity,\n \"--tooltip-cursor-stroke\": varAttr(tooltipCursorStroke, \"colors\"),\n ...rest,\n }),\n)\n\ninterface ChartLegendContext extends Pick<\n UseChartLegendReturn,\n \"getLegendItemProps\"\n> {}\n\nconst [ChartLegendContext, useChartLegendContext] =\n createContext<ChartLegendContext>({\n name: \"ChartLegendContext\",\n })\n\nexport interface ChartLegendProps extends Merge<\n HTMLStyledProps,\n UseChartLegendProps\n> {\n /**\n * Props for the content component.\n */\n contentProps?: Omit<ChartLegendContentProps, \"formatter\" | \"payload\">\n}\n\nexport const ChartLegend = withContext<\"div\", ChartLegendProps>((props) => {\n const { legendProps } = useChartComponentContext()\n const { contentProps, ...rest } = { ...legendProps, ...props }\n const {\n getLegendContentProps,\n getLegendItemProps,\n getLegendProps,\n getRootProps,\n } = useChartLegend({\n content: ({ formatter, payload }) => (\n <ChartLegendContent\n formatter={formatter}\n payload={payload}\n {...getLegendContentProps(contentProps)}\n />\n ),\n ...rest,\n })\n const context = useMemo(() => ({ getLegendItemProps }), [getLegendItemProps])\n\n return (\n <ChartLegendContext value={context}>\n <styled.div asChild {...getRootProps()}>\n <Legend {...getLegendProps()} />\n </styled.div>\n </ChartLegendContext>\n )\n}, \"legend\")()\n\ninterface ChartLegendContentProps\n extends\n HTMLStyledProps,\n Pick<DefaultLegendContentProps, \"formatter\" | \"payload\"> {\n /**\n * If `true`, swatch is visible.\n */\n withSwatch?: boolean\n}\n\nconst ChartLegendContent = withContext<\"div\", ChartLegendContentProps>(\n ({ formatter, payload, withSwatch = true, ...rest }) => {\n const { nameKeyRef } = useChartComponentContext()\n const { getLegendItemProps } = useChartLegendContext()\n\n return (\n <styled.div {...rest}>\n {payload?.map((data, index) => {\n let value = data.value\n\n if (nameKeyRef.current)\n value = (data.payload as any)?.[nameKeyRef.current]\n\n const dataKey =\n isString(data.dataKey) || isNumber(data.dataKey)\n ? data.dataKey\n : value\n const color = parseJSON(data.color)\n const formattedValue = formatter?.(value, data, index) ?? value\n\n return (\n <ChartLegendItem key={index} {...getLegendItemProps({ dataKey })}>\n {withSwatch ? <ChartLegendSwatch bg={color} /> : null}\n <ChartLegendValue>{formattedValue}</ChartLegendValue>\n </ChartLegendItem>\n )\n })}\n </styled.div>\n )\n },\n \"legendContent\",\n)()\n\ninterface ChartLegendItemProps extends HTMLStyledProps {}\n\nconst ChartLegendItem = withContext<\"div\", ChartLegendItemProps>(\n \"div\",\n \"legendItem\",\n)()\n\ninterface ChartLegendSwatchProps extends HTMLStyledProps {}\n\nconst ChartLegendSwatch = withContext<\"div\", ChartLegendSwatchProps>(\n \"div\",\n \"legendSwatch\",\n)()\n\ninterface ChartLegendValueProps extends HTMLStyledProps<\"span\"> {}\n\nconst ChartLegendValue = withContext<\"span\", ChartLegendValueProps>(\n \"span\",\n \"legendValue\",\n)()\n\nexport interface ChartTooltipProps<\n Y extends (number | string)[] | number | string = number,\n M extends number | string = string,\n> extends Omit<Merge<HTMLStyledProps, UseChartTooltipProps<Y, M>>, \"cursor\"> {\n /**\n * Props for the cursor component.\n */\n cursor?: boolean | ChartTooltipCursorProps | ReactElement\n /**\n * Props for the content component.\n */\n contentProps?: Omit<\n ChartTooltipContentProps,\n \"formatter\" | \"label\" | \"labelFormatter\" | \"payload\"\n >\n}\n\nexport const ChartTooltip = <\n Y extends (number | string)[] | number | string,\n M extends number | string,\n>(\n props: ChartTooltipProps<Y, M>,\n) => {\n const { tooltipProps } = useChartComponentContext()\n const {\n cursor = false,\n contentProps,\n ...rest\n } = {\n ...tooltipProps,\n ...props,\n } as ChartTooltipProps<Y, M>\n const { getContentProps, getRootProps } = useChartTooltip({\n content: ({ formatter, label, labelFormatter, payload }) => (\n <ChartTooltipContent\n formatter={formatter}\n label={label}\n labelFormatter={labelFormatter}\n payload={payload}\n {...getContentProps(contentProps)}\n />\n ),\n cursor:\n isValidElement(cursor) || !cursor ? (\n cursor\n ) : (\n <ChartTooltipCursor {...(isObject(cursor) ? cursor : {})} />\n ),\n ...rest,\n })\n\n return <Tooltip {...getRootProps()} />\n}\n\ninterface ChartTooltipCursorProps extends Omit<\n HTMLStyledProps<\"path\">,\n \"height\" | \"points\" | \"width\"\n> {\n brushBottom?: number\n height?: number\n payload?: Dict[]\n payloadIndex?: number\n points?: { x: number; y: number }[]\n width?: number\n}\n\nconst ChartTooltipCursor = withContext<\"path\", ChartTooltipCursorProps>(\n \"path\",\n \"tooltipCursor\",\n)(\n undefined,\n ({\n bottom: _bottom,\n brushBottom: _brushBottom,\n fill,\n height,\n left: _left,\n payload: _payload,\n payloadIndex: _payloadIndex,\n points,\n right: _right,\n stroke,\n top: _top,\n width,\n x,\n y,\n ...rest\n }) => {\n const d = !!points\n ? `M${points[0]?.x},${points[0]?.y}L${points[1]?.x},${points[1]?.y}`\n : `M ${x},${y} h ${width} v ${height} h -${width} Z`\n return {\n asChild: true,\n children: <path d={d} height={height} width={width} />,\n fill: fill === \"#ccc\" ? undefined : fill,\n stroke: stroke === \"#ccc\" ? undefined : stroke,\n ...rest,\n }\n },\n)\n\ninterface ChartTooltipContentProps\n extends\n HTMLStyledProps,\n Pick<\n TooltipContentProps<any, any>,\n \"formatter\" | \"label\" | \"labelFormatter\" | \"payload\"\n > {\n /**\n * If `true`, swatch is visible.\n */\n withSwatch?: boolean\n}\n\nconst ChartTooltipContent = withContext<\"div\", ChartTooltipContentProps>(\n ({\n formatter,\n label: labelProp,\n labelFormatter,\n payload,\n withSwatch = true,\n ...rest\n }) => {\n const { nameKeyRef } = useChartComponentContext()\n const label = labelFormatter\n ? labelFormatter(labelProp, payload)\n : labelProp\n\n return (\n <styled.div {...rest}>\n {!isUndefined(label) && !isNull(label) ? (\n <ChartTooltipLabel>{label}</ChartTooltipLabel>\n ) : null}\n\n <ChartTooltipList>\n {payload.map((data, index) => {\n if (nameKeyRef.current) data.name = data.payload[nameKeyRef.current]\n\n const color = parseJSON(data.color) || data.payload.fill\n const result =\n formatter?.(data.value, data.name, data, index, payload) ??\n (isArray(data.value) ? data.value.join(\", \") : data.value)\n const [value, name] = isArray(result) ? result : [result, data.name]\n\n return (\n <ChartTooltipItem key={index}>\n {withSwatch ? <ChartTooltipSwatch bg={color} /> : null}\n <ChartTooltipName>{name}</ChartTooltipName>\n <ChartTooltipValue>{value}</ChartTooltipValue>\n </ChartTooltipItem>\n )\n })}\n </ChartTooltipList>\n </styled.div>\n )\n },\n \"tooltipContent\",\n)()\n\ninterface ChartTooltipLabel extends HTMLStyledProps<\"p\"> {}\n\nconst ChartTooltipLabel = withContext<\"p\", ChartTooltipLabel>(\n \"p\",\n \"tooltipLabel\",\n)()\n\ninterface ChartTooltipList extends HTMLStyledProps {}\n\nconst ChartTooltipList = withContext<\"div\", ChartTooltipList>(\n \"div\",\n \"tooltipList\",\n)()\n\ninterface ChartTooltipItem extends HTMLStyledProps {}\n\nconst ChartTooltipItem = withContext<\"div\", ChartTooltipItem>(\n \"div\",\n \"tooltipItem\",\n)()\n\ninterface ChartTooltipSwatch extends HTMLStyledProps {}\n\nconst ChartTooltipSwatch = withContext<\"div\", ChartTooltipSwatch>(\n \"div\",\n \"tooltipSwatch\",\n)()\n\ninterface ChartTooltipName extends HTMLStyledProps<\"span\"> {}\n\nconst ChartTooltipName = withContext<\"span\", ChartTooltipName>(\n \"span\",\n \"tooltipName\",\n)()\n\ninterface ChartTooltipValue extends HTMLStyledProps<\"span\"> {}\n\nconst ChartTooltipValue = withContext<\"span\", ChartTooltipValue>(\n \"span\",\n \"tooltipValue\",\n)()\n\nexport interface ChartLabelListProps extends Merge<\n HTMLStyledProps<\"text\">,\n UseChartLabelListProps\n> {}\n\nexport const ChartLabelList = withContext<\"text\", ChartLabelListProps>(\n (props) => {\n const { getLabelListProps, getRootProps } = useChartLabelList(props)\n\n return (\n <styled.text asChild {...getRootProps()}>\n <LabelList {...getLabelListProps()} />\n </styled.text>\n )\n },\n \"labelList\",\n)()\n\nexport interface ChartLabelProps extends Merge<\n HTMLStyledProps<\"text\">,\n UseChartLabelProps\n> {}\n\nexport const ChartLabel = withContext<\"text\", ChartLabelProps>((props) => {\n const { getLabelProps, getRootProps } = useChartLabel(props)\n\n return (\n <styled.text asChild {...getRootProps()}>\n <Label {...getLabelProps()} />\n </styled.text>\n )\n}, \"label\")()\n"],"mappings":";;;;;;;;;;;;;;;;;AA0GA,SAAgB,YACd,QACA,QAA2B,QAC3B,WAA6B,UACQ;CACrC,MAAM,SAAS,UAAU,OAAO,QAAQ,OAAO,SAAS;AAExD,QAAO,OAAO,KAAK,MAAM,WAAW;EAAE,GAAG;EAAM,OAAO,OAAO;EAAQ,EAAE;;AAGzE,SAAgB,UACd,MACA,QAA0B,QAC1B,WAA6B,UACO;CACpC,MAAM,SAAS,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,EAAE;AAIH,MAAM,mBAAmB,YACvB,QACA,cACD,EAAE;AAIH,MAAM,oBAAoB,YACxB,QACA,eACD,EAAE;AAOH,MAAa,iBAAiB,aAC3B,UAAU;CACT,MAAM,EAAE,mBAAmB,iBAAiBS,oCAAkB,MAAM;AAEpE,QACE,2CAACT,uBAAO;EAAK;EAAQ,GAAI,cAAc;YACrC,2CAACU,sBAAU,GAAI,mBAAmB,GAAI;GAC1B;GAGlB,YACD,EAAE;AAOH,MAAa,aAAa,aAAsC,UAAU;CACxE,MAAM,EAAE,eAAe,iBAAiBC,gCAAc,MAAM;AAE5D,QACE,2CAACX,uBAAO;EAAK;EAAQ,GAAI,cAAc;YACrC,2CAACY,kBAAM,GAAI,eAAe,GAAI;GAClB;GAEf,QAAQ,EAAE"}
|
|
1
|
+
{"version":3,"file":"chart.cjs","names":["createSlotComponent","chartStyle","useChart","useSplitChildren","ChartContext","styled","ResponsiveContainer","Fragment","varAttr","createContext","useChartLegend","Legend","useChartTooltip","Tooltip","useChartLabelList","LabelList","useChartLabel","Label"],"sources":["../../../../src/components/chart/chart.tsx"],"sourcesContent":["\"use client\"\n\nimport type {\n JSXElementConstructor,\n PropsWithChildren,\n ReactElement,\n ReactNode,\n RefObject,\n} from \"react\"\nimport type {\n ActiveDotProps,\n DataKey,\n DefaultLegendContentProps,\n DotItemDotProps,\n DotProps,\n LabelProps,\n RenderableText,\n ResponsiveContainerProps,\n TooltipContentProps,\n} from \"recharts\"\nimport type { CSSProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { Dict, Merge } from \"../../utils\"\nimport type { ChartStyle } from \"./chart.style\"\nimport type {\n UseChartLabelListProps,\n UseChartLabelProps,\n UseChartLegendProps,\n UseChartLegendReturn,\n UseChartTooltipProps,\n} from \"./use-chart\"\nimport { Fragment, isValidElement, useMemo, useRef } from \"react\"\nimport {\n Label,\n LabelList,\n Legend,\n ResponsiveContainer,\n Tooltip,\n} from \"recharts\"\nimport { createSlotComponent, styled, varAttr } from \"../../core\"\nimport {\n createContext,\n isArray,\n isNull,\n isNumber,\n isObject,\n isString,\n isUndefined,\n useSplitChildren,\n} from \"../../utils\"\nimport { chartStyle } from \"./chart.style\"\nimport {\n ChartContext,\n useChart,\n useChartLabel,\n useChartLabelList,\n useChartLegend,\n useChartTooltip,\n} from \"./use-chart\"\n\nexport type ChartDot =\n | ((props: DotItemDotProps) => ReactNode)\n | boolean\n | Merge<Partial<DotProps>, HTMLStyledProps<\"circle\">>\n | ReactElement\n\nexport type ChartActiveDot =\n | ((props: ActiveDotProps) => ReactNode)\n | boolean\n | Merge<Partial<ActiveDotProps>, HTMLStyledProps<\"circle\">>\n | ReactElement\n\nexport type ChartLabel =\n | ((props: any) => ReactElement | RenderableText)\n | boolean\n | (Merge<\n HTMLStyledProps<\"text\">,\n Pick<\n LabelProps,\n | \"angle\"\n | \"content\"\n | \"formatter\"\n | \"index\"\n | \"labelRef\"\n | \"offset\"\n | \"parentViewBox\"\n | \"position\"\n | \"textBreakAll\"\n | \"value\"\n | \"viewBox\"\n | \"zIndex\"\n >\n > & { dataKey?: DataKey<any> })\n | number\n | ReactElement\n | string\n\nexport type ChartLabelList =\n | ((props: LabelProps) => ReactElement | RenderableText)\n | boolean\n | ChartLabelListProps\n | ReactElement\n\nexport type ChartTickLine = boolean | HTMLStyledProps<\"line\">\n\nexport type GradientStrategy = \"invert\" | \"shade\" | \"tint\"\n\nexport function mergeSeries<Y>(\n series: Y[],\n color: CSSProps[\"color\"] = \"mono\",\n strategy: GradientStrategy = \"invert\",\n): (Y & { color: CSSProps[\"color\"] })[] {\n const colors = gradients(series.length, color, strategy)\n\n return series.map((item, index) => ({ ...item, color: colors[index] }))\n}\n\nexport function mergeData<Y>(\n data: Y[],\n color: CSSProps[\"fill\"] = \"mono\",\n strategy: GradientStrategy = \"invert\",\n): (Y & { fill: CSSProps[\"fill\"] })[] {\n const colors = gradients(data.length, color, strategy)\n\n return data.map((item, index) => ({ ...item, fill: colors[index] }))\n}\n\nexport function gradients(\n length: number,\n color: CSSProps[\"color\"] = \"mono\",\n strategy: GradientStrategy = \"invert\",\n): CSSProps[\"color\"][] {\n return Array.from({ length }, (_, index) => {\n const value = Math.floor(100 - (100 / length) * index)\n const percent = `${value}%`\n\n if (strategy === \"invert\") {\n return [\n `tint(colors.${color}, ${percent})`,\n `shade(colors.${color}, ${percent})`,\n ]\n } else {\n return `${strategy}(colors.${color}, ${percent})`\n }\n })\n}\n\nfunction parseJSON(value: any) {\n try {\n return JSON.parse(value)\n } catch {\n return value\n }\n}\n\ninterface ComponentContext extends Pick<\n ChartProps,\n \"legendProps\" | \"tooltipProps\"\n> {\n nameKeyRef: RefObject<string | undefined>\n}\n\nexport interface ChartProps extends HTMLStyledProps, ThemeProps<ChartStyle> {\n /**\n * The components to render the chart components.\n */\n components: {\n component: JSXElementConstructor<any>\n fallback: ReactNode\n }[]\n /**\n * The function to render the chart.\n */\n render: (props: PropsWithChildren) => ReactNode\n /**\n * The color of the label list.\n */\n labelListColor?: CSSProps[\"color\"]\n /**\n * The fill of the label list.\n */\n labelListFill?: CSSProps[\"fill\"]\n /**\n * The fill of the tooltip cursor.\n */\n tooltipCursorFill?: CSSProps[\"fill\"]\n /**\n * The fill opacity of the tooltip cursor.\n */\n tooltipCursorFillOpacity?: CSSProps[\"fillOpacity\"]\n /**\n * The stroke of the tooltip cursor.\n */\n tooltipCursorStroke?: CSSProps[\"stroke\"]\n /**\n * If `true`, legend is visible.\n *\n * @default false\n */\n withLegend?: boolean\n /**\n * If `true`, tooltip is visible.\n *\n * @default true\n */\n withTooltip?: boolean\n /**\n * Props for the legend component.\n */\n legendProps?: ChartLegendProps\n /**\n * Props for the responsive container component.\n */\n responsiveContainerProps?: ResponsiveContainerProps\n /**\n * Props for the tooltip component.\n */\n tooltipProps?: ChartTooltipProps\n}\n\nconst {\n ComponentContext,\n PropsContext: ChartPropsContext,\n useComponentContext: useChartComponentContext,\n usePropsContext: useChartPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<ChartProps, ChartStyle, ComponentContext>(\n \"chart\",\n chartStyle,\n)\n\nexport { ChartPropsContext, useChartComponentContext, useChartPropsContext }\n\nexport const Chart = withProvider(\n ({\n children,\n components: componentsProp,\n render,\n withLegend = false,\n withTooltip = true,\n legendProps,\n responsiveContainerProps,\n tooltipProps,\n ...rest\n }: ChartProps) => {\n const { highlightedDataKey, onHighlight } = useChart()\n const nameKeyRef = useRef<string | undefined>(undefined)\n const components = useMemo(\n () => [\n ...componentsProp,\n {\n component: ChartLegend,\n fallback: withLegend ? <ChartLegend /> : null,\n },\n {\n component: ChartTooltip,\n fallback: withTooltip ? <ChartTooltip /> : null,\n },\n ],\n [componentsProp, withLegend, withTooltip],\n )\n const [omittedChildren, ...customComponents] = useSplitChildren(\n children,\n ...components.map(({ component }) => component),\n )\n const context = useMemo(\n () => ({\n highlightedDataKey,\n onHighlight,\n }),\n [highlightedDataKey, onHighlight],\n )\n const componentContext = useMemo(\n () => ({\n nameKeyRef,\n legendProps,\n tooltipProps,\n }),\n [legendProps, tooltipProps],\n )\n\n return (\n <ChartContext value={context}>\n <ComponentContext value={componentContext}>\n <styled.div {...rest}>\n <ResponsiveContainer {...responsiveContainerProps}>\n {render({\n children: (\n <>\n {components.map(({ fallback }, index) => (\n <Fragment key={index}>\n {customComponents[index] ?? fallback}\n </Fragment>\n ))}\n\n {omittedChildren}\n </>\n ),\n })}\n </ResponsiveContainer>\n </styled.div>\n </ComponentContext>\n </ChartContext>\n )\n },\n \"root\",\n)(\n undefined,\n ({\n labelListColor,\n labelListFill,\n tooltipCursorFill,\n tooltipCursorFillOpacity,\n tooltipCursorStroke,\n ...rest\n }) => ({\n \"--label-list-color\": varAttr(labelListColor, \"colors\"),\n \"--label-list-fill\": varAttr(labelListFill, \"colors\"),\n \"--tooltip-cursor-fill\": varAttr(tooltipCursorFill, \"colors\"),\n \"--tooltip-cursor-fill-opacity\": tooltipCursorFillOpacity,\n \"--tooltip-cursor-stroke\": varAttr(tooltipCursorStroke, \"colors\"),\n ...rest,\n }),\n)\n\ninterface ChartLegendContext extends Pick<\n UseChartLegendReturn,\n \"getLegendItemProps\"\n> {}\n\nconst [ChartLegendContext, useChartLegendContext] =\n createContext<ChartLegendContext>({\n name: \"ChartLegendContext\",\n })\n\nexport interface ChartLegendProps extends Merge<\n HTMLStyledProps,\n UseChartLegendProps\n> {\n /**\n * Props for the content component.\n */\n contentProps?: Omit<ChartLegendContentProps, \"formatter\" | \"payload\">\n}\n\nexport const ChartLegend = withContext<\"div\", ChartLegendProps>((props) => {\n const { legendProps } = useChartComponentContext()\n const { contentProps, ...rest } = { ...legendProps, ...props }\n const {\n getLegendContentProps,\n getLegendItemProps,\n getLegendProps,\n getRootProps,\n } = useChartLegend({\n content: ({ formatter, payload }) => (\n <ChartLegendContent\n formatter={formatter}\n payload={payload}\n {...getLegendContentProps(contentProps)}\n />\n ),\n ...rest,\n })\n const context = useMemo(() => ({ getLegendItemProps }), [getLegendItemProps])\n\n return (\n <ChartLegendContext value={context}>\n <styled.div asChild {...getRootProps()}>\n <Legend {...getLegendProps()} />\n </styled.div>\n </ChartLegendContext>\n )\n}, \"legend\")()\n\ninterface ChartLegendContentProps\n extends\n HTMLStyledProps,\n Pick<DefaultLegendContentProps, \"formatter\" | \"payload\"> {\n /**\n * If `true`, swatch is visible.\n */\n withSwatch?: boolean\n}\n\nconst ChartLegendContent = withContext<\"div\", ChartLegendContentProps>(\n ({ formatter, payload, withSwatch = true, ...rest }) => {\n const { nameKeyRef } = useChartComponentContext()\n const { getLegendItemProps } = useChartLegendContext()\n\n return (\n <styled.div {...rest}>\n {payload?.map((data, index) => {\n let value = data.value\n\n if (nameKeyRef.current)\n value = (data.payload as any)?.[nameKeyRef.current]\n\n const dataKey =\n isString(data.dataKey) || isNumber(data.dataKey)\n ? data.dataKey\n : value\n const color = parseJSON(data.color)\n const formattedValue = formatter?.(value, data, index) ?? value\n\n return (\n <ChartLegendItem key={index} {...getLegendItemProps({ dataKey })}>\n {withSwatch ? <ChartLegendSwatch bg={color} /> : null}\n <ChartLegendValue>{formattedValue}</ChartLegendValue>\n </ChartLegendItem>\n )\n })}\n </styled.div>\n )\n },\n \"legendContent\",\n)()\n\ninterface ChartLegendItemProps extends HTMLStyledProps {}\n\nconst ChartLegendItem = withContext<\"div\", ChartLegendItemProps>(\n \"div\",\n \"legendItem\",\n)()\n\ninterface ChartLegendSwatchProps extends HTMLStyledProps {}\n\nconst ChartLegendSwatch = withContext<\"div\", ChartLegendSwatchProps>(\n \"div\",\n \"legendSwatch\",\n)()\n\ninterface ChartLegendValueProps extends HTMLStyledProps<\"span\"> {}\n\nconst ChartLegendValue = withContext<\"span\", ChartLegendValueProps>(\n \"span\",\n \"legendValue\",\n)()\n\nexport interface ChartTooltipProps<\n Y extends (number | string)[] | number | string = number,\n M extends number | string = string,\n> extends Omit<Merge<HTMLStyledProps, UseChartTooltipProps<Y, M>>, \"cursor\"> {\n /**\n * Props for the cursor component.\n */\n cursor?: boolean | ChartTooltipCursorProps | ReactElement\n /**\n * Props for the content component.\n */\n contentProps?: Omit<\n ChartTooltipContentProps,\n \"formatter\" | \"label\" | \"labelFormatter\" | \"payload\"\n >\n}\n\nexport const ChartTooltip = <\n Y extends (number | string)[] | number | string,\n M extends number | string,\n>(\n props: ChartTooltipProps<Y, M>,\n) => {\n const { tooltipProps } = useChartComponentContext()\n const {\n cursor = false,\n contentProps,\n ...rest\n } = {\n ...tooltipProps,\n ...props,\n } as ChartTooltipProps<Y, M>\n const { getContentProps, getRootProps } = useChartTooltip({\n content: ({ formatter, label, labelFormatter, payload }) => (\n <ChartTooltipContent\n formatter={formatter}\n label={label}\n labelFormatter={labelFormatter}\n payload={payload}\n {...getContentProps(contentProps)}\n />\n ),\n cursor:\n isValidElement(cursor) || !cursor ? (\n cursor\n ) : (\n <ChartTooltipCursor {...(isObject(cursor) ? cursor : {})} />\n ),\n ...rest,\n })\n\n return <Tooltip {...getRootProps()} />\n}\n\ninterface ChartTooltipCursorProps extends Omit<\n HTMLStyledProps<\"path\">,\n \"height\" | \"points\" | \"width\"\n> {\n brushBottom?: number\n height?: number\n payload?: Dict[]\n payloadIndex?: number\n points?: { x: number; y: number }[]\n width?: number\n}\n\nconst ChartTooltipCursor = withContext<\"path\", ChartTooltipCursorProps>(\n \"path\",\n \"tooltipCursor\",\n)(\n undefined,\n ({\n bottom: _bottom,\n brushBottom: _brushBottom,\n fill,\n height,\n left: _left,\n payload: _payload,\n payloadIndex: _payloadIndex,\n points,\n right: _right,\n stroke,\n top: _top,\n width,\n x,\n y,\n ...rest\n }) => {\n const d = !!points\n ? `M${points[0]?.x},${points[0]?.y}L${points[1]?.x},${points[1]?.y}`\n : `M ${x},${y} h ${width} v ${height} h -${width} Z`\n return {\n asChild: true,\n children: <path d={d} height={height} width={width} />,\n fill: fill === \"#ccc\" ? undefined : fill,\n stroke: stroke === \"#ccc\" ? undefined : stroke,\n ...rest,\n }\n },\n)\n\ninterface ChartTooltipContentProps\n extends\n HTMLStyledProps,\n Pick<\n TooltipContentProps<any, any>,\n \"formatter\" | \"label\" | \"labelFormatter\" | \"payload\"\n > {\n /**\n * If `true`, swatch is visible.\n */\n withSwatch?: boolean\n}\n\nconst ChartTooltipContent = withContext<\"div\", ChartTooltipContentProps>(\n ({\n formatter,\n label: labelProp,\n labelFormatter,\n payload,\n withSwatch = true,\n ...rest\n }) => {\n const { nameKeyRef } = useChartComponentContext()\n const label = labelFormatter\n ? labelFormatter(labelProp, payload)\n : labelProp\n\n return (\n <styled.div {...rest}>\n {!isUndefined(label) && !isNull(label) ? (\n <ChartTooltipLabel>{label}</ChartTooltipLabel>\n ) : null}\n\n <ChartTooltipList>\n {payload.map((data, index) => {\n if (nameKeyRef.current) data.name = data.payload[nameKeyRef.current]\n\n const color = parseJSON(data.color) || data.payload.fill\n const result =\n formatter?.(data.value, data.name, data, index, payload) ??\n (isArray(data.value) ? data.value.join(\", \") : data.value)\n const [value, name] = isArray(result) ? result : [result, data.name]\n\n return (\n <ChartTooltipItem key={index}>\n {withSwatch ? <ChartTooltipSwatch bg={color} /> : null}\n <ChartTooltipName>{name}</ChartTooltipName>\n <ChartTooltipValue>{value}</ChartTooltipValue>\n </ChartTooltipItem>\n )\n })}\n </ChartTooltipList>\n </styled.div>\n )\n },\n \"tooltipContent\",\n)()\n\ninterface ChartTooltipLabel extends HTMLStyledProps<\"p\"> {}\n\nconst ChartTooltipLabel = withContext<\"p\", ChartTooltipLabel>(\n \"p\",\n \"tooltipLabel\",\n)()\n\ninterface ChartTooltipList extends HTMLStyledProps {}\n\nconst ChartTooltipList = withContext<\"div\", ChartTooltipList>(\n \"div\",\n \"tooltipList\",\n)()\n\ninterface ChartTooltipItem extends HTMLStyledProps {}\n\nconst ChartTooltipItem = withContext<\"div\", ChartTooltipItem>(\n \"div\",\n \"tooltipItem\",\n)()\n\ninterface ChartTooltipSwatch extends HTMLStyledProps {}\n\nconst ChartTooltipSwatch = withContext<\"div\", ChartTooltipSwatch>(\n \"div\",\n \"tooltipSwatch\",\n)()\n\ninterface ChartTooltipName extends HTMLStyledProps<\"span\"> {}\n\nconst ChartTooltipName = withContext<\"span\", ChartTooltipName>(\n \"span\",\n \"tooltipName\",\n)()\n\ninterface ChartTooltipValue extends HTMLStyledProps<\"span\"> {}\n\nconst ChartTooltipValue = withContext<\"span\", ChartTooltipValue>(\n \"span\",\n \"tooltipValue\",\n)()\n\nexport interface ChartLabelListProps extends Merge<\n HTMLStyledProps<\"text\">,\n UseChartLabelListProps\n> {}\n\nexport const ChartLabelList = withContext<\"text\", ChartLabelListProps>(\n (props) => {\n const { getLabelListProps, getRootProps } = useChartLabelList(props)\n\n return (\n <styled.text asChild {...getRootProps()}>\n <LabelList {...getLabelListProps()} />\n </styled.text>\n )\n },\n \"labelList\",\n)()\n\nexport interface ChartLabelProps extends Merge<\n HTMLStyledProps<\"text\">,\n UseChartLabelProps\n> {}\n\nexport const ChartLabel = withContext<\"text\", ChartLabelProps>((props) => {\n const { getLabelProps, getRootProps } = useChartLabel(props)\n\n return (\n <styled.text asChild {...getRootProps()}>\n <Label {...getLabelProps()} />\n </styled.text>\n )\n}, \"label\")()\n"],"mappings":";;;;;;;;;;;;;;;;;AA0GA,SAAgB,YACd,QACA,QAA2B,QAC3B,WAA6B,UACS;CACtC,MAAM,SAAS,UAAU,OAAO,QAAQ,OAAO,SAAS;AAExD,QAAO,OAAO,KAAK,MAAM,WAAW;EAAE,GAAG;EAAM,OAAO,OAAO;EAAQ,EAAE;;AAGzE,SAAgB,UACd,MACA,QAA0B,QAC1B,WAA6B,UACO;CACpC,MAAM,SAAS,UAAU,KAAK,QAAQ,OAAO,SAAS;AAEtD,QAAO,KAAK,KAAK,MAAM,WAAW;EAAE,GAAG;EAAM,MAAM,OAAO;EAAQ,EAAE;;AAGtE,SAAgB,UACd,QACA,QAA2B,QAC3B,WAA6B,UACR;AACrB,QAAO,MAAM,KAAK,EAAE,QAAQ,GAAG,GAAG,UAAU;EAE1C,MAAM,UAAU,GADF,KAAK,MAAM,MAAO,MAAM,SAAU,MAAM,CAC7B;AAEzB,MAAI,aAAa,SACf,QAAO,CACL,eAAe,MAAM,IAAI,QAAQ,IACjC,gBAAgB,MAAM,IAAI,QAAQ,GACnC;MAED,QAAO,GAAG,SAAS,UAAU,MAAM,IAAI,QAAQ;GAEjD;;AAGJ,SAAS,UAAU,OAAY;AAC7B,KAAI;AACF,SAAO,KAAK,MAAM,MAAM;SAClB;AACN,SAAO;;;AAqEX,MAAM,EACJ,kBACA,cAAc,mBACd,qBAAqB,0BACrB,iBAAiB,sBACjB,aACA,iBACEA,6CACF,SACAC,+BACD;AAID,MAAa,QAAQ,cAClB,EACC,UACA,YAAY,gBACZ,QACA,aAAa,OACb,cAAc,MACd,aACA,0BACA,cACA,GAAG,WACa;CAChB,MAAM,EAAE,oBAAoB,gBAAgBC,4BAAU;CACtD,MAAM,+BAAwC,OAAU;CACxD,MAAM,sCACE;EACJ,GAAG;EACH;GACE,WAAW;GACX,UAAU,aAAa,2CAAC,gBAAc,G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C,QAAQ,KAAK,KAAK;AAEpE,UACE,4CAAC;IACE,aAAa,2CAAC,sBAAmB,IAAI,QAAS,GAAG;IAClD,2CAAC,8BAAkB,OAAwB;IAC3C,2CAAC,+BAAmB,QAA0B;QAHzB,MAIJ;IAErB,GACe;GACR;GAGjB,iBACD,EAAE;AAIH,MAAM,oBAAoB,YACxB,KACA,eACD,EAAE;AAIH,MAAM,mBAAmB,YACvB,OACA,cACD,EAAE;AAIH,MAAM,mBAAmB,YACvB,OACA,cACD,EAAE;AAIH,MAAM,qBAAqB,YACzB,OACA,gBACD,EAAE;AAIH,MAAM,mBAAmB,YACvB,QACA,cACD,EAAE;AAIH,MAAM,oBAAoB,YACxB,QACA,eACD,EAAE;AAOH,MAAa,iBAAiB,aAC3B,UAAU;CACT,MAAM,EAAE,mBAAmB,iBAAiBS,oCAAkB,MAAM;AAEpE,QACE,2CAACT,uBAAO;EAAK;EAAQ,GAAI,cAAc;YACrC,2CAACU,sBAAU,GAAI,mBAAmB,GAAI;GAC1B;GAGlB,YACD,EAAE;AAOH,MAAa,aAAa,aAAsC,UAAU;CACxE,MAAM,EAAE,eAAe,iBAAiBC,gCAAc,MAAM;AAE5D,QACE,2CAACX,uBAAO;EAAK;EAAQ,GAAI,cAAc;YACrC,2CAACY,kBAAM,GAAI,eAAe,GAAI;GAClB;GAEf,QAAQ,EAAE"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
4
|
+
const require_create_component = require('../../core/components/create-component.cjs');
|
|
5
|
+
require('../../core/index.cjs');
|
|
6
|
+
const require_composed_chart_style = require('./composed-chart.style.cjs');
|
|
7
|
+
const require_chart = require('./chart.cjs');
|
|
8
|
+
const require_cartesian_chart = require('./cartesian-chart.cjs');
|
|
9
|
+
let react = require("react");
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
let recharts = require("recharts");
|
|
12
|
+
|
|
13
|
+
//#region src/components/chart/composed-chart.tsx
|
|
14
|
+
function isLine(props) {
|
|
15
|
+
return props[0] === "line";
|
|
16
|
+
}
|
|
17
|
+
function isArea(props) {
|
|
18
|
+
return props[0] === "area";
|
|
19
|
+
}
|
|
20
|
+
function isBar(props) {
|
|
21
|
+
return props[0] === "bar";
|
|
22
|
+
}
|
|
23
|
+
function mergeSeries(series, color = "mono", strategy = "invert") {
|
|
24
|
+
const colors = require_chart.gradients(series.length, color, strategy);
|
|
25
|
+
return series.map(([type, props], index) => [type, {
|
|
26
|
+
...props,
|
|
27
|
+
color: colors[index]
|
|
28
|
+
}]);
|
|
29
|
+
}
|
|
30
|
+
const { PropsContext: ComposedChartPropsContext, usePropsContext: useComposedChartPropsContext, withContext } = require_create_component.createComponent("composed-chart", require_composed_chart_style.composedChartStyle);
|
|
31
|
+
/**
|
|
32
|
+
* `ComposedChart` is a component for drawing composed charts to compare multiple sets of data.
|
|
33
|
+
*
|
|
34
|
+
* @see https://yamada-ui.com/docs/components/composed-chart
|
|
35
|
+
*/
|
|
36
|
+
const ComposedChart = withContext(({ children, series = [], barProps, ...rest }) => {
|
|
37
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_cartesian_chart.CartesianChart, {
|
|
38
|
+
components: (0, react.useMemo)(() => [
|
|
39
|
+
{
|
|
40
|
+
component: require_cartesian_chart.ChartLine,
|
|
41
|
+
fallback: series.filter(isLine).map(([, props], index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_cartesian_chart.ChartLine, { ...props }, index))
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
component: require_cartesian_chart.ChartArea,
|
|
45
|
+
fallback: series.filter(isArea).map(([, props], index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_cartesian_chart.ChartArea, { ...props }, index))
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
component: require_cartesian_chart.ChartBar,
|
|
49
|
+
fallback: series.filter(isBar).map(([, props], index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_cartesian_chart.ChartBar, { ...props }, index))
|
|
50
|
+
}
|
|
51
|
+
], [series]),
|
|
52
|
+
render: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.ComposedChart, { ...props }),
|
|
53
|
+
barProps: {
|
|
54
|
+
barSize: 40,
|
|
55
|
+
...barProps
|
|
56
|
+
},
|
|
57
|
+
...rest,
|
|
58
|
+
children
|
|
59
|
+
});
|
|
60
|
+
})();
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
exports.ComposedChart = ComposedChart;
|
|
64
|
+
exports.ComposedChartPropsContext = ComposedChartPropsContext;
|
|
65
|
+
exports.mergeSeries = mergeSeries;
|
|
66
|
+
exports.useComposedChartPropsContext = useComposedChartPropsContext;
|
|
67
|
+
//# sourceMappingURL=composed-chart.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composed-chart.cjs","names":["gradients","createComponent","composedChartStyle","CartesianChart","ChartLine","ChartArea","ChartBar","OriginalComposedChart"],"sources":["../../../../src/components/chart/composed-chart.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type { CSSProps, GenericsComponent, ThemeProps } from \"../../core\"\nimport type { Dict } from \"../../utils\"\nimport type {\n CartesianChartProps,\n ChartAreaProps,\n ChartBarProps,\n ChartLineProps,\n} from \"./cartesian-chart\"\nimport type { GradientStrategy } from \"./chart\"\nimport type { ComposedChartStyle } from \"./composed-chart.style\"\nimport type { LineChartStyle } from \"./line-chart.style\"\nimport { useMemo } from \"react\"\nimport { ComposedChart as OriginalComposedChart } from \"recharts\"\nimport { createComponent } from \"../../core\"\nimport {\n CartesianChart,\n ChartArea,\n ChartBar,\n ChartLine,\n} from \"./cartesian-chart\"\nimport { gradients } from \"./chart\"\nimport { composedChartStyle } from \"./composed-chart.style\"\n\nexport type ComposedType = \"area\" | \"bar\" | \"line\"\n\nexport type ComposedProps<Y extends Dict = Dict> =\n | readonly [\"area\", ChartAreaProps<Y>]\n | readonly [\"bar\", ChartBarProps<Y>]\n | readonly [\"line\", ChartLineProps<Y>]\n\nfunction isLine<Y extends Dict>(\n props: ComposedProps<Y>,\n): props is [\"line\", ChartLineProps<Y>] {\n return props[0] === \"line\"\n}\n\nfunction isArea<Y extends Dict>(\n props: ComposedProps<Y>,\n): props is [\"area\", ChartAreaProps<Y>] {\n return props[0] === \"area\"\n}\n\nfunction isBar<Y extends Dict>(\n props: ComposedProps<Y>,\n): props is [\"bar\", ChartBarProps<Y>] {\n return props[0] === \"bar\"\n}\n\nexport function mergeSeries<Y extends Dict = Dict>(\n series: ComposedProps<Y>[],\n color: CSSProps[\"color\"] = \"mono\",\n strategy: GradientStrategy = \"invert\",\n): ComposedProps<Y>[] {\n const colors = gradients(series.length, color, strategy)\n\n return series.map(\n ([type, props], index) =>\n [type, { ...props, color: colors[index] }] as ComposedProps<Y>,\n )\n}\n\nexport interface ComposedChartProps<Y extends Dict = Dict>\n extends\n Omit<CartesianChartProps<Y>, \"components\" | \"render\">,\n ThemeProps<LineChartStyle> {\n /**\n * If provided, generate lines based on series.\n */\n series?: ComposedProps<Y>[]\n}\n\nconst {\n PropsContext: ComposedChartPropsContext,\n usePropsContext: useComposedChartPropsContext,\n withContext,\n} = createComponent<ComposedChartProps, ComposedChartStyle>(\n \"composed-chart\",\n composedChartStyle,\n)\n\nexport { ComposedChartPropsContext, useComposedChartPropsContext }\n\n/**\n * `ComposedChart` is a component for drawing composed charts to compare multiple sets of data.\n *\n * @see https://yamada-ui.com/docs/components/composed-chart\n */\nexport const ComposedChart = withContext<\"div\", ComposedChartProps>(\n <Y extends Dict>({\n children,\n series = [],\n barProps,\n ...rest\n }: ComposedChartProps<Y>) => {\n const components = useMemo(\n () => [\n {\n component: ChartLine,\n fallback: series\n .filter(isLine)\n .map(([, props], index) => <ChartLine key={index} {...props} />),\n },\n {\n component: ChartArea,\n fallback: series\n .filter(isArea)\n .map(([, props], index) => <ChartArea key={index} {...props} />),\n },\n {\n component: ChartBar,\n fallback: series\n .filter(isBar)\n .map(([, props], index) => <ChartBar key={index} {...props} />),\n },\n ],\n [series],\n )\n\n return (\n <CartesianChart\n components={components}\n render={(props) => <OriginalComposedChart {...props} />}\n barProps={{ barSize: 40, ...barProps }}\n {...rest}\n >\n {children}\n </CartesianChart>\n )\n },\n)() as GenericsComponent<{\n <Y extends Dict>(props: ComposedChartProps<Y>): ReactElement\n}>\n"],"mappings":";;;;;;;;;;;;;AAiCA,SAAS,OACP,OACsC;AACtC,QAAO,MAAM,OAAO;;AAGtB,SAAS,OACP,OACsC;AACtC,QAAO,MAAM,OAAO;;AAGtB,SAAS,MACP,OACoC;AACpC,QAAO,MAAM,OAAO;;AAGtB,SAAgB,YACd,QACA,QAA2B,QAC3B,WAA6B,UACT;CACpB,MAAM,SAASA,wBAAU,OAAO,QAAQ,OAAO,SAAS;AAExD,QAAO,OAAO,KACX,CAAC,MAAM,QAAQ,UACd,CAAC,MAAM;EAAE,GAAG;EAAO,OAAO,OAAO;EAAQ,CAAC,CAC7C;;AAaH,MAAM,EACJ,cAAc,2BACd,iBAAiB,8BACjB,gBACEC,yCACF,kBACAC,gDACD;;;;;;AASD,MAAa,gBAAgB,aACV,EACf,UACA,SAAS,EAAE,EACX,UACA,GAAG,WACwB;AAyB3B,QACE,2CAACC;EACC,qCAzBI;GACJ;IACE,WAAWC;IACX,UAAU,OACP,OAAO,OAAO,CACd,KAAK,GAAG,QAAQ,UAAU,2CAACA,qCAAsB,GAAI,SAAX,MAAoB,CAAC;IACnE;GACD;IACE,WAAWC;IACX,UAAU,OACP,OAAO,OAAO,CACd,KAAK,GAAG,QAAQ,UAAU,2CAACA,qCAAsB,GAAI,SAAX,MAAoB,CAAC;IACnE;GACD;IACE,WAAWC;IACX,UAAU,OACP,OAAO,MAAM,CACb,KAAK,GAAG,QAAQ,UAAU,2CAACA,oCAAqB,GAAI,SAAX,MAAoB,CAAC;IAClE;GACF,EACD,CAAC,OAAO,CACT;EAKG,SAAS,UAAU,2CAACC,0BAAsB,GAAI,QAAS;EACvD,UAAU;GAAE,SAAS;GAAI,GAAG;GAAU;EACtC,GAAI;EAEH;GACc;EAGtB,EAAE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_chart = require('./chart.cjs');
|
|
3
|
+
const require_cartesian_chart = require('./cartesian-chart.cjs');
|
|
4
|
+
const require_composed_chart = require('./composed-chart.cjs');
|
|
5
|
+
|
|
6
|
+
//#region src/components/chart/composed-chart.namespace.ts
|
|
7
|
+
var composed_chart_namespace_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
8
|
+
Area: () => require_cartesian_chart.ChartArea,
|
|
9
|
+
Bar: () => require_cartesian_chart.ChartBar,
|
|
10
|
+
Grid: () => require_cartesian_chart.ChartGrid,
|
|
11
|
+
Label: () => require_chart.ChartLabel,
|
|
12
|
+
LabelList: () => require_chart.ChartLabelList,
|
|
13
|
+
Legend: () => require_chart.ChartLegend,
|
|
14
|
+
Line: () => require_cartesian_chart.ChartLine,
|
|
15
|
+
PropsContext: () => require_composed_chart.ComposedChartPropsContext,
|
|
16
|
+
ReferenceLine: () => require_cartesian_chart.ChartReferenceLine,
|
|
17
|
+
Root: () => require_composed_chart.ComposedChart,
|
|
18
|
+
Tooltip: () => require_chart.ChartTooltip,
|
|
19
|
+
XAxis: () => require_cartesian_chart.ChartXAxis,
|
|
20
|
+
YAxis: () => require_cartesian_chart.ChartYAxis,
|
|
21
|
+
mergeSeries: () => require_composed_chart.mergeSeries,
|
|
22
|
+
usePropsContext: () => require_composed_chart.useComposedChartPropsContext
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
Object.defineProperty(exports, 'composed_chart_namespace_exports', {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () {
|
|
29
|
+
return composed_chart_namespace_exports;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=composed-chart.namespace.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composed-chart.namespace.cjs","names":[],"sources":["../../../../src/components/chart/composed-chart.namespace.ts"],"sourcesContent":["export type {\n ChartAreaProps as AreaProps,\n ChartBarProps as BarProps,\n ChartGridProps as GridProps,\n ChartLineProps as LineProps,\n ChartReferenceLineProps as ReferenceLineProps,\n ChartXAxisProps as XAxisProps,\n ChartXAxisTick as XAxisTick,\n ChartYAxisProps as YAxisProps,\n ChartYAxisTick as YAxisTick,\n} from \"./cartesian-chart\"\nexport {\n ChartArea as Area,\n ChartBar as Bar,\n ChartGrid as Grid,\n ChartLine as Line,\n ChartReferenceLine as ReferenceLine,\n ChartXAxis as XAxis,\n ChartYAxis as YAxis,\n} from \"./cartesian-chart\"\nexport type {\n ChartActiveDot as ActiveDot,\n ChartLabel as ComposedLabel,\n ChartLabelList as ComposedLabelList,\n ChartDot as Dot,\n ChartLabelListProps as LabelListProps,\n ChartLabelProps as LabelProps,\n ChartLegendProps as LegendProps,\n ChartTickLine as TickLine,\n ChartTooltipProps as TooltipProps,\n} from \"./chart\"\nexport {\n ChartLabel as Label,\n ChartLabelList as LabelList,\n ChartLegend as Legend,\n ChartTooltip as Tooltip,\n} from \"./chart\"\nexport type {\n ComposedProps,\n ComposedChartProps as RootProps,\n} from \"./composed-chart\"\nexport {\n mergeSeries,\n ComposedChartPropsContext as PropsContext,\n ComposedChart as Root,\n useComposedChartPropsContext as usePropsContext,\n} from \"./composed-chart\"\n"],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const require_config = require('../../core/system/config.cjs');
|
|
2
|
+
require('../../core/index.cjs');
|
|
3
|
+
const require_line_chart_style = require('./line-chart.style.cjs');
|
|
4
|
+
|
|
5
|
+
//#region src/components/chart/composed-chart.style.ts
|
|
6
|
+
const composedChartStyle = require_config.defineComponentStyle({ base: {
|
|
7
|
+
...require_line_chart_style.lineChartStyle.base,
|
|
8
|
+
"--bar-fill-opacity": "0.6",
|
|
9
|
+
"--bar-stroke": "none"
|
|
10
|
+
} });
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.composedChartStyle = composedChartStyle;
|
|
14
|
+
//# sourceMappingURL=composed-chart.style.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composed-chart.style.cjs","names":["defineComponentStyle","lineChartStyle"],"sources":["../../../../src/components/chart/composed-chart.style.ts"],"sourcesContent":["import { defineComponentStyle } from \"../../core\"\nimport { lineChartStyle } from \"./line-chart.style\"\n\nexport const composedChartStyle = defineComponentStyle({\n base: {\n ...lineChartStyle.base,\n \"--bar-fill-opacity\": \"0.6\",\n \"--bar-stroke\": \"none\",\n },\n})\n\nexport type ComposedChartStyle = typeof composedChartStyle\n"],"mappings":";;;;;AAGA,MAAa,qBAAqBA,oCAAqB,EACrD,MAAM;CACJ,GAAGC,wCAAe;CAClB,sBAAsB;CACtB,gBAAgB;CACjB,EACF,CAAC"}
|
|
@@ -5,7 +5,6 @@ const require_create_component = require('../../core/components/create-component
|
|
|
5
5
|
require('../../core/index.cjs');
|
|
6
6
|
const require_donut_chart_style = require('./donut-chart.style.cjs');
|
|
7
7
|
const require_polar_chart = require('./polar-chart.cjs');
|
|
8
|
-
const require_use_pie_chart = require('./use-pie-chart.cjs');
|
|
9
8
|
let react = require("react");
|
|
10
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
10
|
let recharts = require("recharts");
|
|
@@ -17,22 +16,18 @@ const { PropsContext: DonutChartPropsContext, usePropsContext: useDonutChartProp
|
|
|
17
16
|
*
|
|
18
17
|
* @see https://yamada-ui.com/docs/components/donut-chart
|
|
19
18
|
*/
|
|
20
|
-
const DonutChart = withContext(({ children, series = [],
|
|
21
|
-
const { getChartProps, getRootProps } = require_use_pie_chart.usePieChart(rest);
|
|
19
|
+
const DonutChart = withContext(({ children, series = [], tooltipProps, ...rest }) => {
|
|
22
20
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_polar_chart.PolarChart, {
|
|
23
21
|
components: (0, react.useMemo)(() => [{
|
|
24
22
|
component: require_polar_chart.ChartDonut,
|
|
25
23
|
fallback: series.map((props, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_polar_chart.ChartDonut, { ...props }, index))
|
|
26
24
|
}], [series]),
|
|
27
|
-
render: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.PieChart, { ...
|
|
28
|
-
...props,
|
|
29
|
-
...chartProps
|
|
30
|
-
}) }),
|
|
25
|
+
render: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.PieChart, { ...props }),
|
|
31
26
|
tooltipProps: {
|
|
32
27
|
labelFormatter: (0, react.useCallback)(() => null, []),
|
|
33
28
|
...tooltipProps
|
|
34
29
|
},
|
|
35
|
-
...
|
|
30
|
+
...rest,
|
|
36
31
|
children
|
|
37
32
|
});
|
|
38
33
|
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"donut-chart.cjs","names":["createComponent","donutChartStyle","
|
|
1
|
+
{"version":3,"file":"donut-chart.cjs","names":["createComponent","donutChartStyle","PolarChart","ChartDonut","OriginalPieChart"],"sources":["../../../../src/components/chart/donut-chart.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type { GenericsComponent, ThemeProps } from \"../../core\"\nimport type { Dict } from \"../../utils\"\nimport type { ChartTooltipProps } from \"./chart\"\nimport type { DonutChartStyle } from \"./donut-chart.style\"\nimport type { ChartDonutProps, PolarChartProps } from \"./polar-chart\"\nimport { useCallback, useMemo } from \"react\"\nimport { PieChart as OriginalPieChart } from \"recharts\"\nimport { createComponent } from \"../../core\"\nimport { donutChartStyle } from \"./donut-chart.style\"\nimport { ChartDonut, PolarChart } from \"./polar-chart\"\n\nexport interface DonutChartProps<Y extends Dict = Dict>\n extends\n Omit<PolarChartProps<Y>, \"components\" | \"nameKey\" | \"render\">,\n ThemeProps<DonutChartStyle> {\n /***\n * If provided, generate lines based on series.\n */\n series?: ChartDonutProps<Y>[]\n}\n\nconst {\n PropsContext: DonutChartPropsContext,\n usePropsContext: useDonutChartPropsContext,\n withContext,\n} = createComponent<DonutChartProps, DonutChartStyle>(\n \"donut-chart\",\n donutChartStyle,\n)\n\nexport { DonutChartPropsContext, useDonutChartPropsContext }\n\n/**\n * `DonutChart` is a component for drawing donut charts to compare multiple sets of data.\n *\n * @see https://yamada-ui.com/docs/components/donut-chart\n */\nexport const DonutChart = withContext<\"div\", DonutChartProps>(\n <Y extends Dict>({\n children,\n series = [],\n tooltipProps,\n ...rest\n }: DonutChartProps<Y>) => {\n const components = useMemo(\n () => [\n {\n component: ChartDonut,\n fallback: series.map((props, index) => (\n <ChartDonut key={index} {...props} />\n )),\n },\n ],\n [series],\n )\n const labelFormatter = useCallback<\n NonNullable<ChartTooltipProps[\"labelFormatter\"]>\n >(() => null, [])\n\n return (\n <PolarChart\n components={components}\n render={(props) => <OriginalPieChart {...props} />}\n tooltipProps={{ labelFormatter, ...tooltipProps }}\n {...rest}\n >\n {children}\n </PolarChart>\n )\n },\n)() as GenericsComponent<{\n <Y extends Dict>(props: DonutChartProps<Y>): ReactElement\n}>\n"],"mappings":";;;;;;;;;;;;AAwBA,MAAM,EACJ,cAAc,wBACd,iBAAiB,2BACjB,gBACEA,yCACF,eACAC,0CACD;;;;;;AASD,MAAa,aAAa,aACP,EACf,UACA,SAAS,EAAE,EACX,cACA,GAAG,WACqB;AAgBxB,QACE,2CAACC;EACC,qCAhBI,CACJ;GACE,WAAWC;GACX,UAAU,OAAO,KAAK,OAAO,UAC3B,2CAACA,kCAAuB,GAAI,SAAX,MAAoB,CACrC;GACH,CACF,EACD,CAAC,OAAO,CACT;EAQG,SAAS,UAAU,2CAACC,qBAAiB,GAAI,QAAS;EAClD,cAAc;GAAE,6CANZ,MAAM,EAAE,CAAC;GAMmB,GAAG;GAAc;EACjD,GAAI;EAEH;GACU;EAGlB,EAAE"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
const require_line_chart_style = require('./line-chart.style.cjs');
|
|
1
2
|
const require_area_chart_style = require('./area-chart.style.cjs');
|
|
2
3
|
const require_bar_chart_style = require('./bar-chart.style.cjs');
|
|
3
4
|
const require_chart_style = require('./chart.style.cjs');
|
|
4
5
|
const require_cartesian_chart_style = require('./cartesian-chart.style.cjs');
|
|
6
|
+
const require_composed_chart_style = require('./composed-chart.style.cjs');
|
|
5
7
|
const require_pie_chart_style = require('./pie-chart.style.cjs');
|
|
6
8
|
const require_donut_chart_style = require('./donut-chart.style.cjs');
|
|
7
|
-
const require_line_chart_style = require('./line-chart.style.cjs');
|
|
8
9
|
const require_polar_chart_style = require('./polar-chart.style.cjs');
|
|
9
10
|
const require_radar_chart_style = require('./radar-chart.style.cjs');
|
|
10
11
|
const require_radial_chart_style = require('./radial-chart.style.cjs');
|
|
@@ -12,20 +13,15 @@ const require_use_chart = require('./use-chart.cjs');
|
|
|
12
13
|
const require_chart = require('./chart.cjs');
|
|
13
14
|
const require_use_cartesian_chart = require('./use-cartesian-chart.cjs');
|
|
14
15
|
const require_cartesian_chart = require('./cartesian-chart.cjs');
|
|
15
|
-
const require_use_area_chart = require('./use-area-chart.cjs');
|
|
16
16
|
const require_area_chart_namespace = require('./area-chart.namespace.cjs');
|
|
17
|
-
const require_use_bar_chart = require('./use-bar-chart.cjs');
|
|
18
17
|
const require_bar_chart_namespace = require('./bar-chart.namespace.cjs');
|
|
18
|
+
const require_composed_chart_namespace = require('./composed-chart.namespace.cjs');
|
|
19
19
|
const require_use_polar_chart = require('./use-polar-chart.cjs');
|
|
20
20
|
const require_polar_chart = require('./polar-chart.cjs');
|
|
21
|
-
const require_use_pie_chart = require('./use-pie-chart.cjs');
|
|
22
21
|
const require_donut_chart_namespace = require('./donut-chart.namespace.cjs');
|
|
23
|
-
const require_use_line_chart = require('./use-line-chart.cjs');
|
|
24
22
|
const require_line_chart_namespace = require('./line-chart.namespace.cjs');
|
|
25
23
|
const require_pie_chart_namespace = require('./pie-chart.namespace.cjs');
|
|
26
|
-
const require_use_radar_chart = require('./use-radar-chart.cjs');
|
|
27
24
|
const require_radar_chart_namespace = require('./radar-chart.namespace.cjs');
|
|
28
|
-
const require_use_radial_chart = require('./use-radial-chart.cjs');
|
|
29
25
|
const require_radial_chart_namespace = require('./radial-chart.namespace.cjs');
|
|
30
26
|
|
|
31
27
|
Object.defineProperty(exports, 'AreaChart', {
|
|
@@ -62,6 +58,12 @@ exports.ChartReferenceLine = require_cartesian_chart.ChartReferenceLine;
|
|
|
62
58
|
exports.ChartTooltip = require_chart.ChartTooltip;
|
|
63
59
|
exports.ChartXAxis = require_cartesian_chart.ChartXAxis;
|
|
64
60
|
exports.ChartYAxis = require_cartesian_chart.ChartYAxis;
|
|
61
|
+
Object.defineProperty(exports, 'ComposedChart', {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function () {
|
|
64
|
+
return require_composed_chart_namespace.composed_chart_namespace_exports;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
65
67
|
Object.defineProperty(exports, 'DonutChart', {
|
|
66
68
|
enumerable: true,
|
|
67
69
|
get: function () {
|
|
@@ -97,6 +99,7 @@ exports.areaChartStyle = require_area_chart_style.areaChartStyle;
|
|
|
97
99
|
exports.barChartStyle = require_bar_chart_style.barChartStyle;
|
|
98
100
|
exports.cartesianChartStyle = require_cartesian_chart_style.cartesianChartStyle;
|
|
99
101
|
exports.chartStyle = require_chart_style.chartStyle;
|
|
102
|
+
exports.composedChartStyle = require_composed_chart_style.composedChartStyle;
|
|
100
103
|
exports.donutChartStyle = require_donut_chart_style.donutChartStyle;
|
|
101
104
|
exports.lineChartStyle = require_line_chart_style.lineChartStyle;
|
|
102
105
|
exports.pieChartStyle = require_pie_chart_style.pieChartStyle;
|
|
@@ -104,8 +107,7 @@ exports.polarChartStyle = require_polar_chart_style.polarChartStyle;
|
|
|
104
107
|
exports.radarChartStyle = require_radar_chart_style.radarChartStyle;
|
|
105
108
|
exports.radialChartStyle = require_radial_chart_style.radialChartStyle;
|
|
106
109
|
exports.useAngleAxis = require_use_polar_chart.useAngleAxis;
|
|
107
|
-
exports.
|
|
108
|
-
exports.useBarChart = require_use_bar_chart.useBarChart;
|
|
110
|
+
exports.useCartesianChart = require_use_cartesian_chart.useCartesianChart;
|
|
109
111
|
exports.useChart = require_use_chart.useChart;
|
|
110
112
|
exports.useChartArea = require_use_cartesian_chart.useChartArea;
|
|
111
113
|
exports.useChartBar = require_use_cartesian_chart.useChartBar;
|
|
@@ -126,9 +128,6 @@ exports.useChartSector = require_use_polar_chart.useChartSector;
|
|
|
126
128
|
exports.useChartTooltip = require_use_chart.useChartTooltip;
|
|
127
129
|
exports.useChartXAxis = require_use_cartesian_chart.useChartXAxis;
|
|
128
130
|
exports.useChartYAxis = require_use_cartesian_chart.useChartYAxis;
|
|
129
|
-
exports.
|
|
130
|
-
exports.usePieChart = require_use_pie_chart.usePieChart;
|
|
131
|
+
exports.usePolarChart = require_use_polar_chart.usePolarChart;
|
|
131
132
|
exports.usePolarGrid = require_use_polar_chart.usePolarGrid;
|
|
132
|
-
exports.useRadarChart = require_use_radar_chart.useRadarChart;
|
|
133
|
-
exports.useRadialChart = require_use_radial_chart.useRadialChart;
|
|
134
133
|
exports.useRadiusAxis = require_use_polar_chart.useRadiusAxis;
|
|
@@ -5,7 +5,6 @@ const require_create_component = require('../../core/components/create-component
|
|
|
5
5
|
require('../../core/index.cjs');
|
|
6
6
|
const require_line_chart_style = require('./line-chart.style.cjs');
|
|
7
7
|
const require_cartesian_chart = require('./cartesian-chart.cjs');
|
|
8
|
-
const require_use_line_chart = require('./use-line-chart.cjs');
|
|
9
8
|
let react = require("react");
|
|
10
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
10
|
let recharts = require("recharts");
|
|
@@ -17,18 +16,14 @@ const { PropsContext: LineChartPropsContext, usePropsContext: useLineChartPropsC
|
|
|
17
16
|
*
|
|
18
17
|
* @see https://yamada-ui.com/docs/components/line-chart
|
|
19
18
|
*/
|
|
20
|
-
const LineChart = withContext(({ children, series = [],
|
|
21
|
-
const { getChartProps, getRootProps } = require_use_line_chart.useLineChart(rest);
|
|
19
|
+
const LineChart = withContext(({ children, series = [], ...rest }) => {
|
|
22
20
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_cartesian_chart.CartesianChart, {
|
|
23
21
|
components: (0, react.useMemo)(() => [{
|
|
24
22
|
component: require_cartesian_chart.ChartLine,
|
|
25
23
|
fallback: series.map((props, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_cartesian_chart.ChartLine, { ...props }, index))
|
|
26
24
|
}], [series]),
|
|
27
|
-
render: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.LineChart, { ...
|
|
28
|
-
|
|
29
|
-
...chartProps
|
|
30
|
-
}) }),
|
|
31
|
-
...getRootProps(),
|
|
25
|
+
render: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.LineChart, { ...props }),
|
|
26
|
+
...rest,
|
|
32
27
|
children
|
|
33
28
|
});
|
|
34
29
|
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-chart.cjs","names":["createComponent","lineChartStyle","
|
|
1
|
+
{"version":3,"file":"line-chart.cjs","names":["createComponent","lineChartStyle","CartesianChart","ChartLine","OriginalLineChart"],"sources":["../../../../src/components/chart/line-chart.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type { GenericsComponent, ThemeProps } from \"../../core\"\nimport type { Dict } from \"../../utils\"\nimport type { CartesianChartProps, ChartLineProps } from \"./cartesian-chart\"\nimport type { LineChartStyle } from \"./line-chart.style\"\nimport { useMemo } from \"react\"\nimport { LineChart as OriginalLineChart } from \"recharts\"\nimport { createComponent } from \"../../core\"\nimport { CartesianChart, ChartLine } from \"./cartesian-chart\"\nimport { lineChartStyle } from \"./line-chart.style\"\n\nexport interface LineChartProps<Y extends Dict = Dict>\n extends\n Omit<CartesianChartProps<Y>, \"components\" | \"render\">,\n ThemeProps<LineChartStyle> {\n /**\n * If provided, generate lines based on series.\n */\n series?: ChartLineProps<Y>[]\n}\n\nconst {\n PropsContext: LineChartPropsContext,\n usePropsContext: useLineChartPropsContext,\n withContext,\n} = createComponent<LineChartProps, LineChartStyle>(\n \"line-chart\",\n lineChartStyle,\n)\n\nexport { LineChartPropsContext, useLineChartPropsContext }\n\n/**\n * `LineChart` is a component for drawing line charts to compare multiple sets of data.\n *\n * @see https://yamada-ui.com/docs/components/line-chart\n */\nexport const LineChart = withContext<\"div\", LineChartProps>(\n <Y extends Dict>({ children, series = [], ...rest }: LineChartProps<Y>) => {\n const components = useMemo(\n () => [\n {\n component: ChartLine,\n fallback: series.map((props, index) => (\n <ChartLine key={index} {...props} />\n )),\n },\n ],\n [series],\n )\n\n return (\n <CartesianChart\n components={components}\n render={(props) => <OriginalLineChart {...props} />}\n {...rest}\n >\n {children}\n </CartesianChart>\n )\n },\n)() as GenericsComponent<{\n <Y extends Dict>(props: LineChartProps<Y>): ReactElement\n}>\n"],"mappings":";;;;;;;;;;;;AAuBA,MAAM,EACJ,cAAc,uBACd,iBAAiB,0BACjB,gBACEA,yCACF,cACAC,wCACD;;;;;;AASD,MAAa,YAAY,aACN,EAAE,UAAU,SAAS,EAAE,EAAE,GAAG,WAA8B;AAazE,QACE,2CAACC;EACC,qCAbI,CACJ;GACE,WAAWC;GACX,UAAU,OAAO,KAAK,OAAO,UAC3B,2CAACA,qCAAsB,GAAI,SAAX,MAAoB,CACpC;GACH,CACF,EACD,CAAC,OAAO,CACT;EAKG,SAAS,UAAU,2CAACC,sBAAkB,GAAI,QAAS;EACnD,GAAI;EAEH;GACc;EAGtB,EAAE"}
|
|
@@ -5,7 +5,6 @@ const require_create_component = require('../../core/components/create-component
|
|
|
5
5
|
require('../../core/index.cjs');
|
|
6
6
|
const require_pie_chart_style = require('./pie-chart.style.cjs');
|
|
7
7
|
const require_polar_chart = require('./polar-chart.cjs');
|
|
8
|
-
const require_use_pie_chart = require('./use-pie-chart.cjs');
|
|
9
8
|
let react = require("react");
|
|
10
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
10
|
let recharts = require("recharts");
|
|
@@ -17,22 +16,18 @@ const { PropsContext: PieChartPropsContext, usePropsContext: usePieChartPropsCon
|
|
|
17
16
|
*
|
|
18
17
|
* @see https://yamada-ui.com/docs/components/pie-chart
|
|
19
18
|
*/
|
|
20
|
-
const PieChart = withContext(({ children, series = [],
|
|
21
|
-
const { getChartProps, getRootProps } = require_use_pie_chart.usePieChart(rest);
|
|
19
|
+
const PieChart = withContext(({ children, series = [], tooltipProps, ...rest }) => {
|
|
22
20
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_polar_chart.PolarChart, {
|
|
23
21
|
components: (0, react.useMemo)(() => [{
|
|
24
22
|
component: require_polar_chart.ChartPie,
|
|
25
23
|
fallback: series.map((props, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_polar_chart.ChartPie, { ...props }, index))
|
|
26
24
|
}], [series]),
|
|
27
|
-
render: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.PieChart, { ...
|
|
28
|
-
...props,
|
|
29
|
-
...chartProps
|
|
30
|
-
}) }),
|
|
25
|
+
render: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.PieChart, { ...props }),
|
|
31
26
|
tooltipProps: {
|
|
32
27
|
labelFormatter: (0, react.useCallback)(() => null, []),
|
|
33
28
|
...tooltipProps
|
|
34
29
|
},
|
|
35
|
-
...
|
|
30
|
+
...rest,
|
|
36
31
|
children
|
|
37
32
|
});
|
|
38
33
|
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pie-chart.cjs","names":["createComponent","pieChartStyle","
|
|
1
|
+
{"version":3,"file":"pie-chart.cjs","names":["createComponent","pieChartStyle","PolarChart","ChartPie","OriginalPieChart"],"sources":["../../../../src/components/chart/pie-chart.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type { GenericsComponent, ThemeProps } from \"../../core\"\nimport type { Dict } from \"../../utils\"\nimport type { ChartTooltipProps } from \"./chart\"\nimport type { PieChartStyle } from \"./pie-chart.style\"\nimport type { ChartPieProps, PolarChartProps } from \"./polar-chart\"\nimport { useCallback, useMemo } from \"react\"\nimport { PieChart as OriginalPieChart } from \"recharts\"\nimport { createComponent } from \"../../core\"\nimport { pieChartStyle } from \"./pie-chart.style\"\nimport { ChartPie, PolarChart } from \"./polar-chart\"\n\nexport interface PieChartProps<Y extends Dict = Dict>\n extends\n Omit<PolarChartProps<Y>, \"components\" | \"nameKey\" | \"render\">,\n ThemeProps<PieChartStyle> {\n /***\n * If provided, generate lines based on series.\n */\n series?: ChartPieProps<Y>[]\n}\n\nconst {\n PropsContext: PieChartPropsContext,\n usePropsContext: usePieChartPropsContext,\n withContext,\n} = createComponent<PieChartProps, PieChartStyle>(\"pie-chart\", pieChartStyle)\n\nexport { PieChartPropsContext, usePieChartPropsContext }\n\n/**\n * `PieChart` is a component for drawing pie charts to compare multiple sets of data.\n *\n * @see https://yamada-ui.com/docs/components/pie-chart\n */\nexport const PieChart = withContext<\"div\", PieChartProps>(\n <Y extends Dict>({\n children,\n series = [],\n tooltipProps,\n ...rest\n }: PieChartProps<Y>) => {\n const components = useMemo(\n () => [\n {\n component: ChartPie,\n fallback: series.map((props, index) => (\n <ChartPie key={index} {...props} />\n )),\n },\n ],\n [series],\n )\n const labelFormatter = useCallback<\n NonNullable<ChartTooltipProps[\"labelFormatter\"]>\n >(() => null, [])\n\n return (\n <PolarChart\n components={components}\n render={(props) => <OriginalPieChart {...props} />}\n tooltipProps={{ labelFormatter, ...tooltipProps }}\n {...rest}\n >\n {children}\n </PolarChart>\n )\n },\n)() as GenericsComponent<{\n <Y extends Dict>(props: PieChartProps<Y>): ReactElement\n}>\n"],"mappings":";;;;;;;;;;;;AAwBA,MAAM,EACJ,cAAc,sBACd,iBAAiB,yBACjB,gBACEA,yCAA8C,aAAaC,sCAAc;;;;;;AAS7E,MAAa,WAAW,aACL,EACf,UACA,SAAS,EAAE,EACX,cACA,GAAG,WACmB;AAgBtB,QACE,2CAACC;EACC,qCAhBI,CACJ;GACE,WAAWC;GACX,UAAU,OAAO,KAAK,OAAO,UAC3B,2CAACA,gCAAqB,GAAI,SAAX,MAAoB,CACnC;GACH,CACF,EACD,CAAC,OAAO,CACT;EAQG,SAAS,UAAU,2CAACC,qBAAiB,GAAI,QAAS;EAClD,cAAc;GAAE,6CANZ,MAAM,EAAE,CAAC;GAMmB,GAAG;GAAc;EACjD,GAAI;EAEH;GACU;EAGlB,EAAE"}
|
|
@@ -21,7 +21,8 @@ let recharts = require("recharts");
|
|
|
21
21
|
//#region src/components/chart/polar-chart.tsx
|
|
22
22
|
const shouldForwardProp = require_props.createShouldForwardProp();
|
|
23
23
|
const { component, ComponentContext, PropsContext: PolarChartPropsContext, useComponentContext, usePropsContext: usePolarChartPropsContext, withContext, withProvider, useSlotComponentProps } = require_create_component.createSlotComponent("polar-chart", require_polar_chart_style.polarChartStyle);
|
|
24
|
-
const PolarChart = withProvider(({ components: componentsProp, nameKey, withAngleAxis = false, withGrid = false, withRadiusAxis = false, angleAxisProps, donutProps, gridProps, pieProps = donutProps, radarProps, radialProps, radiusAxisProps, sectorProps, ...rest }) => {
|
|
24
|
+
const PolarChart = withProvider(({ components: componentsProp, nameKey, render, withAngleAxis = false, withGrid = false, withRadiusAxis = false, angleAxisProps, chartProps, donutProps, gridProps, pieProps = donutProps, radarProps, radialProps, radiusAxisProps, sectorProps, ...rest }) => {
|
|
25
|
+
const { getChartProps, getRootProps } = require_use_polar_chart.usePolarChart(rest);
|
|
25
26
|
const components = (0, react.useMemo)(() => [
|
|
26
27
|
{
|
|
27
28
|
component: ChartPolarGrid,
|
|
@@ -64,7 +65,11 @@ const PolarChart = withProvider(({ components: componentsProp, nameKey, withAngl
|
|
|
64
65
|
]),
|
|
65
66
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_chart.Chart, {
|
|
66
67
|
components,
|
|
67
|
-
|
|
68
|
+
render: (props) => render(getChartProps({
|
|
69
|
+
...props,
|
|
70
|
+
...chartProps
|
|
71
|
+
})),
|
|
72
|
+
...getRootProps()
|
|
68
73
|
})
|
|
69
74
|
});
|
|
70
75
|
}, "root")(void 0, ({ activeDotFill, activeDotRadius, activeDotStroke, activeDotStrokeWidth, angleAxisLineStroke, angleAxisLineStrokeWidth, angleAxisTextColor, angleAxisTextFill, dotFill, dotRadius, dotStroke, dotStrokeWidth, gridStroke, inactiveLabelLineOpacity, inactiveLabelOpacity, inactiveRadarOpacity, inactiveSectorOpacity, labelColor, labelFill, labelLineStroke, labelLineStrokeWidth, radarColor, radarFillOpacity, radarStroke, radarStrokeWidth, radialBackgroundColor, radialBackgroundFill, radialBackgroundStroke, radialBackgroundStrokeWidth, radiusAxisLineStroke, radiusAxisLineStrokeWidth, radiusAxisTextColor, radiusAxisTextFill, sectorColor, sectorFill, sectorStroke, sectorStrokeWidth, ...rest }) => ({
|