@nuxt/ui 3.0.0-alpha.1 → 3.0.0-alpha.10
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/.nuxt/ui/accordion.ts +20 -0
- package/.nuxt/ui/alert.ts +242 -0
- package/.nuxt/ui/avatar-group.ts +40 -0
- package/.nuxt/ui/avatar.ts +42 -0
- package/.nuxt/ui/badge.ts +194 -0
- package/.nuxt/ui/breadcrumb.ts +45 -0
- package/.nuxt/ui/button-group.ts +16 -0
- package/.nuxt/ui/button.ts +344 -0
- package/.nuxt/ui/calendar.ts +85 -0
- package/.nuxt/ui/card.ts +8 -0
- package/.nuxt/ui/carousel.ts +41 -0
- package/.nuxt/ui/checkbox.ts +105 -0
- package/.nuxt/ui/chip.ts +67 -0
- package/.nuxt/ui/collapsible.ts +6 -0
- package/.nuxt/ui/color-picker.ts +39 -0
- package/.nuxt/ui/command-palette.ts +50 -0
- package/.nuxt/ui/container.ts +3 -0
- package/.nuxt/ui/context-menu.ts +198 -0
- package/.nuxt/ui/drawer.ts +55 -0
- package/.nuxt/ui/dropdown-menu.ts +199 -0
- package/.nuxt/ui/form-field.ts +40 -0
- package/.nuxt/ui/form.ts +3 -0
- package/.nuxt/ui/index.ts +48 -0
- package/.nuxt/ui/input-menu.ts +410 -0
- package/.nuxt/ui/input-number.ts +204 -0
- package/.nuxt/ui/input.ts +263 -0
- package/.nuxt/ui/kbd.ts +19 -0
- package/.nuxt/ui/link.ts +15 -0
- package/.nuxt/ui/modal.ts +28 -0
- package/.nuxt/ui/navigation-menu.ts +390 -0
- package/.nuxt/ui/pagination.ts +8 -0
- package/.nuxt/ui/pin-input.ts +145 -0
- package/.nuxt/ui/popover.ts +6 -0
- package/.nuxt/ui/progress.ts +258 -0
- package/.nuxt/ui/radio-group.ts +112 -0
- package/.nuxt/ui/select-menu.ts +316 -0
- package/.nuxt/ui/select.ts +315 -0
- package/.nuxt/ui/separator.ts +143 -0
- package/.nuxt/ui/skeleton.ts +3 -0
- package/.nuxt/ui/slideover.ts +63 -0
- package/.nuxt/ui/slider.ts +148 -0
- package/.nuxt/ui/stepper.ts +180 -0
- package/.nuxt/ui/switch.ts +113 -0
- package/.nuxt/ui/table.ts +129 -0
- package/.nuxt/ui/tabs.ts +227 -0
- package/.nuxt/ui/textarea.ts +263 -0
- package/.nuxt/ui/toast.ts +66 -0
- package/.nuxt/ui/toaster.ts +75 -0
- package/.nuxt/ui/tooltip.ts +9 -0
- package/README.md +75 -54
- package/cli/commands/{init.mjs → make/component.mjs} +5 -5
- package/cli/commands/make/index.mjs +14 -0
- package/cli/commands/make/locale.mjs +64 -0
- package/cli/index.mjs +2 -2
- package/cli/templates.mjs +52 -7
- package/cli/utils.mjs +14 -0
- package/dist/chunks/component-meta.cjs +82802 -0
- package/dist/chunks/component-meta.mjs +82800 -0
- package/dist/client/devtools/200.html +1 -0
- package/dist/client/devtools/404.html +1 -0
- package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKK58UfivUw4aw-SK92LTmKP0.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKy58UfivUw-9uYm8d48E4.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu0-K6z9mXg-VNw7NHvqnp.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu6-K6z9mXgjU0-EkYdMs3MAX.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-7DW3w-R7n06NbhGy.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDG3w-leGNfkTmsj.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDW3w-ciElMF03ku.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JCm3w-sB722Uoa0f.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JDW3w-PBDI1JDjwV.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8gCm3w-0q1hqVn09O.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9XCm3w-ByvzuLy2fa.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9uCm3w-5TKCIs6EEw.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat_XDW3w-r2swRDGfn2.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAC5thTQ-ldB60l5U8r.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpthTQ-wbFKGFDrgo.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpxhTQ-LLUBv5jskj.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwARZthTQ-F71RdTRbNg.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwA_JxhTQ-6nh65gZkc0.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAfJthTQ-aMoWEJLmTt.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAkJxhTQ-WMBvmLOgKm.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAop1hTQ-utGC2hnWq2.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxhTQ-YpyTieVa5B.woff +0 -0
- package/dist/client/devtools/_nuxt/B1fTd_Rf.js +1 -0
- package/dist/client/devtools/_nuxt/CSUxkedg.js +1 -0
- package/dist/client/devtools/_nuxt/CbRTGpb7.js +1 -0
- package/dist/client/devtools/_nuxt/YQTlxbcT.js +53 -0
- package/dist/client/devtools/_nuxt/builds/latest.json +1 -0
- package/dist/client/devtools/_nuxt/builds/meta/b3465abc-0a92-4ee7-ba6b-e5174891fcc0.json +1 -0
- package/dist/client/devtools/_nuxt/entry.DXXceQev.css +1 -0
- package/dist/client/devtools/_nuxt/error-404.BJpkZFyY.css +1 -0
- package/dist/client/devtools/_nuxt/error-500.D3i9VDlt.css +1 -0
- package/dist/client/devtools/favicon.svg +1 -0
- package/dist/client/devtools/index.html +1 -0
- package/dist/devtools/runtime/DevtoolsRenderer.vue +54 -0
- package/dist/devtools/runtime/examples/AvatarGroupExample.vue +7 -0
- package/dist/devtools/runtime/examples/ButtonGroupExample.vue +8 -0
- package/dist/devtools/runtime/examples/CardExample.vue +13 -0
- package/dist/devtools/runtime/examples/CarouselExample.vue +13 -0
- package/dist/devtools/runtime/examples/ChipExample.vue +5 -0
- package/dist/devtools/runtime/examples/CollapsibleExample.vue +8 -0
- package/dist/devtools/runtime/examples/CommandPaletteExample.vue +29 -0
- package/dist/devtools/runtime/examples/ContainerExample.vue +5 -0
- package/dist/devtools/runtime/examples/ContextMenuExample.vue +5 -0
- package/dist/devtools/runtime/examples/DrawerExample.vue +8 -0
- package/dist/devtools/runtime/examples/DropdownMenuExample.vue +5 -0
- package/dist/devtools/runtime/examples/FormExample.vue +30 -0
- package/dist/devtools/runtime/examples/FormFieldExample.vue +5 -0
- package/dist/devtools/runtime/examples/LinkExample.vue +5 -0
- package/dist/devtools/runtime/examples/ModalExample.vue +8 -0
- package/dist/devtools/runtime/examples/PopoverExample.vue +8 -0
- package/dist/devtools/runtime/examples/SkeletonExample.vue +3 -0
- package/dist/devtools/runtime/examples/SlideoverExample.vue +8 -0
- package/dist/devtools/runtime/examples/StepperExample.vue +44 -0
- package/dist/devtools/runtime/examples/ToasterExample.vue +11 -0
- package/dist/devtools/runtime/examples/TooltipExample.vue +5 -0
- package/dist/module.cjs +223 -4
- package/dist/module.d.cts +54 -0
- package/dist/module.d.mts +38 -7
- package/dist/module.d.ts +38 -7
- package/dist/module.json +2 -1
- package/dist/module.mjs +179 -2568
- package/dist/runtime/components/Accordion.vue +49 -8
- package/dist/runtime/components/Alert.vue +13 -6
- package/dist/runtime/components/App.vue +20 -7
- package/dist/runtime/components/Avatar.vue +33 -9
- package/dist/runtime/components/AvatarGroup.vue +4 -1
- package/dist/runtime/components/Badge.vue +34 -4
- package/dist/runtime/components/Breadcrumb.vue +52 -13
- package/dist/runtime/components/Button.vue +45 -6
- package/dist/runtime/components/ButtonGroup.vue +5 -2
- package/dist/runtime/components/Calendar.vue +190 -0
- package/dist/runtime/components/Card.vue +4 -1
- package/dist/runtime/components/Carousel.vue +322 -0
- package/dist/runtime/components/Checkbox.vue +28 -33
- package/dist/runtime/components/Chip.vue +9 -2
- package/dist/runtime/components/Collapsible.vue +7 -4
- package/dist/runtime/components/ColorPicker.vue +265 -0
- package/dist/runtime/components/CommandPalette.vue +122 -96
- package/dist/runtime/components/Container.vue +4 -1
- package/dist/runtime/components/ContextMenu.vue +101 -14
- package/dist/runtime/components/ContextMenuContent.vue +48 -18
- package/dist/runtime/components/Drawer.vue +22 -11
- package/dist/runtime/components/DropdownMenu.vue +91 -16
- package/dist/runtime/components/DropdownMenuContent.vue +50 -18
- package/dist/runtime/components/Form.vue +49 -32
- package/dist/runtime/components/FormField.vue +18 -6
- package/dist/runtime/components/Icon.vue +1 -1
- package/dist/runtime/components/Input.vue +15 -6
- package/dist/runtime/components/InputMenu.vue +152 -65
- package/dist/runtime/components/InputNumber.vue +192 -0
- package/dist/runtime/components/Kbd.vue +3 -1
- package/dist/runtime/components/Link.vue +71 -8
- package/dist/runtime/components/LinkBase.vue +10 -7
- package/dist/runtime/components/Modal.vue +23 -11
- package/dist/runtime/components/NavigationMenu.vue +170 -75
- package/dist/runtime/components/Pagination.vue +31 -15
- package/dist/runtime/components/PinInput.vue +96 -0
- package/dist/runtime/components/Popover.vue +26 -7
- package/dist/runtime/components/Progress.vue +25 -8
- package/dist/runtime/components/RadioGroup.vue +28 -7
- package/dist/runtime/components/Select.vue +79 -32
- package/dist/runtime/components/SelectMenu.vue +164 -80
- package/dist/runtime/components/Separator.vue +3 -3
- package/dist/runtime/components/Skeleton.vue +4 -1
- package/dist/runtime/components/Slideover.vue +23 -11
- package/dist/runtime/components/Slider.vue +3 -3
- package/dist/runtime/components/Stepper.vue +171 -0
- package/dist/runtime/components/Switch.vue +16 -16
- package/dist/runtime/components/Table.vue +262 -0
- package/dist/runtime/components/Tabs.vue +42 -15
- package/dist/runtime/components/Textarea.vue +9 -3
- package/dist/runtime/components/Toast.vue +13 -5
- package/dist/runtime/components/Toaster.vue +31 -16
- package/dist/runtime/components/Tooltip.vue +9 -6
- package/dist/runtime/composables/defineLocale.d.ts +9 -0
- package/dist/runtime/composables/defineLocale.js +4 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
- package/dist/runtime/composables/defineShortcuts.js +2 -8
- package/dist/runtime/composables/extendDevtoolsMeta.d.ts +7 -0
- package/dist/runtime/composables/extendDevtoolsMeta.js +2 -0
- package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
- package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
- package/dist/runtime/composables/useComponentIcons.d.ts +3 -0
- package/dist/runtime/composables/useFormField.d.ts +8 -4
- package/dist/runtime/composables/useFormField.js +2 -1
- package/dist/runtime/composables/useKbd.d.ts +10 -3
- package/dist/runtime/composables/useKbd.js +14 -8
- package/dist/runtime/composables/useLocale.d.ts +4 -0
- package/dist/runtime/composables/useLocale.js +10 -0
- package/dist/runtime/composables/useModal.d.ts +2 -2
- package/dist/runtime/composables/useSlideover.d.ts +2 -2
- package/dist/runtime/composables/useToast.d.ts +2 -2
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/keyframes.css +1 -0
- package/dist/runtime/locale/ar.d.ts +2 -0
- package/dist/runtime/locale/ar.js +53 -0
- package/dist/runtime/locale/cs.d.ts +2 -0
- package/dist/runtime/locale/cs.js +52 -0
- package/dist/runtime/locale/de.d.ts +2 -0
- package/dist/runtime/locale/de.js +52 -0
- package/dist/runtime/locale/en.d.ts +2 -0
- package/dist/runtime/locale/en.js +52 -0
- package/dist/runtime/locale/es.d.ts +2 -0
- package/dist/runtime/locale/es.js +52 -0
- package/dist/runtime/locale/fa_ir.d.ts +2 -0
- package/dist/runtime/locale/fa_ir.js +53 -0
- package/dist/runtime/locale/fr.d.ts +2 -0
- package/dist/runtime/locale/fr.js +52 -0
- package/dist/runtime/locale/index.d.ts +19 -0
- package/dist/runtime/locale/index.js +19 -0
- package/dist/runtime/locale/it.d.ts +2 -0
- package/dist/runtime/locale/it.js +52 -0
- package/dist/runtime/locale/ja.d.ts +2 -0
- package/dist/runtime/locale/ja.js +52 -0
- package/dist/runtime/locale/ko.d.ts +2 -0
- package/dist/runtime/locale/ko.js +52 -0
- package/dist/runtime/locale/nl.d.ts +2 -0
- package/dist/runtime/locale/nl.js +52 -0
- package/dist/runtime/locale/pl.d.ts +2 -0
- package/dist/runtime/locale/pl.js +52 -0
- package/dist/runtime/locale/pt.d.ts +2 -0
- package/dist/runtime/locale/pt.js +52 -0
- package/dist/runtime/locale/pt_br.d.ts +2 -0
- package/dist/runtime/locale/pt_br.js +52 -0
- package/dist/runtime/locale/ru.d.ts +2 -0
- package/dist/runtime/locale/ru.js +52 -0
- package/dist/runtime/locale/sk.d.ts +2 -0
- package/dist/runtime/locale/sk.js +52 -0
- package/dist/runtime/locale/tr.d.ts +2 -0
- package/dist/runtime/locale/tr.js +52 -0
- package/dist/runtime/locale/zh_hans.d.ts +2 -0
- package/dist/runtime/locale/zh_hans.js +52 -0
- package/dist/runtime/locale/zh_hant.d.ts +2 -0
- package/dist/runtime/locale/zh_hant.js +52 -0
- package/dist/runtime/plugins/colors.js +12 -8
- package/dist/runtime/types/form.d.ts +9 -2
- package/dist/runtime/types/index.d.ts +50 -42
- package/dist/runtime/types/index.js +8 -0
- package/dist/runtime/types/locale.d.ts +54 -0
- package/dist/runtime/types/utils.d.ts +8 -3
- package/dist/runtime/utils/form.d.ts +7 -5
- package/dist/runtime/utils/form.js +117 -28
- package/dist/runtime/utils/index.d.ts +2 -1
- package/dist/runtime/utils/index.js +16 -0
- package/dist/runtime/utils/link.d.ts +5 -3
- package/dist/runtime/utils/link.js +1 -1
- package/dist/runtime/utils/locale.d.ts +15 -0
- package/dist/runtime/utils/locale.js +25 -0
- package/dist/runtime/vue/components/Icon.vue +15 -0
- package/dist/runtime/vue/components/Link.vue +208 -0
- package/dist/runtime/vue/plugins/color-mode.d.ts +4 -0
- package/dist/runtime/vue/plugins/color-mode.js +6 -0
- package/dist/runtime/vue/plugins/head.d.ts +4 -0
- package/dist/runtime/vue/plugins/head.js +6 -0
- package/dist/runtime/vue/stubs.d.ts +15 -0
- package/dist/runtime/vue/stubs.js +27 -0
- package/dist/shared/ui.CwmIkD_Y.cjs +3269 -0
- package/dist/shared/ui.D_93iuwH.mjs +3262 -0
- package/dist/unplugin.cjs +192 -0
- package/dist/unplugin.d.cts +49 -0
- package/dist/unplugin.d.mts +49 -0
- package/dist/unplugin.d.ts +49 -0
- package/dist/unplugin.mjs +181 -0
- package/dist/vite.cjs +22 -0
- package/dist/vite.d.cts +13 -0
- package/dist/vite.d.mts +13 -0
- package/dist/vite.d.ts +13 -0
- package/dist/vite.mjs +20 -0
- package/package.json +98 -31
- package/vue-plugin.d.ts +5 -0
- package/cli/node_modules/.ignored/citty/LICENSE +0 -36
- package/cli/node_modules/.ignored/citty/README.md +0 -134
- package/cli/node_modules/.ignored/citty/dist/index.cjs +0 -475
- package/cli/node_modules/.ignored/citty/dist/index.d.cts +0 -80
- package/cli/node_modules/.ignored/citty/dist/index.d.mts +0 -80
- package/cli/node_modules/.ignored/citty/dist/index.d.ts +0 -80
- package/cli/node_modules/.ignored/citty/dist/index.mjs +0 -463
- package/cli/node_modules/.ignored/citty/package.json +0 -49
- package/cli/node_modules/.ignored/consola/LICENSE +0 -47
- package/cli/node_modules/.ignored/consola/README.md +0 -318
- package/cli/node_modules/.ignored/consola/core.d.ts +0 -1
- package/cli/node_modules/.ignored/consola/dist/basic.cjs +0 -32
- package/cli/node_modules/.ignored/consola/dist/basic.d.ts +0 -9
- package/cli/node_modules/.ignored/consola/dist/basic.mjs +0 -24
- package/cli/node_modules/.ignored/consola/dist/browser.cjs +0 -80
- package/cli/node_modules/.ignored/consola/dist/browser.d.ts +0 -7
- package/cli/node_modules/.ignored/consola/dist/browser.mjs +0 -72
- package/cli/node_modules/.ignored/consola/dist/chunks/prompt.cjs +0 -436
- package/cli/node_modules/.ignored/consola/dist/chunks/prompt.mjs +0 -429
- package/cli/node_modules/.ignored/consola/dist/core.cjs +0 -415
- package/cli/node_modules/.ignored/consola/dist/core.d.ts +0 -124
- package/cli/node_modules/.ignored/consola/dist/core.mjs +0 -410
- package/cli/node_modules/.ignored/consola/dist/index.cjs +0 -21
- package/cli/node_modules/.ignored/consola/dist/index.d.ts +0 -9
- package/cli/node_modules/.ignored/consola/dist/index.mjs +0 -8
- package/cli/node_modules/.ignored/consola/dist/shared/consola.06ad8a64.mjs +0 -62
- package/cli/node_modules/.ignored/consola/dist/shared/consola.36c0034f.mjs +0 -636
- package/cli/node_modules/.ignored/consola/dist/shared/consola.4bbae468.cjs +0 -645
- package/cli/node_modules/.ignored/consola/dist/shared/consola.deac7d5a.cjs +0 -65
- package/cli/node_modules/.ignored/consola/dist/utils.cjs +0 -308
- package/cli/node_modules/.ignored/consola/dist/utils.d.ts +0 -169
- package/cli/node_modules/.ignored/consola/dist/utils.mjs +0 -284
- package/cli/node_modules/.ignored/consola/lib/index.cjs +0 -9
- package/cli/node_modules/.ignored/consola/package.json +0 -101
- package/cli/node_modules/.ignored/consola/utils.d.ts +0 -1
- package/cli/node_modules/.ignored/pathe/LICENSE +0 -44
- package/cli/node_modules/.ignored/pathe/README.md +0 -69
- package/cli/node_modules/.ignored/pathe/dist/index.cjs +0 -23
- package/cli/node_modules/.ignored/pathe/dist/index.d.cts +0 -36
- package/cli/node_modules/.ignored/pathe/dist/index.d.mts +0 -36
- package/cli/node_modules/.ignored/pathe/dist/index.d.ts +0 -36
- package/cli/node_modules/.ignored/pathe/dist/index.mjs +0 -1
- package/cli/node_modules/.ignored/pathe/dist/shared/pathe.1f0a373c.cjs +0 -238
- package/cli/node_modules/.ignored/pathe/dist/shared/pathe.ff20891b.mjs +0 -221
- package/cli/node_modules/.ignored/pathe/dist/utils.cjs +0 -58
- package/cli/node_modules/.ignored/pathe/dist/utils.d.cts +0 -5
- package/cli/node_modules/.ignored/pathe/dist/utils.d.mts +0 -5
- package/cli/node_modules/.ignored/pathe/dist/utils.d.ts +0 -5
- package/cli/node_modules/.ignored/pathe/dist/utils.mjs +0 -54
- package/cli/node_modules/.ignored/pathe/package.json +0 -48
- package/cli/node_modules/.ignored/pathe/utils.d.ts +0 -1
- package/cli/node_modules/.ignored/scule/LICENSE +0 -21
- package/cli/node_modules/.ignored/scule/README.md +0 -149
- package/cli/node_modules/.ignored/scule/dist/index.cjs +0 -92
- package/cli/node_modules/.ignored/scule/dist/index.d.cts +0 -57
- package/cli/node_modules/.ignored/scule/dist/index.d.mts +0 -57
- package/cli/node_modules/.ignored/scule/dist/index.d.ts +0 -57
- package/cli/node_modules/.ignored/scule/dist/index.mjs +0 -80
- package/cli/node_modules/.ignored/scule/package.json +0 -43
- package/cli/node_modules/.package-lock.json +0 -33
- package/dist/runtime/types/component.d.ts +0 -17
- /package/dist/runtime/types/{component.js → locale.js} +0 -0
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { InputHTMLAttributes } from 'vue'
|
|
3
3
|
import { tv, type VariantProps } from 'tailwind-variants'
|
|
4
|
-
import type { ComboboxRootProps, ComboboxRootEmits, ComboboxContentProps,
|
|
4
|
+
import type { ComboboxRootProps, ComboboxRootEmits, ComboboxContentProps, ComboboxArrowProps, AcceptableValue } from 'reka-ui'
|
|
5
5
|
import type { AppConfig } from '@nuxt/schema'
|
|
6
6
|
import _appConfig from '#build/app.config'
|
|
7
7
|
import theme from '#build/ui/input-menu'
|
|
8
8
|
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
9
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
9
10
|
import type { AvatarProps, ChipProps, InputProps } from '../types'
|
|
10
|
-
import type {
|
|
11
|
+
import type { PartialString, MaybeArrayOfArray, MaybeArrayOfArrayItem, SelectModelValue, SelectModelValueEmits, SelectItemKey } from '../types/utils'
|
|
11
12
|
|
|
12
13
|
const appConfig = _appConfig as AppConfig & { ui: { inputMenu: Partial<typeof theme> } }
|
|
13
14
|
|
|
14
15
|
const inputMenu = tv({ extend: tv(theme), ...(appConfig.ui?.inputMenu || {}) })
|
|
15
16
|
|
|
16
|
-
export interface InputMenuItem
|
|
17
|
+
export interface InputMenuItem {
|
|
17
18
|
label?: string
|
|
18
19
|
icon?: string
|
|
19
20
|
avatar?: AvatarProps
|
|
@@ -23,11 +24,13 @@ export interface InputMenuItem extends Pick<ComboboxItemProps, 'disabled'> {
|
|
|
23
24
|
* @defaultValue 'item'
|
|
24
25
|
*/
|
|
25
26
|
type?: 'label' | 'separator' | 'item'
|
|
27
|
+
disabled?: boolean
|
|
28
|
+
onSelect?(e?: Event): void
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
type InputMenuVariants = VariantProps<typeof inputMenu>
|
|
29
32
|
|
|
30
|
-
export interface InputMenuProps<T
|
|
33
|
+
export interface InputMenuProps<T extends MaybeArrayOfArrayItem<I>, I extends MaybeArrayOfArray<InputMenuItem | AcceptableValue | boolean> = MaybeArrayOfArray<InputMenuItem | AcceptableValue | boolean>, V extends SelectItemKey<T> | undefined = undefined, M extends boolean = false> extends Pick<ComboboxRootProps<T>, 'open' | 'defaultOpen' | 'disabled' | 'name' | 'resetSearchTermOnBlur' | 'highlightOnHover'>, UseComponentIconsProps {
|
|
31
34
|
/**
|
|
32
35
|
* The element or component this component should render as.
|
|
33
36
|
* @defaultValue 'div'
|
|
@@ -61,7 +64,7 @@ export interface InputMenuProps<T> extends Pick<ComboboxRootProps<T>, 'modelValu
|
|
|
61
64
|
deleteIcon?: string
|
|
62
65
|
/**
|
|
63
66
|
* The content of the menu.
|
|
64
|
-
* @defaultValue { side: 'bottom', sideOffset: 8, position: 'popper' }
|
|
67
|
+
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }
|
|
65
68
|
*/
|
|
66
69
|
content?: Omit<ComboboxContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
67
70
|
/**
|
|
@@ -74,35 +77,56 @@ export interface InputMenuProps<T> extends Pick<ComboboxRootProps<T>, 'modelValu
|
|
|
74
77
|
* @defaultValue true
|
|
75
78
|
*/
|
|
76
79
|
portal?: boolean
|
|
77
|
-
/**
|
|
78
|
-
* Whether to filter items or not, can be an array of fields to filter.
|
|
79
|
-
* When `false`, items will not be filtered which is useful for custom filtering.
|
|
80
|
-
* @defaultValue ['label']
|
|
81
|
-
*/
|
|
82
|
-
filter?: boolean | string[]
|
|
83
80
|
/**
|
|
84
81
|
* When `items` is an array of objects, select the field to use as the value instead of the object itself.
|
|
85
82
|
* @defaultValue undefined
|
|
86
83
|
*/
|
|
87
|
-
valueKey?:
|
|
88
|
-
|
|
84
|
+
valueKey?: V
|
|
85
|
+
/**
|
|
86
|
+
* When `items` is an array of objects, select the field to use as the label.
|
|
87
|
+
* @defaultValue 'label'
|
|
88
|
+
*/
|
|
89
|
+
labelKey?: V
|
|
90
|
+
items?: I
|
|
91
|
+
/** The value of the InputMenu when initially rendered. Use when you do not need to control the state of the InputMenu. */
|
|
92
|
+
defaultValue?: SelectModelValue<T, V, M>
|
|
93
|
+
/** The controlled value of the InputMenu. Can be binded-with with `v-model`. */
|
|
94
|
+
modelValue?: SelectModelValue<T, V, M>
|
|
95
|
+
/** Whether multiple options can be selected or not. */
|
|
96
|
+
multiple?: M & boolean
|
|
89
97
|
/** Highlight the ring color like a focus state. */
|
|
90
98
|
highlight?: boolean
|
|
99
|
+
/**
|
|
100
|
+
* Determines if custom user input that does not exist in options can be added.
|
|
101
|
+
* @defaultValue false
|
|
102
|
+
*/
|
|
103
|
+
createItem?: boolean | 'always' | { position?: 'top' | 'bottom', when?: 'empty' | 'always' }
|
|
104
|
+
/**
|
|
105
|
+
* Fields to filter items by.
|
|
106
|
+
* @defaultValue [labelKey]
|
|
107
|
+
*/
|
|
108
|
+
filterFields?: string[]
|
|
109
|
+
/**
|
|
110
|
+
* When `true`, disable the default filters, useful for custom filtering (useAsyncData, useFetch, etc.).
|
|
111
|
+
* @defaultValue false
|
|
112
|
+
*/
|
|
113
|
+
ignoreFilter?: boolean
|
|
91
114
|
class?: any
|
|
92
115
|
ui?: PartialString<typeof inputMenu.slots>
|
|
93
116
|
}
|
|
94
117
|
|
|
95
|
-
export type InputMenuEmits<T> = ComboboxRootEmits<T> & {
|
|
118
|
+
export type InputMenuEmits<T, V, M extends boolean> = Omit<ComboboxRootEmits<T>, 'update:modelValue'> & {
|
|
96
119
|
change: [payload: Event]
|
|
97
120
|
blur: [payload: FocusEvent]
|
|
98
121
|
focus: [payload: FocusEvent]
|
|
99
|
-
|
|
122
|
+
create: [item: string]
|
|
123
|
+
} & SelectModelValueEmits<T, V, M>
|
|
100
124
|
|
|
101
125
|
type SlotProps<T> = (props: { item: T, index: number }) => any
|
|
102
126
|
|
|
103
|
-
export
|
|
104
|
-
'leading'(props: { modelValue: T, open: boolean, ui: any }): any
|
|
105
|
-
'trailing'(props: { modelValue: T, open: boolean, ui: any }): any
|
|
127
|
+
export interface InputMenuSlots<T, M extends boolean> {
|
|
128
|
+
'leading'(props: { modelValue?: M extends true ? T[] : T, open: boolean, ui: any }): any
|
|
129
|
+
'trailing'(props: { modelValue?: M extends true ? T[] : T, open: boolean, ui: any }): any
|
|
106
130
|
'empty'(props: { searchTerm?: string }): any
|
|
107
131
|
'item': SlotProps<T>
|
|
108
132
|
'item-leading': SlotProps<T>
|
|
@@ -110,86 +134,116 @@ export type InputMenuSlots<T> = {
|
|
|
110
134
|
'item-trailing': SlotProps<T>
|
|
111
135
|
'tags-item-text': SlotProps<T>
|
|
112
136
|
'tags-item-delete': SlotProps<T>
|
|
137
|
+
'create-item-label'(props: { item: string }): any
|
|
113
138
|
}
|
|
139
|
+
|
|
140
|
+
extendDevtoolsMeta({ defaultProps: { items: ['Option 1', 'Option 2', 'Option 3'] } })
|
|
114
141
|
</script>
|
|
115
142
|
|
|
116
|
-
<script setup lang="ts" generic="T extends InputMenuItem | AcceptableValue">
|
|
117
|
-
import { computed, ref, toRef, onMounted } from 'vue'
|
|
118
|
-
import { ComboboxRoot, ComboboxAnchor, ComboboxInput, ComboboxTrigger, ComboboxPortal, ComboboxContent, ComboboxViewport, ComboboxEmpty, ComboboxGroup, ComboboxLabel, ComboboxSeparator, ComboboxItem, ComboboxItemIndicator, TagsInputRoot, TagsInputItem, TagsInputItemText, TagsInputItemDelete, TagsInputInput, useForwardPropsEmits } from '
|
|
143
|
+
<script setup lang="ts" generic="T extends MaybeArrayOfArrayItem<I>, I extends MaybeArrayOfArray<InputMenuItem | AcceptableValue | boolean> = MaybeArrayOfArray<InputMenuItem | AcceptableValue | boolean>, V extends SelectItemKey<T> | undefined = undefined, M extends boolean = false">
|
|
144
|
+
import { computed, ref, toRef, onMounted, toRaw } from 'vue'
|
|
145
|
+
import { ComboboxRoot, ComboboxArrow, ComboboxAnchor, ComboboxInput, ComboboxTrigger, ComboboxPortal, ComboboxContent, ComboboxViewport, ComboboxEmpty, ComboboxGroup, ComboboxLabel, ComboboxSeparator, ComboboxItem, ComboboxItemIndicator, TagsInputRoot, TagsInputItem, TagsInputItemText, TagsInputItemDelete, TagsInputInput, useForwardPropsEmits, useFilter } from 'reka-ui'
|
|
119
146
|
import { defu } from 'defu'
|
|
120
|
-
import { reactivePick } from '@vueuse/core'
|
|
147
|
+
import { reactivePick, createReusableTemplate } from '@vueuse/core'
|
|
121
148
|
import { useAppConfig } from '#imports'
|
|
122
149
|
import { useButtonGroup } from '../composables/useButtonGroup'
|
|
123
150
|
import { useComponentIcons } from '../composables/useComponentIcons'
|
|
124
151
|
import { useFormField } from '../composables/useFormField'
|
|
152
|
+
import { useLocale } from '../composables/useLocale'
|
|
153
|
+
import { get, compare } from '../utils'
|
|
125
154
|
import UIcon from './Icon.vue'
|
|
126
155
|
import UAvatar from './Avatar.vue'
|
|
127
156
|
import UChip from './Chip.vue'
|
|
128
|
-
import { get } from '../utils'
|
|
129
157
|
|
|
130
158
|
defineOptions({ inheritAttrs: false })
|
|
131
159
|
|
|
132
|
-
const props = withDefaults(defineProps<InputMenuProps<T>>(), {
|
|
160
|
+
const props = withDefaults(defineProps<InputMenuProps<T, I, V, M>>(), {
|
|
133
161
|
type: 'text',
|
|
134
162
|
autofocusDelay: 0,
|
|
135
163
|
portal: true,
|
|
136
|
-
|
|
164
|
+
labelKey: 'label' as never
|
|
137
165
|
})
|
|
138
|
-
const emits = defineEmits<InputMenuEmits<T>>()
|
|
139
|
-
const slots = defineSlots<InputMenuSlots<T>>()
|
|
166
|
+
const emits = defineEmits<InputMenuEmits<T, V, M>>()
|
|
167
|
+
const slots = defineSlots<InputMenuSlots<T, M>>()
|
|
140
168
|
|
|
141
169
|
const searchTerm = defineModel<string>('searchTerm', { default: '' })
|
|
142
170
|
|
|
171
|
+
const { t } = useLocale()
|
|
143
172
|
const appConfig = useAppConfig()
|
|
144
|
-
const
|
|
145
|
-
|
|
173
|
+
const { contains } = useFilter({ sensitivity: 'base' })
|
|
174
|
+
|
|
175
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'open', 'defaultOpen', 'multiple', 'resetSearchTermOnBlur', 'highlightOnHover', 'ignoreFilter'), emits)
|
|
176
|
+
const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }) as ComboboxContentProps)
|
|
177
|
+
const arrowProps = toRef(() => props.arrow as ComboboxArrowProps)
|
|
178
|
+
|
|
146
179
|
const { emitFormBlur, emitFormChange, emitFormInput, size: formGroupSize, color, id, name, highlight, disabled } = useFormField<InputProps>(props)
|
|
147
180
|
const { orientation, size: buttonGroupSize } = useButtonGroup<InputProps>(props)
|
|
148
181
|
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(props, { trailingIcon: appConfig.ui.icons.chevronDown })))
|
|
149
182
|
|
|
150
183
|
const inputSize = computed(() => buttonGroupSize.value || formGroupSize.value)
|
|
151
184
|
|
|
185
|
+
const [DefineCreateItemTemplate, ReuseCreateItemTemplate] = createReusableTemplate()
|
|
186
|
+
|
|
152
187
|
const ui = computed(() => inputMenu({
|
|
153
188
|
color: color.value,
|
|
154
189
|
variant: props.variant,
|
|
155
190
|
size: inputSize?.value,
|
|
156
191
|
loading: props.loading,
|
|
157
192
|
highlight: highlight.value,
|
|
158
|
-
leading: isLeading.value || !!slots.leading,
|
|
193
|
+
leading: isLeading.value || !!props.avatar || !!slots.leading,
|
|
159
194
|
trailing: isTrailing.value || !!slots.trailing,
|
|
160
195
|
multiple: props.multiple,
|
|
161
196
|
buttonGroup: orientation.value
|
|
162
197
|
}))
|
|
163
198
|
|
|
164
|
-
function displayValue(
|
|
165
|
-
if (
|
|
166
|
-
return
|
|
199
|
+
function displayValue(value: T): string {
|
|
200
|
+
if (!props.valueKey) {
|
|
201
|
+
return value && (typeof value === 'object' ? get(value, props.labelKey as string) : value)
|
|
167
202
|
}
|
|
168
203
|
|
|
169
|
-
|
|
204
|
+
const item = items.value.find(item => compare(typeof item === 'object' ? get(item, props.valueKey as string) : item, value))
|
|
205
|
+
return item && (typeof item === 'object' ? get(item, props.labelKey as string) : item)
|
|
170
206
|
}
|
|
171
207
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
208
|
+
const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0]) ? props.items : [props.items]) as InputMenuItem[][] : [])
|
|
209
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
210
|
+
const items = computed(() => groups.value.flatMap(group => group) as T[])
|
|
211
|
+
|
|
212
|
+
const filteredGroups = computed(() => {
|
|
213
|
+
if (props.ignoreFilter || !searchTerm.value) {
|
|
214
|
+
return groups.value
|
|
175
215
|
}
|
|
176
216
|
|
|
177
|
-
const fields = Array.isArray(props.
|
|
217
|
+
const fields = Array.isArray(props.filterFields) ? props.filterFields : [props.labelKey] as string[]
|
|
178
218
|
|
|
179
|
-
return items.filter((item) => {
|
|
219
|
+
return groups.value.map(items => items.filter((item) => {
|
|
180
220
|
if (typeof item !== 'object') {
|
|
181
|
-
return
|
|
221
|
+
return contains(item, searchTerm.value)
|
|
182
222
|
}
|
|
183
223
|
|
|
184
|
-
|
|
185
|
-
|
|
224
|
+
if (item.type && ['label', 'separator'].includes(item.type)) {
|
|
225
|
+
return true
|
|
226
|
+
}
|
|
186
227
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
228
|
+
return fields.some(field => contains(get(item, field), searchTerm.value))
|
|
229
|
+
})).filter(group => group.filter(item => !item.type || !['label', 'separator'].includes(item.type)).length > 0)
|
|
230
|
+
})
|
|
231
|
+
const filteredItems = computed(() => filteredGroups.value.flatMap(group => group) as T[])
|
|
191
232
|
|
|
192
|
-
const
|
|
233
|
+
const createItem = computed(() => {
|
|
234
|
+
if (!props.createItem || !searchTerm.value) {
|
|
235
|
+
return false
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const newItem = props.valueKey ? { [props.valueKey]: searchTerm.value } as T : searchTerm.value
|
|
239
|
+
|
|
240
|
+
if ((typeof props.createItem === 'object' && props.createItem.when === 'always') || props.createItem === 'always') {
|
|
241
|
+
return !filteredItems.value.find(item => compare(item, newItem, props.valueKey))
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return !filteredItems.value.length
|
|
245
|
+
})
|
|
246
|
+
const createItemPosition = computed(() => typeof props.createItem === 'object' ? props.createItem.position : 'bottom')
|
|
193
247
|
|
|
194
248
|
const inputRef = ref<InstanceType<typeof ComboboxInput> | null>(null)
|
|
195
249
|
|
|
@@ -206,6 +260,9 @@ onMounted(() => {
|
|
|
206
260
|
})
|
|
207
261
|
|
|
208
262
|
function onUpdate(value: any) {
|
|
263
|
+
if (toRaw(props.modelValue) === value) {
|
|
264
|
+
return
|
|
265
|
+
}
|
|
209
266
|
// @ts-expect-error - 'target' does not exist in type 'EventInit'
|
|
210
267
|
const event = new Event('change', { target: { value } })
|
|
211
268
|
emits('change', event)
|
|
@@ -218,6 +275,10 @@ function onBlur(event: FocusEvent) {
|
|
|
218
275
|
emitFormBlur()
|
|
219
276
|
}
|
|
220
277
|
|
|
278
|
+
function onFocus(event: FocusEvent) {
|
|
279
|
+
emits('focus', event)
|
|
280
|
+
}
|
|
281
|
+
|
|
221
282
|
function onUpdateOpen(value: boolean) {
|
|
222
283
|
if (!value) {
|
|
223
284
|
const event = new FocusEvent('blur')
|
|
@@ -234,18 +295,33 @@ defineExpose({
|
|
|
234
295
|
})
|
|
235
296
|
</script>
|
|
236
297
|
|
|
298
|
+
<!-- eslint-disable vue/no-template-shadow -->
|
|
237
299
|
<template>
|
|
300
|
+
<DefineCreateItemTemplate>
|
|
301
|
+
<ComboboxGroup :class="ui.group({ class: props.ui?.group })">
|
|
302
|
+
<ComboboxItem
|
|
303
|
+
:class="ui.item({ class: props.ui?.item })"
|
|
304
|
+
:value="searchTerm"
|
|
305
|
+
@select.prevent="emits('create', searchTerm)"
|
|
306
|
+
>
|
|
307
|
+
<span :class="ui.itemLabel({ class: props.ui?.itemLabel })">
|
|
308
|
+
<slot name="create-item-label" :item="searchTerm">
|
|
309
|
+
{{ t('inputMenu.create', { label: searchTerm }) }}
|
|
310
|
+
</slot>
|
|
311
|
+
</span>
|
|
312
|
+
</ComboboxItem>
|
|
313
|
+
</ComboboxGroup>
|
|
314
|
+
</DefineCreateItemTemplate>
|
|
315
|
+
|
|
238
316
|
<ComboboxRoot
|
|
239
317
|
:id="id"
|
|
240
318
|
v-slot="{ modelValue, open }"
|
|
241
319
|
v-bind="rootProps"
|
|
242
|
-
v-model:search-term="searchTerm"
|
|
243
320
|
:name="name"
|
|
244
321
|
:disabled="disabled"
|
|
245
|
-
:display-value="displayValue"
|
|
246
|
-
:filter-function="filterFunction"
|
|
247
322
|
:class="ui.root({ class: [props.class, props.ui?.root] })"
|
|
248
323
|
:as-child="!!multiple"
|
|
324
|
+
ignore-filter
|
|
249
325
|
@update:model-value="onUpdate"
|
|
250
326
|
@update:open="onUpdateOpen"
|
|
251
327
|
@keydown.enter="$event.preventDefault()"
|
|
@@ -253,17 +329,18 @@ defineExpose({
|
|
|
253
329
|
<ComboboxAnchor :as-child="!multiple" :class="ui.base({ class: props.ui?.base })">
|
|
254
330
|
<TagsInputRoot
|
|
255
331
|
v-if="multiple"
|
|
256
|
-
v-slot="{ modelValue: tags }
|
|
332
|
+
v-slot="{ modelValue: tags }"
|
|
257
333
|
:model-value="(modelValue as string[])"
|
|
258
334
|
:disabled="disabled"
|
|
259
335
|
delimiter=""
|
|
260
336
|
as-child
|
|
261
337
|
@blur="onBlur"
|
|
338
|
+
@focus="onFocus"
|
|
262
339
|
>
|
|
263
340
|
<TagsInputItem v-for="(item, index) in tags" :key="index" :value="(item as string)" :class="ui.tagsItem({ class: props.ui?.tagsItem })">
|
|
264
341
|
<TagsInputItemText :class="ui.tagsItemText({ class: props.ui?.tagsItemText })">
|
|
265
342
|
<slot name="tags-item-text" :item="(item as T)" :index="index">
|
|
266
|
-
{{
|
|
343
|
+
{{ displayValue(item as T) }}
|
|
267
344
|
</slot>
|
|
268
345
|
</TagsInputItemText>
|
|
269
346
|
|
|
@@ -274,7 +351,7 @@ defineExpose({
|
|
|
274
351
|
</TagsInputItemDelete>
|
|
275
352
|
</TagsInputItem>
|
|
276
353
|
|
|
277
|
-
<ComboboxInput as-child>
|
|
354
|
+
<ComboboxInput v-model="searchTerm" :display-value="displayValue" as-child>
|
|
278
355
|
<TagsInputInput
|
|
279
356
|
ref="inputRef"
|
|
280
357
|
v-bind="$attrs"
|
|
@@ -289,22 +366,25 @@ defineExpose({
|
|
|
289
366
|
<ComboboxInput
|
|
290
367
|
v-else
|
|
291
368
|
ref="inputRef"
|
|
369
|
+
v-model="searchTerm"
|
|
370
|
+
:display-value="displayValue"
|
|
292
371
|
v-bind="$attrs"
|
|
293
372
|
:type="type"
|
|
294
373
|
:placeholder="placeholder"
|
|
295
374
|
:required="required"
|
|
296
|
-
:class="ui.base({ class: props.ui?.base })"
|
|
297
375
|
@blur="onBlur"
|
|
376
|
+
@focus="onFocus"
|
|
298
377
|
/>
|
|
299
378
|
|
|
300
|
-
<span v-if="isLeading || !!slots.leading" :class="ui.leading({ class: props.ui?.leading })">
|
|
301
|
-
<slot name="leading" :model-value="(modelValue as T)" :open="open" :ui="ui">
|
|
302
|
-
<UIcon v-if="leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
|
379
|
+
<span v-if="isLeading || !!avatar || !!slots.leading" :class="ui.leading({ class: props.ui?.leading })">
|
|
380
|
+
<slot name="leading" :model-value="(modelValue as M extends true ? T[] : T)" :open="open" :ui="ui">
|
|
381
|
+
<UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
|
382
|
+
<UAvatar v-else-if="!!avatar" :size="((props.ui?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="avatar" :class="ui.itemLeadingAvatar({ class: props.ui?.itemLeadingAvatar })" />
|
|
303
383
|
</slot>
|
|
304
384
|
</span>
|
|
305
385
|
|
|
306
386
|
<ComboboxTrigger v-if="isTrailing || !!slots.trailing" :class="ui.trailing({ class: props.ui?.trailing })">
|
|
307
|
-
<slot name="trailing" :model-value="(modelValue as T)" :open="open" :ui="ui">
|
|
387
|
+
<slot name="trailing" :model-value="(modelValue as M extends true ? T[] : T)" :open="open" :ui="ui">
|
|
308
388
|
<UIcon v-if="trailingIconName" :name="trailingIconName" :class="ui.trailingIcon({ class: props.ui?.trailingIcon })" />
|
|
309
389
|
</slot>
|
|
310
390
|
</ComboboxTrigger>
|
|
@@ -314,15 +394,17 @@ defineExpose({
|
|
|
314
394
|
<ComboboxContent :class="ui.content({ class: props.ui?.content })" v-bind="contentProps">
|
|
315
395
|
<ComboboxEmpty :class="ui.empty({ class: props.ui?.empty })">
|
|
316
396
|
<slot name="empty" :search-term="searchTerm">
|
|
317
|
-
{{ searchTerm ?
|
|
397
|
+
{{ searchTerm ? t('inputMenu.noMatch', { searchTerm }) : t('inputMenu.noData') }}
|
|
318
398
|
</slot>
|
|
319
399
|
</ComboboxEmpty>
|
|
320
400
|
|
|
321
401
|
<ComboboxViewport :class="ui.viewport({ class: props.ui?.viewport })">
|
|
322
|
-
<
|
|
402
|
+
<ReuseCreateItemTemplate v-if="createItem && createItemPosition === 'top'" />
|
|
403
|
+
|
|
404
|
+
<ComboboxGroup v-for="(group, groupIndex) in filteredGroups" :key="`group-${groupIndex}`" :class="ui.group({ class: props.ui?.group })">
|
|
323
405
|
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
|
324
406
|
<ComboboxLabel v-if="item?.type === 'label'" :class="ui.label({ class: props.ui?.label })">
|
|
325
|
-
{{ item.
|
|
407
|
+
{{ get(item, props.labelKey as string) }}
|
|
326
408
|
</ComboboxLabel>
|
|
327
409
|
|
|
328
410
|
<ComboboxSeparator v-else-if="item?.type === 'separator'" :class="ui.separator({ class: props.ui?.separator })" />
|
|
@@ -331,12 +413,13 @@ defineExpose({
|
|
|
331
413
|
v-else
|
|
332
414
|
:class="ui.item({ class: props.ui?.item })"
|
|
333
415
|
:disabled="item.disabled"
|
|
334
|
-
:value="valueKey && typeof item === 'object' ? (item
|
|
416
|
+
:value="valueKey && typeof item === 'object' ? get(item, props.valueKey as string) : item"
|
|
417
|
+
@select="item.onSelect"
|
|
335
418
|
>
|
|
336
419
|
<slot name="item" :item="(item as T)" :index="index">
|
|
337
420
|
<slot name="item-leading" :item="(item as T)" :index="index">
|
|
338
|
-
<
|
|
339
|
-
<
|
|
421
|
+
<UIcon v-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: props.ui?.itemLeadingIcon })" />
|
|
422
|
+
<UAvatar v-else-if="item.avatar" :size="((props.ui?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: props.ui?.itemLeadingAvatar })" />
|
|
340
423
|
<UChip
|
|
341
424
|
v-else-if="item.chip"
|
|
342
425
|
:size="((props.ui?.itemLeadingChipSize || ui.itemLeadingChipSize()) as ChipProps['size'])"
|
|
@@ -349,7 +432,7 @@ defineExpose({
|
|
|
349
432
|
|
|
350
433
|
<span :class="ui.itemLabel({ class: props.ui?.itemLabel })">
|
|
351
434
|
<slot name="item-label" :item="(item as T)" :index="index">
|
|
352
|
-
{{
|
|
435
|
+
{{ typeof item === 'object' ? get(item, props.labelKey as string) : item }}
|
|
353
436
|
</slot>
|
|
354
437
|
</span>
|
|
355
438
|
|
|
@@ -364,7 +447,11 @@ defineExpose({
|
|
|
364
447
|
</ComboboxItem>
|
|
365
448
|
</template>
|
|
366
449
|
</ComboboxGroup>
|
|
450
|
+
|
|
451
|
+
<ReuseCreateItemTemplate v-if="createItem && createItemPosition === 'bottom'" />
|
|
367
452
|
</ComboboxViewport>
|
|
453
|
+
|
|
454
|
+
<ComboboxArrow v-if="!!arrow" v-bind="arrowProps" :class="ui.arrow({ class: props.ui?.arrow })" />
|
|
368
455
|
</ComboboxContent>
|
|
369
456
|
</ComboboxPortal>
|
|
370
457
|
</ComboboxRoot>
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants'
|
|
3
|
+
import type { NumberFieldRootProps } from 'reka-ui'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/ui/input-number'
|
|
7
|
+
import type { ButtonProps } from '../types'
|
|
8
|
+
|
|
9
|
+
const appConfig = _appConfig as AppConfig & { ui: { inputNumber: Partial<typeof theme> } }
|
|
10
|
+
|
|
11
|
+
const inputNumber = tv({ extend: tv(theme), ...(appConfig.ui?.inputNumber || {}) })
|
|
12
|
+
|
|
13
|
+
type InputNumberVariants = VariantProps<typeof inputNumber>
|
|
14
|
+
|
|
15
|
+
export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue' | 'defaultValue' | 'min' | 'max' | 'step' | 'disabled' | 'required' | 'id' | 'name' | 'formatOptions'> {
|
|
16
|
+
/**
|
|
17
|
+
* The element or component this component should render as.
|
|
18
|
+
* @defaultValue 'div'
|
|
19
|
+
*/
|
|
20
|
+
as?: any
|
|
21
|
+
class?: any
|
|
22
|
+
/** The placeholder text when the input is empty. */
|
|
23
|
+
placeholder?: string
|
|
24
|
+
ui?: Partial<typeof inputNumber.slots>
|
|
25
|
+
color?: InputNumberVariants['color']
|
|
26
|
+
variant?: InputNumberVariants['variant']
|
|
27
|
+
size?: InputNumberVariants['size']
|
|
28
|
+
/** Highlight the ring color like a focus state. */
|
|
29
|
+
highlight?: boolean
|
|
30
|
+
/**
|
|
31
|
+
* The orientation of the input menu.
|
|
32
|
+
* @defaultValue 'horizontal'
|
|
33
|
+
*/
|
|
34
|
+
orientation?: 'vertical' | 'horizontal'
|
|
35
|
+
/**
|
|
36
|
+
* Configure the increment button. The `color` and `size` are inherited.
|
|
37
|
+
* @defaultValue { variant: 'link' }
|
|
38
|
+
*/
|
|
39
|
+
increment?: ButtonProps
|
|
40
|
+
/**
|
|
41
|
+
* The icon displayed to increment the value.
|
|
42
|
+
* @defaultValue appConfig.ui.icons.plus
|
|
43
|
+
*/
|
|
44
|
+
incrementIcon?: string
|
|
45
|
+
/**
|
|
46
|
+
* Configure the decrement button. The `color` and `size` are inherited.
|
|
47
|
+
* @defaultValue { variant: 'link' }
|
|
48
|
+
*/
|
|
49
|
+
decrement?: ButtonProps
|
|
50
|
+
/**
|
|
51
|
+
* The icon displayed to decrement the value.
|
|
52
|
+
* @defaultValue appConfig.ui.icons.minus
|
|
53
|
+
*/
|
|
54
|
+
decrementIcon?: string
|
|
55
|
+
autofocus?: boolean
|
|
56
|
+
autofocusDelay?: number
|
|
57
|
+
/**
|
|
58
|
+
* The locale to use for formatting and parsing numbers.
|
|
59
|
+
* @defaultValue UApp.locale.code
|
|
60
|
+
*/
|
|
61
|
+
locale?: string
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface InputNumberEmits {
|
|
65
|
+
(e: 'update:modelValue', payload: number): void
|
|
66
|
+
(e: 'blur', event: FocusEvent): void
|
|
67
|
+
(e: 'change', payload: Event): void
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface InputNumberSlots {
|
|
71
|
+
increment(props?: {}): any
|
|
72
|
+
decrement(props?: {}): any
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<script setup lang="ts">
|
|
77
|
+
import { onMounted, ref, computed } from 'vue'
|
|
78
|
+
import { NumberFieldRoot, NumberFieldInput, NumberFieldDecrement, NumberFieldIncrement, useForwardPropsEmits } from 'reka-ui'
|
|
79
|
+
import { reactivePick } from '@vueuse/core'
|
|
80
|
+
import { useFormField } from '../composables/useFormField'
|
|
81
|
+
import { useLocale } from '../composables/useLocale'
|
|
82
|
+
import UButton from './Button.vue'
|
|
83
|
+
|
|
84
|
+
defineOptions({ inheritAttrs: false })
|
|
85
|
+
|
|
86
|
+
const props = withDefaults(defineProps<InputNumberProps>(), {
|
|
87
|
+
orientation: 'horizontal'
|
|
88
|
+
})
|
|
89
|
+
const emits = defineEmits<InputNumberEmits>()
|
|
90
|
+
defineSlots<InputNumberSlots>()
|
|
91
|
+
|
|
92
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'min', 'max', 'step', 'formatOptions'), emits)
|
|
93
|
+
|
|
94
|
+
const { emitFormBlur, emitFormChange, emitFormInput, id, color, size, name, highlight, disabled } = useFormField<InputNumberProps>(props)
|
|
95
|
+
|
|
96
|
+
const { t, code: codeLocale } = useLocale()
|
|
97
|
+
const locale = computed(() => props.locale || codeLocale.value)
|
|
98
|
+
|
|
99
|
+
const ui = computed(() => inputNumber({
|
|
100
|
+
color: color.value,
|
|
101
|
+
variant: props.variant,
|
|
102
|
+
size: size.value,
|
|
103
|
+
highlight: highlight.value,
|
|
104
|
+
orientation: props.orientation
|
|
105
|
+
}))
|
|
106
|
+
|
|
107
|
+
const incrementIcon = computed(() => props.incrementIcon || (props.orientation === 'horizontal' ? appConfig.ui.icons.plus : appConfig.ui.icons.chevronUp))
|
|
108
|
+
const decrementIcon = computed(() => props.decrementIcon || (props.orientation === 'horizontal' ? appConfig.ui.icons.minus : appConfig.ui.icons.chevronDown))
|
|
109
|
+
|
|
110
|
+
const inputRef = ref<InstanceType<typeof NumberFieldInput> | null>(null)
|
|
111
|
+
|
|
112
|
+
function autoFocus() {
|
|
113
|
+
if (props.autofocus) {
|
|
114
|
+
inputRef.value?.$el?.focus()
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
onMounted(() => {
|
|
119
|
+
setTimeout(() => {
|
|
120
|
+
autoFocus()
|
|
121
|
+
}, props.autofocusDelay)
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
function onUpdate(value: number) {
|
|
125
|
+
// @ts-expect-error - 'target' does not exist in type 'EventInit'
|
|
126
|
+
const event = new Event('change', { target: { value } })
|
|
127
|
+
emits('change', event)
|
|
128
|
+
|
|
129
|
+
emitFormChange()
|
|
130
|
+
emitFormInput()
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function onBlur(event: FocusEvent) {
|
|
134
|
+
emitFormBlur()
|
|
135
|
+
emits('blur', event)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
defineExpose({
|
|
139
|
+
inputRef
|
|
140
|
+
})
|
|
141
|
+
</script>
|
|
142
|
+
|
|
143
|
+
<template>
|
|
144
|
+
<NumberFieldRoot
|
|
145
|
+
v-bind="rootProps"
|
|
146
|
+
:id="id"
|
|
147
|
+
:class="ui.root({ class: [props.class, props.ui?.root] })"
|
|
148
|
+
:name="name"
|
|
149
|
+
:disabled="disabled"
|
|
150
|
+
:locale="locale"
|
|
151
|
+
@update:model-value="onUpdate"
|
|
152
|
+
>
|
|
153
|
+
<NumberFieldInput
|
|
154
|
+
v-bind="$attrs"
|
|
155
|
+
ref="inputRef"
|
|
156
|
+
:placeholder="placeholder"
|
|
157
|
+
:required="required"
|
|
158
|
+
:class="ui.base({ class: props.ui?.base })"
|
|
159
|
+
@blur="onBlur"
|
|
160
|
+
/>
|
|
161
|
+
|
|
162
|
+
<div :class="ui.increment({ class: props.ui?.increment })">
|
|
163
|
+
<NumberFieldIncrement as-child :disabled="disabled">
|
|
164
|
+
<slot name="increment">
|
|
165
|
+
<UButton
|
|
166
|
+
:icon="incrementIcon"
|
|
167
|
+
:color="color"
|
|
168
|
+
:size="size"
|
|
169
|
+
variant="link"
|
|
170
|
+
:aria-label="t('inputNumber.increment')"
|
|
171
|
+
v-bind="typeof increment === 'object' ? increment : undefined"
|
|
172
|
+
/>
|
|
173
|
+
</slot>
|
|
174
|
+
</NumberFieldIncrement>
|
|
175
|
+
</div>
|
|
176
|
+
|
|
177
|
+
<div :class="ui.decrement({ class: props.ui?.decrement })">
|
|
178
|
+
<NumberFieldDecrement as-child :disabled="disabled">
|
|
179
|
+
<slot name="decrement">
|
|
180
|
+
<UButton
|
|
181
|
+
:icon="decrementIcon"
|
|
182
|
+
:color="color"
|
|
183
|
+
:size="size"
|
|
184
|
+
variant="link"
|
|
185
|
+
:aria-label="t('inputNumber.decrement')"
|
|
186
|
+
v-bind="typeof decrement === 'object' ? decrement : undefined"
|
|
187
|
+
/>
|
|
188
|
+
</slot>
|
|
189
|
+
</NumberFieldDecrement>
|
|
190
|
+
</div>
|
|
191
|
+
</NumberFieldRoot>
|
|
192
|
+
</template>
|
|
@@ -4,6 +4,7 @@ import type { AppConfig } from '@nuxt/schema'
|
|
|
4
4
|
import _appConfig from '#build/app.config'
|
|
5
5
|
import theme from '#build/ui/kbd'
|
|
6
6
|
import type { KbdKey } from '../composables/useKbd'
|
|
7
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
7
8
|
|
|
8
9
|
const appConfig = _appConfig as AppConfig & { ui: { kbd: Partial<typeof theme> } }
|
|
9
10
|
|
|
@@ -26,10 +27,11 @@ export interface KbdProps {
|
|
|
26
27
|
export interface KbdSlots {
|
|
27
28
|
default(props?: {}): any
|
|
28
29
|
}
|
|
30
|
+
extendDevtoolsMeta({ defaultProps: { value: 'K' } })
|
|
29
31
|
</script>
|
|
30
32
|
|
|
31
33
|
<script setup lang="ts">
|
|
32
|
-
import { Primitive } from '
|
|
34
|
+
import { Primitive } from 'reka-ui'
|
|
33
35
|
import { useKbd } from '../composables/useKbd'
|
|
34
36
|
|
|
35
37
|
const props = withDefaults(defineProps<KbdProps>(), {
|