@archytechtor/ui 0.0.0-stage → 0.1.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/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/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/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 +244 -0
- package/dist/index.js +114 -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 +126 -0
- package/dist/styles/theme.css +80 -0
- package/dist/styles/utilities.css +553 -0
- package/package.json +89 -3
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { texts } from "../../lib/locale.js";
|
|
4
|
+
import { Button } from "../button/button.js";
|
|
5
|
+
import { XIcon } from "lucide-react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { createContext, useContext, useEffect, useId, useRef, useState } from "react";
|
|
8
|
+
import { AnimatePresence, MotionConfig, motion, useIsPresent } from "motion/react";
|
|
9
|
+
import { createPortal } from "react-dom";
|
|
10
|
+
// src/components/expanded-card/expanded-card.tsx
|
|
11
|
+
let scrollLockCount = 0;
|
|
12
|
+
let scrollLockPrevious = "";
|
|
13
|
+
/** Заблокировать прокрутку страницы (можно вызывать вложенно) */
|
|
14
|
+
function lockBodyScroll() {
|
|
15
|
+
if (scrollLockCount === 0) {
|
|
16
|
+
scrollLockPrevious = document.body.style.overflow;
|
|
17
|
+
document.body.style.overflow = "hidden";
|
|
18
|
+
}
|
|
19
|
+
scrollLockCount += 1;
|
|
20
|
+
}
|
|
21
|
+
/** Снять блокировку; прокрутка возвращается, когда закрылось последнее окно */
|
|
22
|
+
function unlockBodyScroll() {
|
|
23
|
+
scrollLockCount = Math.max(0, scrollLockCount - 1);
|
|
24
|
+
if (scrollLockCount === 0) document.body.style.overflow = scrollLockPrevious;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Анимация по умолчанию: плавная пружина без перелёта
|
|
28
|
+
*/
|
|
29
|
+
const defaultTransition = {
|
|
30
|
+
type: "spring",
|
|
31
|
+
duration: .45,
|
|
32
|
+
bounce: .1
|
|
33
|
+
};
|
|
34
|
+
const ExpandedCardContext = createContext(null);
|
|
35
|
+
const ExpandedViewContext = createContext(false);
|
|
36
|
+
/**
|
|
37
|
+
* Состояние карточки из контекста
|
|
38
|
+
* @returns состояние карточки
|
|
39
|
+
*/
|
|
40
|
+
function useExpandedCard() {
|
|
41
|
+
const context = useContext(ExpandedCardContext);
|
|
42
|
+
if (!context) throw new Error("Части ExpandedCard должны находиться внутри <ExpandedCard>");
|
|
43
|
+
return context;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Раскрывающаяся карточка: свёрнутая карточка плавно разворачивается в окно поверх страницы
|
|
47
|
+
* @param props - пропсы карточки
|
|
48
|
+
* @returns корень карточки без собственного элемента
|
|
49
|
+
*/
|
|
50
|
+
function ExpandedCard({ open, defaultOpen = false, onOpenChange, transition = defaultTransition, children }) {
|
|
51
|
+
const uniqueId = useId();
|
|
52
|
+
const triggerRef = useRef(null);
|
|
53
|
+
const [innerOpen, setInnerOpen] = useState(defaultOpen);
|
|
54
|
+
const isControlled = open !== void 0;
|
|
55
|
+
const isOpen = isControlled ? open : innerOpen;
|
|
56
|
+
/**
|
|
57
|
+
* Открыть или закрыть
|
|
58
|
+
* @param nextOpen - новое состояние
|
|
59
|
+
*/
|
|
60
|
+
const setOpen = (nextOpen) => {
|
|
61
|
+
if (!isControlled) setInnerOpen(nextOpen);
|
|
62
|
+
if (nextOpen !== isOpen) onOpenChange?.(nextOpen);
|
|
63
|
+
};
|
|
64
|
+
const contextValue = {
|
|
65
|
+
isOpen,
|
|
66
|
+
uniqueId,
|
|
67
|
+
triggerRef,
|
|
68
|
+
setOpen
|
|
69
|
+
};
|
|
70
|
+
return /* @__PURE__ */ jsx(ExpandedCardContext.Provider, {
|
|
71
|
+
value: contextValue,
|
|
72
|
+
children: /* @__PURE__ */ jsx(MotionConfig, {
|
|
73
|
+
transition,
|
|
74
|
+
reducedMotion: "user",
|
|
75
|
+
children
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Тело карточки: во свёрнутом виде — кнопка раскрытия, внутри окна — его контейнер
|
|
81
|
+
* @param props - пропсы тела
|
|
82
|
+
* @returns карточка
|
|
83
|
+
*/
|
|
84
|
+
function ExpandedCardBody({ className, onClick, onKeyDown, ref, children, ...props }) {
|
|
85
|
+
const { isOpen, uniqueId, triggerRef, setOpen } = useExpandedCard();
|
|
86
|
+
const isExpandedView = useContext(ExpandedViewContext);
|
|
87
|
+
const classes = cn("relative", "flex", "flex-col", "overflow-hidden", "rounded-xl", "bg-card", "pb-2", "text-sm", "text-card-foreground", "shadow-sm", "ring-1", "ring-foreground/10", !isExpandedView && [
|
|
88
|
+
"cursor-pointer",
|
|
89
|
+
"outline-none",
|
|
90
|
+
"select-none",
|
|
91
|
+
"focus-visible:ring-3",
|
|
92
|
+
"focus-visible:ring-ring/50"
|
|
93
|
+
], className);
|
|
94
|
+
/**
|
|
95
|
+
* Элемент карточки: наружу и в контекст для возврата фокуса
|
|
96
|
+
* @param node - элемент или null при размонтировании
|
|
97
|
+
*/
|
|
98
|
+
const setRef = (node) => {
|
|
99
|
+
if (!isExpandedView) triggerRef.current = node;
|
|
100
|
+
if (typeof ref === "function") {
|
|
101
|
+
ref(node);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (ref) ref.current = node;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Нажатие: раскрыть свёрнутую карточку
|
|
108
|
+
* @param event - событие нажатия
|
|
109
|
+
*/
|
|
110
|
+
const handleClick = (event) => {
|
|
111
|
+
onClick?.(event);
|
|
112
|
+
if (!isExpandedView && !event.defaultPrevented) setOpen(true);
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Enter и пробел раскрывают свёрнутую карточку
|
|
116
|
+
* @param event - событие клавиатуры
|
|
117
|
+
*/
|
|
118
|
+
const handleKeyDown = (event) => {
|
|
119
|
+
onKeyDown?.(event);
|
|
120
|
+
const isActionKey = event.key === "Enter" || event.key === " ";
|
|
121
|
+
const isSelf = event.target === event.currentTarget;
|
|
122
|
+
if (isExpandedView || event.defaultPrevented || !isActionKey || !isSelf) return;
|
|
123
|
+
event.preventDefault();
|
|
124
|
+
setOpen(true);
|
|
125
|
+
};
|
|
126
|
+
const triggerProps = isExpandedView ? {} : {
|
|
127
|
+
role: "button",
|
|
128
|
+
tabIndex: 0,
|
|
129
|
+
"aria-haspopup": "dialog",
|
|
130
|
+
"aria-expanded": isOpen
|
|
131
|
+
};
|
|
132
|
+
return /* @__PURE__ */ jsx(motion.div, {
|
|
133
|
+
"data-slot": "expanded-card-body",
|
|
134
|
+
layoutId: `expanded-card-${uniqueId}`,
|
|
135
|
+
ref: setRef,
|
|
136
|
+
className: classes,
|
|
137
|
+
onClick: handleClick,
|
|
138
|
+
onKeyDown: handleKeyDown,
|
|
139
|
+
...triggerProps,
|
|
140
|
+
...props,
|
|
141
|
+
children
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Окно раскрытия: затемнение и карточка по центру экрана, закрывается по Escape и клику снаружи
|
|
146
|
+
* @param props - пропсы окна
|
|
147
|
+
* @returns окно в портале или null, пока карточка свёрнута
|
|
148
|
+
*/
|
|
149
|
+
function ExpandedCardExpand({ className, overlayClassName, showCloseButton = true, closeLabel = texts.close, children, ...props }) {
|
|
150
|
+
const { isOpen, uniqueId, triggerRef, setOpen } = useExpandedCard();
|
|
151
|
+
const panelRef = useRef(null);
|
|
152
|
+
const [isMounted, setMounted] = useState(false);
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
setMounted(true);
|
|
155
|
+
}, []);
|
|
156
|
+
useEffect(() => {
|
|
157
|
+
if (!isOpen) return;
|
|
158
|
+
/**
|
|
159
|
+
* Escape закрывает окно
|
|
160
|
+
* @param event - событие клавиатуры
|
|
161
|
+
*/
|
|
162
|
+
const handleEscape = (event) => {
|
|
163
|
+
if (event.key === "Escape") setOpen(false);
|
|
164
|
+
};
|
|
165
|
+
const trigger = triggerRef.current;
|
|
166
|
+
const blockedElements = [];
|
|
167
|
+
for (const element of document.body.children) {
|
|
168
|
+
const slot = element.getAttribute("data-slot");
|
|
169
|
+
if (slot === "expanded-card-overlay" || slot === "expanded-card-window") continue;
|
|
170
|
+
if (!element.hasAttribute("inert")) {
|
|
171
|
+
element.setAttribute("inert", "");
|
|
172
|
+
blockedElements.push(element);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
lockBodyScroll();
|
|
176
|
+
document.addEventListener("keydown", handleEscape);
|
|
177
|
+
panelRef.current?.focus({ preventScroll: true });
|
|
178
|
+
return () => {
|
|
179
|
+
for (const element of blockedElements) element.removeAttribute("inert");
|
|
180
|
+
unlockBodyScroll();
|
|
181
|
+
trigger?.focus({ preventScroll: true });
|
|
182
|
+
document.removeEventListener("keydown", handleEscape);
|
|
183
|
+
};
|
|
184
|
+
}, [isOpen]);
|
|
185
|
+
if (!isMounted) return null;
|
|
186
|
+
const overlayClasses = cn("fixed", "inset-0", "z-50", "bg-black/10", "supports-backdrop-filter:backdrop-blur-xs", overlayClassName);
|
|
187
|
+
const bodyClasses = cn("pointer-events-auto", "max-h-[calc(100dvh-2rem)]", "w-full", "overflow-y-auto", "outline-none", className);
|
|
188
|
+
return createPortal(/* @__PURE__ */ jsxs(AnimatePresence, {
|
|
189
|
+
initial: false,
|
|
190
|
+
mode: "sync",
|
|
191
|
+
children: [isOpen && /* @__PURE__ */ jsx(motion.div, {
|
|
192
|
+
"data-slot": "expanded-card-overlay",
|
|
193
|
+
className: overlayClasses,
|
|
194
|
+
initial: { opacity: 0 },
|
|
195
|
+
animate: {
|
|
196
|
+
opacity: 1,
|
|
197
|
+
pointerEvents: "auto"
|
|
198
|
+
},
|
|
199
|
+
exit: {
|
|
200
|
+
opacity: 0,
|
|
201
|
+
pointerEvents: "none"
|
|
202
|
+
},
|
|
203
|
+
transition: { duration: .2 },
|
|
204
|
+
onClick: () => setOpen(false)
|
|
205
|
+
}, "overlay"), isOpen && /* @__PURE__ */ jsx("div", {
|
|
206
|
+
"data-slot": "expanded-card-window",
|
|
207
|
+
className: "pointer-events-none fixed inset-0 z-50 flex items-center justify-center p-4",
|
|
208
|
+
children: /* @__PURE__ */ jsxs(ExpandedCardPresence, {
|
|
209
|
+
className: "relative w-full max-w-2xl",
|
|
210
|
+
children: [/* @__PURE__ */ jsx(ExpandedViewContext.Provider, {
|
|
211
|
+
value: true,
|
|
212
|
+
children: /* @__PURE__ */ jsx(ExpandedCardBody, {
|
|
213
|
+
ref: panelRef,
|
|
214
|
+
role: "dialog",
|
|
215
|
+
"aria-modal": true,
|
|
216
|
+
"aria-labelledby": `${uniqueId}-title`,
|
|
217
|
+
tabIndex: -1,
|
|
218
|
+
className: bodyClasses,
|
|
219
|
+
...props,
|
|
220
|
+
children
|
|
221
|
+
})
|
|
222
|
+
}), showCloseButton && /* @__PURE__ */ jsx(ExpandedCardClose, { label: closeLabel })]
|
|
223
|
+
})
|
|
224
|
+
}, "window")]
|
|
225
|
+
}), document.body);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Обёртка окна: пока оно закрывается (идёт анимация выхода), клики проходят сквозь него,
|
|
229
|
+
* поэтому карточку можно открыть снова, не дожидаясь конца анимации
|
|
230
|
+
* @param props - пропсы обёртки
|
|
231
|
+
* @param props.className - классы обёртки
|
|
232
|
+
* @param props.children - содержимое окна
|
|
233
|
+
* @returns обёртка окна
|
|
234
|
+
*/
|
|
235
|
+
function ExpandedCardPresence({ className, children }) {
|
|
236
|
+
const isPresent = useIsPresent();
|
|
237
|
+
const classes = cn(className, !isPresent && ["*:pointer-events-none", "**:pointer-events-none"]);
|
|
238
|
+
return /* @__PURE__ */ jsx("div", {
|
|
239
|
+
className: classes,
|
|
240
|
+
children
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Кнопка закрытия в углу окна
|
|
245
|
+
* @param props - подпись кнопки
|
|
246
|
+
* @param props.label - подпись для скринридера
|
|
247
|
+
* @returns кнопка закрытия
|
|
248
|
+
*/
|
|
249
|
+
function ExpandedCardClose({ label }) {
|
|
250
|
+
const { setOpen } = useExpandedCard();
|
|
251
|
+
return /* @__PURE__ */ jsx(motion.div, {
|
|
252
|
+
"data-slot": "expanded-card-close",
|
|
253
|
+
className: "pointer-events-auto absolute top-2 right-2 z-10",
|
|
254
|
+
initial: { opacity: 0 },
|
|
255
|
+
animate: { opacity: 1 },
|
|
256
|
+
exit: {
|
|
257
|
+
opacity: 0,
|
|
258
|
+
transition: { duration: .1 }
|
|
259
|
+
},
|
|
260
|
+
transition: {
|
|
261
|
+
duration: .2,
|
|
262
|
+
delay: .2
|
|
263
|
+
},
|
|
264
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
265
|
+
variant: "ghost",
|
|
266
|
+
size: "icon-sm",
|
|
267
|
+
"aria-label": label,
|
|
268
|
+
className: "rounded-full bg-background/50 text-foreground/60 hover:bg-background/70",
|
|
269
|
+
onClick: () => setOpen(false),
|
|
270
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
271
|
+
})
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Заголовок: при раскрытии плавно переезжает на своё место в окне
|
|
276
|
+
* @param props - пропсы заголовка
|
|
277
|
+
* @returns заголовок
|
|
278
|
+
*/
|
|
279
|
+
function ExpandedCardTitle({ className, ...props }) {
|
|
280
|
+
const { uniqueId } = useExpandedCard();
|
|
281
|
+
const id = useContext(ExpandedViewContext) ? `${uniqueId}-title` : void 0;
|
|
282
|
+
const classes = cn("mt-2", "px-4", "text-lg", "leading-6", "font-semibold", "tracking-tight", className);
|
|
283
|
+
return /* @__PURE__ */ jsx(motion.h2, {
|
|
284
|
+
"data-slot": "expanded-card-title",
|
|
285
|
+
id,
|
|
286
|
+
layout: "position",
|
|
287
|
+
layoutId: `expanded-card-title-${uniqueId}`,
|
|
288
|
+
className: classes,
|
|
289
|
+
...props
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Описание: при раскрытии плавно переезжает на своё место в окне
|
|
294
|
+
* @param props - пропсы описания
|
|
295
|
+
* @returns описание
|
|
296
|
+
*/
|
|
297
|
+
function ExpandedCardDescription({ className, ...props }) {
|
|
298
|
+
const { uniqueId } = useExpandedCard();
|
|
299
|
+
const classes = cn("px-4", "text-sm", "text-muted-foreground", className);
|
|
300
|
+
return /* @__PURE__ */ jsx(motion.p, {
|
|
301
|
+
"data-slot": "expanded-card-description",
|
|
302
|
+
layout: "position",
|
|
303
|
+
layoutId: `expanded-card-description-${uniqueId}`,
|
|
304
|
+
className: classes,
|
|
305
|
+
...props
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Изображение карточки: на всю ширину, обрезается сверху
|
|
310
|
+
* @param props - пропсы изображения
|
|
311
|
+
* @returns изображение
|
|
312
|
+
*/
|
|
313
|
+
function ExpandedCardImage({ className, alt = "", ...props }) {
|
|
314
|
+
const classes = cn("h-full", "w-full", "object-cover", "object-top", className);
|
|
315
|
+
return /* @__PURE__ */ jsx("img", {
|
|
316
|
+
"data-slot": "expanded-card-image",
|
|
317
|
+
alt,
|
|
318
|
+
className: classes,
|
|
319
|
+
...props
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Содержимое, которое видно только в раскрытом окне: появляется с небольшой задержкой
|
|
324
|
+
* @param props - пропсы содержимого
|
|
325
|
+
* @returns содержимое
|
|
326
|
+
*/
|
|
327
|
+
function ExpandedCardContent({ className, ...props }) {
|
|
328
|
+
const classes = cn("overflow-hidden", "p-4", className);
|
|
329
|
+
return /* @__PURE__ */ jsx(motion.div, {
|
|
330
|
+
"data-slot": "expanded-card-content",
|
|
331
|
+
className: classes,
|
|
332
|
+
initial: {
|
|
333
|
+
opacity: 0,
|
|
334
|
+
y: 6
|
|
335
|
+
},
|
|
336
|
+
animate: {
|
|
337
|
+
opacity: 1,
|
|
338
|
+
y: 0
|
|
339
|
+
},
|
|
340
|
+
exit: {
|
|
341
|
+
opacity: 0,
|
|
342
|
+
y: 6
|
|
343
|
+
},
|
|
344
|
+
transition: {
|
|
345
|
+
ease: "easeIn",
|
|
346
|
+
duration: .3,
|
|
347
|
+
delay: .2
|
|
348
|
+
},
|
|
349
|
+
...props
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
export { ExpandedCard, ExpandedCardBody, ExpandedCardContent, ExpandedCardDescription, ExpandedCardExpand, ExpandedCardImage, ExpandedCardTitle };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ExpandedCardBodyPropsT, ExpandedCardContentPropsT, ExpandedCardDescriptionPropsT, ExpandedCardExpandPropsT, ExpandedCardImagePropsT, ExpandedCardPropsT, ExpandedCardTitlePropsT } from "./types.js";
|
|
2
|
+
import { ExpandedCard, ExpandedCardBody, ExpandedCardContent, ExpandedCardDescription, ExpandedCardExpand, ExpandedCardImage, ExpandedCardTitle } from "./expanded-card.js";
|
|
3
|
+
export { ExpandedCard, ExpandedCardBody, type ExpandedCardBodyPropsT, ExpandedCardContent, type ExpandedCardContentPropsT, ExpandedCardDescription, type ExpandedCardDescriptionPropsT, ExpandedCardExpand, type ExpandedCardExpandPropsT, ExpandedCardImage, type ExpandedCardImagePropsT, type ExpandedCardPropsT, ExpandedCardTitle, type ExpandedCardTitlePropsT };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ExpandedCard, ExpandedCardBody, ExpandedCardContent, ExpandedCardDescription, ExpandedCardExpand, ExpandedCardImage, ExpandedCardTitle } from "./expanded-card.js";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode, RefObject } from "react";
|
|
2
|
+
import { Transition } from "motion/react";
|
|
3
|
+
/**
|
|
4
|
+
* Пропсы карточки
|
|
5
|
+
*/
|
|
6
|
+
export type ExpandedCardPropsT = {
|
|
7
|
+
/** Раскрыта ли карточка (контролируемый режим) */
|
|
8
|
+
open?: boolean;
|
|
9
|
+
/** Раскрыта ли карточка при первом рендере (неконтролируемый режим) */
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
/** Карточку раскрыли или закрыли */
|
|
12
|
+
onOpenChange?: (open: boolean) => void;
|
|
13
|
+
/** Анимация раскрытия: параметры motion, например { type: 'spring', duration: 0.6 } */
|
|
14
|
+
transition?: Transition;
|
|
15
|
+
/** Свёрнутая карточка и окно раскрытия */
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Пропсы карточки-тела без обработчиков, которые у motion имеют другие типы
|
|
20
|
+
*/
|
|
21
|
+
export type MotionDivPropsT = Omit<ComponentProps<'div'>, 'onDrag' | 'onDragStart' | 'onDragEnd' | 'onAnimationStart' | 'style'>;
|
|
22
|
+
/**
|
|
23
|
+
* Пропсы тела карточки
|
|
24
|
+
*/
|
|
25
|
+
export type ExpandedCardBodyPropsT = MotionDivPropsT;
|
|
26
|
+
/**
|
|
27
|
+
* Пропсы окна раскрытия
|
|
28
|
+
*/
|
|
29
|
+
export type ExpandedCardExpandPropsT = MotionDivPropsT & {
|
|
30
|
+
/** Классы затемнения под окном */
|
|
31
|
+
overlayClassName?: string;
|
|
32
|
+
/** Показывать ли кнопку закрытия */
|
|
33
|
+
showCloseButton?: boolean;
|
|
34
|
+
/** Подпись кнопки закрытия для скринридера и подсказки, по умолчанию «Закрыть» */
|
|
35
|
+
closeLabel?: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Пропсы заголовка карточки
|
|
39
|
+
*/
|
|
40
|
+
export type ExpandedCardTitlePropsT = Omit<ComponentProps<'h2'>, 'onDrag' | 'onDragStart' | 'onDragEnd' | 'onAnimationStart' | 'style'>;
|
|
41
|
+
/**
|
|
42
|
+
* Пропсы описания карточки
|
|
43
|
+
*/
|
|
44
|
+
export type ExpandedCardDescriptionPropsT = Omit<ComponentProps<'p'>, 'onDrag' | 'onDragStart' | 'onDragEnd' | 'onAnimationStart' | 'style'>;
|
|
45
|
+
/**
|
|
46
|
+
* Пропсы изображения карточки
|
|
47
|
+
*/
|
|
48
|
+
export type ExpandedCardImagePropsT = ComponentProps<'img'>;
|
|
49
|
+
/**
|
|
50
|
+
* Пропсы содержимого окна
|
|
51
|
+
*/
|
|
52
|
+
export type ExpandedCardContentPropsT = MotionDivPropsT;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { FieldContentPropsT, FieldDescriptionPropsT, FieldErrorPropsT, FieldGroupPropsT, FieldLabelPropsT, FieldLegendPropsT, FieldPropsT, FieldSeparatorPropsT, FieldSetPropsT, FieldTitlePropsT } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Набор полей: fieldset с заголовком FieldLegend
|
|
4
|
+
* @param props - пропсы набора
|
|
5
|
+
* @returns fieldset
|
|
6
|
+
*/
|
|
7
|
+
export declare function FieldSet({ className, ...props }: FieldSetPropsT): import("react").JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* Заголовок набора полей
|
|
10
|
+
* @param props - пропсы заголовка
|
|
11
|
+
* @returns legend
|
|
12
|
+
*/
|
|
13
|
+
export declare function FieldLegend({ className, variant, ...props }: FieldLegendPropsT): import("react").JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* Группа полей: столбик полей с отступами; контейнер для orientation="responsive"
|
|
16
|
+
* @param props - пропсы группы
|
|
17
|
+
* @returns div
|
|
18
|
+
*/
|
|
19
|
+
export declare function FieldGroup({ className, ...props }: FieldGroupPropsT): import("react").JSX.Element;
|
|
20
|
+
/**
|
|
21
|
+
* Поле формы: подпись, элемент управления, описание и ошибка.
|
|
22
|
+
* data-invalid={true} красит поле в цвет ошибки, data-disabled={true} приглушает подпись
|
|
23
|
+
* @param props - пропсы поля
|
|
24
|
+
* @returns div с role="group"
|
|
25
|
+
*/
|
|
26
|
+
export declare function Field({ className, orientation, ...props }: FieldPropsT): import("react").JSX.Element;
|
|
27
|
+
/**
|
|
28
|
+
* Содержимое поля: подпись и описание столбиком рядом с флажком или переключателем
|
|
29
|
+
* @param props - пропсы содержимого
|
|
30
|
+
* @returns div
|
|
31
|
+
*/
|
|
32
|
+
export declare function FieldContent({ className, ...props }: FieldContentPropsT): import("react").JSX.Element;
|
|
33
|
+
/**
|
|
34
|
+
* Подпись поля. С Field внутри становится карточкой выбора
|
|
35
|
+
* @param props - пропсы подписи
|
|
36
|
+
* @returns label
|
|
37
|
+
*/
|
|
38
|
+
export declare function FieldLabel({ className, ...props }: FieldLabelPropsT): import("react").JSX.Element;
|
|
39
|
+
/**
|
|
40
|
+
* Заголовок поля: как подпись, но не label — для карточек выбора
|
|
41
|
+
* @param props - пропсы заголовка
|
|
42
|
+
* @returns div
|
|
43
|
+
*/
|
|
44
|
+
export declare function FieldTitle({ className, ...props }: FieldTitlePropsT): import("react").JSX.Element;
|
|
45
|
+
/**
|
|
46
|
+
* Описание поля: подсказка серым текстом
|
|
47
|
+
* @param props - пропсы описания
|
|
48
|
+
* @returns p
|
|
49
|
+
*/
|
|
50
|
+
export declare function FieldDescription({ className, ...props }: FieldDescriptionPropsT): import("react").JSX.Element;
|
|
51
|
+
/**
|
|
52
|
+
* Разделитель полей: линия, при необходимости с текстом посередине
|
|
53
|
+
* @param props - пропсы разделителя
|
|
54
|
+
* @returns div
|
|
55
|
+
*/
|
|
56
|
+
export declare function FieldSeparator({ children, className, ...props }: FieldSeparatorPropsT): import("react").JSX.Element;
|
|
57
|
+
/**
|
|
58
|
+
* Ошибка поля: красный текст под элементом управления, озвучивается сразу
|
|
59
|
+
* @param props - пропсы ошибки
|
|
60
|
+
* @returns div с role="alert" или null, если ошибок нет
|
|
61
|
+
*/
|
|
62
|
+
export declare function FieldError({ className, children, errors, ...props }: FieldErrorPropsT): import("react").JSX.Element | null;
|
|
@@ -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 };
|