@nuxt/ui 3.0.0-alpha.0 → 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 +4 -3
- package/dist/module.mjs +180 -2617
- package/dist/runtime/components/Accordion.vue +95 -11
- package/dist/runtime/components/Alert.vue +69 -10
- package/dist/runtime/components/App.vue +28 -5
- package/dist/runtime/components/Avatar.vue +57 -12
- package/dist/runtime/components/AvatarGroup.vue +34 -7
- package/dist/runtime/components/Badge.vue +61 -9
- package/dist/runtime/components/Breadcrumb.vue +93 -16
- package/dist/runtime/components/Button.vue +78 -12
- package/dist/runtime/components/ButtonGroup.vue +35 -8
- package/dist/runtime/components/Calendar.vue +190 -0
- package/dist/runtime/components/Card.vue +29 -7
- package/dist/runtime/components/Carousel.vue +322 -0
- package/dist/runtime/components/Checkbox.vue +64 -30
- package/dist/runtime/components/Chip.vue +48 -8
- package/dist/runtime/components/Collapsible.vue +32 -8
- package/dist/runtime/components/ColorPicker.vue +265 -0
- package/dist/runtime/components/CommandPalette.vue +207 -88
- package/dist/runtime/components/Container.vue +26 -7
- package/dist/runtime/components/ContextMenu.vue +150 -11
- package/dist/runtime/components/ContextMenuContent.vue +63 -19
- package/dist/runtime/components/Drawer.vue +68 -15
- package/dist/runtime/components/DropdownMenu.vue +147 -12
- package/dist/runtime/components/DropdownMenuContent.vue +69 -19
- package/dist/runtime/components/Form.vue +80 -42
- package/dist/runtime/components/FormField.vue +58 -21
- package/dist/runtime/components/Icon.vue +13 -3
- package/dist/runtime/components/Input.vue +61 -12
- package/dist/runtime/components/InputMenu.vue +247 -53
- package/dist/runtime/components/InputNumber.vue +192 -0
- package/dist/runtime/components/Kbd.vue +31 -7
- package/dist/runtime/components/Link.vue +148 -21
- package/dist/runtime/components/LinkBase.vue +21 -8
- package/dist/runtime/components/Modal.vue +90 -15
- package/dist/runtime/components/NavigationMenu.vue +234 -69
- package/dist/runtime/components/Pagination.vue +124 -15
- package/dist/runtime/components/PinInput.vue +96 -0
- package/dist/runtime/components/Popover.vue +66 -11
- package/dist/runtime/components/Progress.vue +67 -12
- package/dist/runtime/components/RadioGroup.vue +78 -9
- package/dist/runtime/components/Select.vue +155 -26
- package/dist/runtime/components/SelectMenu.vue +245 -63
- package/dist/runtime/components/Separator.vue +42 -7
- package/dist/runtime/components/Skeleton.vue +22 -7
- package/dist/runtime/components/Slideover.vue +88 -15
- package/dist/runtime/components/Slider.vue +37 -7
- package/dist/runtime/components/Stepper.vue +171 -0
- package/dist/runtime/components/Switch.vue +58 -14
- package/dist/runtime/components/Table.vue +262 -0
- package/dist/runtime/components/Tabs.vue +97 -17
- package/dist/runtime/components/Textarea.vue +55 -9
- package/dist/runtime/components/Toast.vue +66 -9
- package/dist/runtime/components/Toaster.vue +57 -21
- package/dist/runtime/components/Tooltip.vue +49 -10
- 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 +2 -2
- package/dist/runtime/composables/useButtonGroup.d.ts +5 -5
- package/dist/runtime/composables/useComponentIcons.d.ts +3 -0
- package/dist/runtime/composables/useFormField.d.ts +13 -6
- package/dist/runtime/composables/useFormField.js +12 -7
- 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 -0
- 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.d.ts +2 -0
- package/dist/runtime/plugins/colors.js +12 -8
- package/dist/runtime/plugins/modal.d.ts +2 -0
- package/dist/runtime/plugins/slideover.d.ts +2 -0
- package/dist/runtime/types/form.d.ts +10 -4
- 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 +25 -55
- 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 +103 -37
- package/vue-plugin.d.ts +5 -0
- package/dist/runtime/assets/css/animations.css +0 -1
- package/dist/runtime/components/Accordion.vue.d.ts +0 -492
- package/dist/runtime/components/Alert.vue.d.ts +0 -548
- package/dist/runtime/components/App.vue.d.ts +0 -25
- package/dist/runtime/components/Avatar.vue.d.ts +0 -384
- package/dist/runtime/components/AvatarGroup.vue.d.ts +0 -381
- package/dist/runtime/components/Badge.vue.d.ts +0 -422
- package/dist/runtime/components/Breadcrumb.vue.d.ts +0 -307
- package/dist/runtime/components/Button.vue.d.ts +0 -949
- package/dist/runtime/components/ButtonGroup.vue.d.ts +0 -182
- package/dist/runtime/components/Card.vue.d.ts +0 -191
- package/dist/runtime/components/Checkbox.vue.d.ts +0 -819
- package/dist/runtime/components/Chip.vue.d.ts +0 -590
- package/dist/runtime/components/Collapsible.vue.d.ts +0 -159
- package/dist/runtime/components/CommandPalette.vue.d.ts +0 -684
- package/dist/runtime/components/Container.vue.d.ts +0 -27
- package/dist/runtime/components/ContextMenu.vue.d.ts +0 -796
- package/dist/runtime/components/Drawer.vue.d.ts +0 -343
- package/dist/runtime/components/DropdownMenu.vue.d.ts +0 -815
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +0 -0
- package/dist/runtime/components/Form.vue.d.ts +0 -39
- package/dist/runtime/components/FormField.vue.d.ts +0 -356
- package/dist/runtime/components/Icon.vue.d.ts +0 -17
- package/dist/runtime/components/Input.vue.d.ts +0 -1137
- package/dist/runtime/components/InputMenu.vue.d.ts +0 -2121
- package/dist/runtime/components/Kbd.vue.d.ts +0 -169
- package/dist/runtime/components/Link.vue.d.ts +0 -76
- package/dist/runtime/components/LinkBase.vue.d.ts +0 -49
- package/dist/runtime/components/Modal.vue.d.ts +0 -319
- package/dist/runtime/components/NavigationMenu.vue.d.ts +0 -1789
- package/dist/runtime/components/Pagination.vue.d.ts +0 -295
- package/dist/runtime/components/Popover.vue.d.ts +0 -197
- package/dist/runtime/components/Progress.vue.d.ts +0 -1781
- package/dist/runtime/components/RadioGroup.vue.d.ts +0 -1715
- package/dist/runtime/components/Select.vue.d.ts +0 -1569
- package/dist/runtime/components/SelectMenu.vue.d.ts +0 -1661
- package/dist/runtime/components/Separator.vue.d.ts +0 -0
- package/dist/runtime/components/Skeleton.vue.d.ts +0 -26
- package/dist/runtime/components/Slideover.vue.d.ts +0 -375
- package/dist/runtime/components/Slider.vue.d.ts +0 -0
- package/dist/runtime/components/Switch.vue.d.ts +0 -1676
- package/dist/runtime/components/Tabs.vue.d.ts +0 -934
- package/dist/runtime/components/Textarea.vue.d.ts +0 -1133
- package/dist/runtime/components/Toast.vue.d.ts +0 -0
- package/dist/runtime/components/Toaster.vue.d.ts +0 -362
- package/dist/runtime/components/Tooltip.vue.d.ts +0 -248
- package/dist/runtime/types/component.d.ts +0 -17
- package/dist/runtime/types/component.js +0 -0
- /package/dist/runtime/{components/ContextMenuContent.vue.d.ts → types/locale.js} +0 -0
|
@@ -1,32 +1,165 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { tv } from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants'
|
|
3
|
+
import type { NavigationMenuRootProps, NavigationMenuRootEmits, NavigationMenuContentProps, CollapsibleRootProps } from 'reka-ui'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/ui/navigation-menu'
|
|
7
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
8
|
+
import type { AvatarProps, BadgeProps, LinkProps } from '../types'
|
|
9
|
+
import type { DynamicSlots, MaybeArrayOfArray, MaybeArrayOfArrayItem, PartialString } from '../types/utils'
|
|
10
|
+
|
|
11
|
+
const appConfig = _appConfig as AppConfig & { ui: { navigationMenu: Partial<typeof theme> } }
|
|
12
|
+
|
|
13
|
+
const navigationMenu = tv({ extend: tv(theme), ...(appConfig.ui?.navigationMenu || {}) })
|
|
14
|
+
|
|
15
|
+
export interface NavigationMenuChildItem extends Omit<NavigationMenuItem, 'children'> {
|
|
16
|
+
/** Description is only used when `orientation` is `horizontal`. */
|
|
17
|
+
description?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface NavigationMenuItem extends Omit<LinkProps, 'raw' | 'custom'>, Pick<CollapsibleRootProps, 'defaultOpen' | 'open'> {
|
|
21
|
+
label?: string
|
|
22
|
+
icon?: string
|
|
23
|
+
avatar?: AvatarProps
|
|
24
|
+
badge?: string | number | BadgeProps
|
|
25
|
+
trailingIcon?: string
|
|
26
|
+
slot?: string
|
|
27
|
+
value?: string
|
|
28
|
+
children?: NavigationMenuChildItem[]
|
|
29
|
+
onSelect?(e: Event): void
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type NavigationMenuVariants = VariantProps<typeof navigationMenu>
|
|
33
|
+
|
|
34
|
+
export interface NavigationMenuProps<T> extends Pick<NavigationMenuRootProps, 'modelValue' | 'defaultValue' | 'delayDuration' | 'disableClickTrigger' | 'disableHoverTrigger' | 'skipDelayDuration' | 'disablePointerLeaveClose' | 'unmountOnHide'> {
|
|
35
|
+
/**
|
|
36
|
+
* The element or component this component should render as.
|
|
37
|
+
* @defaultValue 'div'
|
|
38
|
+
*/
|
|
39
|
+
as?: any
|
|
40
|
+
/**
|
|
41
|
+
* The icon displayed to open the menu.
|
|
42
|
+
* @defaultValue appConfig.ui.icons.chevronDown
|
|
43
|
+
*/
|
|
44
|
+
trailingIcon?: string
|
|
45
|
+
items?: T
|
|
46
|
+
color?: NavigationMenuVariants['color']
|
|
47
|
+
variant?: NavigationMenuVariants['variant']
|
|
48
|
+
/**
|
|
49
|
+
* The orientation of the menu.
|
|
50
|
+
* @defaultValue 'horizontal'
|
|
51
|
+
*/
|
|
52
|
+
orientation?: NavigationMenuRootProps['orientation']
|
|
53
|
+
/** Display a line next to the active item. */
|
|
54
|
+
highlight?: boolean
|
|
55
|
+
highlightColor?: NavigationMenuVariants['highlightColor']
|
|
56
|
+
/** The content of the menu. */
|
|
57
|
+
content?: Omit<NavigationMenuContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
58
|
+
/**
|
|
59
|
+
* Display an arrow alongside the menu.
|
|
60
|
+
* @defaultValue false
|
|
61
|
+
*/
|
|
62
|
+
arrow?: boolean
|
|
63
|
+
/**
|
|
64
|
+
* The key used to get the label from the item.
|
|
65
|
+
* @defaultValue 'label'
|
|
66
|
+
*/
|
|
67
|
+
labelKey?: string
|
|
68
|
+
class?: any
|
|
69
|
+
ui?: PartialString<typeof navigationMenu.slots>
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface NavigationMenuEmits extends NavigationMenuRootEmits {}
|
|
73
|
+
|
|
74
|
+
type SlotProps<T> = (props: { item: T, index: number, active?: boolean }) => any
|
|
75
|
+
|
|
76
|
+
export type NavigationMenuSlots<T extends { slot?: string }> = {
|
|
77
|
+
'item': SlotProps<T>
|
|
78
|
+
'item-leading': SlotProps<T>
|
|
79
|
+
'item-label': SlotProps<T>
|
|
80
|
+
'item-trailing': SlotProps<T>
|
|
81
|
+
'item-content': SlotProps<T>
|
|
82
|
+
} & DynamicSlots<T, SlotProps<T>>
|
|
83
|
+
|
|
84
|
+
extendDevtoolsMeta({
|
|
85
|
+
ignoreProps: ['items'],
|
|
86
|
+
defaultProps: {
|
|
87
|
+
items: [
|
|
88
|
+
[{
|
|
89
|
+
label: 'Documentation',
|
|
90
|
+
icon: 'i-lucide-book-open',
|
|
91
|
+
badge: 10,
|
|
92
|
+
children: [{
|
|
93
|
+
label: 'Introduction',
|
|
94
|
+
description: 'Fully styled and customizable components for Nuxt.',
|
|
95
|
+
icon: 'i-lucide-house'
|
|
96
|
+
}, {
|
|
97
|
+
label: 'Installation',
|
|
98
|
+
description: 'Learn how to install and configure Nuxt UI in your application.',
|
|
99
|
+
icon: 'i-lucide-cloud-download'
|
|
100
|
+
}, {
|
|
101
|
+
label: 'Theming',
|
|
102
|
+
description: 'Learn how to customize the look and feel of the components.',
|
|
103
|
+
icon: 'i-lucide-swatch-book'
|
|
104
|
+
}, {
|
|
105
|
+
label: 'Shortcuts',
|
|
106
|
+
description: 'Learn how to display and define keyboard shortcuts in your app.',
|
|
107
|
+
icon: 'i-lucide-monitor'
|
|
108
|
+
}]
|
|
109
|
+
}, {
|
|
110
|
+
label: 'GitHub',
|
|
111
|
+
icon: 'i-simple-icons-github',
|
|
112
|
+
to: 'https://github.com/nuxt/ui',
|
|
113
|
+
target: '_blank'
|
|
114
|
+
}, {
|
|
115
|
+
label: 'Help',
|
|
116
|
+
icon: 'i-lucide-circle-help',
|
|
117
|
+
disabled: true
|
|
118
|
+
}]
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
})
|
|
7
122
|
</script>
|
|
8
123
|
|
|
9
|
-
<script setup lang="ts" generic="T extends NavigationMenuItem">
|
|
124
|
+
<script setup lang="ts" generic="T extends MaybeArrayOfArrayItem<I>, I extends MaybeArrayOfArray<NavigationMenuItem>">
|
|
10
125
|
import { computed, toRef } from 'vue'
|
|
11
|
-
import { NavigationMenuRoot, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, useForwardPropsEmits } from '
|
|
12
|
-
import {
|
|
126
|
+
import { NavigationMenuRoot, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, useForwardPropsEmits } from 'reka-ui'
|
|
127
|
+
import { createReusableTemplate } from '@vueuse/core'
|
|
128
|
+
import { get } from '../utils'
|
|
129
|
+
import { pickLinkProps } from '../utils/link'
|
|
13
130
|
import ULinkBase from './LinkBase.vue'
|
|
14
131
|
import ULink from './Link.vue'
|
|
15
132
|
import UAvatar from './Avatar.vue'
|
|
16
133
|
import UIcon from './Icon.vue'
|
|
17
134
|
import UBadge from './Badge.vue'
|
|
18
|
-
import
|
|
135
|
+
import UCollapsible from './Collapsible.vue'
|
|
19
136
|
|
|
20
|
-
const props = withDefaults(defineProps<NavigationMenuProps<
|
|
137
|
+
const props = withDefaults(defineProps<NavigationMenuProps<I>>(), {
|
|
21
138
|
orientation: 'horizontal',
|
|
22
|
-
delayDuration: 0
|
|
139
|
+
delayDuration: 0,
|
|
140
|
+
labelKey: 'label',
|
|
141
|
+
unmountOnHide: true
|
|
23
142
|
})
|
|
24
143
|
const emits = defineEmits<NavigationMenuEmits>()
|
|
25
144
|
const slots = defineSlots<NavigationMenuSlots<T>>()
|
|
26
145
|
|
|
27
|
-
const rootProps = useForwardPropsEmits(
|
|
146
|
+
const rootProps = useForwardPropsEmits(computed(() => ({
|
|
147
|
+
as: props.as,
|
|
148
|
+
modelValue: props.modelValue,
|
|
149
|
+
defaultValue: props.defaultValue,
|
|
150
|
+
delayDuration: props.delayDuration,
|
|
151
|
+
skipDelayDuration: props.skipDelayDuration,
|
|
152
|
+
orientation: props.orientation,
|
|
153
|
+
disableClickTrigger: props.disableClickTrigger,
|
|
154
|
+
disableHoverTrigger: props.disableHoverTrigger,
|
|
155
|
+
disablePointerLeaveClose: props.disablePointerLeaveClose,
|
|
156
|
+
unmountOnHide: props.unmountOnHide
|
|
157
|
+
})), emits)
|
|
158
|
+
|
|
28
159
|
const contentProps = toRef(() => props.content)
|
|
29
160
|
|
|
161
|
+
const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate<{ item: NavigationMenuItem, active?: boolean, index: number }>()
|
|
162
|
+
|
|
30
163
|
const ui = computed(() => navigationMenu({
|
|
31
164
|
orientation: props.orientation,
|
|
32
165
|
color: props.color,
|
|
@@ -39,76 +172,108 @@ const lists = computed(() => props.items?.length ? (Array.isArray(props.items[0]
|
|
|
39
172
|
</script>
|
|
40
173
|
|
|
41
174
|
<template>
|
|
175
|
+
<DefineItemTemplate v-slot="{ item, active, index }">
|
|
176
|
+
<slot :name="item.slot || 'item'" :item="(item as T)" :index="index">
|
|
177
|
+
<slot :name="item.slot ? `${item.slot}-leading` : 'item-leading'" :item="(item as T)" :active="active" :index="index">
|
|
178
|
+
<UAvatar v-if="item.avatar" :size="((props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.linkLeadingAvatar({ class: props.ui?.linkLeadingAvatar, active, disabled: !!item.disabled })" />
|
|
179
|
+
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.linkLeadingIcon({ class: props.ui?.linkLeadingIcon, active, disabled: !!item.disabled })" />
|
|
180
|
+
</slot>
|
|
181
|
+
|
|
182
|
+
<span v-if="get(item, props.labelKey as string) || !!slots[item.slot ? `${item.slot}-label` : 'item-label']" :class="ui.linkLabel({ class: props.ui?.linkLabel })">
|
|
183
|
+
<slot :name="item.slot ? `${item.slot}-label` : 'item-label'" :item="(item as T)" :active="active" :index="index">
|
|
184
|
+
{{ get(item, props.labelKey as string) }}
|
|
185
|
+
</slot>
|
|
186
|
+
|
|
187
|
+
<UIcon v-if="item.target === '_blank'" :name="appConfig.ui.icons.external" :class="ui.linkLabelExternalIcon({ class: props.ui?.linkLabelExternalIcon, active })" />
|
|
188
|
+
</span>
|
|
189
|
+
|
|
190
|
+
<span v-if="item.badge || (orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content'])) || (orientation === 'vertical' && item.children?.length) || item.trailingIcon || !!slots[item.slot ? `${item.slot}-trailing` : 'item-trailing']" :class="ui.linkTrailing({ class: props.ui?.linkTrailing })">
|
|
191
|
+
<slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="(item as T)" :active="active" :index="index">
|
|
192
|
+
<UBadge
|
|
193
|
+
v-if="item.badge"
|
|
194
|
+
color="neutral"
|
|
195
|
+
variant="outline"
|
|
196
|
+
:size="((props.ui?.linkTrailingBadgeSize || ui.linkTrailingBadgeSize()) as BadgeProps['size'])"
|
|
197
|
+
v-bind="(typeof item.badge === 'string' || typeof item.badge === 'number') ? { label: item.badge } : item.badge"
|
|
198
|
+
:class="ui.linkTrailingBadge({ class: props.ui?.linkTrailingBadge })"
|
|
199
|
+
/>
|
|
200
|
+
|
|
201
|
+
<UIcon v-if="(orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content'])) || (orientation === 'vertical' && item.children?.length)" :name="item.trailingIcon || trailingIcon || appConfig.ui.icons.chevronDown" :class="ui.linkTrailingIcon({ class: props.ui?.linkTrailingIcon, active })" />
|
|
202
|
+
<UIcon v-else-if="item.trailingIcon" :name="item.trailingIcon" :class="ui.linkTrailingIcon({ class: props.ui?.linkTrailingIcon, active })" />
|
|
203
|
+
</slot>
|
|
204
|
+
</span>
|
|
205
|
+
</slot>
|
|
206
|
+
</DefineItemTemplate>
|
|
207
|
+
|
|
42
208
|
<NavigationMenuRoot v-bind="rootProps" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
43
209
|
<template v-for="(list, listIndex) in lists" :key="`list-${listIndex}`">
|
|
44
210
|
<NavigationMenuList :class="ui.list({ class: props.ui?.list })">
|
|
45
|
-
<
|
|
211
|
+
<component
|
|
212
|
+
:is="(item.children?.length && orientation === 'vertical') ? UCollapsible : NavigationMenuItem"
|
|
213
|
+
v-for="(item, index) in list"
|
|
214
|
+
:key="`list-${listIndex}-${index}`"
|
|
215
|
+
as="li"
|
|
216
|
+
:value="item.value || String(index)"
|
|
217
|
+
:default-open="item.defaultOpen"
|
|
218
|
+
:unmount-on-hide="(item.children?.length && orientation === 'vertical') ? unmountOnHide : undefined"
|
|
219
|
+
:open="item.open"
|
|
220
|
+
:class="ui.item({ class: props.ui?.item })"
|
|
221
|
+
>
|
|
46
222
|
<ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
|
|
47
223
|
<component
|
|
48
|
-
:is="item.children?.length ? NavigationMenuTrigger : NavigationMenuLink"
|
|
49
|
-
v-bind="item.children?.length ? { disabled: item.disabled } : { active }"
|
|
224
|
+
:is="(orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content'])) ? NavigationMenuTrigger : NavigationMenuLink"
|
|
50
225
|
as-child
|
|
51
226
|
:active="active"
|
|
52
|
-
|
|
227
|
+
:disabled="item.disabled"
|
|
228
|
+
@select="item.onSelect"
|
|
53
229
|
>
|
|
54
230
|
<ULinkBase v-bind="slotProps" :class="ui.link({ class: [props.ui?.link, item.class], active, disabled: !!item.disabled })">
|
|
55
|
-
<
|
|
56
|
-
<slot :name="item.slot ? `${item.slot}-leading`: 'item-leading'" :item="item" :active="active" :index="index">
|
|
57
|
-
<UAvatar v-if="item.avatar" :size="((props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.linkLeadingAvatar({ class: props.ui?.linkLeadingAvatar, active, disabled: !!item.disabled })" />
|
|
58
|
-
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.linkLeadingIcon({ class: props.ui?.linkLeadingIcon, active, disabled: !!item.disabled })" />
|
|
59
|
-
</slot>
|
|
60
|
-
|
|
61
|
-
<span v-if="item.label || !!slots[item.slot ? `${item.slot}-label`: 'item-label']" :class="ui.linkLabel({ class: props.ui?.linkLabel })">
|
|
62
|
-
<slot :name="item.slot ? `${item.slot}-label`: 'item-label'" :item="item" :active="active" :index="index">
|
|
63
|
-
{{ item.label }}
|
|
64
|
-
</slot>
|
|
65
|
-
|
|
66
|
-
<UIcon v-if="item.target === '_blank'" :name="appConfig.ui.icons.external" :class="ui.linkLabelExternalIcon({ class: props.ui?.linkLabelExternalIcon, active })" />
|
|
67
|
-
</span>
|
|
68
|
-
|
|
69
|
-
<span v-if="item.badge || (item.children?.length && orientation === 'horizontal') || !!slots[item.slot ? `${item.slot}-trailing`: 'item-trailing']" :class="ui.linkTrailing({ class: props.ui?.linkTrailing })">
|
|
70
|
-
<slot :name="item.slot ? `${item.slot}-trailing`: 'item-trailing'" :item="item" :active="active" :index="index">
|
|
71
|
-
<UBadge
|
|
72
|
-
v-if="item.badge"
|
|
73
|
-
color="gray"
|
|
74
|
-
variant="outline"
|
|
75
|
-
:size="((props.ui?.linkTrailingBadgeSize || ui.linkTrailingBadgeSize()) as BadgeProps['size'])"
|
|
76
|
-
v-bind="(typeof item.badge === 'string' || typeof item.badge === 'number') ? { label: item.badge } : item.badge"
|
|
77
|
-
:class="ui.linkTrailingBadge({ class: props.ui?.linkTrailingBadge })"
|
|
78
|
-
/>
|
|
79
|
-
<UIcon v-if="item.children?.length && orientation === 'horizontal'" :name="item.trailingIcon || trailingIcon || appConfig.ui.icons.chevronDown" :class="ui.linkTrailingIcon({ class: props.ui?.linkTrailingIcon, active })" />
|
|
80
|
-
</slot>
|
|
81
|
-
</span>
|
|
82
|
-
</slot>
|
|
231
|
+
<ReuseItemTemplate :item="(item as T)" :active="active" :index="index" />
|
|
83
232
|
</ULinkBase>
|
|
84
233
|
</component>
|
|
85
234
|
|
|
86
|
-
<NavigationMenuContent v-if="item.children?.length
|
|
87
|
-
<
|
|
88
|
-
<
|
|
89
|
-
<
|
|
90
|
-
<
|
|
91
|
-
<
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
<
|
|
96
|
-
{
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
235
|
+
<NavigationMenuContent v-if="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content'])" v-bind="contentProps" :class="ui.content({ class: props.ui?.content })">
|
|
236
|
+
<slot :name="item.slot ? `${item.slot}-content` : 'item-content'" :item="(item as T)" :active="active" :index="index">
|
|
237
|
+
<ul :class="ui.childList({ class: props.ui?.childList })">
|
|
238
|
+
<li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="ui.childItem({ class: props.ui?.childItem })">
|
|
239
|
+
<ULink v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
|
|
240
|
+
<NavigationMenuLink as-child :active="childActive" @select="childItem.onSelect">
|
|
241
|
+
<ULinkBase v-bind="childSlotProps" :class="ui.childLink({ class: [props.ui?.childLink, childItem.class], active: childActive })">
|
|
242
|
+
<UIcon v-if="childItem.icon" :name="childItem.icon" :class="ui.childLinkIcon({ class: props.ui?.childLinkIcon, active: childActive })" />
|
|
243
|
+
|
|
244
|
+
<div :class="ui.childLinkWrapper({ class: props.ui?.childLinkWrapper })">
|
|
245
|
+
<p :class="ui.childLinkLabel({ class: props.ui?.childLinkLabel, active: childActive })">
|
|
246
|
+
{{ get(childItem, props.labelKey as string) }}
|
|
247
|
+
|
|
248
|
+
<UIcon v-if="childItem.target === '_blank'" :name="appConfig.ui.icons.external" :class="ui.childLinkLabelExternalIcon({ class: props.ui?.childLinkLabelExternalIcon, active: childActive })" />
|
|
249
|
+
</p>
|
|
250
|
+
<p v-if="childItem.description" :class="ui.childLinkDescription({ class: props.ui?.childLinkDescription, active: childActive })">
|
|
251
|
+
{{ childItem.description }}
|
|
252
|
+
</p>
|
|
253
|
+
</div>
|
|
254
|
+
</ULinkBase>
|
|
255
|
+
</NavigationMenuLink>
|
|
256
|
+
</ULink>
|
|
257
|
+
</li>
|
|
258
|
+
</ul>
|
|
259
|
+
</slot>
|
|
109
260
|
</NavigationMenuContent>
|
|
110
261
|
</ULink>
|
|
111
|
-
|
|
262
|
+
|
|
263
|
+
<template v-if="orientation === 'vertical' && item.children?.length" #content>
|
|
264
|
+
<ul :class="ui.childList({ class: props.ui?.childList })">
|
|
265
|
+
<li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="ui.childItem({ class: props.ui?.childItem })">
|
|
266
|
+
<ULink v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
|
|
267
|
+
<NavigationMenuLink as-child :active="childActive" @select="childItem.onSelect">
|
|
268
|
+
<ULinkBase v-bind="childSlotProps" :class="ui.link({ class: [props.ui?.link, childItem.class], active: childActive, disabled: !!childItem.disabled })">
|
|
269
|
+
<ReuseItemTemplate :item="(childItem as T)" :active="childActive" :index="childIndex" />
|
|
270
|
+
</ULinkBase>
|
|
271
|
+
</NavigationMenuLink>
|
|
272
|
+
</ULink>
|
|
273
|
+
</li>
|
|
274
|
+
</ul>
|
|
275
|
+
</template>
|
|
276
|
+
</component>
|
|
112
277
|
</NavigationMenuList>
|
|
113
278
|
|
|
114
279
|
<div v-if="orientation === 'vertical' && listIndex < lists.length - 1" :class="ui.separator({ class: props.ui?.separator })" />
|
|
@@ -1,30 +1,139 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { tv } from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv } from 'tailwind-variants'
|
|
3
|
+
import type { PaginationRootProps, PaginationRootEmits } from 'reka-ui'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import type { RouteLocationRaw } from '#vue-router'
|
|
6
|
+
import _appConfig from '#build/app.config'
|
|
7
|
+
import theme from '#build/ui/pagination'
|
|
8
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
9
|
+
import type { ButtonProps } from '../types'
|
|
10
|
+
|
|
11
|
+
const appConfig = _appConfig as AppConfig & { ui: { pagination: Partial<typeof theme> } }
|
|
12
|
+
|
|
13
|
+
const pagination = tv({ extend: tv(theme), ...(appConfig.ui?.pagination || {}) })
|
|
14
|
+
|
|
15
|
+
export interface PaginationProps extends Partial<Pick<PaginationRootProps, 'defaultPage' | 'disabled' | 'itemsPerPage' | 'page' | 'showEdges' | 'siblingCount' | 'total'>> {
|
|
16
|
+
/**
|
|
17
|
+
* The element or component this component should render as.
|
|
18
|
+
* @defaultValue 'div'
|
|
19
|
+
*/
|
|
20
|
+
as?: any
|
|
21
|
+
/**
|
|
22
|
+
* The icon to use for the first page control.
|
|
23
|
+
* @defaultValue appConfig.ui.icons.chevronDoubleLeft
|
|
24
|
+
*/
|
|
25
|
+
firstIcon?: string
|
|
26
|
+
/**
|
|
27
|
+
* The icon to use for the previous page control.
|
|
28
|
+
* @defaultValue appConfig.ui.icons.chevronLeft
|
|
29
|
+
*/
|
|
30
|
+
prevIcon?: string
|
|
31
|
+
/**
|
|
32
|
+
* The icon to use for the next page control.
|
|
33
|
+
* @defaultValue appConfig.ui.icons.chevronRight
|
|
34
|
+
*/
|
|
35
|
+
nextIcon?: string
|
|
36
|
+
/**
|
|
37
|
+
* The icon to use for the last page control.
|
|
38
|
+
* @defaultValue appConfig.ui.icons.chevronDoubleRight
|
|
39
|
+
*/
|
|
40
|
+
lastIcon?: string
|
|
41
|
+
/**
|
|
42
|
+
* The icon to use for the ellipsis control.
|
|
43
|
+
* @defaultValue appConfig.ui.icons.ellipsis
|
|
44
|
+
*/
|
|
45
|
+
ellipsisIcon?: string
|
|
46
|
+
/**
|
|
47
|
+
* The color of the pagination controls.
|
|
48
|
+
* @defaultValue 'neutral'
|
|
49
|
+
*/
|
|
50
|
+
color?: ButtonProps['color']
|
|
51
|
+
/**
|
|
52
|
+
* The variant of the pagination controls.
|
|
53
|
+
* @defaultValue 'outline'
|
|
54
|
+
*/
|
|
55
|
+
variant?: ButtonProps['variant']
|
|
56
|
+
/**
|
|
57
|
+
* The color of the active pagination control.
|
|
58
|
+
* @defaultValue 'primary'
|
|
59
|
+
*/
|
|
60
|
+
activeColor?: ButtonProps['color']
|
|
61
|
+
/**
|
|
62
|
+
* The variant of the active pagination control.
|
|
63
|
+
* @defaultValue 'solid'
|
|
64
|
+
*/
|
|
65
|
+
activeVariant?: ButtonProps['variant']
|
|
66
|
+
/**
|
|
67
|
+
* Whether to show the first, previous, next, and last controls.
|
|
68
|
+
* @defaultValue true
|
|
69
|
+
*/
|
|
70
|
+
showControls?: boolean
|
|
71
|
+
size?: ButtonProps['size']
|
|
72
|
+
/**
|
|
73
|
+
* A function to render page controls as links.
|
|
74
|
+
* @param page The page number to navigate to.
|
|
75
|
+
*/
|
|
76
|
+
to?: (page: number) => RouteLocationRaw
|
|
77
|
+
class?: any
|
|
78
|
+
ui?: Partial<typeof pagination.slots>
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface PaginationEmits extends PaginationRootEmits {}
|
|
82
|
+
|
|
83
|
+
export interface PaginationSlots {
|
|
84
|
+
first(props?: {}): any
|
|
85
|
+
prev(props?: {}): any
|
|
86
|
+
next(props?: {}): any
|
|
87
|
+
last(props?: {}): any
|
|
88
|
+
ellipsis(props?: {}): any
|
|
89
|
+
item(props: {
|
|
90
|
+
page: number
|
|
91
|
+
pageCount: number
|
|
92
|
+
item: {
|
|
93
|
+
type: 'ellipsis'
|
|
94
|
+
} | {
|
|
95
|
+
type: 'page'
|
|
96
|
+
value: number
|
|
97
|
+
}
|
|
98
|
+
index: number
|
|
99
|
+
}): any
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
extendDevtoolsMeta({ defaultProps: { total: 50 } })
|
|
7
103
|
</script>
|
|
8
104
|
|
|
9
105
|
<script setup lang="ts">
|
|
10
|
-
import {
|
|
106
|
+
import { computed } from 'vue'
|
|
107
|
+
import { PaginationRoot, PaginationList, PaginationListItem, PaginationFirst, PaginationPrev, PaginationEllipsis, PaginationNext, PaginationLast, useForwardPropsEmits } from 'reka-ui'
|
|
11
108
|
import { reactivePick } from '@vueuse/core'
|
|
12
109
|
import { useAppConfig } from '#imports'
|
|
110
|
+
import { useLocale } from '../composables/useLocale'
|
|
111
|
+
import UButton from './Button.vue'
|
|
13
112
|
|
|
14
113
|
const props = withDefaults(defineProps<PaginationProps>(), {
|
|
15
|
-
|
|
16
|
-
|
|
114
|
+
size: 'md',
|
|
115
|
+
color: 'neutral',
|
|
17
116
|
variant: 'outline',
|
|
117
|
+
activeColor: 'primary',
|
|
18
118
|
activeVariant: 'solid',
|
|
19
|
-
showControls: true
|
|
119
|
+
showControls: true,
|
|
120
|
+
showEdges: false,
|
|
121
|
+
itemsPerPage: 10,
|
|
122
|
+
siblingCount: 2,
|
|
123
|
+
total: 0
|
|
20
124
|
})
|
|
21
125
|
const emits = defineEmits<PaginationEmits>()
|
|
22
126
|
const slots = defineSlots<PaginationSlots>()
|
|
23
127
|
|
|
24
128
|
const appConfig = useAppConfig()
|
|
25
|
-
|
|
129
|
+
const { dir } = useLocale()
|
|
26
130
|
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultPage', 'disabled', 'itemsPerPage', 'page', 'showEdges', 'siblingCount', 'total'), emits)
|
|
27
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
|
+
|
|
28
137
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
29
138
|
const ui = pagination()
|
|
30
139
|
</script>
|
|
@@ -34,12 +143,12 @@ const ui = pagination()
|
|
|
34
143
|
<PaginationList v-slot="{ items }" :class="ui.list({ class: props.ui?.list })">
|
|
35
144
|
<PaginationFirst v-if="showControls || !!slots.first" as-child>
|
|
36
145
|
<slot name="first">
|
|
37
|
-
<UButton :color="color" :variant="variant" :size="size" :icon="firstIcon
|
|
146
|
+
<UButton :color="color" :variant="variant" :size="size" :icon="firstIcon" :to="to?.(1)" />
|
|
38
147
|
</slot>
|
|
39
148
|
</PaginationFirst>
|
|
40
149
|
<PaginationPrev v-if="showControls || !!slots.prev" as-child>
|
|
41
150
|
<slot name="prev">
|
|
42
|
-
<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" />
|
|
43
152
|
</slot>
|
|
44
153
|
</PaginationPrev>
|
|
45
154
|
|
|
@@ -67,12 +176,12 @@ const ui = pagination()
|
|
|
67
176
|
|
|
68
177
|
<PaginationNext v-if="showControls || !!slots.next" as-child>
|
|
69
178
|
<slot name="next">
|
|
70
|
-
<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" />
|
|
71
180
|
</slot>
|
|
72
181
|
</PaginationNext>
|
|
73
182
|
<PaginationLast v-if="showControls || !!slots.last" as-child>
|
|
74
183
|
<slot name="last">
|
|
75
|
-
<UButton :color="color" :variant="variant" :size="size" :icon="lastIcon
|
|
184
|
+
<UButton :color="color" :variant="variant" :size="size" :icon="lastIcon" :to=" to?.(pageCount)" />
|
|
76
185
|
</slot>
|
|
77
186
|
</PaginationLast>
|
|
78
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>
|