@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,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import type { SliderRootProps } from '
|
|
2
|
+
import type { VariantProps } from 'tailwind-variants'
|
|
3
|
+
import type { SliderRootProps } 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/slider'
|
|
7
|
+
import { tv } from '../utils/tv'
|
|
7
8
|
|
|
8
9
|
const appConfig = _appConfig as AppConfig & { ui: { slider: Partial<typeof theme> } }
|
|
9
10
|
|
|
@@ -14,7 +15,7 @@ type SliderVariants = VariantProps<typeof slider>
|
|
|
14
15
|
export interface SliderProps extends Pick<SliderRootProps, 'name' | 'disabled' | 'inverted' | 'min' | 'max' | 'step' | 'minStepsBetweenThumbs'> {
|
|
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
|
size?: SliderVariants['size']
|
|
@@ -38,7 +39,7 @@ export interface SliderEmits {
|
|
|
38
39
|
|
|
39
40
|
<script setup lang="ts">
|
|
40
41
|
import { computed } from 'vue'
|
|
41
|
-
import { SliderRoot, SliderRange, SliderTrack, SliderThumb, useForwardPropsEmits } from '
|
|
42
|
+
import { SliderRoot, SliderRange, SliderTrack, SliderThumb, useForwardPropsEmits } from 'reka-ui'
|
|
42
43
|
import { reactivePick } from '@vueuse/core'
|
|
43
44
|
import { useFormField } from '../composables/useFormField'
|
|
44
45
|
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { VariantProps } from 'tailwind-variants'
|
|
3
|
+
import type { StepperRootProps, StepperRootEmits } from 'reka-ui'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/ui/stepper'
|
|
7
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
8
|
+
import { tv } from '../utils/tv'
|
|
9
|
+
import type { DynamicSlots } from '../types/utils'
|
|
10
|
+
|
|
11
|
+
const appConfig = _appConfig as AppConfig & { ui: { stepper: Partial<typeof theme> } }
|
|
12
|
+
|
|
13
|
+
const stepper = tv({ extend: tv(theme), ...(appConfig.ui?.stepper || {}) })
|
|
14
|
+
|
|
15
|
+
type StepperVariants = VariantProps<typeof stepper>
|
|
16
|
+
|
|
17
|
+
export interface StepperItem {
|
|
18
|
+
slot?: string
|
|
19
|
+
value?: string | number
|
|
20
|
+
title?: string
|
|
21
|
+
description?: string
|
|
22
|
+
icon?: string
|
|
23
|
+
content?: string
|
|
24
|
+
disabled?: boolean
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface StepperProps<T extends StepperItem> extends Pick<StepperRootProps, 'linear'> {
|
|
28
|
+
/**
|
|
29
|
+
* The element or component this component should render as.
|
|
30
|
+
* @defaultValue 'div'
|
|
31
|
+
*/
|
|
32
|
+
as?: any
|
|
33
|
+
items: T[]
|
|
34
|
+
size?: StepperVariants['size']
|
|
35
|
+
color?: StepperVariants['color']
|
|
36
|
+
orientation?: StepperVariants['orientation']
|
|
37
|
+
/**
|
|
38
|
+
* The value of the step that should be active when initially rendered. Use when you do not need to control the state of the steps.
|
|
39
|
+
*/
|
|
40
|
+
defaultValue?: string | number
|
|
41
|
+
disabled?: boolean
|
|
42
|
+
ui?: Partial<typeof stepper.slots>
|
|
43
|
+
class?: any
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type StepperEmits<T> = Omit<StepperRootEmits, 'update:modelValue'> & {
|
|
47
|
+
next: [payload: T]
|
|
48
|
+
prev: [payload: T]
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type SlotProps<T extends StepperItem> = (props: { item: T }) => any
|
|
52
|
+
|
|
53
|
+
export type StepperSlots<T extends StepperItem> = {
|
|
54
|
+
indicator: SlotProps<T>
|
|
55
|
+
title: SlotProps<T>
|
|
56
|
+
description: SlotProps<T>
|
|
57
|
+
content: SlotProps<T>
|
|
58
|
+
} & DynamicSlots<T, SlotProps<T>>
|
|
59
|
+
|
|
60
|
+
extendDevtoolsMeta({ example: 'StepperExample' })
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<script setup lang="ts" generic="T extends StepperItem">
|
|
64
|
+
import { computed } from 'vue'
|
|
65
|
+
import { StepperRoot, StepperItem, StepperTrigger, StepperIndicator, StepperSeparator, StepperTitle, StepperDescription, useForwardProps } from 'reka-ui'
|
|
66
|
+
import { reactivePick } from '@vueuse/core'
|
|
67
|
+
import UIcon from './Icon.vue'
|
|
68
|
+
|
|
69
|
+
const props = withDefaults(defineProps<StepperProps<T>>(), {
|
|
70
|
+
orientation: 'horizontal',
|
|
71
|
+
linear: true
|
|
72
|
+
})
|
|
73
|
+
const emits = defineEmits<StepperEmits<T>>()
|
|
74
|
+
const slots = defineSlots<StepperSlots<T>>()
|
|
75
|
+
|
|
76
|
+
const modelValue = defineModel<string | number>()
|
|
77
|
+
|
|
78
|
+
const rootProps = useForwardProps(reactivePick(props, 'as', 'orientation', 'linear'))
|
|
79
|
+
|
|
80
|
+
const ui = computed(() => stepper({
|
|
81
|
+
orientation: props.orientation,
|
|
82
|
+
size: props.size,
|
|
83
|
+
color: props.color
|
|
84
|
+
}))
|
|
85
|
+
|
|
86
|
+
const currentStepIndex = computed({
|
|
87
|
+
get() {
|
|
88
|
+
const value = modelValue.value ?? props.defaultValue
|
|
89
|
+
|
|
90
|
+
return ((typeof value === 'string')
|
|
91
|
+
? props.items.findIndex(item => item.value === value)
|
|
92
|
+
: value) ?? 0
|
|
93
|
+
},
|
|
94
|
+
set(value: number) {
|
|
95
|
+
modelValue.value = props.items?.[value]?.value ?? value
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
const currentStep = computed(() => props.items?.[currentStepIndex.value] as T)
|
|
100
|
+
const hasNext = computed(() => currentStepIndex.value < props.items?.length - 1)
|
|
101
|
+
const hasPrev = computed(() => currentStepIndex.value > 0)
|
|
102
|
+
|
|
103
|
+
defineExpose({
|
|
104
|
+
next() {
|
|
105
|
+
if (hasNext.value) {
|
|
106
|
+
currentStepIndex.value += 1
|
|
107
|
+
emits('next', currentStep.value)
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
prev() {
|
|
111
|
+
if (hasPrev.value) {
|
|
112
|
+
currentStepIndex.value -= 1
|
|
113
|
+
emits('prev', currentStep.value)
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
hasNext,
|
|
117
|
+
hasPrev
|
|
118
|
+
})
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<template>
|
|
122
|
+
<StepperRoot v-bind="rootProps" v-model="currentStepIndex" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
123
|
+
<div :class="ui.header({ class: props.ui?.header })">
|
|
124
|
+
<StepperItem
|
|
125
|
+
v-for="(item, count) in items"
|
|
126
|
+
:key="item.value ?? count"
|
|
127
|
+
:step="count"
|
|
128
|
+
:disabled="item.disabled || props.disabled"
|
|
129
|
+
:class="ui.item({ class: props.ui?.item })"
|
|
130
|
+
>
|
|
131
|
+
<div :class="ui.container({ class: props.ui?.container })">
|
|
132
|
+
<StepperTrigger :class="ui.trigger({ class: props.ui?.trigger })">
|
|
133
|
+
<StepperIndicator :class="ui.indicator({ class: props.ui?.indicator })">
|
|
134
|
+
<slot name="indicator" :item="item">
|
|
135
|
+
<UIcon v-if="item.icon" :name="item.icon" :class="ui.icon({ class: props.ui?.indicator })" />
|
|
136
|
+
<template v-else>
|
|
137
|
+
{{ count + 1 }}
|
|
138
|
+
</template>
|
|
139
|
+
</slot>
|
|
140
|
+
</StepperIndicator>
|
|
141
|
+
</StepperTrigger>
|
|
142
|
+
|
|
143
|
+
<StepperSeparator
|
|
144
|
+
v-if="count < items.length - 1"
|
|
145
|
+
:class="ui.separator({ class: props.ui?.separator })"
|
|
146
|
+
/>
|
|
147
|
+
</div>
|
|
148
|
+
|
|
149
|
+
<div :class="ui.wrapper({ class: props.ui?.wrapper })">
|
|
150
|
+
<StepperTitle :class="ui.title({ class: props.ui?.title })">
|
|
151
|
+
<slot name="title" :item="item">
|
|
152
|
+
{{ item.title }}
|
|
153
|
+
</slot>
|
|
154
|
+
</StepperTitle>
|
|
155
|
+
<StepperDescription :class="ui.description({ class: props.ui?.description })">
|
|
156
|
+
<slot name="description" :item="item">
|
|
157
|
+
{{ item.description }}
|
|
158
|
+
</slot>
|
|
159
|
+
</StepperDescription>
|
|
160
|
+
</div>
|
|
161
|
+
</StepperItem>
|
|
162
|
+
</div>
|
|
163
|
+
|
|
164
|
+
<div v-if="currentStep?.content || !!slots.content || (currentStep?.slot && !!slots[currentStep.slot]) || (currentStep?.value && !!slots[currentStep.value])" :class="ui.content({ class: props.ui?.description })">
|
|
165
|
+
<slot
|
|
166
|
+
:name="!!slots[currentStep?.slot ?? currentStep.value] ? currentStep.slot ?? currentStep.value : 'content'"
|
|
167
|
+
:item="currentStep"
|
|
168
|
+
>
|
|
169
|
+
{{ currentStep?.content }}
|
|
170
|
+
</slot>
|
|
171
|
+
</div>
|
|
172
|
+
</StepperRoot>
|
|
173
|
+
</template>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import type { SwitchRootProps } from '
|
|
2
|
+
import type { VariantProps } from 'tailwind-variants'
|
|
3
|
+
import type { SwitchRootProps } 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/switch'
|
|
7
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
8
|
+
import { tv } from '../utils/tv'
|
|
7
9
|
import type { PartialString } from '../types/utils'
|
|
8
10
|
|
|
9
11
|
const appConfig = _appConfig as AppConfig & { ui: { switch: Partial<typeof theme> } }
|
|
@@ -12,10 +14,10 @@ const switchTv = tv({ extend: tv(theme), ...(appConfig.ui?.switch || {}) })
|
|
|
12
14
|
|
|
13
15
|
type SwitchVariants = VariantProps<typeof switchTv>
|
|
14
16
|
|
|
15
|
-
export interface SwitchProps extends Pick<SwitchRootProps, 'disabled' | 'id' | 'name' | 'required' | 'value'> {
|
|
17
|
+
export interface SwitchProps extends Pick<SwitchRootProps, 'disabled' | 'id' | 'name' | 'required' | 'value' | 'defaultValue'> {
|
|
16
18
|
/**
|
|
17
19
|
* The element or component this component should render as.
|
|
18
|
-
* @defaultValue
|
|
20
|
+
* @defaultValue 'div'
|
|
19
21
|
*/
|
|
20
22
|
as?: any
|
|
21
23
|
color?: SwitchVariants['color']
|
|
@@ -33,38 +35,38 @@ export interface SwitchProps extends Pick<SwitchRootProps, 'disabled' | 'id' | '
|
|
|
33
35
|
uncheckedIcon?: string
|
|
34
36
|
label?: string
|
|
35
37
|
description?: string
|
|
36
|
-
/** The state of the switch when it is initially rendered. Use when you do not need to control its state. */
|
|
37
|
-
defaultValue?: boolean
|
|
38
38
|
class?: any
|
|
39
39
|
ui?: PartialString<typeof switchTv.slots>
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export
|
|
43
|
-
|
|
44
|
-
(e: 'change', payload: Event): void
|
|
42
|
+
export type SwitchEmits = {
|
|
43
|
+
change: [payload: Event]
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
export interface SwitchSlots {
|
|
48
47
|
label(props: { label?: string }): any
|
|
49
48
|
description(props: { description?: string }): any
|
|
50
49
|
}
|
|
50
|
+
|
|
51
|
+
extendDevtoolsMeta({ defaultProps: { label: 'Switch me!' } })
|
|
51
52
|
</script>
|
|
52
53
|
|
|
53
54
|
<script setup lang="ts">
|
|
54
55
|
import { computed, useId } from 'vue'
|
|
55
|
-
import { SwitchRoot, SwitchThumb, useForwardProps, Label } from '
|
|
56
|
+
import { Primitive, SwitchRoot, SwitchThumb, useForwardProps, Label } from 'reka-ui'
|
|
56
57
|
import { reactivePick } from '@vueuse/core'
|
|
57
58
|
import { useAppConfig } from '#imports'
|
|
58
59
|
import { useFormField } from '../composables/useFormField'
|
|
60
|
+
import UIcon from './Icon.vue'
|
|
59
61
|
|
|
60
62
|
const props = defineProps<SwitchProps>()
|
|
61
63
|
const slots = defineSlots<SwitchSlots>()
|
|
62
64
|
const emits = defineEmits<SwitchEmits>()
|
|
63
65
|
|
|
64
|
-
const modelValue = defineModel<boolean
|
|
66
|
+
const modelValue = defineModel<boolean>({ default: undefined })
|
|
65
67
|
|
|
66
68
|
const appConfig = useAppConfig()
|
|
67
|
-
const rootProps = useForwardProps(reactivePick(props, '
|
|
69
|
+
const rootProps = useForwardProps(reactivePick(props, 'required', 'value', 'defaultValue'))
|
|
68
70
|
|
|
69
71
|
const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled } = useFormField<SwitchProps>(props)
|
|
70
72
|
const id = _id.value ?? useId()
|
|
@@ -87,17 +89,16 @@ function onUpdate(value: any) {
|
|
|
87
89
|
</script>
|
|
88
90
|
|
|
89
91
|
<template>
|
|
90
|
-
<
|
|
92
|
+
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
91
93
|
<div :class="ui.container({ class: props.ui?.container })">
|
|
92
94
|
<SwitchRoot
|
|
93
95
|
:id="id"
|
|
94
|
-
v-model:checked="modelValue"
|
|
95
|
-
:default-checked="defaultValue"
|
|
96
96
|
v-bind="rootProps"
|
|
97
|
+
v-model="modelValue"
|
|
97
98
|
:name="name"
|
|
98
99
|
:disabled="disabled || loading"
|
|
99
100
|
:class="ui.base({ class: props.ui?.base })"
|
|
100
|
-
@update:
|
|
101
|
+
@update:model-value="onUpdate"
|
|
101
102
|
>
|
|
102
103
|
<SwitchThumb :class="ui.thumb({ class: props.ui?.thumb })">
|
|
103
104
|
<UIcon v-if="loading" :name="loadingIcon || appConfig.ui.icons.loading" :class="ui.icon({ class: props.ui?.icon, checked: true, unchecked: true })" />
|
|
@@ -120,5 +121,5 @@ function onUpdate(value: any) {
|
|
|
120
121
|
</slot>
|
|
121
122
|
</p>
|
|
122
123
|
</div>
|
|
123
|
-
</
|
|
124
|
+
</Primitive>
|
|
124
125
|
</template>
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
<!-- eslint-disable vue/block-tag-newline -->
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
import type { Ref } from 'vue'
|
|
4
|
+
import type { VariantProps } from 'tailwind-variants'
|
|
5
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
6
|
+
import type { RowData } from '@tanstack/table-core'
|
|
7
|
+
import type {
|
|
8
|
+
Row,
|
|
9
|
+
ColumnDef,
|
|
10
|
+
ColumnFiltersState,
|
|
11
|
+
ColumnPinningState,
|
|
12
|
+
RowSelectionState,
|
|
13
|
+
SortingState,
|
|
14
|
+
ExpandedState,
|
|
15
|
+
VisibilityState,
|
|
16
|
+
GlobalFilterOptions,
|
|
17
|
+
ColumnFiltersOptions,
|
|
18
|
+
ColumnPinningOptions,
|
|
19
|
+
VisibilityOptions,
|
|
20
|
+
ExpandedOptions,
|
|
21
|
+
SortingOptions,
|
|
22
|
+
RowSelectionOptions,
|
|
23
|
+
Updater,
|
|
24
|
+
CellContext,
|
|
25
|
+
HeaderContext
|
|
26
|
+
} from '@tanstack/vue-table'
|
|
27
|
+
import _appConfig from '#build/app.config'
|
|
28
|
+
import theme from '#build/ui/table'
|
|
29
|
+
import { tv } from '../utils/tv'
|
|
30
|
+
|
|
31
|
+
declare module '@tanstack/table-core' {
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
33
|
+
interface ColumnMeta<TData extends RowData, TValue> {
|
|
34
|
+
class?: {
|
|
35
|
+
th?: string
|
|
36
|
+
td?: string
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const appConfig = _appConfig as AppConfig & { ui: { table: Partial<typeof theme> } }
|
|
42
|
+
|
|
43
|
+
const table = tv({ extend: tv(theme), ...(appConfig.ui?.table || {}) })
|
|
44
|
+
|
|
45
|
+
type TableVariants = VariantProps<typeof table>
|
|
46
|
+
|
|
47
|
+
export type TableColumn<T> = ColumnDef<T>
|
|
48
|
+
|
|
49
|
+
export interface TableData {
|
|
50
|
+
[key: string]: any
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface TableProps<T> {
|
|
54
|
+
/**
|
|
55
|
+
* The element or component this component should render as.
|
|
56
|
+
* @defaultValue 'div'
|
|
57
|
+
*/
|
|
58
|
+
as?: any
|
|
59
|
+
data?: T[]
|
|
60
|
+
columns?: TableColumn<T>[]
|
|
61
|
+
caption?: string
|
|
62
|
+
/**
|
|
63
|
+
* Whether the table should have a sticky header.
|
|
64
|
+
* @defaultValue false
|
|
65
|
+
*/
|
|
66
|
+
sticky?: boolean
|
|
67
|
+
/** Whether the table should be in loading state. */
|
|
68
|
+
loading?: boolean
|
|
69
|
+
loadingColor?: TableVariants['loadingColor']
|
|
70
|
+
loadingAnimation?: TableVariants['loadingAnimation']
|
|
71
|
+
/**
|
|
72
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#table-options)
|
|
73
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)
|
|
74
|
+
*/
|
|
75
|
+
globalFilterOptions?: Omit<GlobalFilterOptions<T>, 'onGlobalFilterChange'>
|
|
76
|
+
/**
|
|
77
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#table-options)
|
|
78
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
79
|
+
*/
|
|
80
|
+
columnFiltersOptions?: Omit<ColumnFiltersOptions<T>, 'getFilteredRowModel' | 'onColumnFiltersChange'>
|
|
81
|
+
/**
|
|
82
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#table-options)
|
|
83
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)
|
|
84
|
+
*/
|
|
85
|
+
columnPinningOptions?: Omit<ColumnPinningOptions, 'onColumnPinningChange'>
|
|
86
|
+
/**
|
|
87
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#table-options)
|
|
88
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
|
|
89
|
+
*/
|
|
90
|
+
visibilityOptions?: Omit<VisibilityOptions, 'onColumnVisibilityChange'>
|
|
91
|
+
/**
|
|
92
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#table-options)
|
|
93
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
|
|
94
|
+
*/
|
|
95
|
+
sortingOptions?: Omit<SortingOptions<T>, 'getSortedRowModel' | 'onSortingChange'>
|
|
96
|
+
/**
|
|
97
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#table-options)
|
|
98
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)
|
|
99
|
+
*/
|
|
100
|
+
expandedOptions?: Omit<ExpandedOptions<T>, 'getExpandedRowModel' | 'onExpandedChange'>
|
|
101
|
+
/**
|
|
102
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#table-options)
|
|
103
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)
|
|
104
|
+
*/
|
|
105
|
+
rowSelectionOptions?: Omit<RowSelectionOptions<T>, 'onRowSelectionChange'>
|
|
106
|
+
class?: any
|
|
107
|
+
ui?: Partial<typeof table.slots>
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
type DynamicHeaderSlots<T, K = keyof T> = Record<string, (props: HeaderContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-header`, (props: HeaderContext<T, unknown>) => any>
|
|
111
|
+
type DynamicCellSlots<T, K = keyof T> = Record<string, (props: CellContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-cell`, (props: CellContext<T, unknown>) => any>
|
|
112
|
+
|
|
113
|
+
export type TableSlots<T> = {
|
|
114
|
+
expanded: (props: { row: Row<T> }) => any
|
|
115
|
+
empty: (props?: {}) => any
|
|
116
|
+
caption: (props?: {}) => any
|
|
117
|
+
} & DynamicHeaderSlots<T> & DynamicCellSlots<T>
|
|
118
|
+
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<script setup lang="ts" generic="T extends TableData">
|
|
122
|
+
import { computed } from 'vue'
|
|
123
|
+
import { Primitive } from 'reka-ui'
|
|
124
|
+
import { FlexRender, getCoreRowModel, getFilteredRowModel, getSortedRowModel, getExpandedRowModel, useVueTable } from '@tanstack/vue-table'
|
|
125
|
+
import { upperFirst } from 'scule'
|
|
126
|
+
import { useLocale } from '../composables/useLocale'
|
|
127
|
+
|
|
128
|
+
const props = defineProps<TableProps<T>>()
|
|
129
|
+
defineSlots<TableSlots<T>>()
|
|
130
|
+
|
|
131
|
+
const { t } = useLocale()
|
|
132
|
+
|
|
133
|
+
const data = computed(() => props.data ?? [])
|
|
134
|
+
const columns = computed<TableColumn<T>[]>(() => props.columns ?? Object.keys(data.value[0] ?? {}).map((accessorKey: string) => ({ accessorKey, header: upperFirst(accessorKey) })))
|
|
135
|
+
|
|
136
|
+
const ui = computed(() => table({
|
|
137
|
+
sticky: props.sticky,
|
|
138
|
+
loading: props.loading,
|
|
139
|
+
loadingColor: props.loadingColor,
|
|
140
|
+
loadingAnimation: props.loadingAnimation
|
|
141
|
+
}))
|
|
142
|
+
|
|
143
|
+
const globalFilterState = defineModel<string>('globalFilter', { default: undefined })
|
|
144
|
+
const columnFiltersState = defineModel<ColumnFiltersState>('columnFilters', { default: [] })
|
|
145
|
+
const columnVisibilityState = defineModel<VisibilityState>('columnVisibility', { default: {} })
|
|
146
|
+
const columnPinningState = defineModel<ColumnPinningState>('columnPinning', { default: {} })
|
|
147
|
+
const rowSelectionState = defineModel<RowSelectionState>('rowSelection', { default: {} })
|
|
148
|
+
const sortingState = defineModel<SortingState>('sorting', { default: [] })
|
|
149
|
+
const expandedState = defineModel<ExpandedState>('expanded', { default: {} })
|
|
150
|
+
|
|
151
|
+
const tableApi = useVueTable({
|
|
152
|
+
data,
|
|
153
|
+
columns: columns.value,
|
|
154
|
+
getCoreRowModel: getCoreRowModel(),
|
|
155
|
+
...(props.globalFilterOptions || {}),
|
|
156
|
+
onGlobalFilterChange: updaterOrValue => valueUpdater(updaterOrValue, globalFilterState),
|
|
157
|
+
...(props.columnFiltersOptions || {}),
|
|
158
|
+
getFilteredRowModel: getFilteredRowModel(),
|
|
159
|
+
onColumnFiltersChange: updaterOrValue => valueUpdater(updaterOrValue, columnFiltersState),
|
|
160
|
+
...(props.visibilityOptions || {}),
|
|
161
|
+
onColumnVisibilityChange: updaterOrValue => valueUpdater(updaterOrValue, columnVisibilityState),
|
|
162
|
+
...(props.columnPinningOptions || {}),
|
|
163
|
+
onColumnPinningChange: updaterOrValue => valueUpdater(updaterOrValue, columnPinningState),
|
|
164
|
+
...(props.rowSelectionOptions || {}),
|
|
165
|
+
onRowSelectionChange: updaterOrValue => valueUpdater(updaterOrValue, rowSelectionState),
|
|
166
|
+
...(props.sortingOptions || {}),
|
|
167
|
+
getSortedRowModel: getSortedRowModel(),
|
|
168
|
+
onSortingChange: updaterOrValue => valueUpdater(updaterOrValue, sortingState),
|
|
169
|
+
...(props.expandedOptions || {}),
|
|
170
|
+
getExpandedRowModel: getExpandedRowModel(),
|
|
171
|
+
onExpandedChange: updaterOrValue => valueUpdater(updaterOrValue, expandedState),
|
|
172
|
+
state: {
|
|
173
|
+
get globalFilter() {
|
|
174
|
+
return globalFilterState.value
|
|
175
|
+
},
|
|
176
|
+
get columnFilters() {
|
|
177
|
+
return columnFiltersState.value
|
|
178
|
+
},
|
|
179
|
+
get columnVisibility() {
|
|
180
|
+
return columnVisibilityState.value
|
|
181
|
+
},
|
|
182
|
+
get columnPinning() {
|
|
183
|
+
return columnPinningState.value
|
|
184
|
+
},
|
|
185
|
+
get expanded() {
|
|
186
|
+
return expandedState.value
|
|
187
|
+
},
|
|
188
|
+
get rowSelection() {
|
|
189
|
+
return rowSelectionState.value
|
|
190
|
+
},
|
|
191
|
+
get sorting() {
|
|
192
|
+
return sortingState.value
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
function valueUpdater<T extends Updater<any>>(updaterOrValue: T, ref: Ref) {
|
|
198
|
+
ref.value = typeof updaterOrValue === 'function' ? updaterOrValue(ref.value) : updaterOrValue
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
defineExpose({
|
|
202
|
+
tableApi
|
|
203
|
+
})
|
|
204
|
+
</script>
|
|
205
|
+
|
|
206
|
+
<template>
|
|
207
|
+
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
208
|
+
<table :class="ui.base({ class: [props.ui?.base] })">
|
|
209
|
+
<caption v-if="caption" :class="ui.caption({ class: [props.ui?.caption] })">
|
|
210
|
+
<slot name="caption">
|
|
211
|
+
{{ caption }}
|
|
212
|
+
</slot>
|
|
213
|
+
</caption>
|
|
214
|
+
|
|
215
|
+
<thead :class="ui.thead({ class: [props.ui?.thead] })">
|
|
216
|
+
<tr v-for="headerGroup in tableApi.getHeaderGroups()" :key="headerGroup.id" :class="ui.tr({ class: [props.ui?.tr] })">
|
|
217
|
+
<th
|
|
218
|
+
v-for="header in headerGroup.headers"
|
|
219
|
+
:key="header.id"
|
|
220
|
+
:data-pinned="header.column.getIsPinned()"
|
|
221
|
+
:class="ui.th({ class: [props.ui?.th, header.column.columnDef.meta?.class?.th], pinned: !!header.column.getIsPinned() })"
|
|
222
|
+
>
|
|
223
|
+
<slot :name="`${header.id}-header`" v-bind="header.getContext()">
|
|
224
|
+
<FlexRender v-if="!header.isPlaceholder" :render="header.column.columnDef.header" :props="header.getContext()" />
|
|
225
|
+
</slot>
|
|
226
|
+
</th>
|
|
227
|
+
</tr>
|
|
228
|
+
</thead>
|
|
229
|
+
|
|
230
|
+
<tbody :class="ui.tbody({ class: [props.ui?.tbody] })">
|
|
231
|
+
<template v-if="tableApi.getRowModel().rows?.length">
|
|
232
|
+
<template v-for="row in tableApi.getRowModel().rows" :key="row.id">
|
|
233
|
+
<tr :data-selected="row.getIsSelected()" :data-expanded="row.getIsExpanded()" :class="ui.tr({ class: [props.ui?.tr] })">
|
|
234
|
+
<td
|
|
235
|
+
v-for="cell in row.getVisibleCells()"
|
|
236
|
+
:key="cell.id"
|
|
237
|
+
:data-pinned="cell.column.getIsPinned()"
|
|
238
|
+
:class="ui.td({ class: [props.ui?.td, cell.column.columnDef.meta?.class?.td], pinned: !!cell.column.getIsPinned() })"
|
|
239
|
+
>
|
|
240
|
+
<slot :name="`${cell.column.id}-cell`" v-bind="cell.getContext()">
|
|
241
|
+
<FlexRender :render="cell.column.columnDef.cell" :props="cell.getContext()" />
|
|
242
|
+
</slot>
|
|
243
|
+
</td>
|
|
244
|
+
</tr>
|
|
245
|
+
<tr v-if="row.getIsExpanded()" :class="ui.tr({ class: [props.ui?.tr] })">
|
|
246
|
+
<td :colspan="row.getAllCells().length" :class="ui.td({ class: [props.ui?.td] })">
|
|
247
|
+
<slot name="expanded" :row="row" />
|
|
248
|
+
</td>
|
|
249
|
+
</tr>
|
|
250
|
+
</template>
|
|
251
|
+
</template>
|
|
252
|
+
|
|
253
|
+
<tr v-else :class="ui.tr({ class: [props.ui?.tr] })">
|
|
254
|
+
<td :colspan="columns?.length" :class="ui.empty({ class: props.ui?.empty })">
|
|
255
|
+
<slot name="empty">
|
|
256
|
+
{{ t('table.noData') }}
|
|
257
|
+
</slot>
|
|
258
|
+
</td>
|
|
259
|
+
</tr>
|
|
260
|
+
</tbody>
|
|
261
|
+
</table>
|
|
262
|
+
</Primitive>
|
|
263
|
+
</template>
|