@nuxt/ui 3.0.0-alpha.1 → 3.0.0-alpha.11
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 +259 -0
- package/.nuxt/ui/avatar-group.ts +52 -0
- package/.nuxt/ui/avatar.ts +54 -0
- package/.nuxt/ui/badge.ts +231 -0
- package/.nuxt/ui/breadcrumb.ts +45 -0
- package/.nuxt/ui/button-group.ts +29 -0
- package/.nuxt/ui/button.ts +376 -0
- package/.nuxt/ui/calendar.ts +103 -0
- package/.nuxt/ui/card.ts +8 -0
- package/.nuxt/ui/carousel.ts +43 -0
- package/.nuxt/ui/checkbox.ts +123 -0
- package/.nuxt/ui/chip.ts +96 -0
- package/.nuxt/ui/collapsible.ts +6 -0
- package/.nuxt/ui/color-picker.ts +47 -0
- package/.nuxt/ui/command-palette.ts +50 -0
- package/.nuxt/ui/container.ts +3 -0
- package/.nuxt/ui/context-menu.ts +216 -0
- package/.nuxt/ui/drawer.ts +62 -0
- package/.nuxt/ui/dropdown-menu.ts +217 -0
- package/.nuxt/ui/form-field.ts +48 -0
- package/.nuxt/ui/form.ts +3 -0
- package/.nuxt/ui/index.ts +48 -0
- package/.nuxt/ui/input-menu.ts +445 -0
- package/.nuxt/ui/input-number.ts +235 -0
- package/.nuxt/ui/input.ts +298 -0
- package/.nuxt/ui/kbd.ts +31 -0
- package/.nuxt/ui/link.ts +15 -0
- package/.nuxt/ui/modal.ts +28 -0
- package/.nuxt/ui/navigation-menu.ts +436 -0
- package/.nuxt/ui/pagination.ts +8 -0
- package/.nuxt/ui/pin-input.ts +171 -0
- package/.nuxt/ui/popover.ts +6 -0
- package/.nuxt/ui/progress.ts +297 -0
- package/.nuxt/ui/radio-group.ts +135 -0
- package/.nuxt/ui/select-menu.ts +351 -0
- package/.nuxt/ui/select.ts +350 -0
- package/.nuxt/ui/separator.ts +172 -0
- package/.nuxt/ui/skeleton.ts +3 -0
- package/.nuxt/ui/slideover.ts +70 -0
- package/.nuxt/ui/slider.ts +171 -0
- package/.nuxt/ui/stepper.ts +202 -0
- package/.nuxt/ui/switch.ts +131 -0
- package/.nuxt/ui/table.ts +146 -0
- package/.nuxt/ui/tabs.ts +255 -0
- package/.nuxt/ui/textarea.ts +298 -0
- package/.nuxt/ui/toast.ts +76 -0
- package/.nuxt/ui/toaster.ts +91 -0
- package/.nuxt/ui/tooltip.ts +9 -0
- package/README.md +82 -54
- package/cli/commands/{init.mjs → make/component.mjs} +17 -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/package.json +2 -2
- package/cli/templates.mjs +60 -10
- 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/CQ-XZFu7.js +54 -0
- package/dist/client/devtools/_nuxt/DNZFyo26.js +1 -0
- package/dist/client/devtools/_nuxt/Dtz-o9GB.js +1 -0
- package/dist/client/devtools/_nuxt/builds/latest.json +1 -0
- package/dist/client/devtools/_nuxt/builds/meta/1f5fbd7b-9d97-480e-9ae4-e02b4ff7018b.json +1 -0
- package/dist/client/devtools/_nuxt/entry.qOdop8tq.css +1 -0
- package/dist/client/devtools/_nuxt/error-404.D-rS9BDk.css +1 -0
- package/dist/client/devtools/_nuxt/error-500.CfcCHs91.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 +51 -9
- package/dist/runtime/components/Alert.vue +16 -8
- package/dist/runtime/components/App.vue +20 -7
- package/dist/runtime/components/Avatar.vue +36 -11
- package/dist/runtime/components/AvatarGroup.vue +6 -2
- package/dist/runtime/components/Badge.vue +36 -5
- package/dist/runtime/components/Breadcrumb.vue +53 -14
- package/dist/runtime/components/Button.vue +47 -7
- package/dist/runtime/components/ButtonGroup.vue +7 -3
- package/dist/runtime/components/Calendar.vue +191 -0
- package/dist/runtime/components/Card.vue +5 -2
- package/dist/runtime/components/Carousel.vue +323 -0
- package/dist/runtime/components/Checkbox.vue +30 -34
- package/dist/runtime/components/Chip.vue +12 -4
- package/dist/runtime/components/Collapsible.vue +11 -6
- package/dist/runtime/components/ColorPicker.vue +266 -0
- package/dist/runtime/components/CommandPalette.vue +132 -99
- package/dist/runtime/components/Container.vue +5 -2
- package/dist/runtime/components/ContextMenu.vue +103 -15
- package/dist/runtime/components/ContextMenuContent.vue +49 -19
- package/dist/runtime/components/Drawer.vue +28 -12
- package/dist/runtime/components/DropdownMenu.vue +93 -17
- package/dist/runtime/components/DropdownMenuContent.vue +51 -19
- package/dist/runtime/components/Form.vue +59 -41
- package/dist/runtime/components/FormField.vue +20 -7
- package/dist/runtime/components/Icon.vue +1 -1
- package/dist/runtime/components/Input.vue +18 -8
- package/dist/runtime/components/InputMenu.vue +164 -66
- package/dist/runtime/components/InputNumber.vue +193 -0
- package/dist/runtime/components/Kbd.vue +5 -2
- package/dist/runtime/components/Link.vue +72 -9
- package/dist/runtime/components/LinkBase.vue +10 -7
- package/dist/runtime/components/Modal.vue +23 -16
- package/dist/runtime/components/NavigationMenu.vue +178 -78
- package/dist/runtime/components/Pagination.vue +32 -16
- package/dist/runtime/components/PinInput.vue +97 -0
- package/dist/runtime/components/Popover.vue +29 -9
- package/dist/runtime/components/Progress.vue +29 -11
- package/dist/runtime/components/RadioGroup.vue +30 -8
- package/dist/runtime/components/Select.vue +81 -33
- package/dist/runtime/components/SelectMenu.vue +181 -81
- package/dist/runtime/components/Separator.vue +5 -4
- package/dist/runtime/components/Skeleton.vue +5 -2
- package/dist/runtime/components/Slideover.vue +23 -15
- package/dist/runtime/components/Slider.vue +5 -4
- package/dist/runtime/components/Stepper.vue +173 -0
- package/dist/runtime/components/Switch.vue +18 -17
- package/dist/runtime/components/Table.vue +263 -0
- package/dist/runtime/components/Tabs.vue +45 -16
- package/dist/runtime/components/Textarea.vue +12 -5
- package/dist/runtime/components/Toast.vue +15 -6
- package/dist/runtime/components/Toaster.vue +33 -17
- package/dist/runtime/components/Tooltip.vue +10 -7
- 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 +3 -9
- 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 +9 -5
- package/dist/runtime/composables/useFormField.js +8 -4
- 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 +55 -0
- package/dist/runtime/locale/cs.d.ts +2 -0
- package/dist/runtime/locale/cs.js +54 -0
- package/dist/runtime/locale/da.d.ts +2 -0
- package/dist/runtime/locale/da.js +54 -0
- package/dist/runtime/locale/de.d.ts +2 -0
- package/dist/runtime/locale/de.js +54 -0
- package/dist/runtime/locale/el.d.ts +2 -0
- package/dist/runtime/locale/el.js +54 -0
- package/dist/runtime/locale/en.d.ts +2 -0
- package/dist/runtime/locale/en.js +54 -0
- package/dist/runtime/locale/es.d.ts +2 -0
- package/dist/runtime/locale/es.js +54 -0
- package/dist/runtime/locale/et.d.ts +2 -0
- package/dist/runtime/locale/et.js +54 -0
- package/dist/runtime/locale/fa_ir.d.ts +2 -0
- package/dist/runtime/locale/fa_ir.js +55 -0
- package/dist/runtime/locale/fi.d.ts +2 -0
- package/dist/runtime/locale/fi.js +54 -0
- package/dist/runtime/locale/fr.d.ts +2 -0
- package/dist/runtime/locale/fr.js +54 -0
- package/dist/runtime/locale/id.d.ts +2 -0
- package/dist/runtime/locale/id.js +54 -0
- package/dist/runtime/locale/index.d.ts +28 -0
- package/dist/runtime/locale/index.js +28 -0
- package/dist/runtime/locale/it.d.ts +2 -0
- package/dist/runtime/locale/it.js +54 -0
- package/dist/runtime/locale/ja.d.ts +2 -0
- package/dist/runtime/locale/ja.js +54 -0
- package/dist/runtime/locale/ko.d.ts +2 -0
- package/dist/runtime/locale/ko.js +54 -0
- package/dist/runtime/locale/nl.d.ts +2 -0
- package/dist/runtime/locale/nl.js +54 -0
- package/dist/runtime/locale/pl.d.ts +2 -0
- package/dist/runtime/locale/pl.js +54 -0
- package/dist/runtime/locale/pt.d.ts +2 -0
- package/dist/runtime/locale/pt.js +54 -0
- package/dist/runtime/locale/pt_br.d.ts +2 -0
- package/dist/runtime/locale/pt_br.js +54 -0
- package/dist/runtime/locale/ru.d.ts +2 -0
- package/dist/runtime/locale/ru.js +54 -0
- package/dist/runtime/locale/sk.d.ts +2 -0
- package/dist/runtime/locale/sk.js +54 -0
- package/dist/runtime/locale/sv.d.ts +2 -0
- package/dist/runtime/locale/sv.js +54 -0
- package/dist/runtime/locale/th.d.ts +2 -0
- package/dist/runtime/locale/th.js +54 -0
- package/dist/runtime/locale/tr.d.ts +2 -0
- package/dist/runtime/locale/tr.js +54 -0
- package/dist/runtime/locale/uk.d.ts +2 -0
- package/dist/runtime/locale/uk.js +54 -0
- package/dist/runtime/locale/vi.d.ts +2 -0
- package/dist/runtime/locale/vi.js +54 -0
- package/dist/runtime/locale/zh_hans.d.ts +2 -0
- package/dist/runtime/locale/zh_hans.js +54 -0
- package/dist/runtime/locale/zh_hant.d.ts +2 -0
- package/dist/runtime/locale/zh_hant.js +54 -0
- package/dist/runtime/plugins/colors.js +12 -8
- package/dist/runtime/types/form.d.ts +11 -4
- package/dist/runtime/types/form.js +2 -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 +56 -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/utils/tv.d.ts +1 -0
- package/dist/runtime/utils/tv.js +4 -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.BKsd22-Q.mjs +3289 -0
- package/dist/shared/ui.DCjJwb6l.cjs +3296 -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 +107 -35
- 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,21 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { InputHTMLAttributes } from 'vue'
|
|
3
|
-
import {
|
|
4
|
-
import type { ComboboxRootProps, ComboboxRootEmits, ComboboxContentProps,
|
|
3
|
+
import type { VariantProps } from 'tailwind-variants'
|
|
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'
|
|
10
|
+
import { tv } from '../utils/tv'
|
|
9
11
|
import type { AvatarProps, ChipProps, InputProps } from '../types'
|
|
10
|
-
import type {
|
|
12
|
+
import type { PartialString, MaybeArrayOfArray, MaybeArrayOfArrayItem, SelectModelValue, SelectModelValueEmits, SelectItemKey } from '../types/utils'
|
|
11
13
|
|
|
12
14
|
const appConfig = _appConfig as AppConfig & { ui: { inputMenu: Partial<typeof theme> } }
|
|
13
15
|
|
|
14
16
|
const inputMenu = tv({ extend: tv(theme), ...(appConfig.ui?.inputMenu || {}) })
|
|
15
17
|
|
|
16
|
-
export interface InputMenuItem
|
|
18
|
+
export interface InputMenuItem {
|
|
17
19
|
label?: string
|
|
18
20
|
icon?: string
|
|
19
21
|
avatar?: AvatarProps
|
|
@@ -23,11 +25,13 @@ export interface InputMenuItem extends Pick<ComboboxItemProps, 'disabled'> {
|
|
|
23
25
|
* @defaultValue 'item'
|
|
24
26
|
*/
|
|
25
27
|
type?: 'label' | 'separator' | 'item'
|
|
28
|
+
disabled?: boolean
|
|
29
|
+
onSelect?(e?: Event): void
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
type InputMenuVariants = VariantProps<typeof inputMenu>
|
|
29
33
|
|
|
30
|
-
export interface InputMenuProps<T
|
|
34
|
+
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
35
|
/**
|
|
32
36
|
* The element or component this component should render as.
|
|
33
37
|
* @defaultValue 'div'
|
|
@@ -61,7 +65,7 @@ export interface InputMenuProps<T> extends Pick<ComboboxRootProps<T>, 'modelValu
|
|
|
61
65
|
deleteIcon?: string
|
|
62
66
|
/**
|
|
63
67
|
* The content of the menu.
|
|
64
|
-
* @defaultValue { side: 'bottom', sideOffset: 8, position: 'popper' }
|
|
68
|
+
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }
|
|
65
69
|
*/
|
|
66
70
|
content?: Omit<ComboboxContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
67
71
|
/**
|
|
@@ -74,35 +78,56 @@ export interface InputMenuProps<T> extends Pick<ComboboxRootProps<T>, 'modelValu
|
|
|
74
78
|
* @defaultValue true
|
|
75
79
|
*/
|
|
76
80
|
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
81
|
/**
|
|
84
82
|
* When `items` is an array of objects, select the field to use as the value instead of the object itself.
|
|
85
83
|
* @defaultValue undefined
|
|
86
84
|
*/
|
|
87
|
-
valueKey?:
|
|
88
|
-
|
|
85
|
+
valueKey?: V
|
|
86
|
+
/**
|
|
87
|
+
* When `items` is an array of objects, select the field to use as the label.
|
|
88
|
+
* @defaultValue 'label'
|
|
89
|
+
*/
|
|
90
|
+
labelKey?: V
|
|
91
|
+
items?: I
|
|
92
|
+
/** The value of the InputMenu when initially rendered. Use when you do not need to control the state of the InputMenu. */
|
|
93
|
+
defaultValue?: SelectModelValue<T, V, M>
|
|
94
|
+
/** The controlled value of the InputMenu. Can be binded-with with `v-model`. */
|
|
95
|
+
modelValue?: SelectModelValue<T, V, M>
|
|
96
|
+
/** Whether multiple options can be selected or not. */
|
|
97
|
+
multiple?: M & boolean
|
|
89
98
|
/** Highlight the ring color like a focus state. */
|
|
90
99
|
highlight?: boolean
|
|
100
|
+
/**
|
|
101
|
+
* Determines if custom user input that does not exist in options can be added.
|
|
102
|
+
* @defaultValue false
|
|
103
|
+
*/
|
|
104
|
+
createItem?: boolean | 'always' | { position?: 'top' | 'bottom', when?: 'empty' | 'always' }
|
|
105
|
+
/**
|
|
106
|
+
* Fields to filter items by.
|
|
107
|
+
* @defaultValue [labelKey]
|
|
108
|
+
*/
|
|
109
|
+
filterFields?: string[]
|
|
110
|
+
/**
|
|
111
|
+
* When `true`, disable the default filters, useful for custom filtering (useAsyncData, useFetch, etc.).
|
|
112
|
+
* @defaultValue false
|
|
113
|
+
*/
|
|
114
|
+
ignoreFilter?: boolean
|
|
91
115
|
class?: any
|
|
92
116
|
ui?: PartialString<typeof inputMenu.slots>
|
|
93
117
|
}
|
|
94
118
|
|
|
95
|
-
export type InputMenuEmits<T> = ComboboxRootEmits<T> & {
|
|
119
|
+
export type InputMenuEmits<T, V, M extends boolean> = Omit<ComboboxRootEmits<T>, 'update:modelValue'> & {
|
|
96
120
|
change: [payload: Event]
|
|
97
121
|
blur: [payload: FocusEvent]
|
|
98
122
|
focus: [payload: FocusEvent]
|
|
99
|
-
|
|
123
|
+
create: [item: string]
|
|
124
|
+
} & SelectModelValueEmits<T, V, M>
|
|
100
125
|
|
|
101
126
|
type SlotProps<T> = (props: { item: T, index: number }) => any
|
|
102
127
|
|
|
103
|
-
export
|
|
104
|
-
'leading'(props: { modelValue: T, open: boolean, ui: any }): any
|
|
105
|
-
'trailing'(props: { modelValue: T, open: boolean, ui: any }): any
|
|
128
|
+
export interface InputMenuSlots<T, M extends boolean> {
|
|
129
|
+
'leading'(props: { modelValue?: M extends true ? T[] : T, open: boolean, ui: any }): any
|
|
130
|
+
'trailing'(props: { modelValue?: M extends true ? T[] : T, open: boolean, ui: any }): any
|
|
106
131
|
'empty'(props: { searchTerm?: string }): any
|
|
107
132
|
'item': SlotProps<T>
|
|
108
133
|
'item-leading': SlotProps<T>
|
|
@@ -110,86 +135,117 @@ export type InputMenuSlots<T> = {
|
|
|
110
135
|
'item-trailing': SlotProps<T>
|
|
111
136
|
'tags-item-text': SlotProps<T>
|
|
112
137
|
'tags-item-delete': SlotProps<T>
|
|
138
|
+
'create-item-label'(props: { item: string }): any
|
|
113
139
|
}
|
|
140
|
+
|
|
141
|
+
extendDevtoolsMeta({ defaultProps: { items: ['Option 1', 'Option 2', 'Option 3'] } })
|
|
114
142
|
</script>
|
|
115
143
|
|
|
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 '
|
|
144
|
+
<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">
|
|
145
|
+
import { computed, ref, toRef, onMounted, toRaw } from 'vue'
|
|
146
|
+
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
147
|
import { defu } from 'defu'
|
|
120
|
-
import {
|
|
148
|
+
import { isEqual } from 'ohash'
|
|
149
|
+
import { reactivePick, createReusableTemplate } from '@vueuse/core'
|
|
121
150
|
import { useAppConfig } from '#imports'
|
|
122
151
|
import { useButtonGroup } from '../composables/useButtonGroup'
|
|
123
152
|
import { useComponentIcons } from '../composables/useComponentIcons'
|
|
124
153
|
import { useFormField } from '../composables/useFormField'
|
|
154
|
+
import { useLocale } from '../composables/useLocale'
|
|
155
|
+
import { get, compare } from '../utils'
|
|
125
156
|
import UIcon from './Icon.vue'
|
|
126
157
|
import UAvatar from './Avatar.vue'
|
|
127
158
|
import UChip from './Chip.vue'
|
|
128
|
-
import { get } from '../utils'
|
|
129
159
|
|
|
130
160
|
defineOptions({ inheritAttrs: false })
|
|
131
161
|
|
|
132
|
-
const props = withDefaults(defineProps<InputMenuProps<T>>(), {
|
|
162
|
+
const props = withDefaults(defineProps<InputMenuProps<T, I, V, M>>(), {
|
|
133
163
|
type: 'text',
|
|
134
164
|
autofocusDelay: 0,
|
|
135
165
|
portal: true,
|
|
136
|
-
|
|
166
|
+
labelKey: 'label' as never
|
|
137
167
|
})
|
|
138
|
-
const emits = defineEmits<InputMenuEmits<T>>()
|
|
139
|
-
const slots = defineSlots<InputMenuSlots<T>>()
|
|
168
|
+
const emits = defineEmits<InputMenuEmits<T, V, M>>()
|
|
169
|
+
const slots = defineSlots<InputMenuSlots<T, M>>()
|
|
140
170
|
|
|
141
171
|
const searchTerm = defineModel<string>('searchTerm', { default: '' })
|
|
142
172
|
|
|
173
|
+
const { t } = useLocale()
|
|
143
174
|
const appConfig = useAppConfig()
|
|
144
|
-
const
|
|
145
|
-
|
|
175
|
+
const { contains } = useFilter({ sensitivity: 'base' })
|
|
176
|
+
|
|
177
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'open', 'defaultOpen', 'multiple', 'resetSearchTermOnBlur', 'highlightOnHover', 'ignoreFilter'), emits)
|
|
178
|
+
const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }) as ComboboxContentProps)
|
|
179
|
+
const arrowProps = toRef(() => props.arrow as ComboboxArrowProps)
|
|
180
|
+
|
|
146
181
|
const { emitFormBlur, emitFormChange, emitFormInput, size: formGroupSize, color, id, name, highlight, disabled } = useFormField<InputProps>(props)
|
|
147
182
|
const { orientation, size: buttonGroupSize } = useButtonGroup<InputProps>(props)
|
|
148
183
|
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(props, { trailingIcon: appConfig.ui.icons.chevronDown })))
|
|
149
184
|
|
|
150
185
|
const inputSize = computed(() => buttonGroupSize.value || formGroupSize.value)
|
|
151
186
|
|
|
187
|
+
const [DefineCreateItemTemplate, ReuseCreateItemTemplate] = createReusableTemplate()
|
|
188
|
+
|
|
152
189
|
const ui = computed(() => inputMenu({
|
|
153
190
|
color: color.value,
|
|
154
191
|
variant: props.variant,
|
|
155
192
|
size: inputSize?.value,
|
|
156
193
|
loading: props.loading,
|
|
157
194
|
highlight: highlight.value,
|
|
158
|
-
leading: isLeading.value || !!slots.leading,
|
|
195
|
+
leading: isLeading.value || !!props.avatar || !!slots.leading,
|
|
159
196
|
trailing: isTrailing.value || !!slots.trailing,
|
|
160
197
|
multiple: props.multiple,
|
|
161
198
|
buttonGroup: orientation.value
|
|
162
199
|
}))
|
|
163
200
|
|
|
164
|
-
function displayValue(
|
|
165
|
-
if (
|
|
166
|
-
return
|
|
201
|
+
function displayValue(value: T): string {
|
|
202
|
+
if (!props.valueKey) {
|
|
203
|
+
return value && (typeof value === 'object' ? get(value, props.labelKey as string) : value)
|
|
167
204
|
}
|
|
168
205
|
|
|
169
|
-
|
|
206
|
+
const item = items.value.find(item => compare(typeof item === 'object' ? get(item as Record<string, any>, props.valueKey as string) : item, value))
|
|
207
|
+
return item && (typeof item === 'object' ? get(item, props.labelKey as string) : item)
|
|
170
208
|
}
|
|
171
209
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
210
|
+
const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0]) ? props.items : [props.items]) as InputMenuItem[][] : [])
|
|
211
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
212
|
+
const items = computed(() => groups.value.flatMap(group => group) as T[])
|
|
213
|
+
|
|
214
|
+
const filteredGroups = computed(() => {
|
|
215
|
+
if (props.ignoreFilter || !searchTerm.value) {
|
|
216
|
+
return groups.value
|
|
175
217
|
}
|
|
176
218
|
|
|
177
|
-
const fields = Array.isArray(props.
|
|
219
|
+
const fields = Array.isArray(props.filterFields) ? props.filterFields : [props.labelKey] as string[]
|
|
178
220
|
|
|
179
|
-
return items.filter((item) => {
|
|
221
|
+
return groups.value.map(items => items.filter((item) => {
|
|
180
222
|
if (typeof item !== 'object') {
|
|
181
|
-
return
|
|
223
|
+
return contains(item, searchTerm.value)
|
|
182
224
|
}
|
|
183
225
|
|
|
184
|
-
|
|
185
|
-
|
|
226
|
+
if (item.type && ['label', 'separator'].includes(item.type)) {
|
|
227
|
+
return true
|
|
228
|
+
}
|
|
186
229
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
230
|
+
return fields.some(field => contains(get(item, field), searchTerm.value))
|
|
231
|
+
})).filter(group => group.filter(item => !item.type || !['label', 'separator'].includes(item.type)).length > 0)
|
|
232
|
+
})
|
|
233
|
+
const filteredItems = computed(() => filteredGroups.value.flatMap(group => group) as T[])
|
|
191
234
|
|
|
192
|
-
const
|
|
235
|
+
const createItem = computed(() => {
|
|
236
|
+
if (!props.createItem || !searchTerm.value) {
|
|
237
|
+
return false
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const newItem = props.valueKey ? { [props.valueKey]: searchTerm.value } as T : searchTerm.value
|
|
241
|
+
|
|
242
|
+
if ((typeof props.createItem === 'object' && props.createItem.when === 'always') || props.createItem === 'always') {
|
|
243
|
+
return !filteredItems.value.find(item => compare(item, newItem, props.valueKey))
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return !filteredItems.value.length
|
|
247
|
+
})
|
|
248
|
+
const createItemPosition = computed(() => typeof props.createItem === 'object' ? props.createItem.position : 'bottom')
|
|
193
249
|
|
|
194
250
|
const inputRef = ref<InstanceType<typeof ComboboxInput> | null>(null)
|
|
195
251
|
|
|
@@ -206,6 +262,9 @@ onMounted(() => {
|
|
|
206
262
|
})
|
|
207
263
|
|
|
208
264
|
function onUpdate(value: any) {
|
|
265
|
+
if (toRaw(props.modelValue) === value) {
|
|
266
|
+
return
|
|
267
|
+
}
|
|
209
268
|
// @ts-expect-error - 'target' does not exist in type 'EventInit'
|
|
210
269
|
const event = new Event('change', { target: { value } })
|
|
211
270
|
emits('change', event)
|
|
@@ -218,6 +277,10 @@ function onBlur(event: FocusEvent) {
|
|
|
218
277
|
emitFormBlur()
|
|
219
278
|
}
|
|
220
279
|
|
|
280
|
+
function onFocus(event: FocusEvent) {
|
|
281
|
+
emits('focus', event)
|
|
282
|
+
}
|
|
283
|
+
|
|
221
284
|
function onUpdateOpen(value: boolean) {
|
|
222
285
|
if (!value) {
|
|
223
286
|
const event = new FocusEvent('blur')
|
|
@@ -229,23 +292,46 @@ function onUpdateOpen(value: boolean) {
|
|
|
229
292
|
}
|
|
230
293
|
}
|
|
231
294
|
|
|
295
|
+
function onRemoveTag(event: any) {
|
|
296
|
+
if (props.multiple) {
|
|
297
|
+
const modelValue = props.modelValue as SelectModelValue<T, V, true>
|
|
298
|
+
const filteredValue = modelValue.filter(value => !isEqual(value, event))
|
|
299
|
+
emits('update:modelValue', filteredValue as SelectModelValue<T, V, M>)
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
232
303
|
defineExpose({
|
|
233
304
|
inputRef
|
|
234
305
|
})
|
|
235
306
|
</script>
|
|
236
307
|
|
|
308
|
+
<!-- eslint-disable vue/no-template-shadow -->
|
|
237
309
|
<template>
|
|
310
|
+
<DefineCreateItemTemplate>
|
|
311
|
+
<ComboboxGroup :class="ui.group({ class: props.ui?.group })">
|
|
312
|
+
<ComboboxItem
|
|
313
|
+
:class="ui.item({ class: props.ui?.item })"
|
|
314
|
+
:value="searchTerm"
|
|
315
|
+
@select.prevent="emits('create', searchTerm)"
|
|
316
|
+
>
|
|
317
|
+
<span :class="ui.itemLabel({ class: props.ui?.itemLabel })">
|
|
318
|
+
<slot name="create-item-label" :item="searchTerm">
|
|
319
|
+
{{ t('inputMenu.create', { label: searchTerm }) }}
|
|
320
|
+
</slot>
|
|
321
|
+
</span>
|
|
322
|
+
</ComboboxItem>
|
|
323
|
+
</ComboboxGroup>
|
|
324
|
+
</DefineCreateItemTemplate>
|
|
325
|
+
|
|
238
326
|
<ComboboxRoot
|
|
239
327
|
:id="id"
|
|
240
328
|
v-slot="{ modelValue, open }"
|
|
241
329
|
v-bind="rootProps"
|
|
242
|
-
v-model:search-term="searchTerm"
|
|
243
330
|
:name="name"
|
|
244
331
|
:disabled="disabled"
|
|
245
|
-
:display-value="displayValue"
|
|
246
|
-
:filter-function="filterFunction"
|
|
247
332
|
:class="ui.root({ class: [props.class, props.ui?.root] })"
|
|
248
333
|
:as-child="!!multiple"
|
|
334
|
+
ignore-filter
|
|
249
335
|
@update:model-value="onUpdate"
|
|
250
336
|
@update:open="onUpdateOpen"
|
|
251
337
|
@keydown.enter="$event.preventDefault()"
|
|
@@ -253,17 +339,19 @@ defineExpose({
|
|
|
253
339
|
<ComboboxAnchor :as-child="!multiple" :class="ui.base({ class: props.ui?.base })">
|
|
254
340
|
<TagsInputRoot
|
|
255
341
|
v-if="multiple"
|
|
256
|
-
v-slot="{ modelValue: tags }
|
|
342
|
+
v-slot="{ modelValue: tags }"
|
|
257
343
|
:model-value="(modelValue as string[])"
|
|
258
344
|
:disabled="disabled"
|
|
259
345
|
delimiter=""
|
|
260
346
|
as-child
|
|
261
347
|
@blur="onBlur"
|
|
348
|
+
@focus="onFocus"
|
|
349
|
+
@remove-tag="onRemoveTag"
|
|
262
350
|
>
|
|
263
351
|
<TagsInputItem v-for="(item, index) in tags" :key="index" :value="(item as string)" :class="ui.tagsItem({ class: props.ui?.tagsItem })">
|
|
264
352
|
<TagsInputItemText :class="ui.tagsItemText({ class: props.ui?.tagsItemText })">
|
|
265
353
|
<slot name="tags-item-text" :item="(item as T)" :index="index">
|
|
266
|
-
{{
|
|
354
|
+
{{ displayValue(item as T) }}
|
|
267
355
|
</slot>
|
|
268
356
|
</TagsInputItemText>
|
|
269
357
|
|
|
@@ -274,7 +362,7 @@ defineExpose({
|
|
|
274
362
|
</TagsInputItemDelete>
|
|
275
363
|
</TagsInputItem>
|
|
276
364
|
|
|
277
|
-
<ComboboxInput as-child>
|
|
365
|
+
<ComboboxInput v-model="searchTerm" :display-value="displayValue" as-child>
|
|
278
366
|
<TagsInputInput
|
|
279
367
|
ref="inputRef"
|
|
280
368
|
v-bind="$attrs"
|
|
@@ -289,22 +377,25 @@ defineExpose({
|
|
|
289
377
|
<ComboboxInput
|
|
290
378
|
v-else
|
|
291
379
|
ref="inputRef"
|
|
380
|
+
v-model="searchTerm"
|
|
381
|
+
:display-value="displayValue"
|
|
292
382
|
v-bind="$attrs"
|
|
293
383
|
:type="type"
|
|
294
384
|
:placeholder="placeholder"
|
|
295
385
|
:required="required"
|
|
296
|
-
:class="ui.base({ class: props.ui?.base })"
|
|
297
386
|
@blur="onBlur"
|
|
387
|
+
@focus="onFocus"
|
|
298
388
|
/>
|
|
299
389
|
|
|
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 })" />
|
|
390
|
+
<span v-if="isLeading || !!avatar || !!slots.leading" :class="ui.leading({ class: props.ui?.leading })">
|
|
391
|
+
<slot name="leading" :model-value="(modelValue as M extends true ? T[] : T)" :open="open" :ui="ui">
|
|
392
|
+
<UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
|
393
|
+
<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
394
|
</slot>
|
|
304
395
|
</span>
|
|
305
396
|
|
|
306
397
|
<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">
|
|
398
|
+
<slot name="trailing" :model-value="(modelValue as M extends true ? T[] : T)" :open="open" :ui="ui">
|
|
308
399
|
<UIcon v-if="trailingIconName" :name="trailingIconName" :class="ui.trailingIcon({ class: props.ui?.trailingIcon })" />
|
|
309
400
|
</slot>
|
|
310
401
|
</ComboboxTrigger>
|
|
@@ -314,15 +405,17 @@ defineExpose({
|
|
|
314
405
|
<ComboboxContent :class="ui.content({ class: props.ui?.content })" v-bind="contentProps">
|
|
315
406
|
<ComboboxEmpty :class="ui.empty({ class: props.ui?.empty })">
|
|
316
407
|
<slot name="empty" :search-term="searchTerm">
|
|
317
|
-
{{ searchTerm ?
|
|
408
|
+
{{ searchTerm ? t('inputMenu.noMatch', { searchTerm }) : t('inputMenu.noData') }}
|
|
318
409
|
</slot>
|
|
319
410
|
</ComboboxEmpty>
|
|
320
411
|
|
|
321
412
|
<ComboboxViewport :class="ui.viewport({ class: props.ui?.viewport })">
|
|
322
|
-
<
|
|
413
|
+
<ReuseCreateItemTemplate v-if="createItem && createItemPosition === 'top'" />
|
|
414
|
+
|
|
415
|
+
<ComboboxGroup v-for="(group, groupIndex) in filteredGroups" :key="`group-${groupIndex}`" :class="ui.group({ class: props.ui?.group })">
|
|
323
416
|
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
|
324
417
|
<ComboboxLabel v-if="item?.type === 'label'" :class="ui.label({ class: props.ui?.label })">
|
|
325
|
-
{{ item.
|
|
418
|
+
{{ get(item, props.labelKey as string) }}
|
|
326
419
|
</ComboboxLabel>
|
|
327
420
|
|
|
328
421
|
<ComboboxSeparator v-else-if="item?.type === 'separator'" :class="ui.separator({ class: props.ui?.separator })" />
|
|
@@ -331,12 +424,13 @@ defineExpose({
|
|
|
331
424
|
v-else
|
|
332
425
|
:class="ui.item({ class: props.ui?.item })"
|
|
333
426
|
:disabled="item.disabled"
|
|
334
|
-
:value="valueKey && typeof item === 'object' ? (item
|
|
427
|
+
:value="valueKey && typeof item === 'object' ? get(item, props.valueKey as string) : item"
|
|
428
|
+
@select="item.onSelect"
|
|
335
429
|
>
|
|
336
430
|
<slot name="item" :item="(item as T)" :index="index">
|
|
337
431
|
<slot name="item-leading" :item="(item as T)" :index="index">
|
|
338
|
-
<
|
|
339
|
-
<
|
|
432
|
+
<UIcon v-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: props.ui?.itemLeadingIcon })" />
|
|
433
|
+
<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
434
|
<UChip
|
|
341
435
|
v-else-if="item.chip"
|
|
342
436
|
:size="((props.ui?.itemLeadingChipSize || ui.itemLeadingChipSize()) as ChipProps['size'])"
|
|
@@ -349,7 +443,7 @@ defineExpose({
|
|
|
349
443
|
|
|
350
444
|
<span :class="ui.itemLabel({ class: props.ui?.itemLabel })">
|
|
351
445
|
<slot name="item-label" :item="(item as T)" :index="index">
|
|
352
|
-
{{
|
|
446
|
+
{{ typeof item === 'object' ? get(item, props.labelKey as string) : item }}
|
|
353
447
|
</slot>
|
|
354
448
|
</span>
|
|
355
449
|
|
|
@@ -364,7 +458,11 @@ defineExpose({
|
|
|
364
458
|
</ComboboxItem>
|
|
365
459
|
</template>
|
|
366
460
|
</ComboboxGroup>
|
|
461
|
+
|
|
462
|
+
<ReuseCreateItemTemplate v-if="createItem && createItemPosition === 'bottom'" />
|
|
367
463
|
</ComboboxViewport>
|
|
464
|
+
|
|
465
|
+
<ComboboxArrow v-if="!!arrow" v-bind="arrowProps" :class="ui.arrow({ class: props.ui?.arrow })" />
|
|
368
466
|
</ComboboxContent>
|
|
369
467
|
</ComboboxPortal>
|
|
370
468
|
</ComboboxRoot>
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import 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 { tv } from '../utils/tv'
|
|
8
|
+
import type { ButtonProps } from '../types'
|
|
9
|
+
|
|
10
|
+
const appConfig = _appConfig as AppConfig & { ui: { inputNumber: Partial<typeof theme> } }
|
|
11
|
+
|
|
12
|
+
const inputNumber = tv({ extend: tv(theme), ...(appConfig.ui?.inputNumber || {}) })
|
|
13
|
+
|
|
14
|
+
type InputNumberVariants = VariantProps<typeof inputNumber>
|
|
15
|
+
|
|
16
|
+
export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue' | 'defaultValue' | 'min' | 'max' | 'step' | 'disabled' | 'required' | 'id' | 'name' | 'formatOptions'> {
|
|
17
|
+
/**
|
|
18
|
+
* The element or component this component should render as.
|
|
19
|
+
* @defaultValue 'div'
|
|
20
|
+
*/
|
|
21
|
+
as?: any
|
|
22
|
+
class?: any
|
|
23
|
+
/** The placeholder text when the input is empty. */
|
|
24
|
+
placeholder?: string
|
|
25
|
+
ui?: Partial<typeof inputNumber.slots>
|
|
26
|
+
color?: InputNumberVariants['color']
|
|
27
|
+
variant?: InputNumberVariants['variant']
|
|
28
|
+
size?: InputNumberVariants['size']
|
|
29
|
+
/** Highlight the ring color like a focus state. */
|
|
30
|
+
highlight?: boolean
|
|
31
|
+
/**
|
|
32
|
+
* The orientation of the input menu.
|
|
33
|
+
* @defaultValue 'horizontal'
|
|
34
|
+
*/
|
|
35
|
+
orientation?: 'vertical' | 'horizontal'
|
|
36
|
+
/**
|
|
37
|
+
* Configure the increment button. The `color` and `size` are inherited.
|
|
38
|
+
* @defaultValue { variant: 'link' }
|
|
39
|
+
*/
|
|
40
|
+
increment?: ButtonProps
|
|
41
|
+
/**
|
|
42
|
+
* The icon displayed to increment the value.
|
|
43
|
+
* @defaultValue appConfig.ui.icons.plus
|
|
44
|
+
*/
|
|
45
|
+
incrementIcon?: string
|
|
46
|
+
/**
|
|
47
|
+
* Configure the decrement button. The `color` and `size` are inherited.
|
|
48
|
+
* @defaultValue { variant: 'link' }
|
|
49
|
+
*/
|
|
50
|
+
decrement?: ButtonProps
|
|
51
|
+
/**
|
|
52
|
+
* The icon displayed to decrement the value.
|
|
53
|
+
* @defaultValue appConfig.ui.icons.minus
|
|
54
|
+
*/
|
|
55
|
+
decrementIcon?: string
|
|
56
|
+
autofocus?: boolean
|
|
57
|
+
autofocusDelay?: number
|
|
58
|
+
/**
|
|
59
|
+
* The locale to use for formatting and parsing numbers.
|
|
60
|
+
* @defaultValue UApp.locale.code
|
|
61
|
+
*/
|
|
62
|
+
locale?: string
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface InputNumberEmits {
|
|
66
|
+
(e: 'update:modelValue', payload: number): void
|
|
67
|
+
(e: 'blur', event: FocusEvent): void
|
|
68
|
+
(e: 'change', payload: Event): void
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface InputNumberSlots {
|
|
72
|
+
increment(props?: {}): any
|
|
73
|
+
decrement(props?: {}): any
|
|
74
|
+
}
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<script setup lang="ts">
|
|
78
|
+
import { onMounted, ref, computed } from 'vue'
|
|
79
|
+
import { NumberFieldRoot, NumberFieldInput, NumberFieldDecrement, NumberFieldIncrement, useForwardPropsEmits } from 'reka-ui'
|
|
80
|
+
import { reactivePick } from '@vueuse/core'
|
|
81
|
+
import { useFormField } from '../composables/useFormField'
|
|
82
|
+
import { useLocale } from '../composables/useLocale'
|
|
83
|
+
import UButton from './Button.vue'
|
|
84
|
+
|
|
85
|
+
defineOptions({ inheritAttrs: false })
|
|
86
|
+
|
|
87
|
+
const props = withDefaults(defineProps<InputNumberProps>(), {
|
|
88
|
+
orientation: 'horizontal'
|
|
89
|
+
})
|
|
90
|
+
const emits = defineEmits<InputNumberEmits>()
|
|
91
|
+
defineSlots<InputNumberSlots>()
|
|
92
|
+
|
|
93
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'min', 'max', 'step', 'formatOptions'), emits)
|
|
94
|
+
|
|
95
|
+
const { emitFormBlur, emitFormChange, emitFormInput, id, color, size, name, highlight, disabled } = useFormField<InputNumberProps>(props)
|
|
96
|
+
|
|
97
|
+
const { t, code: codeLocale } = useLocale()
|
|
98
|
+
const locale = computed(() => props.locale || codeLocale.value)
|
|
99
|
+
|
|
100
|
+
const ui = computed(() => inputNumber({
|
|
101
|
+
color: color.value,
|
|
102
|
+
variant: props.variant,
|
|
103
|
+
size: size.value,
|
|
104
|
+
highlight: highlight.value,
|
|
105
|
+
orientation: props.orientation
|
|
106
|
+
}))
|
|
107
|
+
|
|
108
|
+
const incrementIcon = computed(() => props.incrementIcon || (props.orientation === 'horizontal' ? appConfig.ui.icons.plus : appConfig.ui.icons.chevronUp))
|
|
109
|
+
const decrementIcon = computed(() => props.decrementIcon || (props.orientation === 'horizontal' ? appConfig.ui.icons.minus : appConfig.ui.icons.chevronDown))
|
|
110
|
+
|
|
111
|
+
const inputRef = ref<InstanceType<typeof NumberFieldInput> | null>(null)
|
|
112
|
+
|
|
113
|
+
function autoFocus() {
|
|
114
|
+
if (props.autofocus) {
|
|
115
|
+
inputRef.value?.$el?.focus()
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
onMounted(() => {
|
|
120
|
+
setTimeout(() => {
|
|
121
|
+
autoFocus()
|
|
122
|
+
}, props.autofocusDelay)
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
function onUpdate(value: number) {
|
|
126
|
+
// @ts-expect-error - 'target' does not exist in type 'EventInit'
|
|
127
|
+
const event = new Event('change', { target: { value } })
|
|
128
|
+
emits('change', event)
|
|
129
|
+
|
|
130
|
+
emitFormChange()
|
|
131
|
+
emitFormInput()
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function onBlur(event: FocusEvent) {
|
|
135
|
+
emitFormBlur()
|
|
136
|
+
emits('blur', event)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
defineExpose({
|
|
140
|
+
inputRef
|
|
141
|
+
})
|
|
142
|
+
</script>
|
|
143
|
+
|
|
144
|
+
<template>
|
|
145
|
+
<NumberFieldRoot
|
|
146
|
+
v-bind="rootProps"
|
|
147
|
+
:id="id"
|
|
148
|
+
:class="ui.root({ class: [props.class, props.ui?.root] })"
|
|
149
|
+
:name="name"
|
|
150
|
+
:disabled="disabled"
|
|
151
|
+
:locale="locale"
|
|
152
|
+
@update:model-value="onUpdate"
|
|
153
|
+
>
|
|
154
|
+
<NumberFieldInput
|
|
155
|
+
v-bind="$attrs"
|
|
156
|
+
ref="inputRef"
|
|
157
|
+
:placeholder="placeholder"
|
|
158
|
+
:required="required"
|
|
159
|
+
:class="ui.base({ class: props.ui?.base })"
|
|
160
|
+
@blur="onBlur"
|
|
161
|
+
/>
|
|
162
|
+
|
|
163
|
+
<div :class="ui.increment({ class: props.ui?.increment })">
|
|
164
|
+
<NumberFieldIncrement as-child :disabled="disabled">
|
|
165
|
+
<slot name="increment">
|
|
166
|
+
<UButton
|
|
167
|
+
:icon="incrementIcon"
|
|
168
|
+
:color="color"
|
|
169
|
+
:size="size"
|
|
170
|
+
variant="link"
|
|
171
|
+
:aria-label="t('inputNumber.increment')"
|
|
172
|
+
v-bind="typeof increment === 'object' ? increment : undefined"
|
|
173
|
+
/>
|
|
174
|
+
</slot>
|
|
175
|
+
</NumberFieldIncrement>
|
|
176
|
+
</div>
|
|
177
|
+
|
|
178
|
+
<div :class="ui.decrement({ class: props.ui?.decrement })">
|
|
179
|
+
<NumberFieldDecrement as-child :disabled="disabled">
|
|
180
|
+
<slot name="decrement">
|
|
181
|
+
<UButton
|
|
182
|
+
:icon="decrementIcon"
|
|
183
|
+
:color="color"
|
|
184
|
+
:size="size"
|
|
185
|
+
variant="link"
|
|
186
|
+
:aria-label="t('inputNumber.decrement')"
|
|
187
|
+
v-bind="typeof decrement === 'object' ? decrement : undefined"
|
|
188
|
+
/>
|
|
189
|
+
</slot>
|
|
190
|
+
</NumberFieldDecrement>
|
|
191
|
+
</div>
|
|
192
|
+
</NumberFieldRoot>
|
|
193
|
+
</template>
|