@yamada-ui/react 2.2.5-dev-20260727044042 → 2.2.5-dev-20260727071034
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/accordion/accordion.cjs.map +1 -1
- package/dist/cjs/components/action-bar/action-bar.cjs.map +1 -1
- package/dist/cjs/components/airy/airy.cjs.map +1 -1
- package/dist/cjs/components/alert/alert.cjs.map +1 -1
- package/dist/cjs/components/alpha-slider/alpha-slider.cjs.map +1 -1
- package/dist/cjs/components/autocomplete/autocomplete.cjs.map +1 -1
- package/dist/cjs/components/autocomplete/use-autocomplete.cjs.map +1 -1
- package/dist/cjs/components/avatar/avatar-group.cjs.map +1 -1
- package/dist/cjs/components/avatar/avatar.cjs.map +1 -1
- package/dist/cjs/components/blockquote/blockquote.cjs.map +1 -1
- package/dist/cjs/components/breadcrumb/breadcrumb.cjs.map +1 -1
- package/dist/cjs/components/button/button-group.cjs.map +1 -1
- package/dist/cjs/components/button/button.cjs.map +1 -1
- 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.map +1 -1
- package/dist/cjs/components/chart/cartesian-chart.cjs.map +1 -1
- package/dist/cjs/components/chart/chart.cjs.map +1 -1
- package/dist/cjs/components/chart/polar-chart.cjs.map +1 -1
- package/dist/cjs/components/checkbox/checkbox-group.cjs.map +1 -1
- package/dist/cjs/components/checkbox/checkbox.cjs.map +1 -1
- package/dist/cjs/components/checkbox-card/checkbox-card-group.cjs.map +1 -1
- 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/collapse/collapse.cjs.map +1 -1
- package/dist/cjs/components/color-picker/color-picker.cjs.map +1 -1
- package/dist/cjs/components/color-selector/color-selector.cjs.map +1 -1
- package/dist/cjs/components/color-swatch/color-swatch-group.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.map +1 -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.map +1 -1
- package/dist/cjs/components/dropzone/dropzone.cjs.map +1 -1
- package/dist/cjs/components/editable/editable.cjs.map +1 -1
- package/dist/cjs/components/empty-state/empty-state.cjs.map +1 -1
- package/dist/cjs/components/fade/fade.cjs.map +1 -1
- package/dist/cjs/components/fade-scale/fade-scale.cjs.map +1 -1
- package/dist/cjs/components/field/field.cjs.map +1 -1
- package/dist/cjs/components/fieldset/fieldset.cjs.map +1 -1
- package/dist/cjs/components/file-input/file-input.cjs.map +1 -1
- package/dist/cjs/components/flip/flip.cjs.map +1 -1
- package/dist/cjs/components/focus-lock/focus-lock.cjs.map +1 -1
- package/dist/cjs/components/form/form.cjs.map +1 -1
- package/dist/cjs/components/format/format-byte.cjs.map +1 -1
- package/dist/cjs/components/format/format-date-time.cjs.map +1 -1
- package/dist/cjs/components/format/format-number.cjs.map +1 -1
- package/dist/cjs/components/highlight/highlight.cjs.map +1 -1
- package/dist/cjs/components/hue-slider/hue-slider.cjs.map +1 -1
- package/dist/cjs/components/icon/icons/circle-euro-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/circle-euro-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/index.cjs +9 -3
- package/dist/cjs/components/icon/icons/index.cjs.map +1 -1
- package/dist/cjs/components/icon/icons/scan-box-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/scan-box-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/icons/server-plus-icon.cjs +14 -0
- package/dist/cjs/components/icon/icons/server-plus-icon.cjs.map +1 -0
- package/dist/cjs/components/icon/index.cjs +6 -2
- package/dist/cjs/components/indicator/indicator.cjs.map +1 -1
- package/dist/cjs/components/infinite-scroll-area/infinite-scroll-area.cjs.map +1 -1
- package/dist/cjs/components/input/input-group.cjs.map +1 -1
- package/dist/cjs/components/link-box/link-box.cjs.map +1 -1
- 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.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.map +1 -1
- package/dist/cjs/components/loading/oval.cjs.map +1 -1
- 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.map +1 -1
- package/dist/cjs/components/loading/suspense.cjs.map +1 -1
- package/dist/cjs/components/menu/menu.cjs.map +1 -1
- package/dist/cjs/components/menu/use-menu.cjs.map +1 -1
- package/dist/cjs/components/modal/modal.cjs.map +1 -1
- package/dist/cjs/components/native-accordion/native-accordion.cjs.map +1 -1
- package/dist/cjs/components/native-popover/native-popover.cjs.map +1 -1
- package/dist/cjs/components/native-select/native-select.cjs.map +1 -1
- package/dist/cjs/components/native-select/use-native-select.cjs.map +1 -1
- package/dist/cjs/components/native-table/native-table.cjs.map +1 -1
- package/dist/cjs/components/notice/notice-provider.cjs.map +1 -1
- package/dist/cjs/components/notice/notice.cjs.map +1 -1
- package/dist/cjs/components/notice/use-notice.cjs.map +1 -1
- package/dist/cjs/components/number-input/number-input.cjs.map +1 -1
- package/dist/cjs/components/pagination/pagination.cjs.map +1 -1
- package/dist/cjs/components/password-input/password-input.cjs.map +1 -1
- package/dist/cjs/components/password-input/strength-meter.cjs.map +1 -1
- package/dist/cjs/components/picture/picture.cjs.map +1 -1
- package/dist/cjs/components/pin-input/pin-input.cjs.map +1 -1
- package/dist/cjs/components/popover/popover.cjs.map +1 -1
- package/dist/cjs/components/progress/progress.cjs.map +1 -1
- package/dist/cjs/components/qr-code/qr-code.cjs.map +1 -1
- package/dist/cjs/components/radio/radio-group.cjs.map +1 -1
- package/dist/cjs/components/radio/radio.cjs.map +1 -1
- package/dist/cjs/components/radio-card/radio-card-group.cjs.map +1 -1
- package/dist/cjs/components/radio-card/radio-card.cjs.map +1 -1
- package/dist/cjs/components/rating/rating.cjs.map +1 -1
- package/dist/cjs/components/reorder/reorder.cjs.map +1 -1
- package/dist/cjs/components/resizable/resizable.cjs.map +1 -1
- package/dist/cjs/components/ripple/ripple.cjs.map +1 -1
- package/dist/cjs/components/rotate/rotate.cjs.map +1 -1
- package/dist/cjs/components/saturation-slider/saturation-slider.cjs.map +1 -1
- package/dist/cjs/components/saturation-slider/use-saturation-slider.cjs.map +1 -1
- package/dist/cjs/components/segmented-control/segmented-control.cjs.map +1 -1
- package/dist/cjs/components/select/select.cjs.map +1 -1
- package/dist/cjs/components/select/use-select.cjs.map +1 -1
- package/dist/cjs/components/sidebar/sidebar.cjs.map +1 -1
- package/dist/cjs/components/skeleton/skeleton-text.cjs.map +1 -1
- package/dist/cjs/components/slide/slide.cjs.map +1 -1
- package/dist/cjs/components/slide-fade/slide-fade.cjs.map +1 -1
- package/dist/cjs/components/slider/slider.cjs.map +1 -1
- package/dist/cjs/components/slot/slot.cjs.map +1 -1
- package/dist/cjs/components/snacks/snacks.cjs.map +1 -1
- package/dist/cjs/components/stack/stack.cjs.map +1 -1
- package/dist/cjs/components/stack/z-stack.cjs.map +1 -1
- package/dist/cjs/components/stat/stat.cjs.map +1 -1
- package/dist/cjs/components/status/status.cjs.map +1 -1
- package/dist/cjs/components/steps/steps.cjs.map +1 -1
- package/dist/cjs/components/switch/switch.cjs.map +1 -1
- package/dist/cjs/components/table/table.cjs.map +1 -1
- package/dist/cjs/components/tabs/tabs.cjs.map +1 -1
- package/dist/cjs/components/tag/tag.cjs.map +1 -1
- 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.map +1 -1
- package/dist/cjs/components/tooltip/tooltip.cjs.map +1 -1
- package/dist/cjs/components/tree/tree.cjs.map +1 -1
- package/dist/cjs/components/tree/use-tree.cjs.map +1 -1
- package/dist/cjs/core/components/create-component.cjs.map +1 -1
- package/dist/cjs/core/system/breakpoint.cjs.map +1 -1
- package/dist/cjs/core/system/environment-provider.cjs.map +1 -1
- package/dist/cjs/core/system/styled.cjs.map +1 -1
- package/dist/cjs/core/system/theme-provider.cjs.map +1 -1
- package/dist/cjs/hooks/use-async-callback/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-breakpoint/use-breakpoint.cjs.map +1 -1
- package/dist/cjs/hooks/use-combobox/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-field-sizing/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-outside-click/index.cjs.map +1 -1
- package/dist/cjs/index.cjs +9 -3
- package/dist/cjs/providers/ui-provider/ui-provider.cjs.map +1 -1
- package/dist/cjs/utils/store.cjs.map +1 -1
- package/dist/esm/components/accordion/accordion.js.map +1 -1
- package/dist/esm/components/action-bar/action-bar.js.map +1 -1
- package/dist/esm/components/airy/airy.js.map +1 -1
- 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/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.map +1 -1
- package/dist/esm/components/avatar/avatar.js.map +1 -1
- package/dist/esm/components/blockquote/blockquote.js.map +1 -1
- package/dist/esm/components/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/esm/components/button/button-group.js.map +1 -1
- 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.map +1 -1
- package/dist/esm/components/chart/cartesian-chart.js.map +1 -1
- package/dist/esm/components/chart/chart.js.map +1 -1
- package/dist/esm/components/chart/polar-chart.js.map +1 -1
- package/dist/esm/components/checkbox/checkbox-group.js.map +1 -1
- package/dist/esm/components/checkbox/checkbox.js.map +1 -1
- package/dist/esm/components/checkbox-card/checkbox-card-group.js.map +1 -1
- package/dist/esm/components/checkbox-card/checkbox-card.js.map +1 -1
- package/dist/esm/components/circle-progress/circle-progress.js.map +1 -1
- package/dist/esm/components/collapse/collapse.js.map +1 -1
- package/dist/esm/components/color-picker/color-picker.js.map +1 -1
- package/dist/esm/components/color-selector/color-selector.js.map +1 -1
- package/dist/esm/components/color-swatch/color-swatch-group.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.map +1 -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/dropzone/dropzone.js.map +1 -1
- package/dist/esm/components/editable/editable.js.map +1 -1
- package/dist/esm/components/empty-state/empty-state.js.map +1 -1
- package/dist/esm/components/fade/fade.js.map +1 -1
- package/dist/esm/components/fade-scale/fade-scale.js.map +1 -1
- package/dist/esm/components/field/field.js.map +1 -1
- package/dist/esm/components/fieldset/fieldset.js.map +1 -1
- package/dist/esm/components/file-input/file-input.js.map +1 -1
- package/dist/esm/components/flip/flip.js.map +1 -1
- package/dist/esm/components/focus-lock/focus-lock.js.map +1 -1
- package/dist/esm/components/form/form.js.map +1 -1
- package/dist/esm/components/format/format-byte.js.map +1 -1
- package/dist/esm/components/format/format-date-time.js.map +1 -1
- package/dist/esm/components/format/format-number.js.map +1 -1
- package/dist/esm/components/highlight/highlight.js.map +1 -1
- package/dist/esm/components/hue-slider/hue-slider.js.map +1 -1
- package/dist/esm/components/icon/icons/circle-euro-icon.js +14 -0
- package/dist/esm/components/icon/icons/circle-euro-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/index.js +7 -3
- package/dist/esm/components/icon/icons/index.js.map +1 -1
- package/dist/esm/components/icon/icons/scan-box-icon.js +14 -0
- package/dist/esm/components/icon/icons/scan-box-icon.js.map +1 -0
- package/dist/esm/components/icon/icons/server-plus-icon.js +14 -0
- package/dist/esm/components/icon/icons/server-plus-icon.js.map +1 -0
- package/dist/esm/components/icon/index.js +4 -2
- package/dist/esm/components/indicator/indicator.js.map +1 -1
- package/dist/esm/components/infinite-scroll-area/infinite-scroll-area.js.map +1 -1
- package/dist/esm/components/input/input-group.js.map +1 -1
- package/dist/esm/components/link-box/link-box.js.map +1 -1
- package/dist/esm/components/list/list.js.map +1 -1
- package/dist/esm/components/loading/audio.js.map +1 -1
- package/dist/esm/components/loading/background.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/page.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/screen.js.map +1 -1
- package/dist/esm/components/loading/suspense.js.map +1 -1
- 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/native-accordion/native-accordion.js.map +1 -1
- package/dist/esm/components/native-popover/native-popover.js.map +1 -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/native-table/native-table.js.map +1 -1
- package/dist/esm/components/notice/notice-provider.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.map +1 -1
- package/dist/esm/components/pagination/pagination.js.map +1 -1
- package/dist/esm/components/password-input/password-input.js.map +1 -1
- package/dist/esm/components/password-input/strength-meter.js.map +1 -1
- package/dist/esm/components/picture/picture.js.map +1 -1
- package/dist/esm/components/pin-input/pin-input.js.map +1 -1
- package/dist/esm/components/popover/popover.js.map +1 -1
- package/dist/esm/components/progress/progress.js.map +1 -1
- package/dist/esm/components/qr-code/qr-code.js.map +1 -1
- package/dist/esm/components/radio/radio-group.js.map +1 -1
- package/dist/esm/components/radio/radio.js.map +1 -1
- package/dist/esm/components/radio-card/radio-card-group.js.map +1 -1
- package/dist/esm/components/radio-card/radio-card.js.map +1 -1
- package/dist/esm/components/rating/rating.js.map +1 -1
- package/dist/esm/components/reorder/reorder.js.map +1 -1
- package/dist/esm/components/resizable/resizable.js.map +1 -1
- package/dist/esm/components/ripple/ripple.js.map +1 -1
- package/dist/esm/components/rotate/rotate.js.map +1 -1
- package/dist/esm/components/saturation-slider/saturation-slider.js.map +1 -1
- package/dist/esm/components/saturation-slider/use-saturation-slider.js.map +1 -1
- package/dist/esm/components/segmented-control/segmented-control.js.map +1 -1
- 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/sidebar/sidebar.js.map +1 -1
- package/dist/esm/components/skeleton/skeleton-text.js.map +1 -1
- package/dist/esm/components/slide/slide.js.map +1 -1
- package/dist/esm/components/slide-fade/slide-fade.js.map +1 -1
- package/dist/esm/components/slider/slider.js.map +1 -1
- package/dist/esm/components/slot/slot.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.map +1 -1
- package/dist/esm/components/stat/stat.js.map +1 -1
- package/dist/esm/components/status/status.js.map +1 -1
- package/dist/esm/components/steps/steps.js.map +1 -1
- package/dist/esm/components/switch/switch.js.map +1 -1
- package/dist/esm/components/table/table.js.map +1 -1
- package/dist/esm/components/tabs/tabs.js.map +1 -1
- package/dist/esm/components/tag/tag.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.map +1 -1
- package/dist/esm/components/tooltip/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.map +1 -1
- package/dist/esm/core/system/breakpoint.js.map +1 -1
- package/dist/esm/core/system/environment-provider.js.map +1 -1
- package/dist/esm/core/system/styled.js.map +1 -1
- package/dist/esm/core/system/theme-provider.js.map +1 -1
- package/dist/esm/hooks/use-breakpoint/use-breakpoint.js.map +1 -1
- package/dist/esm/hooks/use-combobox/index.js.map +1 -1
- package/dist/esm/hooks/use-field-sizing/index.js.map +1 -1
- package/dist/esm/hooks/use-outside-click/index.js.map +1 -1
- package/dist/esm/index.js +7 -3
- package/dist/esm/providers/ui-provider/ui-provider.js.map +1 -1
- package/dist/esm/utils/store.js.map +1 -1
- package/dist/types/components/avatar/avatar.d.ts +3 -3
- package/dist/types/components/avatar/avatar.style.d.ts +1 -1
- package/dist/types/components/data-list/data-list.style.d.ts +1 -1
- package/dist/types/components/field/field.style.d.ts +2 -2
- package/dist/types/components/fieldset/fieldset.style.d.ts +1 -1
- package/dist/types/components/icon/icons/circle-euro-icon.d.ts +13 -0
- package/dist/types/components/icon/icons/index.d.ts +5 -3
- package/dist/types/components/icon/icons/index.types.d.ts +1 -1
- package/dist/types/components/icon/icons/scan-box-icon.d.ts +13 -0
- package/dist/types/components/icon/icons/server-plus-icon.d.ts +13 -0
- package/dist/types/components/icon/index.d.ts +4 -2
- package/dist/types/components/menu/use-menu.d.ts +1 -1
- package/dist/types/components/number-input/number-input.style.d.ts +1 -1
- package/dist/types/components/steps/steps.style.d.ts +1 -1
- package/dist/types/components/timeline/timeline.d.ts +1 -1
- package/dist/types/components/timeline/timeline.style.d.ts +1 -1
- package/dist/types/index.d.ts +5 -3
- package/package.json +5 -5
- package/dist/cjs/components/icon/icons/circle-euro-sign-icon.cjs +0 -14
- package/dist/cjs/components/icon/icons/circle-euro-sign-icon.cjs.map +0 -1
- package/dist/esm/components/icon/icons/circle-euro-sign-icon.js +0 -14
- package/dist/esm/components/icon/icons/circle-euro-sign-icon.js.map +0 -1
- package/dist/types/components/icon/icons/circle-euro-sign-icon.d.ts +0 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha-slider.js","names":["HueSlider.Root","HueSlider.Overlay","HueSlider.Track","HueSlider.Thumb"],"sources":["../../../../src/components/alpha-slider/alpha-slider.tsx"],"sourcesContent":["\"use client\"\n\nimport type { WithoutThemeProps } from \"../../core\"\nimport type { AlphaSliderStyle } from \"./alpha-slider.style\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent } from \"../../core\"\nimport { useValue } from \"../../hooks/use-value\"\nimport { alphaToHex, convertColor } from \"../../utils\"\nimport { checkersProps } from \"../color-swatch\"\nimport { HueSlider } from \"../hue-slider\"\nimport { alphaSliderStyle } from \"./alpha-slider.style\"\n\ninterface ComponentContext extends Pick<\n Required<AlphaSliderRootProps>,\n \"color\" | \"max\" | \"min\" | \"orientation\"\n> {}\n\nexport const getAriaValueText = (alpha: number) => `${alpha * 100}%`\n\nexport interface AlphaSliderRootProps extends WithoutThemeProps<\n Omit<\n HueSlider.RootProps,\n \"color\" | \"max\" | \"step\" | \"thumbProps\" | \"trackProps\"\n >,\n AlphaSliderStyle\n> {\n /**\n * The color used for the slider.\n */\n color: string\n /**\n * The maximum allowed value of the slider. Cannot be less than min.\n *\n * @default 1\n */\n max?: number\n /**\n * The step in which increments or decrements have to be made.\n *\n * @default 0.01\n */\n step?: number\n /**\n * Props for the overlay element.\n */\n overlayProps?: AlphaSliderOverlayProps\n /**\n * Props for the thumb element.\n */\n thumbProps?: AlphaSliderThumbProps\n /**\n * Props for the track element.\n */\n trackProps?: AlphaSliderTrackProps\n}\n\nconst {\n ComponentContext,\n PropsContext: AlphaSliderPropsContext,\n useComponentContext,\n usePropsContext: useAlphaSliderPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<\n AlphaSliderRootProps,\n AlphaSliderStyle,\n ComponentContext\n>(\"alpha-slider\", alphaSliderStyle)\n\nexport { AlphaSliderPropsContext, useAlphaSliderPropsContext }\n\n/**\n * `AlphaSlider` is a component used to allow the user to select color transparency.\n *\n * @see https://yamada-ui.com/docs/components/alpha-slider\n */\nexport const AlphaSliderRoot = withProvider<\"input\", AlphaSliderRootProps>(\n ({\n children,\n color,\n max = 1,\n min = 0,\n orientation: orientationProp = \"horizontal\",\n overlayProps,\n thumbProps,\n trackProps,\n ...rest\n }) => {\n const orientation = useValue(orientationProp)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return (\n <AlphaSliderTrack {...trackProps}>\n <AlphaSliderThumb {...thumbProps} />\n\n <AlphaSliderOverlay {...overlayProps} />\n </AlphaSliderTrack>\n )\n }, [children, overlayProps, thumbProps, trackProps])\n const context = useMemo(\n () => ({ color, max, min, orientation }),\n [color, min, max, orientation],\n )\n\n return (\n <ComponentContext value={context}>\n <HueSlider.Root max={max} min={min} orientation={orientation} {...rest}>\n {computedChildren}\n </HueSlider.Root>\n </ComponentContext>\n )\n },\n \"root\",\n)({ getAriaValueText, step: 0.01 })\n\nexport interface AlphaSliderOverlayProps extends HueSlider.OverlayProps {}\n\nexport const AlphaSliderOverlay = withContext<\"div\", AlphaSliderOverlayProps>(\n HueSlider.Overlay,\n \"overlay\",\n)(undefined, ({ layers, ...rest }) => {\n const { color, max, min, orientation } = useComponentContext()\n\n layers ??= [\n checkersProps,\n {\n bgGradient: `linear(${[\n orientation === \"horizontal\" ? \"to-r\" : \"to-t\",\n convertColor(color)(\"hex\") + alphaToHex(min),\n convertColor(color)(\"hex\") + alphaToHex(max),\n ].join(\", \")})`,\n boxShadow: \"inner\",\n },\n ]\n\n return { layers, ...rest }\n})\n\nexport interface AlphaSliderTrackProps extends HueSlider.TrackProps {}\n\nexport const AlphaSliderTrack = withContext<\"div\", AlphaSliderTrackProps>(\n HueSlider.Track,\n \"track\",\n)()\n\nexport interface AlphaSliderThumbProps extends HueSlider.ThumbProps {}\n\nexport const AlphaSliderThumb = withContext<\"div\", AlphaSliderThumbProps>(\n HueSlider.Thumb,\n \"thumb\",\n)()\n"],"mappings":";;;;;;;;;;AAiBA,MAAa,oBAAoB,UAAkB,GAAG,QAAQ,IAAI;AAuClE,MAAM,EACJ,kBACA,cAAc,yBACd,qBACA,iBAAiB,4BACjB,aACA,iBACE,oBAIF,gBAAgB,gBAAgB;;;;;;AASlC,MAAa,kBAAkB,cAC5B,EACC,UACA,OACA,MAAM,GACN,MAAM,GACN,aAAa,kBAAkB,cAC/B,cACA,YACA,YACA,GAAG,WACC;CACJ,MAAM,cAAc,SAAS,eAAe;CAC5C,MAAM,mBAAmB,cAAc;EACrC,IAAI,UAAU,OAAO;EAErB,OACE,qBAAC,kBAAD;GAAkB,GAAI;
|
|
1
|
+
{"version":3,"file":"alpha-slider.js","names":["HueSlider.Root","HueSlider.Overlay","HueSlider.Track","HueSlider.Thumb"],"sources":["../../../../src/components/alpha-slider/alpha-slider.tsx"],"sourcesContent":["\"use client\"\n\nimport type { WithoutThemeProps } from \"../../core\"\nimport type { AlphaSliderStyle } from \"./alpha-slider.style\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent } from \"../../core\"\nimport { useValue } from \"../../hooks/use-value\"\nimport { alphaToHex, convertColor } from \"../../utils\"\nimport { checkersProps } from \"../color-swatch\"\nimport { HueSlider } from \"../hue-slider\"\nimport { alphaSliderStyle } from \"./alpha-slider.style\"\n\ninterface ComponentContext extends Pick<\n Required<AlphaSliderRootProps>,\n \"color\" | \"max\" | \"min\" | \"orientation\"\n> {}\n\nexport const getAriaValueText = (alpha: number) => `${alpha * 100}%`\n\nexport interface AlphaSliderRootProps extends WithoutThemeProps<\n Omit<\n HueSlider.RootProps,\n \"color\" | \"max\" | \"step\" | \"thumbProps\" | \"trackProps\"\n >,\n AlphaSliderStyle\n> {\n /**\n * The color used for the slider.\n */\n color: string\n /**\n * The maximum allowed value of the slider. Cannot be less than min.\n *\n * @default 1\n */\n max?: number\n /**\n * The step in which increments or decrements have to be made.\n *\n * @default 0.01\n */\n step?: number\n /**\n * Props for the overlay element.\n */\n overlayProps?: AlphaSliderOverlayProps\n /**\n * Props for the thumb element.\n */\n thumbProps?: AlphaSliderThumbProps\n /**\n * Props for the track element.\n */\n trackProps?: AlphaSliderTrackProps\n}\n\nconst {\n ComponentContext,\n PropsContext: AlphaSliderPropsContext,\n useComponentContext,\n usePropsContext: useAlphaSliderPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<\n AlphaSliderRootProps,\n AlphaSliderStyle,\n ComponentContext\n>(\"alpha-slider\", alphaSliderStyle)\n\nexport { AlphaSliderPropsContext, useAlphaSliderPropsContext }\n\n/**\n * `AlphaSlider` is a component used to allow the user to select color transparency.\n *\n * @see https://yamada-ui.com/docs/components/alpha-slider\n */\nexport const AlphaSliderRoot = withProvider<\"input\", AlphaSliderRootProps>(\n ({\n children,\n color,\n max = 1,\n min = 0,\n orientation: orientationProp = \"horizontal\",\n overlayProps,\n thumbProps,\n trackProps,\n ...rest\n }) => {\n const orientation = useValue(orientationProp)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return (\n <AlphaSliderTrack {...trackProps}>\n <AlphaSliderThumb {...thumbProps} />\n\n <AlphaSliderOverlay {...overlayProps} />\n </AlphaSliderTrack>\n )\n }, [children, overlayProps, thumbProps, trackProps])\n const context = useMemo(\n () => ({ color, max, min, orientation }),\n [color, min, max, orientation],\n )\n\n return (\n <ComponentContext value={context}>\n <HueSlider.Root max={max} min={min} orientation={orientation} {...rest}>\n {computedChildren}\n </HueSlider.Root>\n </ComponentContext>\n )\n },\n \"root\",\n)({ getAriaValueText, step: 0.01 })\n\nexport interface AlphaSliderOverlayProps extends HueSlider.OverlayProps {}\n\nexport const AlphaSliderOverlay = withContext<\"div\", AlphaSliderOverlayProps>(\n HueSlider.Overlay,\n \"overlay\",\n)(undefined, ({ layers, ...rest }) => {\n const { color, max, min, orientation } = useComponentContext()\n\n layers ??= [\n checkersProps,\n {\n bgGradient: `linear(${[\n orientation === \"horizontal\" ? \"to-r\" : \"to-t\",\n convertColor(color)(\"hex\") + alphaToHex(min),\n convertColor(color)(\"hex\") + alphaToHex(max),\n ].join(\", \")})`,\n boxShadow: \"inner\",\n },\n ]\n\n return { layers, ...rest }\n})\n\nexport interface AlphaSliderTrackProps extends HueSlider.TrackProps {}\n\nexport const AlphaSliderTrack = withContext<\"div\", AlphaSliderTrackProps>(\n HueSlider.Track,\n \"track\",\n)()\n\nexport interface AlphaSliderThumbProps extends HueSlider.ThumbProps {}\n\nexport const AlphaSliderThumb = withContext<\"div\", AlphaSliderThumbProps>(\n HueSlider.Thumb,\n \"thumb\",\n)()\n"],"mappings":";;;;;;;;;;AAiBA,MAAa,oBAAoB,UAAkB,GAAG,QAAQ,IAAI;AAuClE,MAAM,EACJ,kBACA,cAAc,yBACd,qBACA,iBAAiB,4BACjB,aACA,iBACE,oBAIF,gBAAgB,gBAAgB;;;;;;AASlC,MAAa,kBAAkB,cAC5B,EACC,UACA,OACA,MAAM,GACN,MAAM,GACN,aAAa,kBAAkB,cAC/B,cACA,YACA,YACA,GAAG,WACC;CACJ,MAAM,cAAc,SAAS,eAAe;CAC5C,MAAM,mBAAmB,cAAc;EACrC,IAAI,UAAU,OAAO;EAErB,OACE,qBAAC,kBAAD;GAAkB,GAAI;GAAtB,UAAA,CACE,oBAAC,kBAAD,EAAkB,GAAI,WAAa,CAAA,GAEnC,oBAAC,oBAAD,EAAoB,GAAI,aAAe,CAAA,CACvB;;CAEtB,GAAG;EAAC;EAAU;EAAc;EAAY;CAAU,CAAC;CACnD,MAAM,UAAU,eACP;EAAE;EAAO;EAAK;EAAK;CAAY,IACtC;EAAC;EAAO;EAAK;EAAK;CAAW,CAC/B;CAEA,OACE,oBAAC,kBAAD;EAAkB,OAAO;EACvB,UAAA,oBAACA,eAAD;GAAqB;GAAU;GAAkB;GAAa,GAAI;GAC/D,UAAA;EACa,CAAA;CACA,CAAA;AAEtB,GACA,MACF,CAAC,CAAC;CAAE;CAAkB,MAAM;AAAK,CAAC;AAIlC,MAAa,qBAAqB,YAChCC,kBACA,SACF,CAAC,CAAC,KAAA,IAAY,EAAE,QAAQ,GAAG,WAAW;CACpC,MAAM,EAAE,OAAO,KAAK,KAAK,gBAAgB,oBAAoB;CAE7D,WAAW,CACT,eACA;EACE,YAAY,UAAU;GACpB,gBAAgB,eAAe,SAAS;IAC3B,GAAA,cAAA,aAAA,CAAA,KAAK,CAAC,CAAC,KAAK,KAAA,GAAA,cAAA,WAAA,CAAe,GAAG;IAC9B,GAAA,cAAA,aAAA,CAAA,KAAK,CAAC,CAAC,KAAK,KAAA,GAAA,cAAA,WAAA,CAAe,GAAG;EAC7C,CAAC,CAAC,KAAK,IAAI,EAAE;EACb,WAAW;CACb,CACF;CAEA,OAAO;EAAE;EAAQ,GAAG;CAAK;AAC3B,CAAC;AAID,MAAa,mBAAmB,YAC9BC,gBACA,OACF,CAAC,CAAC;AAIF,MAAa,mBAAmB,YAC9BC,gBACA,OACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.js","names":["Popover.Root","InputGroup.Root","Popover.Trigger","InputGroup.Element","Popover.Content"],"sources":["../../../../src/components/autocomplete/autocomplete.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type {\n ComboboxItem,\n UseComboboxGroupProps,\n} from \"../../hooks/use-combobox\"\nimport type { Merge } from \"../../utils\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { UsePopoverStyleProps, UsePopupAnimationProps } from \"../popover\"\nimport type { AutocompleteStyle } from \"./autocomplete.style\"\nimport type {\n UseAutocompleteOptionProps,\n UseAutocompleteProps,\n UseAutocompleteReturn,\n} from \"./use-autocomplete\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport {\n ComboboxContext,\n ComboboxDescendantsContext,\n ComboboxGroupContext,\n createComboboxChildren,\n createComboboxItem,\n useComboboxGroup,\n useComboboxGroupContext,\n} from \"../../hooks/use-combobox\"\nimport { cast, isArray } from \"../../utils\"\nimport { useGroupItemProps } from \"../group\"\nimport { CheckIcon, ChevronDownIcon, MinusIcon, XIcon } from \"../icon\"\nimport { InputGroup, useInputBorder, useInputPropsContext } from \"../input\"\nimport { Popover, usePopoverStyleProps } from \"../popover\"\nimport { autocompleteStyle } from \"./autocomplete.style\"\nimport {\n AutocompleteContext,\n useAutocomplete,\n useAutocompleteOption,\n} from \"./use-autocomplete\"\n\ninterface ComponentContext\n extends\n Pick<UseAutocompleteReturn, \"getInputProps\" | \"getSeparatorProps\">,\n Pick<\n AutocompleteRootProps,\n \"emptyIcon\" | \"emptyProps\" | \"groupProps\" | \"inputProps\" | \"optionProps\"\n > {}\n\nexport interface AutocompleteRootProps<Multiple extends boolean = false>\n extends\n Omit<\n HTMLStyledProps,\n \"defaultValue\" | \"filter\" | \"offset\" | \"onChange\" | \"ref\" | \"value\"\n >,\n Merge<UseAutocompleteProps<Multiple>, UsePopoverStyleProps>,\n UsePopupAnimationProps,\n ThemeProps<AutocompleteStyle>,\n UseInputBorderProps {\n /**\n * If `true`, display the clear icon.\n *\n * @default true\n */\n clearable?: boolean\n /**\n * The icon to be used in the clear button.\n */\n clearIcon?: ReactNode\n /**\n * The icon to be used in the empty element.\n */\n emptyIcon?: ReactNode\n /**\n * The icon to be used in the autocomplete.\n */\n icon?: ReactNode\n /**\n * Props for content element.\n */\n contentProps?: AutocompleteContentProps\n /**\n * The props for the end element.\n */\n elementProps?: InputGroup.ElementProps\n /**\n * Props for empty element.\n */\n emptyProps?: AutocompleteEmptyProps\n /**\n * Props for group element.\n */\n groupProps?: Omit<AutocompleteGroupProps, \"children\" | \"label\">\n /**\n * Props for icon element.\n */\n iconProps?: AutocompleteIconProps\n /**\n * The props for the input element.\n */\n inputProps?: HTMLStyledProps<\"input\">\n /**\n * Props for option element.\n */\n optionProps?: Omit<AutocompleteOptionProps, \"children\" | \"value\">\n /**\n * Props for root element.\n */\n rootProps?: InputGroup.RootProps\n}\n\nconst {\n ComponentContext,\n PropsContext: AutocompletePropsContext,\n useComponentContext,\n usePropsContext: useAutocompletePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<\n AutocompleteRootProps,\n AutocompleteStyle,\n ComponentContext\n>(\"autocomplete\", autocompleteStyle)\n\nexport { AutocompletePropsContext, useAutocompletePropsContext }\n\n/**\n * `Autocomplete` is a component used to display suggestions in response to user text input.\n *\n * @see https://yamada-ui.com/docs/components/autocomplete\n */\nexport const AutocompleteRoot = withProvider(\n <Multiple extends boolean = false>(\n props: AutocompleteRootProps<Multiple>,\n ) => {\n const [\n groupItemProps,\n {\n className,\n css,\n colorScheme,\n animationScheme = \"block-start\",\n children,\n clearable = true,\n clearIcon = <XIcon />,\n duration,\n emptyIcon,\n errorBorderColor,\n focusBorderColor,\n icon,\n items: itemsProp,\n contentProps,\n elementProps,\n emptyProps,\n groupProps,\n iconProps,\n inputProps,\n optionProps,\n rootProps,\n ...rest\n },\n ] = useGroupItemProps(props)\n const popoverStyleProps = usePopoverStyleProps(rest)\n const items = useMemo<ComboboxItem[]>(() => {\n if (itemsProp) return itemsProp\n\n return createComboboxItem(children, {\n Group: AutocompleteGroup,\n Label: AutocompleteLabel,\n Option: AutocompleteOption,\n })\n }, [itemsProp, children])\n const {\n children: fieldChildren,\n descendants,\n items: computedItems,\n max,\n value,\n getClearIconProps,\n getContentProps,\n getFieldProps,\n getIconProps,\n getInputProps,\n getRootProps,\n getSeparatorProps,\n popoverProps,\n onActiveDescendant,\n onClose,\n onSelect,\n } = useAutocomplete({ items, ...rest, ...popoverStyleProps })\n const mergedPopoverProps = useMemo<Popover.RootProps>(\n () => ({\n animationScheme,\n duration,\n ...popoverProps,\n }),\n [animationScheme, duration, popoverProps],\n )\n const computedChildren = useMemo(\n () =>\n createComboboxChildren(computedItems, {\n Empty: AutocompleteEmpty,\n Group: AutocompleteGroup,\n Option: AutocompleteOption,\n }),\n [computedItems],\n )\n const varProps = useInputBorder({ errorBorderColor, focusBorderColor })\n const comboboxContext = useMemo(\n () => ({ onActiveDescendant, onClose, onSelect }),\n [onActiveDescendant, onClose, onSelect],\n )\n const autocompleteContext = useMemo(() => ({ max, value }), [value, max])\n const componentContext = useMemo(\n () => ({\n emptyIcon,\n emptyProps,\n getInputProps,\n getSeparatorProps,\n groupProps,\n inputProps,\n optionProps,\n }),\n [\n emptyIcon,\n emptyProps,\n getInputProps,\n getSeparatorProps,\n groupProps,\n inputProps,\n optionProps,\n ],\n )\n const hasValue = isArray(value) ? !!value.length : !!value\n\n return (\n <ComboboxDescendantsContext value={descendants}>\n <ComboboxContext value={comboboxContext}>\n <AutocompleteContext value={autocompleteContext}>\n <ComponentContext value={componentContext}>\n <Popover.Root {...mergedPopoverProps}>\n <InputGroup.Root\n colorScheme={colorScheme}\n {...mergeProps(\n { className, css },\n getRootProps(groupItemProps),\n rootProps,\n )()}\n >\n <Popover.Trigger>\n <AutocompleteField {...getFieldProps({ ...varProps })}>\n {fieldChildren}\n </AutocompleteField>\n </Popover.Trigger>\n\n <InputGroup.Element\n {...{ clickable: clearable && hasValue, ...elementProps }}\n >\n {clearable && hasValue ? (\n <AutocompleteIcon\n icon={clearIcon}\n {...getClearIconProps(iconProps)}\n />\n ) : (\n <AutocompleteIcon\n icon={icon}\n {...getIconProps(iconProps)}\n />\n )}\n </InputGroup.Element>\n </InputGroup.Root>\n\n <AutocompleteContent\n {...cast<AutocompleteContentProps>(\n getContentProps(cast<HTMLProps>(contentProps)),\n )}\n >\n {computedChildren}\n </AutocompleteContent>\n </Popover.Root>\n </ComponentContext>\n </AutocompleteContext>\n </ComboboxContext>\n </ComboboxDescendantsContext>\n )\n },\n \"root\",\n)((props) => {\n const context = useInputPropsContext()\n\n return mergeProps(context, props)()\n}) as GenericsComponent<{\n <Multiple extends boolean = false>(\n props: AutocompleteRootProps<Multiple>,\n ): ReactElement\n}>\n\ninterface AutocompleteFieldProps extends HTMLStyledProps {}\n\nconst AutocompleteField = withContext<\"div\", AutocompleteFieldProps>(\n \"div\",\n \"field\",\n)({ \"data-group-propagate\": \"\" }, ({ children, ...rest }) => {\n const { getInputProps, inputProps } = useComponentContext()\n\n return {\n ...rest,\n children: (\n <>\n {children}\n <AutocompleteInput {...getInputProps(inputProps)} />\n </>\n ),\n }\n})\n\ninterface AutocompleteInputProps extends HTMLStyledProps<\"input\"> {}\n\nconst AutocompleteInput = withContext<\"input\", AutocompleteInputProps>(\n \"input\",\n \"input\",\n)()\n\ninterface AutocompleteIconProps extends HTMLStyledProps {\n icon?: ReactNode\n}\n\nconst AutocompleteIcon = withContext<\"div\", AutocompleteIconProps>(\n \"div\",\n \"icon\",\n)(undefined, ({ children, icon, ...rest }) => ({\n children: icon || children || <ChevronDownIcon />,\n ...rest,\n}))\n\ninterface AutocompleteContentProps extends Popover.ContentProps {}\n\nconst AutocompleteContent = withContext<\"div\", AutocompleteContentProps>(\n Popover.Content,\n \"content\",\n)()\n\nexport interface AutocompleteLabelProps extends HTMLStyledProps<\"span\"> {}\n\nexport const AutocompleteLabel = withContext<\"span\", AutocompleteLabelProps>(\n \"span\",\n \"label\",\n)(undefined, (props) => {\n const { getLabelProps } = useComboboxGroupContext()\n\n return getLabelProps(props)\n})\n\nexport interface AutocompleteGroupProps\n extends UseComboboxGroupProps, HTMLStyledProps {\n /**\n * The label of the group.\n */\n label?: ReactNode\n /**\n * Props for the label component.\n */\n labelProps?: AutocompleteLabelProps\n}\n\nexport const AutocompleteGroup = withContext<\"div\", AutocompleteGroupProps>(\n ({ children, label, labelProps, ...rest }) => {\n const { groupProps } = useComponentContext()\n const { getGroupProps, getLabelProps } = useComboboxGroup(\n mergeProps(groupProps, rest)(),\n )\n const context = useMemo(() => ({ getLabelProps }), [getLabelProps])\n\n return (\n <ComboboxGroupContext value={context}>\n <styled.div {...getGroupProps()}>\n {label ? (\n <AutocompleteLabel {...labelProps}>{label}</AutocompleteLabel>\n ) : null}\n {children}\n </styled.div>\n </ComboboxGroupContext>\n )\n },\n \"group\",\n)()\n\nexport interface AutocompleteOptionProps\n extends UseAutocompleteOptionProps, HTMLStyledProps {\n /**\n * The icon to be used in the autocomplete option.\n */\n icon?: ReactNode\n}\n\nexport const AutocompleteOption = withContext<\"div\", AutocompleteOptionProps>(\n ({ children, icon: iconProp, ...rest }) => {\n const { optionProps: { icon, ...optionProps } = {} } = useComponentContext()\n const { getIndicatorProps, getOptionProps } = useAutocompleteOption(\n mergeProps(optionProps, rest)(),\n )\n\n return (\n <styled.div {...getOptionProps()}>\n <AutocompleteIndicator {...getIndicatorProps()}>\n {iconProp ?? icon ?? <CheckIcon />}\n </AutocompleteIndicator>\n {children}\n </styled.div>\n )\n },\n \"option\",\n)()\n\ninterface AutocompleteEmptyProps extends HTMLStyledProps {\n /**\n * The icon to be used in the autocomplete option.\n */\n icon?: ReactNode\n}\n\nconst AutocompleteEmpty = withContext<\"div\", AutocompleteEmptyProps>(\n ({ children, icon, ...rest }) => {\n const { emptyIcon, emptyProps } = useComponentContext()\n\n return (\n <styled.div {...mergeProps(emptyProps, rest)()}>\n <AutocompleteIndicator>\n {icon ?? emptyIcon ?? <MinusIcon />}\n </AutocompleteIndicator>\n {children}\n </styled.div>\n )\n },\n \"empty\",\n)()\n\ninterface AutocompleteIndicatorProps extends HTMLStyledProps {}\n\nconst AutocompleteIndicator = withContext<\"div\", AutocompleteIndicatorProps>(\n \"div\",\n \"indicator\",\n)()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmHA,MAAM,EACJ,kBACA,cAAc,0BACd,qBACA,iBAAiB,6BACjB,aACA,iBACE,oBAIF,gBAAgB,iBAAi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WAAW;CAC/B,MAAM,EAAE,WAAW,eAAe,oBAAoB;CAEtD,OACE,qBAAC,OAAO,KAAR;EAAY,GAAI,WAAW,YAAY,IAAI,CAAC,CAAC;YAA7C,CACE,oBAAC,uBAAD,EAAA,UACG,QAAQ,aAAa,oBAAC,WAAD,CAAY,CAAA,EACb,CAAA,GACtB,QACS;;AAEhB,GACA,OACF,CAAC,CAAC;AAIF,MAAM,wBAAwB,YAC5B,OACA,WACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"autocomplete.js","names":["Popover.Root","InputGroup.Root","Popover.Trigger","InputGroup.Element","Popover.Content"],"sources":["../../../../src/components/autocomplete/autocomplete.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type {\n ComboboxItem,\n UseComboboxGroupProps,\n} from \"../../hooks/use-combobox\"\nimport type { Merge } from \"../../utils\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { UsePopoverStyleProps, UsePopupAnimationProps } from \"../popover\"\nimport type { AutocompleteStyle } from \"./autocomplete.style\"\nimport type {\n UseAutocompleteOptionProps,\n UseAutocompleteProps,\n UseAutocompleteReturn,\n} from \"./use-autocomplete\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport {\n ComboboxContext,\n ComboboxDescendantsContext,\n ComboboxGroupContext,\n createComboboxChildren,\n createComboboxItem,\n useComboboxGroup,\n useComboboxGroupContext,\n} from \"../../hooks/use-combobox\"\nimport { cast, isArray } from \"../../utils\"\nimport { useGroupItemProps } from \"../group\"\nimport { CheckIcon, ChevronDownIcon, MinusIcon, XIcon } from \"../icon\"\nimport { InputGroup, useInputBorder, useInputPropsContext } from \"../input\"\nimport { Popover, usePopoverStyleProps } from \"../popover\"\nimport { autocompleteStyle } from \"./autocomplete.style\"\nimport {\n AutocompleteContext,\n useAutocomplete,\n useAutocompleteOption,\n} from \"./use-autocomplete\"\n\ninterface ComponentContext\n extends\n Pick<UseAutocompleteReturn, \"getInputProps\" | \"getSeparatorProps\">,\n Pick<\n AutocompleteRootProps,\n \"emptyIcon\" | \"emptyProps\" | \"groupProps\" | \"inputProps\" | \"optionProps\"\n > {}\n\nexport interface AutocompleteRootProps<Multiple extends boolean = false>\n extends\n Omit<\n HTMLStyledProps,\n \"defaultValue\" | \"filter\" | \"offset\" | \"onChange\" | \"ref\" | \"value\"\n >,\n Merge<UseAutocompleteProps<Multiple>, UsePopoverStyleProps>,\n UsePopupAnimationProps,\n ThemeProps<AutocompleteStyle>,\n UseInputBorderProps {\n /**\n * If `true`, display the clear icon.\n *\n * @default true\n */\n clearable?: boolean\n /**\n * The icon to be used in the clear button.\n */\n clearIcon?: ReactNode\n /**\n * The icon to be used in the empty element.\n */\n emptyIcon?: ReactNode\n /**\n * The icon to be used in the autocomplete.\n */\n icon?: ReactNode\n /**\n * Props for content element.\n */\n contentProps?: AutocompleteContentProps\n /**\n * The props for the end element.\n */\n elementProps?: InputGroup.ElementProps\n /**\n * Props for empty element.\n */\n emptyProps?: AutocompleteEmptyProps\n /**\n * Props for group element.\n */\n groupProps?: Omit<AutocompleteGroupProps, \"children\" | \"label\">\n /**\n * Props for icon element.\n */\n iconProps?: AutocompleteIconProps\n /**\n * The props for the input element.\n */\n inputProps?: HTMLStyledProps<\"input\">\n /**\n * Props for option element.\n */\n optionProps?: Omit<AutocompleteOptionProps, \"children\" | \"value\">\n /**\n * Props for root element.\n */\n rootProps?: InputGroup.RootProps\n}\n\nconst {\n ComponentContext,\n PropsContext: AutocompletePropsContext,\n useComponentContext,\n usePropsContext: useAutocompletePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<\n AutocompleteRootProps,\n AutocompleteStyle,\n ComponentContext\n>(\"autocomplete\", autocompleteStyle)\n\nexport { AutocompletePropsContext, useAutocompletePropsContext }\n\n/**\n * `Autocomplete` is a component used to display suggestions in response to user text input.\n *\n * @see https://yamada-ui.com/docs/components/autocomplete\n */\nexport const AutocompleteRoot = withProvider(\n <Multiple extends boolean = false>(\n props: AutocompleteRootProps<Multiple>,\n ) => {\n const [\n groupItemProps,\n {\n className,\n css,\n colorScheme,\n animationScheme = \"block-start\",\n children,\n clearable = true,\n clearIcon = <XIcon />,\n duration,\n emptyIcon,\n errorBorderColor,\n focusBorderColor,\n icon,\n items: itemsProp,\n contentProps,\n elementProps,\n emptyProps,\n groupProps,\n iconProps,\n inputProps,\n optionProps,\n rootProps,\n ...rest\n },\n ] = useGroupItemProps(props)\n const popoverStyleProps = usePopoverStyleProps(rest)\n const items = useMemo<ComboboxItem[]>(() => {\n if (itemsProp) return itemsProp\n\n return createComboboxItem(children, {\n Group: AutocompleteGroup,\n Label: AutocompleteLabel,\n Option: AutocompleteOption,\n })\n }, [itemsProp, children])\n const {\n children: fieldChildren,\n descendants,\n items: computedItems,\n max,\n value,\n getClearIconProps,\n getContentProps,\n getFieldProps,\n getIconProps,\n getInputProps,\n getRootProps,\n getSeparatorProps,\n popoverProps,\n onActiveDescendant,\n onClose,\n onSelect,\n } = useAutocomplete({ items, ...rest, ...popoverStyleProps })\n const mergedPopoverProps = useMemo<Popover.RootProps>(\n () => ({\n animationScheme,\n duration,\n ...popoverProps,\n }),\n [animationScheme, duration, popoverProps],\n )\n const computedChildren = useMemo(\n () =>\n createComboboxChildren(computedItems, {\n Empty: AutocompleteEmpty,\n Group: AutocompleteGroup,\n Option: AutocompleteOption,\n }),\n [computedItems],\n )\n const varProps = useInputBorder({ errorBorderColor, focusBorderColor })\n const comboboxContext = useMemo(\n () => ({ onActiveDescendant, onClose, onSelect }),\n [onActiveDescendant, onClose, onSelect],\n )\n const autocompleteContext = useMemo(() => ({ max, value }), [value, max])\n const componentContext = useMemo(\n () => ({\n emptyIcon,\n emptyProps,\n getInputProps,\n getSeparatorProps,\n groupProps,\n inputProps,\n optionProps,\n }),\n [\n emptyIcon,\n emptyProps,\n getInputProps,\n getSeparatorProps,\n groupProps,\n inputProps,\n optionProps,\n ],\n )\n const hasValue = isArray(value) ? !!value.length : !!value\n\n return (\n <ComboboxDescendantsContext value={descendants}>\n <ComboboxContext value={comboboxContext}>\n <AutocompleteContext value={autocompleteContext}>\n <ComponentContext value={componentContext}>\n <Popover.Root {...mergedPopoverProps}>\n <InputGroup.Root\n colorScheme={colorScheme}\n {...mergeProps(\n { className, css },\n getRootProps(groupItemProps),\n rootProps,\n )()}\n >\n <Popover.Trigger>\n <AutocompleteField {...getFieldProps({ ...varProps })}>\n {fieldChildren}\n </AutocompleteField>\n </Popover.Trigger>\n\n <InputGroup.Element\n {...{ clickable: clearable && hasValue, ...elementProps }}\n >\n {clearable && hasValue ? (\n <AutocompleteIcon\n icon={clearIcon}\n {...getClearIconProps(iconProps)}\n />\n ) : (\n <AutocompleteIcon\n icon={icon}\n {...getIconProps(iconProps)}\n />\n )}\n </InputGroup.Element>\n </InputGroup.Root>\n\n <AutocompleteContent\n {...cast<AutocompleteContentProps>(\n getContentProps(cast<HTMLProps>(contentProps)),\n )}\n >\n {computedChildren}\n </AutocompleteContent>\n </Popover.Root>\n </ComponentContext>\n </AutocompleteContext>\n </ComboboxContext>\n </ComboboxDescendantsContext>\n )\n },\n \"root\",\n)((props) => {\n const context = useInputPropsContext()\n\n return mergeProps(context, props)()\n}) as GenericsComponent<{\n <Multiple extends boolean = false>(\n props: AutocompleteRootProps<Multiple>,\n ): ReactElement\n}>\n\ninterface AutocompleteFieldProps extends HTMLStyledProps {}\n\nconst AutocompleteField = withContext<\"div\", AutocompleteFieldProps>(\n \"div\",\n \"field\",\n)({ \"data-group-propagate\": \"\" }, ({ children, ...rest }) => {\n const { getInputProps, inputProps } = useComponentContext()\n\n return {\n ...rest,\n children: (\n <>\n {children}\n <AutocompleteInput {...getInputProps(inputProps)} />\n </>\n ),\n }\n})\n\ninterface AutocompleteInputProps extends HTMLStyledProps<\"input\"> {}\n\nconst AutocompleteInput = withContext<\"input\", AutocompleteInputProps>(\n \"input\",\n \"input\",\n)()\n\ninterface AutocompleteIconProps extends HTMLStyledProps {\n icon?: ReactNode\n}\n\nconst AutocompleteIcon = withContext<\"div\", AutocompleteIconProps>(\n \"div\",\n \"icon\",\n)(undefined, ({ children, icon, ...rest }) => ({\n children: icon || children || <ChevronDownIcon />,\n ...rest,\n}))\n\ninterface AutocompleteContentProps extends Popover.ContentProps {}\n\nconst AutocompleteContent = withContext<\"div\", AutocompleteContentProps>(\n Popover.Content,\n \"content\",\n)()\n\nexport interface AutocompleteLabelProps extends HTMLStyledProps<\"span\"> {}\n\nexport const AutocompleteLabel = withContext<\"span\", AutocompleteLabelProps>(\n \"span\",\n \"label\",\n)(undefined, (props) => {\n const { getLabelProps } = useComboboxGroupContext()\n\n return getLabelProps(props)\n})\n\nexport interface AutocompleteGroupProps\n extends UseComboboxGroupProps, HTMLStyledProps {\n /**\n * The label of the group.\n */\n label?: ReactNode\n /**\n * Props for the label component.\n */\n labelProps?: AutocompleteLabelProps\n}\n\nexport const AutocompleteGroup = withContext<\"div\", AutocompleteGroupProps>(\n ({ children, label, labelProps, ...rest }) => {\n const { groupProps } = useComponentContext()\n const { getGroupProps, getLabelProps } = useComboboxGroup(\n mergeProps(groupProps, rest)(),\n )\n const context = useMemo(() => ({ getLabelProps }), [getLabelProps])\n\n return (\n <ComboboxGroupContext value={context}>\n <styled.div {...getGroupProps()}>\n {label ? (\n <AutocompleteLabel {...labelProps}>{label}</AutocompleteLabel>\n ) : null}\n {children}\n </styled.div>\n </ComboboxGroupContext>\n )\n },\n \"group\",\n)()\n\nexport interface AutocompleteOptionProps\n extends UseAutocompleteOptionProps, HTMLStyledProps {\n /**\n * The icon to be used in the autocomplete option.\n */\n icon?: ReactNode\n}\n\nexport const AutocompleteOption = withContext<\"div\", AutocompleteOptionProps>(\n ({ children, icon: iconProp, ...rest }) => {\n const { optionProps: { icon, ...optionProps } = {} } = useComponentContext()\n const { getIndicatorProps, getOptionProps } = useAutocompleteOption(\n mergeProps(optionProps, rest)(),\n )\n\n return (\n <styled.div {...getOptionProps()}>\n <AutocompleteIndicator {...getIndicatorProps()}>\n {iconProp ?? icon ?? <CheckIcon />}\n </AutocompleteIndicator>\n {children}\n </styled.div>\n )\n },\n \"option\",\n)()\n\ninterface AutocompleteEmptyProps extends HTMLStyledProps {\n /**\n * The icon to be used in the autocomplete option.\n */\n icon?: ReactNode\n}\n\nconst AutocompleteEmpty = withContext<\"div\", AutocompleteEmptyProps>(\n ({ children, icon, ...rest }) => {\n const { emptyIcon, emptyProps } = useComponentContext()\n\n return (\n <styled.div {...mergeProps(emptyProps, rest)()}>\n <AutocompleteIndicator>\n {icon ?? emptyIcon ?? <MinusIcon />}\n </AutocompleteIndicator>\n {children}\n </styled.div>\n )\n },\n \"empty\",\n)()\n\ninterface AutocompleteIndicatorProps extends HTMLStyledProps {}\n\nconst AutocompleteIndicator = withContext<\"div\", AutocompleteIndicatorProps>(\n \"div\",\n \"indicator\",\n)()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmHA,MAAM,EACJ,kBACA,cAAc,0BACd,qBACA,iBAAiB,6BACjB,aACA,iBACE,oBAIF,gBAAgB,iBAAiB;;;;;;AASnC,MAAa,mBAAmB,cAE5B,UACG;CACH,MAAM,CACJ,gBACA,EACE,WACA,KACA,aACA,kBAAkB,eAClB,UACA,YAAY,MACZ,YAAY,oBAAC,OAAD,CAAQ,CAAA,GACpB,UACA,WACA,kBACA,kBACA,MACA,OAAO,WACP,cACA,cACA,YACA,YACA,WACA,YACA,aACA,WACA,GAAG,UAEH,kBAAkB,KAAK;CAC3B,MAAM,oBAAoB,qBAAqB,IAAI;CAUnD,MAAM,EACJ,UAAU,eACV,aACA,OAAO,eACP,KACA,OACA,mBACA,iBACA,eACA,cACA,eACA,cACA,mBACA,cACA,oBACA,SACA,aACE,gBAAgB;EAAE,OA1BR,cAA8B;GAC1C,IAAI,WAAW,OAAO;GAEtB,OAAO,mBAAmB,UAAU;IAClC,OAAO;IACP,OAAO;I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3C,MAAM,EAAE,eAAe,kBAAkB,iBACvC,WAAW,YAAY,IAAI,CAAC,CAAC,CAC/B;CAGA,OACE,oBAAC,sBAAD;EAAsB,OAHR,eAAe,EAAE,cAAc,IAAI,CAAC,aAAa,CAG5B;EACjC,UAAA,qBAAC,OAAO,KAAR;GAAY,GAAI,cAAc;GAA9B,UAAA,CACG,QACC,oBAAC,mBAAD;IAAmB,GAAI;IAAa,UAAA;GAAyB,CAAA,IAC3D,MACH,QACS;;CACQ,CAAA;AAE1B,GACA,OACF,CAAC,CAAC;AAUF,MAAa,qBAAqB,aAC/B,EAAE,UAAU,MAAM,UAAU,GAAG,WAAW;CACzC,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,gBAAgB,CAAC,MAAM,oBAAoB;CAC3E,MAAM,EAAE,mBAAmB,mBAAmB,sBAC5C,WAAW,aAAa,IAAI,CAAC,CAAC,CAChC;CAEA,OACE,qBAAC,OAAO,KAAR;EAAY,GAAI,eAAe;EAA/B,UAAA,CACE,oBAAC,uBAAD;GAAuB,GAAI,kBAAkB;GAC1C,UAAA,YAAY,QAAQ,oBAAC,WAAD,CAAY,CAAA;EACZ,CAAA,GACtB,QACS;;AAEhB,GACA,QACF,CAAC,CAAC;AASF,MAAM,oBAAoB,aACvB,EAAE,UAAU,MAAM,GAAG,WAAW;CAC/B,MAAM,EAAE,WAAW,eAAe,oBAAoB;CAEtD,OACE,qBAAC,OAAO,KAAR;EAAY,GAAI,WAAW,YAAY,IAAI,CAAC,CAAC;EAA7C,UAAA,CACE,oBAAC,uBAAD,EAAA,UACG,QAAQ,aAAa,oBAAC,WAAD,CAAY,CAAA,EACb,CAAA,GACtB,QACS;;AAEhB,GACA,OACF,CAAC,CAAC;AAIF,MAAM,wBAAwB,YAC5B,OACA,WACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-autocomplete.js","names":["createContext","match"],"sources":["../../../../src/components/autocomplete/use-autocomplete.tsx"],"sourcesContent":["\"use client\"\n\nimport type {\n ChangeEvent,\n FocusEvent,\n KeyboardEvent,\n MouseEvent,\n ReactNode,\n} from \"react\"\nimport type { HTMLProps, HTMLRefAttributes, PropGetter } from \"../../core\"\nimport type {\n ComboboxItem,\n ComboboxItemWithValue,\n UseComboboxItemProps,\n UseComboboxProps,\n} from \"../../hooks/use-combobox\"\nimport type { Dict } from \"../../utils\"\nimport type { FieldProps } from \"../field\"\nimport {\n cloneElement,\n isValidElement,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from \"react\"\nimport { useCombobox, useComboboxItem } from \"../../hooks/use-combobox\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n cast,\n contains,\n createContext,\n dataAttr,\n handlerAll,\n isArray,\n isComposing,\n isNumber,\n isString,\n isUndefined,\n match,\n mergeRefs,\n runIfFn,\n runKeyAction,\n useUpdateEffect,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\ninterface AutocompleteRenderProps extends ComboboxItemWithValue {\n count: number\n focused: boolean\n index: number\n separator: string\n onClear: () => void\n max?: number\n}\n\nexport interface AutocompleteItemRender {\n (props: AutocompleteRenderProps): ReactNode\n}\n\nconst defaultRender: AutocompleteItemRender = ({\n count,\n focused,\n index,\n label,\n max,\n separator,\n}) => {\n const last = count - 1 === index\n\n return (\n <span style={{ marginInlineEnd: \"var(--gap)\" }}>\n {label}\n {((!isNumber(max) || count < max) && focused) || !last ? separator : null}\n </span>\n )\n}\n\nconst getInputValue = (item?: ComboboxItemWithValue) =>\n isString(item?.label) ? item.label : (item?.query ?? \"\")\n\nexport interface AutocompleteFilter {\n (\n inputValue: string,\n items: ComboboxItem[],\n matcher: AutocompleteMatcher,\n ): ComboboxItem[]\n}\n\nconst defaultFilter: AutocompleteFilter = (inputValue, items, match) => {\n if (!inputValue.length) return items\n\n return items\n .map((item) => {\n if (\"items\" in item) {\n const items = item.items.filter((item) => {\n if (\"query\" in item)\n return isString(item.query) && match(item.query, inputValue)\n else if (isString(item.label))\n return isString(item.label) && match(item.label, inputValue)\n })\n\n if (items.length) return { ...item, items }\n } else if (\"query\" in item) {\n if (isString(item.query) && match(item.query, inputValue)) return item\n } else if (isString(item.label)) {\n if (isString(item.label) && match(item.label, inputValue)) return item\n }\n })\n .filter(Boolean) as ComboboxItem[]\n}\n\nexport type AutocompleteMatcher = typeof match\n\ninterface AutocompleteContext extends Pick<\n UseAutocompleteReturn,\n \"max\" | \"value\"\n> {}\n\nconst [AutocompleteContext, useAutocompleteContext] =\n createContext<AutocompleteContext>({\n name: \"AutocompleteContext\",\n })\n\nexport { AutocompleteContext, useAutocompleteContext }\n\nexport interface UseAutocompleteProps<Multiple extends boolean = false>\n extends\n Omit<HTMLProps, \"defaultValue\" | \"onChange\" | \"ref\" | \"value\">,\n Omit<\n UseComboboxProps,\n \"defaultValue\" | \"initialFocusValue\" | \"onChange\" | \"ref\" | \"value\"\n >,\n HTMLRefAttributes<\"input\">,\n FieldProps {\n /**\n * If `true`, the autocomplete will allow custom value.\n *\n * @default false\n */\n allowCustomValue?: boolean\n /**\n * If `true`, the autocomplete will be closed when the input value changes.\n *\n * @default false\n */\n closeOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * The initial value of the input.\n */\n defaultInputValue?: string\n /**\n * The initial value of the autocomplete.\n */\n defaultValue?: Multiple extends true ? string[] : string\n /**\n * The message displayed when the search yields no hits.\n *\n * @default 'No results found'\n */\n emptyMessage?: ReactNode\n /**\n * The function to filter the items.\n */\n filter?: AutocompleteFilter\n /**\n * If `true`, the input will be focused when the clear icon is clicked.\n *\n * @default true\n */\n focusOnClear?: boolean\n /**\n * The `id` attribute of the input element.\n */\n id?: string\n /**\n * The value of the input.\n */\n inputValue?: string\n /**\n * If provided, generate options based on items.\n *\n * @default []\n */\n items?: ComboboxItem[]\n /**\n * The function to match the items.\n */\n matcher?: AutocompleteMatcher\n /**\n * The maximum selectable value.\n */\n max?: number\n /**\n * If `true`, the autocomplete will be multiple.\n *\n * @default false\n */\n multiple?: Multiple\n /**\n * The `name` attribute of the input element.\n */\n name?: string\n /**\n * If `true`, the autocomplete will be opened when the input value changes.\n *\n * @default true\n */\n openOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * If `true`, the autocomplete will be opened when the input is focused.\n *\n * @default true\n */\n openOnFocus?: boolean\n /**\n * The placeholder for autocomplete.\n */\n placeholder?: string\n /**\n * The visual separator between each value.\n *\n * @default ','\n */\n separator?: string\n /**\n * The value of the autocomplete.\n */\n value?: Multiple extends true ? string[] : string\n /**\n * The callback invoked when value state changes.\n */\n onChange?: (value: Multiple extends true ? string[] : string) => void\n /**\n * The callback invoked when input value state changes.\n */\n onInputChange?: (value: string) => void\n /**\n * The function to render the selected items.\n */\n render?: (props: AutocompleteRenderProps) => ReactNode\n}\n\nexport const useAutocomplete = <Multiple extends boolean = false>(\n props: UseAutocompleteProps<Multiple> = {},\n) => {\n type MaybeValue = Multiple extends true ? string[] : string\n\n const { t } = useI18n(\"autocomplete\")\n const {\n props: {\n id,\n ref,\n name,\n allowCustomValue = false,\n closeOnChange = false,\n multiple = false,\n closeOnSelect = !multiple,\n defaultInputValue,\n defaultValue = (multiple ? [] : \"\") as MaybeValue,\n disabled,\n emptyMessage = t(\"No results found\"),\n filter = defaultFilter,\n focusOnClear = true,\n inputValue: inputValueProp,\n items = [],\n matcher = match,\n max,\n openOnChange = true,\n openOnClick = true,\n openOnFocus = true,\n placeholder,\n readOnly,\n render = defaultRender,\n required,\n separator = \",\",\n value: valueProp,\n onChange: onChangeProp,\n onInputChange: onInputChangeProp,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const fieldRef = useRef<HTMLDivElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const inputRef = useRef<HTMLInputElement>(null)\n const focusByClickRef = useRef<boolean>(false)\n const valueMap = useMemo<{ [key: string]: ComboboxItemWithValue }>(() => {\n const valueMap: { [key: string]: ComboboxItemWithValue } = {}\n\n items.forEach((item) => {\n if (\"items\" in item) {\n item.items.forEach((item) => {\n item.value ??= isString(item.label) ? item.label : undefined\n\n if (!isUndefined(item.value)) valueMap[item.value] = item\n })\n } else {\n item.value ??= isString(item.label) ? item.label : undefined\n\n if (!isUndefined(item.value)) valueMap[item.value] = item\n }\n })\n\n return valueMap\n }, [items])\n const [focused, setFocused] = useState(false)\n const [value, setValue] = useControllableState({\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n })\n const [inputValue, setInputValue] = useControllableState({\n defaultValue:\n defaultInputValue ??\n getInputValue(isString(value) ? valueMap[value] : undefined),\n value: inputValueProp,\n onChange: onInputChangeProp,\n })\n const onChange = useCallback(\n (selectedValue: string) => {\n setValue((prev) => {\n if (isArray(prev))\n if (prev.includes(selectedValue))\n return prev.filter(\n (prevValue) => prevValue !== selectedValue,\n ) as MaybeValue\n else if (!isNumber(max) || prev.length < max)\n return [...prev, selectedValue] as MaybeValue\n else return prev\n else return selectedValue as MaybeValue\n })\n\n if (isArray(value)) {\n setInputValue(\"\")\n } else {\n const item = valueMap[selectedValue]\n\n setInputValue(getInputValue(item))\n }\n },\n [max, setInputValue, setValue, value, valueMap],\n )\n const {\n activeDescendant,\n descendants,\n interactive,\n open,\n getContentProps: getComboboxContentProps,\n getSeparatorProps,\n getTriggerProps,\n popoverProps,\n onActiveDescendant,\n onClose,\n onOpen,\n onOpenWithActiveDescendant,\n onSelect,\n } = useCombobox({\n closeOnSelect,\n disabled,\n initialFocusValue: isArray(value) ? value[0] : value,\n openOnClick: false,\n openOnEnter: false,\n openOnSpace: false,\n readOnly,\n selectFocusRef: inputRef,\n selectOnSpace: false,\n onChange,\n ...ariaProps,\n ...dataProps,\n ...eventProps,\n ...rest,\n })\n const filteredItems = useMemo<ComboboxItem[]>(() => {\n if (!items.length) return []\n\n return filter(inputValue, items, matcher)\n }, [filter, inputValue, items, matcher])\n const resolvedItems = useMemo<ComboboxItem[]>(() => {\n return filteredItems.length\n ? filteredItems\n : [{ \"data-empty\": \"\", label: emptyMessage }]\n }, [filteredItems, emptyMessage])\n const empty = useMemo(\n () => !resolvedItems.filter(({ hidden }) => !hidden).length,\n [resolvedItems],\n )\n const children = useMemo<ReactNode>(() => {\n if (!isArray(value)) return null\n\n const count = value.length\n\n return value.map((value, index) => {\n const item = valueMap[value] ?? { label: value, value }\n\n const onClear = (ev?: MouseEvent<HTMLElement>) => {\n ev?.preventDefault()\n ev?.stopPropagation()\n\n if (item.value) onChange(item.value)\n }\n\n const component = render({\n count,\n focused,\n index,\n max,\n separator,\n onClear,\n ...item,\n })\n\n if (isValidElement<Dict>(component))\n return cloneElement(component, { ...component.props, key: index })\n else return component\n })\n }, [focused, max, onChange, render, separator, value, valueMap])\n const hasValues = isArray(value) && !!value.length\n\n const onInputChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n if (isArray(value) && value.length === max) return\n\n if (runIfFn(closeOnChange, ev)) onClose()\n else if (runIfFn(openOnChange, ev)) onOpen()\n\n activeDescendant.current = null\n\n const inputValue = ev.target.value\n\n setInputValue(inputValue)\n\n if (inputValue.length || isArray(value)) return\n\n setValue(\"\" as MaybeValue)\n },\n [\n activeDescendant,\n closeOnChange,\n max,\n onClose,\n onOpen,\n openOnChange,\n setInputValue,\n setValue,\n value,\n ],\n )\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLInputElement>) => {\n if (disabled || isComposing(ev)) return\n\n const inputValue = cast<HTMLInputElement>(ev.target).value\n\n runKeyAction(\n ev,\n {\n Backspace: (ev) => {\n if (!isArray(value)) return\n if (inputValue.length) return\n\n ev.preventDefault()\n\n setValue((prev) => prev.slice(0, -1) as MaybeValue)\n },\n Enter: (ev) => {\n if (!open || !inputValue.length || activeDescendant.current) return\n\n const item = filteredItems[0]\n\n if (!item) {\n if (!allowCustomValue || !isArray(value)) return\n\n ev.preventDefault()\n\n onSelect(inputValue)\n } else {\n ev.preventDefault()\n\n if (\"items\" in item) onSelect(item.items[0]?.value)\n else onSelect(item.value)\n }\n },\n },\n { preventDefault: false },\n )\n },\n [\n activeDescendant,\n allowCustomValue,\n disabled,\n filteredItems,\n onSelect,\n open,\n setValue,\n value,\n ],\n )\n\n const onClick = useCallback(() => {\n if (!interactive) return\n\n focusByClickRef.current = true\n\n inputRef.current?.focus()\n\n if (openOnClick) onOpenWithActiveDescendant(descendants.enabledFirstValue)\n }, [descendants, interactive, onOpenWithActiveDescendant, openOnClick])\n\n const onMouseDown = useCallback(\n (ev: MouseEvent<HTMLInputElement>) => {\n if (!openOnFocus) return\n\n ev.preventDefault()\n ev.stopPropagation()\n },\n [openOnFocus],\n )\n\n const onFocus = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n ev.preventDefault()\n ev.stopPropagation()\n\n setFocused(true)\n\n if (openOnFocus && !focusByClickRef.current)\n onOpenWithActiveDescendant(descendants.enabledFirstValue)\n\n focusByClickRef.current = false\n },\n [openOnFocus, onOpenWithActiveDescendant, descendants.enabledFirstValue],\n )\n\n const onBlur = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n if (\n contains(fieldRef.current, ev.relatedTarget) ||\n contains(contentRef.current, ev.relatedTarget)\n ) {\n ev.preventDefault()\n } else {\n setFocused(false)\n\n if (isArray(value)) {\n setInputValue(\"\")\n } else if (allowCustomValue) {\n if (inputValue) setValue(inputValue as MaybeValue)\n } else {\n const item = isString(value) ? valueMap[value] : undefined\n\n setInputValue(getInputValue(item))\n }\n }\n },\n [allowCustomValue, inputValue, setInputValue, setValue, value, valueMap],\n )\n\n const onClear = useCallback(() => {\n if (!interactive) return\n\n setValue((prev) => (isArray(prev) ? [] : \"\") as MaybeValue)\n setInputValue(\"\")\n\n if (focusOnClear) inputRef.current?.focus()\n }, [focusOnClear, interactive, setInputValue, setValue])\n\n useUpdateEffect(() => {\n if (isArray(valueProp)) return\n\n setInputValue(\n getInputValue(isString(valueProp) ? valueMap[valueProp] : undefined),\n )\n }, [valueProp])\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({\n ...dataProps,\n ...props,\n }),\n [dataProps],\n )\n\n const getFieldProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getTriggerProps({\n ref: mergeRefs(ref, fieldRef),\n tabIndex: -1,\n ...props,\n onClick: handlerAll(props.onClick, onClick),\n }),\n\n [getTriggerProps, onClick],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) => ({\n id,\n ref: mergeRefs(props.ref, ref, inputRef),\n name,\n style: {\n ...(!focused && isArray(value) && !!value.length\n ? visuallyHiddenAttributes.style\n : {}),\n ...props.style,\n },\n \"data-max\": dataAttr(\n isArray(value) && isNumber(max) && value.length >= max,\n ),\n autoCapitalize: \"off\",\n autoComplete: \"off\",\n autoCorrect: \"off\",\n disabled,\n placeholder: hasValues ? undefined : placeholder,\n readOnly,\n required,\n spellCheck: false,\n value: inputValue,\n ...dataProps,\n ...props,\n onBlur: handlerAll(props.onBlur, onBlur),\n onChange: handlerAll(props.onChange, onInputChange),\n onFocus: handlerAll(props.onFocus, onFocus),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n onMouseDown: handlerAll(props.onMouseDown, onMouseDown),\n }),\n [\n dataProps,\n disabled,\n focused,\n hasValues,\n id,\n inputValue,\n max,\n name,\n onBlur,\n onFocus,\n onInputChange,\n onKeyDown,\n onMouseDown,\n placeholder,\n readOnly,\n ref,\n required,\n value,\n ],\n )\n\n const getContentProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getComboboxContentProps({\n ref: mergeRefs(ref, contentRef),\n hidden: empty,\n ...props,\n }),\n [empty, getComboboxContentProps],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props) => ({ ...dataProps, ...props }),\n [dataProps],\n )\n\n const getClearIconProps: PropGetter = useCallback(\n (props = {}) =>\n getIconProps({\n \"aria-disabled\": ariaAttr(!interactive),\n \"aria-label\": t(\"Clear value\"),\n role: \"button\",\n tabIndex: interactive ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onClear),\n onKeyDown: handlerAll(props.onKeyDown, (ev) =>\n runKeyAction(ev, { Enter: onClear, Space: onClear }),\n ),\n }),\n [getIconProps, interactive, onClear, t],\n )\n\n return {\n children,\n descendants,\n inputValue,\n interactive,\n items: resolvedItems,\n max,\n open,\n setInputValue,\n setValue,\n value,\n valueMap,\n getClearIconProps,\n getContentProps,\n getFieldProps,\n getIconProps,\n getInputProps,\n getRootProps,\n getSeparatorProps,\n popoverProps,\n onActiveDescendant,\n onChange,\n onClose,\n onInputChange,\n onOpen,\n onSelect,\n }\n}\n\nexport type UseAutocompleteReturn = ReturnType<typeof useAutocomplete>\n\nexport interface UseAutocompleteOptionProps extends UseComboboxItemProps {}\n\nexport const useAutocompleteOption = ({\n children,\n closeOnSelect,\n disabled,\n hidden,\n value,\n ...rest\n}: UseAutocompleteOptionProps = {}) => {\n const { max, value: selectedValue } = useAutocompleteContext()\n\n value ??= isString(children) ? children : undefined\n\n const selected = isArray(selectedValue)\n ? !isUndefined(value) && selectedValue.includes(value)\n : selectedValue === value\n const completed =\n isNumber(max) && isArray(selectedValue) && selectedValue.length >= max\n const { getIndicatorProps, getItemProps } = useComboboxItem({\n children,\n closeOnSelect,\n disabled: disabled || hidden || (completed && !selected),\n hidden,\n selected,\n value,\n ...rest,\n })\n\n const getOptionProps: PropGetter = useCallback(\n (props = {}) => getItemProps(props),\n [getItemProps],\n )\n\n return { getIndicatorProps, getOptionProps }\n}\n\nexport type UseAutocompleteOptionReturn = ReturnType<\n typeof useAutocompleteOption\n>\n"],"mappings":";;;;;;;;;;;;;AA+DA,MAAM,iBAAyC,EAC7C,OACA,SACA,OACA,OACA,KACA,gBACI;CACJ,MAAM,OAAO,QAAQ,MAAM;CAE3B,OACE,qBAAC,QAAD;EAAM,OAAO,EAAE,iBAAiB,aAAa;YAA7C,CACG,QACE,EAAA,GAAA,cAAA,SAAA,CAAU,GA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,GACH;GAAC;GAAc;GAAa;GAAS;EAAC,CAetB;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;AAMA,MAAa,yBAAyB,EACpC,UACA,eACA,UACA,QACA,OACA,GAAG,SAC2B,CAAC,MAAM;CACrC,MAAM,EAAE,KAAK,OAAO,kBAAkB,uBAAuB;CAE7D,WAAA,GAAA,cAAA,SAAA,CAAmB,QAAQ,IAAI,WAAW,KAAA;CAE1C,MAAM,YAAA,GAAA,cAAA,QAAA,CAAmB,aAAa,IAClC,EAAA,GAAA,cAAA,YAAA,CAAa,KAAK,KAAK,cAAc,SAAS,KAAK,IACnD,kBAAkB;CACtB,MAAM,aAAA,GAAA,cAAA,SAAA,CACK,GAAG,MAAA,GAAA,cAAA,QAAA,CAAa,aAAa,KAAK,cAAc,UAAU;CACrE,MAAM,EAAE,mBAAmB,iBAAiB,gBAAgB;EAC1D;EACA;EACA,UAAU,YAAY,UAAW,aAAa,CAAC;EAC/C;EACA;EACA;EACA,GAAG;CACL,CAAC;CAOD,OAAO;EAAE;EAAmB,gBALO,aAChC,QAAQ,CAAC,MAAM,aAAa,KAAK,GAClC,CAAC,YAAY,CAG0B;CAAE;AAC7C"}
|
|
1
|
+
{"version":3,"file":"use-autocomplete.js","names":["createContext","match"],"sources":["../../../../src/components/autocomplete/use-autocomplete.tsx"],"sourcesContent":["\"use client\"\n\nimport type {\n ChangeEvent,\n FocusEvent,\n KeyboardEvent,\n MouseEvent,\n ReactNode,\n} from \"react\"\nimport type { HTMLProps, HTMLRefAttributes, PropGetter } from \"../../core\"\nimport type {\n ComboboxItem,\n ComboboxItemWithValue,\n UseComboboxItemProps,\n UseComboboxProps,\n} from \"../../hooks/use-combobox\"\nimport type { Dict } from \"../../utils\"\nimport type { FieldProps } from \"../field\"\nimport {\n cloneElement,\n isValidElement,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from \"react\"\nimport { useCombobox, useComboboxItem } from \"../../hooks/use-combobox\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n cast,\n contains,\n createContext,\n dataAttr,\n handlerAll,\n isArray,\n isComposing,\n isNumber,\n isString,\n isUndefined,\n match,\n mergeRefs,\n runIfFn,\n runKeyAction,\n useUpdateEffect,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\n\ninterface AutocompleteRenderProps extends ComboboxItemWithValue {\n count: number\n focused: boolean\n index: number\n separator: string\n onClear: () => void\n max?: number\n}\n\nexport interface AutocompleteItemRender {\n (props: AutocompleteRenderProps): ReactNode\n}\n\nconst defaultRender: AutocompleteItemRender = ({\n count,\n focused,\n index,\n label,\n max,\n separator,\n}) => {\n const last = count - 1 === index\n\n return (\n <span style={{ marginInlineEnd: \"var(--gap)\" }}>\n {label}\n {((!isNumber(max) || count < max) && focused) || !last ? separator : null}\n </span>\n )\n}\n\nconst getInputValue = (item?: ComboboxItemWithValue) =>\n isString(item?.label) ? item.label : (item?.query ?? \"\")\n\nexport interface AutocompleteFilter {\n (\n inputValue: string,\n items: ComboboxItem[],\n matcher: AutocompleteMatcher,\n ): ComboboxItem[]\n}\n\nconst defaultFilter: AutocompleteFilter = (inputValue, items, match) => {\n if (!inputValue.length) return items\n\n return items\n .map((item) => {\n if (\"items\" in item) {\n const items = item.items.filter((item) => {\n if (\"query\" in item)\n return isString(item.query) && match(item.query, inputValue)\n else if (isString(item.label))\n return isString(item.label) && match(item.label, inputValue)\n })\n\n if (items.length) return { ...item, items }\n } else if (\"query\" in item) {\n if (isString(item.query) && match(item.query, inputValue)) return item\n } else if (isString(item.label)) {\n if (isString(item.label) && match(item.label, inputValue)) return item\n }\n })\n .filter(Boolean) as ComboboxItem[]\n}\n\nexport type AutocompleteMatcher = typeof match\n\ninterface AutocompleteContext extends Pick<\n UseAutocompleteReturn,\n \"max\" | \"value\"\n> {}\n\nconst [AutocompleteContext, useAutocompleteContext] =\n createContext<AutocompleteContext>({\n name: \"AutocompleteContext\",\n })\n\nexport { AutocompleteContext, useAutocompleteContext }\n\nexport interface UseAutocompleteProps<Multiple extends boolean = false>\n extends\n Omit<HTMLProps, \"defaultValue\" | \"onChange\" | \"ref\" | \"value\">,\n Omit<\n UseComboboxProps,\n \"defaultValue\" | \"initialFocusValue\" | \"onChange\" | \"ref\" | \"value\"\n >,\n HTMLRefAttributes<\"input\">,\n FieldProps {\n /**\n * If `true`, the autocomplete will allow custom value.\n *\n * @default false\n */\n allowCustomValue?: boolean\n /**\n * If `true`, the autocomplete will be closed when the input value changes.\n *\n * @default false\n */\n closeOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * The initial value of the input.\n */\n defaultInputValue?: string\n /**\n * The initial value of the autocomplete.\n */\n defaultValue?: Multiple extends true ? string[] : string\n /**\n * The message displayed when the search yields no hits.\n *\n * @default 'No results found'\n */\n emptyMessage?: ReactNode\n /**\n * The function to filter the items.\n */\n filter?: AutocompleteFilter\n /**\n * If `true`, the input will be focused when the clear icon is clicked.\n *\n * @default true\n */\n focusOnClear?: boolean\n /**\n * The `id` attribute of the input element.\n */\n id?: string\n /**\n * The value of the input.\n */\n inputValue?: string\n /**\n * If provided, generate options based on items.\n *\n * @default []\n */\n items?: ComboboxItem[]\n /**\n * The function to match the items.\n */\n matcher?: AutocompleteMatcher\n /**\n * The maximum selectable value.\n */\n max?: number\n /**\n * If `true`, the autocomplete will be multiple.\n *\n * @default false\n */\n multiple?: Multiple\n /**\n * The `name` attribute of the input element.\n */\n name?: string\n /**\n * If `true`, the autocomplete will be opened when the input value changes.\n *\n * @default true\n */\n openOnChange?: ((ev: ChangeEvent<HTMLInputElement>) => boolean) | boolean\n /**\n * If `true`, the autocomplete will be opened when the input is focused.\n *\n * @default true\n */\n openOnFocus?: boolean\n /**\n * The placeholder for autocomplete.\n */\n placeholder?: string\n /**\n * The visual separator between each value.\n *\n * @default ','\n */\n separator?: string\n /**\n * The value of the autocomplete.\n */\n value?: Multiple extends true ? string[] : string\n /**\n * The callback invoked when value state changes.\n */\n onChange?: (value: Multiple extends true ? string[] : string) => void\n /**\n * The callback invoked when input value state changes.\n */\n onInputChange?: (value: string) => void\n /**\n * The function to render the selected items.\n */\n render?: (props: AutocompleteRenderProps) => ReactNode\n}\n\nexport const useAutocomplete = <Multiple extends boolean = false>(\n props: UseAutocompleteProps<Multiple> = {},\n) => {\n type MaybeValue = Multiple extends true ? string[] : string\n\n const { t } = useI18n(\"autocomplete\")\n const {\n props: {\n id,\n ref,\n name,\n allowCustomValue = false,\n closeOnChange = false,\n multiple = false,\n closeOnSelect = !multiple,\n defaultInputValue,\n defaultValue = (multiple ? [] : \"\") as MaybeValue,\n disabled,\n emptyMessage = t(\"No results found\"),\n filter = defaultFilter,\n focusOnClear = true,\n inputValue: inputValueProp,\n items = [],\n matcher = match,\n max,\n openOnChange = true,\n openOnClick = true,\n openOnFocus = true,\n placeholder,\n readOnly,\n render = defaultRender,\n required,\n separator = \",\",\n value: valueProp,\n onChange: onChangeProp,\n onInputChange: onInputChangeProp,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps(props)\n const fieldRef = useRef<HTMLDivElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const inputRef = useRef<HTMLInputElement>(null)\n const focusByClickRef = useRef<boolean>(false)\n const valueMap = useMemo<{ [key: string]: ComboboxItemWithValue }>(() => {\n const valueMap: { [key: string]: ComboboxItemWithValue } = {}\n\n items.forEach((item) => {\n if (\"items\" in item) {\n item.items.forEach((item) => {\n item.value ??= isString(item.label) ? item.label : undefined\n\n if (!isUndefined(item.value)) valueMap[item.value] = item\n })\n } else {\n item.value ??= isString(item.label) ? item.label : undefined\n\n if (!isUndefined(item.value)) valueMap[item.value] = item\n }\n })\n\n return valueMap\n }, [items])\n const [focused, setFocused] = useState(false)\n const [value, setValue] = useControllableState({\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n })\n const [inputValue, setInputValue] = useControllableState({\n defaultValue:\n defaultInputValue ??\n getInputValue(isString(value) ? valueMap[value] : undefined),\n value: inputValueProp,\n onChange: onInputChangeProp,\n })\n const onChange = useCallback(\n (selectedValue: string) => {\n setValue((prev) => {\n if (isArray(prev))\n if (prev.includes(selectedValue))\n return prev.filter(\n (prevValue) => prevValue !== selectedValue,\n ) as MaybeValue\n else if (!isNumber(max) || prev.length < max)\n return [...prev, selectedValue] as MaybeValue\n else return prev\n else return selectedValue as MaybeValue\n })\n\n if (isArray(value)) {\n setInputValue(\"\")\n } else {\n const item = valueMap[selectedValue]\n\n setInputValue(getInputValue(item))\n }\n },\n [max, setInputValue, setValue, value, valueMap],\n )\n const {\n activeDescendant,\n descendants,\n interactive,\n open,\n getContentProps: getComboboxContentProps,\n getSeparatorProps,\n getTriggerProps,\n popoverProps,\n onActiveDescendant,\n onClose,\n onOpen,\n onOpenWithActiveDescendant,\n onSelect,\n } = useCombobox({\n closeOnSelect,\n disabled,\n initialFocusValue: isArray(value) ? value[0] : value,\n openOnClick: false,\n openOnEnter: false,\n openOnSpace: false,\n readOnly,\n selectFocusRef: inputRef,\n selectOnSpace: false,\n onChange,\n ...ariaProps,\n ...dataProps,\n ...eventProps,\n ...rest,\n })\n const filteredItems = useMemo<ComboboxItem[]>(() => {\n if (!items.length) return []\n\n return filter(inputValue, items, matcher)\n }, [filter, inputValue, items, matcher])\n const resolvedItems = useMemo<ComboboxItem[]>(() => {\n return filteredItems.length\n ? filteredItems\n : [{ \"data-empty\": \"\", label: emptyMessage }]\n }, [filteredItems, emptyMessage])\n const empty = useMemo(\n () => !resolvedItems.filter(({ hidden }) => !hidden).length,\n [resolvedItems],\n )\n const children = useMemo<ReactNode>(() => {\n if (!isArray(value)) return null\n\n const count = value.length\n\n return value.map((value, index) => {\n const item = valueMap[value] ?? { label: value, value }\n\n const onClear = (ev?: MouseEvent<HTMLElement>) => {\n ev?.preventDefault()\n ev?.stopPropagation()\n\n if (item.value) onChange(item.value)\n }\n\n const component = render({\n count,\n focused,\n index,\n max,\n separator,\n onClear,\n ...item,\n })\n\n if (isValidElement<Dict>(component))\n return cloneElement(component, { ...component.props, key: index })\n else return component\n })\n }, [focused, max, onChange, render, separator, value, valueMap])\n const hasValues = isArray(value) && !!value.length\n\n const onInputChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n if (isArray(value) && value.length === max) return\n\n if (runIfFn(closeOnChange, ev)) onClose()\n else if (runIfFn(openOnChange, ev)) onOpen()\n\n activeDescendant.current = null\n\n const inputValue = ev.target.value\n\n setInputValue(inputValue)\n\n if (inputValue.length || isArray(value)) return\n\n setValue(\"\" as MaybeValue)\n },\n [\n activeDescendant,\n closeOnChange,\n max,\n onClose,\n onOpen,\n openOnChange,\n setInputValue,\n setValue,\n value,\n ],\n )\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLInputElement>) => {\n if (disabled || isComposing(ev)) return\n\n const inputValue = cast<HTMLInputElement>(ev.target).value\n\n runKeyAction(\n ev,\n {\n Backspace: (ev) => {\n if (!isArray(value)) return\n if (inputValue.length) return\n\n ev.preventDefault()\n\n setValue((prev) => prev.slice(0, -1) as MaybeValue)\n },\n Enter: (ev) => {\n if (!open || !inputValue.length || activeDescendant.current) return\n\n const item = filteredItems[0]\n\n if (!item) {\n if (!allowCustomValue || !isArray(value)) return\n\n ev.preventDefault()\n\n onSelect(inputValue)\n } else {\n ev.preventDefault()\n\n if (\"items\" in item) onSelect(item.items[0]?.value)\n else onSelect(item.value)\n }\n },\n },\n { preventDefault: false },\n )\n },\n [\n activeDescendant,\n allowCustomValue,\n disabled,\n filteredItems,\n onSelect,\n open,\n setValue,\n value,\n ],\n )\n\n const onClick = useCallback(() => {\n if (!interactive) return\n\n focusByClickRef.current = true\n\n inputRef.current?.focus()\n\n if (openOnClick) onOpenWithActiveDescendant(descendants.enabledFirstValue)\n }, [descendants, interactive, onOpenWithActiveDescendant, openOnClick])\n\n const onMouseDown = useCallback(\n (ev: MouseEvent<HTMLInputElement>) => {\n if (!openOnFocus) return\n\n ev.preventDefault()\n ev.stopPropagation()\n },\n [openOnFocus],\n )\n\n const onFocus = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n ev.preventDefault()\n ev.stopPropagation()\n\n setFocused(true)\n\n if (openOnFocus && !focusByClickRef.current)\n onOpenWithActiveDescendant(descendants.enabledFirstValue)\n\n focusByClickRef.current = false\n },\n [openOnFocus, onOpenWithActiveDescendant, descendants.enabledFirstValue],\n )\n\n const onBlur = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n if (\n contains(fieldRef.current, ev.relatedTarget) ||\n contains(contentRef.current, ev.relatedTarget)\n ) {\n ev.preventDefault()\n } else {\n setFocused(false)\n\n if (isArray(value)) {\n setInputValue(\"\")\n } else if (allowCustomValue) {\n if (inputValue) setValue(inputValue as MaybeValue)\n } else {\n const item = isString(value) ? valueMap[value] : undefined\n\n setInputValue(getInputValue(item))\n }\n }\n },\n [allowCustomValue, inputValue, setInputValue, setValue, value, valueMap],\n )\n\n const onClear = useCallback(() => {\n if (!interactive) return\n\n setValue((prev) => (isArray(prev) ? [] : \"\") as MaybeValue)\n setInputValue(\"\")\n\n if (focusOnClear) inputRef.current?.focus()\n }, [focusOnClear, interactive, setInputValue, setValue])\n\n useUpdateEffect(() => {\n if (isArray(valueProp)) return\n\n setInputValue(\n getInputValue(isString(valueProp) ? valueMap[valueProp] : undefined),\n )\n }, [valueProp])\n\n const getRootProps: PropGetter = useCallback(\n (props) => ({\n ...dataProps,\n ...props,\n }),\n [dataProps],\n )\n\n const getFieldProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getTriggerProps({\n ref: mergeRefs(ref, fieldRef),\n tabIndex: -1,\n ...props,\n onClick: handlerAll(props.onClick, onClick),\n }),\n\n [getTriggerProps, onClick],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) => ({\n id,\n ref: mergeRefs(props.ref, ref, inputRef),\n name,\n style: {\n ...(!focused && isArray(value) && !!value.length\n ? visuallyHiddenAttributes.style\n : {}),\n ...props.style,\n },\n \"data-max\": dataAttr(\n isArray(value) && isNumber(max) && value.length >= max,\n ),\n autoCapitalize: \"off\",\n autoComplete: \"off\",\n autoCorrect: \"off\",\n disabled,\n placeholder: hasValues ? undefined : placeholder,\n readOnly,\n required,\n spellCheck: false,\n value: inputValue,\n ...dataProps,\n ...props,\n onBlur: handlerAll(props.onBlur, onBlur),\n onChange: handlerAll(props.onChange, onInputChange),\n onFocus: handlerAll(props.onFocus, onFocus),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n onMouseDown: handlerAll(props.onMouseDown, onMouseDown),\n }),\n [\n dataProps,\n disabled,\n focused,\n hasValues,\n id,\n inputValue,\n max,\n name,\n onBlur,\n onFocus,\n onInputChange,\n onKeyDown,\n onMouseDown,\n placeholder,\n readOnly,\n ref,\n required,\n value,\n ],\n )\n\n const getContentProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) =>\n getComboboxContentProps({\n ref: mergeRefs(ref, contentRef),\n hidden: empty,\n ...props,\n }),\n [empty, getComboboxContentProps],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props) => ({ ...dataProps, ...props }),\n [dataProps],\n )\n\n const getClearIconProps: PropGetter = useCallback(\n (props = {}) =>\n getIconProps({\n \"aria-disabled\": ariaAttr(!interactive),\n \"aria-label\": t(\"Clear value\"),\n role: \"button\",\n tabIndex: interactive ? 0 : -1,\n ...props,\n onClick: handlerAll(props.onClick, onClear),\n onKeyDown: handlerAll(props.onKeyDown, (ev) =>\n runKeyAction(ev, { Enter: onClear, Space: onClear }),\n ),\n }),\n [getIconProps, interactive, onClear, t],\n )\n\n return {\n children,\n descendants,\n inputValue,\n interactive,\n items: resolvedItems,\n max,\n open,\n setInputValue,\n setValue,\n value,\n valueMap,\n getClearIconProps,\n getContentProps,\n getFieldProps,\n getIconProps,\n getInputProps,\n getRootProps,\n getSeparatorProps,\n popoverProps,\n onActiveDescendant,\n onChange,\n onClose,\n onInputChange,\n onOpen,\n onSelect,\n }\n}\n\nexport type UseAutocompleteReturn = ReturnType<typeof useAutocomplete>\n\nexport interface UseAutocompleteOptionProps extends UseComboboxItemProps {}\n\nexport const useAutocompleteOption = ({\n children,\n closeOnSelect,\n disabled,\n hidden,\n value,\n ...rest\n}: UseAutocompleteOptionProps = {}) => {\n const { max, value: selectedValue } = useAutocompleteContext()\n\n value ??= isString(children) ? children : undefined\n\n const selected = isArray(selectedValue)\n ? !isUndefined(value) && selectedValue.includes(value)\n : selectedValue === value\n const completed =\n isNumber(max) && isArray(selectedValue) && selectedValue.length >= max\n const { getIndicatorProps, getItemProps } = useComboboxItem({\n children,\n closeOnSelect,\n disabled: disabled || hidden || (completed && !selected),\n hidden,\n selected,\n value,\n ...rest,\n })\n\n const getOptionProps: PropGetter = useCallback(\n (props = {}) => getItemProps(props),\n [getItemProps],\n )\n\n return { getIndicatorProps, getOptionProps }\n}\n\nexport type UseAutocompleteOptionReturn = ReturnType<\n typeof useAutocompleteOption\n>\n"],"mappings":";;;;;;;;;;;;;AA+DA,MAAM,iBAAyC,EAC7C,OACA,SACA,OACA,OACA,KACA,gBACI;CACJ,MAAM,OAAO,QAAQ,MAAM;CAE3B,OACE,qBAAC,QAAD;EAAM,OAAO,EAAE,iBAAiB,aAAa;EAA7C,UAAA,CACG,QACE,EAAA,GAAA,cAAA,SAAA,CAAU,GAAG,KAAK,QAAQ,QAAQ,WAAY,CAAC,OAAO,YAAY,IACjE;;AAEV;AAEA,MAAM,iBAAiB,UAAA,GAAA,cAAA,SAAA,CACZ,MAAM,KAAK,IAAI,KAAK,QAAS,MAAM,SAAS;AAUvD,MAAM,iBAAqC,YAAY,OAAO,UAAU;CACtE,IAAI,CAAC,WAAW,QAAQ,OAAO;CAE/B,OAAO,MACJ,KAAK,SAAS;EACb,IAAI,WAAW,MAAM;GACnB,MAAM,QAAQ,KAAK,MAAM,QAAQ,SAAS;IACxC,IAAI,WAAW,MACb,QAAA,G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,KAAA;CAE1C,MAAM,YAAA,GAAA,cAAA,QAAA,CAAmB,aAAa,IAClC,EAAA,GAAA,cAAA,YAAA,CAAa,KAAK,KAAK,cAAc,SAAS,KAAK,IACnD,kBAAkB;CACtB,MAAM,aAAA,GAAA,cAAA,SAAA,CACK,GAAG,MAAA,GAAA,cAAA,QAAA,CAAa,aAAa,KAAK,cAAc,UAAU;CACrE,MAAM,EAAE,mBAAmB,iBAAiB,gBAAgB;EAC1D;EACA;EACA,UAAU,YAAY,UAAW,aAAa,CAAC;EAC/C;EACA;EACA;EACA,GAAG;CACL,CAAC;CAOD,OAAO;EAAE;EAAmB,gBALO,aAChC,QAAQ,CAAC,MAAM,aAAa,KAAK,GAClC,CAAC,YAAY,CAG0B;CAAE;AAC7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar-group.js","names":[],"sources":["../../../../src/components/avatar/avatar-group.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { AvatarStyle } from \"./avatar.style\"\nimport type { UseAvatarGroupProps } from \"./use-avatar-group\"\nimport { useMemo } from \"react\"\nimport { styled } from \"../../core\"\nimport {\n Avatar,\n AvatarPropsContext,\n component,\n useRootComponentProps,\n} from \"./avatar\"\nimport { useAvatarGroup } from \"./use-avatar-group\"\n\nexport interface AvatarGroupRootProps\n extends HTMLStyledProps, ThemeProps<AvatarStyle>, UseAvatarGroupProps {}\n\n/**\n * `Avatar` is a component that displays a profile picture or an icon with initials representing a user.\n *\n * @see https://yamada-ui.com/docs/components/avatar\n */\nexport const AvatarGroupRoot = component<\"div\", AvatarGroupRootProps>(\n (props) => {\n const [, { colorScheme, size, variant, shape, ...rest }] =\n useRootComponentProps(props, \"group\", {\n transferProps: [\"variant\", \"colorScheme\", \"size\", \"shape\"],\n })\n const { children, excess, getRootProps } = useAvatarGroup(rest)\n const context = useMemo(\n () => ({ colorScheme, size, variant, shape }),\n [variant, size, colorScheme, shape],\n )\n\n return (\n <AvatarPropsContext value={context}>\n <styled.div {...getRootProps()}>\n {excess > 0 ? <Avatar fallback={`+${excess}`} /> : null}\n {children}\n </styled.div>\n </AvatarPropsContext>\n )\n },\n \"group\",\n)()\n"],"mappings":";;;;;;;;;;;;AAuBA,MAAa,kBAAkB,WAC5B,UAAU;CACT,MAAM,GAAG,EAAE,aAAa,MAAM,SAAS,OAAO,GAAG,UAC/C,sBAAsB,OAAO,SAAS,EACpC,eAAe;EAAC;EAAW;EAAe;EAAQ;CAAO,EAC3D,CAAC;CACH,MAAM,EAAE,UAAU,QAAQ,iBAAiB,eAAe,IAAI;CAM9D,OACE,oBAAC,oBAAD;EAAoB,OANN,eACP;GAAE;GAAa;GAAM;GAAS;EAAM,IAC3C;GAAC;GAAS;GAAM;GAAa;EAAK,CAID;
|
|
1
|
+
{"version":3,"file":"avatar-group.js","names":[],"sources":["../../../../src/components/avatar/avatar-group.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { AvatarStyle } from \"./avatar.style\"\nimport type { UseAvatarGroupProps } from \"./use-avatar-group\"\nimport { useMemo } from \"react\"\nimport { styled } from \"../../core\"\nimport {\n Avatar,\n AvatarPropsContext,\n component,\n useRootComponentProps,\n} from \"./avatar\"\nimport { useAvatarGroup } from \"./use-avatar-group\"\n\nexport interface AvatarGroupRootProps\n extends HTMLStyledProps, ThemeProps<AvatarStyle>, UseAvatarGroupProps {}\n\n/**\n * `Avatar` is a component that displays a profile picture or an icon with initials representing a user.\n *\n * @see https://yamada-ui.com/docs/components/avatar\n */\nexport const AvatarGroupRoot = component<\"div\", AvatarGroupRootProps>(\n (props) => {\n const [, { colorScheme, size, variant, shape, ...rest }] =\n useRootComponentProps(props, \"group\", {\n transferProps: [\"variant\", \"colorScheme\", \"size\", \"shape\"],\n })\n const { children, excess, getRootProps } = useAvatarGroup(rest)\n const context = useMemo(\n () => ({ colorScheme, size, variant, shape }),\n [variant, size, colorScheme, shape],\n )\n\n return (\n <AvatarPropsContext value={context}>\n <styled.div {...getRootProps()}>\n {excess > 0 ? <Avatar fallback={`+${excess}`} /> : null}\n {children}\n </styled.div>\n </AvatarPropsContext>\n )\n },\n \"group\",\n)()\n"],"mappings":";;;;;;;;;;;;AAuBA,MAAa,kBAAkB,WAC5B,UAAU;CACT,MAAM,GAAG,EAAE,aAAa,MAAM,SAAS,OAAO,GAAG,UAC/C,sBAAsB,OAAO,SAAS,EACpC,eAAe;EAAC;EAAW;EAAe;EAAQ;CAAO,EAC3D,CAAC;CACH,MAAM,EAAE,UAAU,QAAQ,iBAAiB,eAAe,IAAI;CAM9D,OACE,oBAAC,oBAAD;EAAoB,OANN,eACP;GAAE;GAAa;GAAM;GAAS;EAAM,IAC3C;GAAC;GAAS;GAAM;GAAa;EAAK,CAID;EAC/B,UAAA,qBAAC,OAAO,KAAR;GAAY,GAAI,aAAa;GAA7B,UAAA,CACG,SAAS,IAAI,oBAAC,QAAD,EAAQ,UAAU,IAAI,SAAW,CAAA,IAAI,MAClD,QACS;;CACM,CAAA;AAExB,GACA,OACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.js","names":[],"sources":["../../../../src/components/avatar/avatar.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { AvatarStyle } from \"./avatar.style\"\nimport type { UseAvatarProps } from \"./use-avatar\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { UserRoundIcon } from \"../icon\"\nimport { avatarStyle } from \"./avatar.style\"\nimport { useAvatar } from \"./use-avatar\"\n\nexport interface AvatarProps\n extends HTMLStyledProps, ThemeProps<AvatarStyle>, UseAvatarProps {\n /**\n * The avatar icon to use.\n */\n icon?: ReactElement\n /**\n * The props to pass to the fallback component.\n */\n fallbackProps?: AvatarFallbackProps\n /**\n * The props to pass to the image component.\n */\n imageProps?: AvatarImageProps\n}\n\nconst {\n component,\n PropsContext: AvatarPropsContext,\n usePropsContext: useAvatarPropsContext,\n withContext,\n withProvider,\n useRootComponentProps,\n} = createSlotComponent<AvatarProps, AvatarStyle>(\"avatar\", avatarStyle)\n\nexport {\n AvatarPropsContext,\n component,\n useAvatarPropsContext,\n useRootComponentProps,\n}\n\n/**\n * `Avatar` is a component that displays a profile picture or an icon with initials representing a user.\n *\n * @see https://yamada-ui.com/docs/components/avatar\n */\nexport const Avatar = withProvider<\"div\", AvatarProps>(\n ({ fallbackProps, imageProps, ...rest }) => {\n const { getFallbackProps, getImageProps, getRootProps } = useAvatar(rest)\n\n return (\n <styled.div {...getRootProps()}>\n <AvatarFallback {...getFallbackProps(fallbackProps)} />\n <AvatarImage {...getImageProps(imageProps)} />\n </styled.div>\n )\n },\n \"root\",\n)(({ icon, ...rest }) => ({\n icon: icon ?? <UserRoundIcon fontSize=\"1.2em\" />,\n ...rest,\n}))\n\ninterface AvatarImageProps extends HTMLStyledProps<\"img\"> {}\n\nconst AvatarImage = withContext<\"img\", AvatarImageProps>(\"img\", \"image\")()\n\ninterface AvatarFallbackProps extends HTMLStyledProps {}\n\nconst AvatarFallback = withContext<\"div\", AvatarFallbackProps>(\n \"div\",\n \"fallback\",\n)()\n"],"mappings":";;;;;;;;AA2BA,MAAM,EACJ,WACA,cAAc,oBACd,iBAAiB,uBACjB,aACA,cACA,0BACE,oBAA8C,UAAU,WAAW;;;;;;AAcvE,MAAa,SAAS,cACnB,EAAE,eAAe,YAAY,GAAG,WAAW;CAC1C,MAAM,EAAE,kBAAkB,eAAe,iBAAiB,UAAU,IAAI;CAExE,OACE,qBAAC,OAAO,KAAR;EAAY,GAAI,aAAa;
|
|
1
|
+
{"version":3,"file":"avatar.js","names":[],"sources":["../../../../src/components/avatar/avatar.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { AvatarStyle } from \"./avatar.style\"\nimport type { UseAvatarProps } from \"./use-avatar\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { UserRoundIcon } from \"../icon\"\nimport { avatarStyle } from \"./avatar.style\"\nimport { useAvatar } from \"./use-avatar\"\n\nexport interface AvatarProps\n extends HTMLStyledProps, ThemeProps<AvatarStyle>, UseAvatarProps {\n /**\n * The avatar icon to use.\n */\n icon?: ReactElement\n /**\n * The props to pass to the fallback component.\n */\n fallbackProps?: AvatarFallbackProps\n /**\n * The props to pass to the image component.\n */\n imageProps?: AvatarImageProps\n}\n\nconst {\n component,\n PropsContext: AvatarPropsContext,\n usePropsContext: useAvatarPropsContext,\n withContext,\n withProvider,\n useRootComponentProps,\n} = createSlotComponent<AvatarProps, AvatarStyle>(\"avatar\", avatarStyle)\n\nexport {\n AvatarPropsContext,\n component,\n useAvatarPropsContext,\n useRootComponentProps,\n}\n\n/**\n * `Avatar` is a component that displays a profile picture or an icon with initials representing a user.\n *\n * @see https://yamada-ui.com/docs/components/avatar\n */\nexport const Avatar = withProvider<\"div\", AvatarProps>(\n ({ fallbackProps, imageProps, ...rest }) => {\n const { getFallbackProps, getImageProps, getRootProps } = useAvatar(rest)\n\n return (\n <styled.div {...getRootProps()}>\n <AvatarFallback {...getFallbackProps(fallbackProps)} />\n <AvatarImage {...getImageProps(imageProps)} />\n </styled.div>\n )\n },\n \"root\",\n)(({ icon, ...rest }) => ({\n icon: icon ?? <UserRoundIcon fontSize=\"1.2em\" />,\n ...rest,\n}))\n\ninterface AvatarImageProps extends HTMLStyledProps<\"img\"> {}\n\nconst AvatarImage = withContext<\"img\", AvatarImageProps>(\"img\", \"image\")()\n\ninterface AvatarFallbackProps extends HTMLStyledProps {}\n\nconst AvatarFallback = withContext<\"div\", AvatarFallbackProps>(\n \"div\",\n \"fallback\",\n)()\n"],"mappings":";;;;;;;;AA2BA,MAAM,EACJ,WACA,cAAc,oBACd,iBAAiB,uBACjB,aACA,cACA,0BACE,oBAA8C,UAAU,WAAW;;;;;;AAcvE,MAAa,SAAS,cACnB,EAAE,eAAe,YAAY,GAAG,WAAW;CAC1C,MAAM,EAAE,kBAAkB,eAAe,iBAAiB,UAAU,IAAI;CAExE,OACE,qBAAC,OAAO,KAAR;EAAY,GAAI,aAAa;EAA7B,UAAA,CACE,oBAAC,gBAAD,EAAgB,GAAI,iBAAiB,aAAa,EAAI,CAAA,GACtD,oBAAC,aAAD,EAAa,GAAI,cAAc,UAAU,EAAI,CAAA,CACnC;;AAEhB,GACA,MACF,CAAC,EAAE,EAAE,MAAM,GAAG,YAAY;CACxB,MAAM,QAAQ,oBAAC,eAAD,EAAe,UAAS,QAAS,CAAA;CAC/C,GAAG;AACL,EAAE;AAIF,MAAM,cAAc,YAAqC,OAAO,OAAO,CAAC,CAAC;AAIzE,MAAM,iBAAiB,YACrB,OACA,UACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blockquote.js","names":[],"sources":["../../../../src/components/blockquote/blockquote.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { BlockquoteStyle } from \"./blockquote.style\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { useFindChild, useValidChildren } from \"../../utils\"\nimport { QuoteIcon } from \"../icon\"\nimport { blockquoteStyle } from \"./blockquote.style\"\n\ninterface ComponentContext\n extends\n Pick<BlockquoteContentProps, \"citeUrl\">,\n Pick<BlockquoteCaptionProps, \"withDash\"> {}\n\nexport interface BlockquoteRootProps\n extends\n Omit<HTMLStyledProps<\"figure\">, \"cite\">,\n ThemeProps<BlockquoteStyle>,\n Pick<BlockquoteContentProps, \"citeUrl\">,\n Pick<BlockquoteCaptionProps, \"withDash\"> {\n /**\n * The citation of the blockquote.\n */\n cite?: ReactNode\n /**\n * The icon of the blockquote.\n */\n icon?: ReactNode\n /**\n * The props for the `BlockquoteCaption` component.\n */\n captionProps?: HTMLStyledProps<\"figcaption\">\n /**\n * The props for the `BlockquoteCite` component.\n */\n citeProps?: HTMLStyledProps<\"cite\">\n /**\n * The props for the `BlockquoteContent` component.\n */\n contentProps?: HTMLStyledProps<\"blockquote\">\n}\n\nconst {\n ComponentContext,\n PropsContext: BlockquotePropsContext,\n useComponentContext,\n usePropsContext: useBlockquotePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<BlockquoteRootProps, BlockquoteStyle, ComponentContext>(\n \"blockquote\",\n blockquoteStyle,\n)\n\nexport { BlockquotePropsContext, useBlockquotePropsContext }\n\n/**\n * `Blockquote` is a component that represents a blockquote. By default, it renders a `blockquote` element.\n *\n * @see https://yamada-ui.com/docs/components/blockquote\n */\nexport const BlockquoteRoot = withProvider<\"figure\", BlockquoteRootProps>(\n ({\n children,\n cite,\n citeUrl,\n icon,\n withDash,\n captionProps,\n citeProps,\n contentProps,\n ...rest\n }) => {\n const validChildren = useValidChildren(children)\n const customBlockquoteContent = useFindChild(\n validChildren,\n BlockquoteContent,\n )\n const customBlockquoteCaption = useFindChild(\n validChildren,\n BlockquoteCaption,\n )\n\n const context = useMemo(() => ({ citeUrl, withDash }), [citeUrl, withDash])\n\n return (\n <ComponentContext value={context}>\n <styled.figure {...rest}>\n {icon}\n\n {customBlockquoteContent ?? (\n <BlockquoteContent {...contentProps}>{children}</BlockquoteContent>\n )}\n\n {customBlockquoteCaption ??\n (cite ? (\n <BlockquoteCaption {...captionProps}>\n <BlockquoteCite {...citeProps}>{cite}</BlockquoteCite>\n </BlockquoteCaption>\n ) : null)}\n </styled.figure>\n </ComponentContext>\n )\n },\n \"root\",\n)()\n\nexport interface BlockquoteContentProps extends HTMLStyledProps<\"blockquote\"> {\n /**\n * The URL of the citation of the blockquote.\n */\n citeUrl?: string\n}\n\nexport const BlockquoteContent = withContext<\n \"blockquote\",\n BlockquoteContentProps\n>(\"blockquote\", \"content\")(\n undefined,\n ({ cite, citeUrl: citeUrlProp, ...rest }) => {\n const { citeUrl } = useComponentContext()\n\n return { ...rest, citeurl: cite ?? citeUrlProp ?? citeUrl }\n },\n)\n\nexport interface BlockquoteCaptionProps extends HTMLStyledProps<\"figcaption\"> {\n /**\n * If `true`, the dash will be shown.\n *\n * @default false\n */\n withDash?: boolean\n}\n\nexport const BlockquoteCaption = withContext<\n \"figcaption\",\n BlockquoteCaptionProps\n>(\"figcaption\", \"caption\")(\n undefined,\n ({ children, withDash: withDashProp, ...rest }) => {\n const { withDash } = useComponentContext()\n\n withDashProp ??= withDash\n\n return {\n ...rest,\n children: (\n <>\n {withDashProp ? <>—</> : null} {children}\n </>\n ),\n }\n },\n)\n\nexport interface BlockquoteCiteProps extends HTMLStyledProps<\"cite\"> {}\n\nexport const BlockquoteCite = withContext<\"cite\", BlockquoteCiteProps>(\n \"cite\",\n \"cite\",\n)()\n\nexport interface BlockquoteIconProps extends HTMLStyledProps<\"svg\"> {}\n\nexport const BlockquoteIcon = withContext<\"svg\", BlockquoteIconProps>(\n QuoteIcon,\n \"icon\",\n)()\n"],"mappings":";;;;;;;;;AA4CA,MAAM,EACJ,kBACA,cAAc,wBACd,qBACA,iBAAiB,2BACjB,aACA,iBACE,oBACF,cACA,eACF;;;;;;AASA,MAAa,iBAAiB,cAC3B,EACC,UACA,MACA,SACA,MACA,UACA,cACA,WACA,cACA,GAAG,WACC;CACJ,MAAM,gBAAgB,iBAAiB,QAAQ;CAC/C,MAAM,0BAA0B,aAC9B,eACA,iBACF;CACA,MAAM,0BAA0B,aAC9B,eACA,iBACF;CAEA,MAAM,UAAU,eAAe;EAAE;EAAS;CAAS,IAAI,CAAC,SAAS,QAAQ,CAAC;CAE1E,OACE,oBAAC,kBAAD;EAAkB,OAAO;
|
|
1
|
+
{"version":3,"file":"blockquote.js","names":[],"sources":["../../../../src/components/blockquote/blockquote.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { BlockquoteStyle } from \"./blockquote.style\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { useFindChild, useValidChildren } from \"../../utils\"\nimport { QuoteIcon } from \"../icon\"\nimport { blockquoteStyle } from \"./blockquote.style\"\n\ninterface ComponentContext\n extends\n Pick<BlockquoteContentProps, \"citeUrl\">,\n Pick<BlockquoteCaptionProps, \"withDash\"> {}\n\nexport interface BlockquoteRootProps\n extends\n Omit<HTMLStyledProps<\"figure\">, \"cite\">,\n ThemeProps<BlockquoteStyle>,\n Pick<BlockquoteContentProps, \"citeUrl\">,\n Pick<BlockquoteCaptionProps, \"withDash\"> {\n /**\n * The citation of the blockquote.\n */\n cite?: ReactNode\n /**\n * The icon of the blockquote.\n */\n icon?: ReactNode\n /**\n * The props for the `BlockquoteCaption` component.\n */\n captionProps?: HTMLStyledProps<\"figcaption\">\n /**\n * The props for the `BlockquoteCite` component.\n */\n citeProps?: HTMLStyledProps<\"cite\">\n /**\n * The props for the `BlockquoteContent` component.\n */\n contentProps?: HTMLStyledProps<\"blockquote\">\n}\n\nconst {\n ComponentContext,\n PropsContext: BlockquotePropsContext,\n useComponentContext,\n usePropsContext: useBlockquotePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<BlockquoteRootProps, BlockquoteStyle, ComponentContext>(\n \"blockquote\",\n blockquoteStyle,\n)\n\nexport { BlockquotePropsContext, useBlockquotePropsContext }\n\n/**\n * `Blockquote` is a component that represents a blockquote. By default, it renders a `blockquote` element.\n *\n * @see https://yamada-ui.com/docs/components/blockquote\n */\nexport const BlockquoteRoot = withProvider<\"figure\", BlockquoteRootProps>(\n ({\n children,\n cite,\n citeUrl,\n icon,\n withDash,\n captionProps,\n citeProps,\n contentProps,\n ...rest\n }) => {\n const validChildren = useValidChildren(children)\n const customBlockquoteContent = useFindChild(\n validChildren,\n BlockquoteContent,\n )\n const customBlockquoteCaption = useFindChild(\n validChildren,\n BlockquoteCaption,\n )\n\n const context = useMemo(() => ({ citeUrl, withDash }), [citeUrl, withDash])\n\n return (\n <ComponentContext value={context}>\n <styled.figure {...rest}>\n {icon}\n\n {customBlockquoteContent ?? (\n <BlockquoteContent {...contentProps}>{children}</BlockquoteContent>\n )}\n\n {customBlockquoteCaption ??\n (cite ? (\n <BlockquoteCaption {...captionProps}>\n <BlockquoteCite {...citeProps}>{cite}</BlockquoteCite>\n </BlockquoteCaption>\n ) : null)}\n </styled.figure>\n </ComponentContext>\n )\n },\n \"root\",\n)()\n\nexport interface BlockquoteContentProps extends HTMLStyledProps<\"blockquote\"> {\n /**\n * The URL of the citation of the blockquote.\n */\n citeUrl?: string\n}\n\nexport const BlockquoteContent = withContext<\n \"blockquote\",\n BlockquoteContentProps\n>(\"blockquote\", \"content\")(\n undefined,\n ({ cite, citeUrl: citeUrlProp, ...rest }) => {\n const { citeUrl } = useComponentContext()\n\n return { ...rest, citeurl: cite ?? citeUrlProp ?? citeUrl }\n },\n)\n\nexport interface BlockquoteCaptionProps extends HTMLStyledProps<\"figcaption\"> {\n /**\n * If `true`, the dash will be shown.\n *\n * @default false\n */\n withDash?: boolean\n}\n\nexport const BlockquoteCaption = withContext<\n \"figcaption\",\n BlockquoteCaptionProps\n>(\"figcaption\", \"caption\")(\n undefined,\n ({ children, withDash: withDashProp, ...rest }) => {\n const { withDash } = useComponentContext()\n\n withDashProp ??= withDash\n\n return {\n ...rest,\n children: (\n <>\n {withDashProp ? <>—</> : null} {children}\n </>\n ),\n }\n },\n)\n\nexport interface BlockquoteCiteProps extends HTMLStyledProps<\"cite\"> {}\n\nexport const BlockquoteCite = withContext<\"cite\", BlockquoteCiteProps>(\n \"cite\",\n \"cite\",\n)()\n\nexport interface BlockquoteIconProps extends HTMLStyledProps<\"svg\"> {}\n\nexport const BlockquoteIcon = withContext<\"svg\", BlockquoteIconProps>(\n QuoteIcon,\n \"icon\",\n)()\n"],"mappings":";;;;;;;;;AA4CA,MAAM,EACJ,kBACA,cAAc,wBACd,qBACA,iBAAiB,2BACjB,aACA,iBACE,oBACF,cACA,eACF;;;;;;AASA,MAAa,iB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":3,"file":"breadcrumb.js","names":[],"sources":["../../../../src/components/breadcrumb/breadcrumb.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type { HTMLStyledProps, PropGetter, ThemeProps } from \"../../core\"\nimport type { BreadcrumbStyle } from \"./breadcrumb.style\"\nimport type { UseBreadcrumbProps } from \"./use-breadcrumb\"\nimport { Fragment, useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { ChevronRightIcon, EllipsisIcon } from \"../icon\"\nimport { breadcrumbStyle } from \"./breadcrumb.style\"\nimport { useBreadcrumb } from \"./use-breadcrumb\"\n\ninterface ComponentContext {\n getEllipsisProps: PropGetter<\"svg\">\n getLinkProps: PropGetter<\"a\", { currentPage?: boolean }>\n}\n\nexport interface BreadcrumbRootProps\n extends\n HTMLStyledProps<\"nav\">,\n ThemeProps<BreadcrumbStyle>,\n Omit<UseBreadcrumbProps, \"endBoundaries\" | \"startBoundaries\"> {\n /**\n * Number of elements visible on the end(right) edges.\n *\n * @default 0\n */\n endBoundaries?: number\n /**\n * The visual separator between each breadcrumb item.\n *\n * @default '/'\n */\n separator?: ReactElement | string\n /**\n * Number of elements visible on the start(left) edges.\n *\n * @default 0\n */\n startBoundaries?: number\n /**\n * Props for item element.\n */\n itemProps?: BreadcrumbItemProps\n /**\n * Props for ol element.\n */\n listProps?: HTMLStyledProps<\"ol\">\n /**\n * Props for separator element.\n */\n separatorProps?: BreadcrumbSeparatorProps\n}\n\nconst {\n ComponentContext,\n PropsContext: BreadcrumbPropsContext,\n useComponentContext,\n usePropsContext: useBreadcrumbPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<BreadcrumbRootProps, BreadcrumbStyle, ComponentContext>(\n \"breadcrumb\",\n breadcrumbStyle,\n)\n\nexport { BreadcrumbPropsContext, useBreadcrumbPropsContext }\n\n/**\n * `Breadcrumb` is a component that helps users understand the hierarchy of a website.\n *\n * @see https://yamada-ui.com/docs/components/breadcrumb\n */\nexport const BreadcrumbRoot = withProvider<\"nav\", BreadcrumbRootProps>(\n ({\n endBoundaries,\n gap,\n separator,\n startBoundaries,\n itemProps,\n listProps,\n separatorProps,\n ...rest\n }) => {\n const {\n children,\n getEllipsisProps,\n getLinkProps,\n getListProps,\n getRootProps,\n } = useBreadcrumb({\n ellipsis: <BreadcrumbEllipsis />,\n endBoundaries,\n link: <BreadcrumbLink />,\n startBoundaries,\n ...rest,\n })\n\n const context = useMemo(\n () => ({ getEllipsisProps, getLinkProps }),\n [getEllipsisProps, getLinkProps],\n )\n\n return (\n <ComponentContext value={context}>\n <styled.nav {...getRootProps()}>\n <BreadcrumbList {...getListProps({ gap, ...listProps })}>\n {children.map((child, index) => {\n const last = index === children.length - 1\n\n return (\n <Fragment key={index}>\n <BreadcrumbItem {...itemProps}>{child}</BreadcrumbItem>\n\n {!last ? (\n <BreadcrumbSeparator {...separatorProps}>\n {separator}\n </BreadcrumbSeparator>\n ) : null}\n </Fragment>\n )\n })}\n </BreadcrumbList>\n </styled.nav>\n </ComponentContext>\n )\n },\n \"root\",\n)()\n\ninterface BreadcrumbListProps extends HTMLStyledProps<\"ol\"> {}\n\nconst BreadcrumbList = withContext<\"ol\", BreadcrumbListProps>(\"ol\", \"list\")()\n\ninterface BreadcrumbItemProps extends HTMLStyledProps<\"li\"> {}\n\nconst BreadcrumbItem = withContext<\"li\", BreadcrumbItemProps>(\"li\", \"item\")()\n\ninterface BreadcrumbSeparatorProps extends HTMLStyledProps<\"li\"> {}\n\nconst BreadcrumbSeparator = withContext<\"li\", BreadcrumbSeparatorProps>(\n BreadcrumbItem,\n \"separator\",\n)(({ children, ...rest }) => ({\n children: children ?? <ChevronRightIcon />,\n ...rest,\n}))\n\nexport interface BreadcrumbLinkProps extends HTMLStyledProps<\"a\"> {\n /**\n * If `true`, change to span element.\n *\n * @default false\n */\n currentPage?: boolean\n}\n\nexport const BreadcrumbLink = withContext<\"a\", BreadcrumbLinkProps>(\n \"a\",\n \"link\",\n)(undefined, ({ currentPage, ...rest }) => {\n const { getLinkProps } = useComponentContext()\n\n return {\n as: !currentPage ? \"a\" : \"span\",\n ...getLinkProps({ currentPage, ...rest }),\n }\n})\n\nexport interface BreadcrumbEllipsisProps extends HTMLStyledProps<\"svg\"> {}\n\nexport const BreadcrumbEllipsis = withContext<\"svg\", BreadcrumbEllipsisProps>(\n EllipsisIcon,\n \"ellipsis\",\n)(undefined, (props) => {\n const { getEllipsisProps } = useComponentContext()\n\n return { ...getEllipsisProps(props) }\n})\n"],"mappings":";;;;;;;;;;AAsDA,MAAM,EACJ,kBACA,cAAc,wBACd,qBACA,iBAAiB,2BACjB,aACA,iBACE,oBACF,cACA,eACF;;;;;;AASA,MAAa,iBAAiB,cAC3B,EACC,eACA,KACA,WACA,iBACA,WACA,WACA,gBACA,GAAG,WACC;CACJ,MAAM,EACJ,UACA,kBACA,cACA,cACA,iBACE,cAAc;EAChB,UAAU,oBAAC,oBAAD,CAAqB,CAAA;EAC/B;EACA,MAAM,oBAAC,gBAAD,CAAiB,CAAA;EACvB;EACA,GAAG;CACL,CAAC;CAED,MAAM,UAAU,eACP;EAAE;EAAkB;CAAa,IACxC,CAAC,kBAAkB,YAAY,CACjC;CAEA,OACE,oBAAC,kBAAD;EAAkB,OAAO;
|
|
1
|
+
{"version":3,"file":"breadcrumb.js","names":[],"sources":["../../../../src/components/breadcrumb/breadcrumb.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type { HTMLStyledProps, PropGetter, ThemeProps } from \"../../core\"\nimport type { BreadcrumbStyle } from \"./breadcrumb.style\"\nimport type { UseBreadcrumbProps } from \"./use-breadcrumb\"\nimport { Fragment, useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { ChevronRightIcon, EllipsisIcon } from \"../icon\"\nimport { breadcrumbStyle } from \"./breadcrumb.style\"\nimport { useBreadcrumb } from \"./use-breadcrumb\"\n\ninterface ComponentContext {\n getEllipsisProps: PropGetter<\"svg\">\n getLinkProps: PropGetter<\"a\", { currentPage?: boolean }>\n}\n\nexport interface BreadcrumbRootProps\n extends\n HTMLStyledProps<\"nav\">,\n ThemeProps<BreadcrumbStyle>,\n Omit<UseBreadcrumbProps, \"endBoundaries\" | \"startBoundaries\"> {\n /**\n * Number of elements visible on the end(right) edges.\n *\n * @default 0\n */\n endBoundaries?: number\n /**\n * The visual separator between each breadcrumb item.\n *\n * @default '/'\n */\n separator?: ReactElement | string\n /**\n * Number of elements visible on the start(left) edges.\n *\n * @default 0\n */\n startBoundaries?: number\n /**\n * Props for item element.\n */\n itemProps?: BreadcrumbItemProps\n /**\n * Props for ol element.\n */\n listProps?: HTMLStyledProps<\"ol\">\n /**\n * Props for separator element.\n */\n separatorProps?: BreadcrumbSeparatorProps\n}\n\nconst {\n ComponentContext,\n PropsContext: BreadcrumbPropsContext,\n useComponentContext,\n usePropsContext: useBreadcrumbPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<BreadcrumbRootProps, BreadcrumbStyle, ComponentContext>(\n \"breadcrumb\",\n breadcrumbStyle,\n)\n\nexport { BreadcrumbPropsContext, useBreadcrumbPropsContext }\n\n/**\n * `Breadcrumb` is a component that helps users understand the hierarchy of a website.\n *\n * @see https://yamada-ui.com/docs/components/breadcrumb\n */\nexport const BreadcrumbRoot = withProvider<\"nav\", BreadcrumbRootProps>(\n ({\n endBoundaries,\n gap,\n separator,\n startBoundaries,\n itemProps,\n listProps,\n separatorProps,\n ...rest\n }) => {\n const {\n children,\n getEllipsisProps,\n getLinkProps,\n getListProps,\n getRootProps,\n } = useBreadcrumb({\n ellipsis: <BreadcrumbEllipsis />,\n endBoundaries,\n link: <BreadcrumbLink />,\n startBoundaries,\n ...rest,\n })\n\n const context = useMemo(\n () => ({ getEllipsisProps, getLinkProps }),\n [getEllipsisProps, getLinkProps],\n )\n\n return (\n <ComponentContext value={context}>\n <styled.nav {...getRootProps()}>\n <BreadcrumbList {...getListProps({ gap, ...listProps })}>\n {children.map((child, index) => {\n const last = index === children.length - 1\n\n return (\n <Fragment key={index}>\n <BreadcrumbItem {...itemProps}>{child}</BreadcrumbItem>\n\n {!last ? (\n <BreadcrumbSeparator {...separatorProps}>\n {separator}\n </BreadcrumbSeparator>\n ) : null}\n </Fragment>\n )\n })}\n </BreadcrumbList>\n </styled.nav>\n </ComponentContext>\n )\n },\n \"root\",\n)()\n\ninterface BreadcrumbListProps extends HTMLStyledProps<\"ol\"> {}\n\nconst BreadcrumbList = withContext<\"ol\", BreadcrumbListProps>(\"ol\", \"list\")()\n\ninterface BreadcrumbItemProps extends HTMLStyledProps<\"li\"> {}\n\nconst BreadcrumbItem = withContext<\"li\", BreadcrumbItemProps>(\"li\", \"item\")()\n\ninterface BreadcrumbSeparatorProps extends HTMLStyledProps<\"li\"> {}\n\nconst BreadcrumbSeparator = withContext<\"li\", BreadcrumbSeparatorProps>(\n BreadcrumbItem,\n \"separator\",\n)(({ children, ...rest }) => ({\n children: children ?? <ChevronRightIcon />,\n ...rest,\n}))\n\nexport interface BreadcrumbLinkProps extends HTMLStyledProps<\"a\"> {\n /**\n * If `true`, change to span element.\n *\n * @default false\n */\n currentPage?: boolean\n}\n\nexport const BreadcrumbLink = withContext<\"a\", BreadcrumbLinkProps>(\n \"a\",\n \"link\",\n)(undefined, ({ currentPage, ...rest }) => {\n const { getLinkProps } = useComponentContext()\n\n return {\n as: !currentPage ? \"a\" : \"span\",\n ...getLinkProps({ currentPage, ...rest }),\n }\n})\n\nexport interface BreadcrumbEllipsisProps extends HTMLStyledProps<\"svg\"> {}\n\nexport const BreadcrumbEllipsis = withContext<\"svg\", BreadcrumbEllipsisProps>(\n EllipsisIcon,\n \"ellipsis\",\n)(undefined, (props) => {\n const { getEllipsisProps } = useComponentContext()\n\n return { ...getEllipsisProps(props) }\n})\n"],"mappings":";;;;;;;;;;AAsDA,MAAM,EACJ,kBACA,cAAc,wBACd,qBACA,iBAAiB,2BACjB,aACA,iBACE,oBACF,cACA,eACF;;;;;;AASA,MAAa,iBAAiB,cAC3B,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a,GAAG;EAAK,CAAC;CAC1C;AACF,CAAC;AAID,MAAa,qBAAqB,YAChC,cACA,UACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,qBAAqB,oBAAoB;CAEjD,OAAO,EAAE,GAAG,iBAAiB,KAAK,EAAE;AACtC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-group.js","names":[],"sources":["../../../../src/components/button/button-group.tsx"],"sourcesContent":["\"use client\"\n\nimport type { Component, ThemeProps, WithoutThemeProps } from \"../../core\"\nimport type { GroupProps } from \"../group\"\nimport type { ButtonProps } from \"./button\"\nimport type { ButtonStyle } from \"./button.style\"\nimport { useMemo } from \"react\"\nimport { Group } from \"../group\"\nimport { ButtonPropsContext } from \"./button\"\nimport { IconButtonPropsContext } from \"./icon-button\"\n\nexport interface ButtonGroupRootProps\n extends WithoutThemeProps<GroupProps, ButtonStyle>, ThemeProps<ButtonStyle> {\n /**\n * If `true`, all wrapped button will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n}\n\n/**\n * `Button` is an interactive component that allows users to perform actions such as submitting forms and toggling modals.\n *\n * @see https://yamada-ui.com/docs/components/button\n */\nexport const ButtonGroupRoot = (({\n size,\n variant,\n attached,\n disabled,\n ...rest\n}: ButtonGroupRootProps) => {\n const context = useMemo<ButtonProps>(\n () => ({\n size,\n variant,\n disabled,\n focusVisibleRing: attached ? \"inside\" : undefined,\n }),\n [size, variant, disabled, attached],\n )\n\n return (\n <ButtonPropsContext value={context}>\n <IconButtonPropsContext value={context}>\n <Group attached={attached} {...rest} />\n </IconButtonPropsContext>\n </ButtonPropsContext>\n )\n}) as Component<\"div\", ButtonGroupRootProps>\n"],"mappings":";;;;;;;;;;;;AA0BA,MAAa,oBAAoB,EAC/B,MACA,SACA,UACA,UACA,GAAG,WACuB;CAC1B,MAAM,UAAU,eACP;EACL;EACA;EACA;EACA,kBAAkB,WAAW,WAAW,KAAA;CAC1C,IACA;EAAC;EAAM;EAAS;EAAU;CAAQ,CACpC;CAEA,OACE,oBAAC,oBAAD;EAAoB,OAAO;
|
|
1
|
+
{"version":3,"file":"button-group.js","names":[],"sources":["../../../../src/components/button/button-group.tsx"],"sourcesContent":["\"use client\"\n\nimport type { Component, ThemeProps, WithoutThemeProps } from \"../../core\"\nimport type { GroupProps } from \"../group\"\nimport type { ButtonProps } from \"./button\"\nimport type { ButtonStyle } from \"./button.style\"\nimport { useMemo } from \"react\"\nimport { Group } from \"../group\"\nimport { ButtonPropsContext } from \"./button\"\nimport { IconButtonPropsContext } from \"./icon-button\"\n\nexport interface ButtonGroupRootProps\n extends WithoutThemeProps<GroupProps, ButtonStyle>, ThemeProps<ButtonStyle> {\n /**\n * If `true`, all wrapped button will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n}\n\n/**\n * `Button` is an interactive component that allows users to perform actions such as submitting forms and toggling modals.\n *\n * @see https://yamada-ui.com/docs/components/button\n */\nexport const ButtonGroupRoot = (({\n size,\n variant,\n attached,\n disabled,\n ...rest\n}: ButtonGroupRootProps) => {\n const context = useMemo<ButtonProps>(\n () => ({\n size,\n variant,\n disabled,\n focusVisibleRing: attached ? \"inside\" : undefined,\n }),\n [size, variant, disabled, attached],\n )\n\n return (\n <ButtonPropsContext value={context}>\n <IconButtonPropsContext value={context}>\n <Group attached={attached} {...rest} />\n </IconButtonPropsContext>\n </ButtonPropsContext>\n )\n}) as Component<\"div\", ButtonGroupRootProps>\n"],"mappings":";;;;;;;;;;;;AA0BA,MAAa,oBAAoB,EAC/B,MACA,SACA,UACA,UACA,GAAG,WACuB;CAC1B,MAAM,UAAU,eACP;EACL;EACA;EACA;EACA,kBAAkB,WAAW,WAAW,KAAA;CAC1C,IACA;EAAC;EAAM;EAAS;EAAU;CAAQ,CACpC;CAEA,OACE,oBAAC,oBAAD;EAAoB,OAAO;EACzB,UAAA,oBAAC,wBAAD;GAAwB,OAAO;GAC7B,UAAA,oBAAC,OAAD;IAAiB;IAAU,GAAI;GAAO,CAAA;EAChB,CAAA;CACN,CAAA;AAExB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","names":[],"sources":["../../../../src/components/button/button.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ElementType, PropsWithChildren, ReactNode } from \"react\"\nimport type {\n CSSObject,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { Loading } from \"../loading\"\nimport type { ButtonStyle } from \"./button.style\"\nimport {\n Children,\n cloneElement,\n isValidElement,\n useCallback,\n useMemo,\n useRef,\n} from \"react\"\nimport { createComponent, getClassName, mergeCSS, styled } from \"../../core\"\nimport { bem, dataAttr, mergeRefs } from \"../../utils\"\nimport { getLoadingComponent, isLoadingScheme } from \"../loading\"\nimport { Ripple, useRipple } from \"../ripple\"\nimport { buttonStyle } from \"./button.style\"\n\ninterface ComponentContext extends Pick<\n ButtonProps,\n \"endIcon\" | \"iconProps\" | \"loadingIcon\" | \"loadingMessage\" | \"startIcon\"\n> {}\n\nconst useButtonType = (value?: ElementType) => {\n const buttonRef = useRef(!value)\n\n const ref = useCallback((node: HTMLElement | null) => {\n if (node) buttonRef.current = node.tagName === \"BUTTON\"\n }, [])\n\n const type = buttonRef.current ? \"button\" : undefined\n\n return { ref, type } as const\n}\n\nexport interface ButtonProps\n extends HTMLStyledProps<\"button\">, ThemeProps<ButtonStyle> {\n /**\n * If `true`, the button is represented as active.\n *\n * @default false\n */\n active?: boolean\n /**\n * If `true`, the button is disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, disable ripple effects when pressing a element.\n *\n * @default false\n */\n disableRipple?: boolean\n /**\n * The icon to display at the end side of the button.\n */\n endIcon?: ReactNode\n /**\n * If `true`, the loading state of the button is represented.\n *\n * @default false\n */\n loading?: boolean\n /**\n * The icon to display when the button is loading.\n *\n * @default 'oval'\n */\n loadingIcon?: Loading.Scheme | ReactNode\n /**\n * The message to display when the button is loading.\n */\n loadingMessage?: ReactNode\n /**\n * The placement of the loading indicator. Accepts `start` or `end`.\n *\n * @default 'start'\n */\n loadingPlacement?: \"end\" | \"start\"\n /**\n * The icon to display at the start side of the button.\n */\n startIcon?: ReactNode\n /**\n * The type of button. Accepts `button`, `reset`, or `submit`.\n *\n * @default 'button'\n */\n type?: HTMLProps<\"button\">[\"type\"]\n /**\n * The props of the icon element.\n */\n iconProps?: ButtonIconProps\n /**\n * The props of the loading icon element.\n */\n loadingProps?: ButtonLoadingProps\n}\n\nconst {\n component,\n ComponentContext,\n PropsContext: ButtonPropsContext,\n useComponentContext,\n usePropsContext: useButtonPropsContext,\n withContext,\n} = createComponent<ButtonProps, ButtonStyle, ComponentContext>(\n \"button\",\n buttonStyle,\n)\n\nexport { ButtonPropsContext, useButtonPropsContext }\n\n/**\n * `Button` is an interactive component that allows users to perform actions such as submitting forms and toggling modals.\n *\n * @see https://yamada-ui.com/docs/components/button\n */\nexport const Button = withContext<\"button\", ButtonProps>(\n ({\n ref,\n as,\n active,\n children,\n disabled,\n disableRipple,\n endIcon = null,\n loading,\n loadingIcon = \"oval\",\n loadingMessage,\n loadingPlacement = \"start\",\n startIcon = null,\n iconProps,\n loadingProps,\n ...rest\n }) => {\n const trulyDisabled = disabled || loading\n const { ref: buttonRef, type } = useButtonType(as)\n const { onClick, ...rippleProps } = useRipple({\n ...rest,\n disabled: disableRipple || trulyDisabled,\n })\n const startLoading = loading && loadingPlacement === \"start\"\n const endLoading = loading && loadingPlacement === \"end\"\n\n const context = useMemo(\n () => ({ endIcon, loadingIcon, loadingMessage, startIcon, iconProps }),\n [loadingIcon, loadingMessage, startIcon, endIcon, iconProps],\n )\n\n return (\n <ComponentContext value={context}>\n <styled.button\n ref={mergeRefs(ref, buttonRef)}\n as={as}\n type={type}\n data-active={dataAttr(active)}\n data-loading={dataAttr(loading)}\n disabled={trulyDisabled}\n {...rest}\n onClick={onClick}\n >\n {startLoading ? <ButtonStartLoading {...loadingProps} /> : null}\n\n {loading ? (\n loadingMessage || (\n <styled.span opacity={0}>\n <ButtonContent>{children}</ButtonContent>\n </styled.span>\n )\n ) : (\n <ButtonContent>{children}</ButtonContent>\n )}\n\n {endLoading ? <ButtonEndLoading {...loadingProps} /> : null}\n\n <Ripple {...rippleProps} />\n </styled.button>\n </ComponentContext>\n )\n },\n)()\n\nconst ButtonContent = component<\"fragment\", PropsWithChildren>(\n ({ children }) => {\n const { endIcon, startIcon, iconProps } = useComponentContext()\n\n return (\n <>\n {startIcon ? (\n <ButtonStartIcon {...iconProps}>{startIcon}</ButtonStartIcon>\n ) : null}\n {children}\n {endIcon ? (\n <ButtonEndIcon {...iconProps}>{endIcon}</ButtonEndIcon>\n ) : null}\n </>\n )\n },\n { name: \"ButtonContent\", className: getClassName(bem(\"button\", \"content\")) },\n)()\n\ninterface ButtonLoadingProps extends HTMLStyledProps<\"svg\"> {}\n\nconst ButtonLoading = component<\"svg\", ButtonLoadingProps>(\n (props) => {\n const { loadingIcon, loadingMessage } = useComponentContext()\n\n const css = useMemo<CSSObject>(\n () => ({\n position: loadingMessage ? \"relative\" : \"absolute\",\n }),\n [loadingMessage],\n )\n\n if (isLoadingScheme(loadingIcon)) {\n const Component = getLoadingComponent(loadingIcon)\n\n return (\n <Component\n color=\"currentColor\"\n {...props}\n css={mergeCSS(css, props.css)}\n />\n )\n }\n\n if (isValidElement<HTMLStyledProps<\"svg\">>(loadingIcon))\n return cloneElement(loadingIcon, {\n ...props,\n ...loadingIcon.props,\n css: mergeCSS(css, props.css, loadingIcon.props.css),\n })\n\n return null\n },\n { name: \"ButtonLoading\", className: getClassName(bem(\"button\", \"loading\")) },\n)()\n\nconst ButtonStartLoading = component<\"svg\", ButtonLoadingProps>(ButtonLoading, {\n name: \"ButtonStartLoading\",\n className: getClassName(bem(\"button\", \"loading\", \"start\")),\n})()\n\nconst ButtonEndLoading = component<\"svg\", ButtonLoadingProps>(ButtonLoading, {\n name: \"ButtonEndLoading\",\n className: getClassName(bem(\"button\", \"loading\", \"end\")),\n})()\n\ninterface ButtonIconProps extends HTMLStyledProps<\"svg\"> {}\n\nconst ButtonIcon = component<\"svg\", ButtonIconProps>(\n ({ children, ...rest }) => {\n if (isValidElement<HTMLProps<\"svg\">>(children))\n return cloneElement(children, {\n \"aria-hidden\": true,\n role: \"img\",\n ...rest,\n ...children.props,\n })\n\n return Children.count(children) > 1 ? Children.only(null) : null\n },\n { name: \"ButtonIcon\", className: getClassName(bem(\"button\", \"icon\")) },\n)()\n\nconst ButtonStartIcon = component<\"svg\", ButtonIconProps>(ButtonIcon, {\n name: \"ButtonStartIcon\",\n className: getClassName(bem(\"button\", \"icon\", \"start\")),\n})()\n\nconst ButtonEndIcon = component<\"svg\", ButtonIconProps>(ButtonIcon, {\n name: \"ButtonEndIcon\",\n className: getClassName(bem(\"button\", \"icon\", \"end\")),\n})()\n"],"mappings":";;;;;;;;;;;;;;AA8BA,MAAM,iBAAiB,UAAwB;CAC7C,MAAM,YAAY,OAAO,CAAC,KAAK;CAQ/B,OAAO;EAAE,KANG,aAAa,SAA6B;GACpD,IAAI,MAAM,UAAU,UAAU,KAAK,YAAY;EACjD,GAAG,CAAC,CAIO;EAAG,MAFD,UAAU,UAAU,WAAW,KAAA;CAEzB;AACrB;AAoEA,MAAM,EACJ,WACA,kBACA,cAAc,oBACd,qBACA,iBAAiB,uBACjB,gBACE,gBACF,UACA,WACF;;;;;;AASA,MAAa,SAAS,aACnB,EACC,KACA,IACA,QACA,UACA,UACA,eACA,UAAU,MACV,SACA,cAAc,QACd,gBACA,mBAAmB,SACnB,YAAY,MACZ,WACA,cACA,GAAG,WACC;CACJ,MAAM,gBAAgB,YAAY;CAClC,MAAM,EAAE,KAAK,WAAW,SAAS,cAAc,EAAE;CACjD,MAAM,EAAE,SAAS,GAAG,gBAAgB,UAAU;EAC5C,GAAG;EACH,UAAU,iBAAiB;CAC7B,CAAC;CACD,MAAM,eAAe,WAAW,qBAAqB;CACrD,MAAM,aAAa,WAAW,qBAAqB;CAEnD,MAAM,UAAU,eACP;EAAE;EAAS;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,CAAC"}
|
|
1
|
+
{"version":3,"file":"button.js","names":[],"sources":["../../../../src/components/button/button.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ElementType, PropsWithChildren, ReactNode } from \"react\"\nimport type {\n CSSObject,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { Loading } from \"../loading\"\nimport type { ButtonStyle } from \"./button.style\"\nimport {\n Children,\n cloneElement,\n isValidElement,\n useCallback,\n useMemo,\n useRef,\n} from \"react\"\nimport { createComponent, getClassName, mergeCSS, styled } from \"../../core\"\nimport { bem, dataAttr, mergeRefs } from \"../../utils\"\nimport { getLoadingComponent, isLoadingScheme } from \"../loading\"\nimport { Ripple, useRipple } from \"../ripple\"\nimport { buttonStyle } from \"./button.style\"\n\ninterface ComponentContext extends Pick<\n ButtonProps,\n \"endIcon\" | \"iconProps\" | \"loadingIcon\" | \"loadingMessage\" | \"startIcon\"\n> {}\n\nconst useButtonType = (value?: ElementType) => {\n const buttonRef = useRef(!value)\n\n const ref = useCallback((node: HTMLElement | null) => {\n if (node) buttonRef.current = node.tagName === \"BUTTON\"\n }, [])\n\n const type = buttonRef.current ? \"button\" : undefined\n\n return { ref, type } as const\n}\n\nexport interface ButtonProps\n extends HTMLStyledProps<\"button\">, ThemeProps<ButtonStyle> {\n /**\n * If `true`, the button is represented as active.\n *\n * @default false\n */\n active?: boolean\n /**\n * If `true`, the button is disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, disable ripple effects when pressing a element.\n *\n * @default false\n */\n disableRipple?: boolean\n /**\n * The icon to display at the end side of the button.\n */\n endIcon?: ReactNode\n /**\n * If `true`, the loading state of the button is represented.\n *\n * @default false\n */\n loading?: boolean\n /**\n * The icon to display when the button is loading.\n *\n * @default 'oval'\n */\n loadingIcon?: Loading.Scheme | ReactNode\n /**\n * The message to display when the button is loading.\n */\n loadingMessage?: ReactNode\n /**\n * The placement of the loading indicator. Accepts `start` or `end`.\n *\n * @default 'start'\n */\n loadingPlacement?: \"end\" | \"start\"\n /**\n * The icon to display at the start side of the button.\n */\n startIcon?: ReactNode\n /**\n * The type of button. Accepts `button`, `reset`, or `submit`.\n *\n * @default 'button'\n */\n type?: HTMLProps<\"button\">[\"type\"]\n /**\n * The props of the icon element.\n */\n iconProps?: ButtonIconProps\n /**\n * The props of the loading icon element.\n */\n loadingProps?: ButtonLoadingProps\n}\n\nconst {\n component,\n ComponentContext,\n PropsContext: ButtonPropsContext,\n useComponentContext,\n usePropsContext: useButtonPropsContext,\n withContext,\n} = createComponent<ButtonProps, ButtonStyle, ComponentContext>(\n \"button\",\n buttonStyle,\n)\n\nexport { ButtonPropsContext, useButtonPropsContext }\n\n/**\n * `Button` is an interactive component that allows users to perform actions such as submitting forms and toggling modals.\n *\n * @see https://yamada-ui.com/docs/components/button\n */\nexport const Button = withContext<\"button\", ButtonProps>(\n ({\n ref,\n as,\n active,\n children,\n disabled,\n disableRipple,\n endIcon = null,\n loading,\n loadingIcon = \"oval\",\n loadingMessage,\n loadingPlacement = \"start\",\n startIcon = null,\n iconProps,\n loadingProps,\n ...rest\n }) => {\n const trulyDisabled = disabled || loading\n const { ref: buttonRef, type } = useButtonType(as)\n const { onClick, ...rippleProps } = useRipple({\n ...rest,\n disabled: disableRipple || trulyDisabled,\n })\n const startLoading = loading && loadingPlacement === \"start\"\n const endLoading = loading && loadingPlacement === \"end\"\n\n const context = useMemo(\n () => ({ endIcon, loadingIcon, loadingMessage, startIcon, iconProps }),\n [loadingIcon, loadingMessage, startIcon, endIcon, iconProps],\n )\n\n return (\n <ComponentContext value={context}>\n <styled.button\n ref={mergeRefs(ref, buttonRef)}\n as={as}\n type={type}\n data-active={dataAttr(active)}\n data-loading={dataAttr(loading)}\n disabled={trulyDisabled}\n {...rest}\n onClick={onClick}\n >\n {startLoading ? <ButtonStartLoading {...loadingProps} /> : null}\n\n {loading ? (\n loadingMessage || (\n <styled.span opacity={0}>\n <ButtonContent>{children}</ButtonContent>\n </styled.span>\n )\n ) : (\n <ButtonContent>{children}</ButtonContent>\n )}\n\n {endLoading ? <ButtonEndLoading {...loadingProps} /> : null}\n\n <Ripple {...rippleProps} />\n </styled.button>\n </ComponentContext>\n )\n },\n)()\n\nconst ButtonContent = component<\"fragment\", PropsWithChildren>(\n ({ children }) => {\n const { endIcon, startIcon, iconProps } = useComponentContext()\n\n return (\n <>\n {startIcon ? (\n <ButtonStartIcon {...iconProps}>{startIcon}</ButtonStartIcon>\n ) : null}\n {children}\n {endIcon ? (\n <ButtonEndIcon {...iconProps}>{endIcon}</ButtonEndIcon>\n ) : null}\n </>\n )\n },\n { name: \"ButtonContent\", className: getClassName(bem(\"button\", \"content\")) },\n)()\n\ninterface ButtonLoadingProps extends HTMLStyledProps<\"svg\"> {}\n\nconst ButtonLoading = component<\"svg\", ButtonLoadingProps>(\n (props) => {\n const { loadingIcon, loadingMessage } = useComponentContext()\n\n const css = useMemo<CSSObject>(\n () => ({\n position: loadingMessage ? \"relative\" : \"absolute\",\n }),\n [loadingMessage],\n )\n\n if (isLoadingScheme(loadingIcon)) {\n const Component = getLoadingComponent(loadingIcon)\n\n return (\n <Component\n color=\"currentColor\"\n {...props}\n css={mergeCSS(css, props.css)}\n />\n )\n }\n\n if (isValidElement<HTMLStyledProps<\"svg\">>(loadingIcon))\n return cloneElement(loadingIcon, {\n ...props,\n ...loadingIcon.props,\n css: mergeCSS(css, props.css, loadingIcon.props.css),\n })\n\n return null\n },\n { name: \"ButtonLoading\", className: getClassName(bem(\"button\", \"loading\")) },\n)()\n\nconst ButtonStartLoading = component<\"svg\", ButtonLoadingProps>(ButtonLoading, {\n name: \"ButtonStartLoading\",\n className: getClassName(bem(\"button\", \"loading\", \"start\")),\n})()\n\nconst ButtonEndLoading = component<\"svg\", ButtonLoadingProps>(ButtonLoading, {\n name: \"ButtonEndLoading\",\n className: getClassName(bem(\"button\", \"loading\", \"end\")),\n})()\n\ninterface ButtonIconProps extends HTMLStyledProps<\"svg\"> {}\n\nconst ButtonIcon = component<\"svg\", ButtonIconProps>(\n ({ children, ...rest }) => {\n if (isValidElement<HTMLProps<\"svg\">>(children))\n return cloneElement(children, {\n \"aria-hidden\": true,\n role: \"img\",\n ...rest,\n ...children.props,\n })\n\n return Children.count(children) > 1 ? Children.only(null) : null\n },\n { name: \"ButtonIcon\", className: getClassName(bem(\"button\", \"icon\")) },\n)()\n\nconst ButtonStartIcon = component<\"svg\", ButtonIconProps>(ButtonIcon, {\n name: \"ButtonStartIcon\",\n className: getClassName(bem(\"button\", \"icon\", \"start\")),\n})()\n\nconst ButtonEndIcon = component<\"svg\", ButtonIconProps>(ButtonIcon, {\n name: \"ButtonEndIcon\",\n className: getClassName(bem(\"button\", \"icon\", \"end\")),\n})()\n"],"mappings":";;;;;;;;;;;;;;AA8BA,MAAM,iBAAiB,UAAwB;CAC7C,MAAM,YAAY,OAAO,CAAC,KAAK;CAQ/B,OAAO;EAAE,KANG,aAAa,SAA6B;GACpD,IAAI,MAAM,UAAU,UAAU,KAAK,YAAY;EACjD,GAAG,CAAC,CAIO;EAAG,MAFD,UAAU,UAAU,WAAW,KAAA;CAEzB;AACrB;AAoEA,MAAM,EACJ,WACA,kBACA,cAAc,oBACd,qBACA,iBAAiB,uBACjB,gBACE,gBACF,UACA,WACF;;;;;;AASA,MAAa,SAAS,aACnB,EACC,KACA,IACA,QACA,UACA,UACA,eACA,UAAU,MACV,SACA,cAAc,QACd,gBACA,mBAAmB,SACnB,YAAY,MACZ,WACA,cACA,GAAG,WACC;CACJ,MAAM,gBAAgB,YAAY;CAClC,MAAM,EAAE,KAAK,WAAW,SAAS,cAAc,EAAE;CACjD,MAAM,EAAE,SAAS,GAAG,gBAAgB,UAAU;EAC5C,GAAG;EACH,UAAU,iBAAiB;CAC7B,CAAC;CACD,MAAM,eAAe,WAAW,qBAAqB;CACrD,MAAM,aAAa,WAAW,qBAAqB;CAEnD,MAAM,UAAU,eACP;EAAE;EAAS;EAAa;EAAgB;EAAW;CAAU,IACpE;EAAC;EAAa;EAA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 -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.js","names":["Select.Root"],"sources":["../../../../src/components/calendar/calendar.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type { GenericsComponent, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ReactNodeOrFunction } from \"../../utils\"\nimport type { CalendarStyle } from \"./calendar.style\"\nimport type {\n UseCalendarDayProps,\n UseCalendarProps,\n UseCalendarReturn,\n} from \"./use-calendar\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport { runIfFn } from \"../../utils\"\nimport { resetFieldProps } from \"../field\"\nimport { ChevronLeftIcon, ChevronRightIcon } from \"../icon\"\nimport { Select } from \"../select\"\nimport { calendarStyle } from \"./calendar.style\"\nimport {\n CalendarContext,\n CalendarDescendantsContext,\n useCalendar,\n useCalendarContext,\n useCalendarDay,\n} from \"./use-calendar\"\n\ninterface ComponentContext\n extends\n Pick<\n UseCalendarReturn,\n | \"getMonthProps\"\n | \"getMonthSelectProps\"\n | \"getNavigationProps\"\n | \"getNextButtonProps\"\n | \"getPrevButtonProps\"\n | \"getStatusProps\"\n | \"getWeekdayProps\"\n | \"getYearSelectProps\"\n | \"monthDays\"\n | \"monthItems\"\n | \"weekdays\"\n | \"yearItems\"\n >,\n Pick<\n CalendarRootProps,\n | \"buttonProps\"\n | \"controlProps\"\n | \"day\"\n | \"dayProps\"\n | \"monthProps\"\n | \"monthSelectProps\"\n | \"navigationProps\"\n | \"nextButtonProps\"\n | \"prevButtonProps\"\n | \"selectProps\"\n | \"weekdayProps\"\n | \"weekdaysProps\"\n | \"weekProps\"\n | \"weeksProps\"\n | \"yearSelectProps\"\n > {}\n\nexport interface CalendarRootProps<\n Multiple extends boolean = false,\n Range extends boolean = false,\n>\n extends\n Omit<HTMLStyledProps, \"defaultValue\" | \"onChange\">,\n ThemeProps<CalendarStyle>,\n UseCalendarProps<Multiple, Range>,\n Pick<CalendarMonthProps, \"day\"> {\n /**\n * Props for the button component.\n */\n buttonProps?: HTMLStyledProps<\"button\">\n /**\n * Props for the control component.\n */\n controlProps?: CalendarControlProps\n /**\n * Props for the day component.\n */\n dayProps?: Omit<CalendarDayProps, \"value\">\n /**\n * Props for the month component.\n */\n monthProps?: CalendarMonthProps\n /**\n * Props for the month select component.\n */\n monthSelectProps?: CalendarMonthSelectProps\n /**\n * Props for the navigation component.\n */\n navigationProps?: Omit<CalendarNavigationProps, \"children\">\n /**\n * Props for the next button component.\n */\n nextButtonProps?: CalendarNextButtonProps\n /**\n * Props for the prev button component.\n */\n prevButtonProps?: CalendarPrevButtonProps\n /**\n * Props for the select component.\n */\n selectProps?: Select.RootProps\n /**\n * Props for the weekday component.\n */\n weekdayProps?: HTMLStyledProps<\"th\">\n /**\n * Props for the weekdays component.\n */\n weekdaysProps?: HTMLStyledProps<\"tr\">\n /**\n * Props for the week component.\n */\n weekProps?: HTMLStyledProps<\"tr\">\n /**\n * Props for the weeks component.\n */\n weeksProps?: HTMLStyledProps<\"tbody\">\n /**\n * Props for the year select component.\n */\n yearSelectProps?: CalendarYearSelectProps\n}\n\nconst {\n ComponentContext,\n PropsContext: CalendarPropsContext,\n useComponentContext,\n usePropsContext: useCalendarPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<CalendarRootProps, CalendarStyle, ComponentContext>(\n \"calendar\",\n calendarStyle,\n)\n\nexport { CalendarPropsContext, useCalendarPropsContext }\n\n/**\n * `Calendar` is a component for displaying or selecting dates in a calendar.\n *\n * @see https://yamada-ui.com/docs/components/calendar\n */\nexport const CalendarRoot = withProvider(\n <Multiple extends boolean = false, Range extends boolean = false>({\n children,\n day,\n buttonProps,\n controlProps,\n dayProps,\n monthProps,\n monthSelectProps,\n navigationProps,\n nextButtonProps,\n prevButtonProps,\n selectProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n yearSelectProps,\n ...props\n }: CalendarRootProps<Multiple, Range>) => {\n const {\n descendants,\n disabled,\n endOfMonth,\n excludeDate,\n holidays,\n locale,\n max,\n maxDate,\n minDate,\n month,\n monthDays,\n monthItems,\n multiple,\n range,\n startDayOfWeek,\n startOfMonth,\n today,\n value,\n weekdays,\n weekendDays,\n yearItems,\n getMonthProps,\n getMonthSelectProps,\n getNavigationProps,\n getNextButtonProps,\n getPrevButtonProps,\n getRootProps,\n getStatusProps,\n getWeekdayProps,\n getYearSelectProps,\n onChange,\n onMonthChange,\n onNextMonth,\n onPrevMonth,\n } = useCalendar(props)\n const calendarContext = useMemo(\n () => ({\n disabled,\n endOfMonth,\n excludeDate,\n holidays,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n startDayOfWeek,\n startOfMonth,\n today,\n value,\n weekendDays,\n onChange,\n onMonthChange,\n onNextMonth,\n onPrevMonth,\n }),\n [\n disabled,\n endOfMonth,\n excludeDate,\n holidays,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n startDayOfWeek,\n startOfMonth,\n today,\n value,\n weekendDays,\n onChange,\n onMonthChange,\n onNextMonth,\n onPrevMonth,\n ],\n )\n const componentContext = useMemo(\n () => ({\n day,\n monthDays,\n monthItems,\n weekdays,\n yearItems,\n buttonProps,\n controlProps,\n dayProps,\n getMonthProps,\n getMonthSelectProps,\n getNavigationProps,\n getNextButtonProps,\n getPrevButtonProps,\n getStatusProps,\n getWeekdayProps,\n getYearSelectProps,\n monthProps,\n monthSelectProps,\n navigationProps,\n nextButtonProps,\n prevButtonProps,\n selectProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n yearSelectProps,\n }),\n [\n day,\n monthDays,\n monthItems,\n weekdays,\n yearItems,\n buttonProps,\n controlProps,\n dayProps,\n getMonthProps,\n getMonthSelectProps,\n getNavigationProps,\n getNextButtonProps,\n getPrevButtonProps,\n getStatusProps,\n getWeekdayProps,\n getYearSelectProps,\n monthProps,\n monthSelectProps,\n navigationProps,\n nextButtonProps,\n prevButtonProps,\n selectProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n yearSelectProps,\n ],\n )\n\n return (\n <CalendarDescendantsContext value={descendants}>\n <CalendarContext value={calendarContext}>\n <ComponentContext value={componentContext}>\n <styled.div {...getRootProps()}>\n {children ?? (\n <>\n <CalendarNavigation />\n <CalendarMonth />\n </>\n )}\n </styled.div>\n </ComponentContext>\n </CalendarContext>\n </CalendarDescendantsContext>\n )\n },\n \"root\",\n)() as GenericsComponent<{\n <Multiple extends boolean = false, Range extends boolean = false>(\n props: CalendarRootProps<Multiple, Range>,\n ): ReactElement\n}>\n\nexport interface CalendarNavigationProps extends HTMLStyledProps {}\n\nexport const CalendarNavigation = withContext<\"div\", CalendarNavigationProps>(\n \"div\",\n [\"row\", \"navigation\"],\n)(undefined, ({ children, ...rest }) => {\n const { getNavigationProps, navigationProps } = useComponentContext()\n\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return (\n <>\n <CalendarPrevButton />\n <CalendarControl />\n <CalendarNextButton />\n </>\n )\n }, [children])\n\n return {\n ...getNavigationProps(mergeProps(navigationProps, rest)()),\n children: computedChildren,\n }\n})\n\nexport interface CalendarControlProps extends Omit<\n HTMLStyledProps,\n \"children\"\n> {\n /**\n * The control children to use.\n */\n children?: ReactNodeOrFunction<{ month: Date }>\n}\n\nexport const CalendarControl = withContext<\"div\", CalendarControlProps>(\n \"div\",\n \"control\",\n)(undefined, ({ children, ...rest }) => {\n const { month } = useCalendarContext()\n const { controlProps, getStatusProps } = useComponentContext()\n\n const computedChildren = useMemo(() => {\n if (children) return runIfFn(children, { month })\n\n return (\n <>\n <CalendarMonthSelect />\n <CalendarYearSelect />\n </>\n )\n }, [children, month])\n\n return {\n ...mergeProps(controlProps, rest)(),\n children: (\n <>\n {computedChildren}\n <styled.div {...getStatusProps()} />\n </>\n ),\n }\n})\n\nexport interface CalendarPrevButtonProps extends HTMLStyledProps<\"button\"> {}\n\nexport const CalendarPrevButton = withContext<\n \"button\",\n CalendarPrevButtonProps\n>(\"button\", [\"button\", \"prev\"])(\n undefined,\n ({ children = <ChevronLeftIcon />, ...rest }) => {\n const { buttonProps, getPrevButtonProps, prevButtonProps } =\n useComponentContext()\n\n return {\n children,\n ...getPrevButtonProps(mergeProps(buttonProps, prevButtonProps, rest)()),\n }\n },\n)\n\nexport interface CalendarNextButtonProps extends HTMLStyledProps<\"button\"> {}\n\nexport const CalendarNextButton = withContext<\n \"button\",\n CalendarNextButtonProps\n>(\"button\", [\"button\", \"next\"])(\n undefined,\n ({ children = <ChevronRightIcon />, ...rest }) => {\n const { buttonProps, getNextButtonProps, nextButtonProps } =\n useComponentContext()\n\n return {\n children,\n ...getNextButtonProps(mergeProps(buttonProps, nextButtonProps, rest)()),\n }\n },\n)\n\nexport interface CalendarSeparatorProps extends HTMLStyledProps<\"span\"> {}\n\nexport const CalendarSeparator = withContext<\"span\", CalendarSeparatorProps>(\n \"span\",\n \"separator\",\n)({ children: \"/\", role: \"separator\" })\n\nexport interface CalendarYearSelectProps extends Select.RootProps {}\n\nexport const CalendarYearSelect = withContext<\"div\", CalendarYearSelectProps>(\n (props) => {\n const { yearItems, getYearSelectProps, selectProps, yearSelectProps } =\n useComponentContext()\n const { contentProps, rootProps, ...rest } = mergeProps(\n selectProps,\n yearSelectProps,\n props,\n )()\n\n return (\n <Select.Root\n variant=\"plain\"\n items={yearItems}\n minH=\"{cell-size}\"\n contentProps={{ minW: \"{select-content-size}\", ...contentProps }}\n rootProps={{\n fontSize: \"{select-font-size}\",\n w: \"{select-root-size}\",\n ...rootProps,\n }}\n {...resetFieldProps}\n {...getYearSelectProps(rest)}\n />\n )\n },\n [\"select\", \"years\"],\n)()\n\nexport interface CalendarMonthSelectProps extends Select.RootProps {}\n\nexport const CalendarMonthSelect = withContext<\"div\", CalendarMonthSelectProps>(\n (props) => {\n const { monthItems, getMonthSelectProps, monthSelectProps, selectProps } =\n useComponentContext()\n const { contentProps, rootProps, ...rest } = mergeProps(\n selectProps,\n monthSelectProps,\n props,\n )()\n\n return (\n <Select.Root\n variant=\"plain\"\n items={monthItems}\n minH=\"{cell-size}\"\n contentProps={{ minW: \"{select-content-size}\", ...contentProps }}\n rootProps={{\n fontSize: \"{select-font-size}\",\n w: \"{select-root-size}\",\n ...rootProps,\n }}\n {...resetFieldProps}\n {...getMonthSelectProps(rest)}\n />\n )\n },\n [\"select\", \"months\"],\n)()\n\nexport interface CalendarMonthProps extends Omit<\n HTMLStyledProps<\"table\">,\n \"children\"\n> {\n /**\n * The day component to use.\n */\n day?: ReactNodeOrFunction<{ value: Date }>\n}\n\nexport const CalendarMonth = withContext<\"table\", CalendarMonthProps>(\n \"table\",\n \"month\",\n)(undefined, ({ day: dayProp, ...rest }) => {\n const {\n day,\n monthDays,\n weekdays,\n dayProps,\n getMonthProps,\n getWeekdayProps,\n monthProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n } = useComponentContext()\n\n dayProp ??= day\n\n const children = (\n <>\n <styled.thead aria-hidden>\n <CalendarWeekDays {...weekdaysProps}>\n {weekdays.map(({ label, value }, index) => (\n <CalendarWeekday\n key={index}\n {...getWeekdayProps({ ...weekdayProps, value })}\n >\n {label}\n </CalendarWeekday>\n ))}\n </CalendarWeekDays>\n </styled.thead>\n\n <CalendarWeeks {...weeksProps}>\n {monthDays.map((week, index) => (\n <CalendarWeek key={index} {...weekProps}>\n {week.map(({ label, value }) => (\n <CalendarDay\n key={value.toDateString()}\n {...{ ...dayProps, value }}\n >\n {runIfFn(dayProp, { value }) ?? (\n <styled.span>{label}</styled.span>\n )}\n </CalendarDay>\n ))}\n </CalendarWeek>\n ))}\n </CalendarWeeks>\n </>\n )\n\n return {\n ...getMonthProps(mergeProps(monthProps, rest)()),\n children,\n }\n})\n\nconst CalendarWeekDays = withContext(\"tr\", [\"row\", \"weekdays\"])()\n\nconst CalendarWeekday = withContext(\"th\", [\"cell\", \"weekday\"])()\n\nconst CalendarWeeks = withContext(\"tbody\", \"weeks\")()\n\nconst CalendarWeek = withContext(\"tr\", [\"row\", \"week\"])()\n\ninterface CalendarDayProps\n extends Omit<HTMLStyledProps<\"td\">, \"value\">, UseCalendarDayProps {}\n\nconst CalendarDay = withContext<\"td\", CalendarDayProps>(\"td\", [\"cell\", \"day\"])(\n undefined,\n (props) => {\n const { getDayProps } = useCalendarDay(props)\n\n return getDayProps()\n },\n)\n"],"mappings":";;;;;;;;;;;;;;AAiIA,MAAM,EACJ,kBACA,cAAc,sBACd,qBACA,iBAAiB,yBACjB,aACA,iBACE,oBACF,YACA,aACF;;;;;;AASA,MAAa,eAAe,cACwC,EAChE,UACA,KACA,aACA,cACA,UACA,YACA,kBACA,iBACA,iBACA,iBACA,aACA,cACA,eACA,WACA,YACA,iBACA,GAAG,YACqC;CACxC,MAAM,EACJ,aACA,UACA,YACA,aACA,UACA,QACA,KACA,SACA,SACA,OACA,WACA,YACA,UACA,OACA,gBACA,cACA,OACA,OACA,UACA,aACA,WACA,eACA,qBACA,oBACA,oBACA,oBACA,cACA,gBACA,iBACA,oBACA,UACA,eACA,aACA,gBACE,YAAY,KAAK;CACrB,MAAM,kBAAkB,eACf;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CACA,MAAM,mBAAmB,eAChB;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAEA,OACE,oBAAC,4BAAD;EAA4B,OAAO;Y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,CAAC;EAC/C;CACF;AACF,CAAC;AAED,MAAM,mBAAmB,YAAY,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;AAEhE,MAAM,kBAAkB,YAAY,MAAM,CAAC,QAAQ,SAAS,CAAC,CAAC,CAAC;AAE/D,MAAM,gBAAgB,YAAY,SAAS,OAAO,CAAC,CAAC;AAEpD,MAAM,eAAe,YAAY,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC;AAKxD,MAAM,cAAc,YAAoC,MAAM,CAAC,QAAQ,KAAK,CAAC,CAAC,CAC5E,KAAA,IACC,UAAU;CACT,MAAM,EAAE,gBAAgB,eAAe,KAAK;CAE5C,OAAO,YAAY;AACrB,CACF"}
|
|
1
|
+
{"version":3,"file":"calendar.js","names":["Select.Root"],"sources":["../../../../src/components/calendar/calendar.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type { GenericsComponent, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ReactNodeOrFunction } from \"../../utils\"\nimport type { CalendarStyle } from \"./calendar.style\"\nimport type {\n UseCalendarDayProps,\n UseCalendarProps,\n UseCalendarReturn,\n} from \"./use-calendar\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport { runIfFn } from \"../../utils\"\nimport { resetFieldProps } from \"../field\"\nimport { ChevronLeftIcon, ChevronRightIcon } from \"../icon\"\nimport { Select } from \"../select\"\nimport { calendarStyle } from \"./calendar.style\"\nimport {\n CalendarContext,\n CalendarDescendantsContext,\n useCalendar,\n useCalendarContext,\n useCalendarDay,\n} from \"./use-calendar\"\n\ninterface ComponentContext\n extends\n Pick<\n UseCalendarReturn,\n | \"getMonthProps\"\n | \"getMonthSelectProps\"\n | \"getNavigationProps\"\n | \"getNextButtonProps\"\n | \"getPrevButtonProps\"\n | \"getStatusProps\"\n | \"getWeekdayProps\"\n | \"getYearSelectProps\"\n | \"monthDays\"\n | \"monthItems\"\n | \"weekdays\"\n | \"yearItems\"\n >,\n Pick<\n CalendarRootProps,\n | \"buttonProps\"\n | \"controlProps\"\n | \"day\"\n | \"dayProps\"\n | \"monthProps\"\n | \"monthSelectProps\"\n | \"navigationProps\"\n | \"nextButtonProps\"\n | \"prevButtonProps\"\n | \"selectProps\"\n | \"weekdayProps\"\n | \"weekdaysProps\"\n | \"weekProps\"\n | \"weeksProps\"\n | \"yearSelectProps\"\n > {}\n\nexport interface CalendarRootProps<\n Multiple extends boolean = false,\n Range extends boolean = false,\n>\n extends\n Omit<HTMLStyledProps, \"defaultValue\" | \"onChange\">,\n ThemeProps<CalendarStyle>,\n UseCalendarProps<Multiple, Range>,\n Pick<CalendarMonthProps, \"day\"> {\n /**\n * Props for the button component.\n */\n buttonProps?: HTMLStyledProps<\"button\">\n /**\n * Props for the control component.\n */\n controlProps?: CalendarControlProps\n /**\n * Props for the day component.\n */\n dayProps?: Omit<CalendarDayProps, \"value\">\n /**\n * Props for the month component.\n */\n monthProps?: CalendarMonthProps\n /**\n * Props for the month select component.\n */\n monthSelectProps?: CalendarMonthSelectProps\n /**\n * Props for the navigation component.\n */\n navigationProps?: Omit<CalendarNavigationProps, \"children\">\n /**\n * Props for the next button component.\n */\n nextButtonProps?: CalendarNextButtonProps\n /**\n * Props for the prev button component.\n */\n prevButtonProps?: CalendarPrevButtonProps\n /**\n * Props for the select component.\n */\n selectProps?: Select.RootProps\n /**\n * Props for the weekday component.\n */\n weekdayProps?: HTMLStyledProps<\"th\">\n /**\n * Props for the weekdays component.\n */\n weekdaysProps?: HTMLStyledProps<\"tr\">\n /**\n * Props for the week component.\n */\n weekProps?: HTMLStyledProps<\"tr\">\n /**\n * Props for the weeks component.\n */\n weeksProps?: HTMLStyledProps<\"tbody\">\n /**\n * Props for the year select component.\n */\n yearSelectProps?: CalendarYearSelectProps\n}\n\nconst {\n ComponentContext,\n PropsContext: CalendarPropsContext,\n useComponentContext,\n usePropsContext: useCalendarPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<CalendarRootProps, CalendarStyle, ComponentContext>(\n \"calendar\",\n calendarStyle,\n)\n\nexport { CalendarPropsContext, useCalendarPropsContext }\n\n/**\n * `Calendar` is a component for displaying or selecting dates in a calendar.\n *\n * @see https://yamada-ui.com/docs/components/calendar\n */\nexport const CalendarRoot = withProvider(\n <Multiple extends boolean = false, Range extends boolean = false>({\n children,\n day,\n buttonProps,\n controlProps,\n dayProps,\n monthProps,\n monthSelectProps,\n navigationProps,\n nextButtonProps,\n prevButtonProps,\n selectProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n yearSelectProps,\n ...props\n }: CalendarRootProps<Multiple, Range>) => {\n const {\n descendants,\n disabled,\n endOfMonth,\n excludeDate,\n holidays,\n locale,\n max,\n maxDate,\n minDate,\n month,\n monthDays,\n monthItems,\n multiple,\n range,\n startDayOfWeek,\n startOfMonth,\n today,\n value,\n weekdays,\n weekendDays,\n yearItems,\n getMonthProps,\n getMonthSelectProps,\n getNavigationProps,\n getNextButtonProps,\n getPrevButtonProps,\n getRootProps,\n getStatusProps,\n getWeekdayProps,\n getYearSelectProps,\n onChange,\n onMonthChange,\n onNextMonth,\n onPrevMonth,\n } = useCalendar(props)\n const calendarContext = useMemo(\n () => ({\n disabled,\n endOfMonth,\n excludeDate,\n holidays,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n startDayOfWeek,\n startOfMonth,\n today,\n value,\n weekendDays,\n onChange,\n onMonthChange,\n onNextMonth,\n onPrevMonth,\n }),\n [\n disabled,\n endOfMonth,\n excludeDate,\n holidays,\n locale,\n max,\n maxDate,\n minDate,\n month,\n multiple,\n range,\n startDayOfWeek,\n startOfMonth,\n today,\n value,\n weekendDays,\n onChange,\n onMonthChange,\n onNextMonth,\n onPrevMonth,\n ],\n )\n const componentContext = useMemo(\n () => ({\n day,\n monthDays,\n monthItems,\n weekdays,\n yearItems,\n buttonProps,\n controlProps,\n dayProps,\n getMonthProps,\n getMonthSelectProps,\n getNavigationProps,\n getNextButtonProps,\n getPrevButtonProps,\n getStatusProps,\n getWeekdayProps,\n getYearSelectProps,\n monthProps,\n monthSelectProps,\n navigationProps,\n nextButtonProps,\n prevButtonProps,\n selectProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n yearSelectProps,\n }),\n [\n day,\n monthDays,\n monthItems,\n weekdays,\n yearItems,\n buttonProps,\n controlProps,\n dayProps,\n getMonthProps,\n getMonthSelectProps,\n getNavigationProps,\n getNextButtonProps,\n getPrevButtonProps,\n getStatusProps,\n getWeekdayProps,\n getYearSelectProps,\n monthProps,\n monthSelectProps,\n navigationProps,\n nextButtonProps,\n prevButtonProps,\n selectProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n yearSelectProps,\n ],\n )\n\n return (\n <CalendarDescendantsContext value={descendants}>\n <CalendarContext value={calendarContext}>\n <ComponentContext value={componentContext}>\n <styled.div {...getRootProps()}>\n {children ?? (\n <>\n <CalendarNavigation />\n <CalendarMonth />\n </>\n )}\n </styled.div>\n </ComponentContext>\n </CalendarContext>\n </CalendarDescendantsContext>\n )\n },\n \"root\",\n)() as GenericsComponent<{\n <Multiple extends boolean = false, Range extends boolean = false>(\n props: CalendarRootProps<Multiple, Range>,\n ): ReactElement\n}>\n\nexport interface CalendarNavigationProps extends HTMLStyledProps {}\n\nexport const CalendarNavigation = withContext<\"div\", CalendarNavigationProps>(\n \"div\",\n [\"row\", \"navigation\"],\n)(undefined, ({ children, ...rest }) => {\n const { getNavigationProps, navigationProps } = useComponentContext()\n\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return (\n <>\n <CalendarPrevButton />\n <CalendarControl />\n <CalendarNextButton />\n </>\n )\n }, [children])\n\n return {\n ...getNavigationProps(mergeProps(navigationProps, rest)()),\n children: computedChildren,\n }\n})\n\nexport interface CalendarControlProps extends Omit<\n HTMLStyledProps,\n \"children\"\n> {\n /**\n * The control children to use.\n */\n children?: ReactNodeOrFunction<{ month: Date }>\n}\n\nexport const CalendarControl = withContext<\"div\", CalendarControlProps>(\n \"div\",\n \"control\",\n)(undefined, ({ children, ...rest }) => {\n const { month } = useCalendarContext()\n const { controlProps, getStatusProps } = useComponentContext()\n\n const computedChildren = useMemo(() => {\n if (children) return runIfFn(children, { month })\n\n return (\n <>\n <CalendarMonthSelect />\n <CalendarYearSelect />\n </>\n )\n }, [children, month])\n\n return {\n ...mergeProps(controlProps, rest)(),\n children: (\n <>\n {computedChildren}\n <styled.div {...getStatusProps()} />\n </>\n ),\n }\n})\n\nexport interface CalendarPrevButtonProps extends HTMLStyledProps<\"button\"> {}\n\nexport const CalendarPrevButton = withContext<\n \"button\",\n CalendarPrevButtonProps\n>(\"button\", [\"button\", \"prev\"])(\n undefined,\n ({ children = <ChevronLeftIcon />, ...rest }) => {\n const { buttonProps, getPrevButtonProps, prevButtonProps } =\n useComponentContext()\n\n return {\n children,\n ...getPrevButtonProps(mergeProps(buttonProps, prevButtonProps, rest)()),\n }\n },\n)\n\nexport interface CalendarNextButtonProps extends HTMLStyledProps<\"button\"> {}\n\nexport const CalendarNextButton = withContext<\n \"button\",\n CalendarNextButtonProps\n>(\"button\", [\"button\", \"next\"])(\n undefined,\n ({ children = <ChevronRightIcon />, ...rest }) => {\n const { buttonProps, getNextButtonProps, nextButtonProps } =\n useComponentContext()\n\n return {\n children,\n ...getNextButtonProps(mergeProps(buttonProps, nextButtonProps, rest)()),\n }\n },\n)\n\nexport interface CalendarSeparatorProps extends HTMLStyledProps<\"span\"> {}\n\nexport const CalendarSeparator = withContext<\"span\", CalendarSeparatorProps>(\n \"span\",\n \"separator\",\n)({ children: \"/\", role: \"separator\" })\n\nexport interface CalendarYearSelectProps extends Select.RootProps {}\n\nexport const CalendarYearSelect = withContext<\"div\", CalendarYearSelectProps>(\n (props) => {\n const { yearItems, getYearSelectProps, selectProps, yearSelectProps } =\n useComponentContext()\n const { contentProps, rootProps, ...rest } = mergeProps(\n selectProps,\n yearSelectProps,\n props,\n )()\n\n return (\n <Select.Root\n variant=\"plain\"\n items={yearItems}\n minH=\"{cell-size}\"\n contentProps={{ minW: \"{select-content-size}\", ...contentProps }}\n rootProps={{\n fontSize: \"{select-font-size}\",\n w: \"{select-root-size}\",\n ...rootProps,\n }}\n {...resetFieldProps}\n {...getYearSelectProps(rest)}\n />\n )\n },\n [\"select\", \"years\"],\n)()\n\nexport interface CalendarMonthSelectProps extends Select.RootProps {}\n\nexport const CalendarMonthSelect = withContext<\"div\", CalendarMonthSelectProps>(\n (props) => {\n const { monthItems, getMonthSelectProps, monthSelectProps, selectProps } =\n useComponentContext()\n const { contentProps, rootProps, ...rest } = mergeProps(\n selectProps,\n monthSelectProps,\n props,\n )()\n\n return (\n <Select.Root\n variant=\"plain\"\n items={monthItems}\n minH=\"{cell-size}\"\n contentProps={{ minW: \"{select-content-size}\", ...contentProps }}\n rootProps={{\n fontSize: \"{select-font-size}\",\n w: \"{select-root-size}\",\n ...rootProps,\n }}\n {...resetFieldProps}\n {...getMonthSelectProps(rest)}\n />\n )\n },\n [\"select\", \"months\"],\n)()\n\nexport interface CalendarMonthProps extends Omit<\n HTMLStyledProps<\"table\">,\n \"children\"\n> {\n /**\n * The day component to use.\n */\n day?: ReactNodeOrFunction<{ value: Date }>\n}\n\nexport const CalendarMonth = withContext<\"table\", CalendarMonthProps>(\n \"table\",\n \"month\",\n)(undefined, ({ day: dayProp, ...rest }) => {\n const {\n day,\n monthDays,\n weekdays,\n dayProps,\n getMonthProps,\n getWeekdayProps,\n monthProps,\n weekdayProps,\n weekdaysProps,\n weekProps,\n weeksProps,\n } = useComponentContext()\n\n dayProp ??= day\n\n const children = (\n <>\n <styled.thead aria-hidden>\n <CalendarWeekDays {...weekdaysProps}>\n {weekdays.map(({ label, value }, index) => (\n <CalendarWeekday\n key={index}\n {...getWeekdayProps({ ...weekdayProps, value })}\n >\n {label}\n </CalendarWeekday>\n ))}\n </CalendarWeekDays>\n </styled.thead>\n\n <CalendarWeeks {...weeksProps}>\n {monthDays.map((week, index) => (\n <CalendarWeek key={index} {...weekProps}>\n {week.map(({ label, value }) => (\n <CalendarDay\n key={value.toDateString()}\n {...{ ...dayProps, value }}\n >\n {runIfFn(dayProp, { value }) ?? (\n <styled.span>{label}</styled.span>\n )}\n </CalendarDay>\n ))}\n </CalendarWeek>\n ))}\n </CalendarWeeks>\n </>\n )\n\n return {\n ...getMonthProps(mergeProps(monthProps, rest)()),\n children,\n }\n})\n\nconst CalendarWeekDays = withContext(\"tr\", [\"row\", \"weekdays\"])()\n\nconst CalendarWeekday = withContext(\"th\", [\"cell\", \"weekday\"])()\n\nconst CalendarWeeks = withContext(\"tbody\", \"weeks\")()\n\nconst CalendarWeek = withContext(\"tr\", [\"row\", \"week\"])()\n\ninterface CalendarDayProps\n extends Omit<HTMLStyledProps<\"td\">, \"value\">, UseCalendarDayProps {}\n\nconst CalendarDay = withContext<\"td\", CalendarDayProps>(\"td\", [\"cell\", \"day\"])(\n undefined,\n (props) => {\n const { getDayProps } = useCalendarDay(props)\n\n return getDayProps()\n },\n)\n"],"mappings":";;;;;;;;;;;;;;AAiIA,MAAM,EACJ,kBACA,cAAc,sBACd,qBACA,iBAAiB,yBACjB,aACA,iBACE,oBACF,YACA,aACF;;;;;;AASA,MAAa,eAAe,cACwC,EAChE,UACA,KACA,aACA,cACA,UACA,YACA,kBACA,iBACA,iBACA,iBACA,aACA,cACA,eACA,WACA,YACA,iBACA,GAAG,YACqC;CACxC,MAAM,EACJ,aACA,UACA,YACA,aACA,UACA,QACA,KACA,SACA,SACA,OACA,WACA,YACA,UACA,OACA,gBACA,cACA,OACA,OACA,UACA,aACA,WACA,eACA,qBACA,oBACA,oBACA,oBACA,cACA,gBACA,iBACA,oBACA,UACA,eACA,aACA,gBACE,YAAY,KAAK;CACrB,MAAM,kBAAkB,eACf;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CACA,MAAM,mBAAmB,eAChB;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAEA,OACE,oBAAC,4BAAD;EAA4B,OAAO;EACjC,UAAA,oBAAC,iBAAD;GAAiB,OAAO;GACtB,UAAA,oBAAC,kBAAD;IAAkB,OAAO;IACvB,UAAA,oBAAC,OAAO,KAAR;KAAY,GAAI,aAAa;KAC1B,UAAA,YACC,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,oBAAD,CAAqB,CAAA,GACrB,oBAAC,eAAD,CAAgB,CAAA,CAChB,EAAA,CAAA;IAEM,CAAA;GACI,CAAA;EACH,CAAA;CACS,CAAA;AAEhC,GACA,MACF,CAAC,CAAC;AAQF,MAAa,qBAAqB,YAChC,OACA,CAAC,OAAO,YAAY,CACtB,CAAC,CAAC,KAAA,IAAY,EAAE,UAAU,GAAG,WAAW;CACtC,MAAM,EAAE,oBAAoB,oBAAoB,oBAAoB;CAEpE,MAAM,mBAAmB,cAAc;EACrC,IAAI,UAAU,OAAO;EAErB,OACE,qBAAA,YAAA,EAAA,UAAA;GACE,oBAAC,oBAAD,CAAqB,CAAA;GACrB,oBAAC,iBAAD,CAAkB,CAAA;GAClB,oBAAC,oBAAD,CAAqB,CAAA;EACrB,EAAA,CAAA;CAEN,GAAG,CAAC,QAAQ,CAAC;CAEb,OAAO;EACL,GAAG,mBAAmB,WAAW,iBAAiB,IAAI,CAAC,CAAC,CAAC;EACzD,UAAU;CACZ;AAC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