@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,173 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { Separator } from "../separator/separator.js";
|
|
4
|
+
import { Label } from "../label/label.js";
|
|
5
|
+
import { fieldVariants } from "./types.js";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/components/field/field.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Набор полей: fieldset с заголовком FieldLegend
|
|
10
|
+
* @param props - пропсы набора
|
|
11
|
+
* @returns fieldset
|
|
12
|
+
*/
|
|
13
|
+
function FieldSet({ className, ...props }) {
|
|
14
|
+
const classes = cn("flex", "flex-col", "gap-4", "has-[>[data-slot=checkbox-group]]:gap-3", "has-[>[data-slot=radio-group]]:gap-3", className);
|
|
15
|
+
return /* @__PURE__ */ jsx("fieldset", {
|
|
16
|
+
"data-slot": "field-set",
|
|
17
|
+
className: classes,
|
|
18
|
+
...props
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Заголовок набора полей
|
|
23
|
+
* @param props - пропсы заголовка
|
|
24
|
+
* @returns legend
|
|
25
|
+
*/
|
|
26
|
+
function FieldLegend({ className, variant = "legend", ...props }) {
|
|
27
|
+
const classes = cn("mb-1.5", "font-medium", "data-[variant=label]:text-sm", "data-[variant=legend]:text-base", className);
|
|
28
|
+
return /* @__PURE__ */ jsx("legend", {
|
|
29
|
+
"data-slot": "field-legend",
|
|
30
|
+
"data-variant": variant,
|
|
31
|
+
className: classes,
|
|
32
|
+
...props
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Группа полей: столбик полей с отступами; контейнер для orientation="responsive"
|
|
37
|
+
* @param props - пропсы группы
|
|
38
|
+
* @returns div
|
|
39
|
+
*/
|
|
40
|
+
function FieldGroup({ className, ...props }) {
|
|
41
|
+
const classes = cn("group/field-group", "@container/field-group", "flex", "w-full", "flex-col", "gap-5", "data-[slot=checkbox-group]:gap-3", "*:data-[slot=field-group]:gap-4", className);
|
|
42
|
+
return /* @__PURE__ */ jsx("div", {
|
|
43
|
+
"data-slot": "field-group",
|
|
44
|
+
className: classes,
|
|
45
|
+
...props
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Поле формы: подпись, элемент управления, описание и ошибка.
|
|
50
|
+
* data-invalid={true} красит поле в цвет ошибки, data-disabled={true} приглушает подпись
|
|
51
|
+
* @param props - пропсы поля
|
|
52
|
+
* @returns div с role="group"
|
|
53
|
+
*/
|
|
54
|
+
function Field({ className, orientation = "vertical", ...props }) {
|
|
55
|
+
const classes = cn(fieldVariants({ orientation }), className);
|
|
56
|
+
return /* @__PURE__ */ jsx("div", {
|
|
57
|
+
role: "group",
|
|
58
|
+
"data-slot": "field",
|
|
59
|
+
"data-orientation": orientation,
|
|
60
|
+
className: classes,
|
|
61
|
+
...props
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Содержимое поля: подпись и описание столбиком рядом с флажком или переключателем
|
|
66
|
+
* @param props - пропсы содержимого
|
|
67
|
+
* @returns div
|
|
68
|
+
*/
|
|
69
|
+
function FieldContent({ className, ...props }) {
|
|
70
|
+
const classes = cn("group/field-content", "flex", "flex-1", "flex-col", "gap-0.5", "leading-snug", className);
|
|
71
|
+
return /* @__PURE__ */ jsx("div", {
|
|
72
|
+
"data-slot": "field-content",
|
|
73
|
+
className: classes,
|
|
74
|
+
...props
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Подпись поля. С Field внутри становится карточкой выбора
|
|
79
|
+
* @param props - пропсы подписи
|
|
80
|
+
* @returns label
|
|
81
|
+
*/
|
|
82
|
+
function FieldLabel({ className, ...props }) {
|
|
83
|
+
const classes = cn("group/field-label", "peer/field-label", "flex", "w-fit", "gap-2", "leading-snug", "group-data-[disabled=true]/field:opacity-50", "has-data-checked:border-primary/30", "has-data-checked:bg-primary/5", "dark:has-data-checked:border-primary/20", "dark:has-data-checked:bg-primary/10", "has-[>[data-slot=field]]:w-full", "has-[>[data-slot=field]]:flex-col", "has-[>[data-slot=field]]:rounded-lg", "has-[>[data-slot=field]]:border", "has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50", "keyboard:has-[>[data-slot=field]]:has-[:focus-visible]:border-ring", "keyboard:has-[>[data-slot=field]]:has-[:focus-visible]:ring-3", "keyboard:has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50", "*:data-[slot=field]:p-2.5", className);
|
|
84
|
+
return /* @__PURE__ */ jsx(Label, {
|
|
85
|
+
"data-slot": "field-label",
|
|
86
|
+
className: classes,
|
|
87
|
+
...props
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Заголовок поля: как подпись, но не label — для карточек выбора
|
|
92
|
+
* @param props - пропсы заголовка
|
|
93
|
+
* @returns div
|
|
94
|
+
*/
|
|
95
|
+
function FieldTitle({ className, ...props }) {
|
|
96
|
+
const classes = cn("flex", "w-fit", "items-center", "gap-2", "text-sm", "leading-snug", "font-medium", "group-data-[disabled=true]/field:opacity-50", className);
|
|
97
|
+
return /* @__PURE__ */ jsx("div", {
|
|
98
|
+
"data-slot": "field-label",
|
|
99
|
+
className: classes,
|
|
100
|
+
...props
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Описание поля: подсказка серым текстом
|
|
105
|
+
* @param props - пропсы описания
|
|
106
|
+
* @returns p
|
|
107
|
+
*/
|
|
108
|
+
function FieldDescription({ className, ...props }) {
|
|
109
|
+
const classes = cn("text-left", "text-sm", "leading-normal", "font-normal", "text-muted-foreground", "group-has-data-horizontal/field:text-balance", "last:mt-0", "nth-last-2:-mt-1", "[[data-variant=legend]+&]:-mt-1.5", "[&>a]:underline", "[&>a]:underline-offset-4", "[&>a:hover]:text-primary", className);
|
|
110
|
+
return /* @__PURE__ */ jsx("p", {
|
|
111
|
+
"data-slot": "field-description",
|
|
112
|
+
className: classes,
|
|
113
|
+
...props
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Разделитель полей: линия, при необходимости с текстом посередине
|
|
118
|
+
* @param props - пропсы разделителя
|
|
119
|
+
* @returns div
|
|
120
|
+
*/
|
|
121
|
+
function FieldSeparator({ children, className, ...props }) {
|
|
122
|
+
const classes = cn("relative", "-my-2", "flex", "h-5", "items-center", "gap-2", "text-sm", "group-data-[variant=outline]/field-group:-mb-2", className);
|
|
123
|
+
let content = null;
|
|
124
|
+
if (children) content = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
125
|
+
"data-slot": "field-separator-content",
|
|
126
|
+
className: "shrink-0 text-muted-foreground",
|
|
127
|
+
children
|
|
128
|
+
}), /* @__PURE__ */ jsx(Separator, { className: "flex-1" })] });
|
|
129
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
130
|
+
"data-slot": "field-separator",
|
|
131
|
+
"data-content": Boolean(children),
|
|
132
|
+
className: classes,
|
|
133
|
+
...props,
|
|
134
|
+
children: [/* @__PURE__ */ jsx(Separator, { className: "flex-1" }), content]
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Собрать содержимое ошибки: свой текст или уникальные сообщения из errors
|
|
139
|
+
* @param children - свой текст ошибки
|
|
140
|
+
* @param errors - ошибки валидации
|
|
141
|
+
* @returns содержимое или null, если показывать нечего
|
|
142
|
+
*/
|
|
143
|
+
function getErrorContent(children, errors) {
|
|
144
|
+
if (children) return children;
|
|
145
|
+
if (!errors?.length) return null;
|
|
146
|
+
const messages = /* @__PURE__ */ new Set();
|
|
147
|
+
for (const error of errors) if (error?.message) messages.add(error.message);
|
|
148
|
+
if (messages.size === 0) return null;
|
|
149
|
+
const list = [...messages];
|
|
150
|
+
if (list.length === 1) return list[0];
|
|
151
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
152
|
+
className: "ml-4 flex list-disc flex-col gap-1",
|
|
153
|
+
children: list.map((message) => /* @__PURE__ */ jsx("li", { children: message }, message))
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Ошибка поля: красный текст под элементом управления, озвучивается сразу
|
|
158
|
+
* @param props - пропсы ошибки
|
|
159
|
+
* @returns div с role="alert" или null, если ошибок нет
|
|
160
|
+
*/
|
|
161
|
+
function FieldError({ className, children, errors, ...props }) {
|
|
162
|
+
const content = getErrorContent(children, errors);
|
|
163
|
+
const classes = cn("text-sm", "font-normal", "text-destructive", className);
|
|
164
|
+
if (content === null) return null;
|
|
165
|
+
return /* @__PURE__ */ jsx("div", {
|
|
166
|
+
role: "alert",
|
|
167
|
+
"data-slot": "field-error",
|
|
168
|
+
className: classes,
|
|
169
|
+
...props,
|
|
170
|
+
children: content
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { FieldContentPropsT, FieldDescriptionPropsT, FieldErrorItemI, FieldErrorPropsT, FieldGroupPropsT, FieldLabelPropsT, FieldLegendPropsT, FieldLegendVariantT, FieldOrientationT, FieldPropsT, FieldSeparatorPropsT, FieldSetPropsT, FieldTitlePropsT, fieldVariants } from "./types.js";
|
|
2
|
+
import { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle } from "./field.js";
|
|
3
|
+
export { Field, FieldContent, type FieldContentPropsT, FieldDescription, type FieldDescriptionPropsT, FieldError, type FieldErrorItemI, type FieldErrorPropsT, FieldGroup, type FieldGroupPropsT, FieldLabel, type FieldLabelPropsT, FieldLegend, type FieldLegendPropsT, type FieldLegendVariantT, type FieldOrientationT, type FieldPropsT, FieldSeparator, type FieldSeparatorPropsT, FieldSet, type FieldSetPropsT, FieldTitle, type FieldTitlePropsT, fieldVariants };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { fieldVariants } from "./types.js";
|
|
2
|
+
import { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle } from "./field.js";
|
|
3
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, fieldVariants };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { LabelPropsT } from "../label/types.js";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import { ComponentProps, ReactNode } from "react";
|
|
4
|
+
/**
|
|
5
|
+
* Стили поля: расположение подписи и элемента управления.
|
|
6
|
+
* Экспортируются, чтобы оформить полем другой элемент: fieldVariants({ orientation: 'horizontal' }).
|
|
7
|
+
*/
|
|
8
|
+
export declare const fieldVariants: (props?: ({
|
|
9
|
+
orientation?: "vertical" | "horizontal" | "responsive" | null | undefined;
|
|
10
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Варианты стилей поля
|
|
13
|
+
*/
|
|
14
|
+
export type FieldVariantsT = VariantProps<typeof fieldVariants>;
|
|
15
|
+
/**
|
|
16
|
+
* Расположение поля: vertical — подпись сверху, horizontal — в строку, responsive — в строку на широкой группе
|
|
17
|
+
*/
|
|
18
|
+
export type FieldOrientationT = NonNullable<FieldVariantsT['orientation']>;
|
|
19
|
+
/**
|
|
20
|
+
* Пропсы набора полей
|
|
21
|
+
*/
|
|
22
|
+
export type FieldSetPropsT = ComponentProps<'fieldset'>;
|
|
23
|
+
/**
|
|
24
|
+
* Вид заголовка набора: legend — крупный, label — как подпись поля
|
|
25
|
+
*/
|
|
26
|
+
export type FieldLegendVariantT = 'legend' | 'label';
|
|
27
|
+
/**
|
|
28
|
+
* Пропсы заголовка набора
|
|
29
|
+
*/
|
|
30
|
+
export type FieldLegendPropsT = ComponentProps<'legend'> & {
|
|
31
|
+
/** Вид: legend — крупный заголовок, label — как подпись поля */
|
|
32
|
+
variant?: FieldLegendVariantT;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Пропсы группы полей
|
|
36
|
+
*/
|
|
37
|
+
export type FieldGroupPropsT = ComponentProps<'div'>;
|
|
38
|
+
/**
|
|
39
|
+
* Пропсы поля
|
|
40
|
+
*/
|
|
41
|
+
export type FieldPropsT = ComponentProps<'div'> & {
|
|
42
|
+
/** Расположение: vertical — подпись сверху, horizontal — в строку, responsive — в строку на широкой группе */
|
|
43
|
+
orientation?: FieldOrientationT;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Пропсы содержимого поля
|
|
47
|
+
*/
|
|
48
|
+
export type FieldContentPropsT = ComponentProps<'div'>;
|
|
49
|
+
/**
|
|
50
|
+
* Пропсы подписи поля
|
|
51
|
+
*/
|
|
52
|
+
export type FieldLabelPropsT = LabelPropsT;
|
|
53
|
+
/**
|
|
54
|
+
* Пропсы заголовка поля
|
|
55
|
+
*/
|
|
56
|
+
export type FieldTitlePropsT = ComponentProps<'div'>;
|
|
57
|
+
/**
|
|
58
|
+
* Пропсы описания поля
|
|
59
|
+
*/
|
|
60
|
+
export type FieldDescriptionPropsT = ComponentProps<'p'>;
|
|
61
|
+
/**
|
|
62
|
+
* Пропсы разделителя полей
|
|
63
|
+
*/
|
|
64
|
+
export type FieldSeparatorPropsT = ComponentProps<'div'> & {
|
|
65
|
+
/** Текст посередине линии, например «или» */
|
|
66
|
+
children?: ReactNode;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Ошибка валидации
|
|
70
|
+
* @property message - текст ошибки
|
|
71
|
+
*/
|
|
72
|
+
export interface FieldErrorItemI {
|
|
73
|
+
message?: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Пропсы ошибки поля
|
|
77
|
+
*/
|
|
78
|
+
export type FieldErrorPropsT = ComponentProps<'div'> & {
|
|
79
|
+
/** Ошибки валидации (например, из react-hook-form): одна — текстом, несколько — списком */
|
|
80
|
+
errors?: (FieldErrorItemI | undefined)[];
|
|
81
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
// src/components/field/types.ts
|
|
3
|
+
/**
|
|
4
|
+
* Стили поля: расположение подписи и элемента управления.
|
|
5
|
+
* Экспортируются, чтобы оформить полем другой элемент: fieldVariants({ orientation: 'horizontal' }).
|
|
6
|
+
*/
|
|
7
|
+
const fieldVariants = cva("group/field flex w-full gap-2 data-[invalid=true]:text-destructive", {
|
|
8
|
+
variants: { orientation: {
|
|
9
|
+
vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
|
|
10
|
+
horizontal: ["flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto", "has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"],
|
|
11
|
+
responsive: [
|
|
12
|
+
"flex-col *:w-full [&>.sr-only]:w-auto",
|
|
13
|
+
"@md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto",
|
|
14
|
+
"@md/field-group:has-[>[data-slot=field-content]]:items-start",
|
|
15
|
+
"@md/field-group:*:data-[slot=field-label]:flex-auto",
|
|
16
|
+
"@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
17
|
+
]
|
|
18
|
+
} },
|
|
19
|
+
defaultVariants: { orientation: "vertical" }
|
|
20
|
+
});
|
|
21
|
+
export { fieldVariants };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { FormControlPropsT, FormDescriptionPropsT, FormFieldPropsT, FormFieldStateI, FormItemPropsT, FormLabelPropsT, FormMessagePropsT, FormPropsT } from "./types.js";
|
|
2
|
+
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
|
+
/**
|
|
4
|
+
* Форма: передаёт результат useForm() всем полям внутри. Сам тег form пишется внутри
|
|
5
|
+
* @param props - результат useForm() и children
|
|
6
|
+
* @returns провайдер без своей разметки
|
|
7
|
+
*/
|
|
8
|
+
export declare function Form<TFieldValues extends FieldValues, TContext = unknown, TTransformedValues = TFieldValues>(props: FormPropsT<TFieldValues, TContext, TTransformedValues>): import("react").JSX.Element;
|
|
9
|
+
/**
|
|
10
|
+
* Поле формы: связывает значение из формы с элементом управления в render
|
|
11
|
+
* @param props - name, control и render, как у Controller
|
|
12
|
+
* @returns Controller
|
|
13
|
+
*/
|
|
14
|
+
export declare function FormField<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TTransformedValues = TFieldValues>(props: FormFieldPropsT<TFieldValues, TName, TTransformedValues>): import("react").JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* Состояние текущего поля: ошибка и id частей. Работает внутри FormField и FormItem
|
|
17
|
+
* @returns состояние поля
|
|
18
|
+
*/
|
|
19
|
+
export declare function useFormField(): FormFieldStateI;
|
|
20
|
+
/**
|
|
21
|
+
* Блок поля: подпись, элемент, описание и ошибка. При ошибке подсвечивается
|
|
22
|
+
* @param props - пропсы Field; orientation — vertical, horizontal или responsive
|
|
23
|
+
* @returns div с role="group"
|
|
24
|
+
*/
|
|
25
|
+
export declare function FormItem(props: FormItemPropsT): import("react").JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* Подпись поля: связана с элементом, при ошибке красная
|
|
28
|
+
* @param props - пропсы подписи
|
|
29
|
+
* @returns label
|
|
30
|
+
*/
|
|
31
|
+
export declare function FormLabel(props: FormLabelPropsT): import("react").JSX.Element;
|
|
32
|
+
/**
|
|
33
|
+
* Обёртка элемента управления: передаёт ему id, aria-invalid и aria-describedby
|
|
34
|
+
* @param props - пропсы; внутрь кладётся один элемент: Input, SelectTrigger, Checkbox (или он в render)
|
|
35
|
+
* @returns дочерний элемент с атрибутами
|
|
36
|
+
*/
|
|
37
|
+
export declare function FormControl({ children, render, ...props }: FormControlPropsT): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
38
|
+
/**
|
|
39
|
+
* Описание поля: подсказка под элементом
|
|
40
|
+
* @param props - пропсы описания
|
|
41
|
+
* @returns p
|
|
42
|
+
*/
|
|
43
|
+
export declare function FormDescription(props: FormDescriptionPropsT): import("react").JSX.Element;
|
|
44
|
+
/**
|
|
45
|
+
* Ошибка поля: текст ошибки проверки, а без ошибки — children
|
|
46
|
+
* @param props - пропсы ошибки
|
|
47
|
+
* @returns div с role="alert" или null
|
|
48
|
+
*/
|
|
49
|
+
export declare function FormMessage({ children, ...props }: FormMessagePropsT): import("react").JSX.Element;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Field, FieldDescription, FieldError, FieldLabel } from "../field/field.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
5
|
+
import { createContext, isValidElement, useContext, useId } from "react";
|
|
6
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
7
|
+
import { Controller, FormProvider, useFormContext, useFormState } from "react-hook-form";
|
|
8
|
+
// src/components/form/form.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Форма: передаёт результат useForm() всем полям внутри. Сам тег form пишется внутри
|
|
11
|
+
* @param props - результат useForm() и children
|
|
12
|
+
* @returns провайдер без своей разметки
|
|
13
|
+
*/
|
|
14
|
+
function Form(props) {
|
|
15
|
+
return /* @__PURE__ */ jsx(FormProvider, { ...props });
|
|
16
|
+
}
|
|
17
|
+
/** Имя текущего поля */
|
|
18
|
+
const FormFieldContext = createContext(null);
|
|
19
|
+
/**
|
|
20
|
+
* Поле формы: связывает значение из формы с элементом управления в render
|
|
21
|
+
* @param props - name, control и render, как у Controller
|
|
22
|
+
* @returns Controller
|
|
23
|
+
*/
|
|
24
|
+
function FormField(props) {
|
|
25
|
+
const context = { name: props.name };
|
|
26
|
+
return /* @__PURE__ */ jsx(FormFieldContext.Provider, {
|
|
27
|
+
value: context,
|
|
28
|
+
children: /* @__PURE__ */ jsx(Controller, { ...props })
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/** id текущего блока поля */
|
|
32
|
+
const FormItemContext = createContext(null);
|
|
33
|
+
/**
|
|
34
|
+
* Состояние текущего поля: ошибка и id частей. Работает внутри FormField и FormItem
|
|
35
|
+
* @returns состояние поля
|
|
36
|
+
*/
|
|
37
|
+
function useFormField() {
|
|
38
|
+
const fieldContext = useContext(FormFieldContext);
|
|
39
|
+
const itemContext = useContext(FormItemContext);
|
|
40
|
+
const { getFieldState } = useFormContext();
|
|
41
|
+
const formState = useFormState({ name: fieldContext?.name });
|
|
42
|
+
if (!fieldContext || !itemContext) throw new Error("useFormField работает только внутри FormField и FormItem");
|
|
43
|
+
const fieldState = getFieldState(fieldContext.name, formState);
|
|
44
|
+
const { id } = itemContext;
|
|
45
|
+
return {
|
|
46
|
+
id,
|
|
47
|
+
name: fieldContext.name,
|
|
48
|
+
formItemId: `${id}-form-item`,
|
|
49
|
+
formDescriptionId: `${id}-form-item-description`,
|
|
50
|
+
formMessageId: `${id}-form-item-message`,
|
|
51
|
+
...fieldState
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Блок поля: подпись, элемент, описание и ошибка. При ошибке подсвечивается
|
|
56
|
+
* @param props - пропсы Field; orientation — vertical, horizontal или responsive
|
|
57
|
+
* @returns div с role="group"
|
|
58
|
+
*/
|
|
59
|
+
function FormItem(props) {
|
|
60
|
+
const context = { id: useId() };
|
|
61
|
+
return /* @__PURE__ */ jsx(FormItemContext.Provider, {
|
|
62
|
+
value: context,
|
|
63
|
+
children: /* @__PURE__ */ jsx(FormItemField, { ...props })
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Field с data-invalid по состоянию поля
|
|
68
|
+
* @param props - пропсы Field
|
|
69
|
+
* @returns div с role="group"
|
|
70
|
+
*/
|
|
71
|
+
function FormItemField(props) {
|
|
72
|
+
const { invalid } = useFormField();
|
|
73
|
+
return /* @__PURE__ */ jsx(Field, {
|
|
74
|
+
"data-invalid": invalid,
|
|
75
|
+
...props
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Подпись поля: связана с элементом, при ошибке красная
|
|
80
|
+
* @param props - пропсы подписи
|
|
81
|
+
* @returns label
|
|
82
|
+
*/
|
|
83
|
+
function FormLabel(props) {
|
|
84
|
+
const { invalid, formItemId } = useFormField();
|
|
85
|
+
return /* @__PURE__ */ jsx(FieldLabel, {
|
|
86
|
+
"data-error": invalid,
|
|
87
|
+
htmlFor: formItemId,
|
|
88
|
+
...props
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Обёртка элемента управления: передаёт ему id, aria-invalid и aria-describedby
|
|
93
|
+
* @param props - пропсы; внутрь кладётся один элемент: Input, SelectTrigger, Checkbox (или он в render)
|
|
94
|
+
* @returns дочерний элемент с атрибутами
|
|
95
|
+
*/
|
|
96
|
+
function FormControl({ children, render, ...props }) {
|
|
97
|
+
const { invalid, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
98
|
+
const describedBy = invalid ? `${formDescriptionId} ${formMessageId}` : formDescriptionId;
|
|
99
|
+
const element = render ?? (isValidElement(children) ? children : void 0);
|
|
100
|
+
return useRender({
|
|
101
|
+
render: element,
|
|
102
|
+
props: mergeProps({
|
|
103
|
+
"data-slot": "form-control",
|
|
104
|
+
"id": formItemId,
|
|
105
|
+
"aria-describedby": describedBy,
|
|
106
|
+
"aria-invalid": invalid
|
|
107
|
+
}, props)
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Описание поля: подсказка под элементом
|
|
112
|
+
* @param props - пропсы описания
|
|
113
|
+
* @returns p
|
|
114
|
+
*/
|
|
115
|
+
function FormDescription(props) {
|
|
116
|
+
const { formDescriptionId } = useFormField();
|
|
117
|
+
return /* @__PURE__ */ jsx(FieldDescription, {
|
|
118
|
+
id: formDescriptionId,
|
|
119
|
+
...props
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Ошибка поля: текст ошибки проверки, а без ошибки — children
|
|
124
|
+
* @param props - пропсы ошибки
|
|
125
|
+
* @returns div с role="alert" или null
|
|
126
|
+
*/
|
|
127
|
+
function FormMessage({ children, ...props }) {
|
|
128
|
+
const { error, formMessageId } = useFormField();
|
|
129
|
+
const body = error?.message ?? children;
|
|
130
|
+
return /* @__PURE__ */ jsx(FieldError, {
|
|
131
|
+
id: formMessageId,
|
|
132
|
+
...props,
|
|
133
|
+
children: body
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { FormControlPropsT, FormDescriptionPropsT, FormFieldPropsT, FormFieldStateI, FormItemPropsT, FormLabelPropsT, FormMessagePropsT, FormPropsT } from "./types.js";
|
|
2
|
+
import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField } from "./form.js";
|
|
3
|
+
export { Form, FormControl, type FormControlPropsT, FormDescription, type FormDescriptionPropsT, FormField, type FormFieldPropsT, type FormFieldStateI, FormItem, type FormItemPropsT, FormLabel, type FormLabelPropsT, FormMessage, type FormMessagePropsT, type FormPropsT, useFormField };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField } from "./form.js";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { FieldDescriptionPropsT, FieldErrorPropsT, FieldLabelPropsT, FieldPropsT } from "../field/types.js";
|
|
2
|
+
import "../field/index.js";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
import { ControllerProps, FieldPath, FieldValues, FormProviderProps } from "react-hook-form";
|
|
5
|
+
/**
|
|
6
|
+
* Пропсы формы: результат useForm() из react-hook-form
|
|
7
|
+
*/
|
|
8
|
+
export type FormPropsT<TFieldValues extends FieldValues = FieldValues, TContext = unknown, TTransformedValues = TFieldValues> = FormProviderProps<TFieldValues, TContext, TTransformedValues>;
|
|
9
|
+
/**
|
|
10
|
+
* Пропсы поля формы: как у Controller из react-hook-form
|
|
11
|
+
*/
|
|
12
|
+
export type FormFieldPropsT<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TTransformedValues = TFieldValues> = ControllerProps<TFieldValues, TName, TTransformedValues>;
|
|
13
|
+
/**
|
|
14
|
+
* Состояние поля формы и id его частей
|
|
15
|
+
* @property id - базовый id блока
|
|
16
|
+
* @property name - имя поля
|
|
17
|
+
* @property formItemId - id элемента управления
|
|
18
|
+
* @property formDescriptionId - id описания
|
|
19
|
+
* @property formMessageId - id ошибки
|
|
20
|
+
* @property invalid - есть ошибка
|
|
21
|
+
* @property isDirty - значение меняли
|
|
22
|
+
* @property isTouched - поле теряло фокус
|
|
23
|
+
* @property isValidating - идёт проверка
|
|
24
|
+
* @property error - ошибка проверки
|
|
25
|
+
*/
|
|
26
|
+
export interface FormFieldStateI {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
formItemId: string;
|
|
30
|
+
formDescriptionId: string;
|
|
31
|
+
formMessageId: string;
|
|
32
|
+
invalid: boolean;
|
|
33
|
+
isDirty: boolean;
|
|
34
|
+
isTouched: boolean;
|
|
35
|
+
isValidating: boolean;
|
|
36
|
+
error?: {
|
|
37
|
+
message?: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Пропсы блока поля
|
|
42
|
+
*/
|
|
43
|
+
export type FormItemPropsT = FieldPropsT;
|
|
44
|
+
/**
|
|
45
|
+
* Пропсы подписи поля
|
|
46
|
+
*/
|
|
47
|
+
export type FormLabelPropsT = FieldLabelPropsT;
|
|
48
|
+
/**
|
|
49
|
+
* Пропсы обёртки элемента
|
|
50
|
+
*/
|
|
51
|
+
export type FormControlPropsT = useRender.ComponentProps<'div'>;
|
|
52
|
+
/**
|
|
53
|
+
* Пропсы описания поля
|
|
54
|
+
*/
|
|
55
|
+
export type FormDescriptionPropsT = FieldDescriptionPropsT;
|
|
56
|
+
/**
|
|
57
|
+
* Пропсы ошибки поля
|
|
58
|
+
*/
|
|
59
|
+
export type FormMessagePropsT = Omit<FieldErrorPropsT, 'errors'>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GridPropsT } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Сетка: элементы по колонкам с отступом между ячейками
|
|
4
|
+
* @param props - пропсы сетки
|
|
5
|
+
* @returns сетка или свой элемент в стилях сетки (render)
|
|
6
|
+
*/
|
|
7
|
+
export declare function Grid({ className, columns, gap, render, ...props }: GridPropsT): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { cn } from "../../lib/utils.js";
|
|
2
|
+
import { gridColumnsClasses, gridVariants } from "./types.js";
|
|
3
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
4
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
+
// src/components/grid/grid.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Классы колонок: число — на любой ширине, объект — по брейкпоинтам
|
|
8
|
+
* @param columns - число колонок или колонки по брейкпоинтам
|
|
9
|
+
* @returns классы grid-cols-*
|
|
10
|
+
*/
|
|
11
|
+
function getColumnsClasses(columns) {
|
|
12
|
+
if (typeof columns === "number") return gridColumnsClasses.base[columns];
|
|
13
|
+
const classes = [];
|
|
14
|
+
for (const [breakpoint, count] of Object.entries(columns)) {
|
|
15
|
+
if (count === void 0) continue;
|
|
16
|
+
classes.push(gridColumnsClasses[breakpoint][count]);
|
|
17
|
+
}
|
|
18
|
+
return classes;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Сетка: элементы по колонкам с отступом между ячейками
|
|
22
|
+
* @param props - пропсы сетки
|
|
23
|
+
* @returns сетка или свой элемент в стилях сетки (render)
|
|
24
|
+
*/
|
|
25
|
+
function Grid({ className, columns = 1, gap = 4, render, ...props }) {
|
|
26
|
+
const classes = cn(gridVariants({ gap }), getColumnsClasses(columns), className);
|
|
27
|
+
return useRender({
|
|
28
|
+
defaultTagName: "div",
|
|
29
|
+
render,
|
|
30
|
+
props: mergeProps({
|
|
31
|
+
"data-slot": "grid",
|
|
32
|
+
"className": classes
|
|
33
|
+
}, props)
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export { Grid };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { GridBreakpointT, GridColumnsCountT, GridColumnsResponsiveT, GridPropsT, gridColumnsClasses, gridVariants } from "./types.js";
|
|
2
|
+
import { Grid } from "./grid.js";
|
|
3
|
+
export { Grid, type GridBreakpointT, type GridColumnsCountT, type GridColumnsResponsiveT, type GridPropsT, gridColumnsClasses, gridVariants };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { GapT } from "../stack/types.js";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
/**
|
|
4
|
+
* Число колонок сетки
|
|
5
|
+
*/
|
|
6
|
+
export type GridColumnsCountT = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
7
|
+
/**
|
|
8
|
+
* Брейкпоинт Tailwind; base — без брейкпоинта, на любой ширине
|
|
9
|
+
*/
|
|
10
|
+
export type GridBreakpointT = 'base' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
11
|
+
/**
|
|
12
|
+
* Число колонок по брейкпоинтам: { base: 1, md: 2, lg: 4 }
|
|
13
|
+
*/
|
|
14
|
+
export type GridColumnsResponsiveT = Partial<Record<GridBreakpointT, GridColumnsCountT>>;
|
|
15
|
+
/**
|
|
16
|
+
* Классы колонок по брейкпоинтам.
|
|
17
|
+
* Перечислены целиком, чтобы Tailwind потребителя их увидел.
|
|
18
|
+
*/
|
|
19
|
+
export declare const gridColumnsClasses: Record<GridBreakpointT, Record<GridColumnsCountT, string>>;
|
|
20
|
+
/**
|
|
21
|
+
* Стили сетки: отступ между ячейками. Колонки — gridColumnsClasses.
|
|
22
|
+
* Экспортируются, чтобы разложить сеткой другой элемент: gridVariants({ gap: 4 }).
|
|
23
|
+
*/
|
|
24
|
+
export declare const gridVariants: (props?: ({
|
|
25
|
+
gap?: 0 | 1 | 2 | 0.5 | 1.5 | 2.5 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | null | undefined;
|
|
26
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Пропсы сетки
|
|
29
|
+
*/
|
|
30
|
+
export type GridPropsT = useRender.ComponentProps<'div'> & {
|
|
31
|
+
/** Число колонок от 1 до 12 или по брейкпоинтам: { base: 1, md: 2, lg: 4 }. По умолчанию 1 */
|
|
32
|
+
columns?: GridColumnsCountT | GridColumnsResponsiveT;
|
|
33
|
+
/** Отступ между ячейками по шкале Tailwind: 4 → 16px. По умолчанию 4 */
|
|
34
|
+
gap?: GapT;
|
|
35
|
+
};
|