@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
package/dist/module.mjs
CHANGED
|
@@ -1,128 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { defineNuxtModule, createResolver, addVitePlugin, addPlugin, addComponentsDir, addImportsDir,
|
|
3
|
-
import { d as defaultOptions, r as resolveColors, a as getDefaultUiConfig, b as addTemplates
|
|
4
|
-
import { addCustomTab } from '@nuxt/devtools-kit';
|
|
5
|
-
import sirv from 'sirv';
|
|
6
|
-
import 'get-port-please';
|
|
7
|
-
import { kebabCase, camelCase } from 'scule';
|
|
8
|
-
import fs from 'node:fs';
|
|
1
|
+
import { defu } from 'defu';
|
|
2
|
+
import { defineNuxtModule, createResolver, addVitePlugin, addPlugin, addComponentsDir, addImportsDir, hasNuxtModule, installModule } from '@nuxt/kit';
|
|
3
|
+
import { d as defaultOptions, r as resolveColors, a as getDefaultUiConfig, b as addTemplates } from './shared/ui.DSPu6Y8j.mjs';
|
|
9
4
|
import '../dist/runtime/utils/index.js';
|
|
10
5
|
import 'node:url';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function extractDevtoolsMeta(code) {
|
|
14
|
-
const match = code.match(/extendDevtoolsMeta(?:<.*?>)?\(/);
|
|
15
|
-
if (!match)
|
|
16
|
-
return null;
|
|
17
|
-
const startIndex = code.indexOf(match[0]) + match[0].length;
|
|
18
|
-
let openBraceCount = 0;
|
|
19
|
-
let closeBraceCount = 0;
|
|
20
|
-
let endIndex = startIndex;
|
|
21
|
-
for (let i = startIndex; i < code.length; i++) {
|
|
22
|
-
if (code[i] === "{")
|
|
23
|
-
openBraceCount++;
|
|
24
|
-
if (code[i] === "}")
|
|
25
|
-
closeBraceCount++;
|
|
26
|
-
if (openBraceCount > 0 && openBraceCount === closeBraceCount) {
|
|
27
|
-
endIndex = i + 1;
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return code.slice(startIndex, endIndex).trim();
|
|
32
|
-
}
|
|
33
|
-
function devtoolsMetaPlugin({ resolve, options, templates }) {
|
|
34
|
-
return {
|
|
35
|
-
name: "ui-devtools-component-meta",
|
|
36
|
-
enforce: "pre",
|
|
37
|
-
async transform(code, id) {
|
|
38
|
-
if (!id.match(/\/runtime\/components\/\w+.vue/))
|
|
39
|
-
return;
|
|
40
|
-
const fileName = id.split("/")[id.split("/").length - 1];
|
|
41
|
-
if (code && fileName) {
|
|
42
|
-
const slug = kebabCase(fileName.replace(/\..*/, ""));
|
|
43
|
-
const match = extractDevtoolsMeta(code);
|
|
44
|
-
if (match) {
|
|
45
|
-
const metaObject = new Function(`return ${match}`)();
|
|
46
|
-
devtoolsComponentMeta[slug] = { meta: { devtools: { ...metaObject } } };
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
code
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
configureServer(server) {
|
|
54
|
-
server.middlewares.use("/__nuxt_ui__/devtools/api/component-meta", async (_req, res) => {
|
|
55
|
-
res.setHeader("Content-Type", "application/json");
|
|
56
|
-
try {
|
|
57
|
-
const componentMeta = await import('./chunks/component-meta.mjs');
|
|
58
|
-
const meta = defu(
|
|
59
|
-
Object.entries(componentMeta.default).reduce((acc, [key, value]) => {
|
|
60
|
-
if (!key.startsWith("U"))
|
|
61
|
-
return acc;
|
|
62
|
-
const name = key.substring(1);
|
|
63
|
-
const slug = kebabCase(name);
|
|
64
|
-
const template = templates?.[camelCase(name)];
|
|
65
|
-
if (devtoolsComponentMeta[slug] === void 0) {
|
|
66
|
-
const path = resolve(`./runtime/components/${name}.vue`);
|
|
67
|
-
const code = fs.readFileSync(path, "utf-8");
|
|
68
|
-
const match = extractDevtoolsMeta(code);
|
|
69
|
-
if (match) {
|
|
70
|
-
const metaObject = new Function(`return ${match}`)();
|
|
71
|
-
devtoolsComponentMeta[slug] = { meta: { devtools: { ...metaObject } } };
|
|
72
|
-
} else {
|
|
73
|
-
devtoolsComponentMeta[slug] = null;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
value.meta.props = value.meta.props.map((prop) => {
|
|
77
|
-
let defaultValue = prop.default ? prop.default : prop?.tags?.find((tag) => tag.name === "defaultValue" && !tag.text?.includes("appConfig"))?.text ?? template?.defaultVariants?.[prop.name];
|
|
78
|
-
if (typeof defaultValue === "string")
|
|
79
|
-
defaultValue = defaultValue?.replaceAll(/["'`]/g, "");
|
|
80
|
-
if (defaultValue === "true")
|
|
81
|
-
defaultValue = true;
|
|
82
|
-
if (defaultValue === "false")
|
|
83
|
-
defaultValue = false;
|
|
84
|
-
if (!Number.isNaN(Number.parseInt(defaultValue)))
|
|
85
|
-
defaultValue = Number.parseInt(defaultValue);
|
|
86
|
-
return {
|
|
87
|
-
...prop,
|
|
88
|
-
default: defaultValue
|
|
89
|
-
};
|
|
90
|
-
});
|
|
91
|
-
const label = key.replace(/^U/, options.prefix ?? "U");
|
|
92
|
-
acc[kebabCase(key.replace(/^U/, ""))] = { ...value, label, slug };
|
|
93
|
-
return acc;
|
|
94
|
-
}, {}),
|
|
95
|
-
devtoolsComponentMeta
|
|
96
|
-
);
|
|
97
|
-
res.end(JSON.stringify(meta));
|
|
98
|
-
} catch (error) {
|
|
99
|
-
console.error(`Failed to fetch component meta`, error);
|
|
100
|
-
res.statusCode = 500;
|
|
101
|
-
res.end(JSON.stringify({ error: "Failed to fetch component meta" }));
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
server.middlewares.use("/__nuxt_ui__/devtools/api/component-example", async (req, res) => {
|
|
105
|
-
const query = new URL(req.url, "http://localhost").searchParams;
|
|
106
|
-
const name = query.get("component");
|
|
107
|
-
if (!name) {
|
|
108
|
-
res.statusCode = 400;
|
|
109
|
-
res.end(JSON.stringify({ error: "Component name is required" }));
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
try {
|
|
113
|
-
const path = resolve(`./devtools/runtime/examples/${name}.vue`);
|
|
114
|
-
const source = fs.readFileSync(path, "utf-8");
|
|
115
|
-
res.setHeader("Content-Type", "application/json");
|
|
116
|
-
res.end(JSON.stringify({ component: name, source }));
|
|
117
|
-
} catch (error) {
|
|
118
|
-
console.error(`Failed to read component source for ${name}:`, error);
|
|
119
|
-
res.statusCode = 500;
|
|
120
|
-
res.end(JSON.stringify({ error: "Failed to read component source" }));
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
}
|
|
6
|
+
import 'scule';
|
|
7
|
+
import 'tailwindcss/colors';
|
|
126
8
|
|
|
127
9
|
const module = defineNuxtModule({
|
|
128
10
|
meta: {
|
|
@@ -131,7 +13,7 @@ const module = defineNuxtModule({
|
|
|
131
13
|
compatibility: {
|
|
132
14
|
nuxt: ">=3.13.1"
|
|
133
15
|
},
|
|
134
|
-
docs: "https://ui3.nuxt.dev/getting-started/installation"
|
|
16
|
+
docs: "https://ui3.nuxt.dev/getting-started/installation/nuxt"
|
|
135
17
|
},
|
|
136
18
|
defaults: defaultOptions,
|
|
137
19
|
async setup(options, nuxt) {
|
|
@@ -140,7 +22,7 @@ const module = defineNuxtModule({
|
|
|
140
22
|
options.theme.colors = resolveColors(options.theme.colors);
|
|
141
23
|
nuxt.options.ui = options;
|
|
142
24
|
nuxt.options.alias["#ui"] = resolve("./runtime");
|
|
143
|
-
nuxt.options.appConfig.ui = defu
|
|
25
|
+
nuxt.options.appConfig.ui = defu(nuxt.options.appConfig.ui || {}, getDefaultUiConfig(options.theme.colors));
|
|
144
26
|
nuxt.options.app.rootAttrs = nuxt.options.app.rootAttrs || {};
|
|
145
27
|
nuxt.options.app.rootAttrs.class = [nuxt.options.app.rootAttrs.class, "isolate"].filter(Boolean).join(" ");
|
|
146
28
|
if (nuxt.options.builder === "@nuxt/vite-builder") {
|
|
@@ -149,23 +31,21 @@ const module = defineNuxtModule({
|
|
|
149
31
|
} else {
|
|
150
32
|
nuxt.options.postcss.plugins["@tailwindcss/postcss"] = {};
|
|
151
33
|
}
|
|
152
|
-
async function registerModule(name, options2) {
|
|
34
|
+
async function registerModule(name, key, options2) {
|
|
153
35
|
if (!hasNuxtModule(name)) {
|
|
154
36
|
await installModule(name, options2);
|
|
155
37
|
} else {
|
|
156
|
-
nuxt.options[
|
|
38
|
+
nuxt.options[key] = defu(nuxt.options[key], options2);
|
|
157
39
|
}
|
|
158
40
|
}
|
|
159
|
-
await registerModule("@nuxt/icon", { cssLayer: "components" });
|
|
41
|
+
await registerModule("@nuxt/icon", "icon", { cssLayer: "components" });
|
|
160
42
|
if (options.fonts) {
|
|
161
|
-
await registerModule("@nuxt/fonts", { experimental: { processCSSVariables: true } });
|
|
43
|
+
await registerModule("@nuxt/fonts", "fonts", { experimental: { processCSSVariables: true } });
|
|
162
44
|
}
|
|
163
45
|
if (options.colorMode) {
|
|
164
|
-
await registerModule("@nuxtjs/color-mode", { classSuffix: "", disableTransition: true });
|
|
46
|
+
await registerModule("@nuxtjs/color-mode", "colorMode", { classSuffix: "", disableTransition: true });
|
|
165
47
|
}
|
|
166
48
|
addPlugin({ src: resolve("./runtime/plugins/colors") });
|
|
167
|
-
addPlugin({ src: resolve("./runtime/plugins/modal") });
|
|
168
|
-
addPlugin({ src: resolve("./runtime/plugins/slideover") });
|
|
169
49
|
addComponentsDir({
|
|
170
50
|
path: resolve("./runtime/components"),
|
|
171
51
|
prefix: options.prefix,
|
|
@@ -173,41 +53,6 @@ const module = defineNuxtModule({
|
|
|
173
53
|
});
|
|
174
54
|
addImportsDir(resolve("./runtime/composables"));
|
|
175
55
|
addTemplates(options, nuxt, resolve);
|
|
176
|
-
nuxt.options.vite = defu$1(nuxt.options?.vite, { optimizeDeps: { include: ["fast-deep-equal"] } });
|
|
177
|
-
if (nuxt.options.dev && nuxt.options.devtools.enabled && options.devtools?.enabled) {
|
|
178
|
-
const templates = buildTemplates(options);
|
|
179
|
-
nuxt.options.vite = defu$1(nuxt.options?.vite, { plugins: [devtoolsMetaPlugin({ resolve, templates, options })] });
|
|
180
|
-
{
|
|
181
|
-
nuxt.hook("vite:serverCreated", async (server) => {
|
|
182
|
-
server.middlewares.use("/__nuxt_ui__/devtools", sirv(resolve("../dist/client/devtools"), {
|
|
183
|
-
single: true,
|
|
184
|
-
dev: true
|
|
185
|
-
}));
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
nuxt.options.routeRules = defu$1(nuxt.options.routeRules, { "/__nuxt_ui__/**": { ssr: false } });
|
|
189
|
-
extendPages((pages) => {
|
|
190
|
-
pages.unshift({
|
|
191
|
-
name: "ui-devtools",
|
|
192
|
-
path: "/__nuxt_ui__/components/:slug",
|
|
193
|
-
file: resolve("./devtools/runtime/DevtoolsRenderer.vue"),
|
|
194
|
-
meta: {
|
|
195
|
-
// https://github.com/nuxt/nuxt/pull/29366
|
|
196
|
-
// isolate: true
|
|
197
|
-
layout: false
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
});
|
|
201
|
-
addCustomTab({
|
|
202
|
-
name: "nuxt-ui",
|
|
203
|
-
title: "Nuxt UI",
|
|
204
|
-
icon: "/__nuxt_ui__/devtools/favicon.svg",
|
|
205
|
-
view: {
|
|
206
|
-
type: "iframe",
|
|
207
|
-
src: "/__nuxt_ui__/devtools"
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
56
|
}
|
|
212
57
|
});
|
|
213
58
|
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import type { AccordionRootProps, AccordionRootEmits } from 'radix-vue'
|
|
2
|
+
import type { AccordionRootProps, AccordionRootEmits } from 'reka-ui'
|
|
4
3
|
import type { AppConfig } from '@nuxt/schema'
|
|
5
4
|
import _appConfig from '#build/app.config'
|
|
6
5
|
import theme from '#build/ui/accordion'
|
|
7
|
-
import {
|
|
6
|
+
import { tv } from '../utils/tv'
|
|
8
7
|
import type { DynamicSlots } from '../types/utils'
|
|
9
8
|
|
|
10
|
-
const
|
|
9
|
+
const appConfigAccordion = _appConfig as AppConfig & { ui: { accordion: Partial<typeof theme> } }
|
|
11
10
|
|
|
12
|
-
const accordion = tv({ extend: tv(theme), ...(
|
|
11
|
+
const accordion = tv({ extend: tv(theme), ...(appConfigAccordion.ui?.accordion || {}) })
|
|
13
12
|
|
|
14
13
|
export interface AccordionItem {
|
|
15
14
|
label?: string
|
|
@@ -22,7 +21,7 @@ export interface AccordionItem {
|
|
|
22
21
|
disabled?: boolean
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
export interface AccordionProps<T> extends Pick<AccordionRootProps, 'collapsible' | 'defaultValue' | 'modelValue' | 'type' | 'disabled'> {
|
|
24
|
+
export interface AccordionProps<T> extends Pick<AccordionRootProps, 'collapsible' | 'defaultValue' | 'modelValue' | 'type' | 'disabled' | 'unmountOnHide'> {
|
|
26
25
|
/**
|
|
27
26
|
* The element or component this component should render as.
|
|
28
27
|
* @defaultValue 'div'
|
|
@@ -54,42 +53,11 @@ export type AccordionSlots<T extends { slot?: string }> = {
|
|
|
54
53
|
content: SlotProps<T>
|
|
55
54
|
body: SlotProps<T>
|
|
56
55
|
} & 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
|
-
})
|
|
88
56
|
</script>
|
|
89
57
|
|
|
90
58
|
<script setup lang="ts" generic="T extends AccordionItem">
|
|
91
59
|
import { computed } from 'vue'
|
|
92
|
-
import { AccordionRoot, AccordionItem, AccordionHeader, AccordionTrigger, AccordionContent, useForwardPropsEmits } from '
|
|
60
|
+
import { AccordionRoot, AccordionItem, AccordionHeader, AccordionTrigger, AccordionContent, useForwardPropsEmits } from 'reka-ui'
|
|
93
61
|
import { reactivePick } from '@vueuse/core'
|
|
94
62
|
import { useAppConfig } from '#imports'
|
|
95
63
|
import { get } from '../utils'
|
|
@@ -98,13 +66,14 @@ import UIcon from './Icon.vue'
|
|
|
98
66
|
const props = withDefaults(defineProps<AccordionProps<T>>(), {
|
|
99
67
|
type: 'single',
|
|
100
68
|
collapsible: true,
|
|
69
|
+
unmountOnHide: true,
|
|
101
70
|
labelKey: 'label'
|
|
102
71
|
})
|
|
103
72
|
const emits = defineEmits<AccordionEmits>()
|
|
104
73
|
const slots = defineSlots<AccordionSlots<T>>()
|
|
105
74
|
|
|
106
75
|
const appConfig = useAppConfig()
|
|
107
|
-
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'collapsible', 'defaultValue', 'disabled', 'modelValue', 'type'), emits)
|
|
76
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'collapsible', 'defaultValue', 'disabled', 'modelValue', 'type', 'unmountOnHide'), emits)
|
|
108
77
|
|
|
109
78
|
const ui = computed(() => accordion({
|
|
110
79
|
disabled: props.disabled
|
|
@@ -1,14 +1,14 @@
|
|
|
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/alert'
|
|
6
|
-
import {
|
|
6
|
+
import { tv } from '../utils/tv'
|
|
7
7
|
import type { AvatarProps, ButtonProps } from '../types'
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const appConfigAlert = _appConfig as AppConfig & { ui: { alert: Partial<typeof theme> } }
|
|
10
10
|
|
|
11
|
-
const alert = tv({ extend: tv(theme), ...(
|
|
11
|
+
const alert = tv({ extend: tv(theme), ...(appConfigAlert.ui?.alert || {}) })
|
|
12
12
|
|
|
13
13
|
type AlertVariants = VariantProps<typeof alert>
|
|
14
14
|
|
|
@@ -24,19 +24,21 @@ export interface AlertProps {
|
|
|
24
24
|
avatar?: AvatarProps
|
|
25
25
|
color?: AlertVariants['color']
|
|
26
26
|
variant?: AlertVariants['variant']
|
|
27
|
+
orientation?: AlertVariants['orientation']
|
|
27
28
|
/**
|
|
28
29
|
* Display a list of actions:
|
|
29
|
-
* - under the title and description
|
|
30
|
-
* - next to the close button
|
|
30
|
+
* - under the title and description when orientation is `vertical`
|
|
31
|
+
* - next to the close button when orientation is `horizontal`
|
|
32
|
+
* `{ size: 'xs' }`{lang="ts-type"}
|
|
31
33
|
*/
|
|
32
34
|
actions?: ButtonProps[]
|
|
33
35
|
/**
|
|
34
36
|
* Display a close button to dismiss the alert.
|
|
35
37
|
* `{ size: 'md', color: 'neutral', variant: 'link' }`{lang="ts-type"}
|
|
36
|
-
* @emits
|
|
38
|
+
* @emits 'update:open'
|
|
37
39
|
* @defaultValue false
|
|
38
40
|
*/
|
|
39
|
-
close?:
|
|
41
|
+
close?: boolean | Partial<ButtonProps>
|
|
40
42
|
/**
|
|
41
43
|
* The icon displayed in the close button.
|
|
42
44
|
* @defaultValue appConfig.ui.icons.close
|
|
@@ -57,34 +59,36 @@ export interface AlertSlots {
|
|
|
57
59
|
actions(props?: {}): any
|
|
58
60
|
close(props: { ui: any }): any
|
|
59
61
|
}
|
|
60
|
-
|
|
61
|
-
extendDevtoolsMeta<AlertProps>({ defaultProps: { title: 'Heads up!' } })
|
|
62
62
|
</script>
|
|
63
63
|
|
|
64
64
|
<script setup lang="ts">
|
|
65
65
|
import { computed } from 'vue'
|
|
66
|
-
import { Primitive } from '
|
|
66
|
+
import { Primitive } from 'reka-ui'
|
|
67
67
|
import { useAppConfig } from '#imports'
|
|
68
|
+
import { useLocale } from '../composables/useLocale'
|
|
68
69
|
import UIcon from './Icon.vue'
|
|
69
70
|
import UAvatar from './Avatar.vue'
|
|
70
71
|
import UButton from './Button.vue'
|
|
71
72
|
|
|
72
|
-
const props = defineProps<AlertProps>()
|
|
73
|
+
const props = withDefaults(defineProps<AlertProps>(), {
|
|
74
|
+
orientation: 'vertical'
|
|
75
|
+
})
|
|
73
76
|
const emits = defineEmits<AlertEmits>()
|
|
74
77
|
const slots = defineSlots<AlertSlots>()
|
|
75
78
|
|
|
79
|
+
const { t } = useLocale()
|
|
76
80
|
const appConfig = useAppConfig()
|
|
77
81
|
|
|
78
|
-
const multiline = computed(() => !!props.title && !!props.description)
|
|
79
|
-
|
|
80
82
|
const ui = computed(() => alert({
|
|
81
83
|
color: props.color,
|
|
82
|
-
variant: props.variant
|
|
84
|
+
variant: props.variant,
|
|
85
|
+
orientation: props.orientation,
|
|
86
|
+
title: !!props.title || !!slots.title
|
|
83
87
|
}))
|
|
84
88
|
</script>
|
|
85
89
|
|
|
86
90
|
<template>
|
|
87
|
-
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root]
|
|
91
|
+
<Primitive :as="as" :data-orientation="orientation" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
88
92
|
<slot name="leading">
|
|
89
93
|
<UAvatar v-if="avatar" :size="((props.ui?.avatarSize || ui.avatarSize()) as AvatarProps['size'])" v-bind="avatar" :class="ui.avatar({ class: props.ui?.avatar })" />
|
|
90
94
|
<UIcon v-else-if="icon" :name="icon" :class="ui.icon({ class: props.ui?.icon })" />
|
|
@@ -102,15 +106,15 @@ const ui = computed(() => alert({
|
|
|
102
106
|
</slot>
|
|
103
107
|
</div>
|
|
104
108
|
|
|
105
|
-
<div v-if="
|
|
109
|
+
<div v-if="orientation === 'vertical' && actions?.length" :class="ui.actions({ class: props.ui?.actions })">
|
|
106
110
|
<slot name="actions">
|
|
107
111
|
<UButton v-for="(action, index) in actions" :key="index" size="xs" v-bind="action" />
|
|
108
112
|
</slot>
|
|
109
113
|
</div>
|
|
110
114
|
</div>
|
|
111
115
|
|
|
112
|
-
<div v-if="(
|
|
113
|
-
<template v-if="
|
|
116
|
+
<div v-if="(orientation === 'horizontal' && actions?.length) || close" :class="ui.actions({ class: props.ui?.actions, orientation: 'horizontal' })">
|
|
117
|
+
<template v-if="orientation === 'horizontal' && actions?.length">
|
|
114
118
|
<slot name="actions">
|
|
115
119
|
<UButton v-for="(action, index) in actions" :key="index" size="xs" v-bind="action" />
|
|
116
120
|
</slot>
|
|
@@ -123,8 +127,8 @@ const ui = computed(() => alert({
|
|
|
123
127
|
size="md"
|
|
124
128
|
color="neutral"
|
|
125
129
|
variant="link"
|
|
126
|
-
aria-label="
|
|
127
|
-
v-bind="typeof close === 'object' ? close :
|
|
130
|
+
:aria-label="t('alert.close')"
|
|
131
|
+
v-bind="(typeof close === 'object' ? close as Partial<ButtonProps> : {})"
|
|
128
132
|
:class="ui.close({ class: props.ui?.close })"
|
|
129
133
|
@click="emits('update:open', false)"
|
|
130
134
|
/>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { ConfigProviderProps, TooltipProviderProps } from '
|
|
3
|
-
import {
|
|
4
|
-
import type { ToasterProps } from '../types'
|
|
2
|
+
import type { ConfigProviderProps, TooltipProviderProps } from 'reka-ui'
|
|
3
|
+
import { localeContextInjectionKey } from '../composables/useLocale'
|
|
4
|
+
import type { ToasterProps, Locale } from '../types'
|
|
5
5
|
|
|
6
|
-
export interface AppProps extends Omit<ConfigProviderProps, 'useId'> {
|
|
6
|
+
export interface AppProps extends Omit<ConfigProviderProps, 'useId' | 'dir' | 'locale'> {
|
|
7
7
|
tooltip?: TooltipProviderProps
|
|
8
8
|
toaster?: ToasterProps | null
|
|
9
|
+
locale?: Locale
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export interface AppSlots {
|
|
@@ -15,36 +16,35 @@ export interface AppSlots {
|
|
|
15
16
|
export default {
|
|
16
17
|
name: 'App'
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
extendDevtoolsMeta({ ignore: true })
|
|
20
19
|
</script>
|
|
21
20
|
|
|
22
21
|
<script setup lang="ts">
|
|
23
|
-
import { toRef, useId } from 'vue'
|
|
24
|
-
import { ConfigProvider, TooltipProvider, useForwardProps } from '
|
|
22
|
+
import { toRef, useId, provide } from 'vue'
|
|
23
|
+
import { ConfigProvider, TooltipProvider, useForwardProps } from 'reka-ui'
|
|
25
24
|
import { reactivePick } from '@vueuse/core'
|
|
26
25
|
import UToaster from './Toaster.vue'
|
|
27
|
-
import
|
|
28
|
-
import USlideoverProvider from './SlideoverProvider.vue'
|
|
26
|
+
import UOverlayProvider from './OverlayProvider.vue'
|
|
29
27
|
|
|
30
28
|
const props = defineProps<AppProps>()
|
|
31
29
|
defineSlots<AppSlots>()
|
|
32
30
|
|
|
33
|
-
const configProviderProps = useForwardProps(reactivePick(props, '
|
|
31
|
+
const configProviderProps = useForwardProps(reactivePick(props, 'scrollBody'))
|
|
34
32
|
const tooltipProps = toRef(() => props.tooltip)
|
|
35
33
|
const toasterProps = toRef(() => props.toaster)
|
|
34
|
+
|
|
35
|
+
const locale = toRef(() => props.locale)
|
|
36
|
+
provide(localeContextInjectionKey, locale)
|
|
36
37
|
</script>
|
|
37
38
|
|
|
38
39
|
<template>
|
|
39
|
-
<ConfigProvider :use-id="() => (useId() as string)" v-bind="configProviderProps">
|
|
40
|
+
<ConfigProvider :use-id="() => (useId() as string)" :dir="locale?.dir" :locale="locale?.code" v-bind="configProviderProps">
|
|
40
41
|
<TooltipProvider v-bind="tooltipProps">
|
|
41
42
|
<UToaster v-if="toaster !== null" v-bind="toasterProps">
|
|
42
43
|
<slot />
|
|
43
44
|
</UToaster>
|
|
44
45
|
<slot v-else />
|
|
45
|
-
</TooltipProvider>
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
<UOverlayProvider />
|
|
48
|
+
</TooltipProvider>
|
|
49
49
|
</ConfigProvider>
|
|
50
50
|
</template>
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import type { AvatarFallbackProps } from 'radix-vue'
|
|
2
|
+
import type { VariantProps } from 'tailwind-variants'
|
|
4
3
|
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
-
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
6
4
|
import _appConfig from '#build/app.config'
|
|
7
5
|
import theme from '#build/ui/avatar'
|
|
6
|
+
import { tv } from '../utils/tv'
|
|
8
7
|
|
|
9
|
-
const
|
|
8
|
+
const appConfigAvatar = _appConfig as AppConfig & { ui: { avatar: Partial<typeof theme> } }
|
|
10
9
|
|
|
11
|
-
const avatar = tv({ extend: tv(theme), ...(
|
|
10
|
+
const avatar = tv({ extend: tv(theme), ...(appConfigAvatar.ui?.avatar || {}) })
|
|
12
11
|
|
|
13
12
|
type AvatarVariants = VariantProps<typeof avatar>
|
|
14
13
|
|
|
15
|
-
export interface AvatarProps
|
|
14
|
+
export interface AvatarProps {
|
|
16
15
|
/**
|
|
17
16
|
* The element or component this component should render as.
|
|
18
17
|
* @defaultValue 'span'
|
|
@@ -27,23 +26,22 @@ export interface AvatarProps extends Pick<AvatarFallbackProps, 'delayMs'> {
|
|
|
27
26
|
ui?: Partial<typeof avatar.slots>
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
|
|
29
|
+
export interface AvatarSlots {
|
|
30
|
+
default(props?: {}): any
|
|
31
|
+
}
|
|
31
32
|
</script>
|
|
32
33
|
|
|
33
34
|
<script setup lang="ts">
|
|
34
|
-
import { computed } from 'vue'
|
|
35
|
-
import {
|
|
36
|
-
import
|
|
35
|
+
import { ref, computed, watch } from 'vue'
|
|
36
|
+
import { Primitive } from 'reka-ui'
|
|
37
|
+
import ImageComponent from '#build/ui-image-component'
|
|
37
38
|
import { useAvatarGroup } from '../composables/useAvatarGroup'
|
|
38
39
|
import UIcon from './Icon.vue'
|
|
39
|
-
import ImageComponent from '#build/ui-image-component'
|
|
40
40
|
|
|
41
41
|
defineOptions({ inheritAttrs: false })
|
|
42
42
|
|
|
43
43
|
const props = withDefaults(defineProps<AvatarProps>(), { as: 'span' })
|
|
44
44
|
|
|
45
|
-
const fallbackProps = useForwardProps(reactivePick(props, 'delayMs'))
|
|
46
|
-
|
|
47
45
|
const fallback = computed(() => props.text || (props.alt || '').split(' ').map(word => word.charAt(0)).join('').substring(0, 2))
|
|
48
46
|
|
|
49
47
|
const { size } = useAvatarGroup(props)
|
|
@@ -64,24 +62,38 @@ const sizePx = computed(() => ({
|
|
|
64
62
|
'2xl': 44,
|
|
65
63
|
'3xl': 48
|
|
66
64
|
})[props.size || 'md'])
|
|
65
|
+
|
|
66
|
+
const error = ref(false)
|
|
67
|
+
|
|
68
|
+
watch(() => props.src, () => {
|
|
69
|
+
if (error.value) {
|
|
70
|
+
error.value = false
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
function onError() {
|
|
75
|
+
error.value = true
|
|
76
|
+
}
|
|
67
77
|
</script>
|
|
68
78
|
|
|
69
79
|
<template>
|
|
70
|
-
<
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
80
|
+
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
81
|
+
<component
|
|
82
|
+
:is="ImageComponent"
|
|
83
|
+
v-if="src && !error"
|
|
84
|
+
role="img"
|
|
74
85
|
:src="src"
|
|
75
86
|
:alt="alt"
|
|
76
87
|
:width="sizePx"
|
|
77
88
|
:height="sizePx"
|
|
78
89
|
v-bind="$attrs"
|
|
79
90
|
:class="ui.image({ class: props.ui?.image })"
|
|
91
|
+
@error="onError"
|
|
80
92
|
/>
|
|
81
93
|
|
|
82
|
-
<
|
|
94
|
+
<slot v-else>
|
|
83
95
|
<UIcon v-if="icon" :name="icon" :class="ui.icon({ class: props.ui?.icon })" />
|
|
84
|
-
<span v-else :class="ui.fallback({ class: props.ui?.fallback })">{{ fallback }}</span>
|
|
85
|
-
</
|
|
86
|
-
</
|
|
96
|
+
<span v-else :class="ui.fallback({ class: props.ui?.fallback })">{{ fallback || ' ' }}</span>
|
|
97
|
+
</slot>
|
|
98
|
+
</Primitive>
|
|
87
99
|
</template>
|
|
@@ -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/avatar-group'
|
|
6
|
-
import {
|
|
6
|
+
import { tv } from '../utils/tv'
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const appConfigAvatarGroup = _appConfig as AppConfig & { ui: { avatarGroup: Partial<typeof theme> } }
|
|
9
9
|
|
|
10
|
-
const avatarGroup = tv({ extend: tv(theme), ...(
|
|
10
|
+
const avatarGroup = tv({ extend: tv(theme), ...(appConfigAvatarGroup.ui?.avatarGroup || {}) })
|
|
11
11
|
|
|
12
12
|
type AvatarGroupVariants = VariantProps<typeof avatarGroup>
|
|
13
13
|
|
|
@@ -29,13 +29,11 @@ export interface AvatarGroupProps {
|
|
|
29
29
|
export interface AvatarGroupSlots {
|
|
30
30
|
default(props?: {}): any
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
extendDevtoolsMeta({ example: 'AvatarGroupExample' })
|
|
34
32
|
</script>
|
|
35
33
|
|
|
36
34
|
<script setup lang="ts">
|
|
37
35
|
import { computed, provide } from 'vue'
|
|
38
|
-
import { Primitive } from '
|
|
36
|
+
import { Primitive } from 'reka-ui'
|
|
39
37
|
import { avatarGroupInjectionKey } from '../composables/useAvatarGroup'
|
|
40
38
|
import UAvatar from './Avatar.vue'
|
|
41
39
|
|