@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,212 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { formatNumber } from "../../lib/format.js";
|
|
4
|
+
import { THEMES } from "./types.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { createContext, useContext, useId } from "react";
|
|
7
|
+
import * as RechartsPrimitive from "recharts";
|
|
8
|
+
// src/components/chart/chart.tsx
|
|
9
|
+
/** Размер графика до первого замера контейнера */
|
|
10
|
+
const INITIAL_DIMENSION = {
|
|
11
|
+
width: 320,
|
|
12
|
+
height: 200
|
|
13
|
+
};
|
|
14
|
+
/** Настройки рядов текущего графика */
|
|
15
|
+
const ChartContext = createContext(null);
|
|
16
|
+
/**
|
|
17
|
+
* Настройки рядов текущего графика
|
|
18
|
+
* @returns настройки из ChartContainer
|
|
19
|
+
*/
|
|
20
|
+
function useChart() {
|
|
21
|
+
const context = useContext(ChartContext);
|
|
22
|
+
if (!context) throw new Error("useChart работает только внутри ChartContainer");
|
|
23
|
+
return context;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Контейнер графика: подстраивает график под размер, задаёт цвета рядов и оформление осей.
|
|
27
|
+
* Высоту задайте через className, по умолчанию пропорции 16:9
|
|
28
|
+
* @param props - пропсы контейнера; config — подписи и цвета рядов
|
|
29
|
+
* @returns div с графиком
|
|
30
|
+
*/
|
|
31
|
+
function ChartContainer({ id, className, children, config, initialDimension = INITIAL_DIMENSION, ...props }) {
|
|
32
|
+
const uniqueId = useId();
|
|
33
|
+
const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`;
|
|
34
|
+
const context = { config };
|
|
35
|
+
const classes = cn("flex", "aspect-video", "justify-center", "text-xs", "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", "[&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50", "[&_.recharts-curve.recharts-tooltip-cursor]:stroke-border", "[&_.recharts-dot[stroke='#fff']]:stroke-transparent", "[&_.recharts-layer]:outline-hidden", "[&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border", "[&_.recharts-radial-bar-background-sector]:fill-muted", "[&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted", "[&_.recharts-reference-line_[stroke='#ccc']]:stroke-border", "[&_.recharts-sector]:outline-hidden", "[&_.recharts-sector[stroke='#fff']]:stroke-transparent", "[&_.recharts-surface]:outline-hidden", className);
|
|
36
|
+
return /* @__PURE__ */ jsx(ChartContext.Provider, {
|
|
37
|
+
value: context,
|
|
38
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
39
|
+
"data-slot": "chart",
|
|
40
|
+
"data-chart": chartId,
|
|
41
|
+
className: classes,
|
|
42
|
+
...props,
|
|
43
|
+
children: [/* @__PURE__ */ jsx(ChartStyle, {
|
|
44
|
+
id: chartId,
|
|
45
|
+
config
|
|
46
|
+
}), /* @__PURE__ */ jsx(RechartsPrimitive.ResponsiveContainer, {
|
|
47
|
+
initialDimension,
|
|
48
|
+
children
|
|
49
|
+
})]
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Стили графика: CSS-переменные --color-<ключ> для светлой и тёмной темы
|
|
55
|
+
* @param props - id графика и настройки рядов
|
|
56
|
+
* @returns style или null, если цветов нет
|
|
57
|
+
*/
|
|
58
|
+
function ChartStyle({ id, config }) {
|
|
59
|
+
const colorConfig = [];
|
|
60
|
+
for (const entry of Object.entries(config)) if (entry[1].theme ?? entry[1].color) colorConfig.push(entry);
|
|
61
|
+
if (colorConfig.length === 0) return null;
|
|
62
|
+
const blocks = [];
|
|
63
|
+
for (const [theme, prefix] of Object.entries(THEMES)) {
|
|
64
|
+
const lines = [];
|
|
65
|
+
for (const [key, itemConfig] of colorConfig) {
|
|
66
|
+
const color = itemConfig.theme?.[theme] ?? itemConfig.color;
|
|
67
|
+
if (color) lines.push(` --color-${key}: ${color};`);
|
|
68
|
+
}
|
|
69
|
+
const body = lines.join("\n");
|
|
70
|
+
blocks.push(`${prefix} [data-chart=${id}] {\n${body}\n}`);
|
|
71
|
+
}
|
|
72
|
+
const html = { __html: blocks.join("\n") };
|
|
73
|
+
return /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: html });
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Подсказка графика: Tooltip из recharts. В content передайте ChartTooltipContent
|
|
77
|
+
*/
|
|
78
|
+
const ChartTooltip = RechartsPrimitive.Tooltip;
|
|
79
|
+
/**
|
|
80
|
+
* Найти настройки ряда по данным точки
|
|
81
|
+
* @param config - настройки рядов
|
|
82
|
+
* @param payload - данные точки из recharts
|
|
83
|
+
* @param key - ключ ряда или поля с его именем
|
|
84
|
+
* @returns настройки ряда или undefined
|
|
85
|
+
*/
|
|
86
|
+
function getPayloadConfig(config, payload, key) {
|
|
87
|
+
if (typeof payload !== "object" || payload === null) return;
|
|
88
|
+
const innerPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
|
|
89
|
+
const record = payload;
|
|
90
|
+
let configLabelKey = key;
|
|
91
|
+
if (typeof record[key] === "string") configLabelKey = record[key];
|
|
92
|
+
else if (innerPayload && typeof innerPayload[key] === "string") configLabelKey = innerPayload[key];
|
|
93
|
+
if (configLabelKey in config) return config[configLabelKey];
|
|
94
|
+
return config[key];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Содержимое подсказки: заголовок и значения рядов с цветными отметками. Числа — в формате ru-RU
|
|
98
|
+
* @param props - данные от recharts и настройки вида
|
|
99
|
+
* @returns div или null, если подсказка скрыта
|
|
100
|
+
*/
|
|
101
|
+
function ChartTooltipContent({ active, payload, className, indicator = "dot", hideLabel = false, hideIndicator = false, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey }) {
|
|
102
|
+
const { config } = useChart();
|
|
103
|
+
if (!active || !payload?.length) return null;
|
|
104
|
+
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
105
|
+
const labelClasses = cn("font-medium", labelClassName);
|
|
106
|
+
let tooltipLabel = null;
|
|
107
|
+
if (!hideLabel) {
|
|
108
|
+
const [item] = payload;
|
|
109
|
+
const itemConfig = getPayloadConfig(config, item, String(labelKey ?? item?.dataKey ?? item?.name ?? "value"));
|
|
110
|
+
const value = !labelKey && typeof label === "string" ? config[label]?.label ?? label : itemConfig?.label;
|
|
111
|
+
if (labelFormatter) tooltipLabel = /* @__PURE__ */ jsx("div", {
|
|
112
|
+
className: labelClasses,
|
|
113
|
+
children: labelFormatter(value, payload)
|
|
114
|
+
});
|
|
115
|
+
else if (value) tooltipLabel = /* @__PURE__ */ jsx("div", {
|
|
116
|
+
className: labelClasses,
|
|
117
|
+
children: value
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
const rows = [];
|
|
121
|
+
payload.forEach((item, index) => {
|
|
122
|
+
if (item.type === "none") return;
|
|
123
|
+
const key = String(nameKey ?? item.name ?? item.dataKey ?? "value");
|
|
124
|
+
const itemConfig = getPayloadConfig(config, item, key);
|
|
125
|
+
const indicatorColor = color ?? item.payload?.fill ?? item.color;
|
|
126
|
+
const rowClasses = cn("flex", "w-full", "flex-wrap", "items-stretch", "gap-2", "[&>svg]:h-2.5", "[&>svg]:w-2.5", "[&>svg]:text-muted-foreground", indicator === "dot" && "items-center");
|
|
127
|
+
if (formatter && item?.value !== void 0 && item.name) {
|
|
128
|
+
rows.push(/* @__PURE__ */ jsx("div", {
|
|
129
|
+
className: rowClasses,
|
|
130
|
+
children: formatter(item.value, item.name, item, index, item.payload)
|
|
131
|
+
}, index));
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const indicatorClasses = cn("shrink-0", "rounded-[2px]", "border-(--color-border)", "bg-(--color-bg)", {
|
|
135
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
136
|
+
"w-1": indicator === "line",
|
|
137
|
+
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
138
|
+
"my-0.5": nestLabel && indicator === "dashed"
|
|
139
|
+
});
|
|
140
|
+
const indicatorStyle = {
|
|
141
|
+
"--color-bg": indicatorColor,
|
|
142
|
+
"--color-border": indicatorColor
|
|
143
|
+
};
|
|
144
|
+
const valueAlign = nestLabel ? "items-end" : "items-center";
|
|
145
|
+
const formattedValue = typeof item.value === "number" ? formatNumber(item.value) : String(item.value);
|
|
146
|
+
const valueClasses = cn("flex", "flex-1", "justify-between", "gap-4", "leading-none", valueAlign);
|
|
147
|
+
let marker = null;
|
|
148
|
+
if (itemConfig?.icon) marker = /* @__PURE__ */ jsx(itemConfig.icon, {});
|
|
149
|
+
else if (!hideIndicator) marker = /* @__PURE__ */ jsx("div", {
|
|
150
|
+
className: indicatorClasses,
|
|
151
|
+
style: indicatorStyle
|
|
152
|
+
});
|
|
153
|
+
rows.push(/* @__PURE__ */ jsxs("div", {
|
|
154
|
+
className: rowClasses,
|
|
155
|
+
children: [marker, /* @__PURE__ */ jsxs("div", {
|
|
156
|
+
className: valueClasses,
|
|
157
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
158
|
+
className: "grid gap-1.5",
|
|
159
|
+
children: [nestLabel ? tooltipLabel : null, /* @__PURE__ */ jsx("span", {
|
|
160
|
+
className: "text-muted-foreground",
|
|
161
|
+
children: itemConfig?.label ?? item.name
|
|
162
|
+
})]
|
|
163
|
+
}), item.value != null && /* @__PURE__ */ jsx("span", {
|
|
164
|
+
className: "font-mono font-medium text-foreground tabular-nums",
|
|
165
|
+
children: formattedValue
|
|
166
|
+
})]
|
|
167
|
+
})]
|
|
168
|
+
}, index));
|
|
169
|
+
});
|
|
170
|
+
const classes = cn("grid", "min-w-32", "items-start", "gap-1.5", "rounded-lg", "border", "border-border/50", "bg-background", "px-2.5", "py-1.5", "text-xs", "shadow-xl", className);
|
|
171
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
172
|
+
className: classes,
|
|
173
|
+
children: [nestLabel ? null : tooltipLabel, /* @__PURE__ */ jsx("div", {
|
|
174
|
+
className: "grid gap-1.5",
|
|
175
|
+
children: rows
|
|
176
|
+
})]
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Легенда графика: Legend из recharts. В content передайте ChartLegendContent
|
|
181
|
+
*/
|
|
182
|
+
const ChartLegend = RechartsPrimitive.Legend;
|
|
183
|
+
/**
|
|
184
|
+
* Содержимое легенды: цветной квадрат или иконка и подпись каждого ряда
|
|
185
|
+
* @param props - данные от recharts и настройки вида
|
|
186
|
+
* @returns div или null, если рядов нет
|
|
187
|
+
*/
|
|
188
|
+
function ChartLegendContent({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }) {
|
|
189
|
+
const { config } = useChart();
|
|
190
|
+
if (!payload?.length) return null;
|
|
191
|
+
const items = [];
|
|
192
|
+
payload.forEach((item, index) => {
|
|
193
|
+
if (item.type === "none") return;
|
|
194
|
+
const key = String(nameKey ?? item.dataKey ?? "value");
|
|
195
|
+
const itemConfig = getPayloadConfig(config, item, key);
|
|
196
|
+
const markerStyle = { backgroundColor: item.color };
|
|
197
|
+
const marker = itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsx("div", {
|
|
198
|
+
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
199
|
+
style: markerStyle
|
|
200
|
+
});
|
|
201
|
+
items.push(/* @__PURE__ */ jsxs("div", {
|
|
202
|
+
className: "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground",
|
|
203
|
+
children: [marker, itemConfig?.label]
|
|
204
|
+
}, index));
|
|
205
|
+
});
|
|
206
|
+
const classes = cn("flex", "items-center", "justify-center", "gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className);
|
|
207
|
+
return /* @__PURE__ */ jsx("div", {
|
|
208
|
+
className: classes,
|
|
209
|
+
children: items
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ChartConfigT, ChartContainerPropsT, ChartIndicatorT, ChartLegendContentPropsT, ChartStylePropsT, ChartTooltipContentPropsT } from "./types.js";
|
|
2
|
+
import { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent } from "./chart.js";
|
|
3
|
+
export { type ChartConfigT, ChartContainer, type ChartContainerPropsT, type ChartIndicatorT, ChartLegend, ChartLegendContent, type ChartLegendContentPropsT, ChartStyle, type ChartStylePropsT, ChartTooltip, ChartTooltipContent, type ChartTooltipContentPropsT };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent } from "./chart.js";
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ComponentProps, ComponentType, ReactNode } from "react";
|
|
2
|
+
import * as RechartsPrimitive from "recharts";
|
|
3
|
+
import { TooltipValueType } from "recharts";
|
|
4
|
+
/** Темы и их селекторы: светлая — без селектора, тёмная — .dark */
|
|
5
|
+
export declare const THEMES: {
|
|
6
|
+
readonly light: "";
|
|
7
|
+
readonly dark: ".dark";
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Имя ряда в подсказке
|
|
11
|
+
*/
|
|
12
|
+
export type TooltipNameT = number | string;
|
|
13
|
+
/**
|
|
14
|
+
* Тема графика
|
|
15
|
+
*/
|
|
16
|
+
export type ChartThemeT = keyof typeof THEMES;
|
|
17
|
+
/**
|
|
18
|
+
* Настройки рядов графика: подпись, иконка и цвет каждого ряда по его ключу.
|
|
19
|
+
* Цвет попадает в CSS-переменную --color-<ключ>
|
|
20
|
+
*/
|
|
21
|
+
export type ChartConfigT = Record<string, {
|
|
22
|
+
/** Подпись ряда в подсказке и легенде */
|
|
23
|
+
label?: ReactNode;
|
|
24
|
+
/** Иконка вместо цветного квадрата */
|
|
25
|
+
icon?: ComponentType;
|
|
26
|
+
} & ({
|
|
27
|
+
/** Цвет ряда: var(--chart-1), oklch(…) */
|
|
28
|
+
color?: string;
|
|
29
|
+
/** Цвет для каждой темы — вместо color */
|
|
30
|
+
theme?: never;
|
|
31
|
+
} | {
|
|
32
|
+
/** Цвет ряда — вместо theme */
|
|
33
|
+
color?: never;
|
|
34
|
+
/** Цвет для каждой темы: { light, dark } */
|
|
35
|
+
theme: Record<ChartThemeT, string>;
|
|
36
|
+
})>;
|
|
37
|
+
/**
|
|
38
|
+
* Пропсы контейнера графика
|
|
39
|
+
*/
|
|
40
|
+
export type ChartContainerPropsT = Omit<ComponentProps<'div'>, 'children'> & {
|
|
41
|
+
/** Настройки рядов: подписи и цвета */
|
|
42
|
+
config: ChartConfigT;
|
|
43
|
+
/** График recharts: BarChart, LineChart, AreaChart, PieChart… */
|
|
44
|
+
children: ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];
|
|
45
|
+
/** Размер до первого замера контейнера, px. По умолчанию 320×200 */
|
|
46
|
+
initialDimension?: {
|
|
47
|
+
/** Ширина */
|
|
48
|
+
width: number;
|
|
49
|
+
/** Высота */
|
|
50
|
+
height: number;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Пропсы стилей графика
|
|
55
|
+
*/
|
|
56
|
+
export type ChartStylePropsT = {
|
|
57
|
+
/** id графика из data-chart */
|
|
58
|
+
id: string;
|
|
59
|
+
/** Настройки рядов */
|
|
60
|
+
config: ChartConfigT;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Вид отметки ряда в подсказке: dot — квадрат, line — полоса, dashed — пунктир
|
|
64
|
+
*/
|
|
65
|
+
export type ChartIndicatorT = 'line' | 'dot' | 'dashed';
|
|
66
|
+
/**
|
|
67
|
+
* Пропсы содержимого подсказки
|
|
68
|
+
*/
|
|
69
|
+
export type ChartTooltipContentPropsT = ComponentProps<typeof RechartsPrimitive.Tooltip> & ComponentProps<'div'> & Omit<RechartsPrimitive.DefaultTooltipContentProps<TooltipValueType, TooltipNameT>, 'accessibilityLayer'> & {
|
|
70
|
+
/** Скрыть заголовок подсказки */
|
|
71
|
+
hideLabel?: boolean;
|
|
72
|
+
/** Скрыть цветные отметки рядов */
|
|
73
|
+
hideIndicator?: boolean;
|
|
74
|
+
/** Вид отметки: dot, line или dashed. По умолчанию dot */
|
|
75
|
+
indicator?: ChartIndicatorT;
|
|
76
|
+
/** Поле данных с именем ряда — ключом в config */
|
|
77
|
+
nameKey?: string;
|
|
78
|
+
/** Поле данных с заголовком — ключом в config */
|
|
79
|
+
labelKey?: string;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Пропсы содержимого легенды
|
|
83
|
+
*/
|
|
84
|
+
export type ChartLegendContentPropsT = ComponentProps<'div'> & RechartsPrimitive.DefaultLegendContentProps & {
|
|
85
|
+
/** Скрыть иконки рядов из config */
|
|
86
|
+
hideIcon?: boolean;
|
|
87
|
+
/** Поле данных с именем ряда — ключом в config */
|
|
88
|
+
nameKey?: string;
|
|
89
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CheckboxPropsT } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Флажок: отметить или снять отметку
|
|
4
|
+
* @param props - пропсы флажка
|
|
5
|
+
* @returns элемент с role=checkbox
|
|
6
|
+
*/
|
|
7
|
+
export declare function Checkbox({ className, onCheckedChange, ...props }: CheckboxPropsT): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { CheckIcon, MinusIcon } from "lucide-react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Checkbox } from "@base-ui/react/checkbox";
|
|
6
|
+
// src/components/checkbox/checkbox.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Флажок: отметить или снять отметку
|
|
9
|
+
* @param props - пропсы флажка
|
|
10
|
+
* @returns элемент с role=checkbox
|
|
11
|
+
*/
|
|
12
|
+
function Checkbox$1({ className, onCheckedChange, ...props }) {
|
|
13
|
+
const classes = cn("peer", "relative", "flex", "size-4", "shrink-0", "items-center", "justify-center", "rounded-[4px]", "border", "border-input", "transition-colors", "outline-none", "group-has-disabled/field:opacity-50", "keyboard:group-has-[:focus-visible]/field-label:ring-0", "keyboard:group-has-[:focus-visible]/field-label:not-data-checked:border-input", "after:absolute", "after:-inset-x-3", "after:-inset-y-2", "focus-visible:border-ring", "focus-visible:ring-3", "focus-visible:ring-ring/50", "data-disabled:cursor-not-allowed", "data-disabled:opacity-50", "aria-invalid:border-destructive", "aria-invalid:ring-3", "aria-invalid:ring-destructive/20", "aria-invalid:aria-checked:border-primary", "aria-invalid:aria-[checked=mixed]:border-primary", "dark:bg-input/30", "dark:aria-invalid:border-destructive/50", "dark:aria-invalid:ring-destructive/40", "data-checked:border-primary", "data-checked:bg-primary", "data-checked:text-primary-foreground", "dark:data-checked:bg-primary", "keyboard:group-has-[:focus-visible]/field-label:data-checked:border-primary", "data-indeterminate:border-primary", "data-indeterminate:bg-primary", "data-indeterminate:text-primary-foreground", "dark:data-indeterminate:bg-primary", "keyboard:group-has-[:focus-visible]/field-label:data-indeterminate:border-primary", className);
|
|
14
|
+
/**
|
|
15
|
+
* Флажок переключили: наружу только состояние
|
|
16
|
+
* @param checked - отмечен ли
|
|
17
|
+
*/
|
|
18
|
+
const handleCheckedChange = (checked) => onCheckedChange?.(checked);
|
|
19
|
+
return /* @__PURE__ */ jsx(Checkbox.Root, {
|
|
20
|
+
"data-slot": "checkbox",
|
|
21
|
+
className: classes,
|
|
22
|
+
onCheckedChange: handleCheckedChange,
|
|
23
|
+
...props,
|
|
24
|
+
children: /* @__PURE__ */ jsxs(Checkbox.Indicator, {
|
|
25
|
+
"data-slot": "checkbox-indicator",
|
|
26
|
+
className: "group/checkbox-indicator grid place-content-center text-current transition-none [&>svg]:size-3.5",
|
|
27
|
+
children: [/* @__PURE__ */ jsx(CheckIcon, { className: "group-data-indeterminate/checkbox-indicator:hidden" }), /* @__PURE__ */ jsx(MinusIcon, { className: "hidden group-data-indeterminate/checkbox-indicator:block" })]
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export { Checkbox$1 as Checkbox };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Checkbox } from "./checkbox.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PartPropsT } from "../../lib/part-props.js";
|
|
2
|
+
import { Checkbox } from "@base-ui/react/checkbox";
|
|
3
|
+
/**
|
|
4
|
+
* Пропсы флажка
|
|
5
|
+
*/
|
|
6
|
+
export type CheckboxPropsT = PartPropsT<Omit<Checkbox.Root.Props, 'onCheckedChange' | 'children'>> & {
|
|
7
|
+
/** Отмечен ли флажок — контролируемый режим, вместе с onCheckedChange */
|
|
8
|
+
checked?: boolean;
|
|
9
|
+
/** Отмечен ли флажок при первом рендере — неконтролируемый режим */
|
|
10
|
+
defaultChecked?: boolean;
|
|
11
|
+
/** Частично отмечен: черта вместо галочки, например у «выбрать все», когда выбрана часть */
|
|
12
|
+
indeterminate?: boolean;
|
|
13
|
+
/** Флажок отметили или сняли: новое состояние */
|
|
14
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
15
|
+
/** Отключённое состояние: флажок не переключается */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/** Обязательное поле: форма не отправится, пока флажок не отмечен */
|
|
18
|
+
required?: boolean;
|
|
19
|
+
/** Имя поля при отправке формы */
|
|
20
|
+
name?: string;
|
|
21
|
+
/** Значение при отправке формы, по умолчанию on */
|
|
22
|
+
value?: string;
|
|
23
|
+
/** Ошибка: красная рамка и объявление скринридеру, что значение неверное */
|
|
24
|
+
'aria-invalid'?: boolean;
|
|
25
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { CodeBlockActionsPropsT, CodeBlockContentPropsT, CodeBlockCopyButtonPropsT, CodeBlockFooterPropsT, CodeBlockHeaderPropsT, CodeBlockLinePropsT, CodeBlockPropsT, CodeBlockTitlePropsT } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Блок кода: код или вывод терминала с шапкой и действиями
|
|
4
|
+
* @param props - пропсы блока
|
|
5
|
+
* @returns блок кода
|
|
6
|
+
*/
|
|
7
|
+
export declare function CodeBlock({ className, variant, size, ...props }: CodeBlockPropsT): import("react").JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* Шапка блока кода: заголовок и действия
|
|
10
|
+
* @param props - пропсы шапки
|
|
11
|
+
* @returns шапка
|
|
12
|
+
*/
|
|
13
|
+
export declare function CodeBlockHeader({ className, ...props }: CodeBlockHeaderPropsT): import("react").JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* Заголовок блока кода: имя файла, иконка
|
|
16
|
+
* @param props - пропсы заголовка
|
|
17
|
+
* @returns заголовок в одну строку
|
|
18
|
+
*/
|
|
19
|
+
export declare function CodeBlockTitle({ className, ...props }: CodeBlockTitlePropsT): import("react").JSX.Element;
|
|
20
|
+
/**
|
|
21
|
+
* Действия блока кода: в шапке — справа, прямо в блоке — плавают в углу и появляются при наведении
|
|
22
|
+
* @param props - пропсы действий
|
|
23
|
+
* @returns блок действий
|
|
24
|
+
*/
|
|
25
|
+
export declare function CodeBlockActions({ className, ...props }: CodeBlockActionsPropsT): import("react").JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* Кнопка копирования: копирует value и на 2 секунды показывает галочку
|
|
28
|
+
* @param props - пропсы кнопки
|
|
29
|
+
* @returns кнопка и объявление для скринридера
|
|
30
|
+
*/
|
|
31
|
+
export declare function CodeBlockCopyButton({ value, variant, size, copyLabel, copiedLabel, className, onClick, ...props }: CodeBlockCopyButtonPropsT): import("react").JSX.Element;
|
|
32
|
+
/**
|
|
33
|
+
* Содержимое блока кода: <pre> с прокруткой, фокусируется с клавиатуры для прокрутки стрелками
|
|
34
|
+
* @param props - пропсы содержимого
|
|
35
|
+
* @returns код
|
|
36
|
+
*/
|
|
37
|
+
export declare function CodeBlockContent({ className, children, style, wrap, lineNumbers, startLine, ...props }: CodeBlockContentPropsT): import("react").JSX.Element;
|
|
38
|
+
/**
|
|
39
|
+
* Строка кода: номер строки и отметка изменения рисуются псевдоэлементами
|
|
40
|
+
* @param props - пропсы строки
|
|
41
|
+
* @returns строка
|
|
42
|
+
*/
|
|
43
|
+
export declare function CodeBlockLine({ className, variant, children, ...props }: CodeBlockLinePropsT): import("react").JSX.Element;
|
|
44
|
+
/**
|
|
45
|
+
* Подвал блока кода: кнопка «Показать полностью», подпись
|
|
46
|
+
* @param props - пропсы подвала
|
|
47
|
+
* @returns подвал
|
|
48
|
+
*/
|
|
49
|
+
export declare function CodeBlockFooter({ className, ...props }: CodeBlockFooterPropsT): import("react").JSX.Element;
|
|
@@ -0,0 +1,188 @@
|
|
|
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 { codeBlockLineVariants, codeBlockVariants } from "./types.js";
|
|
6
|
+
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { useEffect, useState } from "react";
|
|
9
|
+
// src/components/code-block/code-block.tsx
|
|
10
|
+
/** Сколько миллисекунд показывать отметку «Скопировано» */
|
|
11
|
+
const COPIED_TIMEOUT = 2e3;
|
|
12
|
+
/**
|
|
13
|
+
* Блок кода: код или вывод терминала с шапкой и действиями
|
|
14
|
+
* @param props - пропсы блока
|
|
15
|
+
* @returns блок кода
|
|
16
|
+
*/
|
|
17
|
+
function CodeBlock({ className, variant = "default", size = "default", ...props }) {
|
|
18
|
+
const classes = cn(codeBlockVariants({ variant }), className);
|
|
19
|
+
return /* @__PURE__ */ jsx("div", {
|
|
20
|
+
"data-slot": "code-block",
|
|
21
|
+
"data-variant": variant,
|
|
22
|
+
"data-size": size,
|
|
23
|
+
className: classes,
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Шапка блока кода: заголовок и действия
|
|
29
|
+
* @param props - пропсы шапки
|
|
30
|
+
* @returns шапка
|
|
31
|
+
*/
|
|
32
|
+
function CodeBlockHeader({ className, ...props }) {
|
|
33
|
+
const classes = cn("flex", "min-w-0", "shrink-0", "items-center", "gap-2", "px-3", "pt-3", "text-muted-foreground", "*:has-[>[data-slot=code-block-title]]:min-w-0", "group-data-[variant=destructive]/code-block:text-destructive", "group-data-[size=sm]/code-block:px-2.5", "group-data-[size=sm]/code-block:pt-2.5", className);
|
|
34
|
+
return /* @__PURE__ */ jsx("div", {
|
|
35
|
+
"data-slot": "code-block-header",
|
|
36
|
+
className: classes,
|
|
37
|
+
...props
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Заголовок блока кода: имя файла, иконка
|
|
42
|
+
* @param props - пропсы заголовка
|
|
43
|
+
* @returns заголовок в одну строку
|
|
44
|
+
*/
|
|
45
|
+
function CodeBlockTitle({ className, ...props }) {
|
|
46
|
+
const classes = cn("min-w-0", "truncate", "font-sans", "text-sm", "font-medium", "text-foreground", "group-data-[variant=destructive]/code-block:text-destructive", "group-data-[size=sm]/code-block:text-xs", "[&_svg]:pointer-events-none", "[&_svg]:inline-block", "[&_svg]:align-middle", "*:[svg]:me-1.5", "[&_svg:not([class*=size-])]:size-3.5", className);
|
|
47
|
+
return /* @__PURE__ */ jsx("div", {
|
|
48
|
+
"data-slot": "code-block-title",
|
|
49
|
+
className: classes,
|
|
50
|
+
...props
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Действия блока кода: в шапке — справа, прямо в блоке — плавают в углу и появляются при наведении
|
|
55
|
+
* @param props - пропсы действий
|
|
56
|
+
* @returns блок действий
|
|
57
|
+
*/
|
|
58
|
+
function CodeBlockActions({ className, ...props }) {
|
|
59
|
+
const classes = cn("ms-auto", "-my-1", "-me-1.5", "flex", "shrink-0", "items-center", "gap-1", "[[data-slot=code-block]>&]:absolute", "[[data-slot=code-block]>&]:end-2", "[[data-slot=code-block]>&]:top-2", "[[data-slot=code-block]>&]:z-10", "[[data-slot=code-block]>&]:m-0", "[[data-slot=code-block]>&]:opacity-0", "[[data-slot=code-block]>&]:transition-opacity", "[[data-slot=code-block]>&]:group-focus-within/code-block:opacity-100", "[[data-slot=code-block]>&]:group-hover/code-block:opacity-100", "[[data-slot=code-block]>&]:pointer-coarse:opacity-100", "group-data-[size=sm]/code-block:[[data-slot=code-block]>&]:end-1.5", "group-data-[size=sm]/code-block:[[data-slot=code-block]>&]:top-1.5", "[[data-slot=code-block]>&]:*:[button]:bg-background", "[[data-slot=code-block]>&]:*:[button]:ring-1", "[[data-slot=code-block]>&]:*:[button]:ring-foreground/10", className);
|
|
60
|
+
return /* @__PURE__ */ jsx("div", {
|
|
61
|
+
"data-slot": "code-block-actions",
|
|
62
|
+
className: classes,
|
|
63
|
+
...props
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Кнопка копирования: копирует value и на 2 секунды показывает галочку
|
|
68
|
+
* @param props - пропсы кнопки
|
|
69
|
+
* @returns кнопка и объявление для скринридера
|
|
70
|
+
*/
|
|
71
|
+
function CodeBlockCopyButton({ value, variant = "ghost", size = "icon-xs", copyLabel = texts.copy, copiedLabel = texts.copied, className, onClick, ...props }) {
|
|
72
|
+
const [isCopied, setCopied] = useState(false);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (!isCopied) return;
|
|
75
|
+
const timeout = setTimeout(() => setCopied(false), COPIED_TIMEOUT);
|
|
76
|
+
return () => clearTimeout(timeout);
|
|
77
|
+
}, [isCopied]);
|
|
78
|
+
/**
|
|
79
|
+
* Нажатие: вызвать onClick и скопировать значение
|
|
80
|
+
* @param event - событие нажатия
|
|
81
|
+
*/
|
|
82
|
+
const copyValue = (event) => {
|
|
83
|
+
onClick?.(event);
|
|
84
|
+
navigator.clipboard.writeText(value).then(() => setCopied(true)).catch(() => void 0);
|
|
85
|
+
};
|
|
86
|
+
const label = isCopied ? copiedLabel : copyLabel;
|
|
87
|
+
const announcement = isCopied ? copiedLabel : "";
|
|
88
|
+
const icon = isCopied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {});
|
|
89
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Button, {
|
|
90
|
+
"data-slot": "code-block-copy-button",
|
|
91
|
+
"data-copied": isCopied || void 0,
|
|
92
|
+
variant,
|
|
93
|
+
size,
|
|
94
|
+
"aria-label": label,
|
|
95
|
+
className,
|
|
96
|
+
onClick: copyValue,
|
|
97
|
+
...props,
|
|
98
|
+
children: icon
|
|
99
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
100
|
+
"aria-live": "polite",
|
|
101
|
+
className: "sr-only",
|
|
102
|
+
children: announcement
|
|
103
|
+
})] });
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Пустая ли строка: пустая строка хранит перевод строки, чтобы при копировании выделения
|
|
107
|
+
* пустые строки не терялись
|
|
108
|
+
* @param children - содержимое строки
|
|
109
|
+
* @returns true, если содержимого нет
|
|
110
|
+
*/
|
|
111
|
+
function isEmptyLine(children) {
|
|
112
|
+
if (children === void 0 || children === null || children === "") return true;
|
|
113
|
+
return Array.isArray(children) && children.length === 0;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Разбить текст на строки кода, чтобы показать номера строк
|
|
117
|
+
* @param text - код
|
|
118
|
+
* @returns строки
|
|
119
|
+
*/
|
|
120
|
+
function splitLines(text) {
|
|
121
|
+
const lines = [];
|
|
122
|
+
text.replace(/\n$/, "").split("\n").forEach((row, index) => {
|
|
123
|
+
lines.push(/* @__PURE__ */ jsx(CodeBlockLine, { children: row }, index));
|
|
124
|
+
});
|
|
125
|
+
return lines;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Содержимое блока кода: <pre> с прокруткой, фокусируется с клавиатуры для прокрутки стрелками
|
|
129
|
+
* @param props - пропсы содержимого
|
|
130
|
+
* @returns код
|
|
131
|
+
*/
|
|
132
|
+
function CodeBlockContent({ className, children, style, wrap = false, lineNumbers = false, startLine = 1, ...props }) {
|
|
133
|
+
const classes = cn("min-h-0", "min-w-0", "overflow-auto", "px-3", "py-3", "text-start", "font-mono", "leading-relaxed", "outline-none", "scroll-fade-x", "[scrollbar-width:thin]", "data-wrap:scroll-fade-y", "data-wrap:wrap-break-word", "data-wrap:whitespace-pre-wrap", "group-has-data-[slot=code-block-header]/code-block:pt-2", "group-has-data-[slot=code-block-footer]/code-block:pb-2", "group-data-[size=sm]/code-block:px-2.5", "group-data-[size=sm]/code-block:py-2.5", "group-data-[size=sm]/code-block:group-has-data-[slot=code-block-header]/code-block:pt-1.5", className);
|
|
134
|
+
const codeClasses = cn("grid", "min-h-lh", "min-w-max", "content-start", "in-data-numbered:grid-cols-[auto_1fr]", "in-data-wrap:min-w-0");
|
|
135
|
+
const counterReset = `line ${startLine - 1}`;
|
|
136
|
+
const content = lineNumbers && typeof children === "string" ? splitLines(children) : children;
|
|
137
|
+
return /* @__PURE__ */ jsx("pre", {
|
|
138
|
+
"data-slot": "code-block-content",
|
|
139
|
+
"data-wrap": wrap || void 0,
|
|
140
|
+
"data-numbered": lineNumbers || void 0,
|
|
141
|
+
tabIndex: 0,
|
|
142
|
+
style: {
|
|
143
|
+
counterReset,
|
|
144
|
+
...style
|
|
145
|
+
},
|
|
146
|
+
className: classes,
|
|
147
|
+
...props,
|
|
148
|
+
children: /* @__PURE__ */ jsx("code", {
|
|
149
|
+
"data-slot": "code-block-code",
|
|
150
|
+
className: codeClasses,
|
|
151
|
+
children: content
|
|
152
|
+
})
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Строка кода: номер строки и отметка изменения рисуются псевдоэлементами
|
|
157
|
+
* @param props - пропсы строки
|
|
158
|
+
* @returns строка
|
|
159
|
+
*/
|
|
160
|
+
function CodeBlockLine({ className, variant = "default", children, ...props }) {
|
|
161
|
+
const classes = cn(codeBlockLineVariants({ variant }), className);
|
|
162
|
+
const content = isEmptyLine(children) ? "\n" : children;
|
|
163
|
+
return /* @__PURE__ */ jsx("span", {
|
|
164
|
+
"data-slot": "code-block-line",
|
|
165
|
+
"data-variant": variant,
|
|
166
|
+
className: classes,
|
|
167
|
+
...props,
|
|
168
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
169
|
+
"data-slot": "code-block-line-content",
|
|
170
|
+
className: "min-w-0",
|
|
171
|
+
children: content
|
|
172
|
+
})
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Подвал блока кода: кнопка «Показать полностью», подпись
|
|
177
|
+
* @param props - пропсы подвала
|
|
178
|
+
* @returns подвал
|
|
179
|
+
*/
|
|
180
|
+
function CodeBlockFooter({ className, ...props }) {
|
|
181
|
+
const classes = cn("flex", "min-w-0", "shrink-0", "items-center", "gap-2", "px-3", "pb-3", "text-muted-foreground", "group-data-[size=sm]/code-block:px-2.5", "group-data-[size=sm]/code-block:pb-2.5", className);
|
|
182
|
+
return /* @__PURE__ */ jsx("div", {
|
|
183
|
+
"data-slot": "code-block-footer",
|
|
184
|
+
className: classes,
|
|
185
|
+
...props
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
export { CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockTitle };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CodeHighlighterI } from "./types.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Загрузить язык и вернуть подсветку для него
|
|
5
|
+
* @param language - имя языка: ts, tsx, json, bash, ansi…
|
|
6
|
+
* @returns подсветка или null для языка не из списка
|
|
7
|
+
*/
|
|
8
|
+
export declare function loadHighlighter(language: string): Promise<CodeHighlighterI | null>;
|
|
9
|
+
/**
|
|
10
|
+
* Подсветить код целиком
|
|
11
|
+
* @param code - код
|
|
12
|
+
* @param language - имя языка
|
|
13
|
+
* @returns по узлу React на строку или null для языка не из списка
|
|
14
|
+
*/
|
|
15
|
+
export declare function highlightCode(code: string, language: string): Promise<ReactNode[] | null>;
|