@bevelo/vue 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/dist/accordion.cjs +89 -0
- package/dist/accordion.d.cts +145 -0
- package/dist/accordion.d.ts +145 -0
- package/dist/accordion.js +88 -0
- package/dist/agent.cjs +74 -0
- package/dist/agent.d.cts +2 -0
- package/dist/agent.d.ts +2 -0
- package/dist/agent.js +1 -0
- package/dist/alert-dialog.cjs +48 -0
- package/dist/alert-dialog.d.cts +142 -0
- package/dist/alert-dialog.d.ts +142 -0
- package/dist/alert-dialog.js +47 -0
- package/dist/alert.cjs +77 -0
- package/dist/alert.d.cts +64 -0
- package/dist/alert.d.ts +64 -0
- package/dist/alert.js +76 -0
- package/dist/aspect-ratio.cjs +21 -0
- package/dist/aspect-ratio.d.cts +13 -0
- package/dist/aspect-ratio.d.ts +13 -0
- package/dist/aspect-ratio.js +21 -0
- package/dist/async-options.cjs +76 -0
- package/dist/async-options.d.cts +49 -0
- package/dist/async-options.d.ts +49 -0
- package/dist/async-options.js +75 -0
- package/dist/autocomplete.cjs +274 -0
- package/dist/autocomplete.d.cts +309 -0
- package/dist/autocomplete.d.ts +309 -0
- package/dist/autocomplete.js +273 -0
- package/dist/avatar.cjs +51 -0
- package/dist/avatar.d.cts +69 -0
- package/dist/avatar.d.ts +69 -0
- package/dist/avatar.js +50 -0
- package/dist/badge.cjs +41 -0
- package/dist/badge.d.cts +39 -0
- package/dist/badge.d.ts +39 -0
- package/dist/badge.js +40 -0
- package/dist/breadcrumb.cjs +59 -0
- package/dist/breadcrumb.d.cts +40 -0
- package/dist/breadcrumb.d.ts +40 -0
- package/dist/breadcrumb.js +58 -0
- package/dist/button.cjs +56 -0
- package/dist/button.d.cts +79 -0
- package/dist/button.d.ts +79 -0
- package/dist/button.js +55 -0
- package/dist/calendar-Bcc6HKc9.js +643 -0
- package/dist/calendar-vHGhj3RI.cjs +720 -0
- package/dist/calendar.cjs +4 -0
- package/dist/calendar.d.cts +316 -0
- package/dist/calendar.d.ts +316 -0
- package/dist/calendar.js +1 -0
- package/dist/card-B_ZoLCvt.d.cts +61 -0
- package/dist/card-B_ZoLCvt.d.ts +61 -0
- package/dist/card-CZHRix0r.js +99 -0
- package/dist/card-CvGfpsiU.cjs +140 -0
- package/dist/card.cjs +9 -0
- package/dist/card.d.cts +2 -0
- package/dist/card.d.ts +2 -0
- package/dist/card.js +1 -0
- package/dist/carousel.cjs +225 -0
- package/dist/carousel.d.cts +214 -0
- package/dist/carousel.d.ts +214 -0
- package/dist/carousel.js +224 -0
- package/dist/checkbox-group.cjs +93 -0
- package/dist/checkbox-group.d.cts +108 -0
- package/dist/checkbox-group.d.ts +108 -0
- package/dist/checkbox-group.js +91 -0
- package/dist/checkbox.cjs +117 -0
- package/dist/checkbox.d.cts +153 -0
- package/dist/checkbox.d.ts +153 -0
- package/dist/checkbox.js +116 -0
- package/dist/collapsible.cjs +70 -0
- package/dist/collapsible.d.cts +141 -0
- package/dist/collapsible.d.ts +141 -0
- package/dist/collapsible.js +69 -0
- package/dist/color-picker.cjs +225 -0
- package/dist/color-picker.d.cts +180 -0
- package/dist/color-picker.d.ts +180 -0
- package/dist/color-picker.js +212 -0
- package/dist/combobox-CDHIXr6J.d.ts +735 -0
- package/dist/combobox-D39Waj6L.d.cts +735 -0
- package/dist/combobox-DlCU0vS1.cjs +945 -0
- package/dist/combobox-wLdV6VA_.js +802 -0
- package/dist/combobox.cjs +26 -0
- package/dist/combobox.d.cts +3 -0
- package/dist/combobox.d.ts +3 -0
- package/dist/combobox.js +1 -0
- package/dist/command-CEJACYpR.d.ts +404 -0
- package/dist/command-CqHZVivR.js +693 -0
- package/dist/command-D54bj6RJ.cjs +836 -0
- package/dist/command-rAVp-wbf.d.cts +404 -0
- package/dist/command.cjs +15 -0
- package/dist/command.d.cts +2 -0
- package/dist/command.d.ts +2 -0
- package/dist/command.js +1 -0
- package/dist/context-menu-BPsgeLQm.cjs +170 -0
- package/dist/context-menu-ByhKzWTm.d.ts +129 -0
- package/dist/context-menu-Co3ABcdp.js +153 -0
- package/dist/context-menu-USbhMQuc.d.cts +129 -0
- package/dist/context-menu.cjs +6 -0
- package/dist/context-menu.d.cts +2 -0
- package/dist/context-menu.d.ts +2 -0
- package/dist/context-menu.js +2 -0
- package/dist/date-input.cjs +374 -0
- package/dist/date-input.d.cts +234 -0
- package/dist/date-input.d.ts +234 -0
- package/dist/date-input.js +371 -0
- package/dist/date-picker-D1mygz_Y.js +891 -0
- package/dist/date-picker-D_hqHHAV.cjs +938 -0
- package/dist/date-picker.cjs +4 -0
- package/dist/date-picker.d.cts +447 -0
- package/dist/date-picker.d.ts +447 -0
- package/dist/date-picker.js +1 -0
- package/dist/describe-BlNg9SbK.js +25 -0
- package/dist/describe-D_dLtwde.cjs +42 -0
- package/dist/dialog-view-CKtpbGq_.js +26 -0
- package/dist/dialog-view-swgEQvlZ.cjs +31 -0
- package/dist/dialog.cjs +66 -0
- package/dist/dialog.d.cts +158 -0
- package/dist/dialog.d.ts +158 -0
- package/dist/dialog.js +63 -0
- package/dist/direction.cjs +21 -0
- package/dist/direction.d.cts +13 -0
- package/dist/direction.d.ts +13 -0
- package/dist/direction.js +21 -0
- package/dist/dnd.cjs +103 -0
- package/dist/dnd.d.cts +54 -0
- package/dist/dnd.d.ts +54 -0
- package/dist/dnd.js +98 -0
- package/dist/drawer.cjs +137 -0
- package/dist/drawer.d.cts +190 -0
- package/dist/drawer.d.ts +190 -0
- package/dist/drawer.js +134 -0
- package/dist/empty-state.cjs +75 -0
- package/dist/empty-state.d.cts +46 -0
- package/dist/empty-state.d.ts +46 -0
- package/dist/empty-state.js +74 -0
- package/dist/engine-refs-8O6mHfYd.d.cts +4 -0
- package/dist/engine-refs-8O6mHfYd.d.ts +4 -0
- package/dist/engine-refs-CPWFFTfA.cjs +32 -0
- package/dist/engine-refs-sojZQs1R.js +21 -0
- package/dist/error-state.cjs +86 -0
- package/dist/error-state.d.cts +54 -0
- package/dist/error-state.d.ts +54 -0
- package/dist/error-state.js +85 -0
- package/dist/field.cjs +123 -0
- package/dist/field.d.cts +100 -0
- package/dist/field.d.ts +100 -0
- package/dist/field.js +122 -0
- package/dist/file-input.cjs +117 -0
- package/dist/file-input.d.cts +168 -0
- package/dist/file-input.d.ts +168 -0
- package/dist/file-input.js +116 -0
- package/dist/form-CKus_NQE.cjs +23 -0
- package/dist/form-y7b0fcqL.js +18 -0
- package/dist/gauge-parts-BVmw61GR.js +64 -0
- package/dist/gauge-parts-DjqBK9pL.d.cts +15 -0
- package/dist/gauge-parts-V31Fma77.cjs +75 -0
- package/dist/gauge-parts-mAgseDD4.d.ts +15 -0
- package/dist/headless-B3zQWaJm.js +225 -0
- package/dist/headless-BQe1X1Vf.d.ts +2 -0
- package/dist/headless-CbQgxdK1.d.cts +2 -0
- package/dist/headless-D88yFw8W.cjs +248 -0
- package/dist/hover-card.cjs +139 -0
- package/dist/hover-card.d.cts +200 -0
- package/dist/hover-card.d.ts +200 -0
- package/dist/hover-card.js +137 -0
- package/dist/icon-button.cjs +75 -0
- package/dist/icon-button.d.cts +104 -0
- package/dist/icon-button.d.ts +104 -0
- package/dist/icon-button.js +74 -0
- package/dist/image-cropper.cjs +106 -0
- package/dist/image-cropper.d.cts +7 -0
- package/dist/image-cropper.d.ts +7 -0
- package/dist/image-cropper.js +105 -0
- package/dist/image.cjs +87 -0
- package/dist/image.d.cts +92 -0
- package/dist/image.d.ts +92 -0
- package/dist/image.js +86 -0
- package/dist/index.cjs +1685 -0
- package/dist/index.d.cts +1195 -0
- package/dist/index.d.ts +1195 -0
- package/dist/index.js +1042 -0
- package/dist/input-group.cjs +91 -0
- package/dist/input-group.d.cts +84 -0
- package/dist/input-group.d.ts +84 -0
- package/dist/input-group.js +90 -0
- package/dist/input.cjs +114 -0
- package/dist/input.d.cts +186 -0
- package/dist/input.d.ts +186 -0
- package/dist/input.js +113 -0
- package/dist/item-B-QdNtAl.cjs +264 -0
- package/dist/item-D6GSb0WD.d.ts +144 -0
- package/dist/item-DPJnk7ED.js +199 -0
- package/dist/item-DyrvCrsL.d.cts +144 -0
- package/dist/item.cjs +10 -0
- package/dist/item.d.cts +2 -0
- package/dist/item.d.ts +2 -0
- package/dist/item.js +1 -0
- package/dist/kbd.cjs +55 -0
- package/dist/kbd.d.cts +38 -0
- package/dist/kbd.d.ts +38 -0
- package/dist/kbd.js +54 -0
- package/dist/label.cjs +41 -0
- package/dist/label.d.cts +40 -0
- package/dist/label.d.ts +40 -0
- package/dist/label.js +40 -0
- package/dist/listbox.cjs +85 -0
- package/dist/listbox.d.cts +200 -0
- package/dist/listbox.d.ts +200 -0
- package/dist/listbox.js +84 -0
- package/dist/loader.cjs +66 -0
- package/dist/loader.d.cts +68 -0
- package/dist/loader.d.ts +68 -0
- package/dist/loader.js +65 -0
- package/dist/mention-menu.cjs +126 -0
- package/dist/mention-menu.d.cts +144 -0
- package/dist/mention-menu.d.ts +144 -0
- package/dist/mention-menu.js +125 -0
- package/dist/menu.cjs +182 -0
- package/dist/menu.d.cts +240 -0
- package/dist/menu.d.ts +240 -0
- package/dist/menu.js +181 -0
- package/dist/menubar.cjs +38 -0
- package/dist/menubar.d.cts +43 -0
- package/dist/menubar.d.ts +43 -0
- package/dist/menubar.js +37 -0
- package/dist/meter.cjs +113 -0
- package/dist/meter.d.cts +124 -0
- package/dist/meter.d.ts +124 -0
- package/dist/meter.js +108 -0
- package/dist/native-select-52jYpA3c.d.cts +136 -0
- package/dist/native-select-BdJojSQt.d.ts +136 -0
- package/dist/native-select-BwptULNE.js +129 -0
- package/dist/native-select-DjBGWFoh.cjs +146 -0
- package/dist/native-select.cjs +5 -0
- package/dist/native-select.d.cts +2 -0
- package/dist/native-select.d.ts +2 -0
- package/dist/native-select.js +1 -0
- package/dist/navigation-menu.cjs +108 -0
- package/dist/navigation-menu.d.cts +245 -0
- package/dist/navigation-menu.d.ts +245 -0
- package/dist/navigation-menu.js +107 -0
- package/dist/number-input.cjs +189 -0
- package/dist/number-input.d.cts +232 -0
- package/dist/number-input.d.ts +232 -0
- package/dist/number-input.js +187 -0
- package/dist/option-row-DFCj-NoL.js +64 -0
- package/dist/option-row-Dlc6brXH.d.cts +30 -0
- package/dist/option-row-hLg6Ye86.cjs +105 -0
- package/dist/option-row-yJqjEx0G.d.ts +30 -0
- package/dist/options-BDn36q6n.cjs +111 -0
- package/dist/options-BlkyK-uO.js +106 -0
- package/dist/options-CGl5jBEY.d.ts +19 -0
- package/dist/options-DUGLoksA.d.cts +19 -0
- package/dist/otp-input.cjs +85 -0
- package/dist/otp-input.d.cts +113 -0
- package/dist/otp-input.d.ts +113 -0
- package/dist/otp-input.js +84 -0
- package/dist/overlay-controller-78GSJGbM.js +76 -0
- package/dist/overlay-controller-BDeITPoR.d.cts +16 -0
- package/dist/overlay-controller-DmaZ8FLl.cjs +93 -0
- package/dist/overlay-controller-HrMdTomI.d.ts +16 -0
- package/dist/pagination.cjs +87 -0
- package/dist/pagination.d.cts +112 -0
- package/dist/pagination.d.ts +112 -0
- package/dist/pagination.js +86 -0
- package/dist/parts-9zrUGbuI.js +84 -0
- package/dist/parts-DcYZV8ug.cjs +95 -0
- package/dist/password-input.cjs +144 -0
- package/dist/password-input.d.cts +151 -0
- package/dist/password-input.d.ts +151 -0
- package/dist/password-input.js +143 -0
- package/dist/placement-C_WRqvZk.js +49 -0
- package/dist/placement-ChEh6uxa.cjs +60 -0
- package/dist/popover.cjs +159 -0
- package/dist/popover.d.cts +185 -0
- package/dist/popover.d.ts +185 -0
- package/dist/popover.js +157 -0
- package/dist/preferences.cjs +96 -0
- package/dist/preferences.d.cts +36 -0
- package/dist/preferences.d.ts +36 -0
- package/dist/preferences.js +94 -0
- package/dist/presence.cjs +85 -0
- package/dist/presence.d.cts +25 -0
- package/dist/presence.d.ts +25 -0
- package/dist/presence.js +83 -0
- package/dist/progress.cjs +111 -0
- package/dist/progress.d.cts +109 -0
- package/dist/progress.d.ts +109 -0
- package/dist/progress.js +106 -0
- package/dist/query.cjs +152 -0
- package/dist/query.d.cts +68 -0
- package/dist/query.d.ts +68 -0
- package/dist/query.js +142 -0
- package/dist/radio.cjs +102 -0
- package/dist/radio.d.cts +136 -0
- package/dist/radio.d.ts +136 -0
- package/dist/radio.js +101 -0
- package/dist/rating.cjs +88 -0
- package/dist/rating.d.cts +100 -0
- package/dist/rating.d.ts +100 -0
- package/dist/rating.js +87 -0
- package/dist/resizable.cjs +57 -0
- package/dist/resizable.d.cts +119 -0
- package/dist/resizable.d.ts +119 -0
- package/dist/resizable.js +56 -0
- package/dist/scroll-area.cjs +59 -0
- package/dist/scroll-area.d.cts +72 -0
- package/dist/scroll-area.d.ts +72 -0
- package/dist/scroll-area.js +58 -0
- package/dist/segmented-control.cjs +88 -0
- package/dist/segmented-control.d.cts +121 -0
- package/dist/segmented-control.d.ts +121 -0
- package/dist/segmented-control.js +86 -0
- package/dist/select.cjs +160 -0
- package/dist/select.d.cts +385 -0
- package/dist/select.d.ts +385 -0
- package/dist/select.js +159 -0
- package/dist/separator.cjs +32 -0
- package/dist/separator.d.cts +31 -0
- package/dist/separator.d.ts +31 -0
- package/dist/separator.js +31 -0
- package/dist/sheet.cjs +294 -0
- package/dist/sheet.d.cts +456 -0
- package/dist/sheet.d.ts +456 -0
- package/dist/sheet.js +292 -0
- package/dist/sidebar-C-OdvGzD.d.cts +96 -0
- package/dist/sidebar-CZ1-p0-V.d.ts +96 -0
- package/dist/sidebar-DC-mpzMR.js +87 -0
- package/dist/sidebar-gSAgHdkn.cjs +110 -0
- package/dist/sidebar.cjs +6 -0
- package/dist/sidebar.d.cts +2 -0
- package/dist/sidebar.d.ts +2 -0
- package/dist/sidebar.js +1 -0
- package/dist/skeleton.cjs +46 -0
- package/dist/skeleton.d.cts +47 -0
- package/dist/skeleton.d.ts +47 -0
- package/dist/skeleton.js +45 -0
- package/dist/slider.cjs +118 -0
- package/dist/slider.d.cts +181 -0
- package/dist/slider.d.ts +181 -0
- package/dist/slider.js +117 -0
- package/dist/sortable-board-strict.cjs +149 -0
- package/dist/sortable-board-strict.d.cts +181 -0
- package/dist/sortable-board-strict.d.ts +181 -0
- package/dist/sortable-board-strict.js +148 -0
- package/dist/sortable-engine.cjs +136 -0
- package/dist/sortable-engine.d.cts +237 -0
- package/dist/sortable-engine.d.ts +237 -0
- package/dist/sortable-engine.js +135 -0
- package/dist/sortable.cjs +67 -0
- package/dist/sortable.d.cts +217 -0
- package/dist/sortable.d.ts +217 -0
- package/dist/sortable.js +66 -0
- package/dist/spinner.cjs +32 -0
- package/dist/spinner.d.cts +31 -0
- package/dist/spinner.d.ts +31 -0
- package/dist/spinner.js +31 -0
- package/dist/steps-C9Jmrt8G.cjs +122 -0
- package/dist/steps-Cs8AfxV7.js +81 -0
- package/dist/steps-DW5NkzVj.d.ts +71 -0
- package/dist/steps-ymRMdju5.d.cts +71 -0
- package/dist/steps.cjs +8 -0
- package/dist/steps.d.cts +2 -0
- package/dist/steps.d.ts +2 -0
- package/dist/steps.js +1 -0
- package/dist/switch.cjs +100 -0
- package/dist/switch.d.cts +144 -0
- package/dist/switch.d.ts +144 -0
- package/dist/switch.js +99 -0
- package/dist/table.cjs +124 -0
- package/dist/table.d.cts +124 -0
- package/dist/table.d.ts +124 -0
- package/dist/table.js +123 -0
- package/dist/tabs.cjs +89 -0
- package/dist/tabs.d.cts +160 -0
- package/dist/tabs.d.ts +160 -0
- package/dist/tabs.js +88 -0
- package/dist/textarea.cjs +140 -0
- package/dist/textarea.d.cts +231 -0
- package/dist/textarea.d.ts +231 -0
- package/dist/textarea.js +139 -0
- package/dist/time-input.cjs +117 -0
- package/dist/time-input.d.cts +140 -0
- package/dist/time-input.d.ts +140 -0
- package/dist/time-input.js +116 -0
- package/dist/timeline.cjs +82 -0
- package/dist/timeline.d.cts +62 -0
- package/dist/timeline.d.ts +62 -0
- package/dist/timeline.js +81 -0
- package/dist/toast-CfkRzdNd.js +354 -0
- package/dist/toast-DyezF7lm.cjs +401 -0
- package/dist/toast.cjs +16 -0
- package/dist/toast.d.cts +275 -0
- package/dist/toast.d.ts +275 -0
- package/dist/toast.js +1 -0
- package/dist/toggle-group.cjs +65 -0
- package/dist/toggle-group.d.cts +128 -0
- package/dist/toggle-group.d.ts +128 -0
- package/dist/toggle-group.js +64 -0
- package/dist/toggle.cjs +64 -0
- package/dist/toggle.d.cts +97 -0
- package/dist/toggle.d.ts +97 -0
- package/dist/toggle.js +63 -0
- package/dist/token-input-BIC9VLMG.d.cts +170 -0
- package/dist/token-input-BTReOHIv.cjs +336 -0
- package/dist/token-input-CQnZ6-pO.d.ts +170 -0
- package/dist/token-input-DtcCZrcC.js +295 -0
- package/dist/token-input.cjs +9 -0
- package/dist/token-input.d.cts +2 -0
- package/dist/token-input.d.ts +2 -0
- package/dist/token-input.js +1 -0
- package/dist/toolbar.cjs +62 -0
- package/dist/toolbar.d.cts +58 -0
- package/dist/toolbar.d.ts +58 -0
- package/dist/toolbar.js +61 -0
- package/dist/tooltip.cjs +149 -0
- package/dist/tooltip.d.cts +208 -0
- package/dist/tooltip.d.ts +208 -0
- package/dist/tooltip.js +147 -0
- package/dist/tree-grid.cjs +127 -0
- package/dist/tree-grid.d.cts +130 -0
- package/dist/tree-grid.d.ts +130 -0
- package/dist/tree-grid.js +126 -0
- package/dist/tree.cjs +227 -0
- package/dist/tree.d.cts +223 -0
- package/dist/tree.d.ts +223 -0
- package/dist/tree.js +226 -0
- package/dist/trigger-menu-8FAwypbs.d.cts +347 -0
- package/dist/trigger-menu-B898rWkz.cjs +502 -0
- package/dist/trigger-menu-C2YHe7es.d.ts +347 -0
- package/dist/trigger-menu-CxzocSWO.js +431 -0
- package/dist/trigger-menu.cjs +22 -0
- package/dist/trigger-menu.d.cts +2 -0
- package/dist/trigger-menu.d.ts +2 -0
- package/dist/trigger-menu.js +2 -0
- package/dist/virtual-list-strict.cjs +126 -0
- package/dist/virtual-list-strict.d.cts +69 -0
- package/dist/virtual-list-strict.d.ts +69 -0
- package/dist/virtual-list-strict.js +125 -0
- package/dist/virtual-list.cjs +65 -0
- package/dist/virtual-list.d.cts +82 -0
- package/dist/virtual-list.d.ts +82 -0
- package/dist/virtual-list.js +64 -0
- package/dist/virtual.cjs +27 -0
- package/dist/virtual.d.cts +30 -0
- package/dist/virtual.d.ts +30 -0
- package/dist/virtual.js +26 -0
- package/dist/vue-helpers-Bh_YF48i.cjs +102 -0
- package/dist/vue-helpers-Z3oOAHYB.js +55 -0
- package/dist/waterfall-chart.cjs +114 -0
- package/dist/waterfall-chart.d.cts +117 -0
- package/dist/waterfall-chart.d.ts +117 -0
- package/dist/waterfall-chart.js +113 -0
- package/dist/waterfall.cjs +296 -0
- package/dist/waterfall.d.cts +219 -0
- package/dist/waterfall.d.ts +219 -0
- package/dist/waterfall.js +284 -0
- package/package.json +518 -3
- package/README.md +0 -3
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { n as usePrimitive, t as renderPart } from "./headless-B3zQWaJm.js";
|
|
2
|
+
import { t as vueOptions } from "./options-BlkyK-uO.js";
|
|
3
|
+
import { o as requireInject } from "./vue-helpers-Z3oOAHYB.js";
|
|
4
|
+
import { createTokenSegments, segmentsFromText, segmentsLabel, segmentsToText, tokenInputPrimitive } from "@bevelo/core";
|
|
5
|
+
import { Fragment, defineComponent, h, inject, onBeforeUnmount, provide, ref } from "vue";
|
|
6
|
+
// src/token-input-segments.ts
|
|
7
|
+
/** Parses text into segments with a codec, or one token per separated piece. */
|
|
8
|
+
function fromText(text, separatorOrCodec = ",") {
|
|
9
|
+
return segmentsFromText(text, separatorOrCodec);
|
|
10
|
+
}
|
|
11
|
+
/** Writes segments as text: a codec formats each token, otherwise each token is its label. */
|
|
12
|
+
function toText(value, separatorOrCodec = "") {
|
|
13
|
+
return segmentsToText(value, separatorOrCodec);
|
|
14
|
+
}
|
|
15
|
+
/** The text a reader sees: text as it is, tokens as their labels. */
|
|
16
|
+
function toLabel(value) {
|
|
17
|
+
return segmentsLabel(value);
|
|
18
|
+
}
|
|
19
|
+
const SCOPE = Symbol("token-input-segments");
|
|
20
|
+
const TOKEN = Symbol("token-input-token");
|
|
21
|
+
/** Provides one token to the parts inside it. */
|
|
22
|
+
const TokenScope = defineComponent({
|
|
23
|
+
name: "TokenInputTokenScope",
|
|
24
|
+
props: { token: {
|
|
25
|
+
type: Object,
|
|
26
|
+
required: true
|
|
27
|
+
} },
|
|
28
|
+
setup(props, { slots }) {
|
|
29
|
+
provide(TOKEN, () => props.token);
|
|
30
|
+
return () => slots.default?.();
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* The composed root's setup: creates the store, provides it, exposes its api
|
|
35
|
+
* and returns the render function for the root and its segments.
|
|
36
|
+
*/
|
|
37
|
+
function setupTokenInputSegments(props, emit, attrs, slots, expose) {
|
|
38
|
+
const version = ref(0);
|
|
39
|
+
const editor = ref(null);
|
|
40
|
+
const store = createTokenSegments({
|
|
41
|
+
defaultValue: props.defaultValue,
|
|
42
|
+
editor: () => editor.value,
|
|
43
|
+
read: () => ({
|
|
44
|
+
value: props.modelValue ?? props.value,
|
|
45
|
+
disabled: props.disabled,
|
|
46
|
+
readOnly: props.readOnly,
|
|
47
|
+
onChange: (next, details) => {
|
|
48
|
+
emit("change", next, details);
|
|
49
|
+
emit("update:modelValue", next);
|
|
50
|
+
emit("update:value", next);
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
onBeforeUnmount(store.subscribe(() => version.value++));
|
|
55
|
+
expose({ api: {
|
|
56
|
+
getValue: store.value,
|
|
57
|
+
getLabel: store.label,
|
|
58
|
+
insert: store.insert,
|
|
59
|
+
updateToken: store.updateToken,
|
|
60
|
+
removeToken: store.removeToken,
|
|
61
|
+
undo: store.undo,
|
|
62
|
+
clear: store.clear,
|
|
63
|
+
focus: () => editor.value?.focus()
|
|
64
|
+
} });
|
|
65
|
+
provide(SCOPE, {
|
|
66
|
+
store,
|
|
67
|
+
version,
|
|
68
|
+
editor,
|
|
69
|
+
disabled: () => props.disabled === true,
|
|
70
|
+
readOnly: () => props.readOnly === true,
|
|
71
|
+
submit: () => emit("submit", store.submitValue())
|
|
72
|
+
});
|
|
73
|
+
return () => {
|
|
74
|
+
version.value;
|
|
75
|
+
const host = {};
|
|
76
|
+
for (const [key, value] of Object.entries(attrs)) {
|
|
77
|
+
if (key === "onInput" || key === "onChange" || key === "onSubmit" || key === "onQueryChange") continue;
|
|
78
|
+
host[key] = value;
|
|
79
|
+
}
|
|
80
|
+
const segments = store.value().map((segment, index) => typeof segment === "string" ? h("span", {
|
|
81
|
+
key: `text-${index}`,
|
|
82
|
+
"data-part": "input-text"
|
|
83
|
+
}, segment) : h(TokenScope, {
|
|
84
|
+
key: segment.id ?? String(index),
|
|
85
|
+
token: segment
|
|
86
|
+
}, () => slots.token?.({
|
|
87
|
+
token: segment,
|
|
88
|
+
index
|
|
89
|
+
}) ?? h(TokenInputToken, null, () => [segment.label, h(TokenInputTokenRemove)])));
|
|
90
|
+
return h("div", {
|
|
91
|
+
...host,
|
|
92
|
+
role: "group",
|
|
93
|
+
"data-slot": "token-input",
|
|
94
|
+
"aria-label": props.label || void 0,
|
|
95
|
+
"aria-disabled": props.disabled ? "true" : void 0,
|
|
96
|
+
"aria-readonly": props.readOnly ? "true" : void 0,
|
|
97
|
+
...props.disabled ? { "data-disabled": "" } : {},
|
|
98
|
+
...props.readOnly ? { "data-readonly": "" } : {}
|
|
99
|
+
}, [segments, slots.default?.()]);
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function useScope(part) {
|
|
103
|
+
return requireInject(SCOPE, `${part} must be inside a TokenInput with a default slot`);
|
|
104
|
+
}
|
|
105
|
+
/** The text field after the segments: Enter submits, Backspace at its start removes the token before it. */
|
|
106
|
+
const TokenInputEditor = defineComponent({
|
|
107
|
+
name: "TokenInputEditor",
|
|
108
|
+
inheritAttrs: false,
|
|
109
|
+
setup(_props, { attrs }) {
|
|
110
|
+
const scope = useScope("TokenInputEditor");
|
|
111
|
+
const onKeydown = (event) => {
|
|
112
|
+
const action = scope.store.key(event);
|
|
113
|
+
if (action === void 0) return;
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
if (action.type === "submit") scope.submit();
|
|
116
|
+
};
|
|
117
|
+
return () => {
|
|
118
|
+
scope.version.value;
|
|
119
|
+
return h("input", {
|
|
120
|
+
...attrs,
|
|
121
|
+
"data-part": "input-editor",
|
|
122
|
+
...scope.disabled() ? { disabled: true } : {},
|
|
123
|
+
...scope.readOnly() ? { readonly: true } : {},
|
|
124
|
+
ref: scope.editor,
|
|
125
|
+
onKeydown
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
/** One token's element, carrying its type, id and status. */
|
|
131
|
+
const TokenInputToken = defineComponent({
|
|
132
|
+
name: "TokenInputToken",
|
|
133
|
+
setup(_props, { slots }) {
|
|
134
|
+
const token = inject(TOKEN, null);
|
|
135
|
+
return () => {
|
|
136
|
+
const current = token?.();
|
|
137
|
+
return h("span", {
|
|
138
|
+
"data-part": "input-token",
|
|
139
|
+
"data-token-type": current?.type,
|
|
140
|
+
"data-token-id": current?.id,
|
|
141
|
+
...current?.status === "pending" ? { "data-pending": "" } : {},
|
|
142
|
+
...current?.status === "error" ? { "data-error": "" } : {}
|
|
143
|
+
}, slots.default?.() ?? current?.label);
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
/** Removes the token it sits in and returns focus to the editor. */
|
|
148
|
+
const TokenInputTokenRemove = defineComponent({
|
|
149
|
+
name: "TokenInputTokenRemove",
|
|
150
|
+
setup(_props, { slots }) {
|
|
151
|
+
const scope = useScope("TokenInputTokenRemove");
|
|
152
|
+
const token = inject(TOKEN, null);
|
|
153
|
+
const onClick = (event) => {
|
|
154
|
+
const id = token?.().id;
|
|
155
|
+
if (event.defaultPrevented || id === void 0) return;
|
|
156
|
+
scope.store.removeToken(id);
|
|
157
|
+
scope.editor.value?.focus();
|
|
158
|
+
};
|
|
159
|
+
return () => {
|
|
160
|
+
scope.version.value;
|
|
161
|
+
const current = token?.();
|
|
162
|
+
return h("button", {
|
|
163
|
+
type: "button",
|
|
164
|
+
"data-part": "input-token-remove",
|
|
165
|
+
"aria-label": current ? `Remove ${current.label}` : void 0,
|
|
166
|
+
...scope.disabled() || scope.readOnly() ? { disabled: true } : {},
|
|
167
|
+
onClick
|
|
168
|
+
}, slots.default?.() ?? "×");
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
// src/token-input.ts
|
|
173
|
+
const schema = vueOptions(tokenInputPrimitive, {
|
|
174
|
+
modelValue: ["tokens", "onChange"],
|
|
175
|
+
tokens: ["tokens", "onChange"],
|
|
176
|
+
inputValue: ["inputValue", "onInput"]
|
|
177
|
+
});
|
|
178
|
+
const NO_TOKENS = [];
|
|
179
|
+
/** The tokens as the structured values `getValue` and `submit` report. */
|
|
180
|
+
const tokenValues = (tokens) => tokens.map((token) => ({
|
|
181
|
+
id: token.id,
|
|
182
|
+
type: "token",
|
|
183
|
+
value: token.id,
|
|
184
|
+
label: token.label
|
|
185
|
+
}));
|
|
186
|
+
const NO_SUGGESTIONS = [];
|
|
187
|
+
const TokenInput = defineComponent({
|
|
188
|
+
name: "TokenInput",
|
|
189
|
+
inheritAttrs: false,
|
|
190
|
+
props: {
|
|
191
|
+
...schema.props,
|
|
192
|
+
tokens: {
|
|
193
|
+
type: Array,
|
|
194
|
+
required: false
|
|
195
|
+
},
|
|
196
|
+
inputValue: {
|
|
197
|
+
type: String,
|
|
198
|
+
required: false
|
|
199
|
+
},
|
|
200
|
+
disabled: {
|
|
201
|
+
type: Boolean,
|
|
202
|
+
default: false
|
|
203
|
+
},
|
|
204
|
+
label: {
|
|
205
|
+
type: String,
|
|
206
|
+
default: ""
|
|
207
|
+
},
|
|
208
|
+
placeholder: {
|
|
209
|
+
type: String,
|
|
210
|
+
default: ""
|
|
211
|
+
},
|
|
212
|
+
suggestions: {
|
|
213
|
+
type: Array,
|
|
214
|
+
required: false
|
|
215
|
+
},
|
|
216
|
+
/** Shows the tokens but refuses every add and remove, staying focusable. */
|
|
217
|
+
readOnly: {
|
|
218
|
+
type: Boolean,
|
|
219
|
+
default: false
|
|
220
|
+
},
|
|
221
|
+
/** Composed form (a default slot): controlled mixed text and token segments, also `v-model`. */
|
|
222
|
+
value: {
|
|
223
|
+
type: Array,
|
|
224
|
+
required: false
|
|
225
|
+
},
|
|
226
|
+
/** Composed form: the segments an uncontrolled field starts with. */
|
|
227
|
+
defaultValue: {
|
|
228
|
+
type: Array,
|
|
229
|
+
required: false
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
emits: {
|
|
233
|
+
...schema.emits,
|
|
234
|
+
/** Enter in an empty editor: the tokens, as `{ id, type, value, label }` values. */
|
|
235
|
+
/** Enter in an empty editor: the tokens; in the composed form, the segments and the editor's text. */
|
|
236
|
+
submit: (_value) => true,
|
|
237
|
+
/** Composed form: the next segments. */
|
|
238
|
+
"update:value": (_value) => true
|
|
239
|
+
},
|
|
240
|
+
slots: Object,
|
|
241
|
+
setup(props, { attrs, slots, expose, emit }) {
|
|
242
|
+
if (slots.default !== void 0) return setupTokenInputSegments(props, emit, attrs, slots, expose);
|
|
243
|
+
const handle = usePrimitive(tokenInputPrimitive, schema.bind(props, () => ({
|
|
244
|
+
tokens: props.tokens ?? NO_TOKENS,
|
|
245
|
+
suggestions: props.suggestions ?? NO_SUGGESTIONS,
|
|
246
|
+
...props.readOnly ? { onChange: () => {} } : {}
|
|
247
|
+
})));
|
|
248
|
+
const kernel = handle.api;
|
|
249
|
+
const editorElement = ref(null);
|
|
250
|
+
expose({ api: {
|
|
251
|
+
...kernel,
|
|
252
|
+
getValue: () => tokenValues(kernel.tokens()),
|
|
253
|
+
getLabel: () => kernel.tokens().map((token) => token.label).join(", "),
|
|
254
|
+
removeToken: (id) => kernel.remove(id),
|
|
255
|
+
focus: () => editorElement.value?.focus()
|
|
256
|
+
} });
|
|
257
|
+
const submitOnEnter = (event) => {
|
|
258
|
+
if (event.key !== "Enter" || event.isComposing || (editorElement.value?.value ?? "") !== "") return;
|
|
259
|
+
emit("submit", tokenValues(kernel.tokens()));
|
|
260
|
+
};
|
|
261
|
+
const api = handle.api;
|
|
262
|
+
return () => {
|
|
263
|
+
handle.revision.value;
|
|
264
|
+
const tokens = props.tokens ?? NO_TOKENS;
|
|
265
|
+
const chips = renderPart(handle, "chips", { key: "chips" }, tokens.map((token, index) => renderPart(handle, "input-token", { key: token.id }, [h("span", { "data-token-label": "" }, slots.token?.({
|
|
266
|
+
token,
|
|
267
|
+
index
|
|
268
|
+
}) ?? token.label), renderPart(handle, "input-token-remove", props.readOnly ? {
|
|
269
|
+
key: `${token.id}-remove`,
|
|
270
|
+
disabled: true
|
|
271
|
+
} : { key: `${token.id}-remove` }, "×", { index })], { index })));
|
|
272
|
+
const editor = renderPart(handle, "input-editor", {
|
|
273
|
+
key: "input-editor",
|
|
274
|
+
...props.readOnly ? { readonly: true } : {},
|
|
275
|
+
onKeydown: submitOnEnter,
|
|
276
|
+
ref: (node) => {
|
|
277
|
+
editorElement.value = node;
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
const visibleCount = api.visibleOptions().length;
|
|
281
|
+
const listbox = renderPart(handle, "listbox", { key: "listbox" }, Array.from({ length: visibleCount }, (_unused, index) => renderPart(handle, "option", { key: index }, api.visibleOptions()[index], { index })));
|
|
282
|
+
const host = {};
|
|
283
|
+
for (const [key, value] of Object.entries(attrs)) {
|
|
284
|
+
if (key === "onInput" || key === "onChange" || key === "onQueryChange") continue;
|
|
285
|
+
host[key] = value;
|
|
286
|
+
}
|
|
287
|
+
return renderPart(handle, "root", host, [h(Fragment, null, [
|
|
288
|
+
chips,
|
|
289
|
+
editor,
|
|
290
|
+
listbox
|
|
291
|
+
])]);
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
export { fromText as a, TokenInputTokenRemove as i, TokenInputEditor as n, toLabel as o, TokenInputToken as r, toText as s, TokenInput as t };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_token_input = require("./token-input-BTReOHIv.cjs");
|
|
3
|
+
exports.TokenInput = require_token_input.TokenInput;
|
|
4
|
+
exports.TokenInputEditor = require_token_input.TokenInputEditor;
|
|
5
|
+
exports.TokenInputToken = require_token_input.TokenInputToken;
|
|
6
|
+
exports.TokenInputTokenRemove = require_token_input.TokenInputTokenRemove;
|
|
7
|
+
exports.fromText = require_token_input.fromText;
|
|
8
|
+
exports.toLabel = require_token_input.toLabel;
|
|
9
|
+
exports.toText = require_token_input.toText;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as TokenInputChangeDetails, c as TokenInputSegmentsApi, d as TokenInputValue, f as fromText, i as TokenCodec, l as TokenInputToken, m as toText, n as TokenInputProps, o as TokenInputEditor, p as toLabel, r as Token, s as TokenInputSegment, t as TokenInput, u as TokenInputTokenRemove } from "./token-input-BIC9VLMG.cjs";
|
|
2
|
+
export { type Token, type TokenCodec, TokenInput, type TokenInputChangeDetails, TokenInputEditor, TokenInputProps, type TokenInputSegment, type TokenInputSegmentsApi, TokenInputToken, TokenInputTokenRemove, type TokenInputValue, fromText, toLabel, toText };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as TokenInputChangeDetails, c as TokenInputSegmentsApi, d as TokenInputValue, f as fromText, i as TokenCodec, l as TokenInputToken, m as toText, n as TokenInputProps, o as TokenInputEditor, p as toLabel, r as Token, s as TokenInputSegment, t as TokenInput, u as TokenInputTokenRemove } from "./token-input-CQnZ6-pO.js";
|
|
2
|
+
export { type Token, type TokenCodec, TokenInput, type TokenInputChangeDetails, TokenInputEditor, TokenInputProps, type TokenInputSegment, type TokenInputSegmentsApi, TokenInputToken, TokenInputTokenRemove, type TokenInputValue, fromText, toLabel, toText };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as TokenInput, n as TokenInputEditor, r as TokenInputToken, i as TokenInputTokenRemove, a as fromText, o as toLabel, s as toText } from "./token-input-DtcCZrcC.js";
|
package/dist/toolbar.cjs
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_headless = require("./headless-D88yFw8W.cjs");
|
|
3
|
+
const require_describe = require("./describe-D_dLtwde.cjs");
|
|
4
|
+
const require_options = require("./options-BDn36q6n.cjs");
|
|
5
|
+
let _bevelo_core = require("@bevelo/core");
|
|
6
|
+
let vue = require("vue");
|
|
7
|
+
// src/toolbar.ts
|
|
8
|
+
const schema = require_options.vueOptions(_bevelo_core.toolbarPrimitive);
|
|
9
|
+
function partNameOf(item) {
|
|
10
|
+
return item.kind ?? "button";
|
|
11
|
+
}
|
|
12
|
+
const Toolbar = (0, vue.defineComponent)({
|
|
13
|
+
name: "Toolbar",
|
|
14
|
+
inheritAttrs: false,
|
|
15
|
+
props: {
|
|
16
|
+
...schema.props,
|
|
17
|
+
orientation: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: false
|
|
20
|
+
},
|
|
21
|
+
disabled: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
required: false
|
|
24
|
+
},
|
|
25
|
+
label: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: false
|
|
28
|
+
},
|
|
29
|
+
items: {
|
|
30
|
+
type: Array,
|
|
31
|
+
required: false
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
emits: schema.emits,
|
|
35
|
+
setup(props, { attrs, expose }) {
|
|
36
|
+
const handle = require_headless.usePrimitive(_bevelo_core.toolbarPrimitive, schema.bind(props));
|
|
37
|
+
const primitiveApi = handle.api;
|
|
38
|
+
expose({ api: {
|
|
39
|
+
get activeValue() {
|
|
40
|
+
return primitiveApi.activeValue;
|
|
41
|
+
},
|
|
42
|
+
focusItem: (value) => primitiveApi.focusItem(value),
|
|
43
|
+
trackFocus: (value) => primitiveApi.trackFocus(value),
|
|
44
|
+
focus: () => primitiveApi.focusItem(primitiveApi.activeValue)
|
|
45
|
+
} });
|
|
46
|
+
const renderItem = (item) => {
|
|
47
|
+
const kind = partNameOf(item);
|
|
48
|
+
let children;
|
|
49
|
+
if (item.kind === "group") children = item.items.map((child) => renderItem(child));
|
|
50
|
+
else if (item.kind === "separator" || item.kind === "input") children = void 0;
|
|
51
|
+
else children = require_describe.descriptionNodes([...item.icon ?? [], item.label]);
|
|
52
|
+
const host = { key: item.value };
|
|
53
|
+
return require_headless.renderPart(handle, kind, host, children, { scope: item.value });
|
|
54
|
+
};
|
|
55
|
+
return () => {
|
|
56
|
+
const entries = (props.items ?? []).map((item) => renderItem(item));
|
|
57
|
+
const host = { ...attrs };
|
|
58
|
+
return require_headless.renderPart(handle, "root", host, entries);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
exports.Toolbar = Toolbar;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { n as OptionEmits } from "./options-DUGLoksA.cjs";
|
|
2
|
+
import { VNodeChild } from "vue";
|
|
3
|
+
import { PrimitiveToolbarApi } from "@bevelo/core";
|
|
4
|
+
/** A toolbar's imperative handle: the primitive's api plus `focus()`. */
|
|
5
|
+
export type ToolbarApi = PrimitiveToolbarApi & {
|
|
6
|
+
/** Moves focus to the entry that holds the tab stop. */
|
|
7
|
+
focus(): void;
|
|
8
|
+
};
|
|
9
|
+
export declare const Toolbar: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
10
|
+
orientation: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
required: false;
|
|
13
|
+
};
|
|
14
|
+
disabled: {
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
required: false;
|
|
17
|
+
};
|
|
18
|
+
label: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
required: false;
|
|
21
|
+
};
|
|
22
|
+
items: {
|
|
23
|
+
type: ArrayConstructor;
|
|
24
|
+
required: false;
|
|
25
|
+
};
|
|
26
|
+
directionForKey: {
|
|
27
|
+
type: import("vue").PropType<(input: unknown) => "ltr" | "rtl">;
|
|
28
|
+
default: undefined;
|
|
29
|
+
};
|
|
30
|
+
}>, () => VNodeChild, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, OptionEmits<import("@bevelo/core").PrimitiveToolbarOptions>, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
31
|
+
orientation: {
|
|
32
|
+
type: StringConstructor;
|
|
33
|
+
required: false;
|
|
34
|
+
};
|
|
35
|
+
disabled: {
|
|
36
|
+
type: BooleanConstructor;
|
|
37
|
+
required: false;
|
|
38
|
+
};
|
|
39
|
+
label: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
required: false;
|
|
42
|
+
};
|
|
43
|
+
items: {
|
|
44
|
+
type: ArrayConstructor;
|
|
45
|
+
required: false;
|
|
46
|
+
};
|
|
47
|
+
directionForKey: {
|
|
48
|
+
type: import("vue").PropType<(input: unknown) => "ltr" | "rtl">;
|
|
49
|
+
default: undefined;
|
|
50
|
+
};
|
|
51
|
+
}>> & Readonly<{
|
|
52
|
+
onClick?: (value: string) => any;
|
|
53
|
+
}>, {
|
|
54
|
+
directionForKey: (input: unknown) => "ltr" | "rtl";
|
|
55
|
+
disabled: boolean;
|
|
56
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
57
|
+
/** Props for `Toolbar`. */
|
|
58
|
+
export type ToolbarProps = InstanceType<typeof Toolbar>["$props"];
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { n as OptionEmits } from "./options-CGl5jBEY.js";
|
|
2
|
+
import { PrimitiveToolbarApi } from "@bevelo/core";
|
|
3
|
+
import { VNodeChild } from "vue";
|
|
4
|
+
/** A toolbar's imperative handle: the primitive's api plus `focus()`. */
|
|
5
|
+
export type ToolbarApi = PrimitiveToolbarApi & {
|
|
6
|
+
/** Moves focus to the entry that holds the tab stop. */
|
|
7
|
+
focus(): void;
|
|
8
|
+
};
|
|
9
|
+
export declare const Toolbar: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
10
|
+
orientation: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
required: false;
|
|
13
|
+
};
|
|
14
|
+
disabled: {
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
required: false;
|
|
17
|
+
};
|
|
18
|
+
label: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
required: false;
|
|
21
|
+
};
|
|
22
|
+
items: {
|
|
23
|
+
type: ArrayConstructor;
|
|
24
|
+
required: false;
|
|
25
|
+
};
|
|
26
|
+
directionForKey: {
|
|
27
|
+
type: import("vue").PropType<(input: unknown) => "ltr" | "rtl">;
|
|
28
|
+
default: undefined;
|
|
29
|
+
};
|
|
30
|
+
}>, () => VNodeChild, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, OptionEmits<import("@bevelo/core").PrimitiveToolbarOptions>, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
31
|
+
orientation: {
|
|
32
|
+
type: StringConstructor;
|
|
33
|
+
required: false;
|
|
34
|
+
};
|
|
35
|
+
disabled: {
|
|
36
|
+
type: BooleanConstructor;
|
|
37
|
+
required: false;
|
|
38
|
+
};
|
|
39
|
+
label: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
required: false;
|
|
42
|
+
};
|
|
43
|
+
items: {
|
|
44
|
+
type: ArrayConstructor;
|
|
45
|
+
required: false;
|
|
46
|
+
};
|
|
47
|
+
directionForKey: {
|
|
48
|
+
type: import("vue").PropType<(input: unknown) => "ltr" | "rtl">;
|
|
49
|
+
default: undefined;
|
|
50
|
+
};
|
|
51
|
+
}>> & Readonly<{
|
|
52
|
+
onClick?: (value: string) => any;
|
|
53
|
+
}>, {
|
|
54
|
+
directionForKey: (input: unknown) => "ltr" | "rtl";
|
|
55
|
+
disabled: boolean;
|
|
56
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
57
|
+
/** Props for `Toolbar`. */
|
|
58
|
+
export type ToolbarProps = InstanceType<typeof Toolbar>["$props"];
|
package/dist/toolbar.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { n as usePrimitive, t as renderPart } from "./headless-B3zQWaJm.js";
|
|
2
|
+
import { n as descriptionNodes } from "./describe-BlNg9SbK.js";
|
|
3
|
+
import { t as vueOptions } from "./options-BlkyK-uO.js";
|
|
4
|
+
import { toolbarPrimitive } from "@bevelo/core";
|
|
5
|
+
import { defineComponent } from "vue";
|
|
6
|
+
// src/toolbar.ts
|
|
7
|
+
const schema = vueOptions(toolbarPrimitive);
|
|
8
|
+
function partNameOf(item) {
|
|
9
|
+
return item.kind ?? "button";
|
|
10
|
+
}
|
|
11
|
+
const Toolbar = defineComponent({
|
|
12
|
+
name: "Toolbar",
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
props: {
|
|
15
|
+
...schema.props,
|
|
16
|
+
orientation: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: false
|
|
19
|
+
},
|
|
20
|
+
disabled: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
required: false
|
|
23
|
+
},
|
|
24
|
+
label: {
|
|
25
|
+
type: String,
|
|
26
|
+
required: false
|
|
27
|
+
},
|
|
28
|
+
items: {
|
|
29
|
+
type: Array,
|
|
30
|
+
required: false
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
emits: schema.emits,
|
|
34
|
+
setup(props, { attrs, expose }) {
|
|
35
|
+
const handle = usePrimitive(toolbarPrimitive, schema.bind(props));
|
|
36
|
+
const primitiveApi = handle.api;
|
|
37
|
+
expose({ api: {
|
|
38
|
+
get activeValue() {
|
|
39
|
+
return primitiveApi.activeValue;
|
|
40
|
+
},
|
|
41
|
+
focusItem: (value) => primitiveApi.focusItem(value),
|
|
42
|
+
trackFocus: (value) => primitiveApi.trackFocus(value),
|
|
43
|
+
focus: () => primitiveApi.focusItem(primitiveApi.activeValue)
|
|
44
|
+
} });
|
|
45
|
+
const renderItem = (item) => {
|
|
46
|
+
const kind = partNameOf(item);
|
|
47
|
+
let children;
|
|
48
|
+
if (item.kind === "group") children = item.items.map((child) => renderItem(child));
|
|
49
|
+
else if (item.kind === "separator" || item.kind === "input") children = void 0;
|
|
50
|
+
else children = descriptionNodes([...item.icon ?? [], item.label]);
|
|
51
|
+
const host = { key: item.value };
|
|
52
|
+
return renderPart(handle, kind, host, children, { scope: item.value });
|
|
53
|
+
};
|
|
54
|
+
return () => {
|
|
55
|
+
const entries = (props.items ?? []).map((item) => renderItem(item));
|
|
56
|
+
const host = { ...attrs };
|
|
57
|
+
return renderPart(handle, "root", host, entries);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
export { Toolbar };
|