@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
|
@@ -3,6 +3,7 @@ import { tv, type VariantProps } from 'tailwind-variants'
|
|
|
3
3
|
import type { AppConfig } from '@nuxt/schema'
|
|
4
4
|
import _appConfig from '#build/app.config'
|
|
5
5
|
import theme from '#build/ui/button-group'
|
|
6
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
6
7
|
|
|
7
8
|
const appConfig = _appConfig as AppConfig & { ui: { buttonGroup: Partial<typeof theme> } }
|
|
8
9
|
|
|
@@ -28,11 +29,13 @@ export interface ButtonGroupProps {
|
|
|
28
29
|
export interface ButtonGroupSlots {
|
|
29
30
|
default(props?: {}): any
|
|
30
31
|
}
|
|
32
|
+
|
|
33
|
+
extendDevtoolsMeta({ example: 'ButtonGroupExample' })
|
|
31
34
|
</script>
|
|
32
35
|
|
|
33
36
|
<script setup lang="ts">
|
|
34
37
|
import { provide, computed } from 'vue'
|
|
35
|
-
import { Primitive } from '
|
|
38
|
+
import { Primitive } from 'reka-ui'
|
|
36
39
|
import { buttonGroupInjectionKey } from '../composables/useButtonGroup'
|
|
37
40
|
|
|
38
41
|
const props = withDefaults(defineProps<ButtonGroupProps>(), {
|
|
@@ -47,7 +50,7 @@ provide(buttonGroupInjectionKey, computed(() => ({
|
|
|
47
50
|
</script>
|
|
48
51
|
|
|
49
52
|
<template>
|
|
50
|
-
<Primitive :as="as" :class="buttonGroup({ orientation })">
|
|
53
|
+
<Primitive :as="as" :class="buttonGroup({ orientation, class: props.class })">
|
|
51
54
|
<slot />
|
|
52
55
|
</Primitive>
|
|
53
56
|
</template>
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants'
|
|
3
|
+
import type { CalendarRootProps, CalendarRootEmits, RangeCalendarRootEmits, DateRange, CalendarCellTriggerProps } from 'reka-ui'
|
|
4
|
+
import type { DateValue } from '@internationalized/date'
|
|
5
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
6
|
+
import _appConfig from '#build/app.config'
|
|
7
|
+
import theme from '#build/ui/calendar'
|
|
8
|
+
|
|
9
|
+
const appConfig = _appConfig as AppConfig & { ui: { calendar: Partial<typeof theme> } }
|
|
10
|
+
|
|
11
|
+
const calendar = tv({ extend: tv(theme), ...(appConfig.ui?.calendar || {}) })
|
|
12
|
+
|
|
13
|
+
type CalendarVariants = VariantProps<typeof calendar>
|
|
14
|
+
|
|
15
|
+
type CalendarModelValue<R extends boolean = false, M extends boolean = false> = R extends true
|
|
16
|
+
? DateRange
|
|
17
|
+
: M extends true
|
|
18
|
+
? DateValue[]
|
|
19
|
+
: DateValue
|
|
20
|
+
|
|
21
|
+
export interface CalendarProps<R extends boolean, M extends boolean> extends Omit<CalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'> {
|
|
22
|
+
/**
|
|
23
|
+
* The element or component this component should render as.
|
|
24
|
+
* @defaultValue 'div'
|
|
25
|
+
*/
|
|
26
|
+
as?: any
|
|
27
|
+
/**
|
|
28
|
+
* The icon to use for the next year control.
|
|
29
|
+
* @defaultValue appConfig.ui.icons.chevronDoubleRight
|
|
30
|
+
*/
|
|
31
|
+
nextYearIcon?: string
|
|
32
|
+
/**
|
|
33
|
+
* The icon to use for the next month control.
|
|
34
|
+
* @defaultValue appConfig.ui.icons.chevronRight
|
|
35
|
+
*/
|
|
36
|
+
nextMonthIcon?: string
|
|
37
|
+
/**
|
|
38
|
+
* The icon to use for the previous year control.
|
|
39
|
+
* @defaultValue appConfig.ui.icons.chevronDoubleLeft
|
|
40
|
+
*/
|
|
41
|
+
prevYearIcon?: string
|
|
42
|
+
/**
|
|
43
|
+
* The icon to use for the previous month control.
|
|
44
|
+
* @defaultValue appConfig.ui.icons.chevronLeft
|
|
45
|
+
*/
|
|
46
|
+
prevMonthIcon?: string
|
|
47
|
+
color?: CalendarVariants['color']
|
|
48
|
+
size?: CalendarVariants['size']
|
|
49
|
+
/** Whether or not a range of dates can be selected */
|
|
50
|
+
range?: R & boolean
|
|
51
|
+
/** Whether or not multiple dates can be selected */
|
|
52
|
+
multiple?: M & boolean
|
|
53
|
+
/** Show month controls */
|
|
54
|
+
monthControls?: boolean
|
|
55
|
+
/** Show year controls */
|
|
56
|
+
yearControls?: boolean
|
|
57
|
+
defaultValue?: CalendarModelValue<R, M>
|
|
58
|
+
modelValue?: CalendarModelValue<R, M>
|
|
59
|
+
class?: any
|
|
60
|
+
ui?: Partial<typeof calendar.slots>
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface CalendarEmits<R extends boolean, M extends boolean> extends Omit<CalendarRootEmits & RangeCalendarRootEmits, 'update:modelValue'> {
|
|
64
|
+
'update:modelValue': [date: CalendarModelValue<R, M>]
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface CalendarSlots {
|
|
68
|
+
'heading': (props: { value: string }) => any
|
|
69
|
+
'day': (props: Pick<CalendarCellTriggerProps, 'day'>) => any
|
|
70
|
+
'week-day': (props: { day: string }) => any
|
|
71
|
+
}
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<script setup lang="ts" generic="R extends boolean = false, M extends boolean = false">
|
|
75
|
+
import { computed } from 'vue'
|
|
76
|
+
import { useForwardPropsEmits } from 'reka-ui'
|
|
77
|
+
import { Calendar as SingleCalendar, RangeCalendar } from 'reka-ui/namespaced'
|
|
78
|
+
import { reactiveOmit } from '@vueuse/core'
|
|
79
|
+
import { useLocale } from '../composables/useLocale'
|
|
80
|
+
import UButton from './Button.vue'
|
|
81
|
+
|
|
82
|
+
const props = withDefaults(defineProps<CalendarProps<R, M>>(), {
|
|
83
|
+
fixedWeeks: true,
|
|
84
|
+
monthControls: true,
|
|
85
|
+
yearControls: true
|
|
86
|
+
})
|
|
87
|
+
const emits = defineEmits<CalendarEmits<R, M>>()
|
|
88
|
+
defineSlots<CalendarSlots>()
|
|
89
|
+
|
|
90
|
+
const { code: locale, dir, t } = useLocale()
|
|
91
|
+
|
|
92
|
+
const rootProps = useForwardPropsEmits(reactiveOmit(props, 'range', 'modelValue', 'defaultValue', 'color', 'size', 'monthControls', 'yearControls', 'class', 'ui'), emits)
|
|
93
|
+
|
|
94
|
+
const nextYearIcon = computed(() => props.nextYearIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronDoubleLeft : appConfig.ui.icons.chevronDoubleRight))
|
|
95
|
+
const nextMonthIcon = computed(() => props.nextMonthIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight))
|
|
96
|
+
const prevYearIcon = computed(() => props.prevYearIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronDoubleRight : appConfig.ui.icons.chevronDoubleLeft))
|
|
97
|
+
const prevMonthIcon = computed(() => props.prevMonthIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronRight : appConfig.ui.icons.chevronLeft))
|
|
98
|
+
|
|
99
|
+
const ui = computed(() => calendar({
|
|
100
|
+
color: props.color,
|
|
101
|
+
size: props.size
|
|
102
|
+
}))
|
|
103
|
+
|
|
104
|
+
function paginateYear(date: DateValue, sign: -1 | 1) {
|
|
105
|
+
if (sign === -1) {
|
|
106
|
+
return date.subtract({ years: 1 })
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return date.add({ years: 1 })
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const Calendar = computed(() => props.range ? RangeCalendar : SingleCalendar)
|
|
113
|
+
</script>
|
|
114
|
+
|
|
115
|
+
<template>
|
|
116
|
+
<Calendar.Root
|
|
117
|
+
v-slot="{ weekDays, grid }"
|
|
118
|
+
v-bind="rootProps"
|
|
119
|
+
:model-value="(modelValue as CalendarModelValue<true & false>)"
|
|
120
|
+
:default-value="(defaultValue as CalendarModelValue<true & false>)"
|
|
121
|
+
:locale="locale"
|
|
122
|
+
:dir="dir"
|
|
123
|
+
:class="ui.root({ class: [props.class, props.ui?.root] })"
|
|
124
|
+
>
|
|
125
|
+
<Calendar.Header :class="ui.header({ class: props.ui?.header })">
|
|
126
|
+
<Calendar.Prev v-if="props.yearControls" :prev-page="(date: DateValue) => paginateYear(date, -1)" :aria-label="t('calendar.prevYear')" as-child>
|
|
127
|
+
<UButton :icon="prevYearIcon" :size="props.size" color="neutral" variant="ghost" />
|
|
128
|
+
</Calendar.Prev>
|
|
129
|
+
<Calendar.Prev v-if="props.monthControls" :aria-label="t('calendar.prevMonth')" as-child>
|
|
130
|
+
<UButton :icon="prevMonthIcon" :size="props.size" color="neutral" variant="ghost" />
|
|
131
|
+
</Calendar.Prev>
|
|
132
|
+
<Calendar.Heading v-slot="{ headingValue }" :class="ui.heading({ class: props.ui?.heading })">
|
|
133
|
+
<slot name="heading" :value="headingValue">
|
|
134
|
+
{{ headingValue }}
|
|
135
|
+
</slot>
|
|
136
|
+
</Calendar.Heading>
|
|
137
|
+
<Calendar.Next v-if="props.monthControls" :aria-label="t('calendar.nextMonth')" as-child>
|
|
138
|
+
<UButton :icon="nextMonthIcon" :size="props.size" color="neutral" variant="ghost" />
|
|
139
|
+
</Calendar.Next>
|
|
140
|
+
<Calendar.Next v-if="props.yearControls" :next-page="(date: DateValue) => paginateYear(date, 1)" :aria-label="t('calendar.nextYear')" as-child>
|
|
141
|
+
<UButton :icon="nextYearIcon" :size="props.size" color="neutral" variant="ghost" />
|
|
142
|
+
</Calendar.Next>
|
|
143
|
+
</Calendar.Header>
|
|
144
|
+
<div :class="ui.body({ class: props.ui?.body })">
|
|
145
|
+
<Calendar.Grid
|
|
146
|
+
v-for="month in grid"
|
|
147
|
+
:key="month.value.toString()"
|
|
148
|
+
:class="ui.grid({ class: props.ui?.grid })"
|
|
149
|
+
>
|
|
150
|
+
<Calendar.GridHead>
|
|
151
|
+
<Calendar.GridRow :class="ui.gridWeekDaysRow({ class: props.ui?.gridWeekDaysRow })">
|
|
152
|
+
<Calendar.HeadCell
|
|
153
|
+
v-for="day in weekDays"
|
|
154
|
+
:key="day"
|
|
155
|
+
:class="ui.headCell({ class: props.ui?.headCell })"
|
|
156
|
+
>
|
|
157
|
+
<slot name="week-day" :day="day">
|
|
158
|
+
{{ day }}
|
|
159
|
+
</slot>
|
|
160
|
+
</Calendar.HeadCell>
|
|
161
|
+
</Calendar.GridRow>
|
|
162
|
+
</Calendar.GridHead>
|
|
163
|
+
<Calendar.GridBody :class="ui.gridBody({ class: props.ui?.gridBody })">
|
|
164
|
+
<Calendar.GridRow
|
|
165
|
+
v-for="(weekDates, index) in month.rows"
|
|
166
|
+
:key="`weekDate-${index}`"
|
|
167
|
+
:class="ui.gridRow({ class: props.ui?.gridRow })"
|
|
168
|
+
>
|
|
169
|
+
<Calendar.Cell
|
|
170
|
+
v-for="weekDate in weekDates"
|
|
171
|
+
:key="weekDate.toString()"
|
|
172
|
+
:date="weekDate"
|
|
173
|
+
:class="ui.cell({ class: props.ui?.cell })"
|
|
174
|
+
>
|
|
175
|
+
<Calendar.CellTrigger
|
|
176
|
+
:day="weekDate"
|
|
177
|
+
:month="month.value"
|
|
178
|
+
:class="ui.cellTrigger({ class: props.ui?.cellTrigger })"
|
|
179
|
+
>
|
|
180
|
+
<slot name="day" :day="weekDate">
|
|
181
|
+
{{ weekDate.day }}
|
|
182
|
+
</slot>
|
|
183
|
+
</Calendar.CellTrigger>
|
|
184
|
+
</Calendar.Cell>
|
|
185
|
+
</Calendar.GridRow>
|
|
186
|
+
</Calendar.GridBody>
|
|
187
|
+
</Calendar.Grid>
|
|
188
|
+
</div>
|
|
189
|
+
</Calendar.Root>
|
|
190
|
+
</template>
|
|
@@ -3,6 +3,7 @@ import { tv } from 'tailwind-variants'
|
|
|
3
3
|
import type { AppConfig } from '@nuxt/schema'
|
|
4
4
|
import _appConfig from '#build/app.config'
|
|
5
5
|
import theme from '#build/ui/card'
|
|
6
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
6
7
|
|
|
7
8
|
const appConfig = _appConfig as AppConfig & { ui: { card: Partial<typeof theme> } }
|
|
8
9
|
|
|
@@ -23,10 +24,12 @@ export interface CardSlots {
|
|
|
23
24
|
default(props?: {}): any
|
|
24
25
|
footer(props?: {}): any
|
|
25
26
|
}
|
|
27
|
+
|
|
28
|
+
extendDevtoolsMeta({ example: 'CardExample' })
|
|
26
29
|
</script>
|
|
27
30
|
|
|
28
31
|
<script setup lang="ts">
|
|
29
|
-
import { Primitive } from '
|
|
32
|
+
import { Primitive } from 'reka-ui'
|
|
30
33
|
|
|
31
34
|
const props = defineProps<CardProps>()
|
|
32
35
|
const slots = defineSlots<CardSlots>()
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants'
|
|
3
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
4
|
+
import type { AcceptableValue } from 'reka-ui'
|
|
5
|
+
import type { EmblaCarouselType, EmblaOptionsType, EmblaPluginType } from 'embla-carousel'
|
|
6
|
+
import type { AutoplayOptionsType } from 'embla-carousel-autoplay'
|
|
7
|
+
import type { AutoScrollOptionsType } from 'embla-carousel-auto-scroll'
|
|
8
|
+
import type { AutoHeightOptionsType } from 'embla-carousel-auto-height'
|
|
9
|
+
import type { ClassNamesOptionsType } from 'embla-carousel-class-names'
|
|
10
|
+
import type { FadeOptionsType } from 'embla-carousel-fade'
|
|
11
|
+
import type { WheelGesturesPluginOptions } from 'embla-carousel-wheel-gestures'
|
|
12
|
+
import _appConfig from '#build/app.config'
|
|
13
|
+
import theme from '#build/ui/carousel'
|
|
14
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
15
|
+
import type { ButtonProps } from '../types'
|
|
16
|
+
import type { PartialString } from '../types/utils'
|
|
17
|
+
|
|
18
|
+
const appConfig = _appConfig as AppConfig & { ui: { carousel: Partial<typeof theme> } }
|
|
19
|
+
|
|
20
|
+
const carousel = tv({ extend: tv(theme), ...(appConfig.ui?.carousel || {}) })
|
|
21
|
+
|
|
22
|
+
type CarouselVariants = VariantProps<typeof carousel>
|
|
23
|
+
|
|
24
|
+
export interface CarouselProps<T> extends Omit<EmblaOptionsType, 'axis' | 'container' | 'slides' | 'direction'> {
|
|
25
|
+
/**
|
|
26
|
+
* The element or component this component should render as.
|
|
27
|
+
* @defaultValue 'div'
|
|
28
|
+
*/
|
|
29
|
+
as?: any
|
|
30
|
+
/**
|
|
31
|
+
* Configure the prev button when arrows are enabled.
|
|
32
|
+
* @defaultValue { size: 'md', color: 'neutral', variant: 'link' }
|
|
33
|
+
*/
|
|
34
|
+
prev?: ButtonProps
|
|
35
|
+
/**
|
|
36
|
+
* The icon displayed in the prev button.
|
|
37
|
+
* @defaultValue appConfig.ui.icons.arrowLeft
|
|
38
|
+
*/
|
|
39
|
+
prevIcon?: string
|
|
40
|
+
/**
|
|
41
|
+
* Configure the next button when arrows are enabled.
|
|
42
|
+
* @defaultValue { size: 'md', color: 'neutral', variant: 'link' }
|
|
43
|
+
*/
|
|
44
|
+
next?: ButtonProps
|
|
45
|
+
/**
|
|
46
|
+
* The icon displayed in the next button.
|
|
47
|
+
* @defaultValue appConfig.ui.icons.arrowRight
|
|
48
|
+
*/
|
|
49
|
+
nextIcon?: string
|
|
50
|
+
/**
|
|
51
|
+
* Display prev and next buttons to scroll the carousel.
|
|
52
|
+
* @defaultValue false
|
|
53
|
+
*/
|
|
54
|
+
arrows?: boolean
|
|
55
|
+
/**
|
|
56
|
+
* Display dots to scroll to a specific slide.
|
|
57
|
+
* @defaultValue false
|
|
58
|
+
*/
|
|
59
|
+
dots?: boolean
|
|
60
|
+
orientation?: CarouselVariants['orientation']
|
|
61
|
+
items?: T[]
|
|
62
|
+
/**
|
|
63
|
+
* Enable Autoplay plugin
|
|
64
|
+
* @link https://www.embla-carousel.com/plugins/autoplay/
|
|
65
|
+
*/
|
|
66
|
+
autoplay?: boolean | AutoplayOptionsType
|
|
67
|
+
/**
|
|
68
|
+
* Enable Auto Scroll plugin
|
|
69
|
+
* @link https://www.embla-carousel.com/plugins/auto-scroll/
|
|
70
|
+
*/
|
|
71
|
+
autoScroll?: boolean | AutoScrollOptionsType
|
|
72
|
+
/**
|
|
73
|
+
* Enable Auto Height plugin
|
|
74
|
+
* @link https://www.embla-carousel.com/plugins/auto-height/
|
|
75
|
+
*/
|
|
76
|
+
autoHeight?: boolean | AutoHeightOptionsType
|
|
77
|
+
/**
|
|
78
|
+
* Enable Class Names plugin
|
|
79
|
+
* @link https://www.embla-carousel.com/plugins/class-names/
|
|
80
|
+
*/
|
|
81
|
+
classNames?: boolean | ClassNamesOptionsType
|
|
82
|
+
/**
|
|
83
|
+
* Enable Fade plugin
|
|
84
|
+
* @link https://www.embla-carousel.com/plugins/fade/
|
|
85
|
+
*/
|
|
86
|
+
fade?: boolean | FadeOptionsType
|
|
87
|
+
/**
|
|
88
|
+
* Enable Wheel Gestures plugin
|
|
89
|
+
* @link https://www.embla-carousel.com/plugins/wheel-gestures/
|
|
90
|
+
*/
|
|
91
|
+
wheelGestures?: boolean | WheelGesturesPluginOptions
|
|
92
|
+
class?: any
|
|
93
|
+
ui?: PartialString<typeof carousel.slots>
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type CarouselSlots<T> = {
|
|
97
|
+
default(props: { item: T, index: number }): any
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
extendDevtoolsMeta({ example: 'CarouselExample' })
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<script setup lang="ts" generic="T extends AcceptableValue">
|
|
104
|
+
import { computed, ref, watch, onMounted } from 'vue'
|
|
105
|
+
import useEmblaCarousel from 'embla-carousel-vue'
|
|
106
|
+
import { Primitive, useForwardProps } from 'reka-ui'
|
|
107
|
+
import { reactivePick, computedAsync } from '@vueuse/core'
|
|
108
|
+
import { useAppConfig } from '#imports'
|
|
109
|
+
import { useLocale } from '../composables/useLocale'
|
|
110
|
+
import UButton from './Button.vue'
|
|
111
|
+
|
|
112
|
+
const props = withDefaults(defineProps<CarouselProps<T>>(), {
|
|
113
|
+
orientation: 'horizontal',
|
|
114
|
+
arrows: false,
|
|
115
|
+
dots: false,
|
|
116
|
+
// Embla Options
|
|
117
|
+
active: true,
|
|
118
|
+
align: 'center',
|
|
119
|
+
breakpoints: () => ({}),
|
|
120
|
+
containScroll: 'trimSnaps',
|
|
121
|
+
dragFree: false,
|
|
122
|
+
dragThreshold: 10,
|
|
123
|
+
duration: 25,
|
|
124
|
+
inViewThreshold: 0,
|
|
125
|
+
loop: false,
|
|
126
|
+
skipSnaps: false,
|
|
127
|
+
slidesToScroll: 1,
|
|
128
|
+
startIndex: 0,
|
|
129
|
+
watchDrag: true,
|
|
130
|
+
watchResize: true,
|
|
131
|
+
watchSlides: true,
|
|
132
|
+
watchFocus: true,
|
|
133
|
+
// Embla Plugins
|
|
134
|
+
autoplay: false,
|
|
135
|
+
autoScroll: false,
|
|
136
|
+
autoHeight: false,
|
|
137
|
+
classNames: false,
|
|
138
|
+
fade: false,
|
|
139
|
+
wheelGestures: false
|
|
140
|
+
})
|
|
141
|
+
defineSlots<CarouselSlots<T>>()
|
|
142
|
+
|
|
143
|
+
const appConfig = useAppConfig()
|
|
144
|
+
const { dir, t } = useLocale()
|
|
145
|
+
const rootProps = useForwardProps(reactivePick(props, 'active', 'align', 'breakpoints', 'containScroll', 'dragFree', 'dragThreshold', 'duration', 'inViewThreshold', 'loop', 'skipSnaps', 'slidesToScroll', 'startIndex', 'watchDrag', 'watchResize', 'watchSlides', 'watchFocus'))
|
|
146
|
+
|
|
147
|
+
const prevIcon = computed(() => props.prevIcon || (dir.value === 'rtl' ? appConfig.ui.icons.arrowRight : appConfig.ui.icons.arrowLeft))
|
|
148
|
+
const nextIcon = computed(() => props.nextIcon || (dir.value === 'rtl' ? appConfig.ui.icons.arrowLeft : appConfig.ui.icons.arrowRight))
|
|
149
|
+
|
|
150
|
+
const ui = computed(() => carousel({
|
|
151
|
+
orientation: props.orientation
|
|
152
|
+
}))
|
|
153
|
+
|
|
154
|
+
const options = computed<EmblaOptionsType>(() => ({
|
|
155
|
+
...(props.fade ? { align: 'center', containScroll: false } : {}),
|
|
156
|
+
...rootProps.value,
|
|
157
|
+
axis: props.orientation === 'horizontal' ? 'x' : 'y',
|
|
158
|
+
direction: dir.value === 'rtl' ? 'rtl' : 'ltr'
|
|
159
|
+
}))
|
|
160
|
+
|
|
161
|
+
const plugins = computedAsync<EmblaPluginType[]>(async () => {
|
|
162
|
+
const plugins = []
|
|
163
|
+
|
|
164
|
+
if (props.autoplay) {
|
|
165
|
+
const AutoplayPlugin = await import('embla-carousel-autoplay').then(r => r.default)
|
|
166
|
+
plugins.push(AutoplayPlugin(typeof props.autoplay === 'boolean' ? {} : props.autoplay))
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (props.autoScroll) {
|
|
170
|
+
const AutoScrollPlugin = await import('embla-carousel-auto-scroll').then(r => r.default)
|
|
171
|
+
plugins.push(AutoScrollPlugin(typeof props.autoScroll === 'boolean' ? {} : props.autoScroll))
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (props.autoHeight) {
|
|
175
|
+
const AutoHeightPlugin = await import('embla-carousel-auto-height').then(r => r.default)
|
|
176
|
+
plugins.push(AutoHeightPlugin(typeof props.autoHeight === 'boolean' ? {} : props.autoHeight))
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (props.classNames) {
|
|
180
|
+
const ClassNamesPlugin = await import('embla-carousel-class-names').then(r => r.default)
|
|
181
|
+
plugins.push(ClassNamesPlugin(typeof props.classNames === 'boolean' ? {} : props.classNames))
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (props.fade) {
|
|
185
|
+
const FadePlugin = await import('embla-carousel-fade').then(r => r.default)
|
|
186
|
+
plugins.push(FadePlugin(typeof props.fade === 'boolean' ? {} : props.fade))
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (props.wheelGestures) {
|
|
190
|
+
const { WheelGesturesPlugin } = await import('embla-carousel-wheel-gestures')
|
|
191
|
+
plugins.push(WheelGesturesPlugin(typeof props.wheelGestures === 'boolean' ? {} : props.wheelGestures))
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return plugins
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
const [emblaRef, emblaApi] = useEmblaCarousel(options.value, plugins.value)
|
|
198
|
+
|
|
199
|
+
watch([options, plugins], () => {
|
|
200
|
+
emblaApi.value?.reInit(options.value, plugins.value)
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
function scrollPrev() {
|
|
204
|
+
emblaApi.value?.scrollPrev()
|
|
205
|
+
}
|
|
206
|
+
function scrollNext() {
|
|
207
|
+
emblaApi.value?.scrollNext()
|
|
208
|
+
}
|
|
209
|
+
function scrollTo(index: number) {
|
|
210
|
+
emblaApi.value?.scrollTo(index)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function onKeyDown(event: KeyboardEvent) {
|
|
214
|
+
const prevKey = props.orientation === 'vertical' ? 'ArrowUp' : 'ArrowLeft'
|
|
215
|
+
const nextKey = props.orientation === 'vertical' ? 'ArrowDown' : 'ArrowRight'
|
|
216
|
+
|
|
217
|
+
if (event.key === prevKey) {
|
|
218
|
+
event.preventDefault()
|
|
219
|
+
scrollPrev()
|
|
220
|
+
|
|
221
|
+
return
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (event.key === nextKey) {
|
|
225
|
+
event.preventDefault()
|
|
226
|
+
scrollNext()
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const canScrollNext = ref(false)
|
|
231
|
+
const canScrollPrev = ref(false)
|
|
232
|
+
const selectedIndex = ref<number>(0)
|
|
233
|
+
const scrollSnaps = ref<number[]>([])
|
|
234
|
+
|
|
235
|
+
function onInit(api: EmblaCarouselType) {
|
|
236
|
+
scrollSnaps.value = api?.scrollSnapList() || []
|
|
237
|
+
}
|
|
238
|
+
function onSelect(api: EmblaCarouselType) {
|
|
239
|
+
canScrollNext.value = api?.canScrollNext() || false
|
|
240
|
+
canScrollPrev.value = api?.canScrollPrev() || false
|
|
241
|
+
selectedIndex.value = api?.selectedScrollSnap() || 0
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
onMounted(() => {
|
|
245
|
+
if (!emblaApi.value) {
|
|
246
|
+
return
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
emblaApi.value?.on('init', onInit)
|
|
250
|
+
emblaApi.value?.on('init', onSelect)
|
|
251
|
+
emblaApi.value?.on('reInit', onInit)
|
|
252
|
+
emblaApi.value?.on('reInit', onSelect)
|
|
253
|
+
emblaApi.value?.on('select', onSelect)
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
defineExpose({
|
|
257
|
+
emblaRef,
|
|
258
|
+
emblaApi
|
|
259
|
+
})
|
|
260
|
+
</script>
|
|
261
|
+
|
|
262
|
+
<template>
|
|
263
|
+
<Primitive
|
|
264
|
+
:as="as"
|
|
265
|
+
role="region"
|
|
266
|
+
aria-roledescription="carousel"
|
|
267
|
+
tabindex="0"
|
|
268
|
+
:class="ui.root({ class: [props.class, props.ui?.root] })"
|
|
269
|
+
@keydown="onKeyDown"
|
|
270
|
+
>
|
|
271
|
+
<div ref="emblaRef" :class="ui.viewport({ class: props.ui?.viewport })">
|
|
272
|
+
<div :class="ui.container({ class: props.ui?.container })">
|
|
273
|
+
<div
|
|
274
|
+
v-for="(item, index) in items"
|
|
275
|
+
:key="index"
|
|
276
|
+
role="group"
|
|
277
|
+
aria-roledescription="slide"
|
|
278
|
+
:class="ui.item({ class: props.ui?.item })"
|
|
279
|
+
>
|
|
280
|
+
<slot :item="item" :index="index" />
|
|
281
|
+
</div>
|
|
282
|
+
</div>
|
|
283
|
+
</div>
|
|
284
|
+
|
|
285
|
+
<div v-if="arrows || dots" :class="ui.controls({ class: props.ui?.controls })">
|
|
286
|
+
<div v-if="arrows" :class="ui.arrows({ class: props.ui?.arrows })">
|
|
287
|
+
<UButton
|
|
288
|
+
:disabled="!canScrollPrev"
|
|
289
|
+
:icon="prevIcon"
|
|
290
|
+
size="md"
|
|
291
|
+
color="neutral"
|
|
292
|
+
variant="outline"
|
|
293
|
+
:aria-label="t('carousel.prev')"
|
|
294
|
+
v-bind="typeof prev === 'object' ? prev : undefined"
|
|
295
|
+
:class="ui.prev({ class: props.ui?.prev })"
|
|
296
|
+
@click="scrollPrev"
|
|
297
|
+
/>
|
|
298
|
+
<UButton
|
|
299
|
+
:disabled="!canScrollNext"
|
|
300
|
+
:icon="nextIcon"
|
|
301
|
+
size="md"
|
|
302
|
+
color="neutral"
|
|
303
|
+
variant="outline"
|
|
304
|
+
:aria-label="t('carousel.next')"
|
|
305
|
+
v-bind="typeof next === 'object' ? next : undefined"
|
|
306
|
+
:class="ui.next({ class: props.ui?.next })"
|
|
307
|
+
@click="scrollNext"
|
|
308
|
+
/>
|
|
309
|
+
</div>
|
|
310
|
+
|
|
311
|
+
<div v-if="dots" :class="ui.dots({ class: props.ui?.dots })">
|
|
312
|
+
<template v-for="(_, index) in scrollSnaps" :key="index">
|
|
313
|
+
<button
|
|
314
|
+
:aria-label="t('carousel.goto', { slide: index + 1 })"
|
|
315
|
+
:class="ui.dot({ class: props.ui?.dot, active: selectedIndex === index })"
|
|
316
|
+
@click="scrollTo(index)"
|
|
317
|
+
/>
|
|
318
|
+
</template>
|
|
319
|
+
</div>
|
|
320
|
+
</div>
|
|
321
|
+
</Primitive>
|
|
322
|
+
</template>
|