@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,76 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _bevelo_core = require("@bevelo/core");
|
|
3
|
+
let vue = require("vue");
|
|
4
|
+
// src/async-options.ts
|
|
5
|
+
const STATUS = {
|
|
6
|
+
idle: "idle",
|
|
7
|
+
loading: "loading",
|
|
8
|
+
loaded: "ready",
|
|
9
|
+
failed: "error"
|
|
10
|
+
};
|
|
11
|
+
const DEFAULT_DEBOUNCE = 150;
|
|
12
|
+
/**
|
|
13
|
+
* Loads options as a query changes, keeping only the latest answer. Disposal
|
|
14
|
+
* follows the calling effect scope (a component's setup included): pending
|
|
15
|
+
* work is aborted when it ends.
|
|
16
|
+
*/
|
|
17
|
+
function useAsyncOptions(load, options = {}) {
|
|
18
|
+
const debounce = options.debounceMs ?? options.debounce ?? DEFAULT_DEBOUNCE;
|
|
19
|
+
const result = (0, vue.shallowReactive)({
|
|
20
|
+
items: [],
|
|
21
|
+
status: options.immediate === true ? "loading" : "idle",
|
|
22
|
+
hasMore: false,
|
|
23
|
+
error: void 0,
|
|
24
|
+
query: options.query ?? "",
|
|
25
|
+
setQuery(query) {
|
|
26
|
+
result.query = query;
|
|
27
|
+
binding.query(query);
|
|
28
|
+
},
|
|
29
|
+
reload() {
|
|
30
|
+
if (binding.state().status === "failed") {
|
|
31
|
+
binding.retry();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
binding.dispose();
|
|
35
|
+
binding = create(result.query, true);
|
|
36
|
+
binding.start();
|
|
37
|
+
},
|
|
38
|
+
loadMore() {
|
|
39
|
+
binding.loadMore();
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
function create(query, immediate) {
|
|
43
|
+
const created = (0, _bevelo_core.createAsyncOptions)({
|
|
44
|
+
load: async (request, signal) => {
|
|
45
|
+
const answer = await load(request.query, {
|
|
46
|
+
signal,
|
|
47
|
+
page: request.page
|
|
48
|
+
});
|
|
49
|
+
return Array.isArray(answer) ? {
|
|
50
|
+
items: answer,
|
|
51
|
+
hasMore: false
|
|
52
|
+
} : answer;
|
|
53
|
+
},
|
|
54
|
+
init: {
|
|
55
|
+
query,
|
|
56
|
+
debounce,
|
|
57
|
+
immediate
|
|
58
|
+
},
|
|
59
|
+
onChange: (state) => {
|
|
60
|
+
if (created !== binding) return;
|
|
61
|
+
result.status = STATUS[state.status];
|
|
62
|
+
result.query = state.query;
|
|
63
|
+
result.error = state.error;
|
|
64
|
+
result.hasMore = state.hasMore;
|
|
65
|
+
if (state.status !== "loading") result.items = state.items;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return created;
|
|
69
|
+
}
|
|
70
|
+
let binding = create(options.query ?? "", options.immediate === true);
|
|
71
|
+
if ((0, vue.getCurrentInstance)() !== null) (0, vue.onMounted)(() => binding.start());
|
|
72
|
+
else binding.start();
|
|
73
|
+
if ((0, vue.getCurrentScope)() !== void 0) (0, vue.onScopeDispose)(() => binding.dispose());
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
exports.useAsyncOptions = useAsyncOptions;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** Where the options stand. */
|
|
2
|
+
export type AsyncOptionsStatus = "idle" | "loading" | "ready" | "error";
|
|
3
|
+
/** What the loader receives beside the query. */
|
|
4
|
+
export interface AsyncOptionsContext {
|
|
5
|
+
/** Aborts when a newer query, a reload or the scope's disposal supersedes this load. */
|
|
6
|
+
readonly signal: AbortSignal;
|
|
7
|
+
/** 0 for the first page, then 1, 2… for each `loadMore()`. */
|
|
8
|
+
readonly page: number;
|
|
9
|
+
}
|
|
10
|
+
/** One load: the items alone, or the items and whether another page exists. */
|
|
11
|
+
export type AsyncOptionsLoad<Item> = (query: string, context: AsyncOptionsContext) => Promise<readonly Item[] | {
|
|
12
|
+
readonly items: readonly Item[];
|
|
13
|
+
readonly hasMore?: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
/** Options for `useAsyncOptions`. */
|
|
16
|
+
export interface AsyncOptionsOptions {
|
|
17
|
+
/** Milliseconds typing must pause before a load starts. Defaults to 150. */
|
|
18
|
+
readonly debounceMs?: number;
|
|
19
|
+
/** The same as `debounceMs`. */
|
|
20
|
+
readonly debounce?: number;
|
|
21
|
+
/** Loads the initial query once mounted, without waiting for typing. */
|
|
22
|
+
readonly immediate?: boolean;
|
|
23
|
+
/** The initial query. Defaults to "". */
|
|
24
|
+
readonly query?: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
/** The reactive result: the current answer and the setters that drive it. */
|
|
27
|
+
export interface AsyncOptionsResult<Item> {
|
|
28
|
+
/** The latest answer; kept on screen while a newer query loads. */
|
|
29
|
+
readonly items: readonly Item[];
|
|
30
|
+
readonly status: AsyncOptionsStatus;
|
|
31
|
+
/** Whether `loadMore()` has another page to ask for. */
|
|
32
|
+
readonly hasMore: boolean;
|
|
33
|
+
/** What the last load rejected with, while `status` is "error". */
|
|
34
|
+
readonly error: unknown;
|
|
35
|
+
/** The query the next answer is for. */
|
|
36
|
+
readonly query: string;
|
|
37
|
+
/** Changes the query; the load starts once typing pauses. */
|
|
38
|
+
setQuery(query: string): void;
|
|
39
|
+
/** Loads the current query again, now. */
|
|
40
|
+
reload(): void;
|
|
41
|
+
/** Appends the next page when one exists. */
|
|
42
|
+
loadMore(): void;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Loads options as a query changes, keeping only the latest answer. Disposal
|
|
46
|
+
* follows the calling effect scope (a component's setup included): pending
|
|
47
|
+
* work is aborted when it ends.
|
|
48
|
+
*/
|
|
49
|
+
export declare function useAsyncOptions<Item>(load: AsyncOptionsLoad<Item>, options?: AsyncOptionsOptions): AsyncOptionsResult<Item>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** Where the options stand. */
|
|
2
|
+
export type AsyncOptionsStatus = "idle" | "loading" | "ready" | "error";
|
|
3
|
+
/** What the loader receives beside the query. */
|
|
4
|
+
export interface AsyncOptionsContext {
|
|
5
|
+
/** Aborts when a newer query, a reload or the scope's disposal supersedes this load. */
|
|
6
|
+
readonly signal: AbortSignal;
|
|
7
|
+
/** 0 for the first page, then 1, 2… for each `loadMore()`. */
|
|
8
|
+
readonly page: number;
|
|
9
|
+
}
|
|
10
|
+
/** One load: the items alone, or the items and whether another page exists. */
|
|
11
|
+
export type AsyncOptionsLoad<Item> = (query: string, context: AsyncOptionsContext) => Promise<readonly Item[] | {
|
|
12
|
+
readonly items: readonly Item[];
|
|
13
|
+
readonly hasMore?: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
/** Options for `useAsyncOptions`. */
|
|
16
|
+
export interface AsyncOptionsOptions {
|
|
17
|
+
/** Milliseconds typing must pause before a load starts. Defaults to 150. */
|
|
18
|
+
readonly debounceMs?: number;
|
|
19
|
+
/** The same as `debounceMs`. */
|
|
20
|
+
readonly debounce?: number;
|
|
21
|
+
/** Loads the initial query once mounted, without waiting for typing. */
|
|
22
|
+
readonly immediate?: boolean;
|
|
23
|
+
/** The initial query. Defaults to "". */
|
|
24
|
+
readonly query?: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
/** The reactive result: the current answer and the setters that drive it. */
|
|
27
|
+
export interface AsyncOptionsResult<Item> {
|
|
28
|
+
/** The latest answer; kept on screen while a newer query loads. */
|
|
29
|
+
readonly items: readonly Item[];
|
|
30
|
+
readonly status: AsyncOptionsStatus;
|
|
31
|
+
/** Whether `loadMore()` has another page to ask for. */
|
|
32
|
+
readonly hasMore: boolean;
|
|
33
|
+
/** What the last load rejected with, while `status` is "error". */
|
|
34
|
+
readonly error: unknown;
|
|
35
|
+
/** The query the next answer is for. */
|
|
36
|
+
readonly query: string;
|
|
37
|
+
/** Changes the query; the load starts once typing pauses. */
|
|
38
|
+
setQuery(query: string): void;
|
|
39
|
+
/** Loads the current query again, now. */
|
|
40
|
+
reload(): void;
|
|
41
|
+
/** Appends the next page when one exists. */
|
|
42
|
+
loadMore(): void;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Loads options as a query changes, keeping only the latest answer. Disposal
|
|
46
|
+
* follows the calling effect scope (a component's setup included): pending
|
|
47
|
+
* work is aborted when it ends.
|
|
48
|
+
*/
|
|
49
|
+
export declare function useAsyncOptions<Item>(load: AsyncOptionsLoad<Item>, options?: AsyncOptionsOptions): AsyncOptionsResult<Item>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { createAsyncOptions } from "@bevelo/core";
|
|
2
|
+
import { getCurrentInstance, getCurrentScope, onMounted, onScopeDispose, shallowReactive } from "vue";
|
|
3
|
+
// src/async-options.ts
|
|
4
|
+
const STATUS = {
|
|
5
|
+
idle: "idle",
|
|
6
|
+
loading: "loading",
|
|
7
|
+
loaded: "ready",
|
|
8
|
+
failed: "error"
|
|
9
|
+
};
|
|
10
|
+
const DEFAULT_DEBOUNCE = 150;
|
|
11
|
+
/**
|
|
12
|
+
* Loads options as a query changes, keeping only the latest answer. Disposal
|
|
13
|
+
* follows the calling effect scope (a component's setup included): pending
|
|
14
|
+
* work is aborted when it ends.
|
|
15
|
+
*/
|
|
16
|
+
function useAsyncOptions(load, options = {}) {
|
|
17
|
+
const debounce = options.debounceMs ?? options.debounce ?? DEFAULT_DEBOUNCE;
|
|
18
|
+
const result = shallowReactive({
|
|
19
|
+
items: [],
|
|
20
|
+
status: options.immediate === true ? "loading" : "idle",
|
|
21
|
+
hasMore: false,
|
|
22
|
+
error: void 0,
|
|
23
|
+
query: options.query ?? "",
|
|
24
|
+
setQuery(query) {
|
|
25
|
+
result.query = query;
|
|
26
|
+
binding.query(query);
|
|
27
|
+
},
|
|
28
|
+
reload() {
|
|
29
|
+
if (binding.state().status === "failed") {
|
|
30
|
+
binding.retry();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
binding.dispose();
|
|
34
|
+
binding = create(result.query, true);
|
|
35
|
+
binding.start();
|
|
36
|
+
},
|
|
37
|
+
loadMore() {
|
|
38
|
+
binding.loadMore();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
function create(query, immediate) {
|
|
42
|
+
const created = createAsyncOptions({
|
|
43
|
+
load: async (request, signal) => {
|
|
44
|
+
const answer = await load(request.query, {
|
|
45
|
+
signal,
|
|
46
|
+
page: request.page
|
|
47
|
+
});
|
|
48
|
+
return Array.isArray(answer) ? {
|
|
49
|
+
items: answer,
|
|
50
|
+
hasMore: false
|
|
51
|
+
} : answer;
|
|
52
|
+
},
|
|
53
|
+
init: {
|
|
54
|
+
query,
|
|
55
|
+
debounce,
|
|
56
|
+
immediate
|
|
57
|
+
},
|
|
58
|
+
onChange: (state) => {
|
|
59
|
+
if (created !== binding) return;
|
|
60
|
+
result.status = STATUS[state.status];
|
|
61
|
+
result.query = state.query;
|
|
62
|
+
result.error = state.error;
|
|
63
|
+
result.hasMore = state.hasMore;
|
|
64
|
+
if (state.status !== "loading") result.items = state.items;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
return created;
|
|
68
|
+
}
|
|
69
|
+
let binding = create(options.query ?? "", options.immediate === true);
|
|
70
|
+
if (getCurrentInstance() !== null) onMounted(() => binding.start());
|
|
71
|
+
else binding.start();
|
|
72
|
+
if (getCurrentScope() !== void 0) onScopeDispose(() => binding.dispose());
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
export { useAsyncOptions };
|
|
@@ -0,0 +1,274 @@
|
|
|
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
|
+
const require_option_row = require("./option-row-hLg6Ye86.cjs");
|
|
6
|
+
let _bevelo_core = require("@bevelo/core");
|
|
7
|
+
let vue = require("vue");
|
|
8
|
+
// src/autocomplete.ts
|
|
9
|
+
const schema = require_options.vueOptions(_bevelo_core.autocompletePrimitive, {
|
|
10
|
+
modelValue: ["value", "onChange"],
|
|
11
|
+
value: ["value", "onChange"],
|
|
12
|
+
query: ["query", "onInput"]
|
|
13
|
+
});
|
|
14
|
+
const NO_OPTIONS = [];
|
|
15
|
+
/** A suggestion's icon: a description, a string, or nothing. */
|
|
16
|
+
function iconNode(icon) {
|
|
17
|
+
if (icon === null || icon === void 0 || icon === false) return;
|
|
18
|
+
if (typeof icon === "string" || typeof icon === "number" || typeof icon === "bigint") return String(icon);
|
|
19
|
+
if (typeof icon === "object" && "tag" in icon) return require_describe.descriptionNode(icon, 0);
|
|
20
|
+
}
|
|
21
|
+
const Autocomplete = (0, vue.defineComponent)({
|
|
22
|
+
name: "Autocomplete",
|
|
23
|
+
inheritAttrs: false,
|
|
24
|
+
props: {
|
|
25
|
+
...schema.props,
|
|
26
|
+
options: {
|
|
27
|
+
type: Array,
|
|
28
|
+
required: false
|
|
29
|
+
},
|
|
30
|
+
/** Suggestions with groups and separators; wins over `options`. */
|
|
31
|
+
items: {
|
|
32
|
+
type: Array,
|
|
33
|
+
required: false
|
|
34
|
+
},
|
|
35
|
+
/** The suggestions while the field is blank, in `items`' shape. */
|
|
36
|
+
emptyItems: {
|
|
37
|
+
type: Array,
|
|
38
|
+
required: false
|
|
39
|
+
},
|
|
40
|
+
label: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: ""
|
|
43
|
+
},
|
|
44
|
+
id: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: ""
|
|
47
|
+
},
|
|
48
|
+
/** The field shows its value but the popup never opens and nothing commits. */
|
|
49
|
+
readOnly: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
/** "loading" shows the loading status; any string reaches the status slots. */
|
|
54
|
+
status: {
|
|
55
|
+
type: String,
|
|
56
|
+
required: false
|
|
57
|
+
},
|
|
58
|
+
/** The popup, controlled; pair with `v-model:open` or `@open-change`. */
|
|
59
|
+
open: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: void 0
|
|
62
|
+
},
|
|
63
|
+
defaultOpen: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: false
|
|
66
|
+
},
|
|
67
|
+
/** ArrowDown on the last suggestion goes to the first, ArrowUp on the first to the last. */
|
|
68
|
+
loop: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
default: false
|
|
71
|
+
},
|
|
72
|
+
/** Emits `submit` after a suggestion is chosen. */
|
|
73
|
+
submitOnSelect: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false
|
|
76
|
+
},
|
|
77
|
+
name: {
|
|
78
|
+
type: String,
|
|
79
|
+
required: false
|
|
80
|
+
},
|
|
81
|
+
form: {
|
|
82
|
+
type: String,
|
|
83
|
+
required: false
|
|
84
|
+
},
|
|
85
|
+
required: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: false
|
|
88
|
+
},
|
|
89
|
+
/** Shown while loading. */
|
|
90
|
+
loadingText: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: "Loading"
|
|
93
|
+
},
|
|
94
|
+
/** Shown when no suggestion matches. */
|
|
95
|
+
emptyText: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: "No suggestions"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
emits: {
|
|
101
|
+
...schema.emits,
|
|
102
|
+
openChange: (_open) => true,
|
|
103
|
+
"update:open": (_open) => true,
|
|
104
|
+
highlight: (_value, _details) => true,
|
|
105
|
+
submit: (_value) => true
|
|
106
|
+
},
|
|
107
|
+
slots: Object,
|
|
108
|
+
setup(props, { attrs, slots, emit, expose }) {
|
|
109
|
+
const fieldText = (0, vue.ref)(props.query ?? props.modelValue ?? props.value ?? props.defaultValue ?? "");
|
|
110
|
+
const source = (0, vue.computed)(() => {
|
|
111
|
+
if (props.items === void 0) return void 0;
|
|
112
|
+
return fieldText.value.trim() === "" && props.emptyItems !== void 0 ? props.emptyItems : props.items;
|
|
113
|
+
});
|
|
114
|
+
const sourceValues = (0, vue.computed)(() => source.value === void 0 ? void 0 : (0, _bevelo_core.autocompleteItemValues)(source.value));
|
|
115
|
+
const bound = schema.bind(props);
|
|
116
|
+
const handle = require_headless.usePrimitive(_bevelo_core.autocompletePrimitive, () => {
|
|
117
|
+
const given = bound();
|
|
118
|
+
const change = given["onChange"];
|
|
119
|
+
return {
|
|
120
|
+
...given,
|
|
121
|
+
options: sourceValues.value ?? props.options ?? NO_OPTIONS,
|
|
122
|
+
loading: props.status === "loading" ? true : props.loading,
|
|
123
|
+
...props.submitOnSelect ? { onChange: (value) => {
|
|
124
|
+
change?.(value);
|
|
125
|
+
if (value !== "") emit("submit", value);
|
|
126
|
+
} } : {}
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
const api = handle.api;
|
|
130
|
+
let syncing = false;
|
|
131
|
+
const syncOpen = () => {
|
|
132
|
+
const wanted = props.open;
|
|
133
|
+
if (wanted === void 0 || wanted === api.isOpen()) return;
|
|
134
|
+
syncing = true;
|
|
135
|
+
try {
|
|
136
|
+
if (wanted) api.open();
|
|
137
|
+
else api.close();
|
|
138
|
+
} finally {
|
|
139
|
+
syncing = false;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
if (props.open ?? props.defaultOpen) {
|
|
143
|
+
syncing = true;
|
|
144
|
+
api.open();
|
|
145
|
+
syncing = false;
|
|
146
|
+
}
|
|
147
|
+
let lastOpen = api.isOpen();
|
|
148
|
+
let lastActive = api.activeOption();
|
|
149
|
+
const report = () => {
|
|
150
|
+
if (props.readOnly && api.isOpen()) api.close();
|
|
151
|
+
fieldText.value = api.text();
|
|
152
|
+
const open = api.isOpen();
|
|
153
|
+
if (open !== lastOpen) {
|
|
154
|
+
lastOpen = open;
|
|
155
|
+
if (!syncing) {
|
|
156
|
+
emit("openChange", open);
|
|
157
|
+
emit("update:open", open);
|
|
158
|
+
if (props.open !== void 0) (0, vue.nextTick)(syncOpen);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const active = api.activeOption();
|
|
162
|
+
if (active !== lastActive) {
|
|
163
|
+
lastActive = active;
|
|
164
|
+
emit("highlight", active, { index: active === void 0 ? -1 : api.visible().indexOf(active) });
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
(0, vue.onBeforeUnmount)(handle.instance.subscribeLive(report));
|
|
168
|
+
(0, vue.watch)(() => props.open, syncOpen);
|
|
169
|
+
let input = null;
|
|
170
|
+
const setInput = (node) => {
|
|
171
|
+
input = node instanceof HTMLInputElement ? node : null;
|
|
172
|
+
};
|
|
173
|
+
expose({ api: {
|
|
174
|
+
...api,
|
|
175
|
+
focus: () => input?.focus()
|
|
176
|
+
} });
|
|
177
|
+
const onKeydown = (event) => {
|
|
178
|
+
attrs["onKeydown"]?.(event);
|
|
179
|
+
if (event.defaultPrevented) return;
|
|
180
|
+
if (props.readOnly && (event.key === "ArrowDown" || event.key === "ArrowUp")) {
|
|
181
|
+
event.preventDefault();
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (!props.loop || !api.isOpen()) return;
|
|
185
|
+
const step = (0, _bevelo_core.autocompleteLoopStep)(event.key, api.visible(), api.activeOption());
|
|
186
|
+
if (step === void 0) return;
|
|
187
|
+
event.preventDefault();
|
|
188
|
+
api.move(step);
|
|
189
|
+
};
|
|
190
|
+
return () => {
|
|
191
|
+
handle.revision.value;
|
|
192
|
+
const visible = api.visible();
|
|
193
|
+
const text = api.text();
|
|
194
|
+
const statusProps = {
|
|
195
|
+
loading: props.status === "loading" || props.loading === true,
|
|
196
|
+
count: visible.length,
|
|
197
|
+
query: text,
|
|
198
|
+
empty: visible.length === 0,
|
|
199
|
+
status: props.status ?? (props.loading === true ? "loading" : "idle")
|
|
200
|
+
};
|
|
201
|
+
const labelNode = require_headless.renderPart(handle, "label", { key: "label" }, props.label);
|
|
202
|
+
const inputNode = require_headless.renderPart(handle, "input", {
|
|
203
|
+
key: "input",
|
|
204
|
+
ref: setInput,
|
|
205
|
+
onChange: require_option_row.noop,
|
|
206
|
+
readonly: props.readOnly ? true : void 0,
|
|
207
|
+
name: props.name,
|
|
208
|
+
form: props.form,
|
|
209
|
+
required: props.required ? true : void 0
|
|
210
|
+
});
|
|
211
|
+
const triggerNode = require_headless.renderPart(handle, "trigger", { key: "trigger" }, [(0, vue.h)("span", { "aria-hidden": "true" }, slots.triggerIcon?.() ?? "▾")]);
|
|
212
|
+
const clearNode = props.readOnly ? null : require_headless.renderPart(handle, "clear", { key: "clear" }, slots.clearIcon?.() ?? "×");
|
|
213
|
+
const loadingNode = require_headless.renderPart(handle, "loading", { key: "loading" }, slots.loading?.(statusProps) ?? props.loadingText);
|
|
214
|
+
const emptyNode = require_headless.renderPart(handle, "empty", { key: "empty" }, slots.empty?.(statusProps) ?? props.emptyText);
|
|
215
|
+
const statusNode = slots.status === void 0 ? null : (0, vue.h)("div", {
|
|
216
|
+
key: "status",
|
|
217
|
+
role: "status",
|
|
218
|
+
"data-part": "status"
|
|
219
|
+
}, [slots.status(statusProps)]);
|
|
220
|
+
const icons = props.optionIcons;
|
|
221
|
+
const row = (option, index) => {
|
|
222
|
+
const active = (handle.part("option", { index })?.state)?.active === true;
|
|
223
|
+
const content = slots.option !== void 0 ? [slots.option({
|
|
224
|
+
option,
|
|
225
|
+
index,
|
|
226
|
+
active,
|
|
227
|
+
segments: (0, _bevelo_core.matchSegments)(option, text)
|
|
228
|
+
})] : [require_headless.renderPart(handle, "option-icon", { key: `${option}-icon` }, iconNode(icons?.[option]), { index }), require_headless.renderPart(handle, "option-label", { key: `${option}-label` }, option, { index })];
|
|
229
|
+
return require_headless.renderPart(handle, "option", { key: option }, [(0, vue.h)(vue.Fragment, null, content)], { index });
|
|
230
|
+
};
|
|
231
|
+
let rows;
|
|
232
|
+
if (source.value === void 0) rows = visible.map(row);
|
|
233
|
+
else {
|
|
234
|
+
const groupId = api.listboxId() + "-group-";
|
|
235
|
+
rows = (0, _bevelo_core.autocompleteSections)(source.value, visible).map((section, index) => {
|
|
236
|
+
if (section.kind === "row") return row(section.row.option, section.row.index);
|
|
237
|
+
if (section.kind === "separator") return (0, vue.h)("div", {
|
|
238
|
+
key: `separator:${index}`,
|
|
239
|
+
role: "separator",
|
|
240
|
+
"data-part": "separator"
|
|
241
|
+
});
|
|
242
|
+
return (0, vue.h)("div", {
|
|
243
|
+
key: `group:${index}`,
|
|
244
|
+
role: "group",
|
|
245
|
+
"data-part": "group",
|
|
246
|
+
"aria-labelledby": groupId + index
|
|
247
|
+
}, [(0, vue.h)("div", {
|
|
248
|
+
id: groupId + index,
|
|
249
|
+
"data-part": "label",
|
|
250
|
+
"data-scope": "group"
|
|
251
|
+
}, section.label), ...section.rows.map((entry) => row(entry.option, entry.index))]);
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
const listbox = require_headless.renderPart(handle, "listbox", { key: "listbox" }, rows);
|
|
255
|
+
const popup = require_headless.renderPart(handle, "popup", { key: "popup" }, [(0, vue.h)(vue.Fragment, null, [
|
|
256
|
+
loadingNode,
|
|
257
|
+
emptyNode,
|
|
258
|
+
listbox
|
|
259
|
+
])]);
|
|
260
|
+
return require_headless.renderPart(handle, "root", {
|
|
261
|
+
...attrs,
|
|
262
|
+
onKeydown
|
|
263
|
+
}, [(0, vue.h)(vue.Fragment, null, [
|
|
264
|
+
labelNode,
|
|
265
|
+
inputNode,
|
|
266
|
+
triggerNode,
|
|
267
|
+
clearNode,
|
|
268
|
+
statusNode,
|
|
269
|
+
popup
|
|
270
|
+
])]);
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
exports.Autocomplete = Autocomplete;
|