@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,26 +1,110 @@
|
|
|
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 { AccordionRootProps, AccordionRootEmits } from 'reka-ui'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/ui/accordion'
|
|
7
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
8
|
+
import type { DynamicSlots } from '../types/utils'
|
|
9
|
+
|
|
10
|
+
const appConfig = _appConfig as AppConfig & { ui: { accordion: Partial<typeof theme> } }
|
|
11
|
+
|
|
12
|
+
const accordion = tv({ extend: tv(theme), ...(appConfig.ui?.accordion || {}) })
|
|
13
|
+
|
|
14
|
+
export interface AccordionItem {
|
|
15
|
+
label?: string
|
|
16
|
+
icon?: string
|
|
17
|
+
trailingIcon?: string
|
|
18
|
+
slot?: string
|
|
19
|
+
content?: string
|
|
20
|
+
/** A unique value for the accordion item. Defaults to the index. */
|
|
21
|
+
value?: string
|
|
22
|
+
disabled?: boolean
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface AccordionProps<T> extends Pick<AccordionRootProps, 'collapsible' | 'defaultValue' | 'modelValue' | 'type' | 'disabled' | 'unmountOnHide'> {
|
|
26
|
+
/**
|
|
27
|
+
* The element or component this component should render as.
|
|
28
|
+
* @defaultValue 'div'
|
|
29
|
+
*/
|
|
30
|
+
as?: any
|
|
31
|
+
items?: T[]
|
|
32
|
+
/**
|
|
33
|
+
* The icon displayed on the right side of the trigger.
|
|
34
|
+
* @defaultValue appConfig.ui.icons.chevronDown
|
|
35
|
+
*/
|
|
36
|
+
trailingIcon?: string
|
|
37
|
+
/**
|
|
38
|
+
* The key used to get the label from the item.
|
|
39
|
+
* @defaultValue 'label'
|
|
40
|
+
*/
|
|
41
|
+
labelKey?: string
|
|
42
|
+
class?: any
|
|
43
|
+
ui?: Partial<typeof accordion.slots>
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface AccordionEmits extends AccordionRootEmits {}
|
|
47
|
+
|
|
48
|
+
type SlotProps<T> = (props: { item: T, index: number, open: boolean }) => any
|
|
49
|
+
|
|
50
|
+
export type AccordionSlots<T extends { slot?: string }> = {
|
|
51
|
+
leading: SlotProps<T>
|
|
52
|
+
default: SlotProps<T>
|
|
53
|
+
trailing: SlotProps<T>
|
|
54
|
+
content: SlotProps<T>
|
|
55
|
+
body: SlotProps<T>
|
|
56
|
+
} & DynamicSlots<T, SlotProps<T>>
|
|
57
|
+
|
|
58
|
+
extendDevtoolsMeta({
|
|
59
|
+
defaultProps: {
|
|
60
|
+
items: [{
|
|
61
|
+
label: 'Getting Started',
|
|
62
|
+
icon: 'i-lucide-info',
|
|
63
|
+
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.'
|
|
64
|
+
}, {
|
|
65
|
+
label: 'Installation',
|
|
66
|
+
icon: 'i-lucide-download',
|
|
67
|
+
disabled: true,
|
|
68
|
+
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.'
|
|
69
|
+
}, {
|
|
70
|
+
label: 'Theming',
|
|
71
|
+
icon: 'i-lucide-pipette',
|
|
72
|
+
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.'
|
|
73
|
+
}, {
|
|
74
|
+
label: 'Layouts',
|
|
75
|
+
icon: 'i-lucide-layout-dashboard',
|
|
76
|
+
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.'
|
|
77
|
+
}, {
|
|
78
|
+
label: 'Components',
|
|
79
|
+
icon: 'i-lucide-layers-3',
|
|
80
|
+
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.'
|
|
81
|
+
}, {
|
|
82
|
+
label: 'Utilities',
|
|
83
|
+
icon: 'i-lucide-wrench',
|
|
84
|
+
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.'
|
|
85
|
+
}]
|
|
86
|
+
}
|
|
87
|
+
})
|
|
7
88
|
</script>
|
|
8
89
|
|
|
9
90
|
<script setup lang="ts" generic="T extends AccordionItem">
|
|
10
91
|
import { computed } from 'vue'
|
|
11
|
-
import { AccordionRoot, AccordionItem, AccordionHeader, AccordionTrigger, AccordionContent, useForwardPropsEmits } from '
|
|
92
|
+
import { AccordionRoot, AccordionItem, AccordionHeader, AccordionTrigger, AccordionContent, useForwardPropsEmits } from 'reka-ui'
|
|
12
93
|
import { reactivePick } from '@vueuse/core'
|
|
13
94
|
import { useAppConfig } from '#imports'
|
|
95
|
+
import { get } from '../utils'
|
|
96
|
+
import UIcon from './Icon.vue'
|
|
14
97
|
|
|
15
98
|
const props = withDefaults(defineProps<AccordionProps<T>>(), {
|
|
16
99
|
type: 'single',
|
|
17
|
-
collapsible: true
|
|
100
|
+
collapsible: true,
|
|
101
|
+
labelKey: 'label'
|
|
18
102
|
})
|
|
19
103
|
const emits = defineEmits<AccordionEmits>()
|
|
20
104
|
const slots = defineSlots<AccordionSlots<T>>()
|
|
21
105
|
|
|
22
106
|
const appConfig = useAppConfig()
|
|
23
|
-
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'collapsible', 'defaultValue', 'disabled', 'modelValue', 'type'), emits)
|
|
107
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'collapsible', 'defaultValue', 'disabled', 'modelValue', 'type', 'unmountOnHide'), emits)
|
|
24
108
|
|
|
25
109
|
const ui = computed(() => accordion({
|
|
26
110
|
disabled: props.disabled
|
|
@@ -43,8 +127,8 @@ const ui = computed(() => accordion({
|
|
|
43
127
|
<UIcon v-if="item.icon" :name="item.icon" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
|
44
128
|
</slot>
|
|
45
129
|
|
|
46
|
-
<span v-if="item.
|
|
47
|
-
<slot :item="item" :index="index" :open="open">{{ item.
|
|
130
|
+
<span v-if="get(item, props.labelKey as string) || !!slots.default" :class="ui.label({ class: props.ui?.label })">
|
|
131
|
+
<slot :item="item" :index="index" :open="open">{{ get(item, props.labelKey as string) }}</slot>
|
|
48
132
|
</span>
|
|
49
133
|
|
|
50
134
|
<slot name="trailing" :item="item" :index="index" :open="open">
|
|
@@ -1,22 +1,81 @@
|
|
|
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/alert'
|
|
6
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
7
|
+
import type { AvatarProps, ButtonProps } from '../types'
|
|
8
|
+
|
|
9
|
+
const appConfig = _appConfig as AppConfig & { ui: { alert: Partial<typeof theme> } }
|
|
10
|
+
|
|
11
|
+
const alert = tv({ extend: tv(theme), ...(appConfig.ui?.alert || {}) })
|
|
12
|
+
|
|
13
|
+
type AlertVariants = VariantProps<typeof alert>
|
|
14
|
+
|
|
15
|
+
export interface AlertProps {
|
|
16
|
+
/**
|
|
17
|
+
* The element or component this component should render as.
|
|
18
|
+
* @defaultValue 'div'
|
|
19
|
+
*/
|
|
20
|
+
as?: any
|
|
21
|
+
title?: string
|
|
22
|
+
description?: string
|
|
23
|
+
icon?: string
|
|
24
|
+
avatar?: AvatarProps
|
|
25
|
+
color?: AlertVariants['color']
|
|
26
|
+
variant?: AlertVariants['variant']
|
|
27
|
+
/**
|
|
28
|
+
* Display a list of actions:
|
|
29
|
+
* - under the title and description if multiline
|
|
30
|
+
* - next to the close button if not multiline
|
|
31
|
+
* `{ size: 'xs' }`{lang="ts-type"}
|
|
32
|
+
*/
|
|
33
|
+
actions?: ButtonProps[]
|
|
34
|
+
/**
|
|
35
|
+
* Display a close button to dismiss the alert.
|
|
36
|
+
* `{ size: 'md', color: 'neutral', variant: 'link' }`{lang="ts-type"}
|
|
37
|
+
* @emits `close`
|
|
38
|
+
* @defaultValue false
|
|
39
|
+
*/
|
|
40
|
+
close?: ButtonProps | boolean
|
|
41
|
+
/**
|
|
42
|
+
* The icon displayed in the close button.
|
|
43
|
+
* @defaultValue appConfig.ui.icons.close
|
|
44
|
+
*/
|
|
45
|
+
closeIcon?: string
|
|
46
|
+
class?: any
|
|
47
|
+
ui?: Partial<typeof alert.slots>
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface AlertEmits {
|
|
51
|
+
(e: 'update:open', value: boolean): void
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface AlertSlots {
|
|
55
|
+
leading(props?: {}): any
|
|
56
|
+
title(props?: {}): any
|
|
57
|
+
description(props?: {}): any
|
|
58
|
+
actions(props?: {}): any
|
|
59
|
+
close(props: { ui: any }): any
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
extendDevtoolsMeta<AlertProps>({ defaultProps: { title: 'Heads up!' } })
|
|
7
63
|
</script>
|
|
8
64
|
|
|
9
65
|
<script setup lang="ts">
|
|
10
66
|
import { computed } from 'vue'
|
|
11
|
-
import { Primitive } from '
|
|
67
|
+
import { Primitive } from 'reka-ui'
|
|
12
68
|
import { useAppConfig } from '#imports'
|
|
69
|
+
import { useLocale } from '../composables/useLocale'
|
|
13
70
|
import UIcon from './Icon.vue'
|
|
14
71
|
import UAvatar from './Avatar.vue'
|
|
72
|
+
import UButton from './Button.vue'
|
|
15
73
|
|
|
16
74
|
const props = defineProps<AlertProps>()
|
|
17
75
|
const emits = defineEmits<AlertEmits>()
|
|
18
76
|
const slots = defineSlots<AlertSlots>()
|
|
19
77
|
|
|
78
|
+
const { t } = useLocale()
|
|
20
79
|
const appConfig = useAppConfig()
|
|
21
80
|
|
|
22
81
|
const multiline = computed(() => !!props.title && !!props.description)
|
|
@@ -65,12 +124,12 @@ const ui = computed(() => alert({
|
|
|
65
124
|
v-if="close"
|
|
66
125
|
:icon="closeIcon || appConfig.ui.icons.close"
|
|
67
126
|
size="md"
|
|
68
|
-
color="
|
|
127
|
+
color="neutral"
|
|
69
128
|
variant="link"
|
|
70
|
-
aria-label="
|
|
129
|
+
:aria-label="t('alert.close')"
|
|
71
130
|
v-bind="typeof close === 'object' ? close : undefined"
|
|
72
131
|
:class="ui.close({ class: props.ui?.close })"
|
|
73
|
-
@click="emits('
|
|
132
|
+
@click="emits('update:open', false)"
|
|
74
133
|
/>
|
|
75
134
|
</slot>
|
|
76
135
|
</div>
|
|
@@ -1,10 +1,29 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ConfigProviderProps, TooltipProviderProps } from 'reka-ui'
|
|
3
|
+
import { localeContextInjectionKey } from '../composables/useLocale'
|
|
4
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
5
|
+
import type { ToasterProps, Locale } from '../types'
|
|
2
6
|
|
|
7
|
+
export interface AppProps extends Omit<ConfigProviderProps, 'useId' | 'dir' | 'locale'> {
|
|
8
|
+
tooltip?: TooltipProviderProps
|
|
9
|
+
toaster?: ToasterProps | null
|
|
10
|
+
locale?: Locale
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface AppSlots {
|
|
14
|
+
default(props?: {}): any
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
name: 'App'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
extendDevtoolsMeta({ ignore: true })
|
|
3
22
|
</script>
|
|
4
23
|
|
|
5
24
|
<script setup lang="ts">
|
|
6
|
-
import { toRef, useId } from 'vue'
|
|
7
|
-
import { ConfigProvider, TooltipProvider, useForwardProps } from '
|
|
25
|
+
import { toRef, useId, provide } from 'vue'
|
|
26
|
+
import { ConfigProvider, TooltipProvider, useForwardProps } from 'reka-ui'
|
|
8
27
|
import { reactivePick } from '@vueuse/core'
|
|
9
28
|
import UToaster from './Toaster.vue'
|
|
10
29
|
import UModalProvider from './ModalProvider.vue'
|
|
@@ -13,17 +32,21 @@ import USlideoverProvider from './SlideoverProvider.vue'
|
|
|
13
32
|
const props = defineProps<AppProps>()
|
|
14
33
|
defineSlots<AppSlots>()
|
|
15
34
|
|
|
16
|
-
const configProviderProps = useForwardProps(reactivePick(props, '
|
|
35
|
+
const configProviderProps = useForwardProps(reactivePick(props, 'scrollBody'))
|
|
17
36
|
const tooltipProps = toRef(() => props.tooltip)
|
|
18
37
|
const toasterProps = toRef(() => props.toaster)
|
|
38
|
+
|
|
39
|
+
const locale = toRef(() => props.locale)
|
|
40
|
+
provide(localeContextInjectionKey, locale)
|
|
19
41
|
</script>
|
|
20
42
|
|
|
21
43
|
<template>
|
|
22
|
-
<ConfigProvider :use-id="() => useId() as string" v-bind="configProviderProps">
|
|
44
|
+
<ConfigProvider :use-id="() => (useId() as string)" :dir="locale?.dir" :locale="locale?.code" v-bind="configProviderProps">
|
|
23
45
|
<TooltipProvider v-bind="tooltipProps">
|
|
24
46
|
<UToaster v-if="toaster !== null" v-bind="toasterProps">
|
|
25
47
|
<slot />
|
|
26
48
|
</UToaster>
|
|
49
|
+
<slot v-else />
|
|
27
50
|
</TooltipProvider>
|
|
28
51
|
|
|
29
52
|
<UModalProvider />
|
|
@@ -1,21 +1,50 @@
|
|
|
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 { AvatarFallbackProps } from 'reka-ui'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
6
|
+
import _appConfig from '#build/app.config'
|
|
7
|
+
import theme from '#build/ui/avatar'
|
|
8
|
+
|
|
9
|
+
const appConfig = _appConfig as AppConfig & { ui: { avatar: Partial<typeof theme> } }
|
|
10
|
+
|
|
11
|
+
const avatar = tv({ extend: tv(theme), ...(appConfig.ui?.avatar || {}) })
|
|
12
|
+
|
|
13
|
+
type AvatarVariants = VariantProps<typeof avatar>
|
|
14
|
+
|
|
15
|
+
export interface AvatarProps extends Pick<AvatarFallbackProps, 'delayMs'> {
|
|
16
|
+
/**
|
|
17
|
+
* The element or component this component should render as.
|
|
18
|
+
* @defaultValue 'span'
|
|
19
|
+
*/
|
|
20
|
+
as?: any
|
|
21
|
+
src?: string
|
|
22
|
+
alt?: string
|
|
23
|
+
icon?: string
|
|
24
|
+
text?: string
|
|
25
|
+
size?: AvatarVariants['size']
|
|
26
|
+
class?: any
|
|
27
|
+
ui?: Partial<typeof avatar.slots>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface AvatarSlots {
|
|
31
|
+
default(props?: {}): any
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
extendDevtoolsMeta<AvatarProps>({ defaultProps: { src: 'https://avatars.githubusercontent.com/u/739984?v=4', alt: 'Benjamin Canac' } })
|
|
7
35
|
</script>
|
|
8
36
|
|
|
9
37
|
<script setup lang="ts">
|
|
10
38
|
import { computed } from 'vue'
|
|
11
|
-
import { AvatarRoot, AvatarImage, AvatarFallback, useForwardProps } from '
|
|
39
|
+
import { AvatarRoot, AvatarImage, AvatarFallback, useForwardProps } from 'reka-ui'
|
|
12
40
|
import { reactivePick } from '@vueuse/core'
|
|
13
41
|
import { useAvatarGroup } from '../composables/useAvatarGroup'
|
|
14
42
|
import UIcon from './Icon.vue'
|
|
43
|
+
import ImageComponent from '#build/ui-image-component'
|
|
15
44
|
|
|
16
45
|
defineOptions({ inheritAttrs: false })
|
|
17
46
|
|
|
18
|
-
const props = defineProps<AvatarProps>()
|
|
47
|
+
const props = withDefaults(defineProps<AvatarProps>(), { as: 'span' })
|
|
19
48
|
|
|
20
49
|
const fallbackProps = useForwardProps(reactivePick(props, 'delayMs'))
|
|
21
50
|
|
|
@@ -27,22 +56,38 @@ const { size } = useAvatarGroup(props)
|
|
|
27
56
|
const ui = computed(() => avatar({
|
|
28
57
|
size: size.value
|
|
29
58
|
}))
|
|
59
|
+
|
|
60
|
+
const sizePx = computed(() => ({
|
|
61
|
+
'3xs': 16,
|
|
62
|
+
'2xs': 20,
|
|
63
|
+
'xs': 24,
|
|
64
|
+
'sm': 28,
|
|
65
|
+
'md': 32,
|
|
66
|
+
'lg': 36,
|
|
67
|
+
'xl': 40,
|
|
68
|
+
'2xl': 44,
|
|
69
|
+
'3xl': 48
|
|
70
|
+
})[props.size || 'md'])
|
|
30
71
|
</script>
|
|
31
72
|
|
|
32
73
|
<template>
|
|
33
|
-
<AvatarRoot :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
74
|
+
<AvatarRoot :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
34
75
|
<AvatarImage
|
|
35
76
|
v-if="src"
|
|
36
|
-
:as="
|
|
77
|
+
:as="ImageComponent"
|
|
37
78
|
:src="src"
|
|
38
79
|
:alt="alt"
|
|
80
|
+
:width="sizePx"
|
|
81
|
+
:height="sizePx"
|
|
39
82
|
v-bind="$attrs"
|
|
40
83
|
:class="ui.image({ class: props.ui?.image })"
|
|
41
84
|
/>
|
|
42
85
|
|
|
43
86
|
<AvatarFallback as-child v-bind="fallbackProps">
|
|
44
|
-
<
|
|
45
|
-
|
|
87
|
+
<slot>
|
|
88
|
+
<UIcon v-if="icon" :name="icon" :class="ui.icon({ class: props.ui?.icon })" />
|
|
89
|
+
<span v-else :class="ui.fallback({ class: props.ui?.fallback })">{{ fallback }}</span>
|
|
90
|
+
</slot>
|
|
46
91
|
</AvatarFallback>
|
|
47
92
|
</AvatarRoot>
|
|
48
93
|
</template>
|
|
@@ -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/avatar-group'
|
|
6
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
7
|
+
|
|
8
|
+
const appConfig = _appConfig as AppConfig & { ui: { avatarGroup: Partial<typeof theme> } }
|
|
9
|
+
|
|
10
|
+
const avatarGroup = tv({ extend: tv(theme), ...(appConfig.ui?.avatarGroup || {}) })
|
|
11
|
+
|
|
12
|
+
type AvatarGroupVariants = VariantProps<typeof avatarGroup>
|
|
13
|
+
|
|
14
|
+
export interface AvatarGroupProps {
|
|
15
|
+
/**
|
|
16
|
+
* The element or component this component should render as.
|
|
17
|
+
* @defaultValue 'div'
|
|
18
|
+
*/
|
|
19
|
+
as?: any
|
|
20
|
+
size?: AvatarGroupVariants['size']
|
|
21
|
+
/**
|
|
22
|
+
* The maximum number of avatars to display.
|
|
23
|
+
*/
|
|
24
|
+
max?: number | string
|
|
25
|
+
class?: any
|
|
26
|
+
ui?: Partial<typeof avatarGroup.slots>
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface AvatarGroupSlots {
|
|
30
|
+
default(props?: {}): any
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
extendDevtoolsMeta({ example: 'AvatarGroupExample' })
|
|
7
34
|
</script>
|
|
8
35
|
|
|
9
36
|
<script setup lang="ts">
|
|
10
37
|
import { computed, provide } from 'vue'
|
|
11
|
-
import { Primitive } from '
|
|
38
|
+
import { Primitive } from 'reka-ui'
|
|
12
39
|
import { avatarGroupInjectionKey } from '../composables/useAvatarGroup'
|
|
13
40
|
import UAvatar from './Avatar.vue'
|
|
14
41
|
|
|
@@ -1,24 +1,76 @@
|
|
|
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/badge'
|
|
6
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
7
|
+
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
8
|
+
import type { AvatarProps } from '../types'
|
|
9
|
+
|
|
10
|
+
const appConfig = _appConfig as AppConfig & { ui: { badge: Partial<typeof theme> } }
|
|
11
|
+
|
|
12
|
+
const badge = tv({ extend: tv(theme), ...(appConfig.ui?.badge || {}) })
|
|
13
|
+
|
|
14
|
+
type BadgeVariants = VariantProps<typeof badge>
|
|
15
|
+
|
|
16
|
+
export interface BadgeProps extends Omit<UseComponentIconsProps, 'loading' | 'loadingIcon'> {
|
|
17
|
+
/**
|
|
18
|
+
* The element or component this component should render as.
|
|
19
|
+
* @defaultValue 'span'
|
|
20
|
+
*/
|
|
21
|
+
as?: any
|
|
22
|
+
label?: string | number
|
|
23
|
+
color?: BadgeVariants['color']
|
|
24
|
+
variant?: BadgeVariants['variant']
|
|
25
|
+
size?: BadgeVariants['size']
|
|
26
|
+
class?: any
|
|
27
|
+
ui?: Partial<typeof badge.slots>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface BadgeSlots {
|
|
31
|
+
leading(props?: {}): any
|
|
32
|
+
default(props?: {}): any
|
|
33
|
+
trailing(props?: {}): any
|
|
34
|
+
}
|
|
7
35
|
</script>
|
|
8
36
|
|
|
9
37
|
<script setup lang="ts">
|
|
10
|
-
import {
|
|
38
|
+
import { computed } from 'vue'
|
|
39
|
+
import { Primitive } from 'reka-ui'
|
|
40
|
+
import { useComponentIcons } from '../composables/useComponentIcons'
|
|
41
|
+
import UIcon from './Icon.vue'
|
|
11
42
|
|
|
12
43
|
const props = withDefaults(defineProps<BadgeProps>(), {
|
|
13
44
|
as: 'span'
|
|
14
45
|
})
|
|
15
46
|
defineSlots<BadgeSlots>()
|
|
47
|
+
|
|
48
|
+
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props)
|
|
49
|
+
|
|
50
|
+
const ui = computed(() => badge({
|
|
51
|
+
color: props.color,
|
|
52
|
+
variant: props.variant,
|
|
53
|
+
size: props.size
|
|
54
|
+
}))
|
|
55
|
+
|
|
56
|
+
extendDevtoolsMeta({ defaultProps: { label: 'Badge' } })
|
|
16
57
|
</script>
|
|
17
58
|
|
|
18
59
|
<template>
|
|
19
|
-
<Primitive :as="as" :class="
|
|
60
|
+
<Primitive :as="as" :class="ui.base({ class: [props.class, props.ui?.base] })">
|
|
61
|
+
<slot name="leading">
|
|
62
|
+
<UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
|
63
|
+
<UAvatar v-else-if="!!avatar" :size="((props.ui?.leadingAvatarSize || ui.leadingAvatarSize()) as AvatarProps['size'])" v-bind="avatar" :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })" />
|
|
64
|
+
</slot>
|
|
65
|
+
|
|
20
66
|
<slot>
|
|
21
|
-
{
|
|
67
|
+
<span v-if="label" :class="ui.label({ class: props.ui?.label })">
|
|
68
|
+
{{ label }}
|
|
69
|
+
</span>
|
|
70
|
+
</slot>
|
|
71
|
+
|
|
72
|
+
<slot name="trailing">
|
|
73
|
+
<UIcon v-if="isTrailing && trailingIconName" :name="trailingIconName" :class="ui.trailingIcon({ class: props.ui?.trailingIcon })" />
|
|
22
74
|
</slot>
|
|
23
75
|
</Primitive>
|
|
24
76
|
</template>
|