@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,20 +1,21 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { tv } from 'tailwind-variants'
|
|
3
|
-
import type { PaginationRootProps, PaginationRootEmits } from '
|
|
3
|
+
import type { PaginationRootProps, PaginationRootEmits } from 'reka-ui'
|
|
4
4
|
import type { AppConfig } from '@nuxt/schema'
|
|
5
5
|
import type { RouteLocationRaw } from '#vue-router'
|
|
6
6
|
import _appConfig from '#build/app.config'
|
|
7
7
|
import theme from '#build/ui/pagination'
|
|
8
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
8
9
|
import type { ButtonProps } from '../types'
|
|
9
10
|
|
|
10
11
|
const appConfig = _appConfig as AppConfig & { ui: { pagination: Partial<typeof theme> } }
|
|
11
12
|
|
|
12
13
|
const pagination = tv({ extend: tv(theme), ...(appConfig.ui?.pagination || {}) })
|
|
13
14
|
|
|
14
|
-
export interface PaginationProps extends Pick<PaginationRootProps, 'defaultPage' | 'disabled' | 'itemsPerPage' | 'page' | 'showEdges' | 'siblingCount' | 'total'
|
|
15
|
+
export interface PaginationProps extends Partial<Pick<PaginationRootProps, 'defaultPage' | 'disabled' | 'itemsPerPage' | 'page' | 'showEdges' | 'siblingCount' | 'total'>> {
|
|
15
16
|
/**
|
|
16
17
|
* The element or component this component should render as.
|
|
17
|
-
* @defaultValue
|
|
18
|
+
* @defaultValue 'div'
|
|
18
19
|
*/
|
|
19
20
|
as?: any
|
|
20
21
|
/**
|
|
@@ -44,17 +45,17 @@ export interface PaginationProps extends Pick<PaginationRootProps, 'defaultPage'
|
|
|
44
45
|
ellipsisIcon?: string
|
|
45
46
|
/**
|
|
46
47
|
* The color of the pagination controls.
|
|
47
|
-
* @defaultValue '
|
|
48
|
+
* @defaultValue 'neutral'
|
|
48
49
|
*/
|
|
49
50
|
color?: ButtonProps['color']
|
|
50
51
|
/**
|
|
51
52
|
* The variant of the pagination controls.
|
|
52
|
-
* @defaultValue '
|
|
53
|
+
* @defaultValue 'outline'
|
|
53
54
|
*/
|
|
54
55
|
variant?: ButtonProps['variant']
|
|
55
56
|
/**
|
|
56
57
|
* The color of the active pagination control.
|
|
57
|
-
* @defaultValue '
|
|
58
|
+
* @defaultValue 'primary'
|
|
58
59
|
*/
|
|
59
60
|
activeColor?: ButtonProps['color']
|
|
60
61
|
/**
|
|
@@ -97,27 +98,42 @@ export interface PaginationSlots {
|
|
|
97
98
|
index: number
|
|
98
99
|
}): any
|
|
99
100
|
}
|
|
101
|
+
|
|
102
|
+
extendDevtoolsMeta({ defaultProps: { total: 50 } })
|
|
100
103
|
</script>
|
|
101
104
|
|
|
102
105
|
<script setup lang="ts">
|
|
103
|
-
import {
|
|
106
|
+
import { computed } from 'vue'
|
|
107
|
+
import { PaginationRoot, PaginationList, PaginationListItem, PaginationFirst, PaginationPrev, PaginationEllipsis, PaginationNext, PaginationLast, useForwardPropsEmits } from 'reka-ui'
|
|
104
108
|
import { reactivePick } from '@vueuse/core'
|
|
105
109
|
import { useAppConfig } from '#imports'
|
|
110
|
+
import { useLocale } from '../composables/useLocale'
|
|
111
|
+
import UButton from './Button.vue'
|
|
106
112
|
|
|
107
113
|
const props = withDefaults(defineProps<PaginationProps>(), {
|
|
108
|
-
|
|
109
|
-
|
|
114
|
+
size: 'md',
|
|
115
|
+
color: 'neutral',
|
|
110
116
|
variant: 'outline',
|
|
117
|
+
activeColor: 'primary',
|
|
111
118
|
activeVariant: 'solid',
|
|
112
|
-
showControls: true
|
|
119
|
+
showControls: true,
|
|
120
|
+
showEdges: false,
|
|
121
|
+
itemsPerPage: 10,
|
|
122
|
+
siblingCount: 2,
|
|
123
|
+
total: 0
|
|
113
124
|
})
|
|
114
125
|
const emits = defineEmits<PaginationEmits>()
|
|
115
126
|
const slots = defineSlots<PaginationSlots>()
|
|
116
127
|
|
|
117
128
|
const appConfig = useAppConfig()
|
|
118
|
-
|
|
129
|
+
const { dir } = useLocale()
|
|
119
130
|
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultPage', 'disabled', 'itemsPerPage', 'page', 'showEdges', 'siblingCount', 'total'), emits)
|
|
120
131
|
|
|
132
|
+
const firstIcon = computed(() => props.firstIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronDoubleRight : appConfig.ui.icons.chevronDoubleLeft))
|
|
133
|
+
const prevIcon = computed(() => props.prevIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronRight : appConfig.ui.icons.chevronLeft))
|
|
134
|
+
const nextIcon = computed(() => props.nextIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight))
|
|
135
|
+
const lastIcon = computed(() => props.lastIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronDoubleLeft : appConfig.ui.icons.chevronDoubleRight))
|
|
136
|
+
|
|
121
137
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
122
138
|
const ui = pagination()
|
|
123
139
|
</script>
|
|
@@ -127,12 +143,12 @@ const ui = pagination()
|
|
|
127
143
|
<PaginationList v-slot="{ items }" :class="ui.list({ class: props.ui?.list })">
|
|
128
144
|
<PaginationFirst v-if="showControls || !!slots.first" as-child>
|
|
129
145
|
<slot name="first">
|
|
130
|
-
<UButton :color="color" :variant="variant" :size="size" :icon="firstIcon
|
|
146
|
+
<UButton :color="color" :variant="variant" :size="size" :icon="firstIcon" :to="to?.(1)" />
|
|
131
147
|
</slot>
|
|
132
148
|
</PaginationFirst>
|
|
133
149
|
<PaginationPrev v-if="showControls || !!slots.prev" as-child>
|
|
134
150
|
<slot name="prev">
|
|
135
|
-
<UButton :color="color" :variant="variant" :size="size" :icon="prevIcon
|
|
151
|
+
<UButton :color="color" :variant="variant" :size="size" :icon="prevIcon" :to="page > 1 ? to?.(page - 1) : undefined" />
|
|
136
152
|
</slot>
|
|
137
153
|
</PaginationPrev>
|
|
138
154
|
|
|
@@ -160,12 +176,12 @@ const ui = pagination()
|
|
|
160
176
|
|
|
161
177
|
<PaginationNext v-if="showControls || !!slots.next" as-child>
|
|
162
178
|
<slot name="next">
|
|
163
|
-
<UButton :color="color" :variant="variant" :size="size" :icon="nextIcon
|
|
179
|
+
<UButton :color="color" :variant="variant" :size="size" :icon="nextIcon" :to="page < pageCount ? to?.(pageCount) : undefined" />
|
|
164
180
|
</slot>
|
|
165
181
|
</PaginationNext>
|
|
166
182
|
<PaginationLast v-if="showControls || !!slots.last" as-child>
|
|
167
183
|
<slot name="last">
|
|
168
|
-
<UButton :color="color" :variant="variant" :size="size" :icon="lastIcon
|
|
184
|
+
<UButton :color="color" :variant="variant" :size="size" :icon="lastIcon" :to=" to?.(pageCount)" />
|
|
169
185
|
</slot>
|
|
170
186
|
</PaginationLast>
|
|
171
187
|
</PaginationList>
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import _appConfig from '#build/app.config'
|
|
3
|
+
import theme from '#build/ui/pin-input'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import type { PinInputRootEmits, PinInputRootProps } from 'reka-ui'
|
|
6
|
+
import { tv, type VariantProps } from 'tailwind-variants'
|
|
7
|
+
import type { PartialString } from '../types/utils'
|
|
8
|
+
|
|
9
|
+
const appConfig = _appConfig as AppConfig & { ui: { pinInput: Partial<typeof theme> } }
|
|
10
|
+
|
|
11
|
+
const pinInput = tv({ extend: tv(theme), ...(appConfig.ui?.pinInput || {}) })
|
|
12
|
+
|
|
13
|
+
type PinInputVariants = VariantProps<typeof pinInput>
|
|
14
|
+
|
|
15
|
+
export interface PinInputProps extends Pick<PinInputRootProps, 'defaultValue' | 'disabled' | 'id' | 'mask' | 'modelValue' | 'name' | 'otp' | 'placeholder' | 'required' | 'type'> {
|
|
16
|
+
/**
|
|
17
|
+
* The element or component this component should render as.
|
|
18
|
+
* @defaultValue 'div'
|
|
19
|
+
*/
|
|
20
|
+
as?: any
|
|
21
|
+
color?: PinInputVariants['color']
|
|
22
|
+
variant?: PinInputVariants['variant']
|
|
23
|
+
size?: PinInputVariants['size']
|
|
24
|
+
length?: number | string
|
|
25
|
+
highlight?: boolean
|
|
26
|
+
class?: any
|
|
27
|
+
ui?: PartialString<typeof pinInput.slots>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type PinInputEmits = PinInputRootEmits & {
|
|
31
|
+
change: [payload: Event]
|
|
32
|
+
blur: [payload: Event]
|
|
33
|
+
}
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<script setup lang="ts">
|
|
37
|
+
import { ref, computed } from 'vue'
|
|
38
|
+
import { PinInputInput, PinInputRoot, useForwardPropsEmits } from 'reka-ui'
|
|
39
|
+
import { reactivePick } from '@vueuse/core'
|
|
40
|
+
import { useFormField } from '../composables/useFormField'
|
|
41
|
+
import { looseToNumber } from '../utils'
|
|
42
|
+
|
|
43
|
+
defineOptions({ inheritAttrs: false })
|
|
44
|
+
|
|
45
|
+
const props = withDefaults(defineProps<PinInputProps>(), {
|
|
46
|
+
type: 'text',
|
|
47
|
+
length: 5
|
|
48
|
+
})
|
|
49
|
+
const emits = defineEmits<PinInputEmits>()
|
|
50
|
+
|
|
51
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'defaultValue', 'disabled', 'id', 'mask', 'modelValue', 'name', 'otp', 'placeholder', 'required', 'type'), emits)
|
|
52
|
+
const { emitFormInput, emitFormChange, emitFormBlur, size, color, id, name, highlight, disabled } = useFormField<PinInputProps>(props)
|
|
53
|
+
|
|
54
|
+
const ui = computed(() => pinInput({
|
|
55
|
+
color: color.value,
|
|
56
|
+
variant: props.variant,
|
|
57
|
+
size: size.value,
|
|
58
|
+
highlight: highlight.value
|
|
59
|
+
}))
|
|
60
|
+
|
|
61
|
+
const completed = ref(false)
|
|
62
|
+
function onComplete(value: string[]) {
|
|
63
|
+
// @ts-expect-error - 'target' does not exist in type 'EventInit'
|
|
64
|
+
const event = new Event('change', { target: { value } })
|
|
65
|
+
emits('change', event)
|
|
66
|
+
emitFormChange()
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function onBlur(event: FocusEvent) {
|
|
70
|
+
if (!event.relatedTarget || completed.value) {
|
|
71
|
+
emits('blur', event)
|
|
72
|
+
emitFormBlur()
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<template>
|
|
78
|
+
<PinInputRoot
|
|
79
|
+
v-bind="rootProps"
|
|
80
|
+
:id="id"
|
|
81
|
+
:name="name"
|
|
82
|
+
:class="ui.root({ class: [props.class, props.ui?.root] })"
|
|
83
|
+
@update:model-value="emitFormInput()"
|
|
84
|
+
@complete="onComplete"
|
|
85
|
+
>
|
|
86
|
+
<PinInputInput
|
|
87
|
+
v-for="(ids, index) in looseToNumber(props.length)"
|
|
88
|
+
:key="ids"
|
|
89
|
+
:index="index"
|
|
90
|
+
:class="ui.base({ class: props.ui?.base })"
|
|
91
|
+
v-bind="$attrs"
|
|
92
|
+
:disabled="disabled"
|
|
93
|
+
@blur="onBlur"
|
|
94
|
+
/>
|
|
95
|
+
</PinInputRoot>
|
|
96
|
+
</template>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { tv } from 'tailwind-variants'
|
|
3
|
-
import type { PopoverRootProps, HoverCardRootProps, PopoverRootEmits, PopoverContentProps, PopoverArrowProps } from '
|
|
3
|
+
import type { PopoverRootProps, HoverCardRootProps, PopoverRootEmits, PopoverContentProps, PopoverArrowProps } from 'reka-ui'
|
|
4
4
|
import type { AppConfig } from '@nuxt/schema'
|
|
5
5
|
import _appConfig from '#build/app.config'
|
|
6
6
|
import theme from '#build/ui/popover'
|
|
7
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
7
8
|
|
|
8
9
|
const appConfig = _appConfig as AppConfig & { ui: { popover: Partial<typeof theme> } }
|
|
9
10
|
|
|
@@ -17,7 +18,7 @@ export interface PopoverProps extends PopoverRootProps, Pick<HoverCardRootProps,
|
|
|
17
18
|
mode?: 'click' | 'hover'
|
|
18
19
|
/**
|
|
19
20
|
* The content of the popover.
|
|
20
|
-
* @defaultValue { side: 'bottom', sideOffset: 8 }
|
|
21
|
+
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8 }
|
|
21
22
|
*/
|
|
22
23
|
content?: Omit<PopoverContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
23
24
|
/**
|
|
@@ -30,6 +31,11 @@ export interface PopoverProps extends PopoverRootProps, Pick<HoverCardRootProps,
|
|
|
30
31
|
* @defaultValue true
|
|
31
32
|
*/
|
|
32
33
|
portal?: boolean
|
|
34
|
+
/**
|
|
35
|
+
* When `true`, the popover will not close when clicking outside.
|
|
36
|
+
* @defaultValue false
|
|
37
|
+
*/
|
|
38
|
+
preventClose?: boolean
|
|
33
39
|
class?: any
|
|
34
40
|
ui?: Partial<typeof popover.slots>
|
|
35
41
|
}
|
|
@@ -40,13 +46,15 @@ export interface PopoverSlots {
|
|
|
40
46
|
default(props: { open: boolean }): any
|
|
41
47
|
content(props?: {}): any
|
|
42
48
|
}
|
|
49
|
+
|
|
50
|
+
extendDevtoolsMeta({ example: 'PopoverExample' })
|
|
43
51
|
</script>
|
|
44
52
|
|
|
45
53
|
<script setup lang="ts">
|
|
46
54
|
import { computed, toRef } from 'vue'
|
|
47
55
|
import { defu } from 'defu'
|
|
48
|
-
import { useForwardPropsEmits } from '
|
|
49
|
-
import { Popover, HoverCard } from '
|
|
56
|
+
import { useForwardPropsEmits } from 'reka-ui'
|
|
57
|
+
import { Popover, HoverCard } from 'reka-ui/namespaced'
|
|
50
58
|
import { reactivePick } from '@vueuse/core'
|
|
51
59
|
|
|
52
60
|
const props = withDefaults(defineProps<PopoverProps>(), {
|
|
@@ -60,7 +68,18 @@ const slots = defineSlots<PopoverSlots>()
|
|
|
60
68
|
|
|
61
69
|
const pick = props.mode === 'hover' ? reactivePick(props, 'defaultOpen', 'open', 'openDelay', 'closeDelay') : reactivePick(props, 'defaultOpen', 'open', 'modal')
|
|
62
70
|
const rootProps = useForwardPropsEmits(pick, emits)
|
|
63
|
-
const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffset: 8 }) as PopoverContentProps)
|
|
71
|
+
const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffset: 8, collisionPadding: 8 }) as PopoverContentProps)
|
|
72
|
+
const contentEvents = computed(() => {
|
|
73
|
+
if (props.preventClose) {
|
|
74
|
+
return {
|
|
75
|
+
pointerDownOutside: (e: Event) => e.preventDefault(),
|
|
76
|
+
interactOutside: (e: Event) => e.preventDefault(),
|
|
77
|
+
escapeKeyDown: (e: Event) => e.preventDefault()
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return {}
|
|
82
|
+
})
|
|
64
83
|
const arrowProps = toRef(() => props.arrow as PopoverArrowProps)
|
|
65
84
|
|
|
66
85
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
@@ -73,12 +92,12 @@ const Component = computed(() => props.mode === 'hover' ? HoverCard : Popover)
|
|
|
73
92
|
|
|
74
93
|
<template>
|
|
75
94
|
<Component.Root v-slot="{ open }" v-bind="rootProps">
|
|
76
|
-
<Component.Trigger v-if="!!slots.default" as-child>
|
|
95
|
+
<Component.Trigger v-if="!!slots.default" as-child :class="props.class">
|
|
77
96
|
<slot :open="open" />
|
|
78
97
|
</Component.Trigger>
|
|
79
98
|
|
|
80
99
|
<Component.Portal :disabled="!portal">
|
|
81
|
-
<Component.Content v-bind="contentProps" :class="ui.content({ class: [props.class, props.ui?.content] })">
|
|
100
|
+
<Component.Content v-bind="contentProps" :class="ui.content({ class: [!slots.default && props.class, props.ui?.content] })" v-on="contentEvents">
|
|
82
101
|
<slot name="content" />
|
|
83
102
|
|
|
84
103
|
<Component.Arrow v-if="!!arrow" v-bind="arrowProps" :class="ui.arrow({ class: props.ui?.arrow })" />
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
<!-- eslint-disable vue/block-tag-newline -->
|
|
1
2
|
<script lang="ts">
|
|
2
3
|
import { tv, type VariantProps } from 'tailwind-variants'
|
|
3
|
-
import type { ProgressRootProps, ProgressRootEmits } from '
|
|
4
|
+
import type { ProgressRootProps, ProgressRootEmits } from 'reka-ui'
|
|
4
5
|
import type { AppConfig } from '@nuxt/schema'
|
|
5
6
|
import _appConfig from '#build/app.config'
|
|
6
7
|
import theme from '#build/ui/progress'
|
|
@@ -14,7 +15,7 @@ type ProgressVariants = VariantProps<typeof progress>
|
|
|
14
15
|
export interface ProgressProps extends Pick<ProgressRootProps, 'getValueLabel' | 'modelValue'> {
|
|
15
16
|
/**
|
|
16
17
|
* The element or component this component should render as.
|
|
17
|
-
* @defaultValue
|
|
18
|
+
* @defaultValue 'div'
|
|
18
19
|
*/
|
|
19
20
|
as?: any
|
|
20
21
|
/** The maximum progress value. */
|
|
@@ -42,12 +43,14 @@ export type ProgressSlots = {
|
|
|
42
43
|
} & {
|
|
43
44
|
[key: string]: (props: { step: number }) => any
|
|
44
45
|
}
|
|
46
|
+
|
|
45
47
|
</script>
|
|
46
48
|
|
|
47
49
|
<script setup lang="ts">
|
|
48
50
|
import { computed } from 'vue'
|
|
49
|
-
import {
|
|
51
|
+
import { Primitive, ProgressRoot, ProgressIndicator, useForwardPropsEmits } from 'reka-ui'
|
|
50
52
|
import { reactivePick } from '@vueuse/core'
|
|
53
|
+
import { useLocale } from '../composables/useLocale'
|
|
51
54
|
|
|
52
55
|
const props = withDefaults(defineProps<ProgressProps>(), {
|
|
53
56
|
inverted: false,
|
|
@@ -57,7 +60,9 @@ const props = withDefaults(defineProps<ProgressProps>(), {
|
|
|
57
60
|
const emits = defineEmits<ProgressEmits>()
|
|
58
61
|
defineSlots<ProgressSlots>()
|
|
59
62
|
|
|
60
|
-
const
|
|
63
|
+
const { dir } = useLocale()
|
|
64
|
+
|
|
65
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'getValueLabel', 'modelValue'), emits)
|
|
61
66
|
|
|
62
67
|
const isIndeterminate = computed(() => rootProps.value.modelValue === null)
|
|
63
68
|
const hasSteps = computed(() => Array.isArray(props.max))
|
|
@@ -91,8 +96,20 @@ const indicatorStyle = computed(() => {
|
|
|
91
96
|
return
|
|
92
97
|
}
|
|
93
98
|
|
|
94
|
-
|
|
95
|
-
|
|
99
|
+
if (props.orientation === 'vertical') {
|
|
100
|
+
return {
|
|
101
|
+
transform: `translateY(${props.inverted ? '' : '-'}${100 - percent.value}%)`
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
if (dir.value === 'rtl') {
|
|
105
|
+
return {
|
|
106
|
+
transform: `translateX(${props.inverted ? '-' : ''}${100 - percent.value}%)`
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
return {
|
|
110
|
+
transform: `translateX(${props.inverted ? '' : '-'}${100 - percent.value}%)`
|
|
111
|
+
}
|
|
112
|
+
}
|
|
96
113
|
}
|
|
97
114
|
})
|
|
98
115
|
|
|
@@ -142,7 +159,7 @@ const ui = computed(() => progress({
|
|
|
142
159
|
</script>
|
|
143
160
|
|
|
144
161
|
<template>
|
|
145
|
-
<
|
|
162
|
+
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
146
163
|
<div v-if="!isIndeterminate && (status || $slots.status)" :class="ui.status({ class: props.ui?.status })" :style="statusStyle">
|
|
147
164
|
<slot name="status" :percent="percent">
|
|
148
165
|
{{ percent }}%
|
|
@@ -160,5 +177,5 @@ const ui = computed(() => progress({
|
|
|
160
177
|
</slot>
|
|
161
178
|
</div>
|
|
162
179
|
</div>
|
|
163
|
-
</
|
|
180
|
+
</Primitive>
|
|
164
181
|
</template>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { tv, type VariantProps } from 'tailwind-variants'
|
|
3
|
-
import type { RadioGroupRootProps, RadioGroupRootEmits,
|
|
3
|
+
import type { RadioGroupRootProps, RadioGroupRootEmits, AcceptableValue } from 'reka-ui'
|
|
4
4
|
import type { AppConfig } from '@nuxt/schema'
|
|
5
5
|
import _appConfig from '#build/app.config'
|
|
6
6
|
import theme from '#build/ui/radio-group'
|
|
7
|
-
import
|
|
7
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
8
8
|
|
|
9
9
|
const appConfig = _appConfig as AppConfig & { ui: { radioGroup: Partial<typeof theme> } }
|
|
10
10
|
|
|
@@ -12,15 +12,17 @@ const radioGroup = tv({ extend: tv(theme), ...(appConfig.ui?.radioGroup || {}) }
|
|
|
12
12
|
|
|
13
13
|
type RadioGroupVariants = VariantProps<typeof radioGroup>
|
|
14
14
|
|
|
15
|
-
export interface RadioGroupItem
|
|
15
|
+
export interface RadioGroupItem {
|
|
16
16
|
label?: string
|
|
17
17
|
description?: string
|
|
18
|
+
disabled?: boolean
|
|
19
|
+
value?: string
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
export interface RadioGroupProps<T> extends Pick<RadioGroupRootProps, 'defaultValue' | 'disabled' | 'loop' | 'modelValue' | 'name' | 'required'> {
|
|
21
23
|
/**
|
|
22
24
|
* The element or component this component should render as.
|
|
23
|
-
* @defaultValue
|
|
25
|
+
* @defaultValue 'div'
|
|
24
26
|
*/
|
|
25
27
|
as?: any
|
|
26
28
|
legend?: string
|
|
@@ -29,6 +31,16 @@ export interface RadioGroupProps<T> extends Pick<RadioGroupRootProps, 'defaultVa
|
|
|
29
31
|
* @defaultValue 'value'
|
|
30
32
|
*/
|
|
31
33
|
valueKey?: string
|
|
34
|
+
/**
|
|
35
|
+
* When `items` is an array of objects, select the field to use as the label.
|
|
36
|
+
* @defaultValue 'label'
|
|
37
|
+
*/
|
|
38
|
+
labelKey?: string
|
|
39
|
+
/**
|
|
40
|
+
* When `items` is an array of objects, select the field to use as the description.
|
|
41
|
+
* @defaultValue 'description'
|
|
42
|
+
*/
|
|
43
|
+
descriptionKey?: string
|
|
32
44
|
items?: T[]
|
|
33
45
|
size?: RadioGroupVariants['size']
|
|
34
46
|
color?: RadioGroupVariants['color']
|
|
@@ -45,23 +57,28 @@ export type RadioGroupEmits = RadioGroupRootEmits & {
|
|
|
45
57
|
change: [payload: Event]
|
|
46
58
|
}
|
|
47
59
|
|
|
48
|
-
type SlotProps<T> = (props: { item: T, modelValue?:
|
|
60
|
+
type SlotProps<T> = (props: { item: T, modelValue?: AcceptableValue }) => any
|
|
49
61
|
|
|
50
62
|
export interface RadioGroupSlots<T> {
|
|
51
63
|
legend(props?: {}): any
|
|
52
64
|
label: SlotProps<T>
|
|
53
65
|
description: SlotProps<T>
|
|
54
66
|
}
|
|
67
|
+
|
|
68
|
+
extendDevtoolsMeta({ defaultProps: { items: ['Option 1', 'Option 2', 'Option 3'] } })
|
|
55
69
|
</script>
|
|
56
70
|
|
|
57
71
|
<script setup lang="ts" generic="T extends RadioGroupItem | AcceptableValue">
|
|
58
72
|
import { computed, useId } from 'vue'
|
|
59
|
-
import { RadioGroupRoot, RadioGroupItem, RadioGroupIndicator, Label, useForwardPropsEmits } from '
|
|
73
|
+
import { RadioGroupRoot, RadioGroupItem, RadioGroupIndicator, Label, useForwardPropsEmits } from 'reka-ui'
|
|
60
74
|
import { reactivePick } from '@vueuse/core'
|
|
61
75
|
import { useFormField } from '../composables/useFormField'
|
|
76
|
+
import { get } from '../utils'
|
|
62
77
|
|
|
63
78
|
const props = withDefaults(defineProps<RadioGroupProps<T>>(), {
|
|
64
79
|
valueKey: 'value',
|
|
80
|
+
labelKey: 'label',
|
|
81
|
+
descriptionKey: 'description',
|
|
65
82
|
orientation: 'vertical'
|
|
66
83
|
})
|
|
67
84
|
const emits = defineEmits<RadioGroupEmits>()
|
|
@@ -89,11 +106,15 @@ function normalizeItem(item: any) {
|
|
|
89
106
|
}
|
|
90
107
|
}
|
|
91
108
|
|
|
92
|
-
const value = item
|
|
109
|
+
const value = get(item, props.valueKey as string)
|
|
110
|
+
const label = get(item, props.labelKey as string)
|
|
111
|
+
const description = get(item, props.descriptionKey as string)
|
|
93
112
|
|
|
94
113
|
return {
|
|
95
114
|
...item,
|
|
96
115
|
value,
|
|
116
|
+
label,
|
|
117
|
+
description,
|
|
97
118
|
id: `${id}:${value}`
|
|
98
119
|
}
|
|
99
120
|
}
|