@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,294 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { texts } from "../../lib/locale.js";
|
|
4
|
+
import { getMasonryLayout } from "./masonry.js";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
7
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
8
|
+
import { createPortal } from "react-dom";
|
|
9
|
+
// src/components/image-gallery/image-gallery.tsx
|
|
10
|
+
const DEFAULT_OPEN_LABEL = "Открыть изображение";
|
|
11
|
+
const LAZY_MARGIN = 500;
|
|
12
|
+
const MOBILE_WIDTH = 480;
|
|
13
|
+
const TABLET_WIDTH = 768;
|
|
14
|
+
const FALLBACK_RATIOS = [
|
|
15
|
+
.75,
|
|
16
|
+
1,
|
|
17
|
+
1.5,
|
|
18
|
+
2
|
|
19
|
+
];
|
|
20
|
+
const morphTransition = {
|
|
21
|
+
type: "spring",
|
|
22
|
+
stiffness: 120,
|
|
23
|
+
damping: 15
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Изображению без размеров подставляет размеры по номеру, чтобы раскладка была стабильной
|
|
27
|
+
* @param image - изображение
|
|
28
|
+
* @param index - номер в списке
|
|
29
|
+
* @returns изображение с размерами
|
|
30
|
+
*/
|
|
31
|
+
function withDimensions(image, index) {
|
|
32
|
+
if (image.width && image.height) return image;
|
|
33
|
+
const ratio = FALLBACK_RATIOS[index % FALLBACK_RATIOS.length] ?? 1;
|
|
34
|
+
return {
|
|
35
|
+
...image,
|
|
36
|
+
width: 800,
|
|
37
|
+
height: Math.round(800 / ratio)
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Скругление элемента в px из его классов. motion сохраняет скругление при анимации
|
|
42
|
+
* размера, только если оно задано числом в style, иначе углы сжимаются вместе с картинкой
|
|
43
|
+
* @param ref - элемент, у которого берётся скругление
|
|
44
|
+
* @returns скругление в px или undefined до измерения
|
|
45
|
+
*/
|
|
46
|
+
function useBorderRadius(ref) {
|
|
47
|
+
const [radius, setRadius] = useState();
|
|
48
|
+
useLayoutEffect(() => {
|
|
49
|
+
if (ref.current) setRadius(parseFloat(getComputedStyle(ref.current).borderTopLeftRadius));
|
|
50
|
+
}, [ref]);
|
|
51
|
+
return radius;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Число колонок по ширине галереи
|
|
55
|
+
* @param width - ширина контейнера, px
|
|
56
|
+
* @param columns - число колонок для разной ширины
|
|
57
|
+
* @returns число колонок
|
|
58
|
+
*/
|
|
59
|
+
function getColumnCount(width, columns = {}) {
|
|
60
|
+
if (width < MOBILE_WIDTH) return columns.mobile ?? 1;
|
|
61
|
+
if (width < TABLET_WIDTH) return columns.tablet ?? 2;
|
|
62
|
+
return columns.desktop ?? 3;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Галерея изображений: сетка «кирпичной кладки» с ленивой загрузкой.
|
|
66
|
+
* Нажатие на изображение плавно увеличивает его поверх страницы
|
|
67
|
+
* @param props - пропсы галереи
|
|
68
|
+
* @returns контейнер с плитками и просмотром изображения
|
|
69
|
+
*/
|
|
70
|
+
function ImageGallery({ images, gap = 16, columns, lazyLoading = true, filterImages, sortImages, onImageClick, openLabel = DEFAULT_OPEN_LABEL, closeLabel = texts.close, itemClassName, viewerClassName, backdropClassName, className, style, ref, ...props }) {
|
|
71
|
+
const galleryId = useId();
|
|
72
|
+
const containerRef = useRef(null);
|
|
73
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
74
|
+
const [activeIndex, setActiveIndex] = useState(null);
|
|
75
|
+
const visibleImages = useMemo(() => {
|
|
76
|
+
let result = images.map(withDimensions);
|
|
77
|
+
if (filterImages) result = result.filter(filterImages);
|
|
78
|
+
if (sortImages) result = result.sort(sortImages);
|
|
79
|
+
return result;
|
|
80
|
+
}, [
|
|
81
|
+
images,
|
|
82
|
+
filterImages,
|
|
83
|
+
sortImages
|
|
84
|
+
]);
|
|
85
|
+
const columnCount = getColumnCount(containerWidth, columns);
|
|
86
|
+
const layout = useMemo(() => getMasonryLayout(visibleImages, containerWidth, columnCount, gap), [
|
|
87
|
+
visibleImages,
|
|
88
|
+
containerWidth,
|
|
89
|
+
columnCount,
|
|
90
|
+
gap
|
|
91
|
+
]);
|
|
92
|
+
const activeImage = activeIndex === null ? void 0 : visibleImages[activeIndex];
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
const container = containerRef.current;
|
|
95
|
+
if (!container) return;
|
|
96
|
+
const observer = new ResizeObserver(() => setContainerWidth(container.clientWidth));
|
|
97
|
+
setContainerWidth(container.clientWidth);
|
|
98
|
+
observer.observe(container);
|
|
99
|
+
return () => observer.disconnect();
|
|
100
|
+
}, []);
|
|
101
|
+
/**
|
|
102
|
+
* Элемент галереи: для измерения ширины и наружу
|
|
103
|
+
* @param node - элемент или null при размонтировании
|
|
104
|
+
*/
|
|
105
|
+
const setRef = (node) => {
|
|
106
|
+
containerRef.current = node;
|
|
107
|
+
if (typeof ref === "function") {
|
|
108
|
+
ref(node);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (ref) ref.current = node;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Нажатие на плитку: открыть изображение и сообщить наружу
|
|
115
|
+
* @param item - плитка
|
|
116
|
+
*/
|
|
117
|
+
const handleItemClick = (item) => {
|
|
118
|
+
setActiveIndex(item.index);
|
|
119
|
+
onImageClick?.(item.image, item.index);
|
|
120
|
+
};
|
|
121
|
+
const closeViewer = () => setActiveIndex(null);
|
|
122
|
+
const rootStyle = {
|
|
123
|
+
height: layout.height,
|
|
124
|
+
...style
|
|
125
|
+
};
|
|
126
|
+
const classes = cn("relative", "w-full", className);
|
|
127
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
128
|
+
"data-slot": "image-gallery",
|
|
129
|
+
ref: setRef,
|
|
130
|
+
className: classes,
|
|
131
|
+
style: rootStyle,
|
|
132
|
+
...props,
|
|
133
|
+
children: [layout.items.map((item) => /* @__PURE__ */ jsx(ImageGalleryItem, {
|
|
134
|
+
item,
|
|
135
|
+
layoutId: `${galleryId}-${item.index}`,
|
|
136
|
+
lazyLoading,
|
|
137
|
+
openLabel,
|
|
138
|
+
className: itemClassName,
|
|
139
|
+
onOpen: handleItemClick
|
|
140
|
+
}, `${item.image.src}-${item.index}`)), /* @__PURE__ */ jsx(ImageGalleryViewer, {
|
|
141
|
+
image: activeImage,
|
|
142
|
+
layoutId: `${galleryId}-${activeIndex}`,
|
|
143
|
+
closeLabel,
|
|
144
|
+
className: viewerClassName,
|
|
145
|
+
backdropClassName,
|
|
146
|
+
onClose: closeViewer
|
|
147
|
+
})]
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Плитка галереи: кнопка с изображением, пока изображение не загружено — заглушка
|
|
152
|
+
* @param props - пропсы плитки
|
|
153
|
+
* @returns кнопка открытия изображения
|
|
154
|
+
*/
|
|
155
|
+
function ImageGalleryItem({ item, layoutId, lazyLoading, openLabel, className, onOpen }) {
|
|
156
|
+
const buttonRef = useRef(null);
|
|
157
|
+
const [isNear, setIsNear] = useState(false);
|
|
158
|
+
const isLoaded = !lazyLoading || isNear;
|
|
159
|
+
const radius = useBorderRadius(buttonRef);
|
|
160
|
+
useEffect(() => {
|
|
161
|
+
const button = buttonRef.current;
|
|
162
|
+
if (!lazyLoading || !button) return;
|
|
163
|
+
const observer = new IntersectionObserver((entries) => {
|
|
164
|
+
if (entries.some((entry) => entry.isIntersecting)) {
|
|
165
|
+
setIsNear(true);
|
|
166
|
+
observer.disconnect();
|
|
167
|
+
}
|
|
168
|
+
}, { rootMargin: `${LAZY_MARGIN}px` });
|
|
169
|
+
observer.observe(button);
|
|
170
|
+
return () => observer.disconnect();
|
|
171
|
+
}, [lazyLoading]);
|
|
172
|
+
const classes = cn("group/image-gallery-item", "absolute", "block", "cursor-zoom-in", "rounded-lg", "outline-none", "focus-visible:border-ring", "focus-visible:ring-3", "focus-visible:ring-ring/50", !isLoaded && ["animate-pulse", "bg-muted"], className);
|
|
173
|
+
const buttonStyle = {
|
|
174
|
+
left: item.x,
|
|
175
|
+
top: item.y,
|
|
176
|
+
width: item.width,
|
|
177
|
+
height: item.height
|
|
178
|
+
};
|
|
179
|
+
return /* @__PURE__ */ jsx("button", {
|
|
180
|
+
"data-slot": "image-gallery-item",
|
|
181
|
+
ref: buttonRef,
|
|
182
|
+
type: "button",
|
|
183
|
+
"aria-label": `${openLabel}: ${item.image.alt}`,
|
|
184
|
+
className: classes,
|
|
185
|
+
style: buttonStyle,
|
|
186
|
+
onClick: () => onOpen(item),
|
|
187
|
+
children: isLoaded && /* @__PURE__ */ jsx(motion.img, {
|
|
188
|
+
"data-slot": "image-gallery-image",
|
|
189
|
+
layoutId,
|
|
190
|
+
src: item.image.src,
|
|
191
|
+
alt: "",
|
|
192
|
+
draggable: false,
|
|
193
|
+
transition: morphTransition,
|
|
194
|
+
className: "size-full rounded-[inherit] object-cover object-center",
|
|
195
|
+
style: { borderRadius: radius }
|
|
196
|
+
})
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Просмотр: затемнение и увеличенное изображение поверх страницы. Закрывается
|
|
201
|
+
* нажатием, клавишей Escape; прокрутка страницы блокируется
|
|
202
|
+
* @param props - пропсы просмотра
|
|
203
|
+
* @returns портал с затемнением и изображением
|
|
204
|
+
*/
|
|
205
|
+
function ImageGalleryViewer({ image, layoutId, closeLabel, className, backdropClassName, onClose }) {
|
|
206
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
207
|
+
const isOpen = image !== void 0;
|
|
208
|
+
useEffect(() => {
|
|
209
|
+
setIsMounted(true);
|
|
210
|
+
}, []);
|
|
211
|
+
useEffect(() => {
|
|
212
|
+
if (!isOpen) return;
|
|
213
|
+
const handleKeyDown = (event) => {
|
|
214
|
+
if (event.key === "Escape") onClose();
|
|
215
|
+
};
|
|
216
|
+
const previousOverflow = document.body.style.overflow;
|
|
217
|
+
const previousFocus = document.activeElement;
|
|
218
|
+
const blockedElements = [];
|
|
219
|
+
for (const element of document.body.children) {
|
|
220
|
+
const slot = element.getAttribute("data-slot");
|
|
221
|
+
if (slot === "image-gallery-backdrop" || slot === "image-gallery-viewer") continue;
|
|
222
|
+
if (!element.hasAttribute("inert")) {
|
|
223
|
+
element.setAttribute("inert", "");
|
|
224
|
+
blockedElements.push(element);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
document.body.style.overflow = "hidden";
|
|
228
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
229
|
+
document.querySelector("[data-slot=\"image-gallery-viewer\"]")?.focus({ preventScroll: true });
|
|
230
|
+
return () => {
|
|
231
|
+
for (const element of blockedElements) element.removeAttribute("inert");
|
|
232
|
+
document.body.style.overflow = previousOverflow;
|
|
233
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
234
|
+
if (previousFocus instanceof HTMLElement) previousFocus.focus({ preventScroll: true });
|
|
235
|
+
};
|
|
236
|
+
}, [isOpen, onClose]);
|
|
237
|
+
if (!isMounted) return null;
|
|
238
|
+
const backdropClasses = cn("fixed", "inset-0", "z-50", "cursor-zoom-out", "bg-black/80", backdropClassName);
|
|
239
|
+
const imageClasses = cn("pointer-events-auto", "max-h-[90vh]", "max-w-[90vw]", "cursor-zoom-out", "rounded-lg", "object-cover", "object-center", className);
|
|
240
|
+
return createPortal(/* @__PURE__ */ jsx(AnimatePresence, { children: image && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(motion.button, {
|
|
241
|
+
"data-slot": "image-gallery-backdrop",
|
|
242
|
+
type: "button",
|
|
243
|
+
"aria-label": closeLabel,
|
|
244
|
+
tabIndex: -1,
|
|
245
|
+
className: backdropClasses,
|
|
246
|
+
initial: { opacity: 0 },
|
|
247
|
+
animate: {
|
|
248
|
+
opacity: 1,
|
|
249
|
+
pointerEvents: "auto"
|
|
250
|
+
},
|
|
251
|
+
exit: {
|
|
252
|
+
opacity: 0,
|
|
253
|
+
pointerEvents: "none"
|
|
254
|
+
},
|
|
255
|
+
transition: { duration: .3 },
|
|
256
|
+
onClick: onClose
|
|
257
|
+
}, "backdrop"), /* @__PURE__ */ jsx("div", {
|
|
258
|
+
"data-slot": "image-gallery-viewer",
|
|
259
|
+
role: "dialog",
|
|
260
|
+
"aria-modal": true,
|
|
261
|
+
"aria-label": image.alt,
|
|
262
|
+
tabIndex: -1,
|
|
263
|
+
className: "pointer-events-none fixed inset-0 z-50 flex items-center justify-center outline-none",
|
|
264
|
+
children: /* @__PURE__ */ jsx(ImageGalleryViewerImage, {
|
|
265
|
+
image,
|
|
266
|
+
layoutId,
|
|
267
|
+
className: imageClasses,
|
|
268
|
+
onClose
|
|
269
|
+
})
|
|
270
|
+
}, layoutId)] }) }), document.body);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Увеличенное изображение: прилетает из плитки и улетает обратно, сохраняя скругление
|
|
274
|
+
* @param props - пропсы изображения
|
|
275
|
+
* @returns изображение
|
|
276
|
+
*/
|
|
277
|
+
function ImageGalleryViewerImage({ image, layoutId, className, onClose }) {
|
|
278
|
+
const imageRef = useRef(null);
|
|
279
|
+
const radius = useBorderRadius(imageRef);
|
|
280
|
+
return /* @__PURE__ */ jsx(motion.img, {
|
|
281
|
+
"data-slot": "image-gallery-viewer-image",
|
|
282
|
+
ref: imageRef,
|
|
283
|
+
layoutId,
|
|
284
|
+
src: image.src,
|
|
285
|
+
alt: image.alt,
|
|
286
|
+
animate: { pointerEvents: "auto" },
|
|
287
|
+
exit: { pointerEvents: "none" },
|
|
288
|
+
transition: morphTransition,
|
|
289
|
+
className,
|
|
290
|
+
style: { borderRadius: radius },
|
|
291
|
+
onClick: onClose
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
export { ImageGallery };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ImageGalleryColumnsI, ImageGalleryImageI, ImageGalleryPropsT, MasonryItemI, MasonryLayoutI } from "./types.js";
|
|
2
|
+
import { ImageGallery } from "./image-gallery.js";
|
|
3
|
+
import { getMasonryLayout } from "./masonry.js";
|
|
4
|
+
export { ImageGallery, type ImageGalleryColumnsI, type ImageGalleryImageI, type ImageGalleryPropsT, type MasonryItemI, type MasonryLayoutI, getMasonryLayout };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ImageGalleryImageI, MasonryLayoutI } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Раскладка «кирпичной кладки»: каждое изображение идёт в самую низкую колонку,
|
|
4
|
+
* затем плитки колонки растягиваются так, чтобы все колонки закончились на одной высоте
|
|
5
|
+
* @param images - изображения
|
|
6
|
+
* @param containerWidth - ширина контейнера, px
|
|
7
|
+
* @param columnCount - число колонок
|
|
8
|
+
* @param gap - промежуток между плитками, px
|
|
9
|
+
* @returns плитки с позициями и общая высота
|
|
10
|
+
*/
|
|
11
|
+
export declare function getMasonryLayout(images: ImageGalleryImageI[], containerWidth: number, columnCount: number, gap: number): MasonryLayoutI;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// src/components/image-gallery/masonry.ts
|
|
2
|
+
/**
|
|
3
|
+
* Пропорции изображения: ширина к высоте, квадрат, если размеры не заданы
|
|
4
|
+
* @param image - изображение
|
|
5
|
+
* @returns отношение ширины к высоте
|
|
6
|
+
*/
|
|
7
|
+
function getAspectRatio(image) {
|
|
8
|
+
if (image.width && image.height) return image.width / image.height;
|
|
9
|
+
return 1;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Раскладка «кирпичной кладки»: каждое изображение идёт в самую низкую колонку,
|
|
13
|
+
* затем плитки колонки растягиваются так, чтобы все колонки закончились на одной высоте
|
|
14
|
+
* @param images - изображения
|
|
15
|
+
* @param containerWidth - ширина контейнера, px
|
|
16
|
+
* @param columnCount - число колонок
|
|
17
|
+
* @param gap - промежуток между плитками, px
|
|
18
|
+
* @returns плитки с позициями и общая высота
|
|
19
|
+
*/
|
|
20
|
+
function getMasonryLayout(images, containerWidth, columnCount, gap) {
|
|
21
|
+
if (containerWidth <= 0 || images.length === 0 || columnCount < 1) return {
|
|
22
|
+
items: [],
|
|
23
|
+
height: 0
|
|
24
|
+
};
|
|
25
|
+
const columnWidth = (containerWidth - gap * (columnCount - 1)) / columnCount;
|
|
26
|
+
const columnHeights = Array.from({ length: columnCount }, () => 0);
|
|
27
|
+
const columns = Array.from({ length: columnCount }, () => []);
|
|
28
|
+
images.forEach((image, index) => {
|
|
29
|
+
const columnIndex = columnHeights.indexOf(Math.min(...columnHeights));
|
|
30
|
+
columnHeights[columnIndex] = (columnHeights[columnIndex] ?? 0) + columnWidth / getAspectRatio(image) + gap;
|
|
31
|
+
columns[columnIndex]?.push({
|
|
32
|
+
image,
|
|
33
|
+
index
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
const totalHeight = Math.max(...columnHeights) - gap;
|
|
37
|
+
const items = [];
|
|
38
|
+
columns.forEach((column, columnIndex) => {
|
|
39
|
+
if (column.length === 0) return;
|
|
40
|
+
let imagesHeight = 0;
|
|
41
|
+
for (const { image } of column) imagesHeight += columnWidth / getAspectRatio(image);
|
|
42
|
+
const scale = (totalHeight - gap * (column.length - 1)) / imagesHeight;
|
|
43
|
+
let offsetY = 0;
|
|
44
|
+
for (const { image, index } of column) {
|
|
45
|
+
const height = columnWidth / getAspectRatio(image) * scale;
|
|
46
|
+
items.push({
|
|
47
|
+
image,
|
|
48
|
+
index,
|
|
49
|
+
x: columnIndex * (columnWidth + gap),
|
|
50
|
+
y: offsetY,
|
|
51
|
+
width: columnWidth,
|
|
52
|
+
height
|
|
53
|
+
});
|
|
54
|
+
offsetY += height + gap;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
items,
|
|
59
|
+
height: totalHeight
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export { getMasonryLayout };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Изображение галереи
|
|
4
|
+
* @property src - адрес изображения
|
|
5
|
+
* @property alt - описание для скринридера
|
|
6
|
+
* @property width - исходная ширина, по ней считаются пропорции плитки
|
|
7
|
+
* @property height - исходная высота, по ней считаются пропорции плитки
|
|
8
|
+
*/
|
|
9
|
+
export interface ImageGalleryImageI {
|
|
10
|
+
src: string;
|
|
11
|
+
alt: string;
|
|
12
|
+
width?: number;
|
|
13
|
+
height?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Число колонок на разной ширине галереи
|
|
17
|
+
* @property desktop - от 768px, по умолчанию 3
|
|
18
|
+
* @property tablet - от 480px до 768px, по умолчанию 2
|
|
19
|
+
* @property mobile - уже 480px, по умолчанию 1
|
|
20
|
+
*/
|
|
21
|
+
export interface ImageGalleryColumnsI {
|
|
22
|
+
desktop?: number;
|
|
23
|
+
tablet?: number;
|
|
24
|
+
mobile?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Пропсы галереи
|
|
28
|
+
*/
|
|
29
|
+
export type ImageGalleryPropsT = Omit<ComponentProps<'div'>, 'children'> & {
|
|
30
|
+
/** Изображения галереи */
|
|
31
|
+
images: ImageGalleryImageI[];
|
|
32
|
+
/** Промежуток между изображениями, px. По умолчанию 16 */
|
|
33
|
+
gap?: number;
|
|
34
|
+
/** Число колонок для узкой, средней и широкой галереи. По умолчанию 1, 2 и 3 */
|
|
35
|
+
columns?: ImageGalleryColumnsI;
|
|
36
|
+
/** Загружать изображения, только когда они приближаются к видимой области. По умолчанию включено */
|
|
37
|
+
lazyLoading?: boolean;
|
|
38
|
+
/** Показывать только подходящие изображения */
|
|
39
|
+
filterImages?: (image: ImageGalleryImageI, index: number) => boolean;
|
|
40
|
+
/** Порядок изображений */
|
|
41
|
+
sortImages?: (first: ImageGalleryImageI, second: ImageGalleryImageI) => number;
|
|
42
|
+
/** Нажатие на изображение в сетке */
|
|
43
|
+
onImageClick?: (image: ImageGalleryImageI, index: number) => void;
|
|
44
|
+
/** Подпись кнопки открытия изображения для скринридера, по умолчанию «Открыть изображение» */
|
|
45
|
+
openLabel?: string;
|
|
46
|
+
/** Подпись закрытия просмотра для скринридера, по умолчанию «Закрыть» */
|
|
47
|
+
closeLabel?: string;
|
|
48
|
+
/** Классы плитки изображения */
|
|
49
|
+
itemClassName?: string;
|
|
50
|
+
/** Классы увеличенного изображения */
|
|
51
|
+
viewerClassName?: string;
|
|
52
|
+
/** Классы затемнения под увеличенным изображением */
|
|
53
|
+
backdropClassName?: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Изображение с позицией и размером в сетке
|
|
57
|
+
* @property image - исходное изображение
|
|
58
|
+
* @property index - номер изображения в переданном списке
|
|
59
|
+
* @property x - отступ слева, px
|
|
60
|
+
* @property y - отступ сверху, px
|
|
61
|
+
* @property width - ширина плитки, px
|
|
62
|
+
* @property height - высота плитки, px
|
|
63
|
+
*/
|
|
64
|
+
export interface MasonryItemI {
|
|
65
|
+
image: ImageGalleryImageI;
|
|
66
|
+
index: number;
|
|
67
|
+
x: number;
|
|
68
|
+
y: number;
|
|
69
|
+
width: number;
|
|
70
|
+
height: number;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Раскладка сетки
|
|
74
|
+
* @property items - плитки с позициями
|
|
75
|
+
* @property height - общая высота сетки, px
|
|
76
|
+
*/
|
|
77
|
+
export interface MasonryLayoutI {
|
|
78
|
+
items: MasonryItemI[];
|
|
79
|
+
height: number;
|
|
80
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Input } from "./input.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { cn } from "../../lib/utils.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/input/input.tsx
|
|
4
|
+
/**
|
|
5
|
+
* Однострочное поле ввода
|
|
6
|
+
* @param props - пропсы поля
|
|
7
|
+
* @returns элемент input
|
|
8
|
+
*/
|
|
9
|
+
function Input({ className, type, ...props }) {
|
|
10
|
+
const classes = cn("h-8", "w-full", "min-w-0", "rounded-lg", "border", "border-input", "bg-transparent", "px-2.5", "py-1", "text-base", "transition-colors", "outline-none", "file:inline-flex", "file:h-6", "file:border-0", "file:bg-transparent", "file:text-sm", "file:font-medium", "file:text-foreground", "placeholder:text-muted-foreground", "focus-visible:border-ring", "focus-visible:ring-3", "focus-visible:ring-ring/50", "disabled:cursor-not-allowed", "disabled:bg-input/50", "disabled:opacity-50", "aria-invalid:border-destructive", "aria-invalid:ring-3", "aria-invalid:ring-destructive/20", "md:text-sm", "dark:bg-input/30", "dark:disabled:bg-input/80", "dark:aria-invalid:border-destructive/50", "dark:aria-invalid:ring-destructive/40", className);
|
|
11
|
+
return /* @__PURE__ */ jsx("input", {
|
|
12
|
+
type,
|
|
13
|
+
"data-slot": "input",
|
|
14
|
+
className: classes,
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export { Input };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ChangeEvent, ComponentProps } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Тип поля ввода: все значения атрибута type у input
|
|
4
|
+
*/
|
|
5
|
+
export type InputTypeT = 'text' | 'email' | 'password' | 'number' | 'search' | 'tel' | 'url' | 'file' | 'date' | 'datetime-local' | 'month' | 'week' | 'time' | 'color' | 'range' | 'checkbox' | 'radio' | 'hidden' | 'button' | 'submit' | 'reset' | 'image';
|
|
6
|
+
/**
|
|
7
|
+
* Пропсы поля ввода
|
|
8
|
+
*/
|
|
9
|
+
export type InputPropsT = Omit<ComponentProps<'input'>, 'type' | 'value' | 'defaultValue' | 'placeholder' | 'disabled' | 'readOnly' | 'required' | 'aria-invalid' | 'onChange'> & {
|
|
10
|
+
/** Тип поля: text, email, password, number, search, tel, url, file и другие */
|
|
11
|
+
type?: InputTypeT;
|
|
12
|
+
/** Значение поля — контролируемый режим, вместе с onChange */
|
|
13
|
+
value?: string | number;
|
|
14
|
+
/** Значение при первом рендере — неконтролируемый режим */
|
|
15
|
+
defaultValue?: string | number;
|
|
16
|
+
/** Подсказка о формате, пока поле пустое */
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
/** Отключённое состояние: поле нельзя изменить и выделить, оно не отправляется с формой */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** Только для чтения: значение видно и выделяется, но не меняется */
|
|
21
|
+
readOnly?: boolean;
|
|
22
|
+
/** Обязательное поле: форма не отправится, пока оно пустое */
|
|
23
|
+
required?: boolean;
|
|
24
|
+
/** Ошибка: красная рамка и объявление скринридеру, что значение неверное */
|
|
25
|
+
'aria-invalid'?: boolean;
|
|
26
|
+
/** Значение изменилось */
|
|
27
|
+
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
28
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { InputGroupAddonPropsT, InputGroupAlignT, InputGroupButtonPropsT, InputGroupButtonSizeT, InputGroupInputPropsT, InputGroupPropsT, InputGroupTextPropsT, InputGroupTextareaPropsT, inputGroupAddonVariants, inputGroupButtonVariants } from "./types.js";
|
|
2
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea } from "./input-group.js";
|
|
3
|
+
export { InputGroup, InputGroupAddon, type InputGroupAddonPropsT, type InputGroupAlignT, InputGroupButton, type InputGroupButtonPropsT, type InputGroupButtonSizeT, InputGroupInput, type InputGroupInputPropsT, type InputGroupPropsT, InputGroupText, type InputGroupTextPropsT, InputGroupTextarea, type InputGroupTextareaPropsT, inputGroupAddonVariants, inputGroupButtonVariants };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { inputGroupAddonVariants, inputGroupButtonVariants } from "./types.js";
|
|
2
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea } from "./input-group.js";
|
|
3
|
+
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, inputGroupAddonVariants, inputGroupButtonVariants };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { InputGroupAddonPropsT, InputGroupButtonPropsT, InputGroupInputPropsT, InputGroupPropsT, InputGroupTextPropsT, InputGroupTextareaPropsT } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Группа поля: поле ввода с иконками, текстом и кнопками внутри общей рамки
|
|
4
|
+
* @param props - пропсы группы
|
|
5
|
+
* @returns div с role="group"
|
|
6
|
+
*/
|
|
7
|
+
export declare function InputGroup({ className, ...props }: InputGroupPropsT): import("react").JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* Дополнение: иконка, текст или кнопки внутри рамки. Нажатие ставит фокус в поле
|
|
10
|
+
* @param props - пропсы дополнения
|
|
11
|
+
* @returns div с role="group"
|
|
12
|
+
*/
|
|
13
|
+
export declare function InputGroupAddon({ className, align, onClick, ...props }: InputGroupAddonPropsT): import("react").JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* Кнопка в группе: компактная, по умолчанию ghost
|
|
16
|
+
* @param props - пропсы кнопки; по умолчанию type="button", variant="ghost", size="xs"
|
|
17
|
+
* @returns кнопка
|
|
18
|
+
*/
|
|
19
|
+
export declare function InputGroupButton({ className, type, variant, size, ...props }: InputGroupButtonPropsT): import("react").JSX.Element;
|
|
20
|
+
/**
|
|
21
|
+
* Текст в группе: префикс или суффикс поля (₽, https://, @example.ru)
|
|
22
|
+
* @param props - пропсы текста
|
|
23
|
+
* @returns span
|
|
24
|
+
*/
|
|
25
|
+
export declare function InputGroupText({ className, ...props }: InputGroupTextPropsT): import("react").JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* Поле в группе: Input без своей рамки, рамку рисует группа
|
|
28
|
+
* @param props - пропсы поля
|
|
29
|
+
* @returns input
|
|
30
|
+
*/
|
|
31
|
+
export declare function InputGroupInput({ className, ...props }: InputGroupInputPropsT): import("react").JSX.Element;
|
|
32
|
+
/**
|
|
33
|
+
* Многострочное поле в группе: Textarea без своей рамки
|
|
34
|
+
* @param props - пропсы поля
|
|
35
|
+
* @returns textarea
|
|
36
|
+
*/
|
|
37
|
+
export declare function InputGroupTextarea({ className, ...props }: InputGroupTextareaPropsT): import("react").JSX.Element;
|