@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,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { loadHighlighter } from "./highlighter.js";
|
|
3
|
+
import { useEffect, useMemo, useState } from "react";
|
|
4
|
+
// src/components/code-block/use-highlighted-code.ts
|
|
5
|
+
/**
|
|
6
|
+
* Подсветить код по строкам. Пока язык загружается — строки без подсветки.
|
|
7
|
+
* При потоковом коде подсвечиваются только новые строки, начиная с состояния последней
|
|
8
|
+
* @param value - код
|
|
9
|
+
* @param language - имя языка: ts, tsx, json, bash, ansi…
|
|
10
|
+
* @returns по узлу React на строку — для CodeBlockLine
|
|
11
|
+
*/
|
|
12
|
+
function useHighlightedCode(value, language) {
|
|
13
|
+
const code = value.endsWith("\n") ? value.slice(0, -1) : value;
|
|
14
|
+
const [loaded, setLoaded] = useState(null);
|
|
15
|
+
const highlighter = loaded?.language === language ? loaded.highlighter : null;
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
let isCancelled = false;
|
|
18
|
+
/**
|
|
19
|
+
* Сохранить загруженную подсветку, если язык ещё актуален
|
|
20
|
+
* @param next - подсветка
|
|
21
|
+
*/
|
|
22
|
+
const saveHighlighter = (next) => {
|
|
23
|
+
if (!isCancelled) setLoaded({
|
|
24
|
+
language,
|
|
25
|
+
highlighter: next
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
loadHighlighter(language).then(saveHighlighter).catch(() => void 0);
|
|
29
|
+
return () => {
|
|
30
|
+
isCancelled = true;
|
|
31
|
+
};
|
|
32
|
+
}, [language]);
|
|
33
|
+
const [done, setDone] = useState({
|
|
34
|
+
highlighter: null,
|
|
35
|
+
text: "",
|
|
36
|
+
lines: []
|
|
37
|
+
});
|
|
38
|
+
let next = done;
|
|
39
|
+
if (next.highlighter !== highlighter || !code.startsWith(next.text)) next = {
|
|
40
|
+
highlighter,
|
|
41
|
+
text: "",
|
|
42
|
+
lines: []
|
|
43
|
+
};
|
|
44
|
+
const end = code.lastIndexOf("\n") + 1;
|
|
45
|
+
if (highlighter !== null && end > next.text.length) {
|
|
46
|
+
const result = highlighter.highlight(code.slice(next.text.length, end - 1), next.state);
|
|
47
|
+
next = {
|
|
48
|
+
highlighter,
|
|
49
|
+
text: code.slice(0, end),
|
|
50
|
+
lines: next.lines.concat(result.lines),
|
|
51
|
+
state: result.state
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
if (next !== done) setDone(next);
|
|
55
|
+
const tail = code.slice(end);
|
|
56
|
+
return useMemo(() => {
|
|
57
|
+
if (highlighter === null) return code.split("\n");
|
|
58
|
+
const tailLine = highlighter.highlight(tail, next.state).lines[0];
|
|
59
|
+
return next.lines.concat([tailLine]);
|
|
60
|
+
}, [
|
|
61
|
+
code,
|
|
62
|
+
highlighter,
|
|
63
|
+
next,
|
|
64
|
+
tail
|
|
65
|
+
]);
|
|
66
|
+
}
|
|
67
|
+
export { useHighlightedCode };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CollapsibleContentPropsT, CollapsiblePropsT, CollapsibleTriggerPropsT } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Раскрывающийся блок: показывает и скрывает содержимое по нажатию на переключатель
|
|
4
|
+
* @param props - пропсы блока
|
|
5
|
+
* @returns обёртка переключателя и содержимого
|
|
6
|
+
*/
|
|
7
|
+
export declare function Collapsible({ onOpenChange, ...props }: CollapsiblePropsT): import("react").JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* Переключатель: кнопка, которая раскрывает и скрывает содержимое. Свою кнопку — через render={<Button />}
|
|
10
|
+
* @param props - пропсы переключателя
|
|
11
|
+
* @returns кнопка с aria-expanded
|
|
12
|
+
*/
|
|
13
|
+
export declare function CollapsibleTrigger(props: CollapsibleTriggerPropsT): import("react").JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* Содержимое: видно, пока блок раскрыт
|
|
16
|
+
* @param props - пропсы содержимого
|
|
17
|
+
* @returns раскрываемый блок
|
|
18
|
+
*/
|
|
19
|
+
export declare function CollapsibleContent(props: CollapsibleContentPropsT): import("react").JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Collapsible } from "@base-ui/react/collapsible";
|
|
4
|
+
// src/components/collapsible/collapsible.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Раскрывающийся блок: показывает и скрывает содержимое по нажатию на переключатель
|
|
7
|
+
* @param props - пропсы блока
|
|
8
|
+
* @returns обёртка переключателя и содержимого
|
|
9
|
+
*/
|
|
10
|
+
function Collapsible$1({ onOpenChange, ...props }) {
|
|
11
|
+
/**
|
|
12
|
+
* Блок раскрыли или скрыли: наружу только флаг
|
|
13
|
+
* @param open - раскрыт ли
|
|
14
|
+
*/
|
|
15
|
+
const handleOpenChange = (open) => onOpenChange?.(open);
|
|
16
|
+
return /* @__PURE__ */ jsx(Collapsible.Root, {
|
|
17
|
+
"data-slot": "collapsible",
|
|
18
|
+
onOpenChange: handleOpenChange,
|
|
19
|
+
...props
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Переключатель: кнопка, которая раскрывает и скрывает содержимое. Свою кнопку — через render={<Button />}
|
|
24
|
+
* @param props - пропсы переключателя
|
|
25
|
+
* @returns кнопка с aria-expanded
|
|
26
|
+
*/
|
|
27
|
+
function CollapsibleTrigger(props) {
|
|
28
|
+
return /* @__PURE__ */ jsx(Collapsible.Trigger, {
|
|
29
|
+
"data-slot": "collapsible-trigger",
|
|
30
|
+
...props
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Содержимое: видно, пока блок раскрыт
|
|
35
|
+
* @param props - пропсы содержимого
|
|
36
|
+
* @returns раскрываемый блок
|
|
37
|
+
*/
|
|
38
|
+
function CollapsibleContent(props) {
|
|
39
|
+
return /* @__PURE__ */ jsx(Collapsible.Panel, {
|
|
40
|
+
"data-slot": "collapsible-content",
|
|
41
|
+
...props
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export { Collapsible$1 as Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CollapsibleContentPropsT, CollapsiblePropsT, CollapsibleTriggerPropsT } from "./types.js";
|
|
2
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./collapsible.js";
|
|
3
|
+
export { Collapsible, CollapsibleContent, type CollapsibleContentPropsT, type CollapsiblePropsT, CollapsibleTrigger, type CollapsibleTriggerPropsT };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./collapsible.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PartPropsT } from "../../lib/part-props.js";
|
|
2
|
+
import { Collapsible } from "@base-ui/react/collapsible";
|
|
3
|
+
/**
|
|
4
|
+
* Пропсы раскрывающегося блока
|
|
5
|
+
*/
|
|
6
|
+
export type CollapsiblePropsT = PartPropsT<Omit<Collapsible.Root.Props, 'onOpenChange'>> & {
|
|
7
|
+
/** Блок раскрыт — контролируемый режим, вместе с onOpenChange */
|
|
8
|
+
open?: boolean;
|
|
9
|
+
/** Блок раскрыт при первом рендере — неконтролируемый режим */
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
/** Блок раскрыли или скрыли: новое состояние */
|
|
12
|
+
onOpenChange?: (open: boolean) => void;
|
|
13
|
+
/** Отключить переключение */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Пропсы переключателя
|
|
18
|
+
*/
|
|
19
|
+
export type CollapsibleTriggerPropsT = PartPropsT<Collapsible.Trigger.Props>;
|
|
20
|
+
/**
|
|
21
|
+
* Пропсы содержимого
|
|
22
|
+
*/
|
|
23
|
+
export type CollapsibleContentPropsT = PartPropsT<Collapsible.Panel.Props> & {
|
|
24
|
+
/** Держать содержимое в DOM, даже когда блок скрыт: для поиска по странице и своих анимаций */
|
|
25
|
+
keepMounted?: boolean;
|
|
26
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ComboboxChipPropsT, ComboboxChipsInputPropsT, ComboboxChipsPropsT, ComboboxClearPropsT, ComboboxCollectionPropsT, ComboboxContentPropsT, ComboboxEmptyPropsT, ComboboxGroupPropsT, ComboboxInputPropsT, ComboboxItemPropsT, ComboboxLabelPropsT, ComboboxListPropsT, ComboboxPropsT, ComboboxSeparatorPropsT, ComboboxTriggerPropsT, ComboboxValuePropsT } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Комбобокс: поле с поиском и выпадающим списком, выбор одного или нескольких значений
|
|
4
|
+
* @param props - пропсы комбобокса; items — пункты, по ним идёт фильтрация
|
|
5
|
+
* @returns корень без своей разметки
|
|
6
|
+
*/
|
|
7
|
+
export declare function Combobox<Value, Multiple extends boolean | undefined = false>(props: ComboboxPropsT<Value, Multiple>): import("react").JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* Выбранное значение: текст выбранного пункта или функция для своего отображения
|
|
10
|
+
* @param props - пропсы значения
|
|
11
|
+
* @returns текст без своей разметки
|
|
12
|
+
*/
|
|
13
|
+
export declare function ComboboxValue(props: ComboboxValuePropsT): import("react").JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* Кнопка открытия списка: справа стрелка вниз
|
|
16
|
+
* @param props - пропсы кнопки; render — оформить другим элементом, например Button
|
|
17
|
+
* @returns кнопка
|
|
18
|
+
*/
|
|
19
|
+
export declare function ComboboxTrigger({ className, children, ...props }: ComboboxTriggerPropsT): import("react").JSX.Element;
|
|
20
|
+
/**
|
|
21
|
+
* Кнопка очистки: крестик, сбрасывает выбранное значение и текст
|
|
22
|
+
* @param props - пропсы кнопки; aria-label по умолчанию «Очистить»
|
|
23
|
+
* @returns кнопка
|
|
24
|
+
*/
|
|
25
|
+
export declare function ComboboxClear({ className, 'aria-label': ariaLabel, ...props }: ComboboxClearPropsT): import("react").JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* Поле с поиском: ввод фильтрует список, справа стрелка и крестик очистки.
|
|
28
|
+
* В children можно положить InputGroupAddon с иконкой
|
|
29
|
+
* @param props - пропсы поля; className уходит на рамку InputGroup
|
|
30
|
+
* @returns группа поля
|
|
31
|
+
*/
|
|
32
|
+
export declare function ComboboxInput({ className, children, disabled, showTrigger, showClear, ...props }: ComboboxInputPropsT): import("react").JSX.Element;
|
|
33
|
+
/**
|
|
34
|
+
* Всплывающее окно со списком: рендерится в портале под полем, шириной с поле.
|
|
35
|
+
* Внутрь кладутся ComboboxEmpty и ComboboxList, при необходимости ComboboxInput
|
|
36
|
+
* @param props - пропсы окна; по умолчанию side="bottom", align="start", sideOffset={6}
|
|
37
|
+
* @returns портал с окном
|
|
38
|
+
*/
|
|
39
|
+
export declare function ComboboxContent({ className, side, sideOffset, align, alignOffset, anchor, ...props }: ComboboxContentPropsT): import("react").JSX.Element;
|
|
40
|
+
/**
|
|
41
|
+
* Список пунктов: прокручивается внутри окна
|
|
42
|
+
* @param props - пропсы списка; children — функция (item, index) => ComboboxItem
|
|
43
|
+
* @returns div с role="listbox"
|
|
44
|
+
*/
|
|
45
|
+
export declare function ComboboxList({ className, ...props }: ComboboxListPropsT): import("react").JSX.Element;
|
|
46
|
+
/**
|
|
47
|
+
* Пункт списка: у выбранного справа галочка
|
|
48
|
+
* @param props - пропсы пункта; value — значение пункта
|
|
49
|
+
* @returns div с role="option"
|
|
50
|
+
*/
|
|
51
|
+
export declare function ComboboxItem({ className, children, ref, ...props }: ComboboxItemPropsT): import("react").JSX.Element;
|
|
52
|
+
/**
|
|
53
|
+
* Группа пунктов с подписью ComboboxLabel
|
|
54
|
+
* @param props - пропсы группы
|
|
55
|
+
* @returns div с role="group"
|
|
56
|
+
*/
|
|
57
|
+
export declare function ComboboxGroup({ className, ...props }: ComboboxGroupPropsT): import("react").JSX.Element;
|
|
58
|
+
/**
|
|
59
|
+
* Подпись группы: мелкий приглушённый текст
|
|
60
|
+
* @param props - пропсы подписи
|
|
61
|
+
* @returns div
|
|
62
|
+
*/
|
|
63
|
+
export declare function ComboboxLabel({ className, ...props }: ComboboxLabelPropsT): import("react").JSX.Element;
|
|
64
|
+
/**
|
|
65
|
+
* Коллекция: отрисовывает пункты группы из ComboboxGroup items
|
|
66
|
+
* @param props - пропсы коллекции
|
|
67
|
+
* @returns пункты без своей разметки
|
|
68
|
+
*/
|
|
69
|
+
export declare function ComboboxCollection(props: ComboboxCollectionPropsT): import("react").JSX.Element;
|
|
70
|
+
/**
|
|
71
|
+
* Пустой результат: показывается, когда ничего не нашлось
|
|
72
|
+
* @param props - пропсы; children по умолчанию «Ничего не найдено»
|
|
73
|
+
* @returns div
|
|
74
|
+
*/
|
|
75
|
+
export declare function ComboboxEmpty({ className, children, ...props }: ComboboxEmptyPropsT): import("react").JSX.Element;
|
|
76
|
+
/**
|
|
77
|
+
* Разделитель между группами
|
|
78
|
+
* @param props - пропсы разделителя
|
|
79
|
+
* @returns div с role="separator"
|
|
80
|
+
*/
|
|
81
|
+
export declare function ComboboxSeparator({ className, ...props }: ComboboxSeparatorPropsT): import("react").JSX.Element;
|
|
82
|
+
/**
|
|
83
|
+
* Поле с чипами для выбора нескольких значений: чипы и ComboboxChipsInput в общей рамке
|
|
84
|
+
* @param props - пропсы поля; ref передайте в anchor у ComboboxContent
|
|
85
|
+
* @returns div
|
|
86
|
+
*/
|
|
87
|
+
export declare function ComboboxChips({ className, ...props }: ComboboxChipsPropsT): import("react").JSX.Element;
|
|
88
|
+
/**
|
|
89
|
+
* Чип выбранного значения: текст и крестик удаления
|
|
90
|
+
* @param props - пропсы чипа
|
|
91
|
+
* @returns div
|
|
92
|
+
*/
|
|
93
|
+
export declare function ComboboxChip({ className, children, showRemove, removeLabel, ...props }: ComboboxChipPropsT): import("react").JSX.Element;
|
|
94
|
+
/**
|
|
95
|
+
* Поле ввода среди чипов: занимает оставшееся место в строке
|
|
96
|
+
* @param props - пропсы поля
|
|
97
|
+
* @returns input
|
|
98
|
+
*/
|
|
99
|
+
export declare function ComboboxChipsInput({ className, ...props }: ComboboxChipsInputPropsT): import("react").JSX.Element;
|
|
100
|
+
/**
|
|
101
|
+
* Ref для привязки окна к полю с чипами: передайте в ComboboxChips ref и в ComboboxContent anchor
|
|
102
|
+
* @returns ref на div
|
|
103
|
+
*/
|
|
104
|
+
export declare function useComboboxAnchor(): import("react").RefObject<HTMLDivElement | null>;
|
|
@@ -0,0 +1,365 @@
|
|
|
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 { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "../input-group/input-group.js";
|
|
6
|
+
import { CheckIcon, ChevronDownIcon, XIcon } from "lucide-react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { useEffect, useRef } from "react";
|
|
9
|
+
import { Combobox } from "@base-ui/react/combobox";
|
|
10
|
+
// src/components/combobox/combobox.tsx
|
|
11
|
+
/**
|
|
12
|
+
* Комбобокс: поле с поиском и выпадающим списком, выбор одного или нескольких значений
|
|
13
|
+
* @param props - пропсы комбобокса; items — пункты, по ним идёт фильтрация
|
|
14
|
+
* @returns корень без своей разметки
|
|
15
|
+
*/
|
|
16
|
+
function Combobox$1(props) {
|
|
17
|
+
return /* @__PURE__ */ jsx(Combobox.Root, { ...props });
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Выбранное значение: текст выбранного пункта или функция для своего отображения
|
|
21
|
+
* @param props - пропсы значения
|
|
22
|
+
* @returns текст без своей разметки
|
|
23
|
+
*/
|
|
24
|
+
function ComboboxValue(props) {
|
|
25
|
+
return /* @__PURE__ */ jsx(Combobox.Value, {
|
|
26
|
+
"data-slot": "combobox-value",
|
|
27
|
+
...props
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Кнопка открытия списка: справа стрелка вниз
|
|
32
|
+
* @param props - пропсы кнопки; render — оформить другим элементом, например Button
|
|
33
|
+
* @returns кнопка
|
|
34
|
+
*/
|
|
35
|
+
function ComboboxTrigger({ className, children, ...props }) {
|
|
36
|
+
const classes = cn("[&_svg:not([class*=size-])]:size-4", className);
|
|
37
|
+
return /* @__PURE__ */ jsxs(Combobox.Trigger, {
|
|
38
|
+
"data-slot": "combobox-trigger",
|
|
39
|
+
className: classes,
|
|
40
|
+
...props,
|
|
41
|
+
children: [children, /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
42
|
+
"data-slot": "combobox-trigger-icon",
|
|
43
|
+
className: "pointer-events-none size-4 text-muted-foreground"
|
|
44
|
+
})]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Кнопка очистки: крестик, сбрасывает выбранное значение и текст
|
|
49
|
+
* @param props - пропсы кнопки; aria-label по умолчанию «Очистить»
|
|
50
|
+
* @returns кнопка
|
|
51
|
+
*/
|
|
52
|
+
function ComboboxClear({ className, "aria-label": ariaLabel = texts.clear, ...props }) {
|
|
53
|
+
const classes = cn(className);
|
|
54
|
+
const button = /* @__PURE__ */ jsx(InputGroupButton, {
|
|
55
|
+
variant: "ghost",
|
|
56
|
+
size: "icon-xs"
|
|
57
|
+
});
|
|
58
|
+
return /* @__PURE__ */ jsx(Combobox.Clear, {
|
|
59
|
+
"data-slot": "combobox-clear",
|
|
60
|
+
"aria-label": ariaLabel,
|
|
61
|
+
render: button,
|
|
62
|
+
className: classes,
|
|
63
|
+
...props,
|
|
64
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "pointer-events-none" })
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Поле с поиском: ввод фильтрует список, справа стрелка и крестик очистки.
|
|
69
|
+
* В children можно положить InputGroupAddon с иконкой
|
|
70
|
+
* @param props - пропсы поля; className уходит на рамку InputGroup
|
|
71
|
+
* @returns группа поля
|
|
72
|
+
*/
|
|
73
|
+
function ComboboxInput({ className, children, disabled = false, showTrigger = true, showClear = false, ...props }) {
|
|
74
|
+
const classes = cn("w-auto", className);
|
|
75
|
+
const input = /* @__PURE__ */ jsx(InputGroupInput, { disabled });
|
|
76
|
+
const triggerButton = /* @__PURE__ */ jsx(InputGroupButton, {
|
|
77
|
+
size: "icon-xs",
|
|
78
|
+
variant: "ghost",
|
|
79
|
+
"data-slot": "input-group-button",
|
|
80
|
+
className: "group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent"
|
|
81
|
+
});
|
|
82
|
+
return /* @__PURE__ */ jsxs(InputGroup, {
|
|
83
|
+
className: classes,
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ jsx(Combobox.Input, {
|
|
86
|
+
render: input,
|
|
87
|
+
...props
|
|
88
|
+
}),
|
|
89
|
+
/* @__PURE__ */ jsxs(InputGroupAddon, {
|
|
90
|
+
align: "inline-end",
|
|
91
|
+
children: [showTrigger && /* @__PURE__ */ jsx(ComboboxTrigger, {
|
|
92
|
+
"aria-label": texts.openList,
|
|
93
|
+
render: triggerButton,
|
|
94
|
+
disabled
|
|
95
|
+
}), showClear && /* @__PURE__ */ jsx(ComboboxClear, { disabled })]
|
|
96
|
+
}),
|
|
97
|
+
children
|
|
98
|
+
]
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/** Сколько мс после колеса, касания или клавиши прокрутка считается пользовательской */
|
|
102
|
+
const USER_SCROLL_WINDOW = 300;
|
|
103
|
+
/** Клавиши, которыми пользователь прокручивает страницу */
|
|
104
|
+
const scrollKeys = /* @__PURE__ */ new Set([
|
|
105
|
+
"PageUp",
|
|
106
|
+
"PageDown",
|
|
107
|
+
"Home",
|
|
108
|
+
"End",
|
|
109
|
+
" "
|
|
110
|
+
]);
|
|
111
|
+
/**
|
|
112
|
+
* Пока окно списка открыто, страница не прокручивается сама: прокрутку, которую вызвал
|
|
113
|
+
* не пользователь (фокус, scrollIntoView, сдвиг раскладки), откатываем на прежнее место
|
|
114
|
+
*/
|
|
115
|
+
function usePageScrollGuard() {
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
let left = window.scrollX;
|
|
118
|
+
let top = window.scrollY;
|
|
119
|
+
let userUntil = 0;
|
|
120
|
+
/** Пользователь крутит колесо, касается экрана или тянет полосу прокрутки */
|
|
121
|
+
const markUser = () => {
|
|
122
|
+
userUntil = performance.now() + USER_SCROLL_WINDOW;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Клавиша прокрутки страницы
|
|
126
|
+
* @param event - событие клавиатуры
|
|
127
|
+
*/
|
|
128
|
+
const handleKeyDown = (event) => {
|
|
129
|
+
if (scrollKeys.has(event.key)) markUser();
|
|
130
|
+
};
|
|
131
|
+
/** Прокрутка: своя — запоминаем место, чужая — возвращаем */
|
|
132
|
+
const handleScroll = () => {
|
|
133
|
+
if (performance.now() < userUntil) {
|
|
134
|
+
left = window.scrollX;
|
|
135
|
+
top = window.scrollY;
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (window.scrollX !== left || window.scrollY !== top) window.scrollTo(left, top);
|
|
139
|
+
};
|
|
140
|
+
window.addEventListener("wheel", markUser, { passive: true });
|
|
141
|
+
window.addEventListener("touchmove", markUser, { passive: true });
|
|
142
|
+
window.addEventListener("pointerdown", markUser);
|
|
143
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
144
|
+
window.addEventListener("scroll", handleScroll);
|
|
145
|
+
return () => {
|
|
146
|
+
window.removeEventListener("wheel", markUser);
|
|
147
|
+
window.removeEventListener("touchmove", markUser);
|
|
148
|
+
window.removeEventListener("pointerdown", markUser);
|
|
149
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
150
|
+
window.removeEventListener("scroll", handleScroll);
|
|
151
|
+
};
|
|
152
|
+
}, []);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Защита прокрутки страницы: монтируется только вместе с открытым окном
|
|
156
|
+
* @returns ничего не рисует
|
|
157
|
+
*/
|
|
158
|
+
function PageScrollGuard() {
|
|
159
|
+
usePageScrollGuard();
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Всплывающее окно со списком: рендерится в портале под полем, шириной с поле.
|
|
164
|
+
* Внутрь кладутся ComboboxEmpty и ComboboxList, при необходимости ComboboxInput
|
|
165
|
+
* @param props - пропсы окна; по умолчанию side="bottom", align="start", sideOffset={6}
|
|
166
|
+
* @returns портал с окном
|
|
167
|
+
*/
|
|
168
|
+
function ComboboxContent({ className, side = "bottom", sideOffset = 6, align = "start", alignOffset = 0, anchor, ...props }) {
|
|
169
|
+
const hasAnchor = Boolean(anchor);
|
|
170
|
+
const classes = cn("group/combobox-content", "relative", "max-h-72", "w-(--anchor-width)", "max-w-(--available-width)", "min-w-36", "min-w-[calc(var(--anchor-width)+--spacing(7))]", "origin-(--transform-origin)", "overflow-hidden", "rounded-lg", "bg-popover", "text-popover-foreground", "shadow-md", "ring-1", "ring-foreground/10", "duration-100", "data-[chips=true]:min-w-(--anchor-width)", "data-open:animate-in", "data-open:fade-in-0", "data-open:zoom-in-95", "data-closed:animate-out", "data-closed:fade-out-0", "data-closed:zoom-out-95", "data-[side=bottom]:slide-in-from-top-2", "data-[side=left]:slide-in-from-right-2", "data-[side=right]:slide-in-from-left-2", "data-[side=top]:slide-in-from-bottom-2", "*:data-[slot=input-group]:m-1", "*:data-[slot=input-group]:mb-0", "*:data-[slot=input-group]:h-8", "*:data-[slot=input-group]:border-input/30", "*:data-[slot=input-group]:bg-input/30", "*:data-[slot=input-group]:shadow-none", className);
|
|
171
|
+
return /* @__PURE__ */ jsx(Combobox.Portal, { children: /* @__PURE__ */ jsxs(Combobox.Positioner, {
|
|
172
|
+
side,
|
|
173
|
+
sideOffset,
|
|
174
|
+
align,
|
|
175
|
+
alignOffset,
|
|
176
|
+
anchor,
|
|
177
|
+
className: "isolate z-50",
|
|
178
|
+
children: [/* @__PURE__ */ jsx(PageScrollGuard, {}), /* @__PURE__ */ jsx(Combobox.Popup, {
|
|
179
|
+
"data-slot": "combobox-content",
|
|
180
|
+
"data-chips": hasAnchor,
|
|
181
|
+
className: classes,
|
|
182
|
+
...props
|
|
183
|
+
})]
|
|
184
|
+
}) });
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Список пунктов: прокручивается внутри окна
|
|
188
|
+
* @param props - пропсы списка; children — функция (item, index) => ComboboxItem
|
|
189
|
+
* @returns div с role="listbox"
|
|
190
|
+
*/
|
|
191
|
+
function ComboboxList({ className, ...props }) {
|
|
192
|
+
const classes = cn("max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))]", "scroll-py-1", "overflow-y-auto", "overscroll-contain", "p-1", "[scrollbar-width:none]", "data-empty:p-0", className);
|
|
193
|
+
return /* @__PURE__ */ jsx(Combobox.List, {
|
|
194
|
+
"data-slot": "combobox-list",
|
|
195
|
+
className: classes,
|
|
196
|
+
...props
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Прокрутить список так, чтобы пункт стал виден; страница при этом не двигается
|
|
201
|
+
* @param item - пункт списка
|
|
202
|
+
*/
|
|
203
|
+
function scrollItemInList(item) {
|
|
204
|
+
const list = item.closest("[data-slot=combobox-list]");
|
|
205
|
+
if (!list) return;
|
|
206
|
+
const padding = Number.parseFloat(getComputedStyle(list).scrollPaddingTop) || 0;
|
|
207
|
+
const listRect = list.getBoundingClientRect();
|
|
208
|
+
const itemRect = item.getBoundingClientRect();
|
|
209
|
+
const top = listRect.top + padding;
|
|
210
|
+
const bottom = listRect.bottom - padding;
|
|
211
|
+
if (itemRect.top < top) list.scrollTop -= top - itemRect.top;
|
|
212
|
+
else if (itemRect.bottom > bottom) list.scrollTop += itemRect.bottom - bottom;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Пункт списка: у выбранного справа галочка
|
|
216
|
+
* @param props - пропсы пункта; value — значение пункта
|
|
217
|
+
* @returns div с role="option"
|
|
218
|
+
*/
|
|
219
|
+
function ComboboxItem({ className, children, ref, ...props }) {
|
|
220
|
+
const classes = cn("relative", "flex", "w-full", "cursor-default", "items-center", "gap-2", "rounded-md", "py-1", "pr-8", "pl-1.5", "text-sm", "outline-hidden", "select-none", "data-highlighted:bg-accent", "data-highlighted:text-accent-foreground", "not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground", "data-disabled:pointer-events-none", "data-disabled:opacity-50", "[&_svg]:pointer-events-none", "[&_svg]:shrink-0", "[&_svg:not([class*=size-])]:size-4", className);
|
|
221
|
+
const indicator = /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center" });
|
|
222
|
+
/**
|
|
223
|
+
* Пункт подсвечивается с прокруткой (scrollIntoView): прокручиваем только список,
|
|
224
|
+
* иначе браузер двигает и страницу, если окно списка выходит за край экрана
|
|
225
|
+
* @param node - элемент пункта
|
|
226
|
+
*/
|
|
227
|
+
const itemRef = (node) => {
|
|
228
|
+
if (node) node.scrollIntoView = () => scrollItemInList(node);
|
|
229
|
+
if (typeof ref === "function") ref(node);
|
|
230
|
+
else if (ref) ref.current = node;
|
|
231
|
+
};
|
|
232
|
+
return /* @__PURE__ */ jsxs(Combobox.Item, {
|
|
233
|
+
ref: itemRef,
|
|
234
|
+
"data-slot": "combobox-item",
|
|
235
|
+
className: classes,
|
|
236
|
+
...props,
|
|
237
|
+
children: [children, /* @__PURE__ */ jsx(Combobox.ItemIndicator, {
|
|
238
|
+
"data-slot": "combobox-item-indicator",
|
|
239
|
+
render: indicator,
|
|
240
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { className: "pointer-events-none" })
|
|
241
|
+
})]
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Группа пунктов с подписью ComboboxLabel
|
|
246
|
+
* @param props - пропсы группы
|
|
247
|
+
* @returns div с role="group"
|
|
248
|
+
*/
|
|
249
|
+
function ComboboxGroup({ className, ...props }) {
|
|
250
|
+
const classes = cn(className);
|
|
251
|
+
return /* @__PURE__ */ jsx(Combobox.Group, {
|
|
252
|
+
"data-slot": "combobox-group",
|
|
253
|
+
className: classes,
|
|
254
|
+
...props
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Подпись группы: мелкий приглушённый текст
|
|
259
|
+
* @param props - пропсы подписи
|
|
260
|
+
* @returns div
|
|
261
|
+
*/
|
|
262
|
+
function ComboboxLabel({ className, ...props }) {
|
|
263
|
+
const classes = cn("px-2", "py-1.5", "text-xs", "text-muted-foreground", className);
|
|
264
|
+
return /* @__PURE__ */ jsx(Combobox.GroupLabel, {
|
|
265
|
+
"data-slot": "combobox-label",
|
|
266
|
+
className: classes,
|
|
267
|
+
...props
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Коллекция: отрисовывает пункты группы из ComboboxGroup items
|
|
272
|
+
* @param props - пропсы коллекции
|
|
273
|
+
* @returns пункты без своей разметки
|
|
274
|
+
*/
|
|
275
|
+
function ComboboxCollection(props) {
|
|
276
|
+
return /* @__PURE__ */ jsx(Combobox.Collection, {
|
|
277
|
+
"data-slot": "combobox-collection",
|
|
278
|
+
...props
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Пустой результат: показывается, когда ничего не нашлось
|
|
283
|
+
* @param props - пропсы; children по умолчанию «Ничего не найдено»
|
|
284
|
+
* @returns div
|
|
285
|
+
*/
|
|
286
|
+
function ComboboxEmpty({ className, children = texts.empty, ...props }) {
|
|
287
|
+
const classes = cn("hidden", "w-full", "justify-center", "py-2", "text-center", "text-sm", "text-muted-foreground", "group-data-empty/combobox-content:flex", className);
|
|
288
|
+
return /* @__PURE__ */ jsx(Combobox.Empty, {
|
|
289
|
+
"data-slot": "combobox-empty",
|
|
290
|
+
className: classes,
|
|
291
|
+
...props,
|
|
292
|
+
children
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Разделитель между группами
|
|
297
|
+
* @param props - пропсы разделителя
|
|
298
|
+
* @returns div с role="separator"
|
|
299
|
+
*/
|
|
300
|
+
function ComboboxSeparator({ className, ...props }) {
|
|
301
|
+
const classes = cn("-mx-1", "my-1", "h-px", "bg-border", className);
|
|
302
|
+
return /* @__PURE__ */ jsx(Combobox.Separator, {
|
|
303
|
+
"data-slot": "combobox-separator",
|
|
304
|
+
className: classes,
|
|
305
|
+
...props
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Поле с чипами для выбора нескольких значений: чипы и ComboboxChipsInput в общей рамке
|
|
310
|
+
* @param props - пропсы поля; ref передайте в anchor у ComboboxContent
|
|
311
|
+
* @returns div
|
|
312
|
+
*/
|
|
313
|
+
function ComboboxChips({ className, ...props }) {
|
|
314
|
+
const classes = cn("flex", "min-h-8", "flex-wrap", "items-center", "gap-1", "rounded-lg", "border", "border-input", "bg-transparent", "bg-clip-padding", "px-2.5", "py-1", "text-sm", "transition-colors", "dark:bg-input/30", "keyboard:focus-within:border-ring", "keyboard:focus-within:ring-3", "keyboard:focus-within:ring-ring/50", "has-aria-invalid:border-destructive", "has-aria-invalid:ring-3", "has-aria-invalid:ring-destructive/20", "dark:has-aria-invalid:border-destructive/50", "dark:has-aria-invalid:ring-destructive/40", "has-data-[slot=combobox-chip]:px-1", className);
|
|
315
|
+
return /* @__PURE__ */ jsx(Combobox.Chips, {
|
|
316
|
+
"data-slot": "combobox-chips",
|
|
317
|
+
className: classes,
|
|
318
|
+
...props
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Чип выбранного значения: текст и крестик удаления
|
|
323
|
+
* @param props - пропсы чипа
|
|
324
|
+
* @returns div
|
|
325
|
+
*/
|
|
326
|
+
function ComboboxChip({ className, children, showRemove = true, removeLabel = texts.delete, ...props }) {
|
|
327
|
+
const classes = cn("flex", "h-[calc(--spacing(5.25))]", "w-fit", "items-center", "justify-center", "gap-1", "rounded-sm", "bg-muted", "px-1.5", "text-xs", "font-medium", "whitespace-nowrap", "text-foreground", "has-data-[slot=combobox-chip-remove]:pr-0", "has-disabled:pointer-events-none", "has-disabled:cursor-not-allowed", "has-disabled:opacity-50", className);
|
|
328
|
+
const button = /* @__PURE__ */ jsx(Button, {
|
|
329
|
+
variant: "ghost",
|
|
330
|
+
size: "icon-xs"
|
|
331
|
+
});
|
|
332
|
+
return /* @__PURE__ */ jsxs(Combobox.Chip, {
|
|
333
|
+
"data-slot": "combobox-chip",
|
|
334
|
+
className: classes,
|
|
335
|
+
...props,
|
|
336
|
+
children: [children, showRemove && /* @__PURE__ */ jsx(Combobox.ChipRemove, {
|
|
337
|
+
"data-slot": "combobox-chip-remove",
|
|
338
|
+
"aria-label": removeLabel,
|
|
339
|
+
render: button,
|
|
340
|
+
className: "-ml-1 opacity-50 hover:opacity-100",
|
|
341
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "pointer-events-none" })
|
|
342
|
+
})]
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Поле ввода среди чипов: занимает оставшееся место в строке
|
|
347
|
+
* @param props - пропсы поля
|
|
348
|
+
* @returns input
|
|
349
|
+
*/
|
|
350
|
+
function ComboboxChipsInput({ className, ...props }) {
|
|
351
|
+
const classes = cn("min-w-16", "flex-1", "outline-none", className);
|
|
352
|
+
return /* @__PURE__ */ jsx(Combobox.Input, {
|
|
353
|
+
"data-slot": "combobox-chip-input",
|
|
354
|
+
className: classes,
|
|
355
|
+
...props
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Ref для привязки окна к полю с чипами: передайте в ComboboxChips ref и в ComboboxContent anchor
|
|
360
|
+
* @returns ref на div
|
|
361
|
+
*/
|
|
362
|
+
function useComboboxAnchor() {
|
|
363
|
+
return useRef(null);
|
|
364
|
+
}
|
|
365
|
+
export { Combobox$1 as Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxClear, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, useComboboxAnchor };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ComboboxChipPropsT, ComboboxChipsInputPropsT, ComboboxChipsPropsT, ComboboxClearPropsT, ComboboxCollectionPropsT, ComboboxContentPropsT, ComboboxEmptyPropsT, ComboboxGroupPropsT, ComboboxInputPropsT, ComboboxItemPropsT, ComboboxLabelPropsT, ComboboxListPropsT, ComboboxPropsT, ComboboxSeparatorPropsT, ComboboxTriggerPropsT, ComboboxValuePropsT } from "./types.js";
|
|
2
|
+
import { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxClear, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, useComboboxAnchor } from "./combobox.js";
|
|
3
|
+
export { Combobox, ComboboxChip, type ComboboxChipPropsT, ComboboxChips, ComboboxChipsInput, type ComboboxChipsInputPropsT, type ComboboxChipsPropsT, ComboboxClear, type ComboboxClearPropsT, ComboboxCollection, type ComboboxCollectionPropsT, ComboboxContent, type ComboboxContentPropsT, ComboboxEmpty, type ComboboxEmptyPropsT, ComboboxGroup, type ComboboxGroupPropsT, ComboboxInput, type ComboboxInputPropsT, ComboboxItem, type ComboboxItemPropsT, ComboboxLabel, type ComboboxLabelPropsT, ComboboxList, type ComboboxListPropsT, type ComboboxPropsT, ComboboxSeparator, type ComboboxSeparatorPropsT, ComboboxTrigger, type ComboboxTriggerPropsT, ComboboxValue, type ComboboxValuePropsT, useComboboxAnchor };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxClear, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, useComboboxAnchor } from "./combobox.js";
|