@masaraxui/react 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +50 -0
- package/dist/components/accordion/accordion.d.ts +30 -0
- package/dist/components/accordion/accordion.js +191 -0
- package/dist/components/accordion/index.d.ts +25 -0
- package/dist/components/accordion/index.js +18 -0
- package/dist/components/alert/alert.d.ts +15 -0
- package/dist/components/alert/alert.js +152 -0
- package/dist/components/alert/index.d.ts +21 -0
- package/dist/components/alert/index.js +16 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +65 -0
- package/dist/components/alert-dialog/alert-dialog.js +309 -0
- package/dist/components/alert-dialog/index.d.ts +33 -0
- package/dist/components/alert-dialog/index.js +22 -0
- package/dist/components/autocomplete/autocomplete.d.ts +31 -0
- package/dist/components/autocomplete/autocomplete.js +241 -0
- package/dist/components/autocomplete/index.d.ts +25 -0
- package/dist/components/autocomplete/index.js +18 -0
- package/dist/components/avatar/avatar.d.ts +15 -0
- package/dist/components/avatar/avatar.js +93 -0
- package/dist/components/avatar/index.d.ts +17 -0
- package/dist/components/avatar/index.js +14 -0
- package/dist/components/badge/badge.d.ts +19 -0
- package/dist/components/badge/badge.js +87 -0
- package/dist/components/badge/index.d.ts +17 -0
- package/dist/components/badge/index.js +14 -0
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +14 -0
- package/dist/components/breadcrumbs/breadcrumbs.js +84 -0
- package/dist/components/breadcrumbs/index.d.ts +15 -0
- package/dist/components/breadcrumbs/index.js +13 -0
- package/dist/components/button/button.d.ts +10 -0
- package/dist/components/button/button.js +49 -0
- package/dist/components/button/index.d.ts +15 -0
- package/dist/components/button/index.js +13 -0
- package/dist/components/button-group/button-group.d.ts +26 -0
- package/dist/components/button-group/button-group.js +82 -0
- package/dist/components/button-group/index.d.ts +16 -0
- package/dist/components/button-group/index.js +14 -0
- package/dist/components/calendar/calendar.d.ts +71 -0
- package/dist/components/calendar/calendar.js +283 -0
- package/dist/components/calendar/index.d.ts +91 -0
- package/dist/components/calendar/index.js +29 -0
- package/dist/components/calendar-year-picker/calendar-year-picker.d.ts +61 -0
- package/dist/components/calendar-year-picker/calendar-year-picker.js +411 -0
- package/dist/components/calendar-year-picker/index.d.ts +43 -0
- package/dist/components/calendar-year-picker/index.js +18 -0
- package/dist/components/calendar-year-picker/year-picker-context.d.ts +28 -0
- package/dist/components/calendar-year-picker/year-picker-context.js +39 -0
- package/dist/components/card/card.d.ts +22 -0
- package/dist/components/card/card.js +141 -0
- package/dist/components/card/index.d.ts +23 -0
- package/dist/components/card/index.js +17 -0
- package/dist/components/checkbox/checkbox.d.ts +22 -0
- package/dist/components/checkbox/checkbox.js +124 -0
- package/dist/components/checkbox/index.d.ts +19 -0
- package/dist/components/checkbox/index.js +15 -0
- package/dist/components/checkbox-group/checkbox-group.d.ts +14 -0
- package/dist/components/checkbox-group/checkbox-group.js +33 -0
- package/dist/components/checkbox-group/index.d.ts +3 -0
- package/dist/components/checkbox-group/index.js +3 -0
- package/dist/components/chip/chip.d.ts +14 -0
- package/dist/components/chip/chip.js +67 -0
- package/dist/components/chip/index.d.ts +15 -0
- package/dist/components/chip/index.js +13 -0
- package/dist/components/close-button/close-button.d.ts +8 -0
- package/dist/components/close-button/close-button.js +33 -0
- package/dist/components/close-button/index.d.ts +13 -0
- package/dist/components/close-button/index.js +12 -0
- package/dist/components/color-area/color-area.d.ts +11 -0
- package/dist/components/color-area/color-area.js +70 -0
- package/dist/components/color-area/index.d.ts +15 -0
- package/dist/components/color-area/index.js +13 -0
- package/dist/components/color-field/color-field.d.ts +9 -0
- package/dist/components/color-field/color-field.js +29 -0
- package/dist/components/color-field/index.d.ts +22 -0
- package/dist/components/color-field/index.js +18 -0
- package/dist/components/color-input-group/color-input-group.d.ts +19 -0
- package/dist/components/color-input-group/color-input-group.js +98 -0
- package/dist/components/color-input-group/index.d.ts +19 -0
- package/dist/components/color-input-group/index.js +15 -0
- package/dist/components/color-picker/color-picker.d.ts +21 -0
- package/dist/components/color-picker/color-picker.js +86 -0
- package/dist/components/color-picker/index.d.ts +17 -0
- package/dist/components/color-picker/index.js +14 -0
- package/dist/components/color-slider/color-slider.d.ts +50 -0
- package/dist/components/color-slider/color-slider.js +205 -0
- package/dist/components/color-slider/index.d.ts +19 -0
- package/dist/components/color-slider/index.js +15 -0
- package/dist/components/color-swatch/color-swatch.d.ts +8 -0
- package/dist/components/color-swatch/color-swatch.js +31 -0
- package/dist/components/color-swatch/index.d.ts +13 -0
- package/dist/components/color-swatch/index.js +12 -0
- package/dist/components/color-swatch-picker/color-swatch-picker.d.ts +20 -0
- package/dist/components/color-swatch-picker/color-swatch-picker.js +149 -0
- package/dist/components/color-swatch-picker/index.d.ts +19 -0
- package/dist/components/color-swatch-picker/index.js +15 -0
- package/dist/components/combo-box/combo-box.d.ts +34 -0
- package/dist/components/combo-box/combo-box.js +116 -0
- package/dist/components/combo-box/index.d.ts +20 -0
- package/dist/components/combo-box/index.js +16 -0
- package/dist/components/date-field/date-field.d.ts +9 -0
- package/dist/components/date-field/date-field.js +29 -0
- package/dist/components/date-field/index.d.ts +26 -0
- package/dist/components/date-field/index.js +20 -0
- package/dist/components/date-input-group/date-input-group.d.ts +25 -0
- package/dist/components/date-input-group/date-input-group.js +146 -0
- package/dist/components/date-input-group/index.d.ts +23 -0
- package/dist/components/date-input-group/index.js +17 -0
- package/dist/components/date-picker/date-picker.d.ts +30 -0
- package/dist/components/date-picker/date-picker.js +151 -0
- package/dist/components/date-picker/index.d.ts +31 -0
- package/dist/components/date-picker/index.js +15 -0
- package/dist/components/date-range-picker/date-range-picker.d.ts +36 -0
- package/dist/components/date-range-picker/date-range-picker.js +173 -0
- package/dist/components/date-range-picker/index.d.ts +36 -0
- package/dist/components/date-range-picker/index.js +16 -0
- package/dist/components/description/description.d.ts +9 -0
- package/dist/components/description/description.js +22 -0
- package/dist/components/description/index.d.ts +13 -0
- package/dist/components/description/index.js +12 -0
- package/dist/components/disclosure/disclosure.d.ts +27 -0
- package/dist/components/disclosure/disclosure.js +157 -0
- package/dist/components/disclosure/index.d.ts +23 -0
- package/dist/components/disclosure/index.js +17 -0
- package/dist/components/disclosure-group/disclosure-group.d.ts +8 -0
- package/dist/components/disclosure-group/disclosure-group.js +35 -0
- package/dist/components/disclosure-group/index.d.ts +15 -0
- package/dist/components/disclosure-group/index.js +13 -0
- package/dist/components/disclosure-group/use-disclosure-group-navigation.d.ts +14 -0
- package/dist/components/disclosure-group/use-disclosure-group-navigation.js +51 -0
- package/dist/components/drawer/drawer.d.ts +84 -0
- package/dist/components/drawer/drawer.js +439 -0
- package/dist/components/drawer/index.d.ts +69 -0
- package/dist/components/drawer/index.js +22 -0
- package/dist/components/dropdown/dropdown.d.ts +38 -0
- package/dist/components/dropdown/dropdown.js +156 -0
- package/dist/components/dropdown/index.d.ts +29 -0
- package/dist/components/dropdown/index.js +20 -0
- package/dist/components/empty-state/empty-state.d.ts +7 -0
- package/dist/components/empty-state/empty-state.js +20 -0
- package/dist/components/empty-state/index.d.ts +13 -0
- package/dist/components/empty-state/index.js +12 -0
- package/dist/components/error-message/error-message.d.ts +9 -0
- package/dist/components/error-message/error-message.js +22 -0
- package/dist/components/error-message/index.d.ts +13 -0
- package/dist/components/error-message/index.js +12 -0
- package/dist/components/field-error/field-error.d.ts +8 -0
- package/dist/components/field-error/field-error.js +21 -0
- package/dist/components/field-error/index.d.ts +13 -0
- package/dist/components/field-error/index.js +12 -0
- package/dist/components/fieldset/fieldset.d.ts +16 -0
- package/dist/components/fieldset/fieldset.js +88 -0
- package/dist/components/fieldset/index.d.ts +19 -0
- package/dist/components/fieldset/index.js +15 -0
- package/dist/components/form/form.d.ts +7 -0
- package/dist/components/form/form.js +13 -0
- package/dist/components/form/index.d.ts +11 -0
- package/dist/components/form/index.js +11 -0
- package/dist/components/header/header.d.ts +7 -0
- package/dist/components/header/header.js +21 -0
- package/dist/components/header/index.d.ts +9 -0
- package/dist/components/header/index.js +10 -0
- package/dist/components/icons.d.ts +18 -0
- package/dist/components/icons.js +243 -0
- package/dist/components/index.d.ts +84 -0
- package/dist/components/input/index.d.ts +13 -0
- package/dist/components/input/index.js +12 -0
- package/dist/components/input/input.d.ts +8 -0
- package/dist/components/input/input.js +31 -0
- package/dist/components/input-group/index.d.ts +21 -0
- package/dist/components/input-group/index.js +16 -0
- package/dist/components/input-group/input-group.d.ts +20 -0
- package/dist/components/input-group/input-group.js +129 -0
- package/dist/components/input-otp/index.d.ts +22 -0
- package/dist/components/input-otp/index.js +21 -0
- package/dist/components/input-otp/input-otp.d.ts +26 -0
- package/dist/components/input-otp/input-otp.js +139 -0
- package/dist/components/kbd/index.d.ts +19 -0
- package/dist/components/kbd/index.js +15 -0
- package/dist/components/kbd/kbd.constants.d.ts +3 -0
- package/dist/components/kbd/kbd.constants.js +51 -0
- package/dist/components/kbd/kbd.d.ts +24 -0
- package/dist/components/kbd/kbd.js +76 -0
- package/dist/components/label/index.d.ts +13 -0
- package/dist/components/label/index.js +12 -0
- package/dist/components/label/label.d.ts +8 -0
- package/dist/components/label/label.js +27 -0
- package/dist/components/link/index.d.ts +15 -0
- package/dist/components/link/index.js +13 -0
- package/dist/components/link/link.d.ts +10 -0
- package/dist/components/link/link.js +59 -0
- package/dist/components/list-box/index.d.ts +23 -0
- package/dist/components/list-box/index.js +18 -0
- package/dist/components/list-box/list-box.d.ts +9 -0
- package/dist/components/list-box/list-box.js +23 -0
- package/dist/components/list-box-item/index.d.ts +15 -0
- package/dist/components/list-box-item/index.js +13 -0
- package/dist/components/list-box-item/list-box-item.d.ts +15 -0
- package/dist/components/list-box-item/list-box-item.js +77 -0
- package/dist/components/list-box-section/index.d.ts +10 -0
- package/dist/components/list-box-section/index.js +10 -0
- package/dist/components/list-box-section/list-box-section.d.ts +8 -0
- package/dist/components/list-box-section/list-box-section.js +22 -0
- package/dist/components/menu/index.d.ts +24 -0
- package/dist/components/menu/index.js +18 -0
- package/dist/components/menu/menu.d.ts +9 -0
- package/dist/components/menu/menu.js +20 -0
- package/dist/components/menu-item/index.d.ts +17 -0
- package/dist/components/menu-item/index.js +14 -0
- package/dist/components/menu-item/menu-item.d.ts +20 -0
- package/dist/components/menu-item/menu-item.js +123 -0
- package/dist/components/menu-section/index.d.ts +10 -0
- package/dist/components/menu-section/index.js +10 -0
- package/dist/components/menu-section/menu-section.d.ts +8 -0
- package/dist/components/menu-section/menu-section.js +22 -0
- package/dist/components/meter/index.d.ts +34 -0
- package/dist/components/meter/index.js +15 -0
- package/dist/components/meter/meter.d.ts +29 -0
- package/dist/components/meter/meter.js +108 -0
- package/dist/components/modal/index.d.ts +33 -0
- package/dist/components/modal/index.js +22 -0
- package/dist/components/modal/modal.d.ts +53 -0
- package/dist/components/modal/modal.js +288 -0
- package/dist/components/number-field/index.d.ts +21 -0
- package/dist/components/number-field/index.js +16 -0
- package/dist/components/number-field/number-field.d.ts +20 -0
- package/dist/components/number-field/number-field.js +127 -0
- package/dist/components/pagination/index.d.ts +64 -0
- package/dist/components/pagination/index.js +21 -0
- package/dist/components/pagination/pagination.d.ts +84 -0
- package/dist/components/pagination/pagination.js +230 -0
- package/dist/components/popover/index.d.ts +23 -0
- package/dist/components/popover/index.js +17 -0
- package/dist/components/popover/popover.d.ts +24 -0
- package/dist/components/popover/popover.js +153 -0
- package/dist/components/progress-bar/index.d.ts +34 -0
- package/dist/components/progress-bar/index.js +15 -0
- package/dist/components/progress-bar/progress-bar.d.ts +29 -0
- package/dist/components/progress-bar/progress-bar.js +108 -0
- package/dist/components/progress-circle/index.d.ts +34 -0
- package/dist/components/progress-circle/index.js +15 -0
- package/dist/components/progress-circle/progress-circle.d.ts +29 -0
- package/dist/components/progress-circle/progress-circle.js +126 -0
- package/dist/components/rac/components.d.ts +1 -0
- package/dist/components/rac/index.d.ts +5 -0
- package/dist/components/rac/index.js +3 -0
- package/dist/components/rac/types.d.ts +3 -0
- package/dist/components/rac/utils.d.ts +1 -0
- package/dist/components/radio/index.d.ts +19 -0
- package/dist/components/radio/index.js +15 -0
- package/dist/components/radio/radio.d.ts +21 -0
- package/dist/components/radio/radio.js +97 -0
- package/dist/components/radio-group/index.d.ts +13 -0
- package/dist/components/radio-group/index.js +12 -0
- package/dist/components/radio-group/radio-group.d.ts +8 -0
- package/dist/components/radio-group/radio-group.js +27 -0
- package/dist/components/range-calendar/index.d.ts +91 -0
- package/dist/components/range-calendar/index.js +29 -0
- package/dist/components/range-calendar/range-calendar.d.ts +71 -0
- package/dist/components/range-calendar/range-calendar.js +298 -0
- package/dist/components/scroll-shadow/index.d.ts +21 -0
- package/dist/components/scroll-shadow/index.js +13 -0
- package/dist/components/scroll-shadow/scroll-shadow.d.ts +32 -0
- package/dist/components/scroll-shadow/scroll-shadow.js +76 -0
- package/dist/components/scroll-shadow/use-scroll-shadow.d.ts +11 -0
- package/dist/components/scroll-shadow/use-scroll-shadow.js +121 -0
- package/dist/components/search-field/index.d.ts +21 -0
- package/dist/components/search-field/index.js +16 -0
- package/dist/components/search-field/search-field.d.ts +23 -0
- package/dist/components/search-field/search-field.js +127 -0
- package/dist/components/select/index.d.ts +21 -0
- package/dist/components/select/index.js +16 -0
- package/dist/components/select/select.d.ts +24 -0
- package/dist/components/select/select.js +140 -0
- package/dist/components/separator/index.d.ts +13 -0
- package/dist/components/separator/index.js +12 -0
- package/dist/components/separator/separator.d.ts +8 -0
- package/dist/components/separator/separator.js +27 -0
- package/dist/components/skeleton/index.d.ts +13 -0
- package/dist/components/skeleton/index.js +12 -0
- package/dist/components/skeleton/skeleton.d.ts +7 -0
- package/dist/components/skeleton/skeleton.js +25 -0
- package/dist/components/slider/index.d.ts +23 -0
- package/dist/components/slider/index.js +17 -0
- package/dist/components/slider/slider.d.ts +23 -0
- package/dist/components/slider/slider.js +177 -0
- package/dist/components/spinner/index.d.ts +13 -0
- package/dist/components/spinner/index.js +12 -0
- package/dist/components/spinner/spinner.d.ts +7 -0
- package/dist/components/spinner/spinner.js +88 -0
- package/dist/components/surface/index.d.ts +14 -0
- package/dist/components/surface/index.js +13 -0
- package/dist/components/surface/surface.d.ts +12 -0
- package/dist/components/surface/surface.js +34 -0
- package/dist/components/switch/index.d.ts +21 -0
- package/dist/components/switch/index.js +16 -0
- package/dist/components/switch/switch.d.ts +20 -0
- package/dist/components/switch/switch.js +118 -0
- package/dist/components/switch-group/index.d.ts +13 -0
- package/dist/components/switch-group/index.js +12 -0
- package/dist/components/switch-group/switch-group.d.ts +7 -0
- package/dist/components/switch-group/switch-group.js +25 -0
- package/dist/components/table/index.d.ts +38 -0
- package/dist/components/table/index.js +25 -0
- package/dist/components/table/table.d.ts +50 -0
- package/dist/components/table/table.js +283 -0
- package/dist/components/tabs/index.d.ts +25 -0
- package/dist/components/tabs/index.js +18 -0
- package/dist/components/tabs/tabs.d.ts +37 -0
- package/dist/components/tabs/tabs.js +156 -0
- package/dist/components/tag/index.d.ts +15 -0
- package/dist/components/tag/index.js +13 -0
- package/dist/components/tag/tag.d.ts +14 -0
- package/dist/components/tag/tag.js +85 -0
- package/dist/components/tag-group/index.d.ts +15 -0
- package/dist/components/tag-group/index.js +14 -0
- package/dist/components/tag-group/tag-group.d.ts +20 -0
- package/dist/components/tag-group/tag-group.js +59 -0
- package/dist/components/text/index.d.ts +13 -0
- package/dist/components/text/index.js +12 -0
- package/dist/components/text/text.d.ts +8 -0
- package/dist/components/text/text.js +25 -0
- package/dist/components/textarea/index.d.ts +13 -0
- package/dist/components/textarea/index.js +12 -0
- package/dist/components/textarea/textarea.d.ts +8 -0
- package/dist/components/textarea/textarea.js +27 -0
- package/dist/components/textfield/index.d.ts +14 -0
- package/dist/components/textfield/index.js +13 -0
- package/dist/components/textfield/textfield.d.ts +18 -0
- package/dist/components/textfield/textfield.js +39 -0
- package/dist/components/time-field/index.d.ts +26 -0
- package/dist/components/time-field/index.js +20 -0
- package/dist/components/time-field/time-field.d.ts +9 -0
- package/dist/components/time-field/time-field.js +29 -0
- package/dist/components/toast/constants.d.ts +6 -0
- package/dist/components/toast/constants.js +15 -0
- package/dist/components/toast/index.d.ts +75 -0
- package/dist/components/toast/index.js +23 -0
- package/dist/components/toast/toast-queue.d.ts +70 -0
- package/dist/components/toast/toast-queue.js +147 -0
- package/dist/components/toast/toast.d.ts +69 -0
- package/dist/components/toast/toast.js +365 -0
- package/dist/components/toggle-button/index.d.ts +13 -0
- package/dist/components/toggle-button/index.js +12 -0
- package/dist/components/toggle-button/toggle-button.d.ts +8 -0
- package/dist/components/toggle-button/toggle-button.js +36 -0
- package/dist/components/toggle-button-group/index.d.ts +16 -0
- package/dist/components/toggle-button-group/index.js +14 -0
- package/dist/components/toggle-button-group/toggle-button-group.d.ts +25 -0
- package/dist/components/toggle-button-group/toggle-button-group.js +70 -0
- package/dist/components/toolbar/index.d.ts +19 -0
- package/dist/components/toolbar/index.js +12 -0
- package/dist/components/toolbar/toolbar.d.ts +11 -0
- package/dist/components/toolbar/toolbar.js +39 -0
- package/dist/components/tooltip/index.d.ts +19 -0
- package/dist/components/tooltip/index.js +15 -0
- package/dist/components/tooltip/tooltip.d.ts +20 -0
- package/dist/components/tooltip/tooltip.js +106 -0
- package/dist/hooks/index.d.ts +9 -0
- package/dist/hooks/use-css-variable.d.ts +36 -0
- package/dist/hooks/use-css-variable.js +72 -0
- package/dist/hooks/use-is-hydrated.d.ts +19 -0
- package/dist/hooks/use-is-hydrated.js +28 -0
- package/dist/hooks/use-isomorphic-layout-effect.d.ts +2 -0
- package/dist/hooks/use-isomorphic-layout-effect.js +6 -0
- package/dist/hooks/use-list-data.d.ts +111 -0
- package/dist/hooks/use-list-data.js +296 -0
- package/dist/hooks/use-measured-height.d.ts +4 -0
- package/dist/hooks/use-measured-height.js +47 -0
- package/dist/hooks/use-media-query.d.ts +6 -0
- package/dist/hooks/use-media-query.js +50 -0
- package/dist/hooks/use-mounted.d.ts +1 -0
- package/dist/hooks/use-mounted.js +15 -0
- package/dist/hooks/use-overlay-state.d.ts +52 -0
- package/dist/hooks/use-overlay-state.js +70 -0
- package/dist/hooks/use-safe-layout-effect.d.ts +2 -0
- package/dist/hooks/use-safe-layout-effect.js +6 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +190 -0
- package/dist/prerelease.d.ts +4 -0
- package/dist/prerelease.js +50 -0
- package/dist/styles.css +2 -0
- package/dist/utils/assertion.d.ts +9 -0
- package/dist/utils/assertion.js +3 -0
- package/dist/utils/calendar.d.ts +12 -0
- package/dist/utils/calendar.js +52 -0
- package/dist/utils/children.d.ts +9 -0
- package/dist/utils/children.js +17 -0
- package/dist/utils/compose.d.ts +7 -0
- package/dist/utils/compose.js +18 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/logger.d.ts +23 -0
- package/dist/utils/logger.js +78 -0
- package/dist/utils/tv.d.ts +3 -0
- package/dist/utils/variants.d.ts +73 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +5 -0
- package/package.json +406 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AvatarVariants } from "@masaraxui/styles";
|
|
2
|
+
import type { ComponentPropsWithRef } from "react";
|
|
3
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
4
|
+
interface AvatarRootProps extends Omit<ComponentPropsWithRef<typeof AvatarPrimitive.Root>, "color">, AvatarVariants {
|
|
5
|
+
}
|
|
6
|
+
declare const AvatarRoot: ({ children, className, color, size, variant, ...props }: AvatarRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
interface AvatarImageProps extends ComponentPropsWithRef<typeof AvatarPrimitive.Image> {
|
|
8
|
+
}
|
|
9
|
+
declare const AvatarImage: ({ className, crossOrigin, loading, onError, onLoad, sizes, src, srcSet, ...props }: AvatarImageProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
interface AvatarFallbackProps extends ComponentPropsWithRef<typeof AvatarPrimitive.Fallback> {
|
|
11
|
+
color?: AvatarVariants["color"];
|
|
12
|
+
}
|
|
13
|
+
declare const AvatarFallback: ({ className, color, ...props }: AvatarFallbackProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export { AvatarRoot, AvatarImage, AvatarFallback };
|
|
15
|
+
export type { AvatarRootProps, AvatarImageProps, AvatarFallbackProps };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { avatarVariants } from '@masaraxui/styles';
|
|
3
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
4
|
+
import React__default, { createContext } from 'react';
|
|
5
|
+
import { composeSlotClassName } from '../../utils/compose.js';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
const AvatarContext = /*#__PURE__*/createContext({});
|
|
9
|
+
|
|
10
|
+
/* -------------------------------------------------------------------------------------------------
|
|
11
|
+
* Avatar Root
|
|
12
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
13
|
+
|
|
14
|
+
const AvatarRoot = ({
|
|
15
|
+
children,
|
|
16
|
+
className,
|
|
17
|
+
color,
|
|
18
|
+
size,
|
|
19
|
+
variant,
|
|
20
|
+
...props
|
|
21
|
+
}) => {
|
|
22
|
+
const slots = React__default.useMemo(() => avatarVariants({
|
|
23
|
+
color,
|
|
24
|
+
size,
|
|
25
|
+
variant
|
|
26
|
+
}), [color, size, variant]);
|
|
27
|
+
return /*#__PURE__*/jsx(AvatarContext, {
|
|
28
|
+
value: {
|
|
29
|
+
slots
|
|
30
|
+
},
|
|
31
|
+
children: /*#__PURE__*/jsx(AvatarPrimitive.Root, {
|
|
32
|
+
className: slots.base({
|
|
33
|
+
className
|
|
34
|
+
}),
|
|
35
|
+
...props,
|
|
36
|
+
children: children
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/* -------------------------------------------------------------------------------------------------
|
|
42
|
+
* Avatar Image
|
|
43
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
44
|
+
|
|
45
|
+
const AvatarImage = ({
|
|
46
|
+
className,
|
|
47
|
+
crossOrigin,
|
|
48
|
+
loading,
|
|
49
|
+
onError,
|
|
50
|
+
onLoad,
|
|
51
|
+
sizes,
|
|
52
|
+
src,
|
|
53
|
+
srcSet,
|
|
54
|
+
...props
|
|
55
|
+
}) => {
|
|
56
|
+
const {
|
|
57
|
+
slots
|
|
58
|
+
} = React__default.useContext(AvatarContext);
|
|
59
|
+
return /*#__PURE__*/jsx(AvatarPrimitive.Image, {
|
|
60
|
+
className: composeSlotClassName(slots?.image, className),
|
|
61
|
+
crossOrigin: crossOrigin,
|
|
62
|
+
loading: loading,
|
|
63
|
+
sizes: sizes,
|
|
64
|
+
src: src,
|
|
65
|
+
srcSet: srcSet,
|
|
66
|
+
onError: onError,
|
|
67
|
+
onLoad: onLoad,
|
|
68
|
+
...props
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/* -------------------------------------------------------------------------------------------------
|
|
73
|
+
* Avatar Fallback
|
|
74
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
75
|
+
|
|
76
|
+
const AvatarFallback = ({
|
|
77
|
+
className,
|
|
78
|
+
color,
|
|
79
|
+
...props
|
|
80
|
+
}) => {
|
|
81
|
+
const {
|
|
82
|
+
slots
|
|
83
|
+
} = React__default.useContext(AvatarContext);
|
|
84
|
+
return /*#__PURE__*/jsx(AvatarPrimitive.Fallback, {
|
|
85
|
+
className: composeSlotClassName(slots?.fallback, className, {
|
|
86
|
+
color
|
|
87
|
+
}),
|
|
88
|
+
"data-slot": "avatar-fallback",
|
|
89
|
+
...props
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export { AvatarFallback, AvatarImage, AvatarRoot };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { AvatarFallback, AvatarImage, AvatarRoot } from "./avatar";
|
|
3
|
+
export declare const Avatar: (({ children, className, color, size, variant, ...props }: import("./avatar").AvatarRootProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
4
|
+
Root: ({ children, className, color, size, variant, ...props }: import("./avatar").AvatarRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
Image: ({ className, crossOrigin, loading, onError, onLoad, sizes, src, srcSet, ...props }: import("./avatar").AvatarImageProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
Fallback: ({ className, color, ...props }: import("./avatar").AvatarFallbackProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
};
|
|
8
|
+
export type Avatar = {
|
|
9
|
+
Props: ComponentProps<typeof AvatarRoot>;
|
|
10
|
+
RootProps: ComponentProps<typeof AvatarRoot>;
|
|
11
|
+
ImageProps: ComponentProps<typeof AvatarImage>;
|
|
12
|
+
FallbackProps: ComponentProps<typeof AvatarFallback>;
|
|
13
|
+
};
|
|
14
|
+
export { AvatarRoot, AvatarImage, AvatarFallback };
|
|
15
|
+
export type { AvatarRootProps, AvatarRootProps as AvatarProps, AvatarImageProps, AvatarFallbackProps, } from "./avatar";
|
|
16
|
+
export { avatarVariants } from "@masaraxui/styles";
|
|
17
|
+
export type { AvatarVariants } from "@masaraxui/styles";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { AvatarRoot, AvatarFallback, AvatarImage } from './avatar.js';
|
|
3
|
+
export { avatarVariants } from '@masaraxui/styles';
|
|
4
|
+
|
|
5
|
+
/* -------------------------------------------------------------------------------------------------
|
|
6
|
+
* Compound Component
|
|
7
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
8
|
+
const Avatar = Object.assign(AvatarRoot, {
|
|
9
|
+
Root: AvatarRoot,
|
|
10
|
+
Image: AvatarImage,
|
|
11
|
+
Fallback: AvatarFallback
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export { Avatar, AvatarFallback, AvatarImage, AvatarRoot };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { BadgeVariants } from "@masaraxui/styles";
|
|
2
|
+
import type { ComponentPropsWithRef } from "react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
interface BadgeAnchorProps extends ComponentPropsWithRef<"span"> {
|
|
5
|
+
className?: string;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare const BadgeAnchor: ({ children, className, ...props }: BadgeAnchorProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
interface BadgeRootProps extends Omit<ComponentPropsWithRef<"span">, "color">, BadgeVariants {
|
|
10
|
+
className?: string;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
declare const BadgeRoot: ({ children, className, color, placement, size, variant, ...props }: BadgeRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
interface BadgeLabelProps extends ComponentPropsWithRef<"span"> {
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
declare const BadgeLabel: ({ children, className, ...props }: BadgeLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export { BadgeRoot, BadgeLabel, BadgeAnchor };
|
|
19
|
+
export type { BadgeRootProps, BadgeLabelProps, BadgeAnchorProps };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { badgeVariants } from '@masaraxui/styles';
|
|
3
|
+
import React__default, { createContext, useContext } from 'react';
|
|
4
|
+
import { cx } from 'tailwind-variants';
|
|
5
|
+
import { composeSlotClassName } from '../../utils/compose.js';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
const BadgeContext = /*#__PURE__*/createContext({});
|
|
9
|
+
|
|
10
|
+
/* -------------------------------------------------------------------------------------------------
|
|
11
|
+
* Badge Anchor
|
|
12
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
13
|
+
|
|
14
|
+
const BadgeAnchor = ({
|
|
15
|
+
children,
|
|
16
|
+
className,
|
|
17
|
+
...props
|
|
18
|
+
}) => {
|
|
19
|
+
return /*#__PURE__*/jsx("span", {
|
|
20
|
+
...props,
|
|
21
|
+
className: cx("badge-anchor", className) ?? undefined,
|
|
22
|
+
"data-slot": "badge-anchor",
|
|
23
|
+
children: children
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/* -------------------------------------------------------------------------------------------------
|
|
28
|
+
* Badge Root
|
|
29
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
30
|
+
|
|
31
|
+
const BadgeRoot = ({
|
|
32
|
+
children,
|
|
33
|
+
className,
|
|
34
|
+
color,
|
|
35
|
+
placement,
|
|
36
|
+
size,
|
|
37
|
+
variant,
|
|
38
|
+
...props
|
|
39
|
+
}) => {
|
|
40
|
+
const slots = React__default.useMemo(() => badgeVariants({
|
|
41
|
+
color,
|
|
42
|
+
placement,
|
|
43
|
+
size,
|
|
44
|
+
variant
|
|
45
|
+
}), [color, placement, size, variant]);
|
|
46
|
+
const badgeChildren = React__default.useMemo(() => {
|
|
47
|
+
if (typeof children === "string" || typeof children === "number") {
|
|
48
|
+
return /*#__PURE__*/jsx(BadgeLabel, {
|
|
49
|
+
children: children
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return children;
|
|
53
|
+
}, [children]);
|
|
54
|
+
return /*#__PURE__*/jsx(BadgeContext, {
|
|
55
|
+
value: {
|
|
56
|
+
slots
|
|
57
|
+
},
|
|
58
|
+
children: /*#__PURE__*/jsx("span", {
|
|
59
|
+
...props,
|
|
60
|
+
className: composeSlotClassName(slots.base, className),
|
|
61
|
+
"data-slot": "badge",
|
|
62
|
+
children: badgeChildren
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/* -------------------------------------------------------------------------------------------------
|
|
68
|
+
* Badge Label
|
|
69
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
70
|
+
|
|
71
|
+
const BadgeLabel = ({
|
|
72
|
+
children,
|
|
73
|
+
className,
|
|
74
|
+
...props
|
|
75
|
+
}) => {
|
|
76
|
+
const {
|
|
77
|
+
slots
|
|
78
|
+
} = useContext(BadgeContext);
|
|
79
|
+
return /*#__PURE__*/jsx("span", {
|
|
80
|
+
className: composeSlotClassName(slots?.label, className),
|
|
81
|
+
"data-slot": "badge-label",
|
|
82
|
+
...props,
|
|
83
|
+
children: children
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export { BadgeAnchor, BadgeLabel, BadgeRoot };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { BadgeAnchor, BadgeLabel, BadgeRoot } from "./badge";
|
|
3
|
+
export declare const Badge: (({ children, className, color, placement, size, variant, ...props }: import("./badge").BadgeRootProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
4
|
+
Anchor: ({ children, className, ...props }: import("./badge").BadgeAnchorProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
Label: ({ children, className, ...props }: import("./badge").BadgeLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
Root: ({ children, className, color, placement, size, variant, ...props }: import("./badge").BadgeRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
};
|
|
8
|
+
export type Badge = {
|
|
9
|
+
AnchorProps: ComponentProps<typeof BadgeAnchor>;
|
|
10
|
+
LabelProps: ComponentProps<typeof BadgeLabel>;
|
|
11
|
+
Props: ComponentProps<typeof BadgeRoot>;
|
|
12
|
+
RootProps: ComponentProps<typeof BadgeRoot>;
|
|
13
|
+
};
|
|
14
|
+
export { BadgeRoot, BadgeLabel, BadgeAnchor };
|
|
15
|
+
export type { BadgeRootProps, BadgeRootProps as BadgeProps, BadgeLabelProps, BadgeAnchorProps, } from "./badge";
|
|
16
|
+
export { badgeVariants } from "@masaraxui/styles";
|
|
17
|
+
export type { BadgeVariants } from "@masaraxui/styles";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { BadgeRoot, BadgeLabel, BadgeAnchor } from './badge.js';
|
|
3
|
+
export { badgeVariants } from '@masaraxui/styles';
|
|
4
|
+
|
|
5
|
+
/* -------------------------------------------------------------------------------------------------
|
|
6
|
+
* Compound Component
|
|
7
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
8
|
+
const Badge = Object.assign(BadgeRoot, {
|
|
9
|
+
Anchor: BadgeAnchor,
|
|
10
|
+
Label: BadgeLabel,
|
|
11
|
+
Root: BadgeRoot
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export { Badge, BadgeAnchor, BadgeLabel, BadgeRoot };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LinkProps } from "../link";
|
|
2
|
+
import type { BreadcrumbsVariants } from "@masaraxui/styles";
|
|
3
|
+
import type { ComponentPropsWithRef } from "react";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { Breadcrumb as BreadcrumbPrimitive, Breadcrumbs as BreadcrumbsPrimitive } from "react-aria-components";
|
|
6
|
+
interface BreadcrumbsRootProps extends ComponentPropsWithRef<typeof BreadcrumbsPrimitive>, BreadcrumbsVariants {
|
|
7
|
+
separator?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare const BreadcrumbsRoot: ({ children, className, separator, ...props }: BreadcrumbsRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
interface BreadcrumbsItemProps extends ComponentPropsWithRef<typeof BreadcrumbPrimitive> {
|
|
11
|
+
}
|
|
12
|
+
declare const BreadcrumbsItem: ({ children, className, ...props }: BreadcrumbsItemProps & Omit<LinkProps, "className">) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export { BreadcrumbsRoot, BreadcrumbsItem };
|
|
14
|
+
export type { BreadcrumbsRootProps, BreadcrumbsItemProps };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { breadcrumbsVariants } from '@masaraxui/styles';
|
|
3
|
+
import React__default, { createContext, useContext } from 'react';
|
|
4
|
+
import { Breadcrumbs, Breadcrumb } from 'react-aria-components';
|
|
5
|
+
import { composeSlotClassName, composeTwRenderProps } from '../../utils/compose.js';
|
|
6
|
+
import { IconChevronRight } from '../icons.js';
|
|
7
|
+
import { Link } from '../link/index.js';
|
|
8
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
|
+
|
|
10
|
+
const BreadcrumbsContext = /*#__PURE__*/createContext({});
|
|
11
|
+
|
|
12
|
+
/* -------------------------------------------------------------------------------------------------
|
|
13
|
+
* Breadcrumbs Root
|
|
14
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
15
|
+
|
|
16
|
+
const BreadcrumbsRoot = ({
|
|
17
|
+
children,
|
|
18
|
+
className,
|
|
19
|
+
separator,
|
|
20
|
+
...props
|
|
21
|
+
}) => {
|
|
22
|
+
const slots = React__default.useMemo(() => breadcrumbsVariants({}), []);
|
|
23
|
+
return /*#__PURE__*/jsx(BreadcrumbsContext.Provider, {
|
|
24
|
+
value: {
|
|
25
|
+
slots,
|
|
26
|
+
separator
|
|
27
|
+
},
|
|
28
|
+
children: /*#__PURE__*/jsx(Breadcrumbs, {
|
|
29
|
+
"data-slot": "breadcrumbs",
|
|
30
|
+
...props,
|
|
31
|
+
className: composeSlotClassName(slots.base, className),
|
|
32
|
+
children: children
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/* -------------------------------------------------------------------------------------------------
|
|
38
|
+
* Breadcrumbs Item
|
|
39
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
40
|
+
|
|
41
|
+
const BreadcrumbsItem = ({
|
|
42
|
+
children,
|
|
43
|
+
className,
|
|
44
|
+
...props
|
|
45
|
+
}) => {
|
|
46
|
+
const {
|
|
47
|
+
separator,
|
|
48
|
+
slots
|
|
49
|
+
} = useContext(BreadcrumbsContext);
|
|
50
|
+
const renderSeparator = () => {
|
|
51
|
+
if (!separator) return /*#__PURE__*/jsx(IconChevronRight, {
|
|
52
|
+
className: slots?.separator(),
|
|
53
|
+
"data-slot": "breadcrumbs-separator"
|
|
54
|
+
});
|
|
55
|
+
if (/*#__PURE__*/React__default.isValidElement(separator)) {
|
|
56
|
+
return /*#__PURE__*/React__default.cloneElement(separator, {
|
|
57
|
+
className: slots?.separator(),
|
|
58
|
+
"data-slot": "breadcrumbs-separator"
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return separator;
|
|
62
|
+
};
|
|
63
|
+
return /*#__PURE__*/jsx(Breadcrumb, {
|
|
64
|
+
className: composeTwRenderProps(className, slots?.item()),
|
|
65
|
+
"data-slot": "breadcrumbs-item",
|
|
66
|
+
...props,
|
|
67
|
+
children: ({
|
|
68
|
+
isCurrent
|
|
69
|
+
}) => {
|
|
70
|
+
if (typeof children === "function") {
|
|
71
|
+
return children({});
|
|
72
|
+
}
|
|
73
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
74
|
+
children: [/*#__PURE__*/jsx(Link, {
|
|
75
|
+
className: slots?.link(),
|
|
76
|
+
...props,
|
|
77
|
+
children: children
|
|
78
|
+
}), !isCurrent && renderSeparator()]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export { BreadcrumbsItem, BreadcrumbsRoot };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { BreadcrumbsItem, BreadcrumbsRoot } from "./breadcrumbs";
|
|
3
|
+
export declare const Breadcrumbs: (({ children, className, separator, ...props }: import("./breadcrumbs").BreadcrumbsRootProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
4
|
+
Root: ({ children, className, separator, ...props }: import("./breadcrumbs").BreadcrumbsRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
Item: ({ children, className, ...props }: import("./breadcrumbs").BreadcrumbsItemProps & Omit<import("..").LinkRootProps, "className">) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
};
|
|
7
|
+
export type Breadcrumbs = {
|
|
8
|
+
Props: ComponentProps<typeof BreadcrumbsRoot>;
|
|
9
|
+
RootProps: ComponentProps<typeof BreadcrumbsRoot>;
|
|
10
|
+
ItemProps: ComponentProps<typeof BreadcrumbsItem>;
|
|
11
|
+
};
|
|
12
|
+
export { BreadcrumbsRoot, BreadcrumbsItem };
|
|
13
|
+
export type { BreadcrumbsRootProps, BreadcrumbsRootProps as BreadcrumbsProps, BreadcrumbsItemProps, } from "./breadcrumbs";
|
|
14
|
+
export { breadcrumbsVariants } from "@masaraxui/styles";
|
|
15
|
+
export type { BreadcrumbsVariants } from "@masaraxui/styles";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { BreadcrumbsRoot, BreadcrumbsItem } from './breadcrumbs.js';
|
|
3
|
+
export { breadcrumbsVariants } from '@masaraxui/styles';
|
|
4
|
+
|
|
5
|
+
/* -------------------------------------------------------------------------------------------------
|
|
6
|
+
* Compound Component
|
|
7
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
8
|
+
const Breadcrumbs = Object.assign(BreadcrumbsRoot, {
|
|
9
|
+
Root: BreadcrumbsRoot,
|
|
10
|
+
Item: BreadcrumbsItem
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export { Breadcrumbs, BreadcrumbsItem, BreadcrumbsRoot };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ButtonVariants } from "@masaraxui/styles";
|
|
2
|
+
import type { ComponentPropsWithRef } from "react";
|
|
3
|
+
import { Button as ButtonPrimitive } from "react-aria-components";
|
|
4
|
+
import { BUTTON_GROUP_CHILD } from "../button-group";
|
|
5
|
+
interface ButtonRootProps extends ComponentPropsWithRef<typeof ButtonPrimitive>, ButtonVariants {
|
|
6
|
+
[BUTTON_GROUP_CHILD]?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const ButtonRoot: ({ children, className, fullWidth, isDisabled, isIconOnly, size, slot, style, variant, [BUTTON_GROUP_CHILD]: isButtonGroupChild, ...rest }: ButtonRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export { ButtonRoot };
|
|
10
|
+
export type { ButtonRootProps };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { buttonVariants } from '@masaraxui/styles';
|
|
3
|
+
import { useContext } from 'react';
|
|
4
|
+
import { Button } from 'react-aria-components';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
import { ButtonGroupContext, BUTTON_GROUP_CHILD } from '../button-group/button-group.js';
|
|
7
|
+
import { composeTwRenderProps } from '../../utils/compose.js';
|
|
8
|
+
|
|
9
|
+
const ButtonRoot = ({
|
|
10
|
+
children,
|
|
11
|
+
className,
|
|
12
|
+
fullWidth,
|
|
13
|
+
isDisabled,
|
|
14
|
+
isIconOnly,
|
|
15
|
+
size,
|
|
16
|
+
slot,
|
|
17
|
+
style,
|
|
18
|
+
variant,
|
|
19
|
+
[BUTTON_GROUP_CHILD]: isButtonGroupChild,
|
|
20
|
+
...rest
|
|
21
|
+
}) => {
|
|
22
|
+
const buttonGroupContext = useContext(ButtonGroupContext);
|
|
23
|
+
|
|
24
|
+
// Only use context if this button is a direct child of ButtonGroup
|
|
25
|
+
const shouldUseContext = isButtonGroupChild === true;
|
|
26
|
+
|
|
27
|
+
// Merge props with precedence: direct props > context props
|
|
28
|
+
const finalSize = size ?? (shouldUseContext ? buttonGroupContext?.size : undefined);
|
|
29
|
+
const finalVariant = variant ?? (shouldUseContext ? buttonGroupContext?.variant : undefined);
|
|
30
|
+
const finalIsDisabled = isDisabled ?? (shouldUseContext ? buttonGroupContext?.isDisabled : undefined);
|
|
31
|
+
const finalFullWidth = fullWidth ?? (shouldUseContext ? buttonGroupContext?.fullWidth : undefined);
|
|
32
|
+
const styles = buttonVariants({
|
|
33
|
+
fullWidth: finalFullWidth,
|
|
34
|
+
isIconOnly,
|
|
35
|
+
size: finalSize,
|
|
36
|
+
variant: finalVariant
|
|
37
|
+
});
|
|
38
|
+
return /*#__PURE__*/jsx(Button, {
|
|
39
|
+
className: composeTwRenderProps(className, styles),
|
|
40
|
+
"data-slot": "button",
|
|
41
|
+
isDisabled: finalIsDisabled,
|
|
42
|
+
slot: slot,
|
|
43
|
+
style: style,
|
|
44
|
+
...rest,
|
|
45
|
+
children: renderProps => typeof children === "function" ? children(renderProps) : children
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { ButtonRoot };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { BUTTON_GROUP_CHILD } from "../button-group";
|
|
3
|
+
import { ButtonRoot } from "./button";
|
|
4
|
+
export declare const Button: (({ children, className, fullWidth, isDisabled, isIconOnly, size, slot, style, variant, [BUTTON_GROUP_CHILD]: isButtonGroupChild, ...rest }: import("./button").ButtonRootProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
5
|
+
Root: ({ children, className, fullWidth, isDisabled, isIconOnly, size, slot, style, variant, [BUTTON_GROUP_CHILD]: isButtonGroupChild, ...rest }: import("./button").ButtonRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
};
|
|
7
|
+
export type Button = {
|
|
8
|
+
Props: ComponentProps<typeof ButtonRoot>;
|
|
9
|
+
RootProps: ComponentProps<typeof ButtonRoot>;
|
|
10
|
+
};
|
|
11
|
+
export { ButtonRoot };
|
|
12
|
+
export type { ButtonRootProps, ButtonRootProps as ButtonProps } from "./button";
|
|
13
|
+
export { BUTTON_GROUP_CHILD };
|
|
14
|
+
export { buttonVariants } from "@masaraxui/styles";
|
|
15
|
+
export type { ButtonVariants } from "@masaraxui/styles";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { ButtonRoot } from './button.js';
|
|
3
|
+
export { buttonVariants } from '@masaraxui/styles';
|
|
4
|
+
export { BUTTON_GROUP_CHILD } from '../button-group/button-group.js';
|
|
5
|
+
|
|
6
|
+
/* -------------------------------------------------------------------------------------------------
|
|
7
|
+
* Compound Component
|
|
8
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
9
|
+
const Button = Object.assign(ButtonRoot, {
|
|
10
|
+
Root: ButtonRoot
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export { Button, ButtonRoot };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ButtonProps } from "../button";
|
|
2
|
+
import type { ButtonGroupVariants } from "@masaraxui/styles";
|
|
3
|
+
import type { ComponentPropsWithRef } from "react";
|
|
4
|
+
import { buttonGroupVariants } from "@masaraxui/styles";
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { Group } from "react-aria-components";
|
|
7
|
+
type ButtonGroupContext = {
|
|
8
|
+
slots?: ReturnType<typeof buttonGroupVariants>;
|
|
9
|
+
size?: ButtonProps["size"];
|
|
10
|
+
variant?: ButtonProps["variant"];
|
|
11
|
+
isDisabled?: ButtonProps["isDisabled"];
|
|
12
|
+
fullWidth?: ButtonProps["fullWidth"];
|
|
13
|
+
};
|
|
14
|
+
declare const ButtonGroupContext: React.Context<ButtonGroupContext>;
|
|
15
|
+
export declare const BUTTON_GROUP_CHILD = "__button_group_child";
|
|
16
|
+
interface ButtonGroupRootProps extends ComponentPropsWithRef<typeof Group>, Pick<ButtonProps, "size" | "variant">, ButtonGroupVariants {
|
|
17
|
+
/** The orientation of the button group */
|
|
18
|
+
orientation?: "horizontal" | "vertical";
|
|
19
|
+
}
|
|
20
|
+
declare const ButtonGroupRoot: ({ children, className, fullWidth, isDisabled, orientation: orientationProp, size, variant, ...rest }: ButtonGroupRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
interface ButtonGroupSeparatorProps extends ComponentPropsWithRef<"span"> {
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
declare const ButtonGroupSeparator: ({ className, ...props }: ButtonGroupSeparatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export { ButtonGroupRoot, ButtonGroupSeparator, ButtonGroupContext };
|
|
26
|
+
export type { ButtonGroupRootProps, ButtonGroupSeparatorProps };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { buttonGroupVariants } from '@masaraxui/styles';
|
|
3
|
+
import React__default, { Children, isValidElement, createContext, useContext } from 'react';
|
|
4
|
+
import { useSlottedContext, ToggleButtonGroupContext, Group } from 'react-aria-components';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
import { composeTwRenderProps, composeSlotClassName } from '../../utils/compose.js';
|
|
7
|
+
|
|
8
|
+
const ButtonGroupContext = /*#__PURE__*/createContext({});
|
|
9
|
+
|
|
10
|
+
// Property name to mark direct children of ButtonGroup
|
|
11
|
+
const BUTTON_GROUP_CHILD = "__button_group_child";
|
|
12
|
+
|
|
13
|
+
/* -------------------------------------------------------------------------------------------------
|
|
14
|
+
* ButtonGroup Root
|
|
15
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
16
|
+
|
|
17
|
+
const ButtonGroupRoot = ({
|
|
18
|
+
children,
|
|
19
|
+
className,
|
|
20
|
+
fullWidth,
|
|
21
|
+
isDisabled,
|
|
22
|
+
orientation: orientationProp,
|
|
23
|
+
size,
|
|
24
|
+
variant,
|
|
25
|
+
...rest
|
|
26
|
+
}) => {
|
|
27
|
+
const racContext = useSlottedContext(ToggleButtonGroupContext);
|
|
28
|
+
const orientation = orientationProp ?? racContext?.orientation ?? "horizontal";
|
|
29
|
+
const slots = React__default.useMemo(() => buttonGroupVariants({
|
|
30
|
+
fullWidth,
|
|
31
|
+
orientation
|
|
32
|
+
}), [fullWidth, orientation]);
|
|
33
|
+
|
|
34
|
+
// Wrap only direct children with context provider
|
|
35
|
+
const wrappedChildren = Children.map(children, child => {
|
|
36
|
+
if (! /*#__PURE__*/isValidElement(child)) {
|
|
37
|
+
return child;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Clone the child and add the special prop
|
|
41
|
+
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
42
|
+
[BUTTON_GROUP_CHILD]: true
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
return /*#__PURE__*/jsx(ButtonGroupContext, {
|
|
46
|
+
value: {
|
|
47
|
+
slots,
|
|
48
|
+
size,
|
|
49
|
+
variant,
|
|
50
|
+
isDisabled,
|
|
51
|
+
fullWidth
|
|
52
|
+
},
|
|
53
|
+
children: /*#__PURE__*/jsx(Group, {
|
|
54
|
+
className: composeTwRenderProps(className, slots.base()),
|
|
55
|
+
"data-slot": "button-group",
|
|
56
|
+
isDisabled: isDisabled,
|
|
57
|
+
...rest,
|
|
58
|
+
children: wrappedChildren
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/* -------------------------------------------------------------------------------------------------
|
|
64
|
+
* ButtonGroup Separator
|
|
65
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
66
|
+
|
|
67
|
+
const ButtonGroupSeparator = ({
|
|
68
|
+
className,
|
|
69
|
+
...props
|
|
70
|
+
}) => {
|
|
71
|
+
const {
|
|
72
|
+
slots
|
|
73
|
+
} = useContext(ButtonGroupContext);
|
|
74
|
+
return /*#__PURE__*/jsx("span", {
|
|
75
|
+
"aria-hidden": "true",
|
|
76
|
+
className: composeSlotClassName(slots?.separator, className),
|
|
77
|
+
"data-slot": "button-group-separator",
|
|
78
|
+
...props
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export { BUTTON_GROUP_CHILD, ButtonGroupContext, ButtonGroupRoot, ButtonGroupSeparator };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { ButtonGroupRoot, ButtonGroupSeparator } from "./button-group";
|
|
3
|
+
export declare const ButtonGroup: (({ children, className, fullWidth, isDisabled, orientation: orientationProp, size, variant, ...rest }: import("./button-group").ButtonGroupRootProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
4
|
+
Root: ({ children, className, fullWidth, isDisabled, orientation: orientationProp, size, variant, ...rest }: import("./button-group").ButtonGroupRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
Separator: ({ className, ...props }: import("./button-group").ButtonGroupSeparatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
};
|
|
7
|
+
export type ButtonGroup = {
|
|
8
|
+
Props: ComponentProps<typeof ButtonGroupRoot>;
|
|
9
|
+
RootProps: ComponentProps<typeof ButtonGroupRoot>;
|
|
10
|
+
SeparatorProps: ComponentProps<typeof ButtonGroupSeparator>;
|
|
11
|
+
};
|
|
12
|
+
export { ButtonGroupRoot, ButtonGroupSeparator };
|
|
13
|
+
export type { ButtonGroupRootProps, ButtonGroupRootProps as ButtonGroupProps, ButtonGroupSeparatorProps, } from "./button-group";
|
|
14
|
+
export { ButtonGroupContext, BUTTON_GROUP_CHILD } from "./button-group";
|
|
15
|
+
export { buttonGroupVariants } from "@masaraxui/styles";
|
|
16
|
+
export type { ButtonGroupVariants } from "@masaraxui/styles";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { ButtonGroupRoot, ButtonGroupSeparator } from './button-group.js';
|
|
3
|
+
export { BUTTON_GROUP_CHILD, ButtonGroupContext } from './button-group.js';
|
|
4
|
+
export { buttonGroupVariants } from '@masaraxui/styles';
|
|
5
|
+
|
|
6
|
+
/* -------------------------------------------------------------------------------------------------
|
|
7
|
+
* Compound Component
|
|
8
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
9
|
+
const ButtonGroup = Object.assign(ButtonGroupRoot, {
|
|
10
|
+
Root: ButtonGroupRoot,
|
|
11
|
+
Separator: ButtonGroupSeparator
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export { ButtonGroup, ButtonGroupRoot, ButtonGroupSeparator };
|