@nuxt/ui 3.0.0-alpha.11 → 3.0.0-alpha.13
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 +47 -37
- package/.nuxt/ui/avatar-group.ts +1 -1
- package/.nuxt/ui/avatar.ts +4 -4
- package/.nuxt/ui/badge.ts +37 -28
- package/.nuxt/ui/breadcrumb.ts +5 -5
- package/.nuxt/ui/button.ts +42 -43
- package/.nuxt/ui/calendar.ts +15 -15
- package/.nuxt/ui/card.ts +27 -1
- package/.nuxt/ui/carousel.ts +2 -2
- package/.nuxt/ui/checkbox.ts +18 -18
- package/.nuxt/ui/chip.ts +8 -8
- package/.nuxt/ui/color-picker.ts +2 -2
- package/.nuxt/ui/command-palette.ts +12 -12
- package/.nuxt/ui/container.ts +1 -1
- package/.nuxt/ui/context-menu.ts +32 -32
- package/.nuxt/ui/drawer.ts +72 -11
- package/.nuxt/ui/dropdown-menu.ts +33 -33
- package/.nuxt/ui/form-field.ts +6 -6
- package/.nuxt/ui/input-menu.ts +41 -41
- package/.nuxt/ui/input-number.ts +20 -20
- package/.nuxt/ui/input.ts +23 -23
- package/.nuxt/ui/kbd.ts +4 -4
- package/.nuxt/ui/link.ts +3 -3
- package/.nuxt/ui/modal.ts +5 -5
- package/.nuxt/ui/navigation-menu.ts +144 -77
- package/.nuxt/ui/pin-input.ts +20 -20
- package/.nuxt/ui/popover.ts +2 -2
- package/.nuxt/ui/progress.ts +17 -17
- package/.nuxt/ui/radio-group.ts +20 -20
- package/.nuxt/ui/select-menu.ts +33 -32
- package/.nuxt/ui/select.ts +31 -31
- package/.nuxt/ui/separator.ts +8 -8
- package/.nuxt/ui/skeleton.ts +1 -1
- package/.nuxt/ui/slideover.ts +4 -4
- package/.nuxt/ui/slider.ts +16 -16
- package/.nuxt/ui/stepper.ts +18 -18
- package/.nuxt/ui/switch.ts +20 -20
- package/.nuxt/ui/table.ts +16 -16
- package/.nuxt/ui/tabs.ts +33 -33
- package/.nuxt/ui/textarea.ts +23 -23
- package/.nuxt/ui/toast.ts +42 -32
- package/.nuxt/ui/toaster.ts +4 -4
- package/.nuxt/ui/tooltip.ts +2 -2
- package/.nuxt/ui.css +90 -0
- package/README.md +2 -2
- package/cli/package.json +2 -2
- package/cli/templates.mjs +7 -7
- package/dist/chunks/component-meta.cjs +2590 -2511
- package/dist/chunks/component-meta.mjs +2590 -2511
- package/dist/client/devtools/200.html +1 -1
- package/dist/client/devtools/404.html +1 -1
- package/dist/client/devtools/_nuxt/CG6Dc4jp.js +1 -0
- package/dist/client/devtools/_nuxt/{Dtz-o9GB.js → DrNJgD08.js} +1 -1
- package/dist/client/devtools/_nuxt/{DNZFyo26.js → ElqrUh1r.js} +1 -1
- package/dist/client/devtools/_nuxt/builds/latest.json +1 -1
- package/dist/client/devtools/_nuxt/builds/meta/255c8d0b-7281-4d74-b4b6-ec96e6721aa0.json +1 -0
- package/dist/client/devtools/_nuxt/entry.Hn8drx4g.css +1 -0
- package/dist/client/devtools/_nuxt/error-404.Dew7w9Ee.css +1 -0
- package/dist/client/devtools/_nuxt/error-500.Dep59i31.css +1 -0
- package/dist/client/devtools/_nuxt/mC2e7kOs.js +57 -0
- package/dist/client/devtools/index.html +1 -1
- package/dist/devtools/runtime/examples/CardExample.vue +3 -3
- package/dist/devtools/runtime/examples/CollapsibleExample.vue +1 -1
- package/dist/devtools/runtime/examples/ContainerExample.vue +1 -1
- package/dist/devtools/runtime/examples/ContextMenuExample.vue +1 -1
- package/dist/devtools/runtime/examples/PopoverExample.vue +1 -1
- package/dist/devtools/runtime/examples/TooltipExample.vue +1 -1
- package/dist/module.cjs +2 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -1
- package/dist/runtime/components/Accordion.vue +2 -2
- package/dist/runtime/components/Alert.vue +15 -12
- package/dist/runtime/components/App.vue +3 -3
- package/dist/runtime/components/Avatar.vue +31 -10
- package/dist/runtime/components/AvatarGroup.vue +2 -2
- package/dist/runtime/components/Badge.vue +7 -3
- package/dist/runtime/components/Breadcrumb.vue +2 -2
- package/dist/runtime/components/Button.vue +2 -2
- package/dist/runtime/components/ButtonGroup.vue +2 -2
- package/dist/runtime/components/Calendar.vue +6 -3
- package/dist/runtime/components/Card.vue +8 -4
- package/dist/runtime/components/Carousel.vue +2 -2
- package/dist/runtime/components/Checkbox.vue +4 -4
- package/dist/runtime/components/Chip.vue +2 -2
- package/dist/runtime/components/Collapsible.vue +2 -2
- package/dist/runtime/components/ColorPicker.vue +46 -15
- package/dist/runtime/components/CommandPalette.vue +48 -41
- package/dist/runtime/components/Container.vue +2 -2
- package/dist/runtime/components/ContextMenu.vue +10 -2
- package/dist/runtime/components/ContextMenuContent.vue +4 -2
- package/dist/runtime/components/Drawer.vue +9 -3
- package/dist/runtime/components/DropdownMenu.vue +10 -2
- package/dist/runtime/components/DropdownMenuContent.vue +4 -2
- package/dist/runtime/components/Form.vue +46 -17
- package/dist/runtime/components/FormField.vue +12 -6
- package/dist/runtime/components/Input.vue +5 -4
- package/dist/runtime/components/InputMenu.vue +6 -5
- package/dist/runtime/components/InputNumber.vue +10 -6
- package/dist/runtime/components/Kbd.vue +2 -2
- package/dist/runtime/components/Link.vue +2 -2
- package/dist/runtime/components/Modal.vue +17 -3
- package/dist/runtime/components/NavigationMenu.vue +110 -67
- package/dist/runtime/components/Pagination.vue +2 -2
- package/dist/runtime/components/PinInput.vue +5 -4
- package/dist/runtime/components/Popover.vue +2 -2
- package/dist/runtime/components/Progress.vue +2 -2
- package/dist/runtime/components/RadioGroup.vue +4 -4
- package/dist/runtime/components/Select.vue +9 -7
- package/dist/runtime/components/SelectMenu.vue +67 -64
- package/dist/runtime/components/Separator.vue +2 -2
- package/dist/runtime/components/Skeleton.vue +2 -2
- package/dist/runtime/components/Slideover.vue +17 -3
- package/dist/runtime/components/Slider.vue +4 -4
- package/dist/runtime/components/Stepper.vue +3 -3
- package/dist/runtime/components/Switch.vue +4 -4
- package/dist/runtime/components/Table.vue +96 -18
- package/dist/runtime/components/Tabs.vue +2 -2
- package/dist/runtime/components/Textarea.vue +7 -5
- package/dist/runtime/components/Toast.vue +28 -16
- package/dist/runtime/components/Toaster.vue +4 -4
- package/dist/runtime/components/Tooltip.vue +2 -2
- package/dist/runtime/composables/useFormField.d.ts +6 -2
- package/dist/runtime/composables/useFormField.js +18 -11
- 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/locale/az.js +54 -0
- package/dist/runtime/locale/bn.js +54 -0
- package/dist/runtime/locale/es.js +2 -2
- 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/index.d.ts +8 -2
- package/dist/runtime/locale/index.js +8 -2
- package/dist/runtime/locale/km.d.ts +2 -0
- package/dist/runtime/locale/km.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/zh_cn.d.ts +2 -0
- package/dist/runtime/locale/{zh_hans.js → zh_cn.js} +1 -1
- package/dist/runtime/locale/zh_tw.d.ts +2 -0
- package/dist/runtime/locale/{zh_hant.js → zh_tw.js} +1 -1
- package/dist/runtime/plugins/colors.js +8 -5
- package/dist/runtime/types/form.d.ts +21 -12
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/utils.d.ts +5 -0
- package/dist/runtime/utils/form.js +3 -5
- package/dist/runtime/utils/tv.js +2 -2
- package/dist/runtime/vue/components/Link.vue +77 -18
- package/dist/shared/{ui.DCjJwb6l.cjs → ui.C5FzRWM5.cjs} +529 -366
- package/dist/shared/{ui.BKsd22-Q.mjs → ui.DCZM2pl8.mjs} +525 -366
- package/dist/unplugin.cjs +44 -20
- package/dist/unplugin.d.cts +10 -0
- package/dist/unplugin.d.mts +10 -0
- package/dist/unplugin.d.ts +10 -0
- package/dist/unplugin.mjs +43 -19
- 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 +67 -41
- package/dist/client/devtools/_nuxt/CQ-XZFu7.js +0 -54
- package/dist/client/devtools/_nuxt/builds/meta/1f5fbd7b-9d97-480e-9ae4-e02b4ff7018b.json +0 -1
- package/dist/client/devtools/_nuxt/entry.qOdop8tq.css +0 -1
- package/dist/client/devtools/_nuxt/error-404.D-rS9BDk.css +0 -1
- package/dist/client/devtools/_nuxt/error-500.CfcCHs91.css +0 -1
- /package/dist/runtime/locale/{zh_hans.d.ts → az.d.ts} +0 -0
- /package/dist/runtime/locale/{zh_hant.d.ts → bn.d.ts} +0 -0
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { default as ar } from './ar';
|
|
2
|
+
export { default as az } from './az';
|
|
3
|
+
export { default as bn } from './bn';
|
|
2
4
|
export { default as cs } from './cs';
|
|
3
5
|
export { default as da } from './da';
|
|
4
6
|
export { default as de } from './de';
|
|
@@ -9,10 +11,13 @@ export { default as es } from './es';
|
|
|
9
11
|
export { default as fa_ir } from './fa_ir';
|
|
10
12
|
export { default as fi } from './fi';
|
|
11
13
|
export { default as fr } from './fr';
|
|
14
|
+
export { default as hi } from './hi';
|
|
12
15
|
export { default as id } from './id';
|
|
13
16
|
export { default as it } from './it';
|
|
14
17
|
export { default as ja } from './ja';
|
|
18
|
+
export { default as km } from './km';
|
|
15
19
|
export { default as ko } from './ko';
|
|
20
|
+
export { default as nb_no } from './nb_no';
|
|
16
21
|
export { default as nl } from './nl';
|
|
17
22
|
export { default as pl } from './pl';
|
|
18
23
|
export { default as pt } from './pt';
|
|
@@ -24,5 +29,6 @@ export { default as th } from './th';
|
|
|
24
29
|
export { default as tr } from './tr';
|
|
25
30
|
export { default as uk } from './uk';
|
|
26
31
|
export { default as vi } from './vi';
|
|
27
|
-
export { default as
|
|
28
|
-
export { default as
|
|
32
|
+
export { default as zh_cn } from './zh_cn';
|
|
33
|
+
export { default as zh_tw } from './zh_tw';
|
|
34
|
+
export { default as he } from './he';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { default as ar } from "./ar.js";
|
|
2
|
+
export { default as az } from "./az.js";
|
|
3
|
+
export { default as bn } from "./bn.js";
|
|
2
4
|
export { default as cs } from "./cs.js";
|
|
3
5
|
export { default as da } from "./da.js";
|
|
4
6
|
export { default as de } from "./de.js";
|
|
@@ -9,10 +11,13 @@ export { default as es } from "./es.js";
|
|
|
9
11
|
export { default as fa_ir } from "./fa_ir.js";
|
|
10
12
|
export { default as fi } from "./fi.js";
|
|
11
13
|
export { default as fr } from "./fr.js";
|
|
14
|
+
export { default as hi } from "./hi.js";
|
|
12
15
|
export { default as id } from "./id.js";
|
|
13
16
|
export { default as it } from "./it.js";
|
|
14
17
|
export { default as ja } from "./ja.js";
|
|
18
|
+
export { default as km } from "./km.js";
|
|
15
19
|
export { default as ko } from "./ko.js";
|
|
20
|
+
export { default as nb_no } from "./nb_no.js";
|
|
16
21
|
export { default as nl } from "./nl.js";
|
|
17
22
|
export { default as pl } from "./pl.js";
|
|
18
23
|
export { default as pt } from "./pt.js";
|
|
@@ -24,5 +29,6 @@ export { default as th } from "./th.js";
|
|
|
24
29
|
export { default as tr } from "./tr.js";
|
|
25
30
|
export { default as uk } from "./uk.js";
|
|
26
31
|
export { default as vi } from "./vi.js";
|
|
27
|
-
export { default as
|
|
28
|
-
export { default as
|
|
32
|
+
export { default as zh_cn } from "./zh_cn.js";
|
|
33
|
+
export { default as zh_tw } from "./zh_tw.js";
|
|
34
|
+
export { default as he } from "./he.js";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { defineLocale } from "../composables/defineLocale.js";
|
|
2
|
+
export default defineLocale({
|
|
3
|
+
name: "\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A",
|
|
4
|
+
code: "km",
|
|
5
|
+
messages: {
|
|
6
|
+
inputMenu: {
|
|
7
|
+
noMatch: "\u1798\u17B7\u1793\u1798\u17B6\u1793\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u178A\u17C2\u179B\u178F\u17D2\u179A\u17BC\u179C\u1782\u17D2\u1793\u17B6\u1791\u17C1",
|
|
8
|
+
noData: "\u1798\u17B7\u1793\u1798\u17B6\u1793\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799",
|
|
9
|
+
create: '\u1794\u1784\u17D2\u1780\u17BE\u178F "{label}"'
|
|
10
|
+
},
|
|
11
|
+
calendar: {
|
|
12
|
+
prevYear: "\u1786\u17D2\u1793\u17B6\u17C6\u1798\u17BB\u1793",
|
|
13
|
+
nextYear: "\u1786\u17D2\u1793\u17B6\u17C6\u1794\u1793\u17D2\u1791\u17B6\u1794\u17CB",
|
|
14
|
+
prevMonth: "\u1781\u17C2\u1798\u17BB\u1793",
|
|
15
|
+
nextMonth: "\u1781\u17C2\u1794\u1793\u17D2\u1791\u17B6\u1794\u17CB"
|
|
16
|
+
},
|
|
17
|
+
inputNumber: {
|
|
18
|
+
increment: "\u1794\u1784\u17D2\u1780\u17BE\u1793",
|
|
19
|
+
decrement: "\u1794\u1793\u17D2\u1790\u1799"
|
|
20
|
+
},
|
|
21
|
+
commandPalette: {
|
|
22
|
+
placeholder: "\u179C\u17B6\u1799\u1796\u17B6\u1780\u17D2\u1799\u1794\u1789\u17D2\u1787\u17B6 \u17AC\u179F\u17D2\u179C\u17C2\u1784\u179A\u1780...",
|
|
23
|
+
noMatch: "\u1798\u17B7\u1793\u1798\u17B6\u1793\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u178A\u17C2\u179B\u178F\u17D2\u179A\u17BC\u179C\u1782\u17D2\u1793\u17B6\u1791\u17C1",
|
|
24
|
+
noData: "\u1798\u17B7\u1793\u1798\u17B6\u1793\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799",
|
|
25
|
+
close: "\u1794\u17B7\u1791"
|
|
26
|
+
},
|
|
27
|
+
selectMenu: {
|
|
28
|
+
noMatch: "\u1798\u17B7\u1793\u1798\u17B6\u1793\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u178A\u17C2\u179B\u178F\u17D2\u179A\u17BC\u179C\u1782\u17D2\u1793\u17B6\u1791\u17C1",
|
|
29
|
+
noData: "\u1798\u17B7\u1793\u1798\u17B6\u1793\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799",
|
|
30
|
+
create: '\u1794\u1784\u17D2\u1780\u17BE\u178F "{label}"',
|
|
31
|
+
search: "\u179F\u17D2\u179C\u17C2\u1784\u179A\u1780..."
|
|
32
|
+
},
|
|
33
|
+
toast: {
|
|
34
|
+
close: "\u1794\u17B7\u1791"
|
|
35
|
+
},
|
|
36
|
+
carousel: {
|
|
37
|
+
prev: "\u1798\u17BB\u1793",
|
|
38
|
+
next: "\u1794\u1793\u17D2\u1791\u17B6\u1794\u17CB",
|
|
39
|
+
goto: "\u179B\u17C4\u178F\u1791\u17C5\u1780\u17B6\u1793\u17CB\u179F\u17D2\u179B\u17B6\u1799 {slide}"
|
|
40
|
+
},
|
|
41
|
+
modal: {
|
|
42
|
+
close: "\u1794\u17B7\u1791"
|
|
43
|
+
},
|
|
44
|
+
slideover: {
|
|
45
|
+
close: "\u1794\u17B7\u1791"
|
|
46
|
+
},
|
|
47
|
+
alert: {
|
|
48
|
+
close: "\u1794\u17B7\u1791"
|
|
49
|
+
},
|
|
50
|
+
table: {
|
|
51
|
+
noData: "\u1798\u17B7\u1793\u1798\u17B6\u1793\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { defineLocale } from "../composables/defineLocale.js";
|
|
2
|
+
export default defineLocale({
|
|
3
|
+
name: "Norsk Bokm\xE5l",
|
|
4
|
+
code: "nb-NO",
|
|
5
|
+
messages: {
|
|
6
|
+
inputMenu: {
|
|
7
|
+
noMatch: "Ingen samsvarende data",
|
|
8
|
+
noData: "Ingen data",
|
|
9
|
+
create: 'Opprett "{label}"'
|
|
10
|
+
},
|
|
11
|
+
calendar: {
|
|
12
|
+
prevYear: "Forrige \xE5r",
|
|
13
|
+
nextYear: "Neste \xE5r",
|
|
14
|
+
prevMonth: "Forrige m\xE5ned",
|
|
15
|
+
nextMonth: "Neste m\xE5ned"
|
|
16
|
+
},
|
|
17
|
+
inputNumber: {
|
|
18
|
+
increment: "\xD8k",
|
|
19
|
+
decrement: "Reduser"
|
|
20
|
+
},
|
|
21
|
+
commandPalette: {
|
|
22
|
+
placeholder: "Skriv inn en kommando eller s\xF8k...",
|
|
23
|
+
noMatch: "Ingen samsvarende data",
|
|
24
|
+
noData: "Ingen data",
|
|
25
|
+
close: "Lukk"
|
|
26
|
+
},
|
|
27
|
+
selectMenu: {
|
|
28
|
+
noMatch: "Ingen samsvarende data",
|
|
29
|
+
noData: "Ingen data",
|
|
30
|
+
create: 'Opprett "{label}"',
|
|
31
|
+
search: "S\xF8k..."
|
|
32
|
+
},
|
|
33
|
+
toast: {
|
|
34
|
+
close: "Lukk"
|
|
35
|
+
},
|
|
36
|
+
carousel: {
|
|
37
|
+
prev: "Forrige",
|
|
38
|
+
next: "Neste",
|
|
39
|
+
goto: "G\xE5 til lysbilde {slide}"
|
|
40
|
+
},
|
|
41
|
+
modal: {
|
|
42
|
+
close: "Lukk"
|
|
43
|
+
},
|
|
44
|
+
slideover: {
|
|
45
|
+
close: "Lukk"
|
|
46
|
+
},
|
|
47
|
+
alert: {
|
|
48
|
+
close: "Lukk"
|
|
49
|
+
},
|
|
50
|
+
table: {
|
|
51
|
+
noData: "Ingen data"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
@@ -5,20 +5,23 @@ export default defineNuxtPlugin(() => {
|
|
|
5
5
|
const nuxtApp = useNuxtApp();
|
|
6
6
|
const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
|
7
7
|
function generateShades(key, value) {
|
|
8
|
-
return `${shades.map((shade) => `--ui-color-${key}-${shade}: var(--color-${value}-${shade});`).join("\n ")}`;
|
|
8
|
+
return `${shades.map((shade) => `--ui-color-${key}-${shade}: var(--color-${value === "neutral" ? "old-neutral" : value}-${shade});`).join("\n ")}`;
|
|
9
9
|
}
|
|
10
10
|
function generateColor(key, shade) {
|
|
11
11
|
return `--ui-${key}: var(--ui-color-${key}-${shade});`;
|
|
12
12
|
}
|
|
13
13
|
const root = computed(() => {
|
|
14
14
|
const { neutral, ...colors } = appConfig.ui.colors;
|
|
15
|
-
return
|
|
15
|
+
return `@layer base {
|
|
16
|
+
:root {
|
|
16
17
|
${Object.entries(appConfig.ui.colors).map(([key, value]) => generateShades(key, value)).join("\n ")}
|
|
17
|
-
|
|
18
|
+
}
|
|
19
|
+
:root, .light {
|
|
18
20
|
${Object.keys(colors).map((key) => generateColor(key, 500)).join("\n ")}
|
|
19
|
-
}
|
|
20
|
-
.dark {
|
|
21
|
+
}
|
|
22
|
+
.dark {
|
|
21
23
|
${Object.keys(colors).map((key) => generateColor(key, 400)).join("\n ")}
|
|
24
|
+
}
|
|
22
25
|
}`;
|
|
23
26
|
});
|
|
24
27
|
const headData = {
|
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
-
import type { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import type { ComputedRef, DeepReadonly, Ref } from 'vue';
|
|
3
3
|
import type { ZodSchema } from 'zod';
|
|
4
4
|
import type { Schema as JoiSchema } from 'joi';
|
|
5
5
|
import type { ObjectSchema as YupObjectSchema } from 'yup';
|
|
6
6
|
import type { GenericSchema as ValibotSchema, GenericSchemaAsync as ValibotSchemaAsync, SafeParser as ValibotSafeParser, SafeParserAsync as ValibotSafeParserAsync } from 'valibot';
|
|
7
7
|
import type { GetObjectField } from './utils';
|
|
8
8
|
import type { Struct as SuperstructSchema } from 'superstruct';
|
|
9
|
-
export interface Form<T> {
|
|
9
|
+
export interface Form<T extends object> {
|
|
10
10
|
validate(opts?: {
|
|
11
|
-
name
|
|
12
|
-
silent?:
|
|
11
|
+
name?: keyof T | (keyof T)[];
|
|
12
|
+
silent?: boolean;
|
|
13
13
|
nested?: boolean;
|
|
14
|
+
transform?: boolean;
|
|
14
15
|
}): Promise<T | false>;
|
|
15
16
|
clear(path?: string): void;
|
|
16
17
|
errors: Ref<FormError[]>;
|
|
17
|
-
setErrors(errs: FormError[],
|
|
18
|
-
getErrors(
|
|
18
|
+
setErrors(errs: FormError[], name?: keyof T): void;
|
|
19
|
+
getErrors(name?: keyof T): FormError[];
|
|
19
20
|
submit(): Promise<void>;
|
|
20
21
|
disabled: ComputedRef<boolean>;
|
|
22
|
+
dirty: ComputedRef<boolean>;
|
|
23
|
+
dirtyFields: DeepReadonly<Set<keyof T>>;
|
|
24
|
+
touchedFields: DeepReadonly<Set<keyof T>>;
|
|
25
|
+
blurredFields: DeepReadonly<Set<keyof T>>;
|
|
21
26
|
}
|
|
22
|
-
export type FormSchema<T extends
|
|
23
|
-
export type FormInputEvents = 'input' | 'blur' | 'change';
|
|
27
|
+
export type FormSchema<T extends object> = ZodSchema | YupObjectSchema<T> | ValibotSchema | ValibotSchemaAsync | ValibotSafeParser<any, any> | ValibotSafeParserAsync<any, any> | JoiSchema<T> | SuperstructSchema<any, any> | StandardSchemaV1;
|
|
28
|
+
export type FormInputEvents = 'input' | 'blur' | 'change' | 'focus';
|
|
24
29
|
export interface FormError<P extends string = string> {
|
|
25
30
|
name: P;
|
|
26
31
|
message: string;
|
|
@@ -46,11 +51,12 @@ export type FormChildDetachEvent = {
|
|
|
46
51
|
type: 'detach';
|
|
47
52
|
formId: string | number;
|
|
48
53
|
};
|
|
49
|
-
export type FormInputEvent = {
|
|
54
|
+
export type FormInputEvent<T extends object> = {
|
|
50
55
|
type: FormEventType;
|
|
51
|
-
name
|
|
56
|
+
name: keyof T;
|
|
57
|
+
eager?: boolean;
|
|
52
58
|
};
|
|
53
|
-
export type FormEvent = FormInputEvent | FormChildAttachEvent | FormChildDetachEvent;
|
|
59
|
+
export type FormEvent<T extends object> = FormInputEvent<T> | FormChildAttachEvent | FormChildDetachEvent;
|
|
54
60
|
export interface FormInjectedOptions {
|
|
55
61
|
disabled?: boolean;
|
|
56
62
|
validateOnInputDelay?: number;
|
|
@@ -62,6 +68,9 @@ export interface FormFieldInjectedOptions<T> {
|
|
|
62
68
|
eagerValidation?: boolean;
|
|
63
69
|
validateOnInputDelay?: number;
|
|
64
70
|
errorPattern?: RegExp;
|
|
71
|
+
hint?: string;
|
|
72
|
+
description?: string;
|
|
73
|
+
ariaId: string;
|
|
65
74
|
}
|
|
66
75
|
export interface ValidateReturnSchema<T> {
|
|
67
76
|
result: T;
|
|
@@ -71,5 +80,5 @@ export declare class FormValidationException extends Error {
|
|
|
71
80
|
formId: string | number;
|
|
72
81
|
errors: FormErrorWithId[];
|
|
73
82
|
children?: FormValidationException[];
|
|
74
|
-
constructor(formId: string | number, errors: FormErrorWithId[], childErrors
|
|
83
|
+
constructor(formId: string | number, errors: FormErrorWithId[], childErrors?: FormValidationException[]);
|
|
75
84
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { VNode } from 'vue';
|
|
1
2
|
export interface TightMap<O = any> {
|
|
2
3
|
[key: string]: TightMap | O;
|
|
3
4
|
}
|
|
@@ -20,3 +21,7 @@ export type SelectItemKey<T> = T extends Record<string, any> ? keyof T : string;
|
|
|
20
21
|
export type SelectModelValueEmits<T, V, M extends boolean = false, DV = T> = {
|
|
21
22
|
'update:modelValue': [payload: SelectModelValue<T, V, M, DV>];
|
|
22
23
|
};
|
|
24
|
+
export type StringOrVNode = string | VNode | (() => VNode);
|
|
25
|
+
export type EmitsToProps<T> = {
|
|
26
|
+
[K in keyof T as `on${Capitalize<string & K>}`]: T[K] extends [...args: infer Args] ? (...args: Args) => void : never;
|
|
27
|
+
};
|
|
@@ -23,9 +23,7 @@ export function isStandardSchema(schema) {
|
|
|
23
23
|
return "~standard" in schema;
|
|
24
24
|
}
|
|
25
25
|
export async function validateStandardSchema(state, schema) {
|
|
26
|
-
const result = await schema["~standard"].validate(
|
|
27
|
-
value: state
|
|
28
|
-
});
|
|
26
|
+
const result = await schema["~standard"].validate(state);
|
|
29
27
|
if (result.issues) {
|
|
30
28
|
return {
|
|
31
29
|
errors: result.issues?.map((issue) => ({
|
|
@@ -141,14 +139,14 @@ export function validateSchema(state, schema) {
|
|
|
141
139
|
return validateZodSchema(state, schema);
|
|
142
140
|
} else if (isJoiSchema(schema)) {
|
|
143
141
|
return validateJoiSchema(state, schema);
|
|
142
|
+
} else if (isStandardSchema(schema)) {
|
|
143
|
+
return validateStandardSchema(state, schema);
|
|
144
144
|
} else if (isValibotSchema(schema)) {
|
|
145
145
|
return validateValibotSchema(state, schema);
|
|
146
146
|
} else if (isYupSchema(schema)) {
|
|
147
147
|
return validateYupSchema(state, schema);
|
|
148
148
|
} else if (isSuperStructSchema(schema)) {
|
|
149
149
|
return validateSuperstructSchema(state, schema);
|
|
150
|
-
} else if (isStandardSchema(schema)) {
|
|
151
|
-
return validateStandardSchema(state, schema);
|
|
152
150
|
} else {
|
|
153
151
|
throw new Error("Form validation failed: Unsupported form schema");
|
|
154
152
|
}
|
package/dist/runtime/utils/tv.js
CHANGED
|
@@ -52,9 +52,9 @@ interface NuxtLinkProps extends Omit<RouterLinkProps, 'to'> {
|
|
|
52
52
|
noPrefetch?: boolean
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
const
|
|
55
|
+
const appConfigLink = _appConfig as AppConfig & { ui: { link: Partial<typeof theme> } }
|
|
56
56
|
|
|
57
|
-
const link = tv({ extend: tv(theme), ...(
|
|
57
|
+
const link = tv({ extend: tv(theme), ...(appConfigLink.ui?.link || {}) })
|
|
58
58
|
|
|
59
59
|
export interface LinkProps extends NuxtLinkProps {
|
|
60
60
|
/**
|
|
@@ -90,7 +90,7 @@ export interface LinkSlots {
|
|
|
90
90
|
</script>
|
|
91
91
|
|
|
92
92
|
<script setup lang="ts">
|
|
93
|
-
import { computed } from 'vue'
|
|
93
|
+
import { computed, getCurrentInstance } from 'vue'
|
|
94
94
|
import { isEqual, diff } from 'ohash'
|
|
95
95
|
import { useForwardProps } from 'reka-ui'
|
|
96
96
|
import { reactiveOmit } from '@vueuse/core'
|
|
@@ -109,7 +109,22 @@ const props = withDefaults(defineProps<LinkProps>(), {
|
|
|
109
109
|
})
|
|
110
110
|
defineSlots<LinkSlots>()
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
// Check if vue-router is available by checking for the injection key
|
|
113
|
+
const hasRouter = computed(() => {
|
|
114
|
+
const app = getCurrentInstance()?.appContext.app
|
|
115
|
+
return !!(app?.config?.globalProperties?.$router)
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
// Only try to get route if router exists
|
|
119
|
+
const route = computed(() => {
|
|
120
|
+
if (!hasRouter.value) return null
|
|
121
|
+
try {
|
|
122
|
+
return useRoute()
|
|
123
|
+
} catch {
|
|
124
|
+
return null
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
|
|
113
128
|
const routerLinkProps = useForwardProps(reactiveOmit(props, 'as', 'type', 'disabled', 'active', 'exact', 'exactQuery', 'exactHash', 'activeClass', 'inactiveClass', 'to', 'raw', 'class'))
|
|
114
129
|
|
|
115
130
|
const ui = computed(() => tv({
|
|
@@ -132,24 +147,27 @@ function isPartiallyEqual(item1: any, item2: any) {
|
|
|
132
147
|
return isEqual(item1, item2, { excludeKeys: key => diffedKeys.includes(key) })
|
|
133
148
|
}
|
|
134
149
|
|
|
135
|
-
const isExternal = computed(() =>
|
|
150
|
+
const isExternal = computed(() => {
|
|
151
|
+
if (!props.to) return false
|
|
152
|
+
return typeof props.to === 'string' && hasProtocol(props.to, { acceptRelative: true })
|
|
153
|
+
})
|
|
136
154
|
|
|
137
155
|
function isLinkActive({ route: linkRoute, isActive, isExactActive }: any) {
|
|
138
156
|
if (props.active !== undefined) {
|
|
139
157
|
return props.active
|
|
140
158
|
}
|
|
141
159
|
|
|
142
|
-
if (!props.to) {
|
|
160
|
+
if (!props.to || !route.value) {
|
|
143
161
|
return false
|
|
144
162
|
}
|
|
145
163
|
|
|
146
164
|
if (props.exactQuery === 'partial') {
|
|
147
|
-
if (!isPartiallyEqual(linkRoute.query, route.query)) return false
|
|
165
|
+
if (!isPartiallyEqual(linkRoute.query, route.value.query)) return false
|
|
148
166
|
} else if (props.exactQuery === true) {
|
|
149
|
-
if (!isEqual(linkRoute.query, route.query)) return false
|
|
167
|
+
if (!isEqual(linkRoute.query, route.value.query)) return false
|
|
150
168
|
}
|
|
151
169
|
|
|
152
|
-
if (props.exactHash && linkRoute.hash !== route.hash) {
|
|
170
|
+
if (props.exactHash && linkRoute.hash !== route.value.hash) {
|
|
153
171
|
return false
|
|
154
172
|
}
|
|
155
173
|
|
|
@@ -173,10 +191,51 @@ function resolveLinkClass({ route, isActive, isExactActive }: any) {
|
|
|
173
191
|
|
|
174
192
|
return ui.value({ class: props.class, active, disabled: props.disabled })
|
|
175
193
|
}
|
|
194
|
+
|
|
195
|
+
// Handle navigation without vue-router
|
|
196
|
+
const handleNavigation = (href: string) => {
|
|
197
|
+
if (isExternal.value) {
|
|
198
|
+
window.location.href = href
|
|
199
|
+
} else {
|
|
200
|
+
window.location.pathname = href
|
|
201
|
+
}
|
|
202
|
+
}
|
|
176
203
|
</script>
|
|
177
204
|
|
|
178
205
|
<template>
|
|
179
|
-
<
|
|
206
|
+
<template v-if="hasRouter">
|
|
207
|
+
<RouterLink v-slot="{ href, navigate, route: linkRoute, isActive, isExactActive }" v-bind="routerLinkProps" :to="to || '#'" custom>
|
|
208
|
+
<template v-if="custom">
|
|
209
|
+
<slot
|
|
210
|
+
v-bind="{
|
|
211
|
+
...$attrs,
|
|
212
|
+
as,
|
|
213
|
+
type,
|
|
214
|
+
disabled,
|
|
215
|
+
href: to ? (isExternal ? to as string : href) : undefined,
|
|
216
|
+
navigate,
|
|
217
|
+
active: isLinkActive({ route: linkRoute, isActive, isExactActive })
|
|
218
|
+
}"
|
|
219
|
+
/>
|
|
220
|
+
</template>
|
|
221
|
+
<ULinkBase
|
|
222
|
+
v-else
|
|
223
|
+
v-bind="{
|
|
224
|
+
...$attrs,
|
|
225
|
+
as,
|
|
226
|
+
type,
|
|
227
|
+
disabled,
|
|
228
|
+
href: to ? (isExternal ? to as string : href) : undefined,
|
|
229
|
+
navigate
|
|
230
|
+
}"
|
|
231
|
+
:class="resolveLinkClass({ route: linkRoute, isActive, isExactActive })"
|
|
232
|
+
>
|
|
233
|
+
<slot :active="isLinkActive({ route: linkRoute, isActive, isExactActive })" />
|
|
234
|
+
</ULinkBase>
|
|
235
|
+
</RouterLink>
|
|
236
|
+
</template>
|
|
237
|
+
|
|
238
|
+
<template v-else>
|
|
180
239
|
<template v-if="custom">
|
|
181
240
|
<slot
|
|
182
241
|
v-bind="{
|
|
@@ -184,9 +243,9 @@ function resolveLinkClass({ route, isActive, isExactActive }: any) {
|
|
|
184
243
|
as,
|
|
185
244
|
type,
|
|
186
245
|
disabled,
|
|
187
|
-
href: to
|
|
188
|
-
navigate,
|
|
189
|
-
active:
|
|
246
|
+
href: to,
|
|
247
|
+
navigate: () => to && handleNavigation(to as string),
|
|
248
|
+
active: false
|
|
190
249
|
}"
|
|
191
250
|
/>
|
|
192
251
|
</template>
|
|
@@ -197,12 +256,12 @@ function resolveLinkClass({ route, isActive, isExactActive }: any) {
|
|
|
197
256
|
as,
|
|
198
257
|
type,
|
|
199
258
|
disabled,
|
|
200
|
-
href:
|
|
201
|
-
navigate
|
|
259
|
+
href: (to as string)
|
|
202
260
|
}"
|
|
203
|
-
:class="
|
|
261
|
+
:class="ui({ class: props.class, disabled })"
|
|
262
|
+
@click="to && handleNavigation(to as string)"
|
|
204
263
|
>
|
|
205
|
-
<slot :active="
|
|
264
|
+
<slot :active="false" />
|
|
206
265
|
</ULinkBase>
|
|
207
|
-
</
|
|
266
|
+
</template>
|
|
208
267
|
</template>
|