@yamada-ui/react 2.2.6 → 2.2.7-dev-20260804111744
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/_virtual/_rolldown/runtime.cjs +1 -1
- package/dist/cjs/components/accordion/accordion.cjs +4 -2
- package/dist/cjs/components/accordion/accordion.cjs.map +1 -1
- package/dist/cjs/components/accordion/use-accordion.cjs +1 -0
- package/dist/cjs/components/accordion/use-accordion.cjs.map +1 -1
- package/dist/cjs/components/action-bar/action-bar.cjs +1 -0
- package/dist/cjs/components/action-bar/action-bar.cjs.map +1 -1
- package/dist/cjs/components/action-bar/use-action-bar.cjs +1 -0
- package/dist/cjs/components/action-bar/use-action-bar.cjs.map +1 -1
- package/dist/cjs/components/airy/airy.cjs +1 -0
- package/dist/cjs/components/airy/airy.cjs.map +1 -1
- package/dist/cjs/components/alert/alert.cjs +5 -2
- package/dist/cjs/components/alert/alert.cjs.map +1 -1
- package/dist/cjs/components/alpha-slider/alpha-slider.cjs +1 -0
- package/dist/cjs/components/alpha-slider/alpha-slider.cjs.map +1 -1
- package/dist/cjs/components/aspect-ratio/aspect-ratio.cjs +1 -0
- package/dist/cjs/components/aspect-ratio/aspect-ratio.cjs.map +1 -1
- package/dist/cjs/components/autocomplete/autocomplete.cjs +14 -10
- package/dist/cjs/components/autocomplete/autocomplete.cjs.map +1 -1
- package/dist/cjs/components/autocomplete/use-autocomplete.cjs +1 -0
- package/dist/cjs/components/autocomplete/use-autocomplete.cjs.map +1 -1
- package/dist/cjs/components/avatar/avatar-group.cjs +13 -11
- package/dist/cjs/components/avatar/avatar-group.cjs.map +1 -1
- package/dist/cjs/components/avatar/use-avatar-group.cjs +1 -0
- package/dist/cjs/components/avatar/use-avatar-group.cjs.map +1 -1
- package/dist/cjs/components/avatar/use-avatar.cjs +1 -0
- package/dist/cjs/components/avatar/use-avatar.cjs.map +1 -1
- package/dist/cjs/components/blockquote/blockquote.cjs +1 -0
- package/dist/cjs/components/blockquote/blockquote.cjs.map +1 -1
- package/dist/cjs/components/breadcrumb/breadcrumb.cjs +1 -0
- package/dist/cjs/components/breadcrumb/breadcrumb.cjs.map +1 -1
- package/dist/cjs/components/breadcrumb/use-breadcrumb.cjs +1 -0
- package/dist/cjs/components/breadcrumb/use-breadcrumb.cjs.map +1 -1
- package/dist/cjs/components/button/button-group.cjs +1 -0
- package/dist/cjs/components/button/button-group.cjs.map +1 -1
- package/dist/cjs/components/button/button.cjs +9 -5
- package/dist/cjs/components/button/button.cjs.map +1 -1
- package/dist/cjs/components/calendar/calendar.cjs +1 -0
- package/dist/cjs/components/calendar/calendar.cjs.map +1 -1
- package/dist/cjs/components/calendar/use-calendar.cjs.map +1 -1
- package/dist/cjs/components/carousel/carousel.cjs +27 -25
- package/dist/cjs/components/carousel/carousel.cjs.map +1 -1
- package/dist/cjs/components/carousel/use-carousel.cjs.map +1 -1
- package/dist/cjs/components/chart/area-chart.cjs +6 -4
- package/dist/cjs/components/chart/area-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/bar-chart.cjs +6 -4
- package/dist/cjs/components/chart/bar-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/cartesian-chart.cjs +146 -139
- package/dist/cjs/components/chart/cartesian-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/chart.cjs +3 -1
- package/dist/cjs/components/chart/chart.cjs.map +1 -1
- package/dist/cjs/components/chart/composed-chart.cjs +16 -14
- package/dist/cjs/components/chart/composed-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/donut-chart.cjs +8 -5
- package/dist/cjs/components/chart/donut-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/line-chart.cjs +6 -4
- package/dist/cjs/components/chart/line-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/pie-chart.cjs +8 -5
- package/dist/cjs/components/chart/pie-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/polar-chart.cjs +119 -111
- package/dist/cjs/components/chart/polar-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/radar-chart.cjs +6 -4
- package/dist/cjs/components/chart/radar-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/radial-chart.cjs +1 -0
- package/dist/cjs/components/chart/radial-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/use-cartesian-chart.cjs +1 -0
- package/dist/cjs/components/chart/use-cartesian-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/use-chart.cjs +1 -0
- package/dist/cjs/components/chart/use-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/use-polar-chart.cjs +1 -0
- package/dist/cjs/components/chart/use-polar-chart.cjs.map +1 -1
- package/dist/cjs/components/checkbox/checkbox-group.cjs +39 -36
- package/dist/cjs/components/checkbox/checkbox-group.cjs.map +1 -1
- package/dist/cjs/components/checkbox/checkbox.cjs +1 -0
- package/dist/cjs/components/checkbox/checkbox.cjs.map +1 -1
- package/dist/cjs/components/checkbox/use-checkbox-group.cjs +1 -0
- package/dist/cjs/components/checkbox/use-checkbox-group.cjs.map +1 -1
- package/dist/cjs/components/checkbox/use-checkbox.cjs +3 -1
- package/dist/cjs/components/checkbox/use-checkbox.cjs.map +1 -1
- package/dist/cjs/components/checkbox-card/checkbox-card-group.cjs +43 -40
- package/dist/cjs/components/checkbox-card/checkbox-card-group.cjs.map +1 -1
- package/dist/cjs/components/checkbox-card/checkbox-card.cjs +1 -0
- package/dist/cjs/components/checkbox-card/checkbox-card.cjs.map +1 -1
- package/dist/cjs/components/circle-progress/circle-progress.cjs.map +1 -1
- package/dist/cjs/components/client-only/client-only.cjs +2 -1
- package/dist/cjs/components/client-only/client-only.cjs.map +1 -1
- package/dist/cjs/components/collapse/collapse.cjs +1 -0
- package/dist/cjs/components/collapse/collapse.cjs.map +1 -1
- package/dist/cjs/components/color-picker/color-picker.cjs +3 -1
- package/dist/cjs/components/color-picker/color-picker.cjs.map +1 -1
- package/dist/cjs/components/color-picker/use-color-picker.cjs +1 -0
- package/dist/cjs/components/color-picker/use-color-picker.cjs.map +1 -1
- package/dist/cjs/components/color-selector/color-selector.cjs +3 -1
- package/dist/cjs/components/color-selector/color-selector.cjs.map +1 -1
- package/dist/cjs/components/color-selector/use-color-selector.cjs +1 -0
- package/dist/cjs/components/color-selector/use-color-selector.cjs.map +1 -1
- package/dist/cjs/components/color-swatch/color-swatch.cjs.map +1 -1
- package/dist/cjs/components/data-list/data-list.cjs +9 -5
- package/dist/cjs/components/data-list/data-list.cjs.map +1 -1
- package/dist/cjs/components/date-picker/date-picker.cjs +3 -1
- package/dist/cjs/components/date-picker/date-picker.cjs.map +1 -1
- package/dist/cjs/components/date-picker/use-date-picker.cjs.map +1 -1
- package/dist/cjs/components/drawer/drawer.cjs +1 -0
- package/dist/cjs/components/drawer/drawer.cjs.map +1 -1
- package/dist/cjs/components/drawer/use-drawer.cjs +2 -3
- package/dist/cjs/components/drawer/use-drawer.cjs.map +1 -1
- package/dist/cjs/components/dropzone/dropzone.cjs +3 -1
- package/dist/cjs/components/dropzone/dropzone.cjs.map +1 -1
- package/dist/cjs/components/dropzone/use-dropzone.cjs +1 -0
- package/dist/cjs/components/dropzone/use-dropzone.cjs.map +1 -1
- package/dist/cjs/components/editable/editable.cjs.map +1 -1
- package/dist/cjs/components/editable/use-editable.cjs +1 -0
- package/dist/cjs/components/editable/use-editable.cjs.map +1 -1
- package/dist/cjs/components/fade/fade.cjs +1 -0
- package/dist/cjs/components/fade/fade.cjs.map +1 -1
- package/dist/cjs/components/fade-scale/fade-scale.cjs +1 -0
- package/dist/cjs/components/fade-scale/fade-scale.cjs.map +1 -1
- package/dist/cjs/components/field/field.cjs +1 -0
- package/dist/cjs/components/field/field.cjs.map +1 -1
- package/dist/cjs/components/field/use-field-props.cjs +1 -0
- package/dist/cjs/components/field/use-field-props.cjs.map +1 -1
- package/dist/cjs/components/fieldset/fieldset.cjs +1 -0
- package/dist/cjs/components/fieldset/fieldset.cjs.map +1 -1
- package/dist/cjs/components/file-button/use-file-button.cjs +1 -0
- package/dist/cjs/components/file-button/use-file-button.cjs.map +1 -1
- package/dist/cjs/components/file-input/file-input.cjs +3 -1
- package/dist/cjs/components/file-input/file-input.cjs.map +1 -1
- package/dist/cjs/components/file-input/use-file-input.cjs +1 -0
- package/dist/cjs/components/file-input/use-file-input.cjs.map +1 -1
- package/dist/cjs/components/flip/flip.cjs +1 -0
- package/dist/cjs/components/flip/flip.cjs.map +1 -1
- package/dist/cjs/components/float/float.cjs.map +1 -1
- package/dist/cjs/components/focus-lock/focus-lock.cjs.map +1 -1
- package/dist/cjs/components/for/for.cjs.map +1 -1
- package/dist/cjs/components/form/form.cjs +1 -0
- package/dist/cjs/components/form/form.cjs.map +1 -1
- package/dist/cjs/components/format/use-format-byte.cjs +1 -0
- package/dist/cjs/components/format/use-format-byte.cjs.map +1 -1
- package/dist/cjs/components/format/use-format-date-time.cjs +1 -0
- package/dist/cjs/components/format/use-format-date-time.cjs.map +1 -1
- package/dist/cjs/components/format/use-format-number.cjs +1 -0
- package/dist/cjs/components/format/use-format-number.cjs.map +1 -1
- package/dist/cjs/components/grid/grid-item.cjs.map +1 -1
- package/dist/cjs/components/group/group.cjs.map +1 -1
- package/dist/cjs/components/group/use-group.cjs +1 -0
- package/dist/cjs/components/group/use-group.cjs.map +1 -1
- package/dist/cjs/components/highlight/highlight.cjs +1 -0
- package/dist/cjs/components/highlight/highlight.cjs.map +1 -1
- package/dist/cjs/components/highlight/use-highlight.cjs +1 -0
- package/dist/cjs/components/highlight/use-highlight.cjs.map +1 -1
- package/dist/cjs/components/hue-slider/hue-slider.cjs +1 -0
- package/dist/cjs/components/hue-slider/hue-slider.cjs.map +1 -1
- package/dist/cjs/components/icon/icons/index.cjs +30 -6
- package/dist/cjs/components/icon/icons/index.cjs.map +1 -1
- package/dist/cjs/components/icon/icons/layout-freeform-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/layout-freeform-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/mic-audio-lines-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/mic-audio-lines-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/mic-signal-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/mic-signal-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/mosque-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/mosque-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/rotate-ccw-clock-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/rotate-ccw-clock-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/rotate-cw-fading-clock-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/rotate-cw-fading-clock-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/scan-square-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/scan-square-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/shield-keyhole-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/shield-keyhole-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/square-off-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/square-off-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/user-shield-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/user-shield-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/index.cjs +20 -4
- package/dist/cjs/components/indicator/indicator.cjs +1 -0
- package/dist/cjs/components/indicator/indicator.cjs.map +1 -1
- package/dist/cjs/components/infinite-scroll-area/infinite-scroll-area.cjs +3 -1
- package/dist/cjs/components/infinite-scroll-area/infinite-scroll-area.cjs.map +1 -1
- package/dist/cjs/components/infinite-scroll-area/use-infinite-scroll.cjs +1 -0
- package/dist/cjs/components/infinite-scroll-area/use-infinite-scroll.cjs.map +1 -1
- package/dist/cjs/components/input/input-group.cjs +14 -12
- package/dist/cjs/components/input/input-group.cjs.map +1 -1
- package/dist/cjs/components/input/input.style.cjs.map +1 -1
- package/dist/cjs/components/input/use-input-border.cjs +1 -0
- package/dist/cjs/components/input/use-input-border.cjs.map +1 -1
- package/dist/cjs/components/link-box/link-box.cjs.map +1 -1
- package/dist/cjs/components/list/list.cjs +1 -0
- package/dist/cjs/components/list/list.cjs.map +1 -1
- package/dist/cjs/components/loading/audio.cjs.map +1 -1
- package/dist/cjs/components/loading/background.cjs +1 -0
- package/dist/cjs/components/loading/background.cjs.map +1 -1
- package/dist/cjs/components/loading/circles.cjs.map +1 -1
- package/dist/cjs/components/loading/dots.cjs.map +1 -1
- package/dist/cjs/components/loading/grid.cjs.map +1 -1
- package/dist/cjs/components/loading/loading-provider.cjs +1 -0
- package/dist/cjs/components/loading/loading-provider.cjs.map +1 -1
- package/dist/cjs/components/loading/oval.cjs.map +1 -1
- package/dist/cjs/components/loading/page.cjs +1 -0
- package/dist/cjs/components/loading/page.cjs.map +1 -1
- package/dist/cjs/components/loading/puff.cjs.map +1 -1
- package/dist/cjs/components/loading/rings.cjs.map +1 -1
- package/dist/cjs/components/loading/screen.cjs +1 -0
- package/dist/cjs/components/loading/screen.cjs.map +1 -1
- package/dist/cjs/components/loading/suspense.cjs +1 -0
- package/dist/cjs/components/loading/suspense.cjs.map +1 -1
- package/dist/cjs/components/loading/use-loading-component.cjs +1 -0
- package/dist/cjs/components/loading/use-loading-component.cjs.map +1 -1
- package/dist/cjs/components/menu/menu.cjs +13 -10
- package/dist/cjs/components/menu/menu.cjs.map +1 -1
- package/dist/cjs/components/menu/use-menu.cjs +1 -0
- package/dist/cjs/components/menu/use-menu.cjs.map +1 -1
- package/dist/cjs/components/modal/modal.cjs +1 -0
- package/dist/cjs/components/modal/modal.cjs.map +1 -1
- package/dist/cjs/components/modal/use-modal.cjs +1 -0
- package/dist/cjs/components/modal/use-modal.cjs.map +1 -1
- package/dist/cjs/components/motion/motion.cjs +1 -0
- package/dist/cjs/components/motion/motion.cjs.map +1 -1
- package/dist/cjs/components/motion/transition.cjs.map +1 -1
- package/dist/cjs/components/native-accordion/native-accordion.cjs +1 -0
- package/dist/cjs/components/native-accordion/native-accordion.cjs.map +1 -1
- package/dist/cjs/components/native-accordion/use-native-accordion.cjs +1 -0
- package/dist/cjs/components/native-accordion/use-native-accordion.cjs.map +1 -1
- package/dist/cjs/components/native-popover/native-popover.cjs +1 -0
- package/dist/cjs/components/native-popover/native-popover.cjs.map +1 -1
- package/dist/cjs/components/native-popover/use-native-popover.cjs +1 -0
- package/dist/cjs/components/native-popover/use-native-popover.cjs.map +1 -1
- package/dist/cjs/components/native-select/native-select.cjs +2 -1
- package/dist/cjs/components/native-select/native-select.cjs.map +1 -1
- package/dist/cjs/components/native-select/use-native-select.cjs +1 -0
- package/dist/cjs/components/native-select/use-native-select.cjs.map +1 -1
- package/dist/cjs/components/notice/notice-provider.cjs +1 -0
- package/dist/cjs/components/notice/notice-provider.cjs.map +1 -1
- package/dist/cjs/components/notice/notice.cjs +1 -0
- package/dist/cjs/components/notice/notice.cjs.map +1 -1
- package/dist/cjs/components/notice/use-notice.cjs +1 -0
- package/dist/cjs/components/notice/use-notice.cjs.map +1 -1
- package/dist/cjs/components/number-input/number-input.cjs +2 -1
- package/dist/cjs/components/number-input/number-input.cjs.map +1 -1
- package/dist/cjs/components/number-input/use-number-counter.cjs +1 -0
- package/dist/cjs/components/number-input/use-number-counter.cjs.map +1 -1
- package/dist/cjs/components/number-input/use-number-input.cjs +1 -0
- package/dist/cjs/components/number-input/use-number-input.cjs.map +1 -1
- package/dist/cjs/components/number-input/use-spinner.cjs +1 -0
- package/dist/cjs/components/number-input/use-spinner.cjs.map +1 -1
- package/dist/cjs/components/pagination/pagination.cjs +1 -0
- package/dist/cjs/components/pagination/pagination.cjs.map +1 -1
- package/dist/cjs/components/pagination/use-pagination.cjs +1 -0
- package/dist/cjs/components/pagination/use-pagination.cjs.map +1 -1
- package/dist/cjs/components/password-input/password-input.cjs +2 -1
- package/dist/cjs/components/password-input/password-input.cjs.map +1 -1
- package/dist/cjs/components/password-input/use-password-input.cjs +1 -0
- package/dist/cjs/components/password-input/use-password-input.cjs.map +1 -1
- package/dist/cjs/components/password-input/use-strength-meter.cjs +1 -0
- package/dist/cjs/components/password-input/use-strength-meter.cjs.map +1 -1
- package/dist/cjs/components/picture/picture.cjs +1 -0
- package/dist/cjs/components/picture/picture.cjs.map +1 -1
- package/dist/cjs/components/pin-input/pin-input.cjs +1 -0
- package/dist/cjs/components/pin-input/pin-input.cjs.map +1 -1
- package/dist/cjs/components/pin-input/use-pin-input.cjs +1 -0
- package/dist/cjs/components/pin-input/use-pin-input.cjs.map +1 -1
- package/dist/cjs/components/popover/popover.cjs +1 -0
- package/dist/cjs/components/popover/popover.cjs.map +1 -1
- package/dist/cjs/components/popover/use-popover.cjs +1 -0
- package/dist/cjs/components/popover/use-popover.cjs.map +1 -1
- package/dist/cjs/components/portal/portal.cjs +1 -0
- package/dist/cjs/components/portal/portal.cjs.map +1 -1
- package/dist/cjs/components/progress/progress.cjs.map +1 -1
- package/dist/cjs/components/progress/use-progress.cjs +1 -0
- package/dist/cjs/components/progress/use-progress.cjs.map +1 -1
- package/dist/cjs/components/qr-code/qr-code.cjs +1 -0
- package/dist/cjs/components/qr-code/qr-code.cjs.map +1 -1
- package/dist/cjs/components/qr-code/use-qr-code.cjs +1 -0
- package/dist/cjs/components/qr-code/use-qr-code.cjs.map +1 -1
- package/dist/cjs/components/radio/radio-group.cjs +37 -34
- package/dist/cjs/components/radio/radio-group.cjs.map +1 -1
- package/dist/cjs/components/radio/radio.cjs +1 -0
- package/dist/cjs/components/radio/radio.cjs.map +1 -1
- package/dist/cjs/components/radio/use-radio-group.cjs +1 -0
- package/dist/cjs/components/radio/use-radio-group.cjs.map +1 -1
- package/dist/cjs/components/radio/use-radio.cjs +3 -1
- package/dist/cjs/components/radio/use-radio.cjs.map +1 -1
- package/dist/cjs/components/radio-card/radio-card-group.cjs +41 -38
- package/dist/cjs/components/radio-card/radio-card-group.cjs.map +1 -1
- package/dist/cjs/components/radio-card/radio-card.cjs +1 -0
- package/dist/cjs/components/radio-card/radio-card.cjs.map +1 -1
- package/dist/cjs/components/rating/rating.cjs +1 -0
- package/dist/cjs/components/rating/rating.cjs.map +1 -1
- package/dist/cjs/components/rating/use-rating.cjs +1 -0
- package/dist/cjs/components/rating/use-rating.cjs.map +1 -1
- package/dist/cjs/components/reorder/use-reorder.cjs +1 -0
- package/dist/cjs/components/reorder/use-reorder.cjs.map +1 -1
- package/dist/cjs/components/resizable/resizable.cjs +13 -10
- package/dist/cjs/components/resizable/resizable.cjs.map +1 -1
- package/dist/cjs/components/resizable/use-resizable.cjs +1 -0
- package/dist/cjs/components/resizable/use-resizable.cjs.map +1 -1
- package/dist/cjs/components/ripple/ripple.cjs.map +1 -1
- package/dist/cjs/components/ripple/use-ripple.cjs +1 -0
- package/dist/cjs/components/ripple/use-ripple.cjs.map +1 -1
- package/dist/cjs/components/rotate/rotate.cjs +1 -0
- package/dist/cjs/components/rotate/rotate.cjs.map +1 -1
- package/dist/cjs/components/saturation-slider/saturation-slider.cjs +1 -0
- package/dist/cjs/components/saturation-slider/saturation-slider.cjs.map +1 -1
- package/dist/cjs/components/saturation-slider/use-saturation-slider.cjs +1 -0
- package/dist/cjs/components/saturation-slider/use-saturation-slider.cjs.map +1 -1
- package/dist/cjs/components/scroll-area/use-scroll-area.cjs +1 -0
- package/dist/cjs/components/scroll-area/use-scroll-area.cjs.map +1 -1
- package/dist/cjs/components/segmented-control/segmented-control.cjs +3 -1
- package/dist/cjs/components/segmented-control/segmented-control.cjs.map +1 -1
- package/dist/cjs/components/segmented-control/use-segmented-control.cjs +1 -0
- package/dist/cjs/components/segmented-control/use-segmented-control.cjs.map +1 -1
- package/dist/cjs/components/select/select.cjs +14 -10
- package/dist/cjs/components/select/select.cjs.map +1 -1
- package/dist/cjs/components/select/use-select.cjs +1 -0
- package/dist/cjs/components/select/use-select.cjs.map +1 -1
- package/dist/cjs/components/show/show.cjs +1 -0
- package/dist/cjs/components/show/show.cjs.map +1 -1
- package/dist/cjs/components/sidebar/sidebar.cjs +6 -3
- package/dist/cjs/components/sidebar/sidebar.cjs.map +1 -1
- package/dist/cjs/components/sidebar/use-sidebar.cjs +1 -0
- package/dist/cjs/components/sidebar/use-sidebar.cjs.map +1 -1
- package/dist/cjs/components/simple-grid/simple-grid.cjs +1 -0
- package/dist/cjs/components/simple-grid/simple-grid.cjs.map +1 -1
- package/dist/cjs/components/skeleton/skeleton.cjs.map +1 -1
- package/dist/cjs/components/slide/slide.cjs +1 -0
- package/dist/cjs/components/slide/slide.cjs.map +1 -1
- package/dist/cjs/components/slide-fade/slide-fade.cjs +1 -0
- package/dist/cjs/components/slide-fade/slide-fade.cjs.map +1 -1
- package/dist/cjs/components/slider/slider.cjs +3 -1
- package/dist/cjs/components/slider/slider.cjs.map +1 -1
- package/dist/cjs/components/slider/use-slider.cjs +3 -1
- package/dist/cjs/components/slider/use-slider.cjs.map +1 -1
- package/dist/cjs/components/slot/slot.cjs +1 -0
- package/dist/cjs/components/slot/slot.cjs.map +1 -1
- package/dist/cjs/components/snacks/snacks.cjs +1 -0
- package/dist/cjs/components/snacks/snacks.cjs.map +1 -1
- package/dist/cjs/components/snacks/use-snacks.cjs +1 -0
- package/dist/cjs/components/snacks/use-snacks.cjs.map +1 -1
- package/dist/cjs/components/stack/stack.cjs +1 -0
- package/dist/cjs/components/stack/stack.cjs.map +1 -1
- package/dist/cjs/components/stack/z-stack.cjs +5 -2
- package/dist/cjs/components/stack/z-stack.cjs.map +1 -1
- package/dist/cjs/components/steps/steps.cjs +51 -47
- package/dist/cjs/components/steps/steps.cjs.map +1 -1
- package/dist/cjs/components/steps/use-steps.cjs +1 -0
- package/dist/cjs/components/steps/use-steps.cjs.map +1 -1
- package/dist/cjs/components/switch/switch.cjs.map +1 -1
- package/dist/cjs/components/switch/use-switch.cjs +1 -0
- package/dist/cjs/components/switch/use-switch.cjs.map +1 -1
- package/dist/cjs/components/table/table.cjs +51 -49
- package/dist/cjs/components/table/table.cjs.map +1 -1
- package/dist/cjs/components/tabs/tabs.cjs +23 -20
- package/dist/cjs/components/tabs/tabs.cjs.map +1 -1
- package/dist/cjs/components/tabs/use-tabs.cjs +1 -0
- package/dist/cjs/components/tabs/use-tabs.cjs.map +1 -1
- package/dist/cjs/components/tag/tag.cjs +1 -0
- package/dist/cjs/components/tag/tag.cjs.map +1 -1
- package/dist/cjs/components/textarea/use-autosize.cjs +1 -0
- package/dist/cjs/components/textarea/use-autosize.cjs.map +1 -1
- package/dist/cjs/components/textarea/use-textarea.cjs +1 -0
- package/dist/cjs/components/textarea/use-textarea.cjs.map +1 -1
- package/dist/cjs/components/timeline/timeline.cjs +1 -0
- package/dist/cjs/components/timeline/timeline.cjs.map +1 -1
- package/dist/cjs/components/tip/tip.cjs.map +1 -1
- package/dist/cjs/components/toggle/toggle-group.cjs +27 -24
- package/dist/cjs/components/toggle/toggle-group.cjs.map +1 -1
- package/dist/cjs/components/toggle/use-toggle-group.cjs +1 -0
- package/dist/cjs/components/toggle/use-toggle-group.cjs.map +1 -1
- package/dist/cjs/components/toggle/use-toggle.cjs +1 -0
- package/dist/cjs/components/toggle/use-toggle.cjs.map +1 -1
- package/dist/cjs/components/tooltip/tooltip.cjs.map +1 -1
- package/dist/cjs/components/tooltip/use-tooltip.cjs +1 -0
- package/dist/cjs/components/tooltip/use-tooltip.cjs.map +1 -1
- package/dist/cjs/components/tree/tree.cjs +1 -0
- package/dist/cjs/components/tree/tree.cjs.map +1 -1
- package/dist/cjs/components/tree/use-tree.cjs +1 -0
- package/dist/cjs/components/tree/use-tree.cjs.map +1 -1
- package/dist/cjs/core/components/create-component.cjs +5 -2
- package/dist/cjs/core/components/create-component.cjs.map +1 -1
- package/dist/cjs/core/components/props.cjs.map +1 -1
- package/dist/cjs/core/components/use-component-style.cjs +11 -6
- package/dist/cjs/core/components/use-component-style.cjs.map +1 -1
- package/dist/cjs/core/components/utils.cjs.map +1 -1
- package/dist/cjs/core/css/animation.cjs.map +1 -1
- package/dist/cjs/core/css/at-rule.cjs.map +1 -1
- package/dist/cjs/core/css/calc.cjs.map +1 -1
- package/dist/cjs/core/css/color-mix.cjs.map +1 -1
- package/dist/cjs/core/css/color-scheme.cjs.map +1 -1
- package/dist/cjs/core/css/config.cjs.map +1 -1
- package/dist/cjs/core/css/css.cjs +5 -3
- package/dist/cjs/core/css/css.cjs.map +1 -1
- package/dist/cjs/core/css/gradient.cjs.map +1 -1
- package/dist/cjs/core/css/merge-css.cjs.map +1 -1
- package/dist/cjs/core/css/style.cjs.map +1 -1
- package/dist/cjs/core/css/use-css.cjs +1 -0
- package/dist/cjs/core/css/use-css.cjs.map +1 -1
- package/dist/cjs/core/css/use-inject-vars.cjs +1 -0
- package/dist/cjs/core/css/use-inject-vars.cjs.map +1 -1
- package/dist/cjs/core/css/utils.cjs.map +1 -1
- package/dist/cjs/core/system/breakpoint.cjs.map +1 -1
- package/dist/cjs/core/system/color-mode-provider.cjs +1 -0
- package/dist/cjs/core/system/color-mode-provider.cjs.map +1 -1
- package/dist/cjs/core/system/create-system.cjs.map +1 -1
- package/dist/cjs/core/system/environment-provider.cjs +1 -0
- package/dist/cjs/core/system/environment-provider.cjs.map +1 -1
- package/dist/cjs/core/system/layer.cjs.map +1 -1
- package/dist/cjs/core/system/storage-script.cjs.map +1 -1
- package/dist/cjs/core/system/styled.cjs.map +1 -1
- package/dist/cjs/core/system/system-provider.cjs +1 -0
- package/dist/cjs/core/system/system-provider.cjs.map +1 -1
- package/dist/cjs/core/system/theme-provider.cjs +5 -3
- package/dist/cjs/core/system/theme-provider.cjs.map +1 -1
- package/dist/cjs/core/system/use-system-color-mode.cjs +1 -0
- package/dist/cjs/core/system/use-system-color-mode.cjs.map +1 -1
- package/dist/cjs/core/system/var.cjs +2 -1
- package/dist/cjs/core/system/var.cjs.map +1 -1
- package/dist/cjs/hooks/use-animation/index.cjs +4 -2
- package/dist/cjs/hooks/use-animation/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-async/index.cjs +1 -0
- package/dist/cjs/hooks/use-async/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-async-callback/index.cjs +1 -0
- package/dist/cjs/hooks/use-async-callback/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-boolean/index.cjs +1 -0
- package/dist/cjs/hooks/use-boolean/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-breakpoint/use-breakpoint-effect.cjs +1 -0
- package/dist/cjs/hooks/use-breakpoint/use-breakpoint-effect.cjs.map +1 -1
- package/dist/cjs/hooks/use-breakpoint/use-breakpoint-state.cjs +3 -1
- package/dist/cjs/hooks/use-breakpoint/use-breakpoint-state.cjs.map +1 -1
- package/dist/cjs/hooks/use-breakpoint/use-breakpoint-value.cjs +1 -0
- package/dist/cjs/hooks/use-breakpoint/use-breakpoint-value.cjs.map +1 -1
- package/dist/cjs/hooks/use-breakpoint/use-breakpoint.cjs +1 -0
- package/dist/cjs/hooks/use-breakpoint/use-breakpoint.cjs.map +1 -1
- package/dist/cjs/hooks/use-clickable/index.cjs +1 -0
- package/dist/cjs/hooks/use-clickable/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-clipboard/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-combobox/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-controllable-state/index.cjs +1 -0
- package/dist/cjs/hooks/use-controllable-state/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-counter/index.cjs +1 -0
- package/dist/cjs/hooks/use-counter/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-descendants/index.cjs +1 -0
- package/dist/cjs/hooks/use-descendants/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-disclosure/use-disclosure.cjs +1 -0
- package/dist/cjs/hooks/use-disclosure/use-disclosure.cjs.map +1 -1
- package/dist/cjs/hooks/use-disclosure/use-promise-disclosure.cjs +1 -0
- package/dist/cjs/hooks/use-disclosure/use-promise-disclosure.cjs.map +1 -1
- package/dist/cjs/hooks/use-event-listener/index.cjs +1 -0
- package/dist/cjs/hooks/use-event-listener/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-eye-dropper/index.cjs +1 -0
- package/dist/cjs/hooks/use-eye-dropper/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-field-sizing/index.cjs +1 -0
- package/dist/cjs/hooks/use-field-sizing/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-focus/index.cjs +3 -1
- package/dist/cjs/hooks/use-focus/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-hover/index.cjs +1 -0
- package/dist/cjs/hooks/use-hover/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-idle/index.cjs +1 -0
- package/dist/cjs/hooks/use-idle/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-interval/index.cjs +1 -0
- package/dist/cjs/hooks/use-interval/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-lazy-mount/index.cjs +1 -0
- package/dist/cjs/hooks/use-lazy-mount/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-local-storage/index.cjs +1 -0
- package/dist/cjs/hooks/use-local-storage/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-media-query/index.cjs +1 -0
- package/dist/cjs/hooks/use-media-query/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-mounted/index.cjs +1 -0
- package/dist/cjs/hooks/use-mounted/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-online/index.cjs +1 -0
- package/dist/cjs/hooks/use-online/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-os/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-outside-click/index.cjs +1 -0
- package/dist/cjs/hooks/use-outside-click/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-pan-event/index.cjs +1 -0
- package/dist/cjs/hooks/use-pan-event/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-popper/index.cjs +1 -0
- package/dist/cjs/hooks/use-popper/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-previous/index.cjs +1 -0
- package/dist/cjs/hooks/use-previous/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-processing/index.cjs +1 -0
- package/dist/cjs/hooks/use-processing/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-resize-observer/index.cjs +1 -0
- package/dist/cjs/hooks/use-resize-observer/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-timeout/index.cjs +1 -0
- package/dist/cjs/hooks/use-timeout/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-value/index.cjs +1 -0
- package/dist/cjs/hooks/use-value/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-window-event/index.cjs +1 -0
- package/dist/cjs/hooks/use-window-event/index.cjs.map +1 -1
- package/dist/cjs/index.cjs +30 -6
- package/dist/cjs/providers/i18n-provider/i18n-provider.cjs.map +1 -1
- package/dist/cjs/providers/ui-provider/ui-provider.cjs.map +1 -1
- package/dist/cjs/utils/children.cjs.map +1 -1
- package/dist/cjs/utils/context.cjs.map +1 -1
- package/dist/cjs/utils/dom.cjs.map +1 -1
- package/dist/cjs/utils/ref.cjs.map +1 -1
- package/dist/cjs/utils/ssr.cjs +1 -0
- package/dist/cjs/utils/ssr.cjs.map +1 -1
- package/dist/cjs/utils/store.cjs +1 -0
- package/dist/cjs/utils/store.cjs.map +1 -1
- package/dist/esm/components/accordion/accordion.js +3 -2
- package/dist/esm/components/accordion/accordion.js.map +1 -1
- package/dist/esm/components/accordion/use-accordion.js.map +1 -1
- package/dist/esm/components/action-bar/action-bar.js.map +1 -1
- package/dist/esm/components/action-bar/use-action-bar.js.map +1 -1
- package/dist/esm/components/airy/airy.js.map +1 -1
- package/dist/esm/components/alert/alert.js +4 -2
- package/dist/esm/components/alert/alert.js.map +1 -1
- package/dist/esm/components/alpha-slider/alpha-slider.js.map +1 -1
- package/dist/esm/components/aspect-ratio/aspect-ratio.js.map +1 -1
- package/dist/esm/components/autocomplete/autocomplete.js +13 -10
- package/dist/esm/components/autocomplete/autocomplete.js.map +1 -1
- package/dist/esm/components/autocomplete/use-autocomplete.js.map +1 -1
- package/dist/esm/components/avatar/avatar-group.js +12 -11
- package/dist/esm/components/avatar/avatar-group.js.map +1 -1
- package/dist/esm/components/avatar/use-avatar-group.js.map +1 -1
- package/dist/esm/components/avatar/use-avatar.js.map +1 -1
- package/dist/esm/components/breadcrumb/use-breadcrumb.js.map +1 -1
- package/dist/esm/components/button/button.js +8 -5
- package/dist/esm/components/button/button.js.map +1 -1
- package/dist/esm/components/calendar/calendar.js.map +1 -1
- package/dist/esm/components/calendar/use-calendar.js.map +1 -1
- package/dist/esm/components/carousel/carousel.js +26 -25
- package/dist/esm/components/carousel/carousel.js.map +1 -1
- package/dist/esm/components/carousel/use-carousel.js.map +1 -1
- package/dist/esm/components/chart/area-chart.js +5 -4
- package/dist/esm/components/chart/area-chart.js.map +1 -1
- package/dist/esm/components/chart/bar-chart.js +5 -4
- package/dist/esm/components/chart/bar-chart.js.map +1 -1
- package/dist/esm/components/chart/cartesian-chart.js +145 -139
- package/dist/esm/components/chart/cartesian-chart.js.map +1 -1
- package/dist/esm/components/chart/chart.js +2 -1
- package/dist/esm/components/chart/chart.js.map +1 -1
- package/dist/esm/components/chart/composed-chart.js +15 -14
- package/dist/esm/components/chart/composed-chart.js.map +1 -1
- package/dist/esm/components/chart/donut-chart.js +7 -5
- package/dist/esm/components/chart/donut-chart.js.map +1 -1
- package/dist/esm/components/chart/line-chart.js +5 -4
- package/dist/esm/components/chart/line-chart.js.map +1 -1
- package/dist/esm/components/chart/pie-chart.js +7 -5
- package/dist/esm/components/chart/pie-chart.js.map +1 -1
- package/dist/esm/components/chart/polar-chart.js +118 -111
- package/dist/esm/components/chart/polar-chart.js.map +1 -1
- package/dist/esm/components/chart/radar-chart.js +5 -4
- package/dist/esm/components/chart/radar-chart.js.map +1 -1
- package/dist/esm/components/chart/use-cartesian-chart.js.map +1 -1
- package/dist/esm/components/chart/use-chart.js.map +1 -1
- package/dist/esm/components/chart/use-polar-chart.js.map +1 -1
- package/dist/esm/components/checkbox/checkbox-group.js +38 -36
- package/dist/esm/components/checkbox/checkbox-group.js.map +1 -1
- package/dist/esm/components/checkbox/use-checkbox-group.js.map +1 -1
- package/dist/esm/components/checkbox/use-checkbox.js +2 -1
- package/dist/esm/components/checkbox/use-checkbox.js.map +1 -1
- package/dist/esm/components/checkbox-card/checkbox-card-group.js +42 -40
- package/dist/esm/components/checkbox-card/checkbox-card-group.js.map +1 -1
- package/dist/esm/components/circle-progress/circle-progress.js.map +1 -1
- package/dist/esm/components/client-only/client-only.js +2 -1
- package/dist/esm/components/client-only/client-only.js.map +1 -1
- package/dist/esm/components/collapse/collapse.js.map +1 -1
- package/dist/esm/components/color-picker/color-picker.js +2 -1
- package/dist/esm/components/color-picker/color-picker.js.map +1 -1
- package/dist/esm/components/color-picker/use-color-picker.js.map +1 -1
- package/dist/esm/components/color-selector/color-selector.js +2 -1
- package/dist/esm/components/color-selector/color-selector.js.map +1 -1
- package/dist/esm/components/color-selector/use-color-selector.js.map +1 -1
- package/dist/esm/components/color-swatch/color-swatch.js.map +1 -1
- package/dist/esm/components/data-list/data-list.js +8 -5
- package/dist/esm/components/data-list/data-list.js.map +1 -1
- package/dist/esm/components/date-picker/date-picker.js +2 -1
- package/dist/esm/components/date-picker/date-picker.js.map +1 -1
- package/dist/esm/components/date-picker/use-date-picker.js.map +1 -1
- package/dist/esm/components/drawer/drawer.js.map +1 -1
- package/dist/esm/components/drawer/use-drawer.js +1 -3
- package/dist/esm/components/drawer/use-drawer.js.map +1 -1
- package/dist/esm/components/dropzone/dropzone.js +2 -1
- package/dist/esm/components/dropzone/dropzone.js.map +1 -1
- package/dist/esm/components/dropzone/use-dropzone.js.map +1 -1
- package/dist/esm/components/editable/editable.js.map +1 -1
- package/dist/esm/components/editable/use-editable.js.map +1 -1
- package/dist/esm/components/field/field.js.map +1 -1
- package/dist/esm/components/field/use-field-props.js.map +1 -1
- package/dist/esm/components/fieldset/fieldset.js.map +1 -1
- package/dist/esm/components/file-input/file-input.js +2 -1
- package/dist/esm/components/file-input/file-input.js.map +1 -1
- package/dist/esm/components/file-input/use-file-input.js.map +1 -1
- package/dist/esm/components/flip/flip.js.map +1 -1
- package/dist/esm/components/float/float.js.map +1 -1
- package/dist/esm/components/focus-lock/focus-lock.js.map +1 -1
- package/dist/esm/components/for/for.js.map +1 -1
- package/dist/esm/components/form/form.js.map +1 -1
- package/dist/esm/components/grid/grid-item.js.map +1 -1
- package/dist/esm/components/group/group.js.map +1 -1
- package/dist/esm/components/group/use-group.js.map +1 -1
- package/dist/esm/components/highlight/use-highlight.js.map +1 -1
- package/dist/esm/components/icon/icons/index.js +21 -5
- package/dist/esm/components/icon/icons/index.js.map +1 -1
- package/dist/esm/components/icon/icons/layout-freeform-icon.js +14 -0
- package/dist/esm/components/icon/icons/layout-freeform-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/mic-audio-lines-icon.js +14 -0
- package/dist/esm/components/icon/icons/mic-audio-lines-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/mic-signal-icon.js +14 -0
- package/dist/esm/components/icon/icons/mic-signal-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/mosque-icon.js +14 -0
- package/dist/esm/components/icon/icons/mosque-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/rotate-ccw-clock-icon.js +14 -0
- package/dist/esm/components/icon/icons/rotate-ccw-clock-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/rotate-cw-fading-clock-icon.js +14 -0
- package/dist/esm/components/icon/icons/rotate-cw-fading-clock-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/scan-square-icon.js +14 -0
- package/dist/esm/components/icon/icons/scan-square-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/shield-keyhole-icon.js +14 -0
- package/dist/esm/components/icon/icons/shield-keyhole-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/square-off-icon.js +14 -0
- package/dist/esm/components/icon/icons/square-off-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/user-shield-icon.js +14 -0
- package/dist/esm/components/icon/icons/user-shield-icon.js.map +1 -0
- package/dist/esm/components/icon/index.js +11 -3
- package/dist/esm/components/indicator/indicator.js.map +1 -1
- package/dist/esm/components/infinite-scroll-area/infinite-scroll-area.js +2 -1
- package/dist/esm/components/infinite-scroll-area/infinite-scroll-area.js.map +1 -1
- package/dist/esm/components/input/input-group.js +13 -12
- package/dist/esm/components/input/input-group.js.map +1 -1
- package/dist/esm/components/input/input.style.js.map +1 -1
- package/dist/esm/components/link-box/link-box.js.map +1 -1
- package/dist/esm/components/loading/audio.js.map +1 -1
- package/dist/esm/components/loading/circles.js.map +1 -1
- package/dist/esm/components/loading/dots.js.map +1 -1
- package/dist/esm/components/loading/grid.js.map +1 -1
- package/dist/esm/components/loading/loading-provider.js.map +1 -1
- package/dist/esm/components/loading/oval.js.map +1 -1
- package/dist/esm/components/loading/puff.js.map +1 -1
- package/dist/esm/components/loading/rings.js.map +1 -1
- package/dist/esm/components/loading/use-loading-component.js.map +1 -1
- package/dist/esm/components/menu/menu.js +12 -10
- package/dist/esm/components/menu/menu.js.map +1 -1
- package/dist/esm/components/menu/use-menu.js.map +1 -1
- package/dist/esm/components/modal/modal.js.map +1 -1
- package/dist/esm/components/modal/use-modal.js.map +1 -1
- package/dist/esm/components/motion/motion.js.map +1 -1
- package/dist/esm/components/motion/transition.js.map +1 -1
- package/dist/esm/components/native-accordion/use-native-accordion.js.map +1 -1
- package/dist/esm/components/native-popover/native-popover.js.map +1 -1
- package/dist/esm/components/native-popover/use-native-popover.js.map +1 -1
- package/dist/esm/components/native-select/native-select.js +2 -1
- package/dist/esm/components/native-select/native-select.js.map +1 -1
- package/dist/esm/components/native-select/use-native-select.js.map +1 -1
- package/dist/esm/components/notice/notice.js.map +1 -1
- package/dist/esm/components/notice/use-notice.js.map +1 -1
- package/dist/esm/components/number-input/number-input.js +2 -1
- package/dist/esm/components/number-input/number-input.js.map +1 -1
- package/dist/esm/components/number-input/use-number-counter.js.map +1 -1
- package/dist/esm/components/number-input/use-number-input.js.map +1 -1
- package/dist/esm/components/pagination/pagination.js.map +1 -1
- package/dist/esm/components/pagination/use-pagination.js.map +1 -1
- package/dist/esm/components/password-input/password-input.js +2 -1
- package/dist/esm/components/password-input/password-input.js.map +1 -1
- package/dist/esm/components/password-input/use-password-input.js.map +1 -1
- package/dist/esm/components/password-input/use-strength-meter.js.map +1 -1
- package/dist/esm/components/picture/picture.js.map +1 -1
- package/dist/esm/components/pin-input/use-pin-input.js.map +1 -1
- package/dist/esm/components/popover/popover.js.map +1 -1
- package/dist/esm/components/popover/use-popover.js.map +1 -1
- package/dist/esm/components/portal/portal.js.map +1 -1
- package/dist/esm/components/progress/progress.js.map +1 -1
- package/dist/esm/components/progress/use-progress.js.map +1 -1
- package/dist/esm/components/radio/radio-group.js +36 -34
- package/dist/esm/components/radio/radio-group.js.map +1 -1
- package/dist/esm/components/radio/use-radio-group.js.map +1 -1
- package/dist/esm/components/radio/use-radio.js +2 -1
- package/dist/esm/components/radio/use-radio.js.map +1 -1
- package/dist/esm/components/radio-card/radio-card-group.js +40 -38
- package/dist/esm/components/radio-card/radio-card-group.js.map +1 -1
- package/dist/esm/components/rating/rating.js.map +1 -1
- package/dist/esm/components/rating/use-rating.js.map +1 -1
- package/dist/esm/components/reorder/use-reorder.js.map +1 -1
- package/dist/esm/components/resizable/resizable.js +12 -10
- package/dist/esm/components/resizable/resizable.js.map +1 -1
- package/dist/esm/components/resizable/use-resizable.js.map +1 -1
- package/dist/esm/components/ripple/ripple.js.map +1 -1
- package/dist/esm/components/ripple/use-ripple.js.map +1 -1
- package/dist/esm/components/rotate/rotate.js.map +1 -1
- package/dist/esm/components/saturation-slider/use-saturation-slider.js.map +1 -1
- package/dist/esm/components/scroll-area/use-scroll-area.js.map +1 -1
- package/dist/esm/components/segmented-control/segmented-control.js +2 -1
- package/dist/esm/components/segmented-control/segmented-control.js.map +1 -1
- package/dist/esm/components/segmented-control/use-segmented-control.js.map +1 -1
- package/dist/esm/components/select/select.js +13 -10
- package/dist/esm/components/select/select.js.map +1 -1
- package/dist/esm/components/select/use-select.js.map +1 -1
- package/dist/esm/components/show/show.js.map +1 -1
- package/dist/esm/components/sidebar/sidebar.js +5 -3
- package/dist/esm/components/sidebar/sidebar.js.map +1 -1
- package/dist/esm/components/sidebar/use-sidebar.js.map +1 -1
- package/dist/esm/components/simple-grid/simple-grid.js.map +1 -1
- package/dist/esm/components/skeleton/skeleton.js.map +1 -1
- package/dist/esm/components/slider/slider.js +2 -1
- package/dist/esm/components/slider/slider.js.map +1 -1
- package/dist/esm/components/slider/use-slider.js +2 -1
- package/dist/esm/components/slider/use-slider.js.map +1 -1
- package/dist/esm/components/snacks/snacks.js.map +1 -1
- package/dist/esm/components/stack/stack.js.map +1 -1
- package/dist/esm/components/stack/z-stack.js +4 -2
- package/dist/esm/components/stack/z-stack.js.map +1 -1
- package/dist/esm/components/steps/steps.js +50 -47
- package/dist/esm/components/steps/steps.js.map +1 -1
- package/dist/esm/components/steps/use-steps.js.map +1 -1
- package/dist/esm/components/switch/switch.js.map +1 -1
- package/dist/esm/components/switch/use-switch.js.map +1 -1
- package/dist/esm/components/table/table.js +50 -49
- package/dist/esm/components/table/table.js.map +1 -1
- package/dist/esm/components/tabs/tabs.js +22 -20
- package/dist/esm/components/tabs/tabs.js.map +1 -1
- package/dist/esm/components/tabs/use-tabs.js.map +1 -1
- package/dist/esm/components/tag/tag.js.map +1 -1
- package/dist/esm/components/textarea/use-autosize.js.map +1 -1
- package/dist/esm/components/timeline/timeline.js.map +1 -1
- package/dist/esm/components/tip/tip.js.map +1 -1
- package/dist/esm/components/toggle/toggle-group.js +26 -24
- package/dist/esm/components/toggle/toggle-group.js.map +1 -1
- package/dist/esm/components/toggle/use-toggle-group.js.map +1 -1
- package/dist/esm/components/toggle/use-toggle.js.map +1 -1
- package/dist/esm/components/tooltip/tooltip.js.map +1 -1
- package/dist/esm/components/tooltip/use-tooltip.js.map +1 -1
- package/dist/esm/components/tree/tree.js.map +1 -1
- package/dist/esm/components/tree/use-tree.js.map +1 -1
- package/dist/esm/core/components/create-component.js +4 -2
- package/dist/esm/core/components/create-component.js.map +1 -1
- package/dist/esm/core/components/props.js.map +1 -1
- package/dist/esm/core/components/use-component-style.js +10 -6
- package/dist/esm/core/components/use-component-style.js.map +1 -1
- package/dist/esm/core/components/utils.js.map +1 -1
- package/dist/esm/core/css/animation.js.map +1 -1
- package/dist/esm/core/css/at-rule.js.map +1 -1
- package/dist/esm/core/css/calc.js.map +1 -1
- package/dist/esm/core/css/color-mix.js.map +1 -1
- package/dist/esm/core/css/color-scheme.js.map +1 -1
- package/dist/esm/core/css/config.js.map +1 -1
- package/dist/esm/core/css/css.js +5 -3
- package/dist/esm/core/css/css.js.map +1 -1
- package/dist/esm/core/css/gradient.js.map +1 -1
- package/dist/esm/core/css/merge-css.js.map +1 -1
- package/dist/esm/core/css/style.js.map +1 -1
- package/dist/esm/core/css/use-css.js.map +1 -1
- package/dist/esm/core/css/utils.js.map +1 -1
- package/dist/esm/core/system/breakpoint.js.map +1 -1
- package/dist/esm/core/system/color-mode-provider.js.map +1 -1
- package/dist/esm/core/system/create-system.js.map +1 -1
- package/dist/esm/core/system/environment-provider.js.map +1 -1
- package/dist/esm/core/system/layer.js.map +1 -1
- package/dist/esm/core/system/storage-script.js.map +1 -1
- package/dist/esm/core/system/styled.js.map +1 -1
- package/dist/esm/core/system/theme-provider.js +4 -3
- package/dist/esm/core/system/theme-provider.js.map +1 -1
- package/dist/esm/core/system/use-system-color-mode.js.map +1 -1
- package/dist/esm/core/system/var.js +2 -1
- package/dist/esm/core/system/var.js.map +1 -1
- package/dist/esm/hooks/use-animation/index.js +3 -2
- package/dist/esm/hooks/use-animation/index.js.map +1 -1
- package/dist/esm/hooks/use-breakpoint/use-breakpoint-state.js +2 -1
- package/dist/esm/hooks/use-breakpoint/use-breakpoint-state.js.map +1 -1
- package/dist/esm/hooks/use-breakpoint/use-breakpoint.js.map +1 -1
- package/dist/esm/hooks/use-clickable/index.js.map +1 -1
- package/dist/esm/hooks/use-clipboard/index.js.map +1 -1
- package/dist/esm/hooks/use-combobox/index.js.map +1 -1
- package/dist/esm/hooks/use-controllable-state/index.js.map +1 -1
- package/dist/esm/hooks/use-counter/index.js.map +1 -1
- package/dist/esm/hooks/use-descendants/index.js.map +1 -1
- package/dist/esm/hooks/use-event-listener/index.js.map +1 -1
- package/dist/esm/hooks/use-focus/index.js +2 -1
- package/dist/esm/hooks/use-focus/index.js.map +1 -1
- package/dist/esm/hooks/use-local-storage/index.js.map +1 -1
- package/dist/esm/hooks/use-os/index.js.map +1 -1
- package/dist/esm/hooks/use-outside-click/index.js.map +1 -1
- package/dist/esm/hooks/use-pan-event/index.js.map +1 -1
- package/dist/esm/hooks/use-resize-observer/index.js.map +1 -1
- package/dist/esm/hooks/use-value/index.js.map +1 -1
- package/dist/esm/index.js +21 -5
- package/dist/esm/providers/i18n-provider/i18n-provider.js.map +1 -1
- package/dist/esm/providers/ui-provider/ui-provider.js.map +1 -1
- package/dist/types/components/chart/polar-chart.style.d.ts +1 -1
- package/dist/types/components/color-picker/color-picker.style.d.ts +1 -1
- package/dist/types/components/color-selector/color-selector.style.d.ts +2 -2
- package/dist/types/components/drawer/drawer.style.d.ts +2 -2
- package/dist/types/components/file-input/file-input.style.d.ts +1 -1
- package/dist/types/components/icon/icons/index.d.ts +12 -4
- package/dist/types/components/icon/icons/index.types.d.ts +1 -1
- package/dist/types/components/icon/icons/layout-freeform-icon.d.ts +13 -0
- package/dist/types/components/icon/icons/mic-audio-lines-icon.d.ts +13 -0
- package/dist/types/components/icon/icons/mic-signal-icon.d.ts +13 -0
- package/dist/types/components/icon/icons/mosque-icon.d.ts +13 -0
- package/dist/types/components/icon/icons/rotate-ccw-clock-icon.d.ts +13 -0
- package/dist/types/components/icon/icons/rotate-cw-fading-clock-icon.d.ts +13 -0
- package/dist/types/components/icon/icons/scan-square-icon.d.ts +13 -0
- package/dist/types/components/icon/icons/shield-keyhole-icon.d.ts +13 -0
- package/dist/types/components/icon/icons/{history-icon.d.ts → square-off-icon.d.ts} +5 -5
- package/dist/types/components/icon/icons/user-shield-icon.d.ts +13 -0
- package/dist/types/components/icon/index.d.ts +11 -3
- package/dist/types/components/modal/modal.style.d.ts +2 -2
- package/dist/types/components/notice/notice.style.d.ts +1 -1
- package/dist/types/components/tag/tag.style.d.ts +1 -1
- package/dist/types/index.d.ts +12 -4
- package/package.json +9 -9
- package/dist/cjs/components/icon/icons/history-icon.cjs +0 -14
- package/dist/cjs/components/icon/icons/history-icon.cjs.map +0 -1
- package/dist/cjs/components/icon/icons/podcast-icon.cjs +0 -14
- package/dist/cjs/components/icon/icons/podcast-icon.cjs.map +0 -1
- package/dist/esm/components/icon/icons/history-icon.js +0 -14
- package/dist/esm/components/icon/icons/history-icon.js.map +0 -1
- package/dist/esm/components/icon/icons/podcast-icon.js +0 -14
- package/dist/esm/components/icon/icons/podcast-icon.js.map +0 -1
- package/dist/types/components/icon/icons/podcast-icon.d.ts +0 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-pagination.cjs","names":["createContext","useControllableState","useI18n","mergeProps","mergeRefs"],"sources":["../../../../src/components/pagination/use-pagination.ts"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport { useCallback, useMemo } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { createContext, handlerAll, isNumber, mergeRefs } from \"../../utils\"\n\nexport type Page = \"ellipsis\" | number\n\ninterface PaginationContext extends Omit<UsePaginationReturn, \"getRootProps\"> {}\n\nconst [PaginationContext, usePaginationContext] =\n createContext<PaginationContext>({\n name: \"PaginationContext\",\n })\n\nexport { PaginationContext, usePaginationContext }\n\nexport interface UsePaginationProps extends Omit<\n HTMLProps,\n \"onChange\" | \"page\"\n> {\n /**\n * The total number of pages in pagination.\n */\n total: number\n /**\n * Number of elements visible on the left/right edges.\n *\n * @default 1\n */\n boundaries?: number\n /**\n * The initial page of the pagination.\n * Should be less than `total` and greater than `1`.\n *\n * @default 1\n */\n defaultPage?: number\n /**\n * If `true`, the pagination all item will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The page of the pagination.\n * Should be less than `total` and greater than `1`.\n */\n page?: number\n /** Number of siblings displayed on the left/right side of selected page.\n *\n * @default 1\n */\n siblings?: number\n /**\n * The callback invoked when the page changes.\n */\n onChange?: (page: number) => void\n}\n\nexport const usePagination = ({\n boundaries = 1,\n defaultPage = 1,\n disabled = false,\n page,\n siblings = 1,\n total,\n onChange: onChangeProp,\n ...rest\n}: UsePaginationProps) => {\n const { ref: restRef, ...restProps } = rest\n const [currentPage, setCurrentPage] = useControllableState({\n defaultValue: defaultPage,\n value: page,\n onChange: onChangeProp,\n })\n const { t } = useI18n(\"pagination\")\n const range = useMemo((): Page[] => {\n const minimumTotal = siblings * 2 + 3 + boundaries * 2\n\n if (minimumTotal >= total) return computedRange(1, total)\n\n const prevSiblings = Math.max(currentPage - siblings, boundaries)\n const nextSiblings = Math.min(currentPage + siblings, total - boundaries)\n const prevDots = prevSiblings > boundaries + 2\n const nextDots = nextSiblings < total - (boundaries + 1)\n\n if (!prevDots && nextDots) {\n const prevPages = siblings * 2 + boundaries + 2\n\n return [\n ...computedRange(1, prevPages),\n \"ellipsis\",\n ...computedRange(total - (boundaries - 1), total),\n ]\n }\n\n if (prevDots && !nextDots) {\n const nextPages = boundaries + 1 + 2 * siblings\n\n return [\n ...computedRange(1, boundaries),\n \"ellipsis\",\n ...computedRange(total - nextPages, total),\n ]\n }\n\n return [\n ...computedRange(1, boundaries),\n \"ellipsis\",\n ...computedRange(prevSiblings, nextSiblings),\n \"ellipsis\",\n ...computedRange(total - boundaries + 1, total),\n ]\n }, [boundaries, siblings, currentPage, total])\n\n const onChange = useCallback(\n (page: number) => setCurrentPage(Math.max(1, Math.min(total, page))),\n [setCurrentPage, total],\n )\n\n const onChangeStart = useCallback(() => setCurrentPage(1), [setCurrentPage])\n\n const onChangeEnd = useCallback(\n () => setCurrentPage(total),\n [setCurrentPage, total],\n )\n\n const onChangePrev = useCallback(\n () => setCurrentPage((prev) => Math.max(1, prev - 1)),\n [setCurrentPage],\n )\n\n const onChangeNext = useCallback(\n () => setCurrentPage((prev) => Math.min(total, prev + 1)),\n [setCurrentPage, total],\n )\n\n const getRootProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps(\n {\n \"aria-label\": t(\"Pagination\"),\n role: \"navigation\",\n },\n restProps,\n props,\n {\n ref: mergeRefs(ref, restRef),\n },\n )(),\n [restProps, restRef, t],\n )\n\n const getItemProps: PropGetter<\"button\", { page?: Page }> = useCallback(\n ({ page, ...props } = {}) => {\n if (isNumber(page))\n return {\n type: \"button\",\n \"aria-current\": currentPage === page ? \"page\" : undefined,\n \"aria-label\": t(\"Go to page {value}\", { value: page }),\n disabled,\n ...props,\n onClick: handlerAll(props.onClick, () => onChange(page)),\n }\n else return { ...props, \"data-ellipsis\": \"\" }\n },\n [currentPage, t, onChange, disabled],\n )\n\n const getStartTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n type: \"button\",\n \"aria-label\": t(\"Go to first page\"),\n disabled: disabled || currentPage === 1,\n ...props,\n onClick: handlerAll(props.onClick, onChangeStart),\n }),\n [onChangeStart, t, disabled, currentPage],\n )\n\n const getEndTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n type: \"button\",\n \"aria-label\": t(\"Go to last page\"),\n disabled: disabled || currentPage === total,\n ...props,\n onClick: handlerAll(props.onClick, onChangeEnd),\n }),\n [onChangeEnd, t, disabled, currentPage, total],\n )\n\n const getPrevTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n type: \"button\",\n \"aria-label\": t(\"Go to previous page\"),\n disabled: disabled || currentPage === 1,\n ...props,\n onClick: handlerAll(props.onClick, onChangePrev),\n }),\n [onChangePrev, t, disabled, currentPage],\n )\n\n const getNextTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n type: \"button\",\n \"aria-label\": t(\"Go to next page\"),\n disabled: disabled || currentPage === total,\n ...props,\n onClick: handlerAll(props.onClick, onChangeNext),\n }),\n [onChangeNext, t, disabled, currentPage, total],\n )\n\n return {\n currentPage,\n disabled,\n range,\n total,\n getEndTriggerProps,\n getItemProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getRootProps,\n getStartTriggerProps,\n onChange,\n onChangeEnd,\n onChangeNext,\n onChangePrev,\n onChangeStart,\n }\n}\n\nexport type UsePaginationReturn = ReturnType<typeof usePagination>\n\nconst computedRange = (start: number, end: number) =>\n Array.from({ length: end - start + 1 }, (_, index) => index + start)\n"],"mappings":";;;;;;;;;AAaA,MAAM,CAAC,mBAAmB,wBACxBA,gBAAAA,cAAiC,EAC/B,MAAM,oBACR,CAAC;AA+CH,MAAa,iBAAiB,EAC5B,aAAa,GACb,cAAc,GACd,WAAW,OACX,MACA,WAAW,GACX,OACA,UAAU,cACV,GAAG,WACqB;CACxB,MAAM,EAAE,KAAK,SAAS,GAAG,cAAc;CACvC,MAAM,CAAC,aAAa,kBAAkBC,2CAAAA,qBAAqB;EACzD,cAAc;EACd,OAAO;EACP,UAAU;CACZ,CAAC;CACD,MAAM,EAAE,MAAMC,sBAAAA,QAAQ,YAAY;CAClC,MAAM,SAAA,GAAA,MAAA,QAAA,OAA8B;EAGlC,IAFqB,WAAW,IAAI,IAAI,aAAa,KAEjC,OAAO,OAAO,cAAc,GAAG,KAAK;EAExD,MAAM,eAAe,KAAK,IAAI,cAAc,UAAU,UAAU;EAChE,MAAM,eAAe,KAAK,IAAI,cAAc,UAAU,QAAQ,UAAU;EACxE,MAAM,WAAW,eAAe,aAAa;EAC7C,MAAM,WAAW,eAAe,SAAS,aAAa;EAEtD,IAAI,CAAC,YAAY,UAAU;GACzB,MAAM,YAAY,WAAW,IAAI,aAAa;GAE9C,OAAO;IACL,GAAG,cAAc,GAAG,SAAS;IAC7B;IACA,GAAG,cAAc,SAAS,aAAa,IAAI,KAAK;GAClD;EACF;EAEA,IAAI,YAAY,CAAC,UAAU;GACzB,MAAM,YAAY,aAAa,IAAI,IAAI;GAEvC,OAAO;IACL,GA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ACA;GAAC;GAAc;GAAG;GAAU;GAAa;EAAK,CAU5B;EAClB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;AAIA,MAAM,iBAAiB,OAAe,QACpC,MAAM,KAAK,EAAE,QAAQ,MAAM,QAAQ,EAAE,IAAI,GAAG,UAAU,QAAQ,KAAK"}
|
|
1
|
+
{"version":3,"file":"use-pagination.cjs","names":["createContext","useControllableState","useI18n","useMemo","useCallback","mergeProps","mergeRefs"],"sources":["../../../../src/components/pagination/use-pagination.ts"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport { useCallback, useMemo } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { createContext, handlerAll, isNumber, mergeRefs } from \"../../utils\"\n\nexport type Page = \"ellipsis\" | number\n\ninterface PaginationContext extends Omit<UsePaginationReturn, \"getRootProps\"> {}\n\nconst [PaginationContext, usePaginationContext] =\n createContext<PaginationContext>({\n name: \"PaginationContext\",\n })\n\nexport { PaginationContext, usePaginationContext }\n\nexport interface UsePaginationProps extends Omit<\n HTMLProps,\n \"onChange\" | \"page\"\n> {\n /**\n * The total number of pages in pagination.\n */\n total: number\n /**\n * Number of elements visible on the left/right edges.\n *\n * @default 1\n */\n boundaries?: number\n /**\n * The initial page of the pagination.\n * Should be less than `total` and greater than `1`.\n *\n * @default 1\n */\n defaultPage?: number\n /**\n * If `true`, the pagination all item will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The page of the pagination.\n * Should be less than `total` and greater than `1`.\n */\n page?: number\n /** Number of siblings displayed on the left/right side of selected page.\n *\n * @default 1\n */\n siblings?: number\n /**\n * The callback invoked when the page changes.\n */\n onChange?: (page: number) => void\n}\n\nexport const usePagination = ({\n boundaries = 1,\n defaultPage = 1,\n disabled = false,\n page,\n siblings = 1,\n total,\n onChange: onChangeProp,\n ...rest\n}: UsePaginationProps) => {\n const { ref: restRef, ...restProps } = rest\n const [currentPage, setCurrentPage] = useControllableState({\n defaultValue: defaultPage,\n value: page,\n onChange: onChangeProp,\n })\n const { t } = useI18n(\"pagination\")\n const range = useMemo((): Page[] => {\n const minimumTotal = siblings * 2 + 3 + boundaries * 2\n\n if (minimumTotal >= total) return computedRange(1, total)\n\n const prevSiblings = Math.max(currentPage - siblings, boundaries)\n const nextSiblings = Math.min(currentPage + siblings, total - boundaries)\n const prevDots = prevSiblings > boundaries + 2\n const nextDots = nextSiblings < total - (boundaries + 1)\n\n if (!prevDots && nextDots) {\n const prevPages = siblings * 2 + boundaries + 2\n\n return [\n ...computedRange(1, prevPages),\n \"ellipsis\",\n ...computedRange(total - (boundaries - 1), total),\n ]\n }\n\n if (prevDots && !nextDots) {\n const nextPages = boundaries + 1 + 2 * siblings\n\n return [\n ...computedRange(1, boundaries),\n \"ellipsis\",\n ...computedRange(total - nextPages, total),\n ]\n }\n\n return [\n ...computedRange(1, boundaries),\n \"ellipsis\",\n ...computedRange(prevSiblings, nextSiblings),\n \"ellipsis\",\n ...computedRange(total - boundaries + 1, total),\n ]\n }, [boundaries, siblings, currentPage, total])\n\n const onChange = useCallback(\n (page: number) => setCurrentPage(Math.max(1, Math.min(total, page))),\n [setCurrentPage, total],\n )\n\n const onChangeStart = useCallback(() => setCurrentPage(1), [setCurrentPage])\n\n const onChangeEnd = useCallback(\n () => setCurrentPage(total),\n [setCurrentPage, total],\n )\n\n const onChangePrev = useCallback(\n () => setCurrentPage((prev) => Math.max(1, prev - 1)),\n [setCurrentPage],\n )\n\n const onChangeNext = useCallback(\n () => setCurrentPage((prev) => Math.min(total, prev + 1)),\n [setCurrentPage, total],\n )\n\n const getRootProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n mergeProps(\n {\n \"aria-label\": t(\"Pagination\"),\n role: \"navigation\",\n },\n restProps,\n props,\n {\n ref: mergeRefs(ref, restRef),\n },\n )(),\n [restProps, restRef, t],\n )\n\n const getItemProps: PropGetter<\"button\", { page?: Page }> = useCallback(\n ({ page, ...props } = {}) => {\n if (isNumber(page))\n return {\n type: \"button\",\n \"aria-current\": currentPage === page ? \"page\" : undefined,\n \"aria-label\": t(\"Go to page {value}\", { value: page }),\n disabled,\n ...props,\n onClick: handlerAll(props.onClick, () => onChange(page)),\n }\n else return { ...props, \"data-ellipsis\": \"\" }\n },\n [currentPage, t, onChange, disabled],\n )\n\n const getStartTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n type: \"button\",\n \"aria-label\": t(\"Go to first page\"),\n disabled: disabled || currentPage === 1,\n ...props,\n onClick: handlerAll(props.onClick, onChangeStart),\n }),\n [onChangeStart, t, disabled, currentPage],\n )\n\n const getEndTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n type: \"button\",\n \"aria-label\": t(\"Go to last page\"),\n disabled: disabled || currentPage === total,\n ...props,\n onClick: handlerAll(props.onClick, onChangeEnd),\n }),\n [onChangeEnd, t, disabled, currentPage, total],\n )\n\n const getPrevTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n type: \"button\",\n \"aria-label\": t(\"Go to previous page\"),\n disabled: disabled || currentPage === 1,\n ...props,\n onClick: handlerAll(props.onClick, onChangePrev),\n }),\n [onChangePrev, t, disabled, currentPage],\n )\n\n const getNextTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n type: \"button\",\n \"aria-label\": t(\"Go to next page\"),\n disabled: disabled || currentPage === total,\n ...props,\n onClick: handlerAll(props.onClick, onChangeNext),\n }),\n [onChangeNext, t, disabled, currentPage, total],\n )\n\n return {\n currentPage,\n disabled,\n range,\n total,\n getEndTriggerProps,\n getItemProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getRootProps,\n getStartTriggerProps,\n onChange,\n onChangeEnd,\n onChangeNext,\n onChangePrev,\n onChangeStart,\n }\n}\n\nexport type UsePaginationReturn = ReturnType<typeof usePagination>\n\nconst computedRange = (start: number, end: number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"}
|
|
@@ -38,7 +38,8 @@ const PasswordInput = withProvider(({ className, css, colorScheme, visibilityIco
|
|
|
38
38
|
})]
|
|
39
39
|
});
|
|
40
40
|
}, "root")((props) => {
|
|
41
|
-
|
|
41
|
+
const context = require_input.useInputPropsContext();
|
|
42
|
+
return require_props.mergeProps(context, props)();
|
|
42
43
|
});
|
|
43
44
|
const PasswordInputField = withContext(require_input.Input, "field")({ "data-group-propagate": "" });
|
|
44
45
|
const PasswordInputButton = withContext("button", "button")();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password-input.cjs","names":["createSlotComponent","passwordInputStyle","EyeOffIcon","EyeIcon","useGroupItemProps","usePasswordInput","mergeProps","useInputPropsContext","Input"],"sources":["../../../../src/components/password-input/password-input.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps, WithoutThemeProps } from \"../../core\"\nimport type { InputProps } from \"../input\"\nimport type { PasswordInputStyle } from \"./password-input.style\"\nimport type { UsePasswordInputProps } from \"./use-password-input\"\nimport { createSlotComponent, mergeProps } from \"../../core\"\nimport { useGroupItemProps } from \"../group\"\nimport { EyeIcon, EyeOffIcon } from \"../icon\"\nimport { Input, InputGroup, useInputPropsContext } from \"../input\"\nimport { passwordInputStyle } from \"./password-input.style\"\nimport { usePasswordInput } from \"./use-password-input\"\n\nexport interface PasswordInputProps\n extends\n WithoutThemeProps<InputProps, PasswordInputStyle>,\n ThemeProps<PasswordInputStyle>,\n UsePasswordInputProps {\n /**\n * The icons to be used for the visibility toggle.\n */\n visibilityIcon?: { off: ReactNode; on: ReactNode }\n /**\n * The props for the button element.\n */\n buttonProps?: PasswordInputButtonProps\n /**\n * The props for the end element.\n */\n elementProps?: InputGroup.ElementProps\n /**\n * The props for the root element.\n */\n rootProps?: InputGroup.RootProps\n}\n\nconst {\n PropsContext: PasswordInputPropsContext,\n usePropsContext: usePasswordInputPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<PasswordInputProps, PasswordInputStyle>(\n \"password-input\",\n passwordInputStyle,\n)\n\nexport { PasswordInputPropsContext, usePasswordInputPropsContext }\n\n/**\n * `PasswordInput` is a component that allows users to input passwords with a visibility toggle.\n *\n * @see https://yamada-ui.com/docs/components/password-input\n */\nexport const PasswordInput = withProvider<\"input\", PasswordInputProps>(\n ({\n className,\n css,\n colorScheme,\n visibilityIcon = { off: <EyeOffIcon />, on: <EyeIcon /> },\n buttonProps,\n elementProps,\n rootProps,\n ...props\n }) => {\n const [groupItemProps, rest] = useGroupItemProps(props)\n const { visible, getButtonProps, getInputProps } = usePasswordInput(rest)\n\n return (\n <InputGroup.Root\n className={className}\n css={css}\n colorScheme={colorScheme}\n {...mergeProps(groupItemProps, rootProps)()}\n >\n <PasswordInputField {...getInputProps()} />\n\n <InputGroup.Element clickable {...elementProps}>\n <PasswordInputButton {...getButtonProps(buttonProps)}>\n {visible ? visibilityIcon.off : visibilityIcon.on}\n </PasswordInputButton>\n </InputGroup.Element>\n </InputGroup.Root>\n )\n },\n \"root\",\n)((props) => {\n const context = useInputPropsContext()\n\n return mergeProps(context, props)()\n})\n\ninterface PasswordInputFieldProps extends InputProps {}\n\nconst PasswordInputField = withContext<\"input\", PasswordInputFieldProps>(\n Input,\n \"field\",\n)({ \"data-group-propagate\": \"\" })\n\ninterface PasswordInputButtonProps extends HTMLStyledProps<\"button\"> {}\n\nconst PasswordInputButton = withContext<\"button\", PasswordInputButtonProps>(\n \"button\",\n \"button\",\n)()\n"],"mappings":";;;;;;;;;;;;;AAqCA,MAAM,EACJ,cAAc,2BACd,iBAAiB,8BACjB,aACA,iBACEA,yBAAAA,oBACF,kBACAC,6BAAAA,kBACF;;;;;;AASA,MAAa,gBAAgB,cAC1B,EACC,WACA,KACA,aACA,iBAAiB;CAAE,KAAK,iBAAA,GAAA,kBAAA,IAAA,CAACC,qBAAAA,YAAD,CAAa,CAAA;CAAG,IAAI,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,SAAD,CAAU,CAAA;AAAE,GACxD,aACA,cACA,WACA,GAAG,YACC;CACJ,MAAM,CAAC,gBAAgB,QAAQC,kBAAAA,kBAAkB,KAAK;CACtD,MAAM,EAAE,SAAS,gBAAgB,kBAAkBC,2BAAAA,iBAAiB,IAAI;CAExE,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAA,oBAAA,gBAAA;EACa;EACN;EACQ;EACb,GAAIC,cAAAA,WAAW,gBAAgB,SAAS,CAAC,CAAC;EAJ5C,UAAA,CAME,iBAAA,GAAA,kBAAA,IAAA,CAAC,oBAAD,EAAoB,GAAI,cAAc,EAAI,CAAA,GAE1C,iBAAA,GAAA,kBAAA,IAAA,CAAA,sBAAA,cAAA;GAAoB,WAAA;GAAU,GAAI;GAChC,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,qBAAD;IAAqB,GAAI,eAAe,WAAW;IAChD,UAAA,UAAU,eAAe,MAAM,eAAe;GAC5B,CAAA;EACH,CAAA,CACL;;AAErB,GACA,MACF,CAAC,EAAE,UAAU;
|
|
1
|
+
{"version":3,"file":"password-input.cjs","names":["createSlotComponent","passwordInputStyle","EyeOffIcon","EyeIcon","useGroupItemProps","usePasswordInput","mergeProps","useInputPropsContext","Input"],"sources":["../../../../src/components/password-input/password-input.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps, WithoutThemeProps } from \"../../core\"\nimport type { InputProps } from \"../input\"\nimport type { PasswordInputStyle } from \"./password-input.style\"\nimport type { UsePasswordInputProps } from \"./use-password-input\"\nimport { createSlotComponent, mergeProps } from \"../../core\"\nimport { useGroupItemProps } from \"../group\"\nimport { EyeIcon, EyeOffIcon } from \"../icon\"\nimport { Input, InputGroup, useInputPropsContext } from \"../input\"\nimport { passwordInputStyle } from \"./password-input.style\"\nimport { usePasswordInput } from \"./use-password-input\"\n\nexport interface PasswordInputProps\n extends\n WithoutThemeProps<InputProps, PasswordInputStyle>,\n ThemeProps<PasswordInputStyle>,\n UsePasswordInputProps {\n /**\n * The icons to be used for the visibility toggle.\n */\n visibilityIcon?: { off: ReactNode; on: ReactNode }\n /**\n * The props for the button element.\n */\n buttonProps?: PasswordInputButtonProps\n /**\n * The props for the end element.\n */\n elementProps?: InputGroup.ElementProps\n /**\n * The props for the root element.\n */\n rootProps?: InputGroup.RootProps\n}\n\nconst {\n PropsContext: PasswordInputPropsContext,\n usePropsContext: usePasswordInputPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<PasswordInputProps, PasswordInputStyle>(\n \"password-input\",\n passwordInputStyle,\n)\n\nexport { PasswordInputPropsContext, usePasswordInputPropsContext }\n\n/**\n * `PasswordInput` is a component that allows users to input passwords with a visibility toggle.\n *\n * @see https://yamada-ui.com/docs/components/password-input\n */\nexport const PasswordInput = withProvider<\"input\", PasswordInputProps>(\n ({\n className,\n css,\n colorScheme,\n visibilityIcon = { off: <EyeOffIcon />, on: <EyeIcon /> },\n buttonProps,\n elementProps,\n rootProps,\n ...props\n }) => {\n const [groupItemProps, rest] = useGroupItemProps(props)\n const { visible, getButtonProps, getInputProps } = usePasswordInput(rest)\n\n return (\n <InputGroup.Root\n className={className}\n css={css}\n colorScheme={colorScheme}\n {...mergeProps(groupItemProps, rootProps)()}\n >\n <PasswordInputField {...getInputProps()} />\n\n <InputGroup.Element clickable {...elementProps}>\n <PasswordInputButton {...getButtonProps(buttonProps)}>\n {visible ? visibilityIcon.off : visibilityIcon.on}\n </PasswordInputButton>\n </InputGroup.Element>\n </InputGroup.Root>\n )\n },\n \"root\",\n)((props) => {\n const context = useInputPropsContext()\n\n return mergeProps(context, props)()\n})\n\ninterface PasswordInputFieldProps extends InputProps {}\n\nconst PasswordInputField = withContext<\"input\", PasswordInputFieldProps>(\n Input,\n \"field\",\n)({ \"data-group-propagate\": \"\" })\n\ninterface PasswordInputButtonProps extends HTMLStyledProps<\"button\"> {}\n\nconst PasswordInputButton = withContext<\"button\", PasswordInputButtonProps>(\n \"button\",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"version":3,"file":"use-password-input.cjs","names":["useFieldProps","useControllableState","useI18n","mergeProps","mergeRefs"],"sources":["../../../../src/components/password-input/use-password-input.tsx"],"sourcesContent":["\"use client\"\n\nimport type { MouseEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { handlerAll, mergeRefs } from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nexport interface UsePasswordInputProps extends HTMLProps<\"input\">, FieldProps {\n /**\n * Determines whether the password input is visible by default.\n *\n * @default false\n */\n defaultVisible?: boolean\n /**\n * Determines the visibility of the password input.\n *\n * @default false\n */\n visible?: boolean\n /**\n * Callback function that is triggered when the visibility of the password input changes.\n */\n onVisibleChange?: (visible: boolean) => void\n}\n\nexport const usePasswordInput = (props: UsePasswordInputProps = {}) => {\n const {\n props: {\n defaultVisible,\n disabled,\n visible: visibleProp,\n onVisibleChange,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const [visible, setVisible] = useControllableState({\n defaultValue: defaultVisible,\n value: visibleProp,\n onChange: onVisibleChange,\n })\n const { t } = useI18n(\"passwordInput\")\n\n const onChangeVisibility = useCallback(\n (ev: MouseEvent<HTMLButtonElement>) => {\n if (disabled || ev.button !== 0) return\n\n ev.preventDefault()\n\n setVisible((prev) => !prev)\n },\n [disabled, setVisible],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n ({ ref, ...props } = {}) => {\n const mergedProps = mergeProps(\n {\n type: visible ? \"text\" : \"password\",\n disabled,\n ...ariaProps,\n ...dataProps,\n },\n rest,\n props,\n )({\n mergeEvent: false,\n mergeRef: false,\n })\n\n return {\n ...mergedProps,\n ref: mergeRefs(ref, rest.ref),\n onBlur: handlerAll(eventProps.onBlur, props.onBlur),\n onFocus: handlerAll(eventProps.onFocus, props.onFocus),\n }\n },\n [visible, rest, disabled, dataProps, eventProps, ariaProps],\n )\n\n const getButtonProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n type: \"button\",\n \"aria-label\": t(\"Toggle password visibility\"),\n disabled,\n ...dataProps,\n ...props,\n onClick: handlerAll(props.onClick, onChangeVisibility),\n }),\n [onChangeVisibility, dataProps, disabled, t],\n )\n\n return {\n setVisible,\n visible,\n getButtonProps,\n getInputProps,\n }\n}\n\nexport type UsePasswordInputReturn = ReturnType<typeof usePasswordInput>\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-password-input.cjs","names":["useFieldProps","useControllableState","useI18n","useCallback","mergeProps","mergeRefs"],"sources":["../../../../src/components/password-input/use-password-input.tsx"],"sourcesContent":["\"use client\"\n\nimport type { MouseEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { handlerAll, mergeRefs } from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nexport interface UsePasswordInputProps extends HTMLProps<\"input\">, FieldProps {\n /**\n * Determines whether the password input is visible by default.\n *\n * @default false\n */\n defaultVisible?: boolean\n /**\n * Determines the visibility of the password input.\n *\n * @default false\n */\n visible?: boolean\n /**\n * Callback function that is triggered when the visibility of the password input changes.\n */\n onVisibleChange?: (visible: boolean) => void\n}\n\nexport const usePasswordInput = (props: UsePasswordInputProps = {}) => {\n const {\n props: {\n defaultVisible,\n disabled,\n visible: visibleProp,\n onVisibleChange,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const [visible, setVisible] = useControllableState({\n defaultValue: defaultVisible,\n value: visibleProp,\n onChange: onVisibleChange,\n })\n const { t } = useI18n(\"passwordInput\")\n\n const onChangeVisibility = useCallback(\n (ev: MouseEvent<HTMLButtonElement>) => {\n if (disabled || ev.button !== 0) return\n\n ev.preventDefault()\n\n setVisible((prev) => !prev)\n },\n [disabled, setVisible],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n ({ ref, ...props } = {}) => {\n const mergedProps = mergeProps(\n {\n type: visible ? \"text\" : \"password\",\n disabled,\n ...ariaProps,\n ...dataProps,\n },\n rest,\n props,\n )({\n mergeEvent: false,\n mergeRef: false,\n })\n\n return {\n ...mergedProps,\n ref: mergeRefs(ref, rest.ref),\n onBlur: handlerAll(eventProps.onBlur, props.onBlur),\n onFocus: handlerAll(eventProps.onFocus, props.onFocus),\n }\n },\n [visible, rest, disabled, dataProps, eventProps, ariaProps],\n )\n\n const getButtonProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n type: \"button\",\n \"aria-label\": t(\"Toggle password visibility\"),\n disabled,\n ...dataProps,\n ...props,\n onClick: handlerAll(props.onClick, onChangeVisibility),\n }),\n [onChangeVisibility, dataProps, disabled, t],\n )\n\n return {\n setVisible,\n visible,\n getButtonProps,\n getInputProps,\n }\n}\n\nexport type UsePasswordInputReturn = ReturnType<typeof usePasswordInput>\n"],"mappings":";;;;;;;;;;AA+BA,MAAa,oBAAoB,QAA+B,CAAC,MAAM;CACrE,MAAM,EACJ,OAAO,EACL,gBACA,UACA,SAAS,aACT,iBACA,GAAG,QAEL,WACA,WACA,eACEA,wBAAAA,cAAc,KAAK;CACvB,MAAM,CAAC,SAAS,cAAcC,2CAAAA,qBAAqB;EACjD,cAAc;EACd,OAAO;EACP,UAAU;CACZ,CAAC;CACD,MAAM,EAAE,MAAMC,sBAAAA,QAAQ,eAAe;CAErC,MAAM,sBAAA,GAAqBC,MAAAA,YAAAA,EACxB,OAAsC;EACrC,IAAI,YAAY,GAAG,WAAW,GAAG;EAEjC,GAAG,eAAe;EAElB,YAAY,SAAS,CAAC,IAAI;CAC5B,GACA,CAAC,UAAU,UAAU,CACvB;CAEA,MAAM,iBAAA,GAAqCA,MAAAA,YAAAA,EACxC,EAAE,KAAK,GAAG,UAAU,CAAC,MAAM;EAe1B,OAAO;GACL,GAfkBC,cAAAA,WAClB;IACE,MAAM,UAAU,SAAS;IACzB;IACA,GAAG;IACH,GAAG;GACL,GACA,MACA,KACF,CAAC,CAAC;IACA,YAAY;IACZ,UAAU;GACZ,CAGe;GACb,KAAKC,YAAAA,UAAU,KAAK,KAAK,GAAG;GAC5B,SAAA,GAAA,oBAAA,cAAQ,WAAA,CAAW,WAAW,QAAQ,MAAM,MAAM;GAClD,UAAA,GAAA,oBAAA,cAAS,WAAA,CAAW,WAAW,SAAS,MAAM,OAAO;EACvD;CACF,GACA;EAAC;EAAS;EAAM;EAAU;EAAW;EAAY;CAAS,CAC5D;CAcA,OAAO;EACL;EACA;EACA,iBAAA,GAf2CF,MAAAA,YAAAA,EAC1C,QAAQ,CAAC,OAAO;GACf,MAAM;GACN,cAAc,EAAE,4BAA4B;GAC5C;GACA,GAAG;GACH,GAAG;GACH,UAAA,GAAA,oBAAA,cAAS,WAAA,CAAW,MAAM,SAAS,kBAAkB;EACvD,IACA;GAAC;GAAoB;GAAW;GAAU;EAAC,CAM9B;EACb;CACF;AACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
3
|
const require_utils_index = require("../../utils/index.cjs");
|
|
3
4
|
const require_props = require("../../core/components/props.cjs");
|
|
4
5
|
const require_i18n_provider = require("../../providers/i18n-provider/i18n-provider.cjs");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-strength-meter.cjs","names":["useI18n","mergeProps"],"sources":["../../../../src/components/password-input/use-strength-meter.ts"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, PropGetter, RequiredPropGetter } from \"../../core\"\nimport { useCallback } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { dataAttr } from \"../../utils\"\n\nexport interface UseStrengthMeterProps extends HTMLProps {\n /**\n * The value of the password strength meter.\n */\n value: number\n /**\n * The maximum value of the password strength meter.\n *\n * @default 4\n */\n max?: number\n}\n\nexport const useStrengthMeter = ({\n max = 4,\n value,\n ...rest\n}: UseStrengthMeterProps) => {\n const { t } = useI18n(\"passwordInput\")\n\n const getRootProps: PropGetter = useCallback(\n (props) =>\n mergeProps(\n {\n \"aria-label\": t(\"Password strength meter\"),\n \"aria-valuemax\": max,\n \"aria-valuemin\": 0,\n \"aria-valuenow\": value,\n role: \"meter\",\n },\n rest,\n props,\n )(),\n [max, rest, value, t],\n )\n\n const getIndicatorProps: RequiredPropGetter<\"div\", { index: number }> =\n useCallback(\n ({ index, ...props }) => ({\n \"data-selected\": dataAttr(index < value),\n ...props,\n }),\n [value],\n )\n\n return { getIndicatorProps, getRootProps }\n}\n\nexport type UseStrengthMeterReturn = ReturnType<typeof useStrengthMeter>\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-strength-meter.cjs","names":["useI18n","useCallback","mergeProps"],"sources":["../../../../src/components/password-input/use-strength-meter.ts"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, PropGetter, RequiredPropGetter } from \"../../core\"\nimport { useCallback } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { dataAttr } from \"../../utils\"\n\nexport interface UseStrengthMeterProps extends HTMLProps {\n /**\n * The value of the password strength meter.\n */\n value: number\n /**\n * The maximum value of the password strength meter.\n *\n * @default 4\n */\n max?: number\n}\n\nexport const useStrengthMeter = ({\n max = 4,\n value,\n ...rest\n}: UseStrengthMeterProps) => {\n const { t } = useI18n(\"passwordInput\")\n\n const getRootProps: PropGetter = useCallback(\n (props) =>\n mergeProps(\n {\n \"aria-label\": t(\"Password strength meter\"),\n \"aria-valuemax\": max,\n \"aria-valuemin\": 0,\n \"aria-valuenow\": value,\n role: \"meter\",\n },\n rest,\n props,\n )(),\n [max, rest, value, t],\n )\n\n const getIndicatorProps: RequiredPropGetter<\"div\", { index: number }> =\n useCallback(\n ({ index, ...props }) => ({\n \"data-selected\": dataAttr(index < value),\n ...props,\n }),\n [value],\n )\n\n return { getIndicatorProps, getRootProps }\n}\n\nexport type UseStrengthMeterReturn = ReturnType<typeof useStrengthMeter>\n"],"mappings":";;;;;;;AAqBA,MAAa,oBAAoB,EAC/B,MAAM,GACN,OACA,GAAG,WACwB;CAC3B,MAAM,EAAE,MAAMA,sBAAAA,QAAQ,eAAe;CAErC,MAAM,gBAAA,GAA2BC,MAAAA,YAAAA,EAC9B,UACCC,cAAAA,WACE;EACE,cAAc,EAAE,yBAAyB;EACzC,iBAAiB;EACjB,iBAAiB;EACjB,iBAAiB;EACjB,MAAM;CACR,GACA,MACA,KACF,CAAC,CAAC,GACJ;EAAC;EAAK;EAAM;EAAO;CAAC,CACtB;CAWA,OAAO;EAAE,oBAAA,GARPD,MAAAA,YAAAA,EACG,EAAE,OAAO,GAAG,aAAa;GACxB,kBAAA,GAAA,oBAAA,cAAiB,SAAA,CAAS,QAAQ,KAAK;GACvC,GAAG;EACL,IACA,CAAC,KAAK,CAGe;EAAG;CAAa;AAC3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"picture.cjs","names":["useSystem","tokenToValue","styled","Image"],"sources":["../../../../src/components/picture/picture.tsx"],"sourcesContent":["import type { FC } from \"react\"\nimport type { HTMLStyledProps, ThemeTokens } from \"../../core\"\nimport type { AnyString } from \"../../utils\"\nimport type { ImageProps } from \"../image\"\nimport { useCallback, useMemo } from \"react\"\nimport { styled, tokenToValue, useSystem } from \"../../core\"\nimport { getPx, isUndefined } from \"../../utils\"\nimport { Image } from \"../image\"\n\nconst createQuery = (\n minW: number | string | undefined,\n maxW: number | string | undefined,\n) => {\n let media = \"\"\n\n if (minW) {\n media = `(min-width: ${minW}px)`\n\n if (maxW) media += ` and (max-width: ${maxW}px)`\n } else {\n media = `(max-width: ${maxW}px)`\n }\n\n return media\n}\n\nexport interface PictureSource extends SourceProps {\n /**\n * The maximum width for the source.\n *\n * If media is set, media takes precedence.\n */\n maxW?: AnyString | number | ThemeTokens[\"sizes\"]\n /**\n * The minimum width for the source.\n *\n * If media is set, media takes precedence.\n */\n minW?: AnyString | number | ThemeTokens[\"sizes\"]\n /**\n * The source set for the source element.\n */\n srcSet?: string\n}\n\nexport interface PictureProps extends ImageProps {\n /**\n * If `true`, the sources will be sorted by the `minW` and `maxW` properties.\n *\n * @default true\n */\n enableSorting?: boolean\n /**\n * The sources for the picture element.\n */\n sources?: PictureSource[]\n /**\n * The props for the picture element.\n */\n pictureProps?: HTMLStyledProps<\"picture\">\n}\n\n/**\n * `Picture` is a component that uses the `picture` element to provide alternative images for different display or device scenarios.\n *\n * @see https://yamada-ui.com/docs/components/picture\n */\nexport const Picture: FC<PictureProps> = ({\n children,\n enableSorting = true,\n sources: sourcesProp = [],\n pictureProps,\n ...rest\n}) => {\n const system = useSystem()\n const { queriesObj } = system.breakpoints\n const { direction = \"down\", identifier = \"@media screen\" } =\n system.config.breakpoint ?? {}\n const searchValue =\n identifier === \"@media screen\" ? \"@media screen and \" : `${identifier} `\n\n const compareSources = useCallback(\n (a: PictureSource, b: PictureSource) => {\n const k = direction === \"down\" ? \"maxW\" : \"minW\"\n\n if (isUndefined(a[k]) && !isUndefined(b[k])) return -1\n\n if (!isUndefined(a[k]) && isUndefined(b[k])) return 1\n\n return direction === \"down\"\n ? Number(a.maxW) - Number(b.maxW)\n : Number(b.minW) - Number(a.minW)\n },\n [direction],\n )\n\n const sources = useMemo(() => {\n const computedSources = sourcesProp.map(\n ({ maxW, media, minW, ...rest }) => {\n if (!media) {\n if (minW) minW = getPx(tokenToValue(system)(\"sizes\", minW))\n if (maxW) maxW = getPx(tokenToValue(system)(\"sizes\", maxW))\n\n media = createQuery(minW, maxW)\n\n return { ...rest, maxW, media, minW }\n } else {\n const { maxW, minW, query } = queriesObj[media] ?? {}\n\n if (query) media = query.replace(searchValue, \"\")\n\n return { ...rest, maxW, media, minW }\n }\n },\n )\n\n if (enableSorting) return computedSources.sort(compareSources)\n else return computedSources\n }, [\n sourcesProp,\n enableSorting,\n system,\n queriesObj,\n searchValue,\n compareSources,\n ])\n\n const sourceElements = useMemo(\n () =>\n sources.map(({ maxW: _maxW, minW: _minW, ...rest }, index) => (\n <styled.source key={index} {...rest} />\n )),\n [sources],\n )\n\n return (\n <styled.picture {...pictureProps}>\n {children ?? (\n <>\n {sourceElements}\n\n <Image {...rest} />\n </>\n )}\n </styled.picture>\n )\n}\n\nexport interface SourceProps extends HTMLStyledProps<\"source\"> {\n /**\n * The media query for the source.\n */\n media?: AnyString | ThemeTokens[\"breakpoints\"]\n}\n\nexport const Source: FC<SourceProps> = ({ media, ...rest }) => {\n const { breakpoints, config } = useSystem()\n const { queriesObj } = breakpoints\n const { identifier = \"@media screen\" } = config.breakpoint ?? {}\n const searchValue =\n identifier === \"@media screen\" ? \"@media screen and \" : `${identifier} `\n\n const { query } = media ? (queriesObj[media] ?? {}) : {}\n\n if (query) media = query.replace(searchValue, \"\")\n\n return <styled.source media={media} {...rest} />\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"picture.cjs","names":["useSystem","useCallback","useMemo","tokenToValue","styled","Image"],"sources":["../../../../src/components/picture/picture.tsx"],"sourcesContent":["import type { FC } from \"react\"\nimport type { HTMLStyledProps, ThemeTokens } from \"../../core\"\nimport type { AnyString } from \"../../utils\"\nimport type { ImageProps } from \"../image\"\nimport { useCallback, useMemo } from \"react\"\nimport { styled, tokenToValue, useSystem } from \"../../core\"\nimport { getPx, isUndefined } from \"../../utils\"\nimport { Image } from \"../image\"\n\nconst createQuery = (\n minW: number | string | undefined,\n maxW: number | string | undefined,\n) => {\n let media = \"\"\n\n if (minW) {\n media = `(min-width: ${minW}px)`\n\n if (maxW) media += ` and (max-width: ${maxW}px)`\n } else {\n media = `(max-width: ${maxW}px)`\n }\n\n return media\n}\n\nexport interface PictureSource extends SourceProps {\n /**\n * The maximum width for the source.\n *\n * If media is set, media takes precedence.\n */\n maxW?: AnyString | number | ThemeTokens[\"sizes\"]\n /**\n * The minimum width for the source.\n *\n * If media is set, media takes precedence.\n */\n minW?: AnyString | number | ThemeTokens[\"sizes\"]\n /**\n * The source set for the source element.\n */\n srcSet?: string\n}\n\nexport interface PictureProps extends ImageProps {\n /**\n * If `true`, the sources will be sorted by the `minW` and `maxW` properties.\n *\n * @default true\n */\n enableSorting?: boolean\n /**\n * The sources for the picture element.\n */\n sources?: PictureSource[]\n /**\n * The props for the picture element.\n */\n pictureProps?: HTMLStyledProps<\"picture\">\n}\n\n/**\n * `Picture` is a component that uses the `picture` element to provide alternative images for different display or device scenarios.\n *\n * @see https://yamada-ui.com/docs/components/picture\n */\nexport const Picture: FC<PictureProps> = ({\n children,\n enableSorting = true,\n sources: sourcesProp = [],\n pictureProps,\n ...rest\n}) => {\n const system = useSystem()\n const { queriesObj } = system.breakpoints\n const { direction = \"down\", identifier = \"@media screen\" } =\n system.config.breakpoint ?? {}\n const searchValue =\n identifier === \"@media screen\" ? \"@media screen and \" : `${identifier} `\n\n const compareSources = useCallback(\n (a: PictureSource, b: PictureSource) => {\n const k = direction === \"down\" ? \"maxW\" : \"minW\"\n\n if (isUndefined(a[k]) && !isUndefined(b[k])) return -1\n\n if (!isUndefined(a[k]) && isUndefined(b[k])) return 1\n\n return direction === \"down\"\n ? Number(a.maxW) - Number(b.maxW)\n : Number(b.minW) - Number(a.minW)\n },\n [direction],\n )\n\n const sources = useMemo(() => {\n const computedSources = sourcesProp.map(\n ({ maxW, media, minW, ...rest }) => {\n if (!media) {\n if (minW) minW = getPx(tokenToValue(system)(\"sizes\", minW))\n if (maxW) maxW = getPx(tokenToValue(system)(\"sizes\", maxW))\n\n media = createQuery(minW, maxW)\n\n return { ...rest, maxW, media, minW }\n } else {\n const { maxW, minW, query } = queriesObj[media] ?? {}\n\n if (query) media = query.replace(searchValue, \"\")\n\n return { ...rest, maxW, media, minW }\n }\n },\n )\n\n if (enableSorting) return computedSources.sort(compareSources)\n else return computedSources\n }, [\n sourcesProp,\n enableSorting,\n system,\n queriesObj,\n searchValue,\n compareSources,\n ])\n\n const sourceElements = useMemo(\n () =>\n sources.map(({ maxW: _maxW, minW: _minW, ...rest }, index) => (\n <styled.source key={index} {...rest} />\n )),\n [sources],\n )\n\n return (\n <styled.picture {...pictureProps}>\n {children ?? (\n <>\n {sourceElements}\n\n <Image {...rest} />\n </>\n )}\n </styled.picture>\n )\n}\n\nexport interface SourceProps extends HTMLStyledProps<\"source\"> {\n /**\n * The media query for the source.\n */\n media?: AnyString | ThemeTokens[\"breakpoints\"]\n}\n\nexport const Source: FC<SourceProps> = ({ media, ...rest }) => {\n const { breakpoints, config } = useSystem()\n const { queriesObj } = breakpoints\n const { identifier = \"@media screen\" } = config.breakpoint ?? {}\n const searchValue =\n identifier === \"@media screen\" ? \"@media screen and \" : `${identifier} `\n\n const { query } = media ? (queriesObj[media] ?? {}) : {}\n\n if (query) media = query.replace(searchValue, \"\")\n\n return <styled.source media={media} {...rest} />\n}\n"],"mappings":";;;;;;;;;AASA,MAAM,eACJ,MACA,SACG;CACH,IAAI,QAAQ;CAEZ,IAAI,MAAM;EACR,QAAQ,eAAe,KAAK;EAE5B,IAAI,MAAM,SAAS,oBAAoB,KAAK;CAC9C,OACE,QAAQ,eAAe,KAAK;CAG9B,OAAO;AACT;;;;;;AA2CA,MAAa,WAA6B,EACxC,UACA,gBAAgB,MAChB,SAAS,cAAc,CAAC,GACxB,cACA,GAAG,WACC;CACJ,MAAM,SAASA,wBAAAA,UAAU;CACzB,MAAM,EAAE,eAAe,OAAO;CAC9B,MAAM,EAAE,YAAY,QAAQ,aAAa,oBACvC,OAAO,OAAO,cAAc,CAAC;CAC/B,MAAM,cACJ,eAAe,kBAAkB,uBAAuB,GAAG,WAAW;CAExE,MAAM,kBAAA,GAAiBC,MAAAA,YAAAA,EACpB,GAAkB,MAAqB;EACtC,MAAM,IAAI,cAAc,SAAS,SAAS;EAE1C,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kBAAA,IAAA,CAACE,gBAAAA,OAAO,QAAR,EAA2B,GAAI,KAAO,GAAlB,KAAkB,CACvC,GACH,CAAC,OAAO,CACV;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,gBAAAA,OAAO,SAAR;EAAgB,GAAI;EACjB,UAAA,YACC,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACG,gBAED,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,OAAD,EAAO,GAAI,KAAO,CAAA,CAClB,EAAA,CAAA;CAEU,CAAA;AAEpB;AASA,MAAa,UAA2B,EAAE,OAAO,GAAG,WAAW;CAC7D,MAAM,EAAE,aAAa,WAAWL,wBAAAA,UAAU;CAC1C,MAAM,EAAE,eAAe;CACvB,MAAM,EAAE,aAAa,oBAAoB,OAAO,cAAc,CAAC;CAC/D,MAAM,cACJ,eAAe,kBAAkB,uBAAuB,GAAG,WAAW;CAExE,MAAM,EAAE,UAAU,QAAS,WAAW,UAAU,CAAC,IAAK,CAAC;CAEvD,IAAI,OAAO,QAAQ,MAAM,QAAQ,aAAa,EAAE;CAEhD,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACI,gBAAAA,OAAO,QAAR;EAAsB;EAAO,GAAI;CAAO,CAAA;AACjD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
3
|
const require_children = require("../../utils/children.cjs");
|
|
3
4
|
const require_ref = require("../../utils/ref.cjs");
|
|
4
5
|
const require_create_component = require("../../core/components/create-component.cjs");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pin-input.cjs","names":["createSlotComponent","pinInputStyle","usePinInput","getValidChildren","PinInputDescendantsContext","Group","Input","usePinInputDescendant","useFieldProps","mergeRefs"],"sources":["../../../../src/components/pin-input/pin-input.tsx"],"sourcesContent":["\"use client\"\n\nimport type {\n RequiredPropGetter,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { GroupProps } from \"../group\"\nimport type { InputProps, UseInputBorderProps } from \"../input\"\nimport type { PinInputStyle } from \"./pin-input.style\"\nimport type { UsePinInputProps } from \"./use-pin-input\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent } from \"../../core\"\nimport { getValidChildren, mergeRefs } from \"../../utils\"\nimport { useFieldProps } from \"../field\"\nimport { Group } from \"../group\"\nimport { Input } from \"../input\"\nimport { pinInputStyle } from \"./pin-input.style\"\nimport {\n PinInputDescendantsContext,\n usePinInput,\n usePinInputDescendant,\n} from \"./use-pin-input\"\n\ninterface ComponentContext extends UseInputBorderProps {\n getInputProps: RequiredPropGetter<\"input\", { index: number }>\n}\n\nexport interface PinInputRootProps\n extends\n Omit<\n WithoutThemeProps<GroupProps, PinInputStyle>,\n \"defaultValue\" | \"mask\" | \"onChange\"\n >,\n ThemeProps<PinInputStyle>,\n UseInputBorderProps,\n UsePinInputProps {}\n\nconst {\n ComponentContext,\n PropsContext: PinInputPropsContext,\n useComponentContext,\n usePropsContext: usePinInputPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<PinInputRootProps, PinInputStyle, ComponentContext>(\n \"pin-input\",\n pinInputStyle,\n)\n\nexport { PinInputPropsContext, usePinInputPropsContext }\n\n/**\n * `PinInput` is a component used to capture pin codes or OTP (One-Time Password) inputs.\n *\n * @see https://yamada-ui.com/docs/components/pin-input\n */\nexport const PinInputRoot = withProvider<\"div\", PinInputRootProps>(\n ({ children, errorBorderColor, focusBorderColor, ...rest }) => {\n const { descendants, items, getInputProps, getRootProps } =\n usePinInput(rest)\n const cloneChildren = useMemo(() => {\n const validChildren = getValidChildren(children)\n\n if (validChildren.length) return validChildren\n else\n return Array.from({ length: items }, (_, index) => (\n <PinInputField key={index} index={index} />\n ))\n }, [children, items])\n const context = useMemo(\n () => ({ errorBorderColor, focusBorderColor, getInputProps }),\n [getInputProps, errorBorderColor, focusBorderColor],\n )\n\n return (\n <PinInputDescendantsContext value={descendants}>\n <ComponentContext value={context}>\n <Group {...getRootProps()}>{cloneChildren}</Group>\n </ComponentContext>\n </PinInputDescendantsContext>\n )\n },\n \"root\",\n)()\n\nexport interface PinInputFieldProps extends InputProps {\n /**\n * The index of the pin input field.\n */\n index: number\n}\n\nexport const PinInputField = withContext<\"input\", PinInputFieldProps>(\n Input,\n \"field\",\n)(undefined, ({ ref, index, ...rest }) => {\n const { errorBorderColor, focusBorderColor, getInputProps } =\n useComponentContext()\n const { register } = usePinInputDescendant()\n const { props, ariaProps, dataProps, eventProps } = useFieldProps(rest)\n\n return {\n ...getInputProps({\n errorBorderColor,\n focusBorderColor,\n ...ariaProps,\n ...dataProps,\n ...eventProps,\n ...props,\n ref: mergeRefs(register, ref),\n index,\n }),\n }\n})\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pin-input.cjs","names":["createSlotComponent","pinInputStyle","usePinInput","useMemo","getValidChildren","PinInputDescendantsContext","Group","Input","usePinInputDescendant","useFieldProps","mergeRefs"],"sources":["../../../../src/components/pin-input/pin-input.tsx"],"sourcesContent":["\"use client\"\n\nimport type {\n RequiredPropGetter,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { GroupProps } from \"../group\"\nimport type { InputProps, UseInputBorderProps } from \"../input\"\nimport type { PinInputStyle } from \"./pin-input.style\"\nimport type { UsePinInputProps } from \"./use-pin-input\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent } from \"../../core\"\nimport { getValidChildren, mergeRefs } from \"../../utils\"\nimport { useFieldProps } from \"../field\"\nimport { Group } from \"../group\"\nimport { Input } from \"../input\"\nimport { pinInputStyle } from \"./pin-input.style\"\nimport {\n PinInputDescendantsContext,\n usePinInput,\n usePinInputDescendant,\n} from \"./use-pin-input\"\n\ninterface ComponentContext extends UseInputBorderProps {\n getInputProps: RequiredPropGetter<\"input\", { index: number }>\n}\n\nexport interface PinInputRootProps\n extends\n Omit<\n WithoutThemeProps<GroupProps, PinInputStyle>,\n \"defaultValue\" | \"mask\" | \"onChange\"\n >,\n ThemeProps<PinInputStyle>,\n UseInputBorderProps,\n UsePinInputProps {}\n\nconst {\n ComponentContext,\n PropsContext: PinInputPropsContext,\n useComponentContext,\n usePropsContext: usePinInputPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<PinInputRootProps, PinInputStyle, ComponentContext>(\n \"pin-input\",\n pinInputStyle,\n)\n\nexport { PinInputPropsContext, usePinInputPropsContext }\n\n/**\n * `PinInput` is a component used to capture pin codes or OTP (One-Time Password) inputs.\n *\n * @see https://yamada-ui.com/docs/components/pin-input\n */\nexport const PinInputRoot = withProvider<\"div\", PinInputRootProps>(\n ({ children, errorBorderColor, focusBorderColor, ...rest }) => {\n const { descendants, items, getInputProps, getRootProps } =\n usePinInput(rest)\n const cloneChildren = useMemo(() => {\n const validChildren = getValidChildren(children)\n\n if (validChildren.length) return validChildren\n else\n return Array.from({ length: items }, (_, index) => (\n <PinInputField key={index} index={index} />\n ))\n }, [children, items])\n const context = useMemo(\n () => ({ errorBorderColor, focusBorderColor, getInputProps }),\n [getInputProps, errorBorderColor, focusBorderColor],\n )\n\n return (\n <PinInputDescendantsContext value={descendants}>\n <ComponentContext value={context}>\n <Group {...getRootProps()}>{cloneChildren}</Group>\n </ComponentContext>\n </PinInputDescendantsContext>\n )\n },\n \"root\",\n)()\n\nexport interface PinInputFieldProps extends InputProps {\n /**\n * The index of the pin input field.\n */\n index: number\n}\n\nexport const PinInputField = withContext<\"input\", PinInputFieldProps>(\n Input,\n \"field\",\n)(undefined, ({ ref, index, ...rest }) => {\n const { errorBorderColor, focusBorderColor, getInputProps } =\n useComponentContext()\n const { register } = usePinInputDescendant()\n const { props, ariaProps, dataProps, eventProps } = useFieldProps(rest)\n\n return {\n ...getInputProps({\n errorBorderColor,\n focusBorderColor,\n ...ariaProps,\n ...dataProps,\n ...eventProps,\n ...props,\n ref: mergeRefs(register, ref),\n index,\n }),\n }\n})\n"],"mappings":";;;;;;;;;;;;;AA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ACA;EACA,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,KAAKC,YAAAA,UAAU,UAAU,GAAG;EAC5B;CACF,CAAC,EACH;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-pin-input.cjs","names":["createDescendants","useFieldProps","useControllableState","mergeProps"],"sources":["../../../../src/components/pin-input/use-pin-input.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent, KeyboardEvent } from \"react\"\nimport type { HTMLProps, PropGetter, RequiredPropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport { cx, filterUndefined, handlerAll, runKeyAction } from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nconst {\n DescendantsContext: PinInputDescendantsContext,\n useDescendant: usePinInputDescendant,\n useDescendants: usePinInputDescendants,\n} = createDescendants<HTMLInputElement>()\n\nexport {\n PinInputDescendantsContext,\n usePinInputDescendant,\n usePinInputDescendants,\n}\n\nconst toArray = (value?: string) => value?.split(\"\")\n\nconst validate = (value: string, type: UsePinInputProps[\"type\"]) => {\n const NUMERIC_REGEX = /^[0-9]+$/\n const ALPHA_NUMERIC_REGEX = /^[a-zA-Z0-9]+$/i\n\n const regex = type === \"alphanumeric\" ? ALPHA_NUMERIC_REGEX : NUMERIC_REGEX\n\n return regex.test(value)\n}\n\nexport interface UsePinInputProps\n extends\n Omit<HTMLProps, \"defaultValue\" | \"mask\" | \"onChange\" | \"value\">,\n FieldProps {\n /**\n * If `true`, the pin input receives focus on mount.\n *\n * @default false\n */\n autoFocus?: boolean\n /**\n * The initial value of the pin input.\n */\n defaultValue?: string\n /**\n * The top-level id string that will be applied to the input fields.\n * The index of the input will be appended to this top-level id.\n */\n id?: string\n /**\n * The number of inputs to display.\n *\n * @default 4\n */\n items?: number\n /**\n * If `true`, focus will move automatically to the next input once filled.\n *\n * @default true\n */\n manageFocus?: boolean\n /**\n * If `true`, the input's value will be masked just like `type=password`.\n */\n mask?: boolean\n /**\n * If `true`, the pin input component signals to its fields that they should.\n */\n otp?: boolean\n /**\n * The placeholder for the pin input.\n *\n * @default '◯'\n */\n placeholder?: string\n /**\n * The type of values the pin-input should allow.\n *\n * @default 'number'\n */\n type?: \"alphanumeric\" | \"number\"\n /**\n * The value of the pin input.\n */\n value?: string\n /**\n * Function called on input change.\n */\n onChange?: (value: string) => void\n /**\n * Function called when all inputs have valid values.\n */\n onComplete?: (value: string) => void\n}\n\nexport const usePinInput = (props: UsePinInputProps = {}) => {\n const uuid = useId()\n const {\n context: { labelId } = {},\n props: {\n id = uuid,\n type = \"number\",\n autoFocus,\n defaultValue,\n disabled,\n items = 4,\n manageFocus = true,\n mask,\n otp = false,\n placeholder = \"◯\",\n readOnly,\n value,\n onChange: onChangeProp,\n onComplete,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const descendants = usePinInputDescendants()\n const [moveFocus, setMoveFocus] = useState<boolean>(true)\n const [focusedIndex, setFocusedIndex] = useState<number>(-1)\n const [values, setValues] = useControllableState<string[]>({\n defaultValue: toArray(defaultValue) || [],\n value: toArray(value),\n onChange: (values) => onChangeProp?.(values.join(\"\")),\n })\n\n const focusNext = useCallback(\n (index: number) => {\n if (!moveFocus || !manageFocus) return\n\n const next = descendants.nextValue(index, false)\n\n if (!next) return\n\n requestAnimationFrame(() => next.node.focus())\n },\n [descendants, moveFocus, manageFocus],\n )\n\n const focusInputField = useCallback(\n (direction: \"next\" | \"prev\", index: number) => {\n const input =\n direction === \"next\"\n ? descendants.nextValue(index, false)\n : descendants.prevValue(index, false)\n\n if (!input) return\n\n const valueLength = input.node.value.length\n\n requestAnimationFrame(() => {\n input.node.focus()\n input.node.setSelectionRange(0, valueLength)\n })\n },\n [descendants],\n )\n\n const setValue = useCallback(\n (value: string, index: number, focus = true) => {\n let nextValues = [...values]\n\n nextValues[index] = value\n\n setValues(nextValues)\n\n nextValues = nextValues.filter(Boolean)\n\n const complete = value !== \"\" && nextValues.length === descendants.count()\n\n if (complete) {\n onComplete?.(nextValues.join(\"\"))\n descendants.value(index)?.node.blur()\n } else if (focus) {\n focusNext(index)\n }\n },\n [values, setValues, descendants, onComplete, focusNext],\n )\n\n const getNextValue = useCallback(\n (value: string | undefined, eventValue: string) => {\n let nextValue = eventValue\n\n if (!value?.length) return nextValue\n\n if (value.startsWith(eventValue.charAt(0)))\n nextValue = eventValue.charAt(1)\n else if (value.startsWith(eventValue.charAt(1)))\n nextValue = eventValue.charAt(0)\n\n return nextValue\n },\n [],\n )\n\n const onChange = useCallback(\n (index: number) =>\n ({ target }: ChangeEvent<HTMLInputElement>) => {\n const eventValue = target.value\n const currentValue = values[index]\n const nextValue = getNextValue(currentValue, eventValue)\n\n if (nextValue === \"\") {\n setValue(\"\", index)\n\n return\n }\n\n if (eventValue.length > 2) {\n if (!validate(eventValue, type)) return\n\n const nextValue = eventValue\n .split(\"\")\n .filter((_, index) => index < descendants.count())\n\n setValues(nextValue)\n\n if (nextValue.length === descendants.count()) {\n onComplete?.(nextValue.join(\"\"))\n descendants.value(index)?.node.blur()\n }\n } else {\n if (validate(nextValue, type)) setValue(nextValue, index)\n\n setMoveFocus(true)\n }\n },\n [descendants, getNextValue, onComplete, setValue, setValues, type, values],\n )\n\n const onKeyDown = useCallback(\n (index: number) => (ev: KeyboardEvent<HTMLInputElement>) => {\n if (!manageFocus) return\n\n runKeyAction(\n ev,\n {\n ArrowLeft: (ev) => {\n ev.preventDefault()\n focusInputField(\"prev\", index)\n },\n ArrowRight: (ev) => {\n ev.preventDefault()\n focusInputField(\"next\", index)\n },\n Backspace: (ev) => {\n if ((ev.target as HTMLInputElement).value === \"\") {\n const prevInput = descendants.prevValue(index, false)\n\n if (!prevInput) return\n\n setValue(\"\", index - 1, false)\n prevInput.node.focus()\n setMoveFocus(true)\n } else {\n setMoveFocus(false)\n }\n },\n },\n { preventDefault: false },\n )\n },\n [descendants, focusInputField, manageFocus, setValue],\n )\n\n const onFocus = useCallback(\n (index: number) => () => setFocusedIndex(index),\n [],\n )\n\n const onBlur = useCallback(() => setFocusedIndex(-1), [])\n\n useEffect(() => {\n if (!autoFocus) return\n\n const firstValue = descendants.firstValue()\n\n if (!firstValue) return\n\n requestAnimationFrame(() => firstValue.node.focus())\n }, [autoFocus, descendants])\n\n const getRootProps: PropGetter = useCallback(\n (props) => mergeProps({ role: \"group\" }, rest, props)(),\n [rest],\n )\n\n const getInputProps: RequiredPropGetter<\"input\", { index: number }> =\n useCallback(\n ({ \"aria-labelledby\": ariaLabelledby, index, ...props }) => ({\n ...ariaProps,\n ...dataProps,\n type: mask ? \"password\" : type === \"number\" ? \"tel\" : \"text\",\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n autoComplete: otp ? \"one-time-code\" : \"off\",\n disabled,\n inputMode: type === \"number\" ? \"numeric\" : \"text\",\n placeholder:\n focusedIndex === index && !readOnly && !props.readOnly\n ? \"\"\n : placeholder,\n readOnly,\n value: values[index] || \"\",\n ...filterUndefined(props),\n id: `${id}${index ? `-${index}` : \"\"}`,\n onBlur: handlerAll(eventProps.onBlur, props.onBlur, onBlur),\n onChange: handlerAll(props.onChange, onChange(index)),\n onFocus: handlerAll(eventProps.onFocus, props.onFocus, onFocus(index)),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown(index)),\n }),\n [\n ariaProps,\n dataProps,\n eventProps,\n mask,\n type,\n labelId,\n otp,\n disabled,\n focusedIndex,\n readOnly,\n placeholder,\n values,\n id,\n onBlur,\n onChange,\n onFocus,\n onKeyDown,\n ],\n )\n\n return {\n descendants,\n items,\n getInputProps,\n getRootProps,\n }\n}\n\nexport type UsePinInputReturn = ReturnType<typeof usePinInput>\n"],"mappings":";;;;;;;;;AAYA,MAAM,EACJ,oBAAoB,4BACpB,eAAe,uBACf,gBAAgB,2BACdA,oCAAA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,EAAE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,CAAC,GACtD,CAAC,IAAI,CACP;CA8CA,OAAO;EACL;EACA;EACA,gBAAA,GAAA,MAAA,YAAA,EA7CG,EAAE,mBAAmB,gBAAgB,OAAO,GAAG,aAAa;GAC3D,GAAG;GACH,GAAG;GACH,MAAM,OAAO,aAAa,SAAS,WAAW,QAAQ;GACtD,oBAAA,GAAA,oBAAA,cAAA,GAAA,CAAsB,gBAAgB,OAAO;GAC7C,cAAc,MAAM,kBAAkB;GACtC;GACA,WAAW,SAAS,WAAW,YAAY;GAC3C,aACE,iBAAiB,SAAS,CAAC,YAAY,CAAC,MAAM,WAC1C,KACA;GACN;GACA,OAAO,OAAO,UAAU;GACxB,IAAA,GAAA,oBAAA,cAAA,gBAAA,CAAmB,KAAK;GACxB,IAAI,GAAG,KAAK,QAAQ,IAAI,UAAU;GAClC,SAAA,GAAA,oBAAA,cAAA,WAAA,CAAmB,WAAW,QAAQ,MAAM,QAAQ,MAAM;GAC1D,WAAA,GAAA,oBAAA,cAAA,WAAA,CAAqB,MAAM,UAAU,SAAS,KAAK,CAAC;GACpD,UAAA,GAAA,oBAAA,cAAA,WAAA,CAAoB,WAAW,SAAS,MAAM,SAAS,QAAQ,KAAK,CAAC;GACrE,YAAA,GAAA,oBAAA,cAAA,WAAA,CAAsB,MAAM,WAAW,UAAU,KAAK,CAAC;EACzD,IACA;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAMU;EACZ;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"use-pin-input.cjs","names":["createDescendants","useId","useFieldProps","useState","useControllableState","useCallback","mergeProps"],"sources":["../../../../src/components/pin-input/use-pin-input.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent, KeyboardEvent } from \"react\"\nimport type { HTMLProps, PropGetter, RequiredPropGetter } from \"../../core\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport { cx, filterUndefined, handlerAll, runKeyAction } from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\nconst {\n DescendantsContext: PinInputDescendantsContext,\n useDescendant: usePinInputDescendant,\n useDescendants: usePinInputDescendants,\n} = createDescendants<HTMLInputElement>()\n\nexport {\n PinInputDescendantsContext,\n usePinInputDescendant,\n usePinInputDescendants,\n}\n\nconst toArray = (value?: string) => value?.split(\"\")\n\nconst validate = (value: string, type: UsePinInputProps[\"type\"]) => {\n const NUMERIC_REGEX = /^[0-9]+$/\n const ALPHA_NUMERIC_REGEX = /^[a-zA-Z0-9]+$/i\n\n const regex = type === \"alphanumeric\" ? ALPHA_NUMERIC_REGEX : NUMERIC_REGEX\n\n return regex.test(value)\n}\n\nexport interface UsePinInputProps\n extends\n Omit<HTMLProps, \"defaultValue\" | \"mask\" | \"onChange\" | \"value\">,\n FieldProps {\n /**\n * If `true`, the pin input receives focus on mount.\n *\n * @default false\n */\n autoFocus?: boolean\n /**\n * The initial value of the pin input.\n */\n defaultValue?: string\n /**\n * The top-level id string that will be applied to the input fields.\n * The index of the input will be appended to this top-level id.\n */\n id?: string\n /**\n * The number of inputs to display.\n *\n * @default 4\n */\n items?: number\n /**\n * If `true`, focus will move automatically to the next input once filled.\n *\n * @default true\n */\n manageFocus?: boolean\n /**\n * If `true`, the input's value will be masked just like `type=password`.\n */\n mask?: boolean\n /**\n * If `true`, the pin input component signals to its fields that they should.\n */\n otp?: boolean\n /**\n * The placeholder for the pin input.\n *\n * @default '◯'\n */\n placeholder?: string\n /**\n * The type of values the pin-input should allow.\n *\n * @default 'number'\n */\n type?: \"alphanumeric\" | \"number\"\n /**\n * The value of the pin input.\n */\n value?: string\n /**\n * Function called on input change.\n */\n onChange?: (value: string) => void\n /**\n * Function called when all inputs have valid values.\n */\n onComplete?: (value: string) => void\n}\n\nexport const usePinInput = (props: UsePinInputProps = {}) => {\n const uuid = useId()\n const {\n context: { labelId } = {},\n props: {\n id = uuid,\n type = \"number\",\n autoFocus,\n defaultValue,\n disabled,\n items = 4,\n manageFocus = true,\n mask,\n otp = false,\n placeholder = \"◯\",\n readOnly,\n value,\n onChange: onChangeProp,\n onComplete,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const descendants = usePinInputDescendants()\n const [moveFocus, setMoveFocus] = useState<boolean>(true)\n const [focusedIndex, setFocusedIndex] = useState<number>(-1)\n const [values, setValues] = useControllableState<string[]>({\n defaultValue: toArray(defaultValue) || [],\n value: toArray(value),\n onChange: (values) => onChangeProp?.(values.join(\"\")),\n })\n\n const focusNext = useCallback(\n (index: number) => {\n if (!moveFocus || !manageFocus) return\n\n const next = descendants.nextValue(index, false)\n\n if (!next) return\n\n requestAnimationFrame(() => next.node.focus())\n },\n [descendants, moveFocus, manageFocus],\n )\n\n const focusInputField = useCallback(\n (direction: \"next\" | \"prev\", index: number) => {\n const input =\n direction === \"next\"\n ? descendants.nextValue(index, false)\n : descendants.prevValue(index, false)\n\n if (!input) return\n\n const valueLength = input.node.value.length\n\n requestAnimationFrame(() => {\n input.node.focus()\n input.node.setSelectionRange(0, valueLength)\n })\n },\n [descendants],\n )\n\n const setValue = useCallback(\n (value: string, index: number, focus = true) => {\n let nextValues = [...values]\n\n nextValues[index] = value\n\n setValues(nextValues)\n\n nextValues = nextValues.filter(Boolean)\n\n const complete = value !== \"\" && nextValues.length === descendants.count()\n\n if (complete) {\n onComplete?.(nextValues.join(\"\"))\n descendants.value(index)?.node.blur()\n } else if (focus) {\n focusNext(index)\n }\n },\n [values, setValues, descendants, onComplete, focusNext],\n )\n\n const getNextValue = useCallback(\n (value: string | undefined, eventValue: string) => {\n let nextValue = eventValue\n\n if (!value?.length) return nextValue\n\n if (value.startsWith(eventValue.charAt(0)))\n nextValue = eventValue.charAt(1)\n else if (value.startsWith(eventValue.charAt(1)))\n nextValue = eventValue.charAt(0)\n\n return nextValue\n },\n [],\n )\n\n const onChange = useCallback(\n (index: number) =>\n ({ target }: ChangeEvent<HTMLInputElement>) => {\n const eventValue = target.value\n const currentValue = values[index]\n const nextValue = getNextValue(currentValue, eventValue)\n\n if (nextValue === \"\") {\n setValue(\"\", index)\n\n return\n }\n\n if (eventValue.length > 2) {\n if (!validate(eventValue, type)) return\n\n const nextValue = eventValue\n .split(\"\")\n .filter((_, index) => index < descendants.count())\n\n setValues(nextValue)\n\n if (nextValue.length === descendants.count()) {\n onComplete?.(nextValue.join(\"\"))\n descendants.value(index)?.node.blur()\n }\n } else {\n if (validate(nextValue, type)) setValue(nextValue, index)\n\n setMoveFocus(true)\n }\n },\n [descendants, getNextValue, onComplete, setValue, setValues, type, values],\n )\n\n const onKeyDown = useCallback(\n (index: number) => (ev: KeyboardEvent<HTMLInputElement>) => {\n if (!manageFocus) return\n\n runKeyAction(\n ev,\n {\n ArrowLeft: (ev) => {\n ev.preventDefault()\n focusInputField(\"prev\", index)\n },\n ArrowRight: (ev) => {\n ev.preventDefault()\n focusInputField(\"next\", index)\n },\n Backspace: (ev) => {\n if ((ev.target as HTMLInputElement).value === \"\") {\n const prevInput = descendants.prevValue(index, false)\n\n if (!prevInput) return\n\n setValue(\"\", index - 1, false)\n prevInput.node.focus()\n setMoveFocus(true)\n } else {\n setMoveFocus(false)\n }\n },\n },\n { preventDefault: false },\n )\n },\n [descendants, focusInputField, manageFocus, setValue],\n )\n\n const onFocus = useCallback(\n (index: number) => () => setFocusedIndex(index),\n [],\n )\n\n const onBlur = useCallback(() => setFocusedIndex(-1), [])\n\n useEffect(() => {\n if (!autoFocus) return\n\n const firstValue = descendants.firstValue()\n\n if (!firstValue) return\n\n requestAnimationFrame(() => firstValue.node.focus())\n }, [autoFocus, descendants])\n\n const getRootProps: PropGetter = useCallback(\n (props) => mergeProps({ role: \"group\" }, rest, props)(),\n [rest],\n )\n\n const getInputProps: RequiredPropGetter<\"input\", { index: number }> =\n useCallback(\n ({ \"aria-labelledby\": ariaLabelledby, index, ...props }) => ({\n ...ariaProps,\n ...dataProps,\n type: mask ? \"password\" : type === \"number\" ? \"tel\" : \"text\",\n \"aria-labelledby\": cx(ariaLabelledby, labelId),\n autoComplete: otp ? \"one-time-code\" : \"off\",\n disabled,\n inputMode: type === \"number\" ? \"numeric\" : \"text\",\n placeholder:\n focusedIndex === index && !readOnly && !props.readOnly\n ? \"\"\n : placeholder,\n readOnly,\n value: values[index] || \"\",\n ...filterUndefined(props),\n id: `${id}${index ? `-${index}` : \"\"}`,\n onBlur: handlerAll(eventProps.onBlur, props.onBlur, onBlur),\n onChange: handlerAll(props.onChange, onChange(index)),\n onFocus: handlerAll(eventProps.onFocus, props.onFocus, onFocus(index)),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown(index)),\n }),\n [\n ariaProps,\n dataProps,\n eventProps,\n mask,\n type,\n labelId,\n otp,\n disabled,\n focusedIndex,\n readOnly,\n placeholder,\n values,\n id,\n onBlur,\n onChange,\n onFocus,\n onKeyDown,\n ],\n )\n\n return {\n descendants,\n items,\n getInputProps,\n getRootProps,\n }\n}\n\nexport type UsePinInputReturn = ReturnType<typeof usePinInput>\n"],"mappings":";;;;;;;;;;AAYA,MAAM,EACJ,oBAAoB,4BACpB,eAAe,uBACf,gBAAgB,2BACdA,oCAAAA,kBAAoC;AAQxC,MAAM,WAAW,UAAmB,OAAO,MAAM,EAAE;AAEnD,MAAM,YAAY,OAAe,SAAmC;CAMlE,QAFc,SAAS,iBAAiB,oBAAsB,WAAA,CAEjD,KAAK,KAAK;AACzB;AAmEA,MAAa,eAAe,QAA0B,CAAC,MAAM;CAC3D,MAAM,QAAA,GAAOC,MAAAA,MAAAA,CAAM;CACnB,MAAM,EACJ,SAAS,EAAE,YAAY,CAAC,GACxB,OAAO,EACL,KAAK,MACL,OAAO,UACP,WACA,cACA,UACA,QAAQ,GACR,cAAc,MACd,MACA,MAAM,OACN,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kBAAkB;GACtC;GACA,WAAW,SAAS,WAAW,YAAY;GAC3C,aACE,iBAAiB,SAAS,CAAC,YAAY,CAAC,MAAM,WAC1C,KACA;GACN;GACA,OAAO,OAAO,UAAU;GACxB,IAAA,GAAA,oBAAA,cAAG,gBAAA,CAAgB,KAAK;GACxB,IAAI,GAAG,KAAK,QAAQ,IAAI,UAAU;GAClC,SAAA,GAAA,oBAAA,cAAQ,WAAA,CAAW,WAAW,QAAQ,MAAM,QAAQ,MAAM;GAC1D,WAAA,GAAA,oBAAA,cAAU,WAAA,CAAW,MAAM,UAAU,SAAS,KAAK,CAAC;GACpD,UAAA,GAAA,oBAAA,cAAS,WAAA,CAAW,WAAW,SAAS,MAAM,SAAS,QAAQ,KAAK,CAAC;GACrE,YAAA,GAAA,oBAAA,cAAW,WAAA,CAAW,MAAM,WAAW,UAAU,KAAK,CAAC;EACzD,IACA;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAMU;EACZ;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.cjs","names":["useValue","fadeScaleVariants","slideFadeVariants","createSlotComponent","popoverStyle","useSplitChildren","usePopover","mergeProps","AnimatePresence","Portal","motion","wrapOrPassProps"],"sources":["../../../../src/components/popover/popover.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, ReactNode } from \"react\"\nimport type {\n HTMLProps,\n HTMLStyledProps,\n SimplePlacement,\n StyleValue,\n ThemeProps,\n} from \"../../core\"\nimport type { Merge, ReactNodeOrFunction } from \"../../utils\"\nimport type { HTMLMotionProps, MotionTransitionProps } from \"../motion\"\nimport type { PortalProps } from \"../portal\"\nimport type { PopoverStyle } from \"./popover.style\"\nimport type { UsePopoverProps, UsePopoverReturn } from \"./use-popover\"\nimport { AnimatePresence } from \"motion/react\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, mergeProps } from \"../../core\"\nimport { useValue } from \"../../hooks/use-value\"\nimport {\n cast,\n filterUndefined,\n isFunction,\n runIfFn,\n useSplitChildren,\n wrapOrPassProps,\n} from \"../../utils\"\nimport { fadeScaleVariants } from \"../fade-scale\"\nimport { motion } from \"../motion\"\nimport { Portal } from \"../portal\"\nimport { slideFadeVariants } from \"../slide-fade\"\nimport { popoverStyle } from \"./popover.style\"\nimport { usePopover } from \"./use-popover\"\n\nexport interface UsePopupAnimationProps {\n /**\n * The animation of the element.\n *\n * @default 'scale'\n */\n animationScheme?: StyleValue<\"none\" | \"scale\" | SimplePlacement>\n /**\n * The animation duration.\n *\n * @default 0.1\n */\n duration?: StyleValue<MotionTransitionProps[\"duration\"]>\n}\n\nexport const usePopupAnimationProps = (props: UsePopupAnimationProps = {}) => {\n const animationScheme = useValue(props.animationScheme ?? \"scale\")\n const duration = useValue(props.duration ?? 0.1)\n const sharedProps = { animate: \"enter\", exit: \"exit\", initial: \"exit\" }\n\n switch (animationScheme) {\n case \"scale\":\n return {\n ...sharedProps,\n custom: { duration, reverse: true, scale: 0.95 },\n variants: fadeScaleVariants,\n }\n case \"block-start\":\n return {\n ...sharedProps,\n custom: { duration, offsetY: -16, reverse: true },\n variants: slideFadeVariants,\n }\n case \"inline-end\":\n return {\n ...sharedProps,\n custom: { duration, offsetX: 16, reverse: true },\n variants: slideFadeVariants,\n }\n case \"inline-start\":\n return {\n ...sharedProps,\n custom: { duration, offsetX: -16, reverse: true },\n variants: slideFadeVariants,\n }\n case \"block-end\":\n return {\n ...sharedProps,\n custom: { duration, offsetY: 16, reverse: true },\n variants: slideFadeVariants,\n }\n default:\n return {}\n }\n}\n\nexport interface UsePopoverStyleProps {\n /**\n * If `true`, the popper will change its placement and flip when it's about to overflow its boundary area.\n *\n * @default true\n */\n flip?: StyleValue<UsePopoverProps[\"flip\"]>\n /**\n * The distance or margin between the reference and popper.\n * It is used internally to create an `offset` modifier.\n *\n * @default 8\n */\n gutter?: StyleValue<UsePopoverProps[\"gutter\"]>\n /**\n * If `true`, the popper will match the width of the reference at all times.\n * It's useful for `autocomplete`, `date-picker` and `select` patterns.\n *\n * @default false\n */\n matchWidth?: StyleValue<UsePopoverProps[\"matchWidth\"]>\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end'\n */\n placement?: StyleValue<UsePopoverProps[\"placement\"]>\n /**\n * The CSS positioning strategy to use.\n *\n * @default 'absolute'\n */\n strategy?: StyleValue<UsePopoverProps[\"strategy\"]>\n}\n\nexport const usePopoverStyleProps = (props: UsePopoverStyleProps = {}) => {\n const placement = useValue(props.placement)\n const gutter = useValue(props.gutter)\n const matchWidth = useValue(props.matchWidth)\n const strategy = useValue(props.strategy)\n const flip = useValue(props.flip)\n\n return useMemo(\n () => filterUndefined({ flip, gutter, matchWidth, placement, strategy }),\n [flip, gutter, matchWidth, placement, strategy],\n )\n}\n\ninterface ComponentContext\n extends\n Pick<\n UsePopoverReturn,\n | \"getAnchorProps\"\n | \"getBodyProps\"\n | \"getCloseTriggerProps\"\n | \"getContentProps\"\n | \"getFooterProps\"\n | \"getHeaderProps\"\n | \"getPositionerProps\"\n | \"getTriggerProps\"\n | \"open\"\n >,\n UsePopupAnimationProps,\n Pick<\n PopoverRootProps,\n | \"anchorProps\"\n | \"bodyProps\"\n | \"closeTriggerProps\"\n | \"contentProps\"\n | \"footerProps\"\n | \"headerProps\"\n | \"triggerProps\"\n > {}\n\nexport interface PopoverRootProps\n extends\n Merge<UsePopoverProps, UsePopoverStyleProps>,\n UsePopupAnimationProps,\n ThemeProps<PopoverStyle>,\n ShorthandPopoverContentProps {\n /**\n * The popover anchor to use.\n */\n anchor?: ReactNode\n /**\n * The children of the popover.\n */\n children?: ReactNodeOrFunction<{\n open: boolean\n onClose: () => void\n }>\n /**\n * The popover trigger to use.\n */\n trigger?: ReactNode\n /**\n * Props for anchor element.\n */\n anchorProps?: Omit<PopoverAnchorProps, \"asChild\" | \"children\">\n /**\n * Props for body element.\n */\n bodyProps?: Omit<PopoverBodyProps, \"children\">\n /**\n * Props for close trigger element.\n */\n closeTriggerProps?: Omit<PopoverCloseTriggerProps, \"asChild\" | \"children\">\n /**\n * Props for content element.\n */\n contentProps?: Omit<PopoverContentProps, \"children\">\n /**\n * Props for footer element.\n */\n footerProps?: Omit<PopoverFooterProps, \"children\">\n /**\n * Props for header element.\n */\n headerProps?: Omit<PopoverHeaderProps, \"children\">\n /**\n * Props for trigger element.\n */\n triggerProps?: Omit<PopoverTriggerProps, \"asChild\" | \"children\">\n}\n\nconst {\n ComponentContext,\n PropsContext: PopoverPropsContext,\n StyleContext,\n useComponentContext,\n usePropsContext: usePopoverPropsContext,\n withContext,\n useRootComponentProps,\n} = createSlotComponent<PopoverRootProps, PopoverStyle, ComponentContext>(\n \"popover\",\n popoverStyle,\n)\n\nexport { PopoverPropsContext, usePopoverPropsContext }\n\n/**\n * `Popover` is a component that floats around an element to display information.\n *\n * @see https://yamada-ui.com/docs/components/popover\n */\nexport const PopoverRoot: FC<PopoverRootProps> = (props) => {\n const styleProps = usePopoverStyleProps(props)\n const [\n styleContext,\n {\n anchor: anchorProp,\n animationScheme,\n body,\n children,\n duration,\n footer,\n header,\n trigger: triggerProp,\n anchorProps,\n bodyProps,\n closeTriggerProps,\n contentProps,\n footerProps,\n headerProps,\n triggerProps,\n ...rest\n },\n ] = useRootComponentProps({ ...props, ...styleProps })\n const [omittedChildren, trigger, anchor, customContent] = useSplitChildren(\n isFunction(children) ? undefined : children,\n PopoverTrigger,\n PopoverAnchor,\n PopoverContent,\n )\n const {\n open,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n onClose,\n } = usePopover(rest)\n const componentContext = useMemo(\n () => ({\n animationScheme,\n duration,\n open,\n anchorProps,\n bodyProps,\n closeTriggerProps,\n contentProps,\n footerProps,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n headerProps,\n triggerProps,\n }),\n [\n open,\n animationScheme,\n anchorProps,\n bodyProps,\n closeTriggerProps,\n contentProps,\n duration,\n footerProps,\n headerProps,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n triggerProps,\n ],\n )\n const customAnchor = anchorProp ? (\n <PopoverAnchor>{anchorProp}</PopoverAnchor>\n ) : null\n const customTrigger = triggerProp ? (\n <PopoverTrigger>{triggerProp}</PopoverTrigger>\n ) : null\n const customContentProp =\n header !== undefined || body !== undefined || footer !== undefined ? (\n <ShorthandPopoverContent body={body} footer={footer} header={header} />\n ) : null\n\n return (\n <StyleContext value={styleContext}>\n <ComponentContext value={componentContext}>\n {isFunction(children) ? (\n runIfFn(children, { open, onClose })\n ) : (\n <>\n {anchor ?? customAnchor}\n {trigger ?? customTrigger}\n {omittedChildren}\n {customContent ?? customContentProp}\n </>\n )}\n </ComponentContext>\n </StyleContext>\n )\n}\n\nexport interface PopoverTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PopoverTrigger = withContext<\"button\", PopoverTriggerProps>(\n \"button\",\n \"trigger\",\n)({ asChild: true }, (props) => {\n const { getTriggerProps, triggerProps } = useComponentContext()\n\n return getTriggerProps(mergeProps(triggerProps, props)())\n})\n\nexport interface PopoverCloseTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PopoverCloseTrigger = withContext<\n \"button\",\n PopoverCloseTriggerProps\n>(\"button\", { name: \"CloseTrigger\", slot: [\"trigger\", \"close\"] })(\n { asChild: true },\n (props) => {\n const { closeTriggerProps, getCloseTriggerProps } = useComponentContext()\n\n return getCloseTriggerProps(mergeProps(closeTriggerProps, props)())\n },\n)\n\nexport interface PopoverAnchorProps extends HTMLStyledProps {}\n\nexport const PopoverAnchor = withContext<\"div\", PopoverAnchorProps>(\n \"div\",\n \"anchor\",\n)({ asChild: true }, (props) => {\n const { anchorProps, getAnchorProps } = useComponentContext()\n\n return getAnchorProps(mergeProps(anchorProps, props)())\n})\n\ninterface PopoverPositionerProps extends HTMLStyledProps {}\n\nconst PopoverPositioner = withContext<\"div\", PopoverPositionerProps>(\n \"div\",\n \"positioner\",\n)(undefined, (props) => {\n const { getPositionerProps } = useComponentContext()\n\n return getPositionerProps(props)\n})\n\nexport interface PopoverContentProps\n extends Omit<HTMLMotionProps, \"children\">, PropsWithChildren {\n /**\n * Props for portal component.\n */\n portalProps?: Omit<PortalProps, \"children\">\n /**\n * Props for positioner component.\n */\n positionerProps?: Omit<PopoverPositionerProps, \"children\">\n}\n\nexport const PopoverContent = withContext<\"div\", PopoverContentProps>(\n ({\n portalProps: portalPropsProp,\n positionerProps: positionerPropsProp,\n ...rest\n }) => {\n const {\n animationScheme,\n duration,\n open,\n contentProps: { portalProps, positionerProps, ...contentProps } = {},\n getContentProps,\n } = useComponentContext()\n const popupAnimationProps = usePopupAnimationProps({\n animationScheme,\n duration,\n })\n\n return (\n <AnimatePresence>\n {open ? (\n <Portal {...mergeProps(portalProps, portalPropsProp)()}>\n <PopoverPositioner\n {...mergeProps(positionerProps, positionerPropsProp)()}\n >\n <motion.div\n {...popupAnimationProps}\n {...cast<HTMLMotionProps>(\n getContentProps(\n cast<HTMLProps>(mergeProps(contentProps, rest)()),\n ),\n )}\n />\n </PopoverPositioner>\n </Portal>\n ) : null}\n </AnimatePresence>\n )\n },\n \"content\",\n)()\n\ninterface ShorthandPopoverContentProps {\n /**\n * The popover body to use.\n */\n body?: PopoverBodyProps | ReactNode\n /**\n * The popover footer to use.\n */\n footer?: PopoverFooterProps | ReactNode\n /**\n * The popover header to use.\n */\n header?: PopoverHeaderProps | ReactNode\n}\n\nconst ShorthandPopoverContent: FC<ShorthandPopoverContentProps> = ({\n body,\n footer,\n header,\n}) => {\n const customHeader = wrapOrPassProps(PopoverHeader, header)\n const customBody = wrapOrPassProps(PopoverBody, body)\n const customFooter = wrapOrPassProps(PopoverFooter, footer)\n\n return (\n <PopoverContent>\n {customHeader}\n {customBody}\n {customFooter}\n </PopoverContent>\n )\n}\n\nexport interface PopoverHeaderProps extends HTMLStyledProps {}\n\nexport const PopoverHeader = withContext<\"div\", PopoverHeaderProps>(\n \"div\",\n \"header\",\n)(undefined, (props) => {\n const { getHeaderProps, headerProps } = useComponentContext()\n\n return getHeaderProps(mergeProps(headerProps, props)())\n})\n\nexport interface PopoverBodyProps extends HTMLStyledProps {}\n\nexport const PopoverBody = withContext<\"div\", PopoverBodyProps>(\"div\", \"body\")(\n undefined,\n (props) => {\n const { bodyProps, getBodyProps } = useComponentContext()\n\n return getBodyProps(mergeProps(bodyProps, props)())\n },\n)\n\nexport interface PopoverFooterProps extends HTMLStyledProps {}\n\nexport const PopoverFooter = withContext<\"div\", PopoverFooterProps>(\n \"div\",\n \"footer\",\n)(undefined, (props) => {\n const { footerProps, getFooterProps } = useComponentContext()\n\n return getFooterProps(mergeProps(footerProps, props)())\n})\n"],"mappings":";;;;;;;;;;;;;;;;AAiDA,MAAa,0BAA0B,QAAgC,CAAC,MAAM;CAC5E,MAAM,kBAAkBA,8BAAAA,SAAS,MAAM,mBAAmB,OAAO;CACjE,MAAM,WAAWA,8BAAAA,SAAS,MAAM,YAAY,EAAG;CAC/C,MAAM,cAAc;EAAE,SAAS;EAAS,MAAM;EAAQ,SAAS;CAAO;CAEtE,QAAQ,iBAAR;EACE,KAAK,SACH,OAAO;GACL,GAAG;GACH,QAAQ;IAAE;IAAU,SAAS;IAAM,OAAO;GAAK;GAC/C,UAAUC,mBAAAA;EACZ;EACF,KAAK,eACH,OAAO;GACL,GAAG;GACH,QAAQ;IAAE;IAAU,SAAS;IAAK,SAAS;GAAK;GAChD,UAAUC,mBAAAA;EACZ;EACF,KAAK,cACH,OAAO;GACL,GAAG;GACH,QAAQ;IAAE;IAAU,SAAS;IAAI,SAAS;GAAK;GAC/C,UAAUA,mBAAAA;EACZ;EACF,KAAK,gBACH,OAAO;GACL,GAAG;GACH,QAA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AC,CAAC,CAClD,CACF;GACD,CAAA;EACgB,CAAA;CACb,CAAA,IACN,KACW,CAAA;AAErB,GACA,SACF,CAAC,CAAC;AAiBF,MAAM,2BAA6D,EACjE,MACA,QACA,aACI;CACJ,MAAM,eAAeI,iBAAAA,gBAAgB,eAAe,MAAM;CAC1D,MAAM,aAAaA,iBAAAA,gBAAgB,aAAa,IAAI;CACpD,MAAM,eAAeA,iBAAAA,gBAAgB,eAAe,MAAM;CAE1D,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,gBAAD,EAAA,UAAA;EACG;EACA;EACA;CACa,EAAA,CAAA;AAEpB;AAIA,MAAa,gBAAgB,YAC3B,OACA,QACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,gBAAgB,gBAAgB,oBAAoB;CAE5D,OAAO,eAAeJ,cAAAA,WAAW,aAAa,KAAK,CAAC,CAAC,CAAC;AACxD,CAAC;AAID,MAAa,cAAc,YAAqC,OAAO,MAAM,CAAC,CAC5E,KAAA,IACC,UAAU;CACT,MAAM,EAAE,WAAW,iBAAiB,oBAAoB;CAExD,OAAO,aAAaA,cAAAA,WAAW,WAAW,KAAK,CAAC,CAAC,CAAC;AACpD,CACF;AAIA,MAAa,gBAAgB,YAC3B,OACA,QACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,aAAa,mBAAmB,oBAAoB;CAE5D,OAAO,eAAeA,cAAAA,WAAW,aAAa,KAAK,CAAC,CAAC,CAAC;AACxD,CAAC"}
|
|
1
|
+
{"version":3,"file":"popover.cjs","names":["useValue","fadeScaleVariants","slideFadeVariants","useMemo","createSlotComponent","popoverStyle","useSplitChildren","usePopover","mergeProps","AnimatePresence","Portal","motion","wrapOrPassProps"],"sources":["../../../../src/components/popover/popover.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, ReactNode } from \"react\"\nimport type {\n HTMLProps,\n HTMLStyledProps,\n SimplePlacement,\n StyleValue,\n ThemeProps,\n} from \"../../core\"\nimport type { Merge, ReactNodeOrFunction } from \"../../utils\"\nimport type { HTMLMotionProps, MotionTransitionProps } from \"../motion\"\nimport type { PortalProps } from \"../portal\"\nimport type { PopoverStyle } from \"./popover.style\"\nimport type { UsePopoverProps, UsePopoverReturn } from \"./use-popover\"\nimport { AnimatePresence } from \"motion/react\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, mergeProps } from \"../../core\"\nimport { useValue } from \"../../hooks/use-value\"\nimport {\n cast,\n filterUndefined,\n isFunction,\n runIfFn,\n useSplitChildren,\n wrapOrPassProps,\n} from \"../../utils\"\nimport { fadeScaleVariants } from \"../fade-scale\"\nimport { motion } from \"../motion\"\nimport { Portal } from \"../portal\"\nimport { slideFadeVariants } from \"../slide-fade\"\nimport { popoverStyle } from \"./popover.style\"\nimport { usePopover } from \"./use-popover\"\n\nexport interface UsePopupAnimationProps {\n /**\n * The animation of the element.\n *\n * @default 'scale'\n */\n animationScheme?: StyleValue<\"none\" | \"scale\" | SimplePlacement>\n /**\n * The animation duration.\n *\n * @default 0.1\n */\n duration?: StyleValue<MotionTransitionProps[\"duration\"]>\n}\n\nexport const usePopupAnimationProps = (props: UsePopupAnimationProps = {}) => {\n const animationScheme = useValue(props.animationScheme ?? \"scale\")\n const duration = useValue(props.duration ?? 0.1)\n const sharedProps = { animate: \"enter\", exit: \"exit\", initial: \"exit\" }\n\n switch (animationScheme) {\n case \"scale\":\n return {\n ...sharedProps,\n custom: { duration, reverse: true, scale: 0.95 },\n variants: fadeScaleVariants,\n }\n case \"block-start\":\n return {\n ...sharedProps,\n custom: { duration, offsetY: -16, reverse: true },\n variants: slideFadeVariants,\n }\n case \"inline-end\":\n return {\n ...sharedProps,\n custom: { duration, offsetX: 16, reverse: true },\n variants: slideFadeVariants,\n }\n case \"inline-start\":\n return {\n ...sharedProps,\n custom: { duration, offsetX: -16, reverse: true },\n variants: slideFadeVariants,\n }\n case \"block-end\":\n return {\n ...sharedProps,\n custom: { duration, offsetY: 16, reverse: true },\n variants: slideFadeVariants,\n }\n default:\n return {}\n }\n}\n\nexport interface UsePopoverStyleProps {\n /**\n * If `true`, the popper will change its placement and flip when it's about to overflow its boundary area.\n *\n * @default true\n */\n flip?: StyleValue<UsePopoverProps[\"flip\"]>\n /**\n * The distance or margin between the reference and popper.\n * It is used internally to create an `offset` modifier.\n *\n * @default 8\n */\n gutter?: StyleValue<UsePopoverProps[\"gutter\"]>\n /**\n * If `true`, the popper will match the width of the reference at all times.\n * It's useful for `autocomplete`, `date-picker` and `select` patterns.\n *\n * @default false\n */\n matchWidth?: StyleValue<UsePopoverProps[\"matchWidth\"]>\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end'\n */\n placement?: StyleValue<UsePopoverProps[\"placement\"]>\n /**\n * The CSS positioning strategy to use.\n *\n * @default 'absolute'\n */\n strategy?: StyleValue<UsePopoverProps[\"strategy\"]>\n}\n\nexport const usePopoverStyleProps = (props: UsePopoverStyleProps = {}) => {\n const placement = useValue(props.placement)\n const gutter = useValue(props.gutter)\n const matchWidth = useValue(props.matchWidth)\n const strategy = useValue(props.strategy)\n const flip = useValue(props.flip)\n\n return useMemo(\n () => filterUndefined({ flip, gutter, matchWidth, placement, strategy }),\n [flip, gutter, matchWidth, placement, strategy],\n )\n}\n\ninterface ComponentContext\n extends\n Pick<\n UsePopoverReturn,\n | \"getAnchorProps\"\n | \"getBodyProps\"\n | \"getCloseTriggerProps\"\n | \"getContentProps\"\n | \"getFooterProps\"\n | \"getHeaderProps\"\n | \"getPositionerProps\"\n | \"getTriggerProps\"\n | \"open\"\n >,\n UsePopupAnimationProps,\n Pick<\n PopoverRootProps,\n | \"anchorProps\"\n | \"bodyProps\"\n | \"closeTriggerProps\"\n | \"contentProps\"\n | \"footerProps\"\n | \"headerProps\"\n | \"triggerProps\"\n > {}\n\nexport interface PopoverRootProps\n extends\n Merge<UsePopoverProps, UsePopoverStyleProps>,\n UsePopupAnimationProps,\n ThemeProps<PopoverStyle>,\n ShorthandPopoverContentProps {\n /**\n * The popover anchor to use.\n */\n anchor?: ReactNode\n /**\n * The children of the popover.\n */\n children?: ReactNodeOrFunction<{\n open: boolean\n onClose: () => void\n }>\n /**\n * The popover trigger to use.\n */\n trigger?: ReactNode\n /**\n * Props for anchor element.\n */\n anchorProps?: Omit<PopoverAnchorProps, \"asChild\" | \"children\">\n /**\n * Props for body element.\n */\n bodyProps?: Omit<PopoverBodyProps, \"children\">\n /**\n * Props for close trigger element.\n */\n closeTriggerProps?: Omit<PopoverCloseTriggerProps, \"asChild\" | \"children\">\n /**\n * Props for content element.\n */\n contentProps?: Omit<PopoverContentProps, \"children\">\n /**\n * Props for footer element.\n */\n footerProps?: Omit<PopoverFooterProps, \"children\">\n /**\n * Props for header element.\n */\n headerProps?: Omit<PopoverHeaderProps, \"children\">\n /**\n * Props for trigger element.\n */\n triggerProps?: Omit<PopoverTriggerProps, \"asChild\" | \"children\">\n}\n\nconst {\n ComponentContext,\n PropsContext: PopoverPropsContext,\n StyleContext,\n useComponentContext,\n usePropsContext: usePopoverPropsContext,\n withContext,\n useRootComponentProps,\n} = createSlotComponent<PopoverRootProps, PopoverStyle, ComponentContext>(\n \"popover\",\n popoverStyle,\n)\n\nexport { PopoverPropsContext, usePopoverPropsContext }\n\n/**\n * `Popover` is a component that floats around an element to display information.\n *\n * @see https://yamada-ui.com/docs/components/popover\n */\nexport const PopoverRoot: FC<PopoverRootProps> = (props) => {\n const styleProps = usePopoverStyleProps(props)\n const [\n styleContext,\n {\n anchor: anchorProp,\n animationScheme,\n body,\n children,\n duration,\n footer,\n header,\n trigger: triggerProp,\n anchorProps,\n bodyProps,\n closeTriggerProps,\n contentProps,\n footerProps,\n headerProps,\n triggerProps,\n ...rest\n },\n ] = useRootComponentProps({ ...props, ...styleProps })\n const [omittedChildren, trigger, anchor, customContent] = useSplitChildren(\n isFunction(children) ? undefined : children,\n PopoverTrigger,\n PopoverAnchor,\n PopoverContent,\n )\n const {\n open,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n onClose,\n } = usePopover(rest)\n const componentContext = useMemo(\n () => ({\n animationScheme,\n duration,\n open,\n anchorProps,\n bodyProps,\n closeTriggerProps,\n contentProps,\n footerProps,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n headerProps,\n triggerProps,\n }),\n [\n open,\n animationScheme,\n anchorProps,\n bodyProps,\n closeTriggerProps,\n contentProps,\n duration,\n footerProps,\n headerProps,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n triggerProps,\n ],\n )\n const customAnchor = anchorProp ? (\n <PopoverAnchor>{anchorProp}</PopoverAnchor>\n ) : null\n const customTrigger = triggerProp ? (\n <PopoverTrigger>{triggerProp}</PopoverTrigger>\n ) : null\n const customContentProp =\n header !== undefined || body !== undefined || footer !== undefined ? (\n <ShorthandPopoverContent body={body} footer={footer} header={header} />\n ) : null\n\n return (\n <StyleContext value={styleContext}>\n <ComponentContext value={componentContext}>\n {isFunction(children) ? (\n runIfFn(children, { open, onClose })\n ) : (\n <>\n {anchor ?? customAnchor}\n {trigger ?? customTrigger}\n {omittedChildren}\n {customContent ?? customContentProp}\n </>\n )}\n </ComponentContext>\n </StyleContext>\n )\n}\n\nexport interface PopoverTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PopoverTrigger = withContext<\"button\", PopoverTriggerProps>(\n \"button\",\n \"trigger\",\n)({ asChild: true }, (props) => {\n const { getTriggerProps, triggerProps } = useComponentContext()\n\n return getTriggerProps(mergeProps(triggerProps, props)())\n})\n\nexport interface PopoverCloseTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PopoverCloseTrigger = withContext<\n \"button\",\n PopoverCloseTriggerProps\n>(\"button\", { name: \"CloseTrigger\", slot: [\"trigger\", \"close\"] })(\n { asChild: true },\n (props) => {\n const { closeTriggerProps, getCloseTriggerProps } = useComponentContext()\n\n return getCloseTriggerProps(mergeProps(closeTriggerProps, props)())\n },\n)\n\nexport interface PopoverAnchorProps extends HTMLStyledProps {}\n\nexport const PopoverAnchor = withContext<\"div\", PopoverAnchorProps>(\n \"div\",\n \"anchor\",\n)({ asChild: true }, (props) => {\n const { anchorProps, getAnchorProps } = useComponentContext()\n\n return getAnchorProps(mergeProps(anchorProps, props)())\n})\n\ninterface PopoverPositionerProps extends HTMLStyledProps {}\n\nconst PopoverPositioner = withContext<\"div\", PopoverPositionerProps>(\n \"div\",\n \"positioner\",\n)(undefined, (props) => {\n const { getPositionerProps } = useComponentContext()\n\n return getPositionerProps(props)\n})\n\nexport interface PopoverContentProps\n extends Omit<HTMLMotionProps, \"children\">, PropsWithChildren {\n /**\n * Props for portal component.\n */\n portalProps?: Omit<PortalProps, \"children\">\n /**\n * Props for positioner component.\n */\n positionerProps?: Omit<PopoverPositionerProps, \"children\">\n}\n\nexport const PopoverContent = withContext<\"div\", PopoverContentProps>(\n ({\n portalProps: portalPropsProp,\n positionerProps: positionerPropsProp,\n ...rest\n }) => {\n const {\n animationScheme,\n duration,\n open,\n contentProps: { portalProps, positionerProps, ...contentProps } = {},\n getContentProps,\n } = useComponentContext()\n const popupAnimationProps = usePopupAnimationProps({\n animationScheme,\n duration,\n })\n\n return (\n <AnimatePresence>\n {open ? (\n <Portal {...mergeProps(portalProps, portalPropsProp)()}>\n <PopoverPositioner\n {...mergeProps(positionerProps, positionerPropsProp)()}\n >\n <motion.div\n {...popupAnimationProps}\n {...cast<HTMLMotionProps>(\n getContentProps(\n cast<HTMLProps>(mergeProps(contentProps, rest)()),\n ),\n )}\n />\n </PopoverPositioner>\n </Portal>\n ) : null}\n </AnimatePresence>\n )\n },\n \"content\",\n)()\n\ninterface ShorthandPopoverContentProps {\n /**\n * The popover body to use.\n */\n body?: PopoverBodyProps | ReactNode\n /**\n * The popover footer to use.\n */\n footer?: PopoverFooterProps | ReactNode\n /**\n * The popover header to use.\n */\n header?: PopoverHeaderProps | ReactNode\n}\n\nconst ShorthandPopoverContent: FC<ShorthandPopoverContentProps> = ({\n body,\n footer,\n header,\n}) => {\n const customHeader = wrapOrPassProps(PopoverHeader, header)\n const customBody = wrapOrPassProps(PopoverBody, body)\n const customFooter = wrapOrPassProps(PopoverFooter, footer)\n\n return (\n <PopoverContent>\n {customHeader}\n {customBody}\n {customFooter}\n </PopoverContent>\n )\n}\n\nexport interface PopoverHeaderProps extends HTMLStyledProps {}\n\nexport const PopoverHeader = withContext<\"div\", PopoverHeaderProps>(\n \"div\",\n \"header\",\n)(undefined, (props) => {\n const { getHeaderProps, headerProps } = useComponentContext()\n\n return getHeaderProps(mergeProps(headerProps, props)())\n})\n\nexport interface PopoverBodyProps extends HTMLStyledProps {}\n\nexport const PopoverBody = withContext<\"div\", PopoverBodyProps>(\"div\", \"body\")(\n undefined,\n (props) => {\n const { bodyProps, getBodyProps } = useComponentContext()\n\n return getBodyProps(mergeProps(bodyProps, props)())\n },\n)\n\nexport interface PopoverFooterProps extends HTMLStyledProps {}\n\nexport const PopoverFooter = withContext<\"div\", PopoverFooterProps>(\n \"div\",\n \"footer\",\n)(undefined, (props) => {\n const { footerProps, getFooterProps } = useComponentContext()\n\n return getFooterProps(mergeProps(footerProps, props)())\n})\n"],"mappings":";;;;;;;;;;;;;;;;;AAiDA,MAAa,0BAA0B,QAAgC,CAAC,MAAM;CAC5E,MAAM,kBAAkBA,8BAAAA,SAAS,MAAM,mBAAmB,OAAO;CACjE,MAAM,WAAWA,8BAAAA,SAAS,MAAM,YAAY,EAAG;CAC/C,MAAM,cAAc;EAAE,SAAS;EAAS,MAAM;EAAQ,SAAS;CAAO;CAEtE,QAAQ,iBAAR;EACE,KAAK,SACH,OAAO;GACL,GAAG;GACH,QAAQ;IAAE;IAAU,SAAS;IAAM,OAAO;GAAK;GAC/C,UAAUC,mBAAAA;E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+1 @@
|
|
|
1
|
-
{"version":3,"file":"use-popover.cjs","names":["useEnvironment","useDisclosure","usePopper","getEventRelatedTarget","mergeRefs","popperProps","useSplitProps"],"sources":["../../../../src/components/popover/use-popover.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FocusEvent, KeyboardEvent, RefObject } from \"react\"\nimport type { Direction, PropGetter } from \"../../core\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport type { UsePopperProps } from \"../../hooks/use-popper\"\nimport type { Dict } from \"../../utils\"\nimport type { UsePopupAnimationProps } from \"./popover\"\nimport { useCallback, useEffect, useId, useRef } from \"react\"\nimport { useEnvironment, useSplitProps } from \"../../core\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport { useEventListener } from \"../../hooks/use-event-listener\"\nimport { useFocusOnShow } from \"../../hooks/use-focus\"\nimport { useOutsideClick } from \"../../hooks/use-outside-click\"\nimport { popperProps, usePopper } from \"../../hooks/use-popper\"\nimport {\n ariaAttr,\n assignRef,\n contains,\n dataAttr,\n focusTransfer,\n focusTrap,\n getEventRelatedTarget,\n handlerAll,\n mergeRefs,\n runKeyAction,\n scrollLock,\n setAttribute,\n useSafeLayoutEffect,\n useUnmountEffect,\n} from \"../../utils\"\n\nexport interface UsePopoverProps\n extends Omit<UseDisclosureProps, \"timing\">, UsePopperProps<\"button\"> {\n /**\n * If `true`, focus will be transferred to the first interactive element when the popover opens.\n *\n * @default true\n */\n autoFocus?: boolean\n /**\n * If `true`, scrolling will be disabled on the `body` when the modal opens.\n *\n * @default false\n */\n blockScrollOnMount?: boolean\n /**\n * If `true`, the popover will close when you blur out it by clicking outside or tabbing out.\n *\n * @default true\n */\n closeOnBlur?: boolean\n /**\n * If `true`, the popover will hide on pressing Esc key.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the popover will hide on scroll.\n *\n * @default false\n */\n closeOnScroll?: boolean\n /**\n * If `true`, the popover will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The `ref` of the element that should receive focus when the popover opens.\n */\n initialFocusRef?: RefObject<HTMLElement | null>\n /**\n * If `true`, the popover will be modal.\n *\n * - scrolling is blocked.\n * - focus is trapped within the popover.\n *\n * @default false\n */\n modal?: boolean\n /**\n * If `true`, the popover will be opened when click on the field.\n *\n * @default true\n */\n openOnClick?: boolean\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end'\n */\n placement?: Direction\n /**\n * If `true`, the focus will be transferred to the popover content when the tab key is pressed.\n *\n * @default true\n */\n transferFocus?: boolean\n /**\n * Update the position of the floating element, re-rendering the component if required.\n */\n updateRef?: RefObject<() => void>\n}\n\nexport const usePopover = ({\n autoFocus = true,\n autoUpdate,\n modal = false,\n blockScrollOnMount = modal,\n closeOnBlur = true,\n closeOnEsc = true,\n closeOnScroll,\n defaultOpen,\n disabled,\n elements,\n flip,\n gutter,\n initialFocusRef,\n matchWidth,\n middleware,\n offset,\n open: openProp,\n openOnClick = true,\n placement = \"end\",\n platform,\n preventOverflow,\n strategy,\n transferFocus = true,\n transform,\n updateRef,\n whileElementsMounted,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n}: UsePopoverProps = {}) => {\n const { getDocument } = useEnvironment()\n const headerId = useId()\n const bodyId = useId()\n const contentId = useId()\n const anchorRef = useRef<HTMLElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const contentRef = useRef<HTMLElement>(null)\n const openTimeout = useRef<NodeJS.Timeout>(undefined)\n const closeTimeout = useRef<NodeJS.Timeout>(undefined)\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const { refs, update, getPopperProps } = usePopper<\"button\">({\n autoUpdate,\n elements,\n flip,\n gutter,\n matchWidth,\n middleware,\n offset,\n open,\n placement,\n platform,\n preventOverflow,\n strategy,\n transform,\n whileElementsMounted,\n })\n\n assignRef(updateRef, update)\n\n const onRestoreFocus = useCallback(() => {\n clearTimeout(closeTimeout.current)\n closeTimeout.current = setTimeout(() => {\n triggerRef.current?.focus()\n })\n }, [])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLElement>) => {\n runKeyAction(ev, {\n Escape: () => {\n if (!closeOnEsc) return\n\n onClose()\n onRestoreFocus()\n },\n })\n },\n [closeOnEsc, onClose, onRestoreFocus],\n )\n\n const onBlur = useCallback(\n (ev: FocusEvent<HTMLDivElement>) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const popup = relatedTarget?.hasAttribute(\"data-popup\")\n\n if (contains(triggerRef.current, relatedTarget)) return\n if (contains(contentRef.current, relatedTarget)) return\n if (contains(contentRef.current, ev.target) && popup) return\n\n if (closeOnBlur) onClose()\n },\n [closeOnBlur, onClose],\n )\n\n useEventListener(getDocument(), \"scroll\", () => {\n if (open && closeOnScroll) onClose()\n })\n\n useFocusOnShow(contentRef, {\n focusTarget: initialFocusRef,\n shouldFocus: autoFocus,\n visible: open,\n })\n\n useOutsideClick({\n ref: [contentRef, triggerRef],\n enabled: open && closeOnBlur,\n handler: onClose,\n })\n\n useSafeLayoutEffect(() => {\n const el = contentRef.current\n const hasHeader = !!getDocument()?.getElementById(headerId)\n const hasBody = !!getDocument()?.getElementById(bodyId)\n\n if (el && hasHeader) setAttribute(el, \"aria-labelledby\", headerId)\n if (el && hasBody) setAttribute(el, \"aria-describedby\", bodyId)\n }, [open, headerId, bodyId])\n\n useEffect(() => {\n if (!open || !modal) return\n\n return focusTrap(contentRef.current)\n }, [open, modal])\n\n useEffect(() => {\n if (!open || !blockScrollOnMount) return\n\n return scrollLock(contentRef.current)\n }, [open, modal, blockScrollOnMount])\n\n useEffect(() => {\n if (!open || modal || !transferFocus) return\n\n return focusTransfer(contentRef.current, triggerRef.current)\n }, [open, modal, transferFocus])\n\n useUnmountEffect(() => {\n clearTimeout(openTimeout.current)\n clearTimeout(closeTimeout.current)\n })\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n ({ ref, ...props } = {}) => ({\n \"aria-controls\": open ? contentId : undefined,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": open,\n \"aria-haspopup\": \"dialog\",\n role: \"button\",\n ...props,\n ref: mergeRefs(ref, triggerRef, (node) => {\n if (anchorRef.current == null) refs.setReference(node)\n }),\n onBlur: handlerAll(props.onBlur, (ev) =>\n !contains(contentRef.current, getEventRelatedTarget(ev)) && closeOnBlur\n ? onClose()\n : void 0,\n ),\n onClick: handlerAll(\n props.onClick,\n !open ? (!disabled && openOnClick ? onOpen : undefined) : onClose,\n ),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [\n closeOnBlur,\n contentId,\n disabled,\n onClose,\n onKeyDown,\n onOpen,\n open,\n openOnClick,\n refs,\n ],\n )\n\n const getAnchorProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => ({\n ...props,\n ref: mergeRefs(ref, anchorRef, refs.setReference),\n }),\n [refs.setReference],\n )\n\n const getPositionerProps: PropGetter = useCallback(\n (props) => getPopperProps(props),\n [getPopperProps],\n )\n\n const getContentProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => ({\n id: contentId,\n \"aria-hidden\": !open,\n \"aria-modal\": modal ? \"true\" : undefined,\n \"data-close\": dataAttr(!open),\n \"data-open\": dataAttr(open),\n \"data-popup\": dataAttr(true),\n role: \"dialog\",\n tabIndex: -1,\n ...props,\n ref: mergeRefs(ref, contentRef),\n onBlur: handlerAll(props.onBlur, onBlur),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [contentId, open, modal, onBlur, onKeyDown],\n )\n\n const getHeaderProps: PropGetter = useCallback(\n (props) => ({ id: headerId, ...props }),\n [headerId],\n )\n\n const getBodyProps: PropGetter = useCallback(\n (props) => ({ id: bodyId, ...props }),\n [bodyId],\n )\n\n const getFooterProps: PropGetter = useCallback((props) => ({ ...props }), [])\n\n const getCloseTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n ...props,\n onClick: handlerAll(props.onClick, () => {\n onClose()\n onRestoreFocus()\n }),\n }),\n [onClose, onRestoreFocus],\n )\n\n return {\n open,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n onClose,\n onOpen,\n }\n}\n\nexport type UsePopoverReturn = ReturnType<typeof usePopover>\n\nexport const popoverProps: (\n | keyof UsePopoverProps\n | keyof UsePopupAnimationProps\n)[] = [\n ...popperProps,\n \"autoFocus\",\n \"transferFocus\",\n \"blockScrollOnMount\",\n \"closeOnBlur\",\n \"closeOnEsc\",\n \"closeOnScroll\",\n \"openOnClick\",\n \"disabled\",\n \"initialFocusRef\",\n \"modal\",\n \"updateRef\",\n \"defaultOpen\",\n \"onOpen\",\n \"onClose\",\n \"animationScheme\",\n \"duration\",\n]\n\nexport const usePopoverProps = <\n Y extends Dict = Dict,\n M extends keyof UsePopoverProps | keyof UsePopupAnimationProps =\n | keyof UsePopoverProps\n | keyof UsePopupAnimationProps,\n>(\n props: Y,\n omitKeys?: M[],\n) => {\n return useSplitProps(\n props,\n popoverProps.filter((key) => !omitKeys?.includes(key as M)),\n ) as unknown as [\n keyof UsePopoverProps | keyof UsePopupAnimationProps extends M\n ? UsePopoverProps & UsePopupAnimationProps\n : Omit<UsePopoverProps & UsePopupAnimationProps, M>,\n Omit<\n Y,\n keyof UsePopoverProps | keyof UsePopupAnimationProps extends M\n ? keyof UsePopoverProps | keyof UsePopupAnimationProps\n : Exclude<keyof UsePopoverProps | keyof UsePopupAnimationProps, M>\n >,\n ]\n}\n"],"mappings":";;;;;;;;;;;;;;AA2GA,MAAa,cAAc,EACzB,YAAY,MACZ,YACA,QAAQ,OACR,qBAAqB,OACrB,cAAc,MACd,aAAa,MACb,eACA,aACA,UACA,UACA,MACA,QACA,iBACA,YACA,YACA,QACA,MAAM,UACN,cAAc,MACd,YAAY,OACZ,UACA,iBACA,UACA,gBAAgB,MAChB,WACA,WACA,sBACA,SAAS,aACT,QAA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;CACA;AACF;AAEA,MAAa,mBAMX,OACA,aACG;CACH,OAAOC,cAAAA,cACL,OACA,aAAa,QAAQ,QAAQ,CAAC,UAAU,SAAS,GAAQ,CAAC,CAC5D;AAWF"}
|
|
1
|
+
{"version":3,"file":"use-popover.cjs","names":["useEnvironment","useId","useRef","useDisclosure","usePopper","useCallback","getEventRelatedTarget","mergeRefs","popperProps","useSplitProps"],"sources":["../../../../src/components/popover/use-popover.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FocusEvent, KeyboardEvent, RefObject } from \"react\"\nimport type { Direction, PropGetter } from \"../../core\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport type { UsePopperProps } from \"../../hooks/use-popper\"\nimport type { Dict } from \"../../utils\"\nimport type { UsePopupAnimationProps } from \"./popover\"\nimport { useCallback, useEffect, useId, useRef } from \"react\"\nimport { useEnvironment, useSplitProps } from \"../../core\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport { useEventListener } from \"../../hooks/use-event-listener\"\nimport { useFocusOnShow } from \"../../hooks/use-focus\"\nimport { useOutsideClick } from \"../../hooks/use-outside-click\"\nimport { popperProps, usePopper } from \"../../hooks/use-popper\"\nimport {\n ariaAttr,\n assignRef,\n contains,\n dataAttr,\n focusTransfer,\n focusTrap,\n getEventRelatedTarget,\n handlerAll,\n mergeRefs,\n runKeyAction,\n scrollLock,\n setAttribute,\n useSafeLayoutEffect,\n useUnmountEffect,\n} from \"../../utils\"\n\nexport interface UsePopoverProps\n extends Omit<UseDisclosureProps, \"timing\">, UsePopperProps<\"button\"> {\n /**\n * If `true`, focus will be transferred to the first interactive element when the popover opens.\n *\n * @default true\n */\n autoFocus?: boolean\n /**\n * If `true`, scrolling will be disabled on the `body` when the modal opens.\n *\n * @default false\n */\n blockScrollOnMount?: boolean\n /**\n * If `true`, the popover will close when you blur out it by clicking outside or tabbing out.\n *\n * @default true\n */\n closeOnBlur?: boolean\n /**\n * If `true`, the popover will hide on pressing Esc key.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the popover will hide on scroll.\n *\n * @default false\n */\n closeOnScroll?: boolean\n /**\n * If `true`, the popover will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The `ref` of the element that should receive focus when the popover opens.\n */\n initialFocusRef?: RefObject<HTMLElement | null>\n /**\n * If `true`, the popover will be modal.\n *\n * - scrolling is blocked.\n * - focus is trapped within the popover.\n *\n * @default false\n */\n modal?: boolean\n /**\n * If `true`, the popover will be opened when click on the field.\n *\n * @default true\n */\n openOnClick?: boolean\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end'\n */\n placement?: Direction\n /**\n * If `true`, the focus will be transferred to the popover content when the tab key is pressed.\n *\n * @default true\n */\n transferFocus?: boolean\n /**\n * Update the position of the floating element, re-rendering the component if required.\n */\n updateRef?: RefObject<() => void>\n}\n\nexport const usePopover = ({\n autoFocus = true,\n autoUpdate,\n modal = false,\n blockScrollOnMount = modal,\n closeOnBlur = true,\n closeOnEsc = true,\n closeOnScroll,\n defaultOpen,\n disabled,\n elements,\n flip,\n gutter,\n initialFocusRef,\n matchWidth,\n middleware,\n offset,\n open: openProp,\n openOnClick = true,\n placement = \"end\",\n platform,\n preventOverflow,\n strategy,\n transferFocus = true,\n transform,\n updateRef,\n whileElementsMounted,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n}: UsePopoverProps = {}) => {\n const { getDocument } = useEnvironment()\n const headerId = useId()\n const bodyId = useId()\n const contentId = useId()\n const anchorRef = useRef<HTMLElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const contentRef = useRef<HTMLElement>(null)\n const openTimeout = useRef<NodeJS.Timeout>(undefined)\n const closeTimeout = useRef<NodeJS.Timeout>(undefined)\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const { refs, update, getPopperProps } = usePopper<\"button\">({\n autoUpdate,\n elements,\n flip,\n gutter,\n matchWidth,\n middleware,\n offset,\n open,\n placement,\n platform,\n preventOverflow,\n strategy,\n transform,\n whileElementsMounted,\n })\n\n assignRef(updateRef, update)\n\n const onRestoreFocus = useCallback(() => {\n clearTimeout(closeTimeout.current)\n closeTimeout.current = setTimeout(() => {\n triggerRef.current?.focus()\n })\n }, [])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLElement>) => {\n runKeyAction(ev, {\n Escape: () => {\n if (!closeOnEsc) return\n\n onClose()\n onRestoreFocus()\n },\n })\n },\n [closeOnEsc, onClose, onRestoreFocus],\n )\n\n const onBlur = useCallback(\n (ev: FocusEvent<HTMLDivElement>) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const popup = relatedTarget?.hasAttribute(\"data-popup\")\n\n if (contains(triggerRef.current, relatedTarget)) return\n if (contains(contentRef.current, relatedTarget)) return\n if (contains(contentRef.current, ev.target) && popup) return\n\n if (closeOnBlur) onClose()\n },\n [closeOnBlur, onClose],\n )\n\n useEventListener(getDocument(), \"scroll\", () => {\n if (open && closeOnScroll) onClose()\n })\n\n useFocusOnShow(contentRef, {\n focusTarget: initialFocusRef,\n shouldFocus: autoFocus,\n visible: open,\n })\n\n useOutsideClick({\n ref: [contentRef, triggerRef],\n enabled: open && closeOnBlur,\n handler: onClose,\n })\n\n useSafeLayoutEffect(() => {\n const el = contentRef.current\n const hasHeader = !!getDocument()?.getElementById(headerId)\n const hasBody = !!getDocument()?.getElementById(bodyId)\n\n if (el && hasHeader) setAttribute(el, \"aria-labelledby\", headerId)\n if (el && hasBody) setAttribute(el, \"aria-describedby\", bodyId)\n }, [open, headerId, bodyId])\n\n useEffect(() => {\n if (!open || !modal) return\n\n return focusTrap(contentRef.current)\n }, [open, modal])\n\n useEffect(() => {\n if (!open || !blockScrollOnMount) return\n\n return scrollLock(contentRef.current)\n }, [open, modal, blockScrollOnMount])\n\n useEffect(() => {\n if (!open || modal || !transferFocus) return\n\n return focusTransfer(contentRef.current, triggerRef.current)\n }, [open, modal, transferFocus])\n\n useUnmountEffect(() => {\n clearTimeout(openTimeout.current)\n clearTimeout(closeTimeout.current)\n })\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n ({ ref, ...props } = {}) => ({\n \"aria-controls\": open ? contentId : undefined,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": open,\n \"aria-haspopup\": \"dialog\",\n role: \"button\",\n ...props,\n ref: mergeRefs(ref, triggerRef, (node) => {\n if (anchorRef.current == null) refs.setReference(node)\n }),\n onBlur: handlerAll(props.onBlur, (ev) =>\n !contains(contentRef.current, getEventRelatedTarget(ev)) && closeOnBlur\n ? onClose()\n : void 0,\n ),\n onClick: handlerAll(\n props.onClick,\n !open ? (!disabled && openOnClick ? onOpen : undefined) : onClose,\n ),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [\n closeOnBlur,\n contentId,\n disabled,\n onClose,\n onKeyDown,\n onOpen,\n open,\n openOnClick,\n refs,\n ],\n )\n\n const getAnchorProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => ({\n ...props,\n ref: mergeRefs(ref, anchorRef, refs.setReference),\n }),\n [refs.setReference],\n )\n\n const getPositionerProps: PropGetter = useCallback(\n (props) => getPopperProps(props),\n [getPopperProps],\n )\n\n const getContentProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => ({\n id: contentId,\n \"aria-hidden\": !open,\n \"aria-modal\": modal ? \"true\" : undefined,\n \"data-close\": dataAttr(!open),\n \"data-open\": dataAttr(open),\n \"data-popup\": dataAttr(true),\n role: \"dialog\",\n tabIndex: -1,\n ...props,\n ref: mergeRefs(ref, contentRef),\n onBlur: handlerAll(props.onBlur, onBlur),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [contentId, open, modal, onBlur, onKeyDown],\n )\n\n const getHeaderProps: PropGetter = useCallback(\n (props) => ({ id: headerId, ...props }),\n [headerId],\n )\n\n const getBodyProps: PropGetter = useCallback(\n (props) => ({ id: bodyId, ...props }),\n [bodyId],\n )\n\n const getFooterProps: PropGetter = useCallback((props) => ({ ...props }), [])\n\n const getCloseTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n ...props,\n onClick: handlerAll(props.onClick, () => {\n onClose()\n onRestoreFocus()\n }),\n }),\n [onClose, onRestoreFocus],\n )\n\n return {\n open,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n onClose,\n onOpen,\n }\n}\n\nexport type UsePopoverReturn = ReturnType<typeof usePopover>\n\nexport const popoverProps: (\n | keyof UsePopoverProps\n | keyof UsePopupAnimationProps\n)[] = [\n ...popperProps,\n \"autoFocus\",\n \"transferFocus\",\n \"blockScrollOnMount\",\n \"closeOnBlur\",\n \"closeOnEsc\",\n \"closeOnScroll\",\n \"openOnClick\",\n \"disabled\",\n \"initialFocusRef\",\n \"modal\",\n \"updateRef\",\n \"defaultOpen\",\n \"onOpen\",\n \"onClose\",\n \"animationScheme\",\n \"duration\",\n]\n\nexport const usePopoverProps = <\n Y extends Dict = Dict,\n M extends keyof UsePopoverProps | keyof UsePopupAnimationProps =\n | keyof UsePopoverProps\n | keyof UsePopupAnimationProps,\n>(\n props: Y,\n omitKeys?: M[],\n) => {\n return useSplitProps(\n props,\n popoverProps.filter((key) => !omitKeys?.includes(key as M)),\n ) as unknown as [\n keyof UsePopoverProps | keyof UsePopupAnimationProps extends M\n ? UsePopoverProps & UsePopupAnimationProps\n : Omit<UsePopoverProps & UsePopupAnimationProps, M>,\n Omit<\n Y,\n keyof UsePopoverProps | keyof UsePopupAnimationProps extends M\n ? keyof UsePopoverProps | keyof UsePopupAnimationProps\n : Exclude<keyof UsePopoverProps | keyof UsePopupAnimationProps, M>\n >,\n ]\n}\n"],"mappings":";;;;;;;;;;;;;;;AA2GA,MAAa,cAAc,EACzB,YAAY,MACZ,YACA,QAAQ,OACR,qBAAqB,OACrB,cAAc,MACd,aAAa,MACb,e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Q;IACR,eAAe;GACjB,CAAC;EACH,IACA,CAAC,SAAS,cAAc,CAOL;EACnB;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;AAIA,MAAa,eAGP;CACJ,GAAGG,+BAAAA;CACH;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,mBAMX,OACA,aACG;CACH,OAAOC,cAAAA,cACL,OACA,aAAa,QAAQ,QAAQ,CAAC,UAAU,SAAS,GAAQ,CAAC,CAC5D;AAWF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
3
|
const require_ssr = require("../../utils/ssr.cjs");
|
|
3
4
|
const require_utils_index = require("../../utils/index.cjs");
|
|
4
5
|
const require_environment_provider = require("../../core/system/environment-provider.cjs");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal.cjs","names":["useSsr","useEnvironment","useFocusLockShard","Children"],"sources":["../../../../src/components/portal/portal.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, RefObject } from \"react\"\nimport type { RootNode } from \"../../core\"\nimport { Children, useEffect, useRef, useState } from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { useEnvironment } from \"../../core\"\nimport { getDocument, isShadowRoot, useSsr } from \"../../utils\"\nimport { useFocusLockShard } from \"../focus-lock\"\n\nconst getPortalNode = (node?: RootNode) => {\n const rootNode = node?.getRootNode()\n\n if (isShadowRoot(rootNode)) return rootNode\n\n return getDocument(node).body\n}\n\nexport interface PortalProps extends PropsWithChildren {\n /**\n * The `ref` to the component where the portal will be attached to.\n */\n containerRef?: RefObject<HTMLElement | null>\n /**\n * If `true`, the forwarding will be disabled.\n */\n disabled?: boolean\n}\n\n/**\n * `Portal` is a component that renders elements outside of the current `DOM` hierarchy.\n *\n * @see https://yamada-ui.com/docs/components/portal\n */\nexport const Portal: FC<PortalProps> = ({\n children,\n containerRef: ref,\n disabled,\n}) => {\n const shardRef = useRef<HTMLDivElement>(null)\n const [target, setTarget] = useState(ref?.current)\n const ssr = useSsr()\n const { getRootNode } = useEnvironment()\n const registerShard = useFocusLockShard()\n\n useEffect(() => {\n setTarget(() => ref?.current)\n }, [ref])\n\n useEffect(() => {\n const shard = shardRef.current\n\n if (disabled || ssr || !shard) return\n\n return registerShard?.(shard)\n }, [disabled, registerShard, ssr])\n\n if (ssr || disabled) return children\n\n const container = target ?? getPortalNode(getRootNode())\n\n if (registerShard)\n return createPortal(<div ref={shardRef}>{children}</div>, container)\n\n return (\n <>{Children.map(children, (child) => createPortal(child, container))}</>\n )\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"portal.cjs","names":["useRef","useState","useSsr","useEnvironment","useFocusLockShard","createPortal","Children"],"sources":["../../../../src/components/portal/portal.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, RefObject } from \"react\"\nimport type { RootNode } from \"../../core\"\nimport { Children, useEffect, useRef, useState } from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { useEnvironment } from \"../../core\"\nimport { getDocument, isShadowRoot, useSsr } from \"../../utils\"\nimport { useFocusLockShard } from \"../focus-lock\"\n\nconst getPortalNode = (node?: RootNode) => {\n const rootNode = node?.getRootNode()\n\n if (isShadowRoot(rootNode)) return rootNode\n\n return getDocument(node).body\n}\n\nexport interface PortalProps extends PropsWithChildren {\n /**\n * The `ref` to the component where the portal will be attached to.\n */\n containerRef?: RefObject<HTMLElement | null>\n /**\n * If `true`, the forwarding will be disabled.\n */\n disabled?: boolean\n}\n\n/**\n * `Portal` is a component that renders elements outside of the current `DOM` hierarchy.\n *\n * @see https://yamada-ui.com/docs/components/portal\n */\nexport const Portal: FC<PortalProps> = ({\n children,\n containerRef: ref,\n disabled,\n}) => {\n const shardRef = useRef<HTMLDivElement>(null)\n const [target, setTarget] = useState(ref?.current)\n const ssr = useSsr()\n const { getRootNode } = useEnvironment()\n const registerShard = useFocusLockShard()\n\n useEffect(() => {\n setTarget(() => ref?.current)\n }, [ref])\n\n useEffect(() => {\n const shard = shardRef.current\n\n if (disabled || ssr || !shard) return\n\n return registerShard?.(shard)\n }, [disabled, registerShard, ssr])\n\n if (ssr || disabled) return children\n\n const container = target ?? getPortalNode(getRootNode())\n\n if (registerShard)\n return createPortal(<div ref={shardRef}>{children}</div>, container)\n\n return (\n <>{Children.map(children, (child) => createPortal(child, container))}</>\n )\n}\n"],"mappings":";;;;;;;;;;AAUA,MAAM,iBAAiB,SAAoB;CACzC,MAAM,WAAW,MAAM,YAAY;CAEnC,KAAA,GAAA,oBAAA,cAAI,aAAA,CAAa,QAAQ,GAAG,OAAO;CAEnC,QAAA,GAAA,oBAAA,cAAO,YAAA,CAAY,IAAI,CAAC,CAAC;AAC3B;;;;;;AAkBA,MAAa,UAA2B,EACtC,UACA,cAAc,KACd,eACI;CACJ,MAAM,YAAA,GAAWA,MAAAA,OAAAA,CAAuB,IAAI;CAC5C,MAAM,CAAC,QAAQ,cAAA,GAAaC,MAAAA,SAAAA,CAAS,KAAK,OAAO;CACjD,MAAM,MAAMC,YAAAA,OAAO;CACnB,MAAM,EAAE,gBAAgBC,6BAAAA,eAAe;CACvC,MAAM,gBAAgBC,mBAAAA,kBAAkB;CAExC,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,gBAAgB,KAAK,OAAO;CAC9B,GAAG,CAAC,GAAG,CAAC;CAER,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,MAAM,QAAQ,SAAS;EAEvB,IAAI,YAAY,OAAO,CAAC,OAAO;EAE/B,OAAO,gBAAgB,KAAK;CAC9B,GAAG;EAAC;EAAU;EAAe;CAAG,CAAC;CAEjC,IAAI,OAAO,UAAU,OAAO;CAE5B,MAAM,YAAY,UAAU,cAAc,YAAY,CAAC;CAEvD,IAAI,eACF,QAAA,GAAOC,UAAAA,aAAAA,CAAa,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,KAAK;EAAW;CAAc,CAAA,GAAG,SAAS;CAErE,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAA,kBAAA,UAAA,EAAA,UAAGC,MAAAA,SAAS,IAAI,WAAW,WAAA,GAAUD,UAAAA,aAAAA,CAAa,OAAO,SAAS,CAAC,EAAI,CAAA;AAE3E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.cjs","names":["createSlotComponent","progressStyle","useProgress","styled","mergeCSS"],"sources":["../../../../src/components/progress/progress.tsx"],"sourcesContent":["\"use client\"\n\nimport type { CSSProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ProgressStyle } from \"./progress.style\"\nimport type { UseProgressProps } from \"./use-progress\"\nimport { createSlotComponent, mergeCSS, styled } from \"../../core\"\nimport { isNumber } from \"../../utils\"\nimport { progressStyle } from \"./progress.style\"\nimport { useProgress } from \"./use-progress\"\n\nexport interface ProgressProps\n extends HTMLStyledProps, UseProgressProps, ThemeProps<ProgressStyle> {\n /**\n * The animation duration in seconds.\n */\n duration?: number | string\n /**\n * The color of the progress range.\n */\n rangeColor?: CSSProps[\"color\"]\n /**\n * The color of the progress track.\n */\n trackColor?: CSSProps[\"color\"]\n /**\n * Props for the progress range element.\n */\n rangeProps?: ProgressRangeProps\n}\n\nconst {\n PropsContext: ProgressPropsContext,\n usePropsContext: useProgressPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<ProgressProps, ProgressStyle>(\"progress\", progressStyle)\n\nexport { ProgressPropsContext, useProgressPropsContext }\n\n/**\n * `Progress` is a component for visually indicating progress.\n *\n * @see https://yamada-ui.com/docs/components/progress\n */\nexport const Progress = withProvider(\n ({ css, max, min, rangeColor, trackColor, value, rangeProps, ...rest }) => {\n const { percent, getRangeProps, getRootProps } = useProgress({\n max,\n min,\n value,\n })\n\n return (\n <styled.div\n css={mergeCSS(css, { \"--width\": `${percent}%` })}\n bg={trackColor}\n {...getRootProps(rest)}\n >\n <ProgressRange bg={rangeColor} {...getRangeProps(rangeProps)} />\n </styled.div>\n )\n },\n \"root\",\n)(undefined, ({ duration, ...rest }) => ({\n \"--duration\": isNumber(duration) ? `${duration}s` : duration,\n ...rest,\n}))\n\ninterface ProgressRangeProps extends HTMLStyledProps {}\n\nconst ProgressRange = withContext<\"div\", ProgressRangeProps>(\"div\", \"range\")()\n"],"mappings":";;;;;;;;;AA8BA,MAAM,EACJ,cAAc,sBACd,iBAAiB,yBACjB,aACA,iBACEA,yBAAAA,oBAAkD,YAAYC,uBAAAA,aAAa;;;;;;AAS/E,MAAa,WAAW,cACrB,EAAE,KAAK,KAAK,KAAK,YAAY,YAAY,OAAO,YAAY,GAAG,WAAW;CACzE,MAAM,EAAE,SAAS,eAAe,iBAAiBC,qBAAAA,YAAY;EAC3D;EACA;EACA;CACF,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,gBAAAA,OAAO,KAAR;EACE,KAAKC,kBAAAA,SAAS,KAAK,EAAE,WAAW,GAAG,QAAQ,GAAG,CAAC;EAC/C,IAAI;EACJ,GAAI,aAAa,IAAI;EAErB,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAD;GAAe,IAAI;GAAY,GAAI,cAAc,UAAU;EAAI,CAAA;CACrD,CAAA;AAEhB,GACA,MACF,CAAC,CAAC,KAAA,IAAY,EAAE,UAAU,GAAG,YAAY;CACvC,eAAA,GAAA,oBAAA,
|
|
1
|
+
{"version":3,"file":"progress.cjs","names":["createSlotComponent","progressStyle","useProgress","styled","mergeCSS"],"sources":["../../../../src/components/progress/progress.tsx"],"sourcesContent":["\"use client\"\n\nimport type { CSSProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ProgressStyle } from \"./progress.style\"\nimport type { UseProgressProps } from \"./use-progress\"\nimport { createSlotComponent, mergeCSS, styled } from \"../../core\"\nimport { isNumber } from \"../../utils\"\nimport { progressStyle } from \"./progress.style\"\nimport { useProgress } from \"./use-progress\"\n\nexport interface ProgressProps\n extends HTMLStyledProps, UseProgressProps, ThemeProps<ProgressStyle> {\n /**\n * The animation duration in seconds.\n */\n duration?: number | string\n /**\n * The color of the progress range.\n */\n rangeColor?: CSSProps[\"color\"]\n /**\n * The color of the progress track.\n */\n trackColor?: CSSProps[\"color\"]\n /**\n * Props for the progress range element.\n */\n rangeProps?: ProgressRangeProps\n}\n\nconst {\n PropsContext: ProgressPropsContext,\n usePropsContext: useProgressPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<ProgressProps, ProgressStyle>(\"progress\", progressStyle)\n\nexport { ProgressPropsContext, useProgressPropsContext }\n\n/**\n * `Progress` is a component for visually indicating progress.\n *\n * @see https://yamada-ui.com/docs/components/progress\n */\nexport const Progress = withProvider(\n ({ css, max, min, rangeColor, trackColor, value, rangeProps, ...rest }) => {\n const { percent, getRangeProps, getRootProps } = useProgress({\n max,\n min,\n value,\n })\n\n return (\n <styled.div\n css={mergeCSS(css, { \"--width\": `${percent}%` })}\n bg={trackColor}\n {...getRootProps(rest)}\n >\n <ProgressRange bg={rangeColor} {...getRangeProps(rangeProps)} />\n </styled.div>\n )\n },\n \"root\",\n)(undefined, ({ duration, ...rest }) => ({\n \"--duration\": isNumber(duration) ? `${duration}s` : duration,\n ...rest,\n}))\n\ninterface ProgressRangeProps extends HTMLStyledProps {}\n\nconst ProgressRange = withContext<\"div\", ProgressRangeProps>(\"div\", \"range\")()\n"],"mappings":";;;;;;;;;AA8BA,MAAM,EACJ,cAAc,sBACd,iBAAiB,yBACjB,aACA,iBACEA,yBAAAA,oBAAkD,YAAYC,uBAAAA,aAAa;;;;;;AAS/E,MAAa,WAAW,cACrB,EAAE,KAAK,KAAK,KAAK,YAAY,YAAY,OAAO,YAAY,GAAG,WAAW;CACzE,MAAM,EAAE,SAAS,eAAe,iBAAiBC,qBAAAA,YAAY;EAC3D;EACA;EACA;CACF,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,gBAAAA,OAAO,KAAR;EACE,KAAKC,kBAAAA,SAAS,KAAK,EAAE,WAAW,GAAG,QAAQ,GAAG,CAAC;EAC/C,IAAI;EACJ,GAAI,aAAa,IAAI;EAErB,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAD;GAAe,IAAI;GAAY,GAAI,cAAc,UAAU;EAAI,CAAA;CACrD,CAAA;AAEhB,GACA,MACF,CAAC,CAAC,KAAA,IAAY,EAAE,UAAU,GAAG,YAAY;CACvC,eAAA,GAAA,oBAAA,cAAc,SAAA,CAAS,QAAQ,IAAI,GAAG,SAAS,KAAK;CACpD,GAAG;AACL,EAAE;AAIF,MAAM,gBAAgB,YAAuC,OAAO,OAAO,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-progress.cjs","names":["useI18n"],"sources":["../../../../src/components/progress/use-progress.ts"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps } from \"../../core\"\nimport { useCallback } from \"react\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { dataAttr, valueToPercent } from \"../../utils\"\n\nexport interface UseProgressProps {\n /**\n * The maximum value of the progress.\n *\n * @default 100\n */\n max?: number\n /**\n * The minimum value of the progress.\n *\n * @default 0\n */\n min?: number\n /**\n * The value of the progress. If `null`, the progress will be indeterminate.\n *\n * @default 0\n */\n value?: null | number\n}\n\nexport const useProgress = <Y extends \"div\" | \"svg\" = \"div\">({\n max = 100,\n min = 0,\n value,\n}: UseProgressProps = {}) => {\n const indeterminate = value === null\n const percent = valueToPercent(value ?? 0, min, max)\n const { t } = useI18n(\"progress\")\n\n const getRootProps = useCallback(\n (props?: HTMLProps<Y>) => ({\n \"aria-label\": indeterminate\n ? t(\"Loading...\")\n : t(\"{value} percent\", { value: percent }),\n \"aria-valuemax\": max,\n \"aria-valuemin\": min,\n \"aria-valuenow\": value ?? undefined,\n \"data-indeterminate\": dataAttr(indeterminate),\n role: \"progressbar\",\n ...props,\n }),\n [max, min, percent, value, indeterminate, t],\n )\n\n const getTrackProps = useCallback(\n (props?: HTMLProps<Y extends \"svg\" ? \"circle\" : \"div\">) => ({\n \"data-indeterminate\": dataAttr(indeterminate),\n ...props,\n }),\n [indeterminate],\n )\n\n const getRangeProps = useCallback(\n (props?: HTMLProps<Y extends \"svg\" ? \"circle\" : \"div\">) => ({\n \"data-indeterminate\": dataAttr(indeterminate),\n ...props,\n }),\n [indeterminate],\n )\n\n return {\n percent,\n getRangeProps,\n getRootProps,\n getTrackProps,\n }\n}\n\nexport type UseProgressReturn = ReturnType<typeof useProgress>\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-progress.cjs","names":["useI18n","useCallback"],"sources":["../../../../src/components/progress/use-progress.ts"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps } from \"../../core\"\nimport { useCallback } from \"react\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport { dataAttr, valueToPercent } from \"../../utils\"\n\nexport interface UseProgressProps {\n /**\n * The maximum value of the progress.\n *\n * @default 100\n */\n max?: number\n /**\n * The minimum value of the progress.\n *\n * @default 0\n */\n min?: number\n /**\n * The value of the progress. If `null`, the progress will be indeterminate.\n *\n * @default 0\n */\n value?: null | number\n}\n\nexport const useProgress = <Y extends \"div\" | \"svg\" = \"div\">({\n max = 100,\n min = 0,\n value,\n}: UseProgressProps = {}) => {\n const indeterminate = value === null\n const percent = valueToPercent(value ?? 0, min, max)\n const { t } = useI18n(\"progress\")\n\n const getRootProps = useCallback(\n (props?: HTMLProps<Y>) => ({\n \"aria-label\": indeterminate\n ? t(\"Loading...\")\n : t(\"{value} percent\", { value: percent }),\n \"aria-valuemax\": max,\n \"aria-valuemin\": min,\n \"aria-valuenow\": value ?? undefined,\n \"data-indeterminate\": dataAttr(indeterminate),\n role: \"progressbar\",\n ...props,\n }),\n [max, min, percent, value, indeterminate, t],\n )\n\n const getTrackProps = useCallback(\n (props?: HTMLProps<Y extends \"svg\" ? \"circle\" : \"div\">) => ({\n \"data-indeterminate\": dataAttr(indeterminate),\n ...props,\n }),\n [indeterminate],\n )\n\n const getRangeProps = useCallback(\n (props?: HTMLProps<Y extends \"svg\" ? \"circle\" : \"div\">) => ({\n \"data-indeterminate\": dataAttr(indeterminate),\n ...props,\n }),\n [indeterminate],\n )\n\n return {\n percent,\n getRangeProps,\n getRootProps,\n getTrackProps,\n }\n}\n\nexport type UseProgressReturn = ReturnType<typeof useProgress>\n"],"mappings":";;;;;;AA4BA,MAAa,eAAgD,EAC3D,MAAM,KACN,MAAM,GACN,UACoB,CAAC,MAAM;CAC3B,MAAM,gBAAgB,UAAU;CAChC,MAAM,WAAA,GAAA,oBAAA,cAAU,eAAA,CAAe,SAAS,GAAG,KAAK,GAAG;CACnD,MAAM,EAAE,MAAMA,sBAAAA,QAAQ,UAAU;CAEhC,MAAM,gBAAA,GAAeC,MAAAA,YAAAA,EAClB,WAA0B;EACzB,cAAc,gBACV,EAAE,YAAY,IACd,EAAE,mBAAmB,EAAE,OAAO,QAAQ,CAAC;EAC3C,iBAAiB;EACjB,iBAAiB;EACjB,iBAAiB,SAAS,KAAA;EAC1B,uBAAA,GAAA,oBAAA,cAAsB,SAAA,CAAS,aAAa;EAC5C,MAAM;EACN,GAAG;CACL,IACA;EAAC;EAAK;EAAK;EAAS;EAAO;EAAe;CAAC,CAC7C;CAEA,MAAM,iBAAA,GAAgBA,MAAAA,YAAAA,EACnB,WAA2D;EAC1D,uBAAA,GAAA,oBAAA,cAAsB,SAAA,CAAS,aAAa;EAC5C,GAAG;CACL,IACA,CAAC,aAAa,CAChB;CAUA,OAAO;EACL;EACA,gBAAA,GAVoBA,MAAAA,YAAAA,EACnB,WAA2D;GAC1D,uBAAA,GAAA,oBAAA,cAAsB,SAAA,CAAS,aAAa;GAC5C,GAAG;EACL,IACA,CAAC,aAAa,CAKF;EACZ;EACA;CACF;AACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
3
|
const require_children = require("../../utils/children.cjs");
|
|
3
4
|
const require_factory = require("../../core/system/factory.cjs");
|
|
4
5
|
const require_create_component = require("../../core/components/create-component.cjs");
|