@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,25 +1,102 @@
|
|
|
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 { AppConfig } from '@nuxt/schema'
|
|
4
|
+
import _appConfig from '#build/app.config'
|
|
5
|
+
import theme from '#build/ui/breadcrumb'
|
|
6
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
7
|
+
import type { AvatarProps, LinkProps } from '../types'
|
|
8
|
+
import type { DynamicSlots, PartialString } from '../types/utils'
|
|
9
|
+
|
|
10
|
+
const appConfig = _appConfig as AppConfig & { ui: { breadcrumb: Partial<typeof theme> } }
|
|
11
|
+
|
|
12
|
+
const breadcrumb = tv({ extend: tv(theme), ...(appConfig.ui?.breadcrumb || {}) })
|
|
13
|
+
|
|
14
|
+
export interface BreadcrumbItem extends Omit<LinkProps, 'raw' | 'custom'> {
|
|
15
|
+
label?: string
|
|
16
|
+
icon?: string
|
|
17
|
+
avatar?: AvatarProps
|
|
18
|
+
slot?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface BreadcrumbProps<T> {
|
|
22
|
+
/**
|
|
23
|
+
* The element or component this component should render as.
|
|
24
|
+
* @defaultValue 'nav'
|
|
25
|
+
*/
|
|
26
|
+
as?: any
|
|
27
|
+
items?: T[]
|
|
28
|
+
/**
|
|
29
|
+
* The icon to use as a separator.
|
|
30
|
+
* @defaultValue appConfig.ui.icons.chevronRight
|
|
31
|
+
*/
|
|
32
|
+
separatorIcon?: string
|
|
33
|
+
/**
|
|
34
|
+
* The key used to get the label from the item.
|
|
35
|
+
* @defaultValue 'label'
|
|
36
|
+
*/
|
|
37
|
+
labelKey?: string
|
|
38
|
+
class?: any
|
|
39
|
+
ui?: PartialString<typeof breadcrumb.slots>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type SlotProps<T> = (props: { item: T, index: number, active?: boolean }) => any
|
|
43
|
+
|
|
44
|
+
export type BreadcrumbSlots<T extends { slot?: string }> = {
|
|
45
|
+
'item': SlotProps<T>
|
|
46
|
+
'item-leading': SlotProps<T>
|
|
47
|
+
'item-label': SlotProps<T>
|
|
48
|
+
'item-trailing': SlotProps<T>
|
|
49
|
+
'separator'(props?: {}): any
|
|
50
|
+
} & DynamicSlots<T, SlotProps<T>>
|
|
51
|
+
|
|
52
|
+
extendDevtoolsMeta({
|
|
53
|
+
defaultProps: {
|
|
54
|
+
items: [
|
|
55
|
+
{ label: 'Home', to: '/' },
|
|
56
|
+
{
|
|
57
|
+
slot: 'dropdown',
|
|
58
|
+
icon: 'i-lucide-ellipsis',
|
|
59
|
+
children: [{
|
|
60
|
+
label: 'Documentation'
|
|
61
|
+
}, {
|
|
62
|
+
label: 'Themes'
|
|
63
|
+
}, {
|
|
64
|
+
label: 'GitHub'
|
|
65
|
+
}]
|
|
66
|
+
}, {
|
|
67
|
+
label: 'Components',
|
|
68
|
+
disabled: true
|
|
69
|
+
}, {
|
|
70
|
+
label: 'Breadcrumb',
|
|
71
|
+
to: '/components/breadcrumb'
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
})
|
|
7
76
|
</script>
|
|
8
77
|
|
|
9
78
|
<script setup lang="ts" generic="T extends BreadcrumbItem">
|
|
10
|
-
import {
|
|
79
|
+
import { computed } from 'vue'
|
|
80
|
+
import { Primitive } from 'reka-ui'
|
|
11
81
|
import { useAppConfig } from '#imports'
|
|
82
|
+
import { useLocale } from '../composables/useLocale'
|
|
83
|
+
import { get } from '../utils'
|
|
84
|
+
import { pickLinkProps } from '../utils/link'
|
|
12
85
|
import UIcon from './Icon.vue'
|
|
13
86
|
import UAvatar from './Avatar.vue'
|
|
14
87
|
import ULinkBase from './LinkBase.vue'
|
|
15
88
|
import ULink from './Link.vue'
|
|
16
|
-
import { pickLinkProps } from '../utils/link'
|
|
17
89
|
|
|
18
|
-
const props = defineProps<BreadcrumbProps<T>>()
|
|
90
|
+
const props = withDefaults(defineProps<BreadcrumbProps<T>>(), {
|
|
91
|
+
as: 'nav',
|
|
92
|
+
labelKey: 'label'
|
|
93
|
+
})
|
|
19
94
|
const slots = defineSlots<BreadcrumbSlots<T>>()
|
|
20
|
-
|
|
95
|
+
const { dir } = useLocale()
|
|
21
96
|
const appConfig = useAppConfig()
|
|
22
97
|
|
|
98
|
+
const separatorIcon = computed(() => props.separatorIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight))
|
|
99
|
+
|
|
23
100
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
24
101
|
const ui = breadcrumb()
|
|
25
102
|
</script>
|
|
@@ -33,13 +110,13 @@ const ui = breadcrumb()
|
|
|
33
110
|
<ULinkBase v-bind="slotProps" as="span" :aria-current="active && (index === items!.length - 1) ? 'page' : undefined" :class="ui.link({ class: [props.ui?.link, item.class], active: index === items!.length - 1, disabled: !!item.disabled, to: !!item.to })">
|
|
34
111
|
<slot :name="item.slot || 'item'" :item="item" :index="index">
|
|
35
112
|
<slot :name="item.slot ? `${item.slot}-leading`: 'item-leading'" :item="item" :active="index === items!.length - 1" :index="index">
|
|
36
|
-
<
|
|
37
|
-
<
|
|
113
|
+
<UIcon v-if="item.icon" :name="item.icon" :class="ui.linkLeadingIcon({ class: props.ui?.linkLeadingIcon, active: index === items!.length - 1 })" />
|
|
114
|
+
<UAvatar v-else-if="item.avatar" :size="((props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.linkLeadingAvatar({ class: props.ui?.linkLeadingAvatar, active: index === items!.length - 1 })" />
|
|
38
115
|
</slot>
|
|
39
116
|
|
|
40
|
-
<span v-if="item.
|
|
117
|
+
<span v-if="get(item, props.labelKey as string) || !!slots[item.slot ? `${item.slot}-label`: 'item-label']" :class="ui.linkLabel({ class: props.ui?.linkLabel })">
|
|
41
118
|
<slot :name="item.slot ? `${item.slot}-label`: 'item-label'" :item="item" :active="index === items!.length - 1" :index="index">
|
|
42
|
-
{{ item.
|
|
119
|
+
{{ get(item, props.labelKey as string) }}
|
|
43
120
|
</slot>
|
|
44
121
|
</span>
|
|
45
122
|
|
|
@@ -49,9 +126,9 @@ const ui = breadcrumb()
|
|
|
49
126
|
</ULink>
|
|
50
127
|
</li>
|
|
51
128
|
|
|
52
|
-
<li v-if="index < items!.length - 1" role="presentation" :class="ui.separator({ class: props.ui?.separator })">
|
|
129
|
+
<li v-if="index < items!.length - 1" role="presentation" aria-hidden="true" :class="ui.separator({ class: props.ui?.separator })">
|
|
53
130
|
<slot name="separator">
|
|
54
|
-
<UIcon :name="separatorIcon
|
|
131
|
+
<UIcon :name="separatorIcon" :class="ui.separatorIcon({ class: props.ui?.separatorIcon })" />
|
|
55
132
|
</slot>
|
|
56
133
|
</li>
|
|
57
134
|
</template>
|
|
@@ -1,19 +1,57 @@
|
|
|
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 { AppConfig } from '@nuxt/schema'
|
|
4
|
+
import _appConfig from '#build/app.config'
|
|
5
|
+
import theme from '#build/ui/button'
|
|
6
|
+
import type { LinkProps } from './Link.vue'
|
|
7
|
+
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
8
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
9
|
+
import type { AvatarProps } from '../types'
|
|
10
|
+
import type { PartialString } from '../types/utils'
|
|
11
|
+
|
|
12
|
+
const appConfig = _appConfig as AppConfig & { ui: { button: Partial<typeof theme> } }
|
|
13
|
+
|
|
14
|
+
const button = tv({ extend: tv(theme), ...(appConfig.ui?.button || {}) })
|
|
15
|
+
|
|
16
|
+
type ButtonVariants = VariantProps<typeof button>
|
|
17
|
+
|
|
18
|
+
export interface ButtonProps extends UseComponentIconsProps, Omit<LinkProps, 'raw' | 'custom'> {
|
|
19
|
+
label?: string
|
|
20
|
+
color?: ButtonVariants['color']
|
|
21
|
+
variant?: ButtonVariants['variant']
|
|
22
|
+
size?: ButtonVariants['size']
|
|
23
|
+
/** Render the button with equal padding on all sides. */
|
|
24
|
+
square?: boolean
|
|
25
|
+
/** Render the button full width. */
|
|
26
|
+
block?: boolean
|
|
27
|
+
/** Set loading state automatically based on the `@click` promise state */
|
|
28
|
+
loadingAuto?: boolean
|
|
29
|
+
onClick?: ((event: MouseEvent) => void | Promise<void>) | Array<((event: MouseEvent) => void | Promise<void>)>
|
|
30
|
+
class?: any
|
|
31
|
+
ui?: PartialString<typeof button.slots>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Injects props to use as default in the devtools playground.
|
|
35
|
+
extendDevtoolsMeta<ButtonProps>({ defaultProps: { label: 'Click me!' } })
|
|
36
|
+
|
|
37
|
+
export interface ButtonSlots {
|
|
38
|
+
leading(props?: {}): any
|
|
39
|
+
default(props?: {}): any
|
|
40
|
+
trailing(props?: {}): any
|
|
41
|
+
}
|
|
7
42
|
</script>
|
|
8
43
|
|
|
9
44
|
<script setup lang="ts">
|
|
10
|
-
import { computed } from 'vue'
|
|
11
|
-
import { useForwardProps } from '
|
|
45
|
+
import { type Ref, computed, ref, inject } from 'vue'
|
|
46
|
+
import { useForwardProps } from 'reka-ui'
|
|
12
47
|
import { useComponentIcons } from '../composables/useComponentIcons'
|
|
13
48
|
import { useButtonGroup } from '../composables/useButtonGroup'
|
|
49
|
+
import { formLoadingInjectionKey } from '../composables/useFormField'
|
|
50
|
+
import { omit } from '../utils'
|
|
51
|
+
import { pickLinkProps } from '../utils/link'
|
|
14
52
|
import UIcon from './Icon.vue'
|
|
53
|
+
import UAvatar from './Avatar.vue'
|
|
15
54
|
import ULink from './Link.vue'
|
|
16
|
-
import { pickLinkProps } from '../utils/link'
|
|
17
55
|
|
|
18
56
|
const props = defineProps<ButtonProps>()
|
|
19
57
|
const slots = defineSlots<ButtonSlots>()
|
|
@@ -21,13 +59,33 @@ const slots = defineSlots<ButtonSlots>()
|
|
|
21
59
|
const linkProps = useForwardProps(pickLinkProps(props))
|
|
22
60
|
|
|
23
61
|
const { orientation, size: buttonSize } = useButtonGroup<ButtonProps>(props)
|
|
24
|
-
|
|
62
|
+
|
|
63
|
+
const loadingAutoState = ref(false)
|
|
64
|
+
const formLoading = inject<Ref<boolean> | undefined>(formLoadingInjectionKey, undefined)
|
|
65
|
+
|
|
66
|
+
async function onClickWrapper(event: MouseEvent) {
|
|
67
|
+
loadingAutoState.value = true
|
|
68
|
+
const callbacks = Array.isArray(props.onClick) ? props.onClick : [props.onClick]
|
|
69
|
+
try {
|
|
70
|
+
await Promise.all(callbacks.map(fn => fn?.(event)))
|
|
71
|
+
} finally {
|
|
72
|
+
loadingAutoState.value = false
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const isLoading = computed(() => {
|
|
77
|
+
return props.loading || (props.loadingAuto && (loadingAutoState.value || (formLoading?.value && props.type === 'submit')))
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(
|
|
81
|
+
computed(() => ({ ...props, loading: isLoading.value }))
|
|
82
|
+
)
|
|
25
83
|
|
|
26
84
|
const ui = computed(() => button({
|
|
27
85
|
color: props.color,
|
|
28
86
|
variant: props.variant,
|
|
29
87
|
size: buttonSize.value,
|
|
30
|
-
loading:
|
|
88
|
+
loading: isLoading.value,
|
|
31
89
|
block: props.block,
|
|
32
90
|
square: props.square || (!slots.default && !props.label),
|
|
33
91
|
leading: isLeading.value,
|
|
@@ -37,9 +95,17 @@ const ui = computed(() => button({
|
|
|
37
95
|
</script>
|
|
38
96
|
|
|
39
97
|
<template>
|
|
40
|
-
<ULink
|
|
98
|
+
<ULink
|
|
99
|
+
:type="type"
|
|
100
|
+
:disabled="disabled || isLoading"
|
|
101
|
+
:class="ui.base({ class: [props.class, props.ui?.base] })"
|
|
102
|
+
v-bind="omit(linkProps, ['type', 'disabled'])"
|
|
103
|
+
raw
|
|
104
|
+
@click="onClickWrapper"
|
|
105
|
+
>
|
|
41
106
|
<slot name="leading">
|
|
42
107
|
<UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
|
108
|
+
<UAvatar v-else-if="!!avatar" :size="((props.ui?.leadingAvatarSize || ui.leadingAvatarSize()) as AvatarProps['size'])" v-bind="avatar" :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })" />
|
|
43
109
|
</slot>
|
|
44
110
|
|
|
45
111
|
<slot>
|
|
@@ -1,14 +1,41 @@
|
|
|
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 { AppConfig } from '@nuxt/schema'
|
|
4
|
+
import _appConfig from '#build/app.config'
|
|
5
|
+
import theme from '#build/ui/button-group'
|
|
6
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
7
|
+
|
|
8
|
+
const appConfig = _appConfig as AppConfig & { ui: { buttonGroup: Partial<typeof theme> } }
|
|
9
|
+
|
|
10
|
+
const buttonGroup = tv({ extend: tv(theme), ...(appConfig.ui?.buttonGroup) })
|
|
11
|
+
|
|
12
|
+
type ButtonGroupVariants = VariantProps<typeof buttonGroup>
|
|
13
|
+
|
|
14
|
+
export interface ButtonGroupProps {
|
|
15
|
+
/**
|
|
16
|
+
* The element or component this component should render as.
|
|
17
|
+
* @defaultValue 'div'
|
|
18
|
+
*/
|
|
19
|
+
as?: any
|
|
20
|
+
size?: ButtonGroupVariants['size']
|
|
21
|
+
/**
|
|
22
|
+
* The orientation the buttons are laid out.
|
|
23
|
+
* @defaultValue 'horizontal'
|
|
24
|
+
*/
|
|
25
|
+
orientation?: ButtonGroupVariants['orientation']
|
|
26
|
+
class?: any
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ButtonGroupSlots {
|
|
30
|
+
default(props?: {}): any
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
extendDevtoolsMeta({ example: 'ButtonGroupExample' })
|
|
7
34
|
</script>
|
|
8
35
|
|
|
9
36
|
<script setup lang="ts">
|
|
10
37
|
import { provide, computed } from 'vue'
|
|
11
|
-
import { Primitive } from '
|
|
38
|
+
import { Primitive } from 'reka-ui'
|
|
12
39
|
import { buttonGroupInjectionKey } from '../composables/useButtonGroup'
|
|
13
40
|
|
|
14
41
|
const props = withDefaults(defineProps<ButtonGroupProps>(), {
|
|
@@ -23,7 +50,7 @@ provide(buttonGroupInjectionKey, computed(() => ({
|
|
|
23
50
|
</script>
|
|
24
51
|
|
|
25
52
|
<template>
|
|
26
|
-
<Primitive :as="as" :class="buttonGroup({ orientation })">
|
|
53
|
+
<Primitive :as="as" :class="buttonGroup({ orientation, class: props.class })">
|
|
27
54
|
<slot />
|
|
28
55
|
</Primitive>
|
|
29
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>
|
|
@@ -1,13 +1,35 @@
|
|
|
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 { AppConfig } from '@nuxt/schema'
|
|
4
|
+
import _appConfig from '#build/app.config'
|
|
5
|
+
import theme from '#build/ui/card'
|
|
6
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
7
|
+
|
|
8
|
+
const appConfig = _appConfig as AppConfig & { ui: { card: Partial<typeof theme> } }
|
|
9
|
+
|
|
10
|
+
const card = tv({ extend: tv(theme), ...(appConfig.ui?.card || {}) })
|
|
11
|
+
|
|
12
|
+
export interface CardProps {
|
|
13
|
+
/**
|
|
14
|
+
* The element or component this component should render as.
|
|
15
|
+
* @defaultValue 'div'
|
|
16
|
+
*/
|
|
17
|
+
as?: any
|
|
18
|
+
class?: any
|
|
19
|
+
ui?: Partial<typeof card.slots>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface CardSlots {
|
|
23
|
+
header(props?: {}): any
|
|
24
|
+
default(props?: {}): any
|
|
25
|
+
footer(props?: {}): any
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
extendDevtoolsMeta({ example: 'CardExample' })
|
|
7
29
|
</script>
|
|
8
30
|
|
|
9
31
|
<script setup lang="ts">
|
|
10
|
-
import { Primitive } from '
|
|
32
|
+
import { Primitive } from 'reka-ui'
|
|
11
33
|
|
|
12
34
|
const props = defineProps<CardProps>()
|
|
13
35
|
const slots = defineSlots<CardSlots>()
|