@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,91 @@
|
|
|
1
|
+
import { QuestionnaireActionsPropsT, QuestionnaireChoiceDescriptionPropsT, QuestionnaireChoicePropsT, QuestionnaireChoicesPropsT, QuestionnaireDescriptionPropsT, QuestionnaireErrorPropsT, QuestionnaireInputPropsT, QuestionnaireItemPropsT, QuestionnaireNextPropsT, QuestionnairePreviousPropsT, QuestionnaireProgressPropsT, QuestionnairePropsT, QuestionnaireSkipPropsT, QuestionnaireSubmitPropsT, QuestionnaireTitlePropsT } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Опрос: форма из вопросов, которые показываются по одному
|
|
4
|
+
* @param props - пропсы опроса
|
|
5
|
+
* @returns форма опроса
|
|
6
|
+
*/
|
|
7
|
+
export declare function Questionnaire({ className, ...props }: QuestionnairePropsT): import("react").JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* Прогресс опроса: «Вопрос 1 из 3», объявляется скринридеру
|
|
10
|
+
* @param props - пропсы прогресса
|
|
11
|
+
* @returns индикатор прогресса
|
|
12
|
+
*/
|
|
13
|
+
export declare function QuestionnaireProgress({ className, children, 'aria-label': ariaLabel, formatProgress, render, ...props }: QuestionnaireProgressPropsT): import("react").JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* Вопрос опроса: виден, только пока он открыт
|
|
16
|
+
* @param props - пропсы вопроса
|
|
17
|
+
* @returns группа полей вопроса
|
|
18
|
+
*/
|
|
19
|
+
export declare function QuestionnaireItem({ className, required, ...props }: QuestionnaireItemPropsT): import("react").JSX.Element;
|
|
20
|
+
/**
|
|
21
|
+
* Заголовок вопроса
|
|
22
|
+
* @param props - пропсы заголовка
|
|
23
|
+
* @returns элемент legend
|
|
24
|
+
*/
|
|
25
|
+
export declare function QuestionnaireTitle({ className, ...props }: QuestionnaireTitlePropsT): import("react").JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* Описание вопроса: подсказка под заголовком
|
|
28
|
+
* @param props - пропсы описания
|
|
29
|
+
* @returns абзац
|
|
30
|
+
*/
|
|
31
|
+
export declare function QuestionnaireDescription({ className, ...props }: QuestionnaireDescriptionPropsT): import("react").JSX.Element;
|
|
32
|
+
/**
|
|
33
|
+
* Список вариантов ответа; переход между вариантами — стрелками
|
|
34
|
+
* @param props - пропсы списка
|
|
35
|
+
* @returns сетка вариантов
|
|
36
|
+
*/
|
|
37
|
+
export declare function QuestionnaireChoices({ className, ...props }: QuestionnaireChoicesPropsT): import("react").JSX.Element;
|
|
38
|
+
/**
|
|
39
|
+
* Вариант ответа: радиокнопка или флажок (если вопрос multiple) с подписью и подсказкой клавиши
|
|
40
|
+
* @param props - пропсы варианта
|
|
41
|
+
* @returns вариант с индикатором
|
|
42
|
+
*/
|
|
43
|
+
export declare function QuestionnaireChoice({ children, className, ...props }: QuestionnaireChoicePropsT): import("react").JSX.Element;
|
|
44
|
+
/**
|
|
45
|
+
* Пояснение под подписью варианта
|
|
46
|
+
* @param props - пропсы пояснения
|
|
47
|
+
* @returns строка пояснения
|
|
48
|
+
*/
|
|
49
|
+
export declare function QuestionnaireChoiceDescription({ className, ...props }: QuestionnaireChoiceDescriptionPropsT): import("react").JSX.Element;
|
|
50
|
+
/**
|
|
51
|
+
* Поле свободного ответа: «Другое…» вместо готовых вариантов
|
|
52
|
+
* @param props - пропсы поля
|
|
53
|
+
* @returns поле ввода в обёртке
|
|
54
|
+
*/
|
|
55
|
+
export declare function QuestionnaireInput({ className, ...props }: QuestionnaireInputPropsT): import("react").JSX.Element;
|
|
56
|
+
/**
|
|
57
|
+
* Ошибка вопроса: видна, когда пытаются перейти дальше без ответа
|
|
58
|
+
* @param props - пропсы ошибки
|
|
59
|
+
* @returns абзац с ошибкой
|
|
60
|
+
*/
|
|
61
|
+
export declare function QuestionnaireError({ className, children, requiredMessage, optionalMessage, ...props }: QuestionnaireErrorPropsT): import("react").JSX.Element;
|
|
62
|
+
/**
|
|
63
|
+
* Панель кнопок: «Назад» слева, «Пропустить» и «Далее» / «Отправить» справа
|
|
64
|
+
* @param props - пропсы панели
|
|
65
|
+
* @returns сетка кнопок
|
|
66
|
+
*/
|
|
67
|
+
export declare function QuestionnaireActions({ className, ...props }: QuestionnaireActionsPropsT): import("react").JSX.Element;
|
|
68
|
+
/**
|
|
69
|
+
* Кнопка «Назад»: к предыдущему вопросу, скрыта на первом
|
|
70
|
+
* @param props - пропсы кнопки
|
|
71
|
+
* @returns кнопка
|
|
72
|
+
*/
|
|
73
|
+
export declare function QuestionnairePrevious({ children, className, size, variant, ...props }: QuestionnairePreviousPropsT): import("react").JSX.Element;
|
|
74
|
+
/**
|
|
75
|
+
* Кнопка «Пропустить»: видна у необязательного вопроса без ответа
|
|
76
|
+
* @param props - пропсы кнопки
|
|
77
|
+
* @returns кнопка
|
|
78
|
+
*/
|
|
79
|
+
export declare function QuestionnaireSkip({ children, className, size, variant, ...props }: QuestionnaireSkipPropsT): import("react").JSX.Element;
|
|
80
|
+
/**
|
|
81
|
+
* Кнопка «Далее»: к следующему вопросу, скрыта на последнем
|
|
82
|
+
* @param props - пропсы кнопки
|
|
83
|
+
* @returns кнопка
|
|
84
|
+
*/
|
|
85
|
+
export declare function QuestionnaireNext({ children, className, size, variant, ...props }: QuestionnaireNextPropsT): import("react").JSX.Element;
|
|
86
|
+
/**
|
|
87
|
+
* Кнопка отправки: видна на последнем вопросе
|
|
88
|
+
* @param props - пропсы кнопки
|
|
89
|
+
* @returns кнопка
|
|
90
|
+
*/
|
|
91
|
+
export declare function QuestionnaireSubmit({ children, className, size, variant, ...props }: QuestionnaireSubmitPropsT): import("react").JSX.Element;
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { texts } from "../../lib/locale.js";
|
|
4
|
+
import { buttonVariants } from "../button/types.js";
|
|
5
|
+
import { QuestionnairePrimitive } from "./questionnaire-primitive.js";
|
|
6
|
+
import { CheckIcon } from "lucide-react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { createContext, use } from "react";
|
|
9
|
+
// src/components/questionnaire/questionnaire.tsx
|
|
10
|
+
/** Подпись прогресса для скринридера по умолчанию */
|
|
11
|
+
const PROGRESS_LABEL = "Прогресс опроса";
|
|
12
|
+
/** Ошибка обязательного вопроса по умолчанию */
|
|
13
|
+
const REQUIRED_MESSAGE = "Выберите ответ, чтобы продолжить.";
|
|
14
|
+
/** Ошибка необязательного вопроса по умолчанию */
|
|
15
|
+
const OPTIONAL_MESSAGE = "Выберите ответ или пропустите вопрос.";
|
|
16
|
+
/** Текст кнопки «Пропустить» по умолчанию */
|
|
17
|
+
const SKIP_TEXT = "Пропустить";
|
|
18
|
+
/** Текст кнопки отправки по умолчанию */
|
|
19
|
+
const SUBMIT_TEXT = "Отправить";
|
|
20
|
+
/**
|
|
21
|
+
* Обязательность текущего вопроса: из неё выбирается текст ошибки
|
|
22
|
+
*/
|
|
23
|
+
const QuestionnaireItemContext = createContext(false);
|
|
24
|
+
/**
|
|
25
|
+
* Опрос: форма из вопросов, которые показываются по одному
|
|
26
|
+
* @param props - пропсы опроса
|
|
27
|
+
* @returns форма опроса
|
|
28
|
+
*/
|
|
29
|
+
function Questionnaire({ className, ...props }) {
|
|
30
|
+
const classes = cn("flex", "w-full", "min-w-0", "flex-col", "gap-4", className);
|
|
31
|
+
return /* @__PURE__ */ jsx(QuestionnairePrimitive.Root, {
|
|
32
|
+
"data-slot": "questionnaire",
|
|
33
|
+
className: classes,
|
|
34
|
+
...props
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Текст прогресса по умолчанию
|
|
39
|
+
* @param current - номер открытого вопроса
|
|
40
|
+
* @param total - всего вопросов
|
|
41
|
+
* @returns «Вопрос 1 из 3»
|
|
42
|
+
*/
|
|
43
|
+
function formatDefaultProgress(current, total) {
|
|
44
|
+
return `Вопрос ${current} ${texts.of} ${total}`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Прогресс опроса: «Вопрос 1 из 3», объявляется скринридеру
|
|
48
|
+
* @param props - пропсы прогресса
|
|
49
|
+
* @returns индикатор прогресса
|
|
50
|
+
*/
|
|
51
|
+
function QuestionnaireProgress({ className, children, "aria-label": ariaLabel = PROGRESS_LABEL, formatProgress = formatDefaultProgress, render, ...props }) {
|
|
52
|
+
const classes = cn("min-h-[1lh]", "w-fit", "min-w-[14ch]", "text-xs", "font-medium", "text-muted-foreground", "tabular-nums", className);
|
|
53
|
+
/**
|
|
54
|
+
* Отрисовать прогресс с русским текстом
|
|
55
|
+
* @param renderProps - пропсы элемента от примитива
|
|
56
|
+
* @param state - номер вопроса и их количество
|
|
57
|
+
* @returns элемент прогресса
|
|
58
|
+
*/
|
|
59
|
+
const renderProgress = (renderProps, state) => {
|
|
60
|
+
const { current, total } = state;
|
|
61
|
+
const text = total ? formatProgress(current, total) : void 0;
|
|
62
|
+
if (render) return render({
|
|
63
|
+
...renderProps,
|
|
64
|
+
"aria-valuetext": text
|
|
65
|
+
}, state);
|
|
66
|
+
return /* @__PURE__ */ jsx("div", {
|
|
67
|
+
...renderProps,
|
|
68
|
+
"aria-valuetext": text,
|
|
69
|
+
children: children ?? text
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
return /* @__PURE__ */ jsx(QuestionnairePrimitive.Progress, {
|
|
73
|
+
"data-slot": "questionnaire-progress",
|
|
74
|
+
"aria-label": ariaLabel,
|
|
75
|
+
className: classes,
|
|
76
|
+
render: renderProgress,
|
|
77
|
+
...props
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Вопрос опроса: виден, только пока он открыт
|
|
82
|
+
* @param props - пропсы вопроса
|
|
83
|
+
* @returns группа полей вопроса
|
|
84
|
+
*/
|
|
85
|
+
function QuestionnaireItem({ className, required, ...props }) {
|
|
86
|
+
const isRequired = required === true;
|
|
87
|
+
const classes = cn("flex", "min-w-0", "flex-col", "gap-4", "border-0", "p-0", "outline-none", className);
|
|
88
|
+
return /* @__PURE__ */ jsx(QuestionnaireItemContext, {
|
|
89
|
+
value: isRequired,
|
|
90
|
+
children: /* @__PURE__ */ jsx(QuestionnairePrimitive.Item, {
|
|
91
|
+
"data-slot": "questionnaire-item",
|
|
92
|
+
required,
|
|
93
|
+
className: classes,
|
|
94
|
+
...props
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Заголовок вопроса
|
|
100
|
+
* @param props - пропсы заголовка
|
|
101
|
+
* @returns элемент legend
|
|
102
|
+
*/
|
|
103
|
+
function QuestionnaireTitle({ className, ...props }) {
|
|
104
|
+
const classes = cn("text-base", "leading-snug", "font-medium", "text-pretty", "[&:not(:has(~[data-slot=questionnaire-description]))]:mb-4", className);
|
|
105
|
+
return /* @__PURE__ */ jsx(QuestionnairePrimitive.Title, {
|
|
106
|
+
"data-slot": "questionnaire-title",
|
|
107
|
+
className: classes,
|
|
108
|
+
...props
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Описание вопроса: подсказка под заголовком
|
|
113
|
+
* @param props - пропсы описания
|
|
114
|
+
* @returns абзац
|
|
115
|
+
*/
|
|
116
|
+
function QuestionnaireDescription({ className, ...props }) {
|
|
117
|
+
const classes = cn("text-sm", "text-pretty", "text-muted-foreground", className);
|
|
118
|
+
return /* @__PURE__ */ jsx(QuestionnairePrimitive.Description, {
|
|
119
|
+
"data-slot": "questionnaire-description",
|
|
120
|
+
className: classes,
|
|
121
|
+
...props
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Список вариантов ответа; переход между вариантами — стрелками
|
|
126
|
+
* @param props - пропсы списка
|
|
127
|
+
* @returns сетка вариантов
|
|
128
|
+
*/
|
|
129
|
+
function QuestionnaireChoices({ className, ...props }) {
|
|
130
|
+
const classes = cn("group/questionnaire-choices", "grid", "min-w-0", "gap-2", className);
|
|
131
|
+
return /* @__PURE__ */ jsx(QuestionnairePrimitive.Choices, {
|
|
132
|
+
"data-slot": "questionnaire-choices",
|
|
133
|
+
className: classes,
|
|
134
|
+
...props
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Вариант ответа: радиокнопка или флажок (если вопрос multiple) с подписью и подсказкой клавиши
|
|
139
|
+
* @param props - пропсы варианта
|
|
140
|
+
* @returns вариант с индикатором
|
|
141
|
+
*/
|
|
142
|
+
function QuestionnaireChoice({ children, className, ...props }) {
|
|
143
|
+
const classes = cn("group/questionnaire-choice", "relative", "flex", "min-h-11", "cursor-pointer", "items-start", "gap-2.5", "rounded-lg", "border", "border-input", "bg-transparent", "px-3", "py-2.5", "text-left", "text-sm", "transition-colors", "outline-none", "select-none", "hover:bg-muted/50", "dark:bg-input/20", "data-checked:border-primary/40", "data-checked:bg-muted", "dark:data-checked:bg-muted", "data-invalid:border-destructive", "keyboard:has-[>input:focus-visible]:border-ring", "keyboard:has-[>input:focus-visible]:ring-3", "keyboard:has-[>input:focus-visible]:ring-ring/50", "data-disabled:pointer-events-none", "data-disabled:cursor-not-allowed", "data-disabled:opacity-50", className);
|
|
144
|
+
const indicatorClasses = cn("pointer-events-none", "relative", "flex", "size-4", "shrink-0", "translate-y-[--spacing(0.45)]", "items-center", "justify-center", "rounded-[4px]", "border", "border-input", "dark:bg-input/30", "group-data-[type=radio]/questionnaire-choice:rounded-full", "group-has-data-[slot=questionnaire-choice-description]/questionnaire-choice:translate-y-0.5", "group-data-checked/questionnaire-choice:border-primary", "group-data-checked/questionnaire-choice:bg-primary", "group-data-checked/questionnaire-choice:text-primary-foreground", "dark:group-data-checked/questionnaire-choice:bg-primary");
|
|
145
|
+
const dotClasses = cn("hidden", "size-2", "rounded-full", "bg-primary-foreground", "group-data-[type=radio]/questionnaire-choice:group-data-checked/questionnaire-choice:block");
|
|
146
|
+
const checkClasses = cn("hidden", "size-3.5", "group-data-[type=checkbox]/questionnaire-choice:group-data-checked/questionnaire-choice:block");
|
|
147
|
+
const shortcutClasses = cn("pointer-events-none", "ml-auto", "hidden", "size-5", "shrink-0", "translate-y-[--spacing(0.45)]", "items-center", "justify-center", "rounded-md", "border", "border-input", "bg-background", "font-mono", "text-[0.625rem]", "leading-none", "font-medium", "text-muted-foreground", "group-has-data-[slot=questionnaire-choice-description]/questionnaire-choice:translate-y-0.5", "group-data-[shortcut]/questionnaire-choice:inline-flex");
|
|
148
|
+
return /* @__PURE__ */ jsxs(QuestionnairePrimitive.Choice, {
|
|
149
|
+
"data-slot": "questionnaire-choice",
|
|
150
|
+
className: classes,
|
|
151
|
+
...props,
|
|
152
|
+
children: [
|
|
153
|
+
/* @__PURE__ */ jsx(QuestionnairePrimitive.ChoiceInput, {
|
|
154
|
+
"data-slot": "questionnaire-choice-input",
|
|
155
|
+
className: "absolute inset-0 z-10 size-full cursor-pointer opacity-0"
|
|
156
|
+
}),
|
|
157
|
+
/* @__PURE__ */ jsxs("span", {
|
|
158
|
+
"data-slot": "questionnaire-choice-indicator",
|
|
159
|
+
"aria-hidden": true,
|
|
160
|
+
className: indicatorClasses,
|
|
161
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
162
|
+
"data-slot": "questionnaire-choice-indicator-dot",
|
|
163
|
+
className: dotClasses
|
|
164
|
+
}), /* @__PURE__ */ jsx(CheckIcon, {
|
|
165
|
+
"data-slot": "questionnaire-choice-indicator-check",
|
|
166
|
+
className: checkClasses
|
|
167
|
+
})]
|
|
168
|
+
}),
|
|
169
|
+
/* @__PURE__ */ jsx(QuestionnairePrimitive.ChoiceLabel, {
|
|
170
|
+
"data-slot": "questionnaire-choice-label",
|
|
171
|
+
className: "flex min-w-0 flex-1 flex-col gap-0.5 leading-snug",
|
|
172
|
+
children
|
|
173
|
+
}),
|
|
174
|
+
/* @__PURE__ */ jsx(QuestionnairePrimitive.ChoiceShortcut, {
|
|
175
|
+
"data-slot": "questionnaire-choice-shortcut",
|
|
176
|
+
className: shortcutClasses
|
|
177
|
+
})
|
|
178
|
+
]
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Пояснение под подписью варианта
|
|
183
|
+
* @param props - пропсы пояснения
|
|
184
|
+
* @returns строка пояснения
|
|
185
|
+
*/
|
|
186
|
+
function QuestionnaireChoiceDescription({ className, ...props }) {
|
|
187
|
+
const classes = cn("text-muted-foreground", className);
|
|
188
|
+
return /* @__PURE__ */ jsx("span", {
|
|
189
|
+
"data-slot": "questionnaire-choice-description",
|
|
190
|
+
className: classes,
|
|
191
|
+
...props
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Поле свободного ответа: «Другое…» вместо готовых вариантов
|
|
196
|
+
* @param props - пропсы поля
|
|
197
|
+
* @returns поле ввода в обёртке
|
|
198
|
+
*/
|
|
199
|
+
function QuestionnaireInput({ className, ...props }) {
|
|
200
|
+
const classes = cn("h-8", "min-h-11", "w-full", "min-w-0", "rounded-lg", "border", "border-input", "bg-transparent", "px-2.5", "py-1", "text-base", "transition-[color,box-shadow,background-color]", "outline-none", "sm:min-h-0", "md:text-sm", "selection:bg-primary", "selection:text-primary-foreground", "placeholder:text-muted-foreground", "dark:bg-input/30", "focus-visible:border-ring", "focus-visible:ring-3", "focus-visible:ring-ring/50", "aria-invalid:border-destructive", "aria-invalid:ring-3", "aria-invalid:ring-destructive/20", "dark:aria-invalid:border-destructive/50", "dark:aria-invalid:ring-destructive/40", "disabled:pointer-events-none", "disabled:cursor-not-allowed", "disabled:bg-input/50", "disabled:opacity-50", "dark:disabled:bg-input/80", className);
|
|
201
|
+
return /* @__PURE__ */ jsx("div", {
|
|
202
|
+
"data-slot": "questionnaire-input-wrapper",
|
|
203
|
+
className: "group/questionnaire-input relative w-full min-w-0",
|
|
204
|
+
children: /* @__PURE__ */ jsx(QuestionnairePrimitive.Input, {
|
|
205
|
+
"data-slot": "questionnaire-input",
|
|
206
|
+
className: classes,
|
|
207
|
+
...props
|
|
208
|
+
})
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Ошибка вопроса: видна, когда пытаются перейти дальше без ответа
|
|
213
|
+
* @param props - пропсы ошибки
|
|
214
|
+
* @returns абзац с ошибкой
|
|
215
|
+
*/
|
|
216
|
+
function QuestionnaireError({ className, children, requiredMessage = REQUIRED_MESSAGE, optionalMessage = OPTIONAL_MESSAGE, ...props }) {
|
|
217
|
+
const message = use(QuestionnaireItemContext) ? requiredMessage : optionalMessage;
|
|
218
|
+
const classes = cn("mt-2", "text-sm", "text-destructive", className);
|
|
219
|
+
return /* @__PURE__ */ jsx(QuestionnairePrimitive.Error, {
|
|
220
|
+
"data-slot": "questionnaire-error",
|
|
221
|
+
className: classes,
|
|
222
|
+
...props,
|
|
223
|
+
children: children ?? message
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Панель кнопок: «Назад» слева, «Пропустить» и «Далее» / «Отправить» справа
|
|
228
|
+
* @param props - пропсы панели
|
|
229
|
+
* @returns сетка кнопок
|
|
230
|
+
*/
|
|
231
|
+
function QuestionnaireActions({ className, ...props }) {
|
|
232
|
+
const classes = cn("grid", "min-h-11", "w-full", "grid-cols-[minmax(0,1fr)_auto_auto]", "items-center", "gap-2", "sm:min-h-8", className);
|
|
233
|
+
return /* @__PURE__ */ jsx("div", {
|
|
234
|
+
"data-slot": "questionnaire-actions",
|
|
235
|
+
className: classes,
|
|
236
|
+
...props
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Кнопка «Назад»: к предыдущему вопросу, скрыта на первом
|
|
241
|
+
* @param props - пропсы кнопки
|
|
242
|
+
* @returns кнопка
|
|
243
|
+
*/
|
|
244
|
+
function QuestionnairePrevious({ children, className, size = "default", variant = "outline", ...props }) {
|
|
245
|
+
const classes = cn(buttonVariants({
|
|
246
|
+
size,
|
|
247
|
+
variant
|
|
248
|
+
}), "col-start-1", "row-start-1", "min-h-11", "justify-self-start", "sm:min-h-0", className);
|
|
249
|
+
return /* @__PURE__ */ jsx(QuestionnairePrimitive.Previous, {
|
|
250
|
+
"data-slot": "questionnaire-previous",
|
|
251
|
+
"data-size": size,
|
|
252
|
+
"data-variant": variant,
|
|
253
|
+
className: classes,
|
|
254
|
+
...props,
|
|
255
|
+
children: children ?? texts.previous
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Кнопка «Пропустить»: видна у необязательного вопроса без ответа
|
|
260
|
+
* @param props - пропсы кнопки
|
|
261
|
+
* @returns кнопка
|
|
262
|
+
*/
|
|
263
|
+
function QuestionnaireSkip({ children, className, size = "default", variant = "outline", ...props }) {
|
|
264
|
+
const classes = cn(buttonVariants({
|
|
265
|
+
size,
|
|
266
|
+
variant
|
|
267
|
+
}), "col-start-2", "row-start-1", "min-h-11", "justify-self-end", "sm:min-h-0", className);
|
|
268
|
+
return /* @__PURE__ */ jsx(QuestionnairePrimitive.Skip, {
|
|
269
|
+
"data-slot": "questionnaire-skip",
|
|
270
|
+
"data-size": size,
|
|
271
|
+
"data-variant": variant,
|
|
272
|
+
className: classes,
|
|
273
|
+
...props,
|
|
274
|
+
children: children ?? SKIP_TEXT
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Кнопка «Далее»: к следующему вопросу, скрыта на последнем
|
|
279
|
+
* @param props - пропсы кнопки
|
|
280
|
+
* @returns кнопка
|
|
281
|
+
*/
|
|
282
|
+
function QuestionnaireNext({ children, className, size = "default", variant = "default", ...props }) {
|
|
283
|
+
const classes = cn(buttonVariants({
|
|
284
|
+
size,
|
|
285
|
+
variant
|
|
286
|
+
}), "col-start-3", "row-start-1", "min-h-11", "justify-self-end", "sm:min-h-0", className);
|
|
287
|
+
return /* @__PURE__ */ jsx(QuestionnairePrimitive.Next, {
|
|
288
|
+
"data-slot": "questionnaire-next",
|
|
289
|
+
"data-size": size,
|
|
290
|
+
"data-variant": variant,
|
|
291
|
+
className: classes,
|
|
292
|
+
...props,
|
|
293
|
+
children: children ?? texts.next
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Кнопка отправки: видна на последнем вопросе
|
|
298
|
+
* @param props - пропсы кнопки
|
|
299
|
+
* @returns кнопка
|
|
300
|
+
*/
|
|
301
|
+
function QuestionnaireSubmit({ children, className, size = "default", variant = "default", ...props }) {
|
|
302
|
+
const classes = cn(buttonVariants({
|
|
303
|
+
size,
|
|
304
|
+
variant
|
|
305
|
+
}), "col-start-3", "row-start-1", "min-h-11", "justify-self-end", "sm:min-h-0", className);
|
|
306
|
+
return /* @__PURE__ */ jsx(QuestionnairePrimitive.Submit, {
|
|
307
|
+
"data-slot": "questionnaire-submit",
|
|
308
|
+
"data-size": size,
|
|
309
|
+
"data-variant": variant,
|
|
310
|
+
className: classes,
|
|
311
|
+
...props,
|
|
312
|
+
children: children ?? SUBMIT_TEXT
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
export { Questionnaire, QuestionnaireActions, QuestionnaireChoice, QuestionnaireChoiceDescription, QuestionnaireChoices, QuestionnaireDescription, QuestionnaireError, QuestionnaireInput, QuestionnaireItem, QuestionnaireNext, QuestionnairePrevious, QuestionnaireProgress, QuestionnaireSkip, QuestionnaireSubmit, QuestionnaireTitle };
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { ButtonPropsT } from "../button/types.js";
|
|
2
|
+
import { ChangeEventHandler, ComponentProps, FormEvent, MouseEvent, ReactElement, ReactNode, Ref } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Статус вопроса: без ответа, отвечен или пропущен
|
|
5
|
+
*/
|
|
6
|
+
export type QuestionnaireItemStatusT = 'unanswered' | 'answered' | 'skipped';
|
|
7
|
+
/**
|
|
8
|
+
* Подсказки клавиш у вариантов: буквы или цифры
|
|
9
|
+
*/
|
|
10
|
+
export type QuestionnaireShortcutModeT = 'letters' | 'numbers';
|
|
11
|
+
/**
|
|
12
|
+
* Описание варианта ответа для Questionnaire items
|
|
13
|
+
* @property disabled - вариант отключён
|
|
14
|
+
* @property value - значение варианта
|
|
15
|
+
*/
|
|
16
|
+
export type QuestionnaireChoiceDefinitionT = {
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
value: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Описание вопроса для Questionnaire items: имя, варианты, обязательность
|
|
22
|
+
* @property choices - варианты ответа в порядке показа
|
|
23
|
+
* @property disabled - вопрос отключён
|
|
24
|
+
* @property name - имя вопроса
|
|
25
|
+
* @property required - обязательный вопрос
|
|
26
|
+
*/
|
|
27
|
+
export type QuestionnaireItemDefinitionT = {
|
|
28
|
+
choices?: readonly QuestionnaireChoiceDefinitionT[];
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
name: string;
|
|
31
|
+
required?: boolean;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Тип поля свободного ответа
|
|
35
|
+
*/
|
|
36
|
+
export type QuestionnaireInputTypeT = 'date' | 'datetime-local' | 'email' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week';
|
|
37
|
+
/**
|
|
38
|
+
* Пропсы кнопок навигации: оформление и размер как у Button
|
|
39
|
+
*/
|
|
40
|
+
export type NavigationButtonPropsT = Omit<ComponentProps<'button'>, 'type'> & {
|
|
41
|
+
/** Оформление кнопки */
|
|
42
|
+
variant?: ButtonPropsT['variant'];
|
|
43
|
+
/** Размер кнопки */
|
|
44
|
+
size?: ButtonPropsT['size'];
|
|
45
|
+
/** Отключённая кнопка */
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Пропсы опроса
|
|
50
|
+
*/
|
|
51
|
+
export type QuestionnairePropsT = Omit<ComponentProps<'form'>, 'defaultValue' | 'value' | 'onSubmit'> & {
|
|
52
|
+
/** Открытый вопрос при первом рендере — неконтролируемый режим */
|
|
53
|
+
defaultItem?: string;
|
|
54
|
+
/** Открытый вопрос — контролируемый режим, вместе с onItemChange */
|
|
55
|
+
item?: string;
|
|
56
|
+
/** Описания вопросов: порядок, варианты и обязательность для навигации и проверки */
|
|
57
|
+
items?: readonly QuestionnaireItemDefinitionT[];
|
|
58
|
+
/** Открыт другой вопрос */
|
|
59
|
+
onItemChange?: (item: string) => void;
|
|
60
|
+
/** Подсказки клавиш у вариантов: letters — A, B, C; numbers — 1, 2, 3 */
|
|
61
|
+
shortcuts?: QuestionnaireShortcutModeT;
|
|
62
|
+
/** Отправка ответов: данные берутся из FormData формы */
|
|
63
|
+
onSubmit?: (event: FormEvent<HTMLFormElement>) => void;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Состояние прогресса для render
|
|
67
|
+
* @property current - номер открытого вопроса
|
|
68
|
+
* @property total - всего вопросов
|
|
69
|
+
* @property first - открыт первый вопрос
|
|
70
|
+
* @property last - открыт последний вопрос
|
|
71
|
+
*/
|
|
72
|
+
export interface QuestionnaireProgressStateI {
|
|
73
|
+
current: number;
|
|
74
|
+
total: number;
|
|
75
|
+
first: boolean;
|
|
76
|
+
last: boolean;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Пропсы прогресса опроса
|
|
80
|
+
*/
|
|
81
|
+
export type QuestionnaireProgressPropsT = Omit<ComponentProps<'div'>, 'aria-label' | 'children'> & {
|
|
82
|
+
/** Подпись для скринридера, по умолчанию «Прогресс опроса» */
|
|
83
|
+
'aria-label'?: string;
|
|
84
|
+
/** Свой текст вместо «Вопрос 1 из 3» */
|
|
85
|
+
children?: ReactNode;
|
|
86
|
+
/**
|
|
87
|
+
* Текст прогресса
|
|
88
|
+
* @param current - номер открытого вопроса
|
|
89
|
+
* @param total - всего вопросов
|
|
90
|
+
* @returns текст, по умолчанию «Вопрос 1 из 3»
|
|
91
|
+
*/
|
|
92
|
+
formatProgress?: (current: number, total: number) => string;
|
|
93
|
+
/**
|
|
94
|
+
* Своя разметка прогресса: например, полоса из шагов
|
|
95
|
+
* @param props - пропсы элемента: role, aria-атрибуты, className
|
|
96
|
+
* @param state - номер вопроса и их количество
|
|
97
|
+
* @returns элемент прогресса
|
|
98
|
+
*/
|
|
99
|
+
render?: (props: Record<string, unknown>, state: QuestionnaireProgressStateI) => ReactElement;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Пропсы вопроса
|
|
103
|
+
*/
|
|
104
|
+
export type QuestionnaireItemPropsT = Omit<ComponentProps<'fieldset'>, 'name' | 'value' | 'disabled'> & {
|
|
105
|
+
/** Имя вопроса: ключ ответа в FormData и идентификатор для item/defaultItem */
|
|
106
|
+
name: string;
|
|
107
|
+
/** Можно выбрать несколько вариантов */
|
|
108
|
+
multiple?: boolean;
|
|
109
|
+
/** Обязательный вопрос: без ответа нельзя перейти дальше и пропустить */
|
|
110
|
+
required?: boolean;
|
|
111
|
+
/** Отключённый вопрос: пропускается при навигации */
|
|
112
|
+
disabled?: boolean;
|
|
113
|
+
/** Ошибка: показать QuestionnaireError и подсветить варианты */
|
|
114
|
+
invalid?: boolean;
|
|
115
|
+
/** Изменился статус вопроса */
|
|
116
|
+
onStatusChange?: (status: QuestionnaireItemStatusT) => void;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Пропсы заголовка вопроса
|
|
120
|
+
*/
|
|
121
|
+
export type QuestionnaireTitlePropsT = ComponentProps<'legend'> & {
|
|
122
|
+
/** Другой элемент вместо legend: пропсы и поведение переходят на него (например, <CardTitle />) */
|
|
123
|
+
render?: ReactElement;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Пропсы описания вопроса
|
|
127
|
+
*/
|
|
128
|
+
export type QuestionnaireDescriptionPropsT = ComponentProps<'p'> & {
|
|
129
|
+
/** Другой элемент вместо p: пропсы и поведение переходят на него (например, <CardTitle />) */
|
|
130
|
+
render?: ReactElement;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Пропсы списка вариантов
|
|
134
|
+
*/
|
|
135
|
+
export type QuestionnaireChoicesPropsT = ComponentProps<'div'> & {
|
|
136
|
+
/** Другой элемент вместо div: пропсы и поведение переходят на него (например, <CardTitle />) */
|
|
137
|
+
render?: ReactElement;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Пропсы варианта ответа
|
|
141
|
+
*/
|
|
142
|
+
export type QuestionnaireChoicePropsT = Omit<ComponentProps<'label'>, 'onChange'> & {
|
|
143
|
+
/** Значение варианта: уходит в FormData */
|
|
144
|
+
value: string;
|
|
145
|
+
/** Выбран ли вариант — контролируемый режим, вместе с onChange */
|
|
146
|
+
checked?: boolean;
|
|
147
|
+
/** Выбран ли вариант при первом рендере — неконтролируемый режим */
|
|
148
|
+
defaultChecked?: boolean;
|
|
149
|
+
/** Отключённый вариант: его нельзя выбрать */
|
|
150
|
+
disabled?: boolean;
|
|
151
|
+
/** Вариант выбран или снят */
|
|
152
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Пропсы пояснения к варианту
|
|
156
|
+
*/
|
|
157
|
+
export type QuestionnaireChoiceDescriptionPropsT = ComponentProps<'span'>;
|
|
158
|
+
/**
|
|
159
|
+
* Пропсы поля свободного ответа
|
|
160
|
+
*/
|
|
161
|
+
export type QuestionnaireInputPropsT = Omit<ComponentProps<'input'>, 'form' | 'name' | 'type' | 'value' | 'defaultValue' | 'disabled' | 'placeholder'> & {
|
|
162
|
+
/** Тип поля: text, email, number, date и другие */
|
|
163
|
+
type?: QuestionnaireInputTypeT;
|
|
164
|
+
/** Значение — контролируемый режим, вместе с onChange */
|
|
165
|
+
value?: string;
|
|
166
|
+
/** Значение при первом рендере — неконтролируемый режим */
|
|
167
|
+
defaultValue?: string;
|
|
168
|
+
/** Подсказка, пока поле пустое */
|
|
169
|
+
placeholder?: string;
|
|
170
|
+
/** Отключённое поле */
|
|
171
|
+
disabled?: boolean;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Пропсы ошибки вопроса
|
|
175
|
+
*/
|
|
176
|
+
export type QuestionnaireErrorPropsT = ComponentProps<'p'> & {
|
|
177
|
+
/** Другой элемент вместо p: пропсы и поведение переходят на него */
|
|
178
|
+
render?: ReactElement;
|
|
179
|
+
/** Текст для обязательного вопроса, по умолчанию «Выберите ответ, чтобы продолжить.» */
|
|
180
|
+
requiredMessage?: string;
|
|
181
|
+
/** Текст для необязательного вопроса, по умолчанию «Выберите ответ или пропустите вопрос.» */
|
|
182
|
+
optionalMessage?: string;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Пропсы панели кнопок
|
|
186
|
+
*/
|
|
187
|
+
export type QuestionnaireActionsPropsT = ComponentProps<'div'>;
|
|
188
|
+
/**
|
|
189
|
+
* Пропсы кнопки «Назад»
|
|
190
|
+
*/
|
|
191
|
+
export type QuestionnairePreviousPropsT = NavigationButtonPropsT;
|
|
192
|
+
/**
|
|
193
|
+
* Пропсы кнопки «Пропустить»
|
|
194
|
+
*/
|
|
195
|
+
export type QuestionnaireSkipPropsT = NavigationButtonPropsT;
|
|
196
|
+
/**
|
|
197
|
+
* Пропсы кнопки «Далее»
|
|
198
|
+
*/
|
|
199
|
+
export type QuestionnaireNextPropsT = NavigationButtonPropsT;
|
|
200
|
+
/**
|
|
201
|
+
* Пропсы кнопки отправки
|
|
202
|
+
*/
|
|
203
|
+
export type QuestionnaireSubmitPropsT = NavigationButtonPropsT;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RadioGroup, RadioGroupItem } from "./radio-group.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RadioGroupItemPropsT, RadioGroupPropsT } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Группа переключателей: выбор одного варианта из нескольких
|
|
4
|
+
* @param props - пропсы группы
|
|
5
|
+
* @returns элемент с role=radiogroup
|
|
6
|
+
*/
|
|
7
|
+
export declare function RadioGroup({ className, onValueChange, ...props }: RadioGroupPropsT): import("react").JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* Вариант группы: круглая кнопка с точкой, когда выбран
|
|
10
|
+
* @param props - пропсы варианта
|
|
11
|
+
* @returns элемент с role=radio
|
|
12
|
+
*/
|
|
13
|
+
export declare function RadioGroupItem({ className, ...props }: RadioGroupItemPropsT): import("react").JSX.Element;
|