@nuxt/ui 3.0.0-alpha.8 → 3.0.0-beta.1
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 +2 -2
- package/.nuxt/ui/alert.ts +122 -95
- package/.nuxt/ui/avatar-group.ts +14 -2
- package/.nuxt/ui/avatar.ts +16 -4
- package/.nuxt/ui/badge.ts +139 -93
- package/.nuxt/ui/breadcrumb.ts +5 -5
- package/.nuxt/ui/button-group.ts +13 -0
- package/.nuxt/ui/button.ts +167 -136
- package/.nuxt/ui/calendar.ts +103 -0
- package/.nuxt/ui/card.ts +27 -1
- package/.nuxt/ui/carousel.ts +9 -7
- package/.nuxt/ui/checkbox.ts +45 -27
- package/.nuxt/ui/chip.ts +44 -15
- package/.nuxt/ui/color-picker.ts +47 -0
- package/.nuxt/ui/command-palette.ts +28 -18
- package/.nuxt/ui/container.ts +1 -1
- package/.nuxt/ui/context-menu.ts +64 -46
- package/.nuxt/ui/drawer.ts +83 -15
- package/.nuxt/ui/dropdown-menu.ts +65 -47
- package/.nuxt/ui/form-field.ts +15 -7
- package/.nuxt/ui/index.ts +7 -1
- package/.nuxt/ui/input-menu.ts +150 -116
- package/.nuxt/ui/input-number.ts +235 -0
- package/.nuxt/ui/input.ts +111 -76
- package/.nuxt/ui/kbd.ts +18 -6
- package/.nuxt/ui/link.ts +3 -3
- package/.nuxt/ui/modal.ts +8 -7
- package/.nuxt/ui/navigation-menu.ts +244 -131
- package/.nuxt/ui/pin-input.ts +171 -0
- package/.nuxt/ui/popover.ts +2 -2
- package/.nuxt/ui/progress.ts +111 -72
- package/.nuxt/ui/radio-group.ts +45 -22
- package/.nuxt/ui/select-menu.ts +127 -96
- package/.nuxt/ui/select.ts +120 -84
- package/.nuxt/ui/separator.ts +60 -31
- package/.nuxt/ui/skeleton.ts +1 -1
- package/.nuxt/ui/slideover.ts +17 -9
- package/.nuxt/ui/slider.ts +61 -38
- package/.nuxt/ui/stepper.ts +202 -0
- package/.nuxt/ui/switch.ts +40 -22
- package/.nuxt/ui/table.ts +49 -31
- package/.nuxt/ui/tabs.ts +101 -73
- package/.nuxt/ui/textarea.ts +111 -76
- package/.nuxt/ui/toast.ts +53 -33
- package/.nuxt/ui/toaster.ts +31 -15
- package/.nuxt/ui/tooltip.ts +2 -2
- package/.nuxt/ui/tree.ts +154 -0
- package/.nuxt/ui.css +92 -0
- package/README.md +69 -18
- package/cli/commands/{init.mjs → make/component.mjs} +16 -4
- package/cli/commands/make/index.mjs +14 -0
- package/cli/commands/make/locale.mjs +64 -0
- package/cli/index.mjs +2 -2
- package/cli/package.json +2 -2
- package/cli/templates.mjs +62 -12
- package/cli/utils.mjs +14 -0
- package/dist/module.cjs +9 -170
- package/dist/module.d.cts +5 -15
- package/dist/module.d.mts +5 -15
- package/dist/module.d.ts +5 -15
- package/dist/module.json +2 -2
- package/dist/module.mjs +12 -167
- package/dist/runtime/components/Accordion.vue +8 -39
- package/dist/runtime/components/Alert.vue +25 -21
- package/dist/runtime/components/App.vue +15 -15
- package/dist/runtime/components/Avatar.vue +33 -21
- package/dist/runtime/components/AvatarGroup.vue +5 -7
- package/dist/runtime/components/Badge.vue +10 -8
- package/dist/runtime/components/Breadcrumb.vue +13 -34
- package/dist/runtime/components/Button.vue +5 -8
- package/dist/runtime/components/ButtonGroup.vue +5 -7
- package/dist/runtime/components/Calendar.vue +194 -0
- package/dist/runtime/components/Card.vue +10 -9
- package/dist/runtime/components/Carousel.vue +26 -17
- package/dist/runtime/components/Checkbox.vue +32 -38
- package/dist/runtime/components/Chip.vue +6 -8
- package/dist/runtime/components/Collapsible.vue +10 -11
- package/dist/runtime/components/ColorPicker.vue +297 -0
- package/dist/runtime/components/CommandPalette.vue +114 -98
- package/dist/runtime/components/Container.vue +4 -7
- package/dist/runtime/components/ContextMenu.vue +16 -69
- package/dist/runtime/components/ContextMenuContent.vue +14 -10
- package/dist/runtime/components/Drawer.vue +23 -12
- package/dist/runtime/components/DropdownMenu.vue +18 -59
- package/dist/runtime/components/DropdownMenuContent.vue +14 -10
- package/dist/runtime/components/Form.vue +78 -49
- package/dist/runtime/components/FormField.vue +28 -15
- package/dist/runtime/components/Icon.vue +1 -1
- package/dist/runtime/components/Input.vue +15 -7
- package/dist/runtime/components/InputMenu.vue +133 -66
- package/dist/runtime/components/InputNumber.vue +197 -0
- package/dist/runtime/components/Kbd.vue +5 -6
- package/dist/runtime/components/Link.vue +24 -13
- package/dist/runtime/components/LinkBase.vue +1 -1
- package/dist/runtime/components/Modal.vue +56 -34
- package/dist/runtime/components/NavigationMenu.vue +129 -112
- package/dist/runtime/components/OverlayProvider.vue +28 -0
- package/dist/runtime/components/Pagination.vue +18 -14
- package/dist/runtime/components/PinInput.vue +95 -0
- package/dist/runtime/components/Popover.vue +28 -14
- package/dist/runtime/components/Progress.vue +28 -12
- package/dist/runtime/components/RadioGroup.vue +9 -12
- package/dist/runtime/components/Select.vue +61 -35
- package/dist/runtime/components/SelectMenu.vue +201 -130
- package/dist/runtime/components/Separator.vue +6 -5
- package/dist/runtime/components/Skeleton.vue +4 -7
- package/dist/runtime/components/Slideover.vue +56 -33
- package/dist/runtime/components/Slider.vue +8 -7
- package/dist/runtime/components/Stepper.vue +170 -0
- package/dist/runtime/components/Switch.vue +19 -23
- package/dist/runtime/components/Table.vue +157 -32
- package/dist/runtime/components/Tabs.vue +12 -31
- package/dist/runtime/components/Textarea.vue +18 -9
- package/dist/runtime/components/Toast.vue +39 -25
- package/dist/runtime/components/Toaster.vue +31 -24
- package/dist/runtime/components/Tooltip.vue +9 -12
- package/dist/runtime/components/Tree.vue +196 -0
- 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 -2
- package/dist/runtime/composables/useFormField.d.ts +11 -4
- package/dist/runtime/composables/useFormField.js +19 -9
- package/dist/runtime/composables/useLocale.d.ts +4 -0
- package/dist/runtime/composables/useLocale.js +10 -0
- package/dist/runtime/composables/useOverlay.d.ts +30 -0
- package/dist/runtime/composables/useOverlay.js +70 -0
- package/dist/runtime/composables/useToast.d.ts +4 -3
- package/dist/runtime/composables/useToast.js +20 -6
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/keyframes.css +1 -1
- package/dist/runtime/locale/ar.d.ts +2 -0
- package/dist/runtime/locale/ar.js +55 -0
- package/dist/runtime/locale/az.d.ts +2 -0
- package/dist/runtime/locale/az.js +54 -0
- package/dist/runtime/locale/bn.d.ts +2 -0
- package/dist/runtime/locale/bn.js +54 -0
- package/dist/runtime/locale/cs.d.ts +2 -0
- package/dist/runtime/locale/cs.js +54 -0
- package/dist/runtime/locale/da.d.ts +2 -0
- package/dist/runtime/locale/da.js +54 -0
- package/dist/runtime/locale/de.d.ts +2 -0
- package/dist/runtime/locale/de.js +54 -0
- package/dist/runtime/locale/el.d.ts +2 -0
- package/dist/runtime/locale/el.js +54 -0
- package/dist/runtime/locale/en.d.ts +2 -0
- package/dist/runtime/locale/en.js +54 -0
- package/dist/runtime/locale/es.d.ts +2 -0
- package/dist/runtime/locale/es.js +54 -0
- package/dist/runtime/locale/et.d.ts +2 -0
- package/dist/runtime/locale/et.js +54 -0
- package/dist/runtime/locale/fa_ir.d.ts +2 -0
- package/dist/runtime/locale/fa_ir.js +55 -0
- package/dist/runtime/locale/fi.d.ts +2 -0
- package/dist/runtime/locale/fi.js +54 -0
- package/dist/runtime/locale/fr.d.ts +2 -0
- package/dist/runtime/locale/fr.js +54 -0
- package/dist/runtime/locale/he.d.ts +2 -0
- package/dist/runtime/locale/he.js +53 -0
- package/dist/runtime/locale/hi.d.ts +2 -0
- package/dist/runtime/locale/hi.js +54 -0
- package/dist/runtime/locale/hu.d.ts +2 -0
- package/dist/runtime/locale/hu.js +54 -0
- package/dist/runtime/locale/id.d.ts +2 -0
- package/dist/runtime/locale/id.js +54 -0
- package/dist/runtime/locale/index.d.ts +34 -0
- package/dist/runtime/locale/index.js +34 -0
- package/dist/runtime/locale/it.d.ts +2 -0
- package/dist/runtime/locale/it.js +54 -0
- package/dist/runtime/locale/ja.d.ts +2 -0
- package/dist/runtime/locale/ja.js +54 -0
- package/dist/runtime/locale/km.d.ts +2 -0
- package/dist/runtime/locale/km.js +54 -0
- package/dist/runtime/locale/ko.d.ts +2 -0
- package/dist/runtime/locale/ko.js +54 -0
- package/dist/runtime/locale/nb_no.d.ts +2 -0
- package/dist/runtime/locale/nb_no.js +54 -0
- package/dist/runtime/locale/nl.d.ts +2 -0
- package/dist/runtime/locale/nl.js +54 -0
- package/dist/runtime/locale/pl.d.ts +2 -0
- package/dist/runtime/locale/pl.js +54 -0
- package/dist/runtime/locale/pt.d.ts +2 -0
- package/dist/runtime/locale/pt.js +54 -0
- package/dist/runtime/locale/pt_br.d.ts +2 -0
- package/dist/runtime/locale/pt_br.js +54 -0
- package/dist/runtime/locale/ru.d.ts +2 -0
- package/dist/runtime/locale/ru.js +54 -0
- package/dist/runtime/locale/sk.d.ts +2 -0
- package/dist/runtime/locale/sk.js +54 -0
- package/dist/runtime/locale/sv.d.ts +2 -0
- package/dist/runtime/locale/sv.js +54 -0
- package/dist/runtime/locale/th.d.ts +2 -0
- package/dist/runtime/locale/th.js +54 -0
- package/dist/runtime/locale/tr.d.ts +2 -0
- package/dist/runtime/locale/tr.js +54 -0
- package/dist/runtime/locale/uk.d.ts +2 -0
- package/dist/runtime/locale/uk.js +54 -0
- package/dist/runtime/locale/vi.d.ts +2 -0
- package/dist/runtime/locale/vi.js +54 -0
- package/dist/runtime/locale/zh_cn.d.ts +2 -0
- package/dist/runtime/locale/zh_cn.js +54 -0
- package/dist/runtime/locale/zh_tw.d.ts +2 -0
- package/dist/runtime/locale/zh_tw.js +54 -0
- package/dist/runtime/plugins/colors.js +8 -5
- package/dist/runtime/types/form.d.ts +29 -15
- package/dist/runtime/types/form.js +2 -2
- package/dist/runtime/types/index.d.ts +8 -0
- package/dist/runtime/types/index.js +8 -0
- package/dist/runtime/types/locale.d.ts +56 -0
- package/dist/runtime/types/locale.js +0 -0
- package/dist/runtime/types/utils.d.ts +7 -3
- package/dist/runtime/utils/form.d.ts +5 -9
- package/dist/runtime/utils/form.js +113 -50
- package/dist/runtime/utils/index.d.ts +1 -1
- package/dist/runtime/utils/index.js +15 -2
- package/dist/runtime/utils/link.d.ts +1 -1
- package/dist/runtime/utils/locale.d.ts +15 -0
- package/dist/runtime/utils/locale.js +25 -0
- package/dist/runtime/utils/tv.d.ts +1 -0
- package/dist/runtime/utils/tv.js +4 -0
- package/dist/runtime/vue/components/Icon.vue +2 -2
- package/dist/runtime/vue/components/Link.vue +87 -23
- package/dist/runtime/vue/composables/useAppConfig.d.ts +1 -0
- package/dist/runtime/vue/composables/useAppConfig.js +2 -0
- package/dist/runtime/vue/plugins/head.d.ts +1 -1
- package/dist/runtime/vue/plugins/head.js +3 -3
- package/dist/runtime/vue/stubs.d.ts +19 -0
- package/dist/runtime/vue/stubs.js +37 -0
- package/dist/shared/{ui.BufKhDiD.mjs → ui.DSPu6Y8j.mjs} +1071 -409
- package/dist/shared/{ui.BU7wzH0D.cjs → ui.DfK2RX6G.cjs} +1074 -409
- package/dist/unplugin.cjs +62 -26
- package/dist/unplugin.d.cts +17 -3
- package/dist/unplugin.d.mts +17 -3
- package/dist/unplugin.d.ts +17 -3
- package/dist/unplugin.mjs +61 -25
- package/dist/vite.cjs +3 -2
- package/dist/vite.d.cts +2 -0
- package/dist/vite.d.mts +2 -0
- package/dist/vite.d.ts +2 -0
- package/dist/vite.mjs +3 -2
- package/package.json +110 -67
- package/dist/chunks/component-meta.cjs +0 -73264
- package/dist/chunks/component-meta.mjs +0 -73262
- package/dist/client/devtools/200.html +0 -1
- package/dist/client/devtools/404.html +0 -1
- 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/Bj9hdafK.js +0 -1
- package/dist/client/devtools/_nuxt/DM3_wAgz.js +0 -62
- package/dist/client/devtools/_nuxt/builds/latest.json +0 -1
- package/dist/client/devtools/_nuxt/builds/meta/e6b425f7-b919-4014-915b-0ea07c316790.json +0 -1
- package/dist/client/devtools/_nuxt/entry.DaJP-ZMB.css +0 -24
- package/dist/client/devtools/_nuxt/error-404.B0Nmv3fV.css +0 -1
- package/dist/client/devtools/_nuxt/error-500.C8fgTxVz.css +0 -1
- package/dist/client/devtools/_nuxt/hKiujHsR.js +0 -1
- package/dist/client/devtools/favicon.svg +0 -1
- package/dist/client/devtools/index.html +0 -1
- package/dist/devtools/runtime/DevtoolsRenderer.vue +0 -53
- package/dist/devtools/runtime/examples/AvatarGroupExample.vue +0 -7
- package/dist/devtools/runtime/examples/ButtonGroupExample.vue +0 -8
- package/dist/devtools/runtime/examples/CardExample.vue +0 -13
- package/dist/devtools/runtime/examples/CarouselExample.vue +0 -13
- package/dist/devtools/runtime/examples/ChipExample.vue +0 -5
- package/dist/devtools/runtime/examples/CollapsibleExample.vue +0 -8
- package/dist/devtools/runtime/examples/CommandPaletteExample.vue +0 -29
- package/dist/devtools/runtime/examples/ContainerExample.vue +0 -5
- package/dist/devtools/runtime/examples/ContextMenuExample.vue +0 -5
- package/dist/devtools/runtime/examples/DrawerExample.vue +0 -8
- package/dist/devtools/runtime/examples/DropdownMenuExample.vue +0 -5
- package/dist/devtools/runtime/examples/FormExample.vue +0 -30
- package/dist/devtools/runtime/examples/FormFieldExample.vue +0 -5
- package/dist/devtools/runtime/examples/LinkExample.vue +0 -5
- package/dist/devtools/runtime/examples/ModalExample.vue +0 -8
- package/dist/devtools/runtime/examples/PopoverExample.vue +0 -8
- package/dist/devtools/runtime/examples/SkeletonExample.vue +0 -3
- package/dist/devtools/runtime/examples/SlideoverExample.vue +0 -8
- package/dist/devtools/runtime/examples/ToasterExample.vue +0 -11
- package/dist/devtools/runtime/examples/TooltipExample.vue +0 -5
- package/dist/runtime/components/ModalProvider.vue +0 -12
- package/dist/runtime/components/SlideoverProvider.vue +0 -12
- package/dist/runtime/composables/extendDevtoolsMeta.d.ts +0 -7
- package/dist/runtime/composables/extendDevtoolsMeta.js +0 -2
- package/dist/runtime/composables/useModal.d.ts +0 -17
- package/dist/runtime/composables/useModal.js +0 -46
- package/dist/runtime/composables/useSlideover.d.ts +0 -17
- package/dist/runtime/composables/useSlideover.js +0 -46
- package/dist/runtime/plugins/modal.d.ts +0 -2
- package/dist/runtime/plugins/modal.js +0 -10
- package/dist/runtime/plugins/slideover.d.ts +0 -2
- package/dist/runtime/plugins/slideover.js +0 -10
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import 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/badge'
|
|
6
|
-
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
7
6
|
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
7
|
+
import { tv } from '../utils/tv'
|
|
8
8
|
import type { AvatarProps } from '../types'
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const appConfigBadge = _appConfig as AppConfig & { ui: { badge: Partial<typeof theme> } }
|
|
11
11
|
|
|
12
|
-
const badge = tv({ extend: tv(theme), ...(
|
|
12
|
+
const badge = tv({ extend: tv(theme), ...(appConfigBadge.ui?.badge || {}) })
|
|
13
13
|
|
|
14
14
|
type BadgeVariants = VariantProps<typeof badge>
|
|
15
15
|
|
|
@@ -36,24 +36,26 @@ export interface BadgeSlots {
|
|
|
36
36
|
|
|
37
37
|
<script setup lang="ts">
|
|
38
38
|
import { computed } from 'vue'
|
|
39
|
-
import { Primitive } from '
|
|
39
|
+
import { Primitive } from 'reka-ui'
|
|
40
|
+
import { useButtonGroup } from '../composables/useButtonGroup'
|
|
40
41
|
import { useComponentIcons } from '../composables/useComponentIcons'
|
|
41
42
|
import UIcon from './Icon.vue'
|
|
43
|
+
import UAvatar from './Avatar.vue'
|
|
42
44
|
|
|
43
45
|
const props = withDefaults(defineProps<BadgeProps>(), {
|
|
44
46
|
as: 'span'
|
|
45
47
|
})
|
|
46
48
|
defineSlots<BadgeSlots>()
|
|
47
49
|
|
|
50
|
+
const { orientation, size: buttonGroupSize } = useButtonGroup<BadgeProps>(props)
|
|
48
51
|
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props)
|
|
49
52
|
|
|
50
53
|
const ui = computed(() => badge({
|
|
51
54
|
color: props.color,
|
|
52
55
|
variant: props.variant,
|
|
53
|
-
size: props.size
|
|
56
|
+
size: buttonGroupSize.value || props.size,
|
|
57
|
+
buttonGroup: orientation.value
|
|
54
58
|
}))
|
|
55
|
-
|
|
56
|
-
extendDevtoolsMeta({ defaultProps: { label: 'Badge' } })
|
|
57
59
|
</script>
|
|
58
60
|
|
|
59
61
|
<template>
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { tv } from 'tailwind-variants'
|
|
3
2
|
import type { AppConfig } from '@nuxt/schema'
|
|
4
3
|
import _appConfig from '#build/app.config'
|
|
5
4
|
import theme from '#build/ui/breadcrumb'
|
|
6
|
-
import {
|
|
5
|
+
import { tv } from '../utils/tv'
|
|
7
6
|
import type { AvatarProps, LinkProps } from '../types'
|
|
8
7
|
import type { DynamicSlots, PartialString } from '../types/utils'
|
|
9
8
|
|
|
10
|
-
const
|
|
9
|
+
const appConfigBreadcrumb = _appConfig as AppConfig & { ui: { breadcrumb: Partial<typeof theme> } }
|
|
11
10
|
|
|
12
|
-
const breadcrumb = tv({ extend: tv(theme), ...(
|
|
11
|
+
const breadcrumb = tv({ extend: tv(theme), ...(appConfigBreadcrumb.ui?.breadcrumb || {}) })
|
|
13
12
|
|
|
14
13
|
export interface BreadcrumbItem extends Omit<LinkProps, 'raw' | 'custom'> {
|
|
15
14
|
label?: string
|
|
@@ -21,7 +20,7 @@ export interface BreadcrumbItem extends Omit<LinkProps, 'raw' | 'custom'> {
|
|
|
21
20
|
export interface BreadcrumbProps<T> {
|
|
22
21
|
/**
|
|
23
22
|
* The element or component this component should render as.
|
|
24
|
-
* @defaultValue '
|
|
23
|
+
* @defaultValue 'nav'
|
|
25
24
|
*/
|
|
26
25
|
as?: any
|
|
27
26
|
items?: T[]
|
|
@@ -48,36 +47,13 @@ export type BreadcrumbSlots<T extends { slot?: string }> = {
|
|
|
48
47
|
'item-trailing': SlotProps<T>
|
|
49
48
|
'separator'(props?: {}): any
|
|
50
49
|
} & 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
|
-
})
|
|
76
50
|
</script>
|
|
77
51
|
|
|
78
52
|
<script setup lang="ts" generic="T extends BreadcrumbItem">
|
|
79
|
-
import {
|
|
53
|
+
import { computed } from 'vue'
|
|
54
|
+
import { Primitive } from 'reka-ui'
|
|
80
55
|
import { useAppConfig } from '#imports'
|
|
56
|
+
import { useLocale } from '../composables/useLocale'
|
|
81
57
|
import { get } from '../utils'
|
|
82
58
|
import { pickLinkProps } from '../utils/link'
|
|
83
59
|
import UIcon from './Icon.vue'
|
|
@@ -86,12 +62,15 @@ import ULinkBase from './LinkBase.vue'
|
|
|
86
62
|
import ULink from './Link.vue'
|
|
87
63
|
|
|
88
64
|
const props = withDefaults(defineProps<BreadcrumbProps<T>>(), {
|
|
65
|
+
as: 'nav',
|
|
89
66
|
labelKey: 'label'
|
|
90
67
|
})
|
|
91
68
|
const slots = defineSlots<BreadcrumbSlots<T>>()
|
|
92
|
-
|
|
69
|
+
const { dir } = useLocale()
|
|
93
70
|
const appConfig = useAppConfig()
|
|
94
71
|
|
|
72
|
+
const separatorIcon = computed(() => props.separatorIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight))
|
|
73
|
+
|
|
95
74
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
96
75
|
const ui = breadcrumb()
|
|
97
76
|
</script>
|
|
@@ -121,9 +100,9 @@ const ui = breadcrumb()
|
|
|
121
100
|
</ULink>
|
|
122
101
|
</li>
|
|
123
102
|
|
|
124
|
-
<li v-if="index < items!.length - 1" role="presentation" :class="ui.separator({ class: props.ui?.separator })">
|
|
103
|
+
<li v-if="index < items!.length - 1" role="presentation" aria-hidden="true" :class="ui.separator({ class: props.ui?.separator })">
|
|
125
104
|
<slot name="separator">
|
|
126
|
-
<UIcon :name="separatorIcon
|
|
105
|
+
<UIcon :name="separatorIcon" :class="ui.separatorIcon({ class: props.ui?.separatorIcon })" />
|
|
127
106
|
</slot>
|
|
128
107
|
</li>
|
|
129
108
|
</template>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import 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'
|
|
6
6
|
import type { LinkProps } from './Link.vue'
|
|
7
7
|
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
8
|
-
import {
|
|
8
|
+
import { tv } from '../utils/tv'
|
|
9
9
|
import type { AvatarProps } from '../types'
|
|
10
10
|
import type { PartialString } from '../types/utils'
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const appConfigButton = _appConfig as AppConfig & { ui: { button: Partial<typeof theme> } }
|
|
13
13
|
|
|
14
|
-
const button = tv({ extend: tv(theme), ...(
|
|
14
|
+
const button = tv({ extend: tv(theme), ...(appConfigButton.ui?.button || {}) })
|
|
15
15
|
|
|
16
16
|
type ButtonVariants = VariantProps<typeof button>
|
|
17
17
|
|
|
@@ -31,9 +31,6 @@ export interface ButtonProps extends UseComponentIconsProps, Omit<LinkProps, 'ra
|
|
|
31
31
|
ui?: PartialString<typeof button.slots>
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
// Injects props to use as default in the devtools playground.
|
|
35
|
-
extendDevtoolsMeta<ButtonProps>({ defaultProps: { label: 'Click me!' } })
|
|
36
|
-
|
|
37
34
|
export interface ButtonSlots {
|
|
38
35
|
leading(props?: {}): any
|
|
39
36
|
default(props?: {}): any
|
|
@@ -43,7 +40,7 @@ export interface ButtonSlots {
|
|
|
43
40
|
|
|
44
41
|
<script setup lang="ts">
|
|
45
42
|
import { type Ref, computed, ref, inject } from 'vue'
|
|
46
|
-
import { useForwardProps } from '
|
|
43
|
+
import { useForwardProps } from 'reka-ui'
|
|
47
44
|
import { useComponentIcons } from '../composables/useComponentIcons'
|
|
48
45
|
import { useButtonGroup } from '../composables/useButtonGroup'
|
|
49
46
|
import { formLoadingInjectionKey } from '../composables/useFormField'
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import 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 {
|
|
6
|
+
import { tv } from '../utils/tv'
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const appConfigButtonGroup = _appConfig as AppConfig & { ui: { buttonGroup: Partial<typeof theme> } }
|
|
9
9
|
|
|
10
|
-
const buttonGroup = tv({ extend: tv(theme), ...(
|
|
10
|
+
const buttonGroup = tv({ extend: tv(theme), ...(appConfigButtonGroup.ui?.buttonGroup) })
|
|
11
11
|
|
|
12
12
|
type ButtonGroupVariants = VariantProps<typeof buttonGroup>
|
|
13
13
|
|
|
@@ -29,13 +29,11 @@ export interface ButtonGroupProps {
|
|
|
29
29
|
export interface ButtonGroupSlots {
|
|
30
30
|
default(props?: {}): any
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
extendDevtoolsMeta({ example: 'ButtonGroupExample' })
|
|
34
32
|
</script>
|
|
35
33
|
|
|
36
34
|
<script setup lang="ts">
|
|
37
35
|
import { provide, computed } from 'vue'
|
|
38
|
-
import { Primitive } from '
|
|
36
|
+
import { Primitive } from 'reka-ui'
|
|
39
37
|
import { buttonGroupInjectionKey } from '../composables/useButtonGroup'
|
|
40
38
|
|
|
41
39
|
const props = withDefaults(defineProps<ButtonGroupProps>(), {
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import 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
|
+
import { tv } from '../utils/tv'
|
|
9
|
+
import type { PartialString } from '../types/utils'
|
|
10
|
+
|
|
11
|
+
const appConfigCalendar = _appConfig as AppConfig & { ui: { calendar: Partial<typeof theme> } }
|
|
12
|
+
|
|
13
|
+
const calendar = tv({ extend: tv(theme), ...(appConfigCalendar.ui?.calendar || {}) })
|
|
14
|
+
|
|
15
|
+
type CalendarVariants = VariantProps<typeof calendar>
|
|
16
|
+
|
|
17
|
+
type CalendarModelValue<R extends boolean = false, M extends boolean = false> = R extends true
|
|
18
|
+
? DateRange
|
|
19
|
+
: M extends true
|
|
20
|
+
? DateValue[]
|
|
21
|
+
: DateValue
|
|
22
|
+
|
|
23
|
+
export interface CalendarProps<R extends boolean, M extends boolean> extends Omit<CalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'> {
|
|
24
|
+
/**
|
|
25
|
+
* The element or component this component should render as.
|
|
26
|
+
* @defaultValue 'div'
|
|
27
|
+
*/
|
|
28
|
+
as?: any
|
|
29
|
+
/**
|
|
30
|
+
* The icon to use for the next year control.
|
|
31
|
+
* @defaultValue appConfig.ui.icons.chevronDoubleRight
|
|
32
|
+
*/
|
|
33
|
+
nextYearIcon?: string
|
|
34
|
+
/**
|
|
35
|
+
* The icon to use for the next month control.
|
|
36
|
+
* @defaultValue appConfig.ui.icons.chevronRight
|
|
37
|
+
*/
|
|
38
|
+
nextMonthIcon?: string
|
|
39
|
+
/**
|
|
40
|
+
* The icon to use for the previous year control.
|
|
41
|
+
* @defaultValue appConfig.ui.icons.chevronDoubleLeft
|
|
42
|
+
*/
|
|
43
|
+
prevYearIcon?: string
|
|
44
|
+
/**
|
|
45
|
+
* The icon to use for the previous month control.
|
|
46
|
+
* @defaultValue appConfig.ui.icons.chevronLeft
|
|
47
|
+
*/
|
|
48
|
+
prevMonthIcon?: string
|
|
49
|
+
color?: CalendarVariants['color']
|
|
50
|
+
size?: CalendarVariants['size']
|
|
51
|
+
/** Whether or not a range of dates can be selected */
|
|
52
|
+
range?: R & boolean
|
|
53
|
+
/** Whether or not multiple dates can be selected */
|
|
54
|
+
multiple?: M & boolean
|
|
55
|
+
/** Show month controls */
|
|
56
|
+
monthControls?: boolean
|
|
57
|
+
/** Show year controls */
|
|
58
|
+
yearControls?: boolean
|
|
59
|
+
defaultValue?: CalendarModelValue<R, M>
|
|
60
|
+
modelValue?: CalendarModelValue<R, M>
|
|
61
|
+
class?: any
|
|
62
|
+
ui?: PartialString<typeof calendar.slots>
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface CalendarEmits<R extends boolean, M extends boolean> extends Omit<CalendarRootEmits & RangeCalendarRootEmits, 'update:modelValue'> {
|
|
66
|
+
'update:modelValue': [date: CalendarModelValue<R, M>]
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface CalendarSlots {
|
|
70
|
+
'heading': (props: { value: string }) => any
|
|
71
|
+
'day': (props: Pick<CalendarCellTriggerProps, 'day'>) => any
|
|
72
|
+
'week-day': (props: { day: string }) => any
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<script setup lang="ts" generic="R extends boolean = false, M extends boolean = false">
|
|
77
|
+
import { computed } from 'vue'
|
|
78
|
+
import { useForwardPropsEmits } from 'reka-ui'
|
|
79
|
+
import { Calendar as SingleCalendar, RangeCalendar } from 'reka-ui/namespaced'
|
|
80
|
+
import { reactiveOmit } from '@vueuse/core'
|
|
81
|
+
import { useAppConfig } from '#imports'
|
|
82
|
+
import { useLocale } from '../composables/useLocale'
|
|
83
|
+
import UButton from './Button.vue'
|
|
84
|
+
|
|
85
|
+
const props = withDefaults(defineProps<CalendarProps<R, M>>(), {
|
|
86
|
+
fixedWeeks: true,
|
|
87
|
+
monthControls: true,
|
|
88
|
+
yearControls: true
|
|
89
|
+
})
|
|
90
|
+
const emits = defineEmits<CalendarEmits<R, M>>()
|
|
91
|
+
defineSlots<CalendarSlots>()
|
|
92
|
+
|
|
93
|
+
const appConfig = useAppConfig()
|
|
94
|
+
const { code: locale, dir, t } = useLocale()
|
|
95
|
+
|
|
96
|
+
const rootProps = useForwardPropsEmits(reactiveOmit(props, 'range', 'modelValue', 'defaultValue', 'color', 'size', 'monthControls', 'yearControls', 'class', 'ui'), emits)
|
|
97
|
+
|
|
98
|
+
const nextYearIcon = computed(() => props.nextYearIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronDoubleLeft : appConfig.ui.icons.chevronDoubleRight))
|
|
99
|
+
const nextMonthIcon = computed(() => props.nextMonthIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight))
|
|
100
|
+
const prevYearIcon = computed(() => props.prevYearIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronDoubleRight : appConfig.ui.icons.chevronDoubleLeft))
|
|
101
|
+
const prevMonthIcon = computed(() => props.prevMonthIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronRight : appConfig.ui.icons.chevronLeft))
|
|
102
|
+
|
|
103
|
+
const ui = computed(() => calendar({
|
|
104
|
+
color: props.color,
|
|
105
|
+
size: props.size
|
|
106
|
+
}))
|
|
107
|
+
|
|
108
|
+
function paginateYear(date: DateValue, sign: -1 | 1) {
|
|
109
|
+
if (sign === -1) {
|
|
110
|
+
return date.subtract({ years: 1 })
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return date.add({ years: 1 })
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const Calendar = computed(() => props.range ? RangeCalendar : SingleCalendar)
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
<template>
|
|
120
|
+
<Calendar.Root
|
|
121
|
+
v-slot="{ weekDays, grid }"
|
|
122
|
+
v-bind="rootProps"
|
|
123
|
+
:model-value="(modelValue as CalendarModelValue<true & false>)"
|
|
124
|
+
:default-value="(defaultValue as CalendarModelValue<true & false>)"
|
|
125
|
+
:locale="locale"
|
|
126
|
+
:dir="dir"
|
|
127
|
+
:class="ui.root({ class: [props.class, props.ui?.root] })"
|
|
128
|
+
>
|
|
129
|
+
<Calendar.Header :class="ui.header({ class: props.ui?.header })">
|
|
130
|
+
<Calendar.Prev v-if="props.yearControls" :prev-page="(date: DateValue) => paginateYear(date, -1)" :aria-label="t('calendar.prevYear')" as-child>
|
|
131
|
+
<UButton :icon="prevYearIcon" :size="props.size" color="neutral" variant="ghost" />
|
|
132
|
+
</Calendar.Prev>
|
|
133
|
+
<Calendar.Prev v-if="props.monthControls" :aria-label="t('calendar.prevMonth')" as-child>
|
|
134
|
+
<UButton :icon="prevMonthIcon" :size="props.size" color="neutral" variant="ghost" />
|
|
135
|
+
</Calendar.Prev>
|
|
136
|
+
<Calendar.Heading v-slot="{ headingValue }" :class="ui.heading({ class: props.ui?.heading })">
|
|
137
|
+
<slot name="heading" :value="headingValue">
|
|
138
|
+
{{ headingValue }}
|
|
139
|
+
</slot>
|
|
140
|
+
</Calendar.Heading>
|
|
141
|
+
<Calendar.Next v-if="props.monthControls" :aria-label="t('calendar.nextMonth')" as-child>
|
|
142
|
+
<UButton :icon="nextMonthIcon" :size="props.size" color="neutral" variant="ghost" />
|
|
143
|
+
</Calendar.Next>
|
|
144
|
+
<Calendar.Next v-if="props.yearControls" :next-page="(date: DateValue) => paginateYear(date, 1)" :aria-label="t('calendar.nextYear')" as-child>
|
|
145
|
+
<UButton :icon="nextYearIcon" :size="props.size" color="neutral" variant="ghost" />
|
|
146
|
+
</Calendar.Next>
|
|
147
|
+
</Calendar.Header>
|
|
148
|
+
<div :class="ui.body({ class: props.ui?.body })">
|
|
149
|
+
<Calendar.Grid
|
|
150
|
+
v-for="month in grid"
|
|
151
|
+
:key="month.value.toString()"
|
|
152
|
+
:class="ui.grid({ class: props.ui?.grid })"
|
|
153
|
+
>
|
|
154
|
+
<Calendar.GridHead>
|
|
155
|
+
<Calendar.GridRow :class="ui.gridWeekDaysRow({ class: props.ui?.gridWeekDaysRow })">
|
|
156
|
+
<Calendar.HeadCell
|
|
157
|
+
v-for="day in weekDays"
|
|
158
|
+
:key="day"
|
|
159
|
+
:class="ui.headCell({ class: props.ui?.headCell })"
|
|
160
|
+
>
|
|
161
|
+
<slot name="week-day" :day="day">
|
|
162
|
+
{{ day }}
|
|
163
|
+
</slot>
|
|
164
|
+
</Calendar.HeadCell>
|
|
165
|
+
</Calendar.GridRow>
|
|
166
|
+
</Calendar.GridHead>
|
|
167
|
+
<Calendar.GridBody :class="ui.gridBody({ class: props.ui?.gridBody })">
|
|
168
|
+
<Calendar.GridRow
|
|
169
|
+
v-for="(weekDates, index) in month.rows"
|
|
170
|
+
:key="`weekDate-${index}`"
|
|
171
|
+
:class="ui.gridRow({ class: props.ui?.gridRow })"
|
|
172
|
+
>
|
|
173
|
+
<Calendar.Cell
|
|
174
|
+
v-for="weekDate in weekDates"
|
|
175
|
+
:key="weekDate.toString()"
|
|
176
|
+
:date="weekDate"
|
|
177
|
+
:class="ui.cell({ class: props.ui?.cell })"
|
|
178
|
+
>
|
|
179
|
+
<Calendar.CellTrigger
|
|
180
|
+
:day="weekDate"
|
|
181
|
+
:month="month.value"
|
|
182
|
+
:class="ui.cellTrigger({ class: props.ui?.cellTrigger })"
|
|
183
|
+
>
|
|
184
|
+
<slot name="day" :day="weekDate">
|
|
185
|
+
{{ weekDate.day }}
|
|
186
|
+
</slot>
|
|
187
|
+
</Calendar.CellTrigger>
|
|
188
|
+
</Calendar.Cell>
|
|
189
|
+
</Calendar.GridRow>
|
|
190
|
+
</Calendar.GridBody>
|
|
191
|
+
</Calendar.Grid>
|
|
192
|
+
</div>
|
|
193
|
+
</Calendar.Root>
|
|
194
|
+
</template>
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import 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/card'
|
|
6
|
-
import {
|
|
6
|
+
import { tv } from '../utils/tv'
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const appConfigCard = _appConfig as AppConfig & { ui: { card: Partial<typeof theme> } }
|
|
9
9
|
|
|
10
|
-
const card = tv({ extend: tv(theme), ...(
|
|
10
|
+
const card = tv({ extend: tv(theme), ...(appConfigCard.ui?.card || {}) })
|
|
11
|
+
|
|
12
|
+
type CardVariants = VariantProps<typeof card>
|
|
11
13
|
|
|
12
14
|
export interface CardProps {
|
|
13
15
|
/**
|
|
@@ -15,6 +17,7 @@ export interface CardProps {
|
|
|
15
17
|
* @defaultValue 'div'
|
|
16
18
|
*/
|
|
17
19
|
as?: any
|
|
20
|
+
variant?: CardVariants['variant']
|
|
18
21
|
class?: any
|
|
19
22
|
ui?: Partial<typeof card.slots>
|
|
20
23
|
}
|
|
@@ -24,18 +27,16 @@ export interface CardSlots {
|
|
|
24
27
|
default(props?: {}): any
|
|
25
28
|
footer(props?: {}): any
|
|
26
29
|
}
|
|
27
|
-
|
|
28
|
-
extendDevtoolsMeta({ example: 'CardExample' })
|
|
29
30
|
</script>
|
|
30
31
|
|
|
31
32
|
<script setup lang="ts">
|
|
32
|
-
import {
|
|
33
|
+
import { computed } from 'vue'
|
|
34
|
+
import { Primitive } from 'reka-ui'
|
|
33
35
|
|
|
34
36
|
const props = defineProps<CardProps>()
|
|
35
37
|
const slots = defineSlots<CardSlots>()
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
const ui = card()
|
|
39
|
+
const ui = computed(() => card({ variant: props.variant }))
|
|
39
40
|
</script>
|
|
40
41
|
|
|
41
42
|
<template>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import type { VariantProps } from 'tailwind-variants'
|
|
3
3
|
import type { AppConfig } from '@nuxt/schema'
|
|
4
|
+
import type { AcceptableValue } from 'reka-ui'
|
|
4
5
|
import type { EmblaCarouselType, EmblaOptionsType, EmblaPluginType } from 'embla-carousel'
|
|
5
6
|
import type { AutoplayOptionsType } from 'embla-carousel-autoplay'
|
|
6
7
|
import type { AutoScrollOptionsType } from 'embla-carousel-auto-scroll'
|
|
@@ -10,17 +11,22 @@ import type { FadeOptionsType } from 'embla-carousel-fade'
|
|
|
10
11
|
import type { WheelGesturesPluginOptions } from 'embla-carousel-wheel-gestures'
|
|
11
12
|
import _appConfig from '#build/app.config'
|
|
12
13
|
import theme from '#build/ui/carousel'
|
|
13
|
-
import {
|
|
14
|
+
import { tv } from '../utils/tv'
|
|
14
15
|
import type { ButtonProps } from '../types'
|
|
15
|
-
import type {
|
|
16
|
+
import type { PartialString } from '../types/utils'
|
|
16
17
|
|
|
17
|
-
const
|
|
18
|
+
const appConfigCarousel = _appConfig as AppConfig & { ui: { carousel: Partial<typeof theme> } }
|
|
18
19
|
|
|
19
|
-
const carousel = tv({ extend: tv(theme), ...(
|
|
20
|
+
const carousel = tv({ extend: tv(theme), ...(appConfigCarousel.ui?.carousel || {}) })
|
|
20
21
|
|
|
21
22
|
type CarouselVariants = VariantProps<typeof carousel>
|
|
22
23
|
|
|
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
|
|
24
30
|
/**
|
|
25
31
|
* Configure the prev button when arrows are enabled.
|
|
26
32
|
* @defaultValue { size: 'md', color: 'neutral', variant: 'link' }
|
|
@@ -90,16 +96,15 @@ export interface CarouselProps<T> extends Omit<EmblaOptionsType, 'axis' | 'conta
|
|
|
90
96
|
export type CarouselSlots<T> = {
|
|
91
97
|
default(props: { item: T, index: number }): any
|
|
92
98
|
}
|
|
93
|
-
|
|
94
|
-
extendDevtoolsMeta({ example: 'CarouselExample' })
|
|
95
99
|
</script>
|
|
96
100
|
|
|
97
101
|
<script setup lang="ts" generic="T extends AcceptableValue">
|
|
98
102
|
import { computed, ref, watch, onMounted } from 'vue'
|
|
99
103
|
import useEmblaCarousel from 'embla-carousel-vue'
|
|
100
|
-
import { useForwardProps } from '
|
|
104
|
+
import { Primitive, useForwardProps } from 'reka-ui'
|
|
101
105
|
import { reactivePick, computedAsync } from '@vueuse/core'
|
|
102
106
|
import { useAppConfig } from '#imports'
|
|
107
|
+
import { useLocale } from '../composables/useLocale'
|
|
103
108
|
import UButton from './Button.vue'
|
|
104
109
|
|
|
105
110
|
const props = withDefaults(defineProps<CarouselProps<T>>(), {
|
|
@@ -134,8 +139,12 @@ const props = withDefaults(defineProps<CarouselProps<T>>(), {
|
|
|
134
139
|
defineSlots<CarouselSlots<T>>()
|
|
135
140
|
|
|
136
141
|
const appConfig = useAppConfig()
|
|
142
|
+
const { dir, t } = useLocale()
|
|
137
143
|
const rootProps = useForwardProps(reactivePick(props, 'active', 'align', 'breakpoints', 'containScroll', 'dragFree', 'dragThreshold', 'duration', 'inViewThreshold', 'loop', 'skipSnaps', 'slidesToScroll', 'startIndex', 'watchDrag', 'watchResize', 'watchSlides', 'watchFocus'))
|
|
138
144
|
|
|
145
|
+
const prevIcon = computed(() => props.prevIcon || (dir.value === 'rtl' ? appConfig.ui.icons.arrowRight : appConfig.ui.icons.arrowLeft))
|
|
146
|
+
const nextIcon = computed(() => props.nextIcon || (dir.value === 'rtl' ? appConfig.ui.icons.arrowLeft : appConfig.ui.icons.arrowRight))
|
|
147
|
+
|
|
139
148
|
const ui = computed(() => carousel({
|
|
140
149
|
orientation: props.orientation
|
|
141
150
|
}))
|
|
@@ -144,8 +153,7 @@ const options = computed<EmblaOptionsType>(() => ({
|
|
|
144
153
|
...(props.fade ? { align: 'center', containScroll: false } : {}),
|
|
145
154
|
...rootProps.value,
|
|
146
155
|
axis: props.orientation === 'horizontal' ? 'x' : 'y',
|
|
147
|
-
|
|
148
|
-
direction: 'ltr'
|
|
156
|
+
direction: dir.value === 'rtl' ? 'rtl' : 'ltr'
|
|
149
157
|
}))
|
|
150
158
|
|
|
151
159
|
const plugins = computedAsync<EmblaPluginType[]>(async () => {
|
|
@@ -250,7 +258,8 @@ defineExpose({
|
|
|
250
258
|
</script>
|
|
251
259
|
|
|
252
260
|
<template>
|
|
253
|
-
<
|
|
261
|
+
<Primitive
|
|
262
|
+
:as="as"
|
|
254
263
|
role="region"
|
|
255
264
|
aria-roledescription="carousel"
|
|
256
265
|
tabindex="0"
|
|
@@ -275,22 +284,22 @@ defineExpose({
|
|
|
275
284
|
<div v-if="arrows" :class="ui.arrows({ class: props.ui?.arrows })">
|
|
276
285
|
<UButton
|
|
277
286
|
:disabled="!canScrollPrev"
|
|
278
|
-
:icon="prevIcon
|
|
287
|
+
:icon="prevIcon"
|
|
279
288
|
size="md"
|
|
280
289
|
color="neutral"
|
|
281
290
|
variant="outline"
|
|
282
|
-
aria-label="
|
|
291
|
+
:aria-label="t('carousel.prev')"
|
|
283
292
|
v-bind="typeof prev === 'object' ? prev : undefined"
|
|
284
293
|
:class="ui.prev({ class: props.ui?.prev })"
|
|
285
294
|
@click="scrollPrev"
|
|
286
295
|
/>
|
|
287
296
|
<UButton
|
|
288
297
|
:disabled="!canScrollNext"
|
|
289
|
-
:icon="nextIcon
|
|
298
|
+
:icon="nextIcon"
|
|
290
299
|
size="md"
|
|
291
300
|
color="neutral"
|
|
292
301
|
variant="outline"
|
|
293
|
-
aria-label="
|
|
302
|
+
:aria-label="t('carousel.next')"
|
|
294
303
|
v-bind="typeof next === 'object' ? next : undefined"
|
|
295
304
|
:class="ui.next({ class: props.ui?.next })"
|
|
296
305
|
@click="scrollNext"
|
|
@@ -300,12 +309,12 @@ defineExpose({
|
|
|
300
309
|
<div v-if="dots" :class="ui.dots({ class: props.ui?.dots })">
|
|
301
310
|
<template v-for="(_, index) in scrollSnaps" :key="index">
|
|
302
311
|
<button
|
|
303
|
-
:aria-label="
|
|
312
|
+
:aria-label="t('carousel.goto', { slide: index + 1 })"
|
|
304
313
|
:class="ui.dot({ class: props.ui?.dot, active: selectedIndex === index })"
|
|
305
314
|
@click="scrollTo(index)"
|
|
306
315
|
/>
|
|
307
316
|
</template>
|
|
308
317
|
</div>
|
|
309
318
|
</div>
|
|
310
|
-
</
|
|
319
|
+
</Primitive>
|
|
311
320
|
</template>
|