@archytechtor/ui 0.0.0-stage → 0.2.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 +105 -2
- package/dist/components/accordion/accordion.d.ts +25 -0
- package/dist/components/accordion/accordion.js +88 -0
- package/dist/components/accordion/index.d.ts +3 -0
- package/dist/components/accordion/index.js +1 -0
- package/dist/components/accordion/types.d.ts +39 -0
- package/dist/components/alert/alert.d.ts +25 -0
- package/dist/components/alert/alert.js +59 -0
- package/dist/components/alert/index.d.ts +3 -0
- package/dist/components/alert/index.js +3 -0
- package/dist/components/alert/types.d.ts +32 -0
- package/dist/components/alert/types.js +19 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +73 -0
- package/dist/components/alert-dialog/alert-dialog.js +170 -0
- package/dist/components/alert-dialog/index.d.ts +3 -0
- package/dist/components/alert-dialog/index.js +1 -0
- package/dist/components/alert-dialog/types.d.ts +80 -0
- package/dist/components/aspect-ratio/aspect-ratio.d.ts +8 -0
- package/dist/components/aspect-ratio/aspect-ratio.js +20 -0
- package/dist/components/aspect-ratio/index.d.ts +3 -0
- package/dist/components/aspect-ratio/index.js +1 -0
- package/dist/components/aspect-ratio/types.d.ts +8 -0
- package/dist/components/attachment/attachment.d.ts +57 -0
- package/dist/components/attachment/attachment.js +139 -0
- package/dist/components/attachment/index.d.ts +3 -0
- package/dist/components/attachment/index.js +3 -0
- package/dist/components/attachment/types.d.ts +79 -0
- package/dist/components/attachment/types.js +43 -0
- package/dist/components/avatar/avatar.d.ts +39 -0
- package/dist/components/avatar/avatar.js +88 -0
- package/dist/components/avatar/index.d.ts +3 -0
- package/dist/components/avatar/index.js +3 -0
- package/dist/components/avatar/types.d.ts +54 -0
- package/dist/components/avatar/types.js +21 -0
- package/dist/components/badge/badge.d.ts +7 -0
- package/dist/components/badge/badge.js +23 -0
- package/dist/components/badge/index.d.ts +3 -0
- package/dist/components/badge/index.js +3 -0
- package/dist/components/badge/types.d.ts +21 -0
- package/dist/components/badge/types.js +26 -0
- package/dist/components/bottom-nav/bottom-nav.d.ts +19 -0
- package/dist/components/bottom-nav/bottom-nav.js +59 -0
- package/dist/components/bottom-nav/index.d.ts +3 -0
- package/dist/components/bottom-nav/index.js +3 -0
- package/dist/components/bottom-nav/types.d.ts +45 -0
- package/dist/components/bottom-nav/types.js +44 -0
- package/dist/components/box/box.d.ts +7 -0
- package/dist/components/box/box.js +26 -0
- package/dist/components/box/index.d.ts +3 -0
- package/dist/components/box/index.js +3 -0
- package/dist/components/box/types.d.ts +23 -0
- package/dist/components/box/types.js +27 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +43 -0
- package/dist/components/breadcrumb/breadcrumb.js +115 -0
- package/dist/components/breadcrumb/index.d.ts +3 -0
- package/dist/components/breadcrumb/index.js +1 -0
- package/dist/components/breadcrumb/types.d.ts +36 -0
- package/dist/components/bubble/bubble.d.ts +25 -0
- package/dist/components/bubble/bubble.js +69 -0
- package/dist/components/bubble/index.d.ts +3 -0
- package/dist/components/bubble/index.js +3 -0
- package/dist/components/bubble/types.d.ts +51 -0
- package/dist/components/bubble/types.js +60 -0
- package/dist/components/button/button.d.ts +7 -0
- package/dist/components/button/button.js +155 -0
- package/dist/components/button/index.d.ts +4 -0
- package/dist/components/button/index.js +4 -0
- package/dist/components/button/types.d.ts +80 -0
- package/dist/components/button/types.js +99 -0
- package/dist/components/button/use-hold-to-confirm.d.ts +25 -0
- package/dist/components/button/use-hold-to-confirm.js +161 -0
- package/dist/components/button-group/button-group.d.ts +20 -0
- package/dist/components/button-group/button-group.js +62 -0
- package/dist/components/button-group/index.d.ts +3 -0
- package/dist/components/button-group/index.js +3 -0
- package/dist/components/button-group/types.d.ts +30 -0
- package/dist/components/button-group/types.js +19 -0
- package/dist/components/calendar/calendar.d.ts +15 -0
- package/dist/components/calendar/calendar.js +157 -0
- package/dist/components/calendar/index.d.ts +3 -0
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/calendar/types.d.ts +21 -0
- package/dist/components/card/card.d.ts +43 -0
- package/dist/components/card/card.js +97 -0
- package/dist/components/card/index.d.ts +3 -0
- package/dist/components/card/index.js +3 -0
- package/dist/components/card/types.d.ts +44 -0
- package/dist/components/card/types.js +19 -0
- package/dist/components/carousel/carousel.d.ts +36 -0
- package/dist/components/carousel/carousel.js +190 -0
- package/dist/components/carousel/index.d.ts +3 -0
- package/dist/components/carousel/index.js +1 -0
- package/dist/components/carousel/types.d.ts +79 -0
- package/dist/components/chart/chart.d.ts +35 -0
- package/dist/components/chart/chart.js +212 -0
- package/dist/components/chart/index.d.ts +3 -0
- package/dist/components/chart/index.js +1 -0
- package/dist/components/chart/types.d.ts +89 -0
- package/dist/components/chart/types.js +7 -0
- package/dist/components/checkbox/checkbox.d.ts +7 -0
- package/dist/components/checkbox/checkbox.js +31 -0
- package/dist/components/checkbox/index.d.ts +3 -0
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/checkbox/types.d.ts +25 -0
- package/dist/components/code-block/code-block.d.ts +49 -0
- package/dist/components/code-block/code-block.js +188 -0
- package/dist/components/code-block/highlighter.d.ts +15 -0
- package/dist/components/code-block/highlighter.js +123 -0
- package/dist/components/code-block/index.d.ts +5 -0
- package/dist/components/code-block/index.js +5 -0
- package/dist/components/code-block/types.d.ts +94 -0
- package/dist/components/code-block/types.js +38 -0
- package/dist/components/code-block/use-highlighted-code.d.ts +9 -0
- package/dist/components/code-block/use-highlighted-code.js +67 -0
- package/dist/components/collapsible/collapsible.d.ts +19 -0
- package/dist/components/collapsible/collapsible.js +44 -0
- package/dist/components/collapsible/index.d.ts +3 -0
- package/dist/components/collapsible/index.js +1 -0
- package/dist/components/collapsible/types.d.ts +26 -0
- package/dist/components/combobox/combobox.d.ts +104 -0
- package/dist/components/combobox/combobox.js +365 -0
- package/dist/components/combobox/index.d.ts +3 -0
- package/dist/components/combobox/index.js +1 -0
- package/dist/components/combobox/types.d.ts +229 -0
- package/dist/components/command/command.d.ts +55 -0
- package/dist/components/command/command.js +179 -0
- package/dist/components/command/index.d.ts +3 -0
- package/dist/components/command/index.js +1 -0
- package/dist/components/command/types.d.ts +69 -0
- package/dist/components/context-menu/context-menu.d.ts +92 -0
- package/dist/components/context-menu/context-menu.js +270 -0
- package/dist/components/context-menu/index.d.ts +3 -0
- package/dist/components/context-menu/index.js +1 -0
- package/dist/components/context-menu/types.d.ts +138 -0
- package/dist/components/data-table/data-table-features.d.ts +21 -0
- package/dist/components/data-table/data-table-features.js +22 -0
- package/dist/components/data-table/data-table.d.ts +69 -0
- package/dist/components/data-table/data-table.js +283 -0
- package/dist/components/data-table/index.d.ts +4 -0
- package/dist/components/data-table/index.js +3 -0
- package/dist/components/data-table/types.d.ts +63 -0
- package/dist/components/date-input/date-input.d.ts +7 -0
- package/dist/components/date-input/date-input.js +147 -0
- package/dist/components/date-input/index.d.ts +3 -0
- package/dist/components/date-input/index.js +1 -0
- package/dist/components/date-input/types.d.ts +27 -0
- package/dist/components/date-picker/date-picker.d.ts +7 -0
- package/dist/components/date-picker/date-picker.js +74 -0
- package/dist/components/date-picker/index.d.ts +3 -0
- package/dist/components/date-picker/index.js +1 -0
- package/dist/components/date-picker/types.d.ts +38 -0
- package/dist/components/date-range-picker/date-range-picker.d.ts +7 -0
- package/dist/components/date-range-picker/date-range-picker.js +89 -0
- package/dist/components/date-range-picker/index.d.ts +3 -0
- package/dist/components/date-range-picker/index.js +1 -0
- package/dist/components/date-range-picker/types.d.ts +43 -0
- package/dist/components/dialog/dialog.d.ts +61 -0
- package/dist/components/dialog/dialog.js +160 -0
- package/dist/components/dialog/index.d.ts +3 -0
- package/dist/components/dialog/index.js +1 -0
- package/dist/components/dialog/types.d.ts +68 -0
- package/dist/components/drawer/drawer.d.ts +69 -0
- package/dist/components/drawer/drawer.js +245 -0
- package/dist/components/drawer/index.d.ts +3 -0
- package/dist/components/drawer/index.js +1 -0
- package/dist/components/drawer/types.d.ts +93 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +92 -0
- package/dist/components/dropdown-menu/dropdown-menu.js +268 -0
- package/dist/components/dropdown-menu/index.d.ts +3 -0
- package/dist/components/dropdown-menu/index.js +1 -0
- package/dist/components/dropdown-menu/types.d.ts +143 -0
- package/dist/components/empty/empty.d.ts +37 -0
- package/dist/components/empty/empty.js +84 -0
- package/dist/components/empty/index.d.ts +3 -0
- package/dist/components/empty/index.js +3 -0
- package/dist/components/empty/types.d.ts +39 -0
- package/dist/components/empty/types.js +13 -0
- package/dist/components/expanded-card/expanded-card.d.ts +43 -0
- package/dist/components/expanded-card/expanded-card.js +352 -0
- package/dist/components/expanded-card/index.d.ts +3 -0
- package/dist/components/expanded-card/index.js +1 -0
- package/dist/components/expanded-card/types.d.ts +52 -0
- package/dist/components/field/field.d.ts +62 -0
- package/dist/components/field/field.js +173 -0
- package/dist/components/field/index.d.ts +3 -0
- package/dist/components/field/index.js +3 -0
- package/dist/components/field/types.d.ts +81 -0
- package/dist/components/field/types.js +21 -0
- package/dist/components/form/form.d.ts +49 -0
- package/dist/components/form/form.js +136 -0
- package/dist/components/form/index.d.ts +3 -0
- package/dist/components/form/index.js +1 -0
- package/dist/components/form/types.d.ts +59 -0
- package/dist/components/grid/grid.d.ts +7 -0
- package/dist/components/grid/grid.js +36 -0
- package/dist/components/grid/index.d.ts +3 -0
- package/dist/components/grid/index.js +3 -0
- package/dist/components/grid/types.d.ts +35 -0
- package/dist/components/grid/types.js +102 -0
- package/dist/components/hover-card/hover-card.d.ts +19 -0
- package/dist/components/hover-card/hover-card.js +63 -0
- package/dist/components/hover-card/index.d.ts +3 -0
- package/dist/components/hover-card/index.js +1 -0
- package/dist/components/hover-card/types.d.ts +27 -0
- package/dist/components/image-gallery/image-gallery.d.ts +8 -0
- package/dist/components/image-gallery/image-gallery.js +294 -0
- package/dist/components/image-gallery/index.d.ts +4 -0
- package/dist/components/image-gallery/index.js +3 -0
- package/dist/components/image-gallery/masonry.d.ts +11 -0
- package/dist/components/image-gallery/masonry.js +62 -0
- package/dist/components/image-gallery/types.d.ts +80 -0
- package/dist/components/input/index.d.ts +3 -0
- package/dist/components/input/index.js +1 -0
- package/dist/components/input/input.d.ts +7 -0
- package/dist/components/input/input.js +18 -0
- package/dist/components/input/types.d.ts +28 -0
- package/dist/components/input-group/index.d.ts +3 -0
- package/dist/components/input-group/index.js +3 -0
- package/dist/components/input-group/input-group.d.ts +37 -0
- package/dist/components/input-group/input-group.js +103 -0
- package/dist/components/input-group/types.d.ts +64 -0
- package/dist/components/input-group/types.js +31 -0
- package/dist/components/input-otp/index.d.ts +3 -0
- package/dist/components/input-otp/index.js +1 -0
- package/dist/components/input-otp/input-otp.d.ts +25 -0
- package/dist/components/input-otp/input-otp.js +76 -0
- package/dist/components/input-otp/types.d.ts +43 -0
- package/dist/components/item/index.d.ts +3 -0
- package/dist/components/item/index.js +3 -0
- package/dist/components/item/item.d.ts +61 -0
- package/dist/components/item/item.js +149 -0
- package/dist/components/item/types.d.ts +75 -0
- package/dist/components/item/types.js +48 -0
- package/dist/components/kbd/index.d.ts +3 -0
- package/dist/components/kbd/index.js +1 -0
- package/dist/components/kbd/kbd.d.ts +13 -0
- package/dist/components/kbd/kbd.js +30 -0
- package/dist/components/kbd/types.d.ts +9 -0
- package/dist/components/label/index.d.ts +3 -0
- package/dist/components/label/index.js +1 -0
- package/dist/components/label/label.d.ts +7 -0
- package/dist/components/label/label.js +17 -0
- package/dist/components/label/types.d.ts +8 -0
- package/dist/components/loader/index.d.ts +3 -0
- package/dist/components/loader/index.js +3 -0
- package/dist/components/loader/loader.d.ts +8 -0
- package/dist/components/loader/loader.js +386 -0
- package/dist/components/loader/types.d.ts +27 -0
- package/dist/components/loader/types.js +58 -0
- package/dist/components/marker/index.d.ts +3 -0
- package/dist/components/marker/index.js +3 -0
- package/dist/components/marker/marker.d.ts +19 -0
- package/dist/components/marker/marker.js +51 -0
- package/dist/components/marker/types.d.ts +30 -0
- package/dist/components/marker/types.js +16 -0
- package/dist/components/menubar/index.d.ts +3 -0
- package/dist/components/menubar/index.js +1 -0
- package/dist/components/menubar/menubar.d.ts +98 -0
- package/dist/components/menubar/menubar.js +284 -0
- package/dist/components/menubar/types.d.ts +146 -0
- package/dist/components/message/index.d.ts +3 -0
- package/dist/components/message/index.js +1 -0
- package/dist/components/message/message.d.ts +37 -0
- package/dist/components/message/message.js +83 -0
- package/dist/components/message/types.d.ts +32 -0
- package/dist/components/message-scroller/index.d.ts +4 -0
- package/dist/components/message-scroller/index.js +3 -0
- package/dist/components/message-scroller/message-scroller-primitive.d.ts +21 -0
- package/dist/components/message-scroller/message-scroller-primitive.js +1349 -0
- package/dist/components/message-scroller/message-scroller.d.ts +39 -0
- package/dist/components/message-scroller/message-scroller.js +103 -0
- package/dist/components/message-scroller/types.d.ts +107 -0
- package/dist/components/money-input/index.d.ts +3 -0
- package/dist/components/money-input/index.js +1 -0
- package/dist/components/money-input/money-input.d.ts +7 -0
- package/dist/components/money-input/money-input.js +143 -0
- package/dist/components/money-input/types.d.ts +20 -0
- package/dist/components/morph-image/index.d.ts +3 -0
- package/dist/components/morph-image/index.js +3 -0
- package/dist/components/morph-image/morph-image.d.ts +8 -0
- package/dist/components/morph-image/morph-image.js +155 -0
- package/dist/components/morph-image/types.d.ts +38 -0
- package/dist/components/morph-image/types.js +18 -0
- package/dist/components/native-select/index.d.ts +3 -0
- package/dist/components/native-select/index.js +3 -0
- package/dist/components/native-select/native-select.d.ts +20 -0
- package/dist/components/native-select/native-select.js +57 -0
- package/dist/components/native-select/types.d.ts +52 -0
- package/dist/components/native-select/types.js +23 -0
- package/dist/components/navigation-menu/index.d.ts +3 -0
- package/dist/components/navigation-menu/index.js +3 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts +50 -0
- package/dist/components/navigation-menu/navigation-menu.js +145 -0
- package/dist/components/navigation-menu/types.d.ts +79 -0
- package/dist/components/navigation-menu/types.js +15 -0
- package/dist/components/number-stepper/index.d.ts +3 -0
- package/dist/components/number-stepper/index.js +3 -0
- package/dist/components/number-stepper/number-stepper.d.ts +9 -0
- package/dist/components/number-stepper/number-stepper.js +223 -0
- package/dist/components/number-stepper/types.d.ts +47 -0
- package/dist/components/number-stepper/types.js +174 -0
- package/dist/components/pagination/index.d.ts +3 -0
- package/dist/components/pagination/index.js +1 -0
- package/dist/components/pagination/pagination.d.ts +43 -0
- package/dist/components/pagination/pagination.js +121 -0
- package/dist/components/pagination/types.d.ts +37 -0
- package/dist/components/phone-input/index.d.ts +3 -0
- package/dist/components/phone-input/index.js +1 -0
- package/dist/components/phone-input/phone-input.d.ts +7 -0
- package/dist/components/phone-input/phone-input.js +54 -0
- package/dist/components/phone-input/types.d.ts +12 -0
- package/dist/components/popover/index.d.ts +3 -0
- package/dist/components/popover/index.js +1 -0
- package/dist/components/popover/popover.d.ts +37 -0
- package/dist/components/popover/popover.js +100 -0
- package/dist/components/popover/types.d.ts +51 -0
- package/dist/components/progress/index.d.ts +3 -0
- package/dist/components/progress/index.js +1 -0
- package/dist/components/progress/progress.d.ts +32 -0
- package/dist/components/progress/progress.js +100 -0
- package/dist/components/progress/types.d.ts +31 -0
- package/dist/components/questionnaire/index.d.ts +3 -0
- package/dist/components/questionnaire/index.js +1 -0
- package/dist/components/questionnaire/questionnaire-primitive.js +1563 -0
- package/dist/components/questionnaire/questionnaire.d.ts +91 -0
- package/dist/components/questionnaire/questionnaire.js +315 -0
- package/dist/components/questionnaire/types.d.ts +203 -0
- package/dist/components/radio-group/index.d.ts +3 -0
- package/dist/components/radio-group/index.js +1 -0
- package/dist/components/radio-group/radio-group.d.ts +13 -0
- package/dist/components/radio-group/radio-group.js +44 -0
- package/dist/components/radio-group/types.d.ts +33 -0
- package/dist/components/reorder-list/index.d.ts +3 -0
- package/dist/components/reorder-list/index.js +1 -0
- package/dist/components/reorder-list/reorder-list.d.ts +19 -0
- package/dist/components/reorder-list/reorder-list.js +279 -0
- package/dist/components/reorder-list/types.d.ts +65 -0
- package/dist/components/resizable/index.d.ts +3 -0
- package/dist/components/resizable/index.js +1 -0
- package/dist/components/resizable/resizable.d.ts +19 -0
- package/dist/components/resizable/resizable.js +44 -0
- package/dist/components/resizable/types.d.ts +89 -0
- package/dist/components/scroll-area/index.d.ts +3 -0
- package/dist/components/scroll-area/index.js +1 -0
- package/dist/components/scroll-area/scroll-area.d.ts +13 -0
- package/dist/components/scroll-area/scroll-area.js +47 -0
- package/dist/components/scroll-area/types.d.ts +19 -0
- package/dist/components/select/index.d.ts +3 -0
- package/dist/components/select/index.js +1 -0
- package/dist/components/select/select.d.ts +61 -0
- package/dist/components/select/select.js +183 -0
- package/dist/components/select/types.d.ts +100 -0
- package/dist/components/separator/index.d.ts +3 -0
- package/dist/components/separator/index.js +1 -0
- package/dist/components/separator/separator.d.ts +7 -0
- package/dist/components/separator/separator.js +20 -0
- package/dist/components/separator/types.d.ts +9 -0
- package/dist/components/sheet/index.d.ts +3 -0
- package/dist/components/sheet/index.js +1 -0
- package/dist/components/sheet/sheet.d.ts +61 -0
- package/dist/components/sheet/sheet.js +155 -0
- package/dist/components/sheet/types.d.ts +69 -0
- package/dist/components/sidebar/index.d.ts +3 -0
- package/dist/components/sidebar/index.js +3 -0
- package/dist/components/sidebar/sidebar.d.ts +145 -0
- package/dist/components/sidebar/sidebar.js +550 -0
- package/dist/components/sidebar/types.d.ts +186 -0
- package/dist/components/sidebar/types.js +42 -0
- package/dist/components/sidebar/use-mobile.js +21 -0
- package/dist/components/skeleton/index.d.ts +3 -0
- package/dist/components/skeleton/index.js +1 -0
- package/dist/components/skeleton/skeleton.d.ts +8 -0
- package/dist/components/skeleton/skeleton.js +18 -0
- package/dist/components/skeleton/types.d.ts +5 -0
- package/dist/components/slider/index.d.ts +3 -0
- package/dist/components/slider/index.js +1 -0
- package/dist/components/slider/slider.d.ts +7 -0
- package/dist/components/slider/slider.js +106 -0
- package/dist/components/slider/types.d.ts +39 -0
- package/dist/components/spinner/index.d.ts +3 -0
- package/dist/components/spinner/index.js +1 -0
- package/dist/components/spinner/spinner.d.ts +7 -0
- package/dist/components/spinner/spinner.js +21 -0
- package/dist/components/spinner/types.d.ts +8 -0
- package/dist/components/stack/index.d.ts +3 -0
- package/dist/components/stack/index.js +3 -0
- package/dist/components/stack/stack.d.ts +7 -0
- package/dist/components/stack/stack.js +29 -0
- package/dist/components/stack/types.d.ts +56 -0
- package/dist/components/stack/types.js +62 -0
- package/dist/components/statistics/index.d.ts +3 -0
- package/dist/components/statistics/index.js +3 -0
- package/dist/components/statistics/statistics.d.ts +31 -0
- package/dist/components/statistics/statistics.js +141 -0
- package/dist/components/statistics/types.d.ts +84 -0
- package/dist/components/statistics/types.js +27 -0
- package/dist/components/switch/index.d.ts +3 -0
- package/dist/components/switch/index.js +3 -0
- package/dist/components/switch/switch.d.ts +7 -0
- package/dist/components/switch/switch.js +32 -0
- package/dist/components/switch/types.d.ts +37 -0
- package/dist/components/switch/types.js +23 -0
- package/dist/components/table/index.d.ts +3 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/table/table.d.ts +49 -0
- package/dist/components/table/table.js +112 -0
- package/dist/components/table/types.d.ts +33 -0
- package/dist/components/tabs/index.d.ts +3 -0
- package/dist/components/tabs/index.js +3 -0
- package/dist/components/tabs/tabs.d.ts +25 -0
- package/dist/components/tabs/tabs.js +81 -0
- package/dist/components/tabs/types.d.ts +61 -0
- package/dist/components/tabs/types.js +18 -0
- package/dist/components/textarea/index.d.ts +3 -0
- package/dist/components/textarea/index.js +1 -0
- package/dist/components/textarea/textarea.d.ts +7 -0
- package/dist/components/textarea/textarea.js +17 -0
- package/dist/components/textarea/types.d.ts +26 -0
- package/dist/components/toast/index.d.ts +3 -0
- package/dist/components/toast/index.js +1 -0
- package/dist/components/toast/toast.d.ts +63 -0
- package/dist/components/toast/toast.js +321 -0
- package/dist/components/toast/types.d.ts +120 -0
- package/dist/components/toggle/index.d.ts +3 -0
- package/dist/components/toggle/index.js +3 -0
- package/dist/components/toggle/toggle.d.ts +7 -0
- package/dist/components/toggle/toggle.js +32 -0
- package/dist/components/toggle/types.d.ts +35 -0
- package/dist/components/toggle/types.js +37 -0
- package/dist/components/toggle-group/index.d.ts +3 -0
- package/dist/components/toggle-group/index.js +1 -0
- package/dist/components/toggle-group/toggle-group.d.ts +13 -0
- package/dist/components/toggle-group/toggle-group.js +88 -0
- package/dist/components/toggle-group/types.d.ts +52 -0
- package/dist/components/tooltip/index.d.ts +3 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/components/tooltip/tooltip.d.ts +25 -0
- package/dist/components/tooltip/tooltip.js +79 -0
- package/dist/components/tooltip/types.d.ts +48 -0
- package/dist/components/trace/index.d.ts +3 -0
- package/dist/components/trace/index.js +1 -0
- package/dist/components/trace/trace.d.ts +52 -0
- package/dist/components/trace/trace.js +132 -0
- package/dist/components/trace/types.d.ts +54 -0
- package/dist/components/typography/index.d.ts +3 -0
- package/dist/components/typography/index.js +3 -0
- package/dist/components/typography/types.d.ts +29 -0
- package/dist/components/typography/types.js +25 -0
- package/dist/components/typography/typography.d.ts +7 -0
- package/dist/components/typography/typography.js +40 -0
- package/dist/components/video-player/index.d.ts +6 -0
- package/dist/components/video-player/index.js +5 -0
- package/dist/components/video-player/types.d.ts +143 -0
- package/dist/components/video-player/use-video-player.js +319 -0
- package/dist/components/video-player/video-player-context.d.ts +45 -0
- package/dist/components/video-player/video-player-context.js +15 -0
- package/dist/components/video-player/video-player-controls.d.ts +38 -0
- package/dist/components/video-player/video-player-controls.js +226 -0
- package/dist/components/video-player/video-player-overlay.d.ts +13 -0
- package/dist/components/video-player/video-player-overlay.js +113 -0
- package/dist/components/video-player/video-player.d.ts +8 -0
- package/dist/components/video-player/video-player.js +139 -0
- package/dist/index.d.ts +259 -0
- package/dist/index.js +124 -0
- package/dist/lib/floating.d.ts +44 -0
- package/dist/lib/focus-source.js +51 -0
- package/dist/lib/format.d.ts +67 -0
- package/dist/lib/format.js +130 -0
- package/dist/lib/locale.d.ts +104 -0
- package/dist/lib/locale.js +103 -0
- package/dist/lib/part-props.d.ts +15 -0
- package/dist/lib/use-controllable-state.js +22 -0
- package/dist/lib/utils.d.ts +9 -0
- package/dist/lib/utils.js +16 -0
- package/dist/styles/index.css +128 -0
- package/dist/styles/theme.css +84 -0
- package/dist/styles/utilities.css +553 -0
- package/package.json +89 -3
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { texts } from "../../lib/locale.js";
|
|
4
|
+
import { Button } from "../button/button.js";
|
|
5
|
+
import { CircleCheckIcon, InfoIcon, LoaderCircleIcon, OctagonXIcon, TriangleAlertIcon, XIcon } from "lucide-react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { createContext, useContext } from "react";
|
|
8
|
+
import { Toast } from "@base-ui/react/toast";
|
|
9
|
+
// src/components/toast/toast.tsx
|
|
10
|
+
/** Общий менеджер: им пользуются toast и Toaster по умолчанию */
|
|
11
|
+
const defaultManager = Toast.createToastManager();
|
|
12
|
+
/** Создать свой менеджер уведомлений: для отдельного Toaster */
|
|
13
|
+
const createToastManager = Toast.createToastManager;
|
|
14
|
+
/**
|
|
15
|
+
* Функция показа уведомлений для менеджера
|
|
16
|
+
* @param manager - менеджер, в который добавляются уведомления
|
|
17
|
+
* @returns toast с методами success, info, warning, error, loading, promise, dismiss
|
|
18
|
+
*/
|
|
19
|
+
function createToast(manager) {
|
|
20
|
+
/**
|
|
21
|
+
* Добавить уведомление
|
|
22
|
+
* @param title - заголовок
|
|
23
|
+
* @param type - тип
|
|
24
|
+
* @param options - параметры
|
|
25
|
+
* @returns id уведомления
|
|
26
|
+
*/
|
|
27
|
+
const show = (title, type, options = {}) => {
|
|
28
|
+
const { id, description, action, duration, priority } = options;
|
|
29
|
+
let toastId = id;
|
|
30
|
+
/**
|
|
31
|
+
* Нажатие на кнопку действия: обработчик и закрытие
|
|
32
|
+
* @param event - событие нажатия
|
|
33
|
+
*/
|
|
34
|
+
const handleAction = (event) => {
|
|
35
|
+
action?.onClick?.(event);
|
|
36
|
+
manager.close(toastId);
|
|
37
|
+
};
|
|
38
|
+
const actionProps = action ? {
|
|
39
|
+
children: action.label,
|
|
40
|
+
onClick: handleAction
|
|
41
|
+
} : void 0;
|
|
42
|
+
toastId = manager.add({
|
|
43
|
+
id,
|
|
44
|
+
title,
|
|
45
|
+
type,
|
|
46
|
+
description,
|
|
47
|
+
timeout: duration,
|
|
48
|
+
priority,
|
|
49
|
+
actionProps
|
|
50
|
+
});
|
|
51
|
+
return toastId;
|
|
52
|
+
};
|
|
53
|
+
const toast = ((title, options) => show(title, void 0, options));
|
|
54
|
+
toast.success = (title, options) => show(title, "success", options);
|
|
55
|
+
toast.info = (title, options) => show(title, "info", options);
|
|
56
|
+
toast.warning = (title, options) => show(title, "warning", options);
|
|
57
|
+
toast.error = (title, options) => show(title, "error", Object.assign({ priority: "high" }, options));
|
|
58
|
+
toast.loading = (title, options) => show(title, "loading", options);
|
|
59
|
+
toast.dismiss = (id) => manager.close(id);
|
|
60
|
+
toast.promise = (promise, textsByState) => {
|
|
61
|
+
/**
|
|
62
|
+
* Текст успеха: строка или функция от результата
|
|
63
|
+
* @param value - результат задачи
|
|
64
|
+
* @returns параметры уведомления
|
|
65
|
+
*/
|
|
66
|
+
const getSuccess = (value) => {
|
|
67
|
+
const { success } = textsByState;
|
|
68
|
+
return { title: typeof success === "function" ? success(value) : success };
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Текст ошибки: строка или функция от ошибки
|
|
72
|
+
* @param error - ошибка задачи
|
|
73
|
+
* @returns параметры уведомления
|
|
74
|
+
*/
|
|
75
|
+
const getError = (error) => {
|
|
76
|
+
const { error: errorText } = textsByState;
|
|
77
|
+
return {
|
|
78
|
+
title: typeof errorText === "function" ? errorText(error) : errorText,
|
|
79
|
+
priority: "high"
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
return manager.promise(promise, {
|
|
83
|
+
loading: { title: textsByState.loading },
|
|
84
|
+
success: getSuccess,
|
|
85
|
+
error: getError
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
return toast;
|
|
89
|
+
}
|
|
90
|
+
/** Показать уведомление в общем Toaster: toast('Текст'), toast.success(...), toast.promise(...) */
|
|
91
|
+
const toast = createToast(defaultManager);
|
|
92
|
+
/** Положение уведомлений для частей внутри Toaster */
|
|
93
|
+
const ToastPositionContext = createContext("bottom-right");
|
|
94
|
+
/** Положение области уведомлений на экране */
|
|
95
|
+
const viewportPositions = {
|
|
96
|
+
"top-left": "top-4 left-4",
|
|
97
|
+
"top-center": "top-4 left-1/2 -translate-x-1/2",
|
|
98
|
+
"top-right": "top-4 right-4",
|
|
99
|
+
"bottom-left": "bottom-4 left-4",
|
|
100
|
+
"bottom-center": "bottom-4 left-1/2 -translate-x-1/2",
|
|
101
|
+
"bottom-right": "bottom-4 right-4"
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Область уведомлений: стопка в углу экрана, раскрывается при наведении
|
|
105
|
+
* @param props - пропсы области
|
|
106
|
+
* @returns область с role="region"
|
|
107
|
+
*/
|
|
108
|
+
function ToastViewport({ className, position, ...props }) {
|
|
109
|
+
const contextPosition = useContext(ToastPositionContext);
|
|
110
|
+
const currentPosition = position ?? contextPosition;
|
|
111
|
+
const classes = cn("pointer-events-none", "fixed", "z-100", "w-[calc(100%-2rem)]", "max-w-sm", "outline-none", viewportPositions[currentPosition], className);
|
|
112
|
+
return /* @__PURE__ */ jsx(Toast.Viewport, {
|
|
113
|
+
"data-slot": "toast-viewport",
|
|
114
|
+
"data-position": currentPosition,
|
|
115
|
+
"aria-label": texts.notifications,
|
|
116
|
+
className: classes,
|
|
117
|
+
...props
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/** Классы уведомления, общие для верха и низа экрана */
|
|
121
|
+
const toastBaseClasses = [
|
|
122
|
+
"group/toast pointer-events-auto absolute right-0 z-[calc(1000-var(--toast-index))] w-full",
|
|
123
|
+
"rounded-2xl border bg-popover text-popover-foreground shadow-lg will-change-transform outline-none select-none",
|
|
124
|
+
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
125
|
+
"[--gap:0.75rem] [--height:var(--toast-frontmost-height,var(--toast-height))] [--peek:0.75rem]",
|
|
126
|
+
"[--scale:calc(max(0,1-(var(--toast-index)*0.1)))] [--shrink:calc(1-var(--scale))]",
|
|
127
|
+
"h-(--height) [transition:transform_500ms_cubic-bezier(0.22,1,0.36,1),opacity_500ms,height_150ms]",
|
|
128
|
+
"after:absolute after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-[\"\"]",
|
|
129
|
+
"data-expanded:h-(--toast-height) data-limited:opacity-0",
|
|
130
|
+
"data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]",
|
|
131
|
+
"data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]"
|
|
132
|
+
];
|
|
133
|
+
/** Уведомления внизу экрана: новые снизу, старые уходят вверх стопкой */
|
|
134
|
+
const toastBottomClasses = [
|
|
135
|
+
"bottom-0 origin-bottom after:top-full",
|
|
136
|
+
"[--offset-y:calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y))]",
|
|
137
|
+
"[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--peek))-(var(--shrink)*var(--height))))_scale(var(--scale))]",
|
|
138
|
+
"data-expanded:[transform:translateX(var(--toast-swipe-movement-x))_translateY(var(--offset-y))]",
|
|
139
|
+
"data-starting-style:[transform:translateY(150%)]",
|
|
140
|
+
"[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]",
|
|
141
|
+
"data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]"
|
|
142
|
+
];
|
|
143
|
+
/** Уведомления вверху экрана: новые сверху, старые уходят вниз стопкой */
|
|
144
|
+
const toastTopClasses = [
|
|
145
|
+
"top-0 origin-top after:bottom-full",
|
|
146
|
+
"[--offset-y:calc(var(--toast-offset-y)+calc(var(--toast-index)*var(--gap))+var(--toast-swipe-movement-y))]",
|
|
147
|
+
"[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+(var(--toast-index)*var(--peek))+(var(--shrink)*var(--height))))_scale(var(--scale))]",
|
|
148
|
+
"data-expanded:[transform:translateX(var(--toast-swipe-movement-x))_translateY(var(--offset-y))]",
|
|
149
|
+
"data-starting-style:[transform:translateY(-150%)]",
|
|
150
|
+
"[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(-150%)]",
|
|
151
|
+
"data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]"
|
|
152
|
+
];
|
|
153
|
+
/**
|
|
154
|
+
* Уведомление: карточка в стопке; смахивается к краю экрана
|
|
155
|
+
* @param props - пропсы уведомления; toast — объект из useToastManager().toasts
|
|
156
|
+
* @returns карточка уведомления
|
|
157
|
+
*/
|
|
158
|
+
function Toast$1({ className, ...props }) {
|
|
159
|
+
const position = useContext(ToastPositionContext);
|
|
160
|
+
const isTop = position.startsWith("top");
|
|
161
|
+
const positionClasses = isTop ? toastTopClasses : toastBottomClasses;
|
|
162
|
+
const vertical = isTop ? "up" : "down";
|
|
163
|
+
const horizontal = position.endsWith("left") ? "left" : "right";
|
|
164
|
+
const classes = cn(toastBaseClasses, positionClasses, className);
|
|
165
|
+
return /* @__PURE__ */ jsx(Toast.Root, {
|
|
166
|
+
"data-slot": "toast",
|
|
167
|
+
swipeDirection: [vertical, horizontal],
|
|
168
|
+
className: classes,
|
|
169
|
+
...props
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Содержимое уведомления: иконка, текст и кнопки в строку; у задних карточек стопки скрыто
|
|
174
|
+
* @param props - пропсы содержимого
|
|
175
|
+
* @returns строка содержимого
|
|
176
|
+
*/
|
|
177
|
+
function ToastContent({ className, ...props }) {
|
|
178
|
+
const classes = cn("flex", "h-full", "items-center", "gap-3", "overflow-hidden", "p-4", "transition-opacity", "duration-250", "ease-[cubic-bezier(0.22,1,0.36,1)]", "data-behind:opacity-0", "data-expanded:opacity-100", className);
|
|
179
|
+
return /* @__PURE__ */ jsx(Toast.Content, {
|
|
180
|
+
"data-slot": "toast-content",
|
|
181
|
+
className: classes,
|
|
182
|
+
...props
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Заголовок уведомления: по умолчанию — первый аргумент toast()
|
|
187
|
+
* @param props - пропсы заголовка
|
|
188
|
+
* @returns заголовок
|
|
189
|
+
*/
|
|
190
|
+
function ToastTitle({ className, ...props }) {
|
|
191
|
+
const classes = cn("text-sm", "font-medium", className);
|
|
192
|
+
return /* @__PURE__ */ jsx(Toast.Title, {
|
|
193
|
+
"data-slot": "toast-title",
|
|
194
|
+
className: classes,
|
|
195
|
+
...props
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Описание уведомления: по умолчанию — description из параметров
|
|
200
|
+
* @param props - пропсы описания
|
|
201
|
+
* @returns абзац
|
|
202
|
+
*/
|
|
203
|
+
function ToastDescription({ className, ...props }) {
|
|
204
|
+
const classes = cn("text-sm", "text-muted-foreground", className);
|
|
205
|
+
return /* @__PURE__ */ jsx(Toast.Description, {
|
|
206
|
+
"data-slot": "toast-description",
|
|
207
|
+
className: classes,
|
|
208
|
+
...props
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Кнопка действия: по умолчанию — action из параметров, оформлена как Button outline sm
|
|
213
|
+
* @param props - пропсы кнопки
|
|
214
|
+
* @returns кнопка
|
|
215
|
+
*/
|
|
216
|
+
function ToastAction({ className, render, ...props }) {
|
|
217
|
+
const button = /* @__PURE__ */ jsx(Button, {
|
|
218
|
+
variant: "outline",
|
|
219
|
+
size: "sm"
|
|
220
|
+
});
|
|
221
|
+
const classes = cn("shrink-0", className);
|
|
222
|
+
return /* @__PURE__ */ jsx(Toast.Action, {
|
|
223
|
+
"data-slot": "toast-action",
|
|
224
|
+
render: render ?? button,
|
|
225
|
+
className: classes,
|
|
226
|
+
...props
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Кнопка закрытия уведомления: крестик
|
|
231
|
+
* @param props - пропсы кнопки
|
|
232
|
+
* @returns кнопка
|
|
233
|
+
*/
|
|
234
|
+
function ToastClose({ className, children, label = texts.close, render, ...props }) {
|
|
235
|
+
const button = /* @__PURE__ */ jsx(Button, {
|
|
236
|
+
variant: "ghost",
|
|
237
|
+
size: "icon-sm"
|
|
238
|
+
});
|
|
239
|
+
const classes = cn("relative", "shrink-0", "text-muted-foreground", "after:absolute", "after:-inset-2", "after:content-[\"\"]", "hover:text-foreground", className);
|
|
240
|
+
return /* @__PURE__ */ jsx(Toast.Close, {
|
|
241
|
+
"data-slot": "toast-close",
|
|
242
|
+
"aria-label": label,
|
|
243
|
+
render: render ?? button,
|
|
244
|
+
className: classes,
|
|
245
|
+
...props,
|
|
246
|
+
children: children ?? /* @__PURE__ */ jsx(XIcon, { "aria-hidden": true })
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
/** Иконки типов уведомлений */
|
|
250
|
+
const statusIcons = {
|
|
251
|
+
success: /* @__PURE__ */ jsx(CircleCheckIcon, { "aria-hidden": true }),
|
|
252
|
+
info: /* @__PURE__ */ jsx(InfoIcon, { "aria-hidden": true }),
|
|
253
|
+
warning: /* @__PURE__ */ jsx(TriangleAlertIcon, { "aria-hidden": true }),
|
|
254
|
+
error: /* @__PURE__ */ jsx(OctagonXIcon, {
|
|
255
|
+
"aria-hidden": true,
|
|
256
|
+
className: "text-destructive"
|
|
257
|
+
}),
|
|
258
|
+
loading: /* @__PURE__ */ jsx(LoaderCircleIcon, {
|
|
259
|
+
"aria-hidden": true,
|
|
260
|
+
className: "animate-spin"
|
|
261
|
+
})
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* Иконка типа уведомления
|
|
265
|
+
* @param props - пропсы
|
|
266
|
+
* @param props.type - тип уведомления
|
|
267
|
+
* @returns иконка или null для обычного уведомления
|
|
268
|
+
*/
|
|
269
|
+
function ToastIcon({ type }) {
|
|
270
|
+
const icon = type ? statusIcons[type] : void 0;
|
|
271
|
+
if (!icon) return null;
|
|
272
|
+
return /* @__PURE__ */ jsx("span", {
|
|
273
|
+
"data-slot": "toast-icon",
|
|
274
|
+
className: "shrink-0 [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4",
|
|
275
|
+
children: icon
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Список уведомлений: стандартная разметка каждого уведомления
|
|
280
|
+
* @param props - пропсы списка
|
|
281
|
+
* @returns уведомления
|
|
282
|
+
*/
|
|
283
|
+
function ToastList({ closeButton }) {
|
|
284
|
+
const { toasts } = Toast.useToastManager();
|
|
285
|
+
return toasts.map((toastItem) => /* @__PURE__ */ jsx(Toast$1, {
|
|
286
|
+
toast: toastItem,
|
|
287
|
+
children: /* @__PURE__ */ jsxs(ToastContent, { children: [
|
|
288
|
+
/* @__PURE__ */ jsx(ToastIcon, { type: toastItem.type }),
|
|
289
|
+
/* @__PURE__ */ jsxs("div", {
|
|
290
|
+
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
291
|
+
children: [/* @__PURE__ */ jsx(ToastTitle, {}), /* @__PURE__ */ jsx(ToastDescription, {})]
|
|
292
|
+
}),
|
|
293
|
+
toastItem.actionProps && /* @__PURE__ */ jsx(ToastAction, {}),
|
|
294
|
+
closeButton && /* @__PURE__ */ jsx(ToastClose, {})
|
|
295
|
+
] })
|
|
296
|
+
}, toastItem.id));
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Контейнер уведомлений: ставится один раз в корень приложения
|
|
300
|
+
* @param props - пропсы контейнера
|
|
301
|
+
* @returns провайдер с областью уведомлений
|
|
302
|
+
*/
|
|
303
|
+
function Toaster({ children, position = "bottom-right", toastManager = defaultManager, closeButton = true, viewportLabel, ...props }) {
|
|
304
|
+
return /* @__PURE__ */ jsx(Toast.Provider, {
|
|
305
|
+
toastManager,
|
|
306
|
+
...props,
|
|
307
|
+
children: /* @__PURE__ */ jsxs(ToastPositionContext, {
|
|
308
|
+
value: position,
|
|
309
|
+
children: [children, /* @__PURE__ */ jsx(Toast.Portal, {
|
|
310
|
+
"data-slot": "toast-portal",
|
|
311
|
+
children: /* @__PURE__ */ jsx(ToastViewport, {
|
|
312
|
+
"aria-label": viewportLabel ?? texts.notifications,
|
|
313
|
+
children: /* @__PURE__ */ jsx(ToastList, { closeButton })
|
|
314
|
+
})
|
|
315
|
+
})]
|
|
316
|
+
})
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
/** Хук: список уведомлений и методы add, close, update, promise ближайшего Toaster */
|
|
320
|
+
const useToastManager = Toast.useToastManager;
|
|
321
|
+
export { Toast$1 as Toast, ToastAction, ToastClose, ToastContent, ToastDescription, ToastTitle, ToastViewport, Toaster, createToast, createToastManager, toast, useToastManager };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { PartPropsT } from "../../lib/part-props.js";
|
|
2
|
+
import { MouseEvent, ReactNode } from "react";
|
|
3
|
+
import { Toast } from "@base-ui/react/toast";
|
|
4
|
+
/**
|
|
5
|
+
* Угол экрана, где появляются уведомления
|
|
6
|
+
*/
|
|
7
|
+
export type ToastPositionT = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
8
|
+
/**
|
|
9
|
+
* Тип уведомления: задаёт иконку
|
|
10
|
+
*/
|
|
11
|
+
export type ToastTypeT = 'success' | 'info' | 'warning' | 'error' | 'loading';
|
|
12
|
+
/**
|
|
13
|
+
* Менеджер уведомлений Base UI: add, close, update, promise
|
|
14
|
+
*/
|
|
15
|
+
export type ToastManagerT = ReturnType<typeof Toast.createToastManager>;
|
|
16
|
+
/**
|
|
17
|
+
* Кнопка действия в уведомлении
|
|
18
|
+
* @property label - Подпись кнопки
|
|
19
|
+
* @property onClick - Нажатие: после него уведомление закрывается
|
|
20
|
+
*/
|
|
21
|
+
export interface ToastActionI {
|
|
22
|
+
label: ReactNode;
|
|
23
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Параметры уведомления
|
|
27
|
+
* @property id - Свой идентификатор: уведомление с тем же id обновляется, а не дублируется
|
|
28
|
+
* @property description - Описание под заголовком
|
|
29
|
+
* @property action - Кнопка действия
|
|
30
|
+
* @property duration - Сколько мс показывать; 0 — пока не закроют
|
|
31
|
+
* @property priority - high — скринридер объявляет сразу (для ошибок)
|
|
32
|
+
*/
|
|
33
|
+
export interface ToastOptionsI {
|
|
34
|
+
id?: string;
|
|
35
|
+
description?: ReactNode;
|
|
36
|
+
action?: ToastActionI;
|
|
37
|
+
duration?: number;
|
|
38
|
+
priority?: 'low' | 'high';
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Тексты уведомления при toast.promise: строка или функция от результата
|
|
42
|
+
* @property loading - Пока задача выполняется
|
|
43
|
+
* @property success - Задача выполнена
|
|
44
|
+
* @property error - Задача завершилась ошибкой
|
|
45
|
+
*/
|
|
46
|
+
export interface ToastPromiseTextsI<ValueT> {
|
|
47
|
+
loading: ReactNode;
|
|
48
|
+
success: ReactNode | ((value: ValueT) => ReactNode);
|
|
49
|
+
error: ReactNode | ((error: unknown) => ReactNode);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Показ уведомлений: toast('Текст'), toast.success(...), toast.error(...), toast.promise(...)
|
|
53
|
+
*/
|
|
54
|
+
export type ToastFunctionT = ((title: ReactNode, options?: ToastOptionsI) => string) & {
|
|
55
|
+
/** Успех: зелёная галочка */
|
|
56
|
+
success: (title: ReactNode, options?: ToastOptionsI) => string;
|
|
57
|
+
/** Информация */
|
|
58
|
+
info: (title: ReactNode, options?: ToastOptionsI) => string;
|
|
59
|
+
/** Предупреждение */
|
|
60
|
+
warning: (title: ReactNode, options?: ToastOptionsI) => string;
|
|
61
|
+
/** Ошибка: объявляется скринридером сразу */
|
|
62
|
+
error: (title: ReactNode, options?: ToastOptionsI) => string;
|
|
63
|
+
/** Загрузка: крутится, пока не обновят или не закроют */
|
|
64
|
+
loading: (title: ReactNode, options?: ToastOptionsI) => string;
|
|
65
|
+
/** Одно уведомление проходит загрузку, затем успех или ошибку */
|
|
66
|
+
promise: <ValueT>(promise: Promise<ValueT>, textsByState: ToastPromiseTextsI<ValueT>) => Promise<ValueT>;
|
|
67
|
+
/** Закрыть уведомление по id или все, если id не передан */
|
|
68
|
+
dismiss: (id?: string) => void;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Пропсы области уведомлений
|
|
72
|
+
*/
|
|
73
|
+
export type ToastViewportPropsT = PartPropsT<Toast.Viewport.Props> & {
|
|
74
|
+
/** Угол экрана. По умолчанию — из Toaster */
|
|
75
|
+
position?: ToastPositionT;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Пропсы уведомления
|
|
79
|
+
*/
|
|
80
|
+
export type ToastPropsT = PartPropsT<Toast.Root.Props>;
|
|
81
|
+
/**
|
|
82
|
+
* Пропсы содержимого уведомления
|
|
83
|
+
*/
|
|
84
|
+
export type ToastContentPropsT = PartPropsT<Toast.Content.Props>;
|
|
85
|
+
/**
|
|
86
|
+
* Пропсы заголовка
|
|
87
|
+
*/
|
|
88
|
+
export type ToastTitlePropsT = PartPropsT<Toast.Title.Props>;
|
|
89
|
+
/**
|
|
90
|
+
* Пропсы описания
|
|
91
|
+
*/
|
|
92
|
+
export type ToastDescriptionPropsT = PartPropsT<Toast.Description.Props>;
|
|
93
|
+
/**
|
|
94
|
+
* Пропсы кнопки действия
|
|
95
|
+
*/
|
|
96
|
+
export type ToastActionPropsT = PartPropsT<Toast.Action.Props>;
|
|
97
|
+
/**
|
|
98
|
+
* Пропсы кнопки закрытия
|
|
99
|
+
*/
|
|
100
|
+
export type ToastClosePropsT = PartPropsT<Toast.Close.Props> & {
|
|
101
|
+
/** Подпись для скринридера, по умолчанию «Закрыть» */
|
|
102
|
+
label?: string;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Пропсы контейнера уведомлений
|
|
106
|
+
*/
|
|
107
|
+
export type ToasterPropsT = Omit<Toast.Provider.Props, 'toastManager'> & {
|
|
108
|
+
/** Угол экрана, где появляются уведомления. По умолчанию bottom-right */
|
|
109
|
+
position?: ToastPositionT;
|
|
110
|
+
/** Менеджер уведомлений: свой из createToastManager вместо общего, которым пользуется toast */
|
|
111
|
+
toastManager?: ToastManagerT;
|
|
112
|
+
/** Показывать крестик закрытия в каждом уведомлении. По умолчанию true */
|
|
113
|
+
closeButton?: boolean;
|
|
114
|
+
/** Сколько уведомлений видно в стопке. По умолчанию 3 */
|
|
115
|
+
limit?: number;
|
|
116
|
+
/** Сколько мс показывать уведомление по умолчанию. По умолчанию 5000 */
|
|
117
|
+
timeout?: number;
|
|
118
|
+
/** Подпись области уведомлений для скринридера. По умолчанию «Уведомления» */
|
|
119
|
+
viewportLabel?: string;
|
|
120
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TogglePropsT } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Переключатель-кнопка: два состояния, включено и выключено
|
|
4
|
+
* @param props - пропсы переключателя
|
|
5
|
+
* @returns кнопка с aria-pressed
|
|
6
|
+
*/
|
|
7
|
+
export declare function Toggle({ className, variant, size, disabled, onPressedChange, ...props }: TogglePropsT): import("react").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { toggleVariants } from "./types.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { Toggle } from "@base-ui/react/toggle";
|
|
6
|
+
// src/components/toggle/toggle.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Переключатель-кнопка: два состояния, включено и выключено
|
|
9
|
+
* @param props - пропсы переключателя
|
|
10
|
+
* @returns кнопка с aria-pressed
|
|
11
|
+
*/
|
|
12
|
+
function Toggle$1({ className, variant = "default", size = "default", disabled = false, onPressedChange, ...props }) {
|
|
13
|
+
const classes = cn(toggleVariants({
|
|
14
|
+
variant,
|
|
15
|
+
size
|
|
16
|
+
}), className);
|
|
17
|
+
/**
|
|
18
|
+
* Переключатель нажали: наружу только состояние
|
|
19
|
+
* @param pressed - включён ли
|
|
20
|
+
*/
|
|
21
|
+
const handlePressedChange = (pressed) => onPressedChange?.(pressed);
|
|
22
|
+
return /* @__PURE__ */ jsx(Toggle, {
|
|
23
|
+
"data-slot": "toggle",
|
|
24
|
+
"data-variant": variant,
|
|
25
|
+
"data-size": size,
|
|
26
|
+
disabled,
|
|
27
|
+
className: classes,
|
|
28
|
+
onPressedChange: handlePressedChange,
|
|
29
|
+
...props
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export { Toggle$1 as Toggle };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { PartPropsT } from "../../lib/part-props.js";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import { Toggle } from "@base-ui/react/toggle";
|
|
4
|
+
/**
|
|
5
|
+
* Стили переключателя-кнопки: вариант оформления и размер.
|
|
6
|
+
* Экспортируются, чтобы оформить переключателем другой элемент: toggleVariants({ variant: 'outline' }).
|
|
7
|
+
*/
|
|
8
|
+
export declare const toggleVariants: (props?: ({
|
|
9
|
+
variant?: "default" | "outline" | null | undefined;
|
|
10
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
|
+
/**
|
|
13
|
+
* Варианты оформления и размеры переключателя
|
|
14
|
+
*/
|
|
15
|
+
type ToggleVariantsT = VariantProps<typeof toggleVariants>;
|
|
16
|
+
/**
|
|
17
|
+
* Пропсы переключателя-кнопки
|
|
18
|
+
*/
|
|
19
|
+
export type TogglePropsT = PartPropsT<Omit<Toggle.Props, 'onPressedChange'>> & {
|
|
20
|
+
/** Оформление: без фона или с рамкой */
|
|
21
|
+
variant?: ToggleVariantsT['variant'];
|
|
22
|
+
/** Размер: sm, default, lg */
|
|
23
|
+
size?: ToggleVariantsT['size'];
|
|
24
|
+
/** Включён ли переключатель — контролируемый режим, вместе с onPressedChange */
|
|
25
|
+
pressed?: boolean;
|
|
26
|
+
/** Включён ли переключатель при первом рендере — неконтролируемый режим */
|
|
27
|
+
defaultPressed?: boolean;
|
|
28
|
+
/** Переключатель включили или выключили: новое состояние */
|
|
29
|
+
onPressedChange?: (pressed: boolean) => void;
|
|
30
|
+
/** Отключённое состояние: переключатель не нажимается */
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** Значение кнопки внутри ToggleGroup */
|
|
33
|
+
value?: string;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
// src/components/toggle/types.ts
|
|
3
|
+
/**
|
|
4
|
+
* Стили переключателя-кнопки: вариант оформления и размер.
|
|
5
|
+
* Экспортируются, чтобы оформить переключателем другой элемент: toggleVariants({ variant: 'outline' }).
|
|
6
|
+
*/
|
|
7
|
+
const toggleVariants = cva([
|
|
8
|
+
"group/toggle inline-flex items-center justify-center gap-1 rounded-lg",
|
|
9
|
+
"text-sm font-medium whitespace-nowrap transition-all outline-none",
|
|
10
|
+
"cursor-pointer hover:bg-muted hover:text-foreground",
|
|
11
|
+
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
12
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
13
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
|
|
14
|
+
"aria-pressed:bg-muted data-pressed:bg-muted",
|
|
15
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4"
|
|
16
|
+
], {
|
|
17
|
+
variants: {
|
|
18
|
+
variant: {
|
|
19
|
+
default: "bg-transparent",
|
|
20
|
+
outline: "border border-input bg-transparent hover:bg-muted"
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
default: ["h-8 min-w-8 px-2.5", "has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"],
|
|
24
|
+
sm: [
|
|
25
|
+
"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem]",
|
|
26
|
+
"has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
|
|
27
|
+
"[&_svg:not([class*=size-])]:size-3.5"
|
|
28
|
+
],
|
|
29
|
+
lg: ["h-9 min-w-9 px-2.5", "has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"]
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
variant: "default",
|
|
34
|
+
size: "default"
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
export { toggleVariants };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ToggleGroup, ToggleGroupItem } from "./toggle-group.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ToggleGroupItemPropsT, ToggleGroupPropsT } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Группа переключателей: одна или несколько нажатых кнопок из набора
|
|
4
|
+
* @param props - пропсы группы
|
|
5
|
+
* @returns группа с ролью group
|
|
6
|
+
*/
|
|
7
|
+
export declare function ToggleGroup({ className, variant, size, spacing, orientation, style, children, onValueChange, ...props }: ToggleGroupPropsT): import("react").JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* Кнопка группы переключателей
|
|
10
|
+
* @param props - пропсы кнопки
|
|
11
|
+
* @returns кнопка с aria-pressed
|
|
12
|
+
*/
|
|
13
|
+
export declare function ToggleGroupItem({ className, variant, size, disabled, ...props }: ToggleGroupItemPropsT): import("react").JSX.Element;
|