@sfxcode/nuxt-ui-formkit 1.2.1 → 1.2.3
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/README.md +24 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/FUAutoForm.d.vue.ts +65 -0
- package/dist/runtime/components/FUAutoForm.vue +59 -0
- package/dist/runtime/components/FUAutoForm.vue.d.ts +65 -0
- package/dist/runtime/components/FUDataEdit.d.vue.ts +11 -1
- package/dist/runtime/components/FUDataEdit.vue +13 -2
- package/dist/runtime/components/FUDataEdit.vue.d.ts +11 -1
- package/dist/runtime/components/FUDataView.d.vue.ts +1 -1
- package/dist/runtime/components/FUDataView.vue.d.ts +1 -1
- package/dist/runtime/composables/useFormKitAutoForm.d.ts +38 -0
- package/dist/runtime/composables/useFormKitAutoForm.js +349 -0
- package/dist/runtime/composables/useFormKitForm.d.ts +15 -0
- package/dist/runtime/composables/useFormKitForm.js +44 -0
- package/dist/runtime/composables/useFormKitMultiStep.d.ts +5 -0
- package/dist/runtime/composables/useFormKitMultiStep.js +65 -0
- package/dist/runtime/composables/useFormKitRepeater.d.ts +4 -0
- package/dist/runtime/composables/useFormKitRepeater.js +138 -0
- package/dist/runtime/composables/useFormKitStandardSchema.d.ts +20 -0
- package/dist/runtime/composables/useFormKitStandardSchema.js +68 -0
- package/dist/runtime/formkit/createNuxtUiFormkitConfig.d.ts +19 -0
- package/dist/runtime/formkit/createNuxtUiFormkitConfig.js +12 -0
- package/dist/runtime/formkit/createNuxtUiFormkitConfig.mjs +12 -0
- package/dist/runtime/formkit/definitions/index.d.ts +3 -0
- package/dist/runtime/formkit/definitions/index.js +4 -0
- package/dist/runtime/formkit/definitions/index.mjs +4 -0
- package/dist/runtime/formkit/definitions/multiStep.d.ts +3 -0
- package/dist/runtime/formkit/definitions/multiStep.js +90 -0
- package/dist/runtime/formkit/definitions/multiStep.mjs +90 -0
- package/dist/runtime/formkit/definitions/repeater.js +3 -119
- package/dist/runtime/formkit/definitions/repeater.mjs +3 -119
- package/dist/runtime/formkit/index.d.ts +10 -0
- package/dist/runtime/formkit/index.js +1 -0
- package/dist/runtime/formkit/index.mjs +1 -0
- package/dist/runtime/formkit/plugins/index.d.ts +1 -0
- package/dist/runtime/formkit/plugins/index.js +1 -0
- package/dist/runtime/formkit/plugins/index.mjs +1 -0
- package/dist/runtime/plugin.js +2 -1
- package/dist/runtime/utils/dateValueConversion.d.ts +8 -7
- package/dist/runtime/utils/dateValueConversion.js +1 -1
- package/dist/runtime/utils/standardSchemaErrors.d.ts +14 -0
- package/dist/runtime/utils/standardSchemaErrors.js +15 -0
- package/package.json +6 -2
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { FormKitMultiStepSlots, FormKitStepSlots } from '@formkit/addons';
|
|
1
2
|
import type { FormKitBaseSlots, FormKitInputs } from '@formkit/inputs';
|
|
2
3
|
import type { CalendarSlots, CheckboxSlots, CheckboxGroupSlots, EditorSlots, FileUploadSlots, RadioGroupSlots, InputSlots, TextareaSlots, SelectSlots, SelectMenuSlots, InputDateSlots, InputMenuSlots, InputNumberSlots, InputTagsSlots, InputTimeSlots, ListboxSlots, SwitchSlots } from '@nuxt/ui';
|
|
4
|
+
export * from './createNuxtUiFormkitConfig.js';
|
|
3
5
|
export * from './definitions/index.js';
|
|
4
6
|
export * from './plugins/index.js';
|
|
5
7
|
/**
|
|
@@ -47,6 +49,9 @@ declare module '@formkit/inputs' {
|
|
|
47
49
|
nuxtUIListbox: {
|
|
48
50
|
type: 'nuxtUIListbox';
|
|
49
51
|
};
|
|
52
|
+
nuxtUIMultiStep: {
|
|
53
|
+
type: 'nuxtUIMultiStep';
|
|
54
|
+
};
|
|
50
55
|
nuxtUIPinInput: {
|
|
51
56
|
type: 'nuxtUIPinInput';
|
|
52
57
|
};
|
|
@@ -62,6 +67,9 @@ declare module '@formkit/inputs' {
|
|
|
62
67
|
nuxtUISlider: {
|
|
63
68
|
type: 'nuxtUISlider';
|
|
64
69
|
};
|
|
70
|
+
nuxtUIStep: {
|
|
71
|
+
type: 'nuxtUIStep';
|
|
72
|
+
};
|
|
65
73
|
nuxtUISwitch: {
|
|
66
74
|
type: 'nuxtUISwitch';
|
|
67
75
|
};
|
|
@@ -100,9 +108,11 @@ declare module '@formkit/inputs' {
|
|
|
100
108
|
nuxtUIInputTags: MergeSlots<FormKitBaseSlots<Props>, InputTagsSlots>;
|
|
101
109
|
nuxtUIInputTime: MergeSlots<FormKitBaseSlots<Props>, InputTimeSlots>;
|
|
102
110
|
nuxtUIListbox: MergeSlots<FormKitBaseSlots<Props>, ListboxSlots>;
|
|
111
|
+
nuxtUIMultiStep: MergeSlots<FormKitBaseSlots<Props>, FormKitMultiStepSlots<Props>>;
|
|
103
112
|
nuxtUIRadioGroup: MergeSlots<FormKitBaseSlots<Props>, RadioGroupSlots>;
|
|
104
113
|
nuxtUISelect: MergeSlots<FormKitBaseSlots<Props>, SelectSlots>;
|
|
105
114
|
nuxtUISelectMenu: MergeSlots<FormKitBaseSlots<Props>, SelectMenuSlots>;
|
|
115
|
+
nuxtUIStep: MergeSlots<FormKitBaseSlots<Props>, FormKitStepSlots<Props>>;
|
|
106
116
|
nuxtUISwitch: MergeSlots<FormKitBaseSlots<Props>, SwitchSlots>;
|
|
107
117
|
nuxtUITextarea: MergeSlots<FormKitBaseSlots<Props>, TextareaSlots>;
|
|
108
118
|
}
|
package/dist/runtime/plugin.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineNuxtPlugin } from "#app";
|
|
2
|
-
import { UButton, UIcon } from "#components";
|
|
2
|
+
import { UButton, UIcon, UTabs } from "#components";
|
|
3
3
|
export default defineNuxtPlugin((_nuxtApp) => {
|
|
4
4
|
_nuxtApp.vueApp.component("UButton", UButton);
|
|
5
5
|
_nuxtApp.vueApp.component("UIcon", UIcon);
|
|
6
|
+
_nuxtApp.vueApp.component("UTabs", UTabs);
|
|
6
7
|
});
|
|
@@ -6,6 +6,7 @@ export interface DateConversionOptions {
|
|
|
6
6
|
hideTimeZone?: boolean;
|
|
7
7
|
timeZone?: string;
|
|
8
8
|
}
|
|
9
|
+
export declare function isDateValue(value: unknown): value is DateValue;
|
|
9
10
|
/**
|
|
10
11
|
* Converts an external value (JS `Date`, ISO 8601 string, or an already-native
|
|
11
12
|
* `DateValue`) into the `DateValue` that `UInputDate`/`UCalendar` require.
|
|
@@ -24,12 +25,12 @@ export declare function toDateValueOrRangeOrArray(value: unknown, options?: Date
|
|
|
24
25
|
/** Converts a `DateValue` emitted by `UInputDate`/`UCalendar` back into the shape the form value should take. */
|
|
25
26
|
export declare function fromDateValue(value: DateValue | undefined, valueType: DateValueType, timeZone?: string): DateValue | Date | string | undefined;
|
|
26
27
|
/** Same as {@link fromDateValue}, but also handles the `{ start, end }` range shape. */
|
|
27
|
-
export declare function fromDateValueOrRange(value: unknown, valueType: DateValueType, timeZone?: string): string |
|
|
28
|
-
start: string |
|
|
29
|
-
end: string |
|
|
28
|
+
export declare function fromDateValueOrRange(value: unknown, valueType: DateValueType, timeZone?: string): string | CalendarDate | CalendarDateTime | ZonedDateTime | Date | {
|
|
29
|
+
start: string | DateValue | Date | undefined;
|
|
30
|
+
end: string | DateValue | Date | undefined;
|
|
30
31
|
} | undefined;
|
|
31
32
|
/** Same as {@link fromDateValueOrRange}, but also handles arrays (multiple-selection mode). */
|
|
32
|
-
export declare function fromDateValueOrRangeOrArray(value: unknown, valueType: DateValueType, timeZone?: string): string |
|
|
33
|
-
start: string |
|
|
34
|
-
end: string |
|
|
35
|
-
} | (string |
|
|
33
|
+
export declare function fromDateValueOrRangeOrArray(value: unknown, valueType: DateValueType, timeZone?: string): string | CalendarDate | CalendarDateTime | ZonedDateTime | Date | {
|
|
34
|
+
start: string | DateValue | Date | undefined;
|
|
35
|
+
end: string | DateValue | Date | undefined;
|
|
36
|
+
} | (string | DateValue | Date | undefined)[] | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CalendarDate, CalendarDateTime, ZonedDateTime, fromDate, getLocalTimeZone, parseAbsolute, parseDate, parseDateTime, toCalendarDate, toCalendarDateTime } from "@internationalized/date";
|
|
2
2
|
const ISO_DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
|
|
3
3
|
const ISO_HAS_ZONE = /(?:Z|[+-]\d{2}:\d{2})(?:\[[^\]]+\])?$/;
|
|
4
|
-
function isDateValue(value) {
|
|
4
|
+
export function isDateValue(value) {
|
|
5
5
|
return value instanceof CalendarDate || value instanceof CalendarDateTime || value instanceof ZonedDateTime;
|
|
6
6
|
}
|
|
7
7
|
function isRangeLike(value) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
export interface FormKitStandardSchemaErrors {
|
|
3
|
+
localErrors: string[];
|
|
4
|
+
childErrors: Record<string, string[]>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Normalizes a Standard Schema `Issue[]` array into FormKit's
|
|
8
|
+
* `setErrors`/`clearErrors` address shape. Mirrors `@nuxt/ui`'s own
|
|
9
|
+
* `validateStandardSchema()` path-flattening exactly (`item.key` for object
|
|
10
|
+
* path segments, the bare value otherwise, joined with `.`) so a Zod/Valibot
|
|
11
|
+
* issue at `items[2].email` resolves to the same FormKit node address
|
|
12
|
+
* (`"items.2.email"`) Nuxt UI's own forms would use for the same schema.
|
|
13
|
+
*/
|
|
14
|
+
export declare function issuesToFormKitErrors(issues: readonly StandardSchemaV1.Issue[]): FormKitStandardSchemaErrors;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function issuesToFormKitErrors(issues) {
|
|
2
|
+
const localErrors = [];
|
|
3
|
+
const childErrors = {};
|
|
4
|
+
for (const issue of issues) {
|
|
5
|
+
const address = issue.path?.map((item) => typeof item === "object" ? item.key : item).join(".");
|
|
6
|
+
if (!address) {
|
|
7
|
+
localErrors.push(issue.message);
|
|
8
|
+
continue;
|
|
9
|
+
}
|
|
10
|
+
if (!childErrors[address])
|
|
11
|
+
childErrors[address] = [];
|
|
12
|
+
childErrors[address].push(issue.message);
|
|
13
|
+
}
|
|
14
|
+
return { localErrors, childErrors };
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sfxcode/nuxt-ui-formkit",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "FormKit integration for Nuxt UI - Seamlessly connect FormKit form handling with Nuxt UI components",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Tom",
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"@formkit/nuxt": "^2.1.0",
|
|
93
93
|
"@nuxt/kit": "4.4.8",
|
|
94
94
|
"@nuxt/ui": "^4.9.0",
|
|
95
|
+
"@standard-schema/spec": "^1.1.0",
|
|
95
96
|
"@vue/compiler-dom": "^3.5.39"
|
|
96
97
|
},
|
|
97
98
|
"devDependencies": {
|
|
@@ -109,6 +110,7 @@
|
|
|
109
110
|
"@nuxt/test-utils": "^4.0.3",
|
|
110
111
|
"@types/node": "latest",
|
|
111
112
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
113
|
+
"@vue/test-utils": "^2.4.11",
|
|
112
114
|
"changelogen": "^0.6.2",
|
|
113
115
|
"codemirror": "^6.0.2",
|
|
114
116
|
"eslint": "^10.6.0",
|
|
@@ -118,11 +120,13 @@
|
|
|
118
120
|
"sass-embedded": "^1.100.0",
|
|
119
121
|
"typescript": "~6.0.3",
|
|
120
122
|
"unbuild": "^3.6.1",
|
|
123
|
+
"valibot": "^1.4.2",
|
|
121
124
|
"vitepress": "2.0.0-alpha.17",
|
|
122
125
|
"vitest": "^4.1.9",
|
|
123
126
|
"vue": "^3.5.39",
|
|
124
127
|
"vue-i18n": "^11.4.6",
|
|
125
|
-
"vue-tsc": "^3.3.6"
|
|
128
|
+
"vue-tsc": "^3.3.6",
|
|
129
|
+
"zod": "^4.4.3"
|
|
126
130
|
},
|
|
127
131
|
"packageManager": "pnpm@11.1.2+sha512.415a1cc25974731e75455c1468371be74c5aa5fb7621b50d4056d222451609f11412f23fd602e6169f1e060466641f798597e1be961a10688836a67b16569499"
|
|
128
132
|
}
|