@sfxcode/formkit-nuxt-ui 0.7.2
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/LICENSE +22 -0
- package/README.md +385 -0
- package/dist/module.d.mts +7 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +29 -0
- package/dist/runtime/components/FUDataDebug.d.vue.ts +43 -0
- package/dist/runtime/components/FUDataDebug.vue +30 -0
- package/dist/runtime/components/FUDataDebug.vue.d.ts +43 -0
- package/dist/runtime/components/FUDataEdit.d.vue.ts +180 -0
- package/dist/runtime/components/FUDataEdit.vue +141 -0
- package/dist/runtime/components/FUDataEdit.vue.d.ts +180 -0
- package/dist/runtime/components/FUDataView.d.vue.ts +73 -0
- package/dist/runtime/components/FUDataView.vue +49 -0
- package/dist/runtime/components/FUDataView.vue.d.ts +73 -0
- package/dist/runtime/components/inputs/FUCheckbox.d.vue.ts +27 -0
- package/dist/runtime/components/inputs/FUCheckbox.vue +33 -0
- package/dist/runtime/components/inputs/FUCheckbox.vue.d.ts +27 -0
- package/dist/runtime/components/inputs/FUCheckboxGroup.d.vue.ts +38 -0
- package/dist/runtime/components/inputs/FUCheckboxGroup.vue +34 -0
- package/dist/runtime/components/inputs/FUCheckboxGroup.vue.d.ts +38 -0
- package/dist/runtime/components/inputs/FUColorPicker.d.vue.ts +22 -0
- package/dist/runtime/components/inputs/FUColorPicker.vue +27 -0
- package/dist/runtime/components/inputs/FUColorPicker.vue.d.ts +22 -0
- package/dist/runtime/components/inputs/FUInput.d.vue.ts +44 -0
- package/dist/runtime/components/inputs/FUInput.vue +50 -0
- package/dist/runtime/components/inputs/FUInput.vue.d.ts +44 -0
- package/dist/runtime/components/inputs/FUInputDate.d.vue.ts +51 -0
- package/dist/runtime/components/inputs/FUInputDate.vue +52 -0
- package/dist/runtime/components/inputs/FUInputDate.vue.d.ts +51 -0
- package/dist/runtime/components/inputs/FUInputMenu.d.vue.ts +73 -0
- package/dist/runtime/components/inputs/FUInputMenu.vue +65 -0
- package/dist/runtime/components/inputs/FUInputMenu.vue.d.ts +73 -0
- package/dist/runtime/components/inputs/FUInputNumber.d.vue.ts +43 -0
- package/dist/runtime/components/inputs/FUInputNumber.vue +49 -0
- package/dist/runtime/components/inputs/FUInputNumber.vue.d.ts +43 -0
- package/dist/runtime/components/inputs/FUInputTags.d.vue.ts +47 -0
- package/dist/runtime/components/inputs/FUInputTags.vue +53 -0
- package/dist/runtime/components/inputs/FUInputTags.vue.d.ts +47 -0
- package/dist/runtime/components/inputs/FUInputTime.d.vue.ts +50 -0
- package/dist/runtime/components/inputs/FUInputTime.vue +50 -0
- package/dist/runtime/components/inputs/FUInputTime.vue.d.ts +50 -0
- package/dist/runtime/components/inputs/FUPinInput.d.vue.ts +30 -0
- package/dist/runtime/components/inputs/FUPinInput.vue +37 -0
- package/dist/runtime/components/inputs/FUPinInput.vue.d.ts +30 -0
- package/dist/runtime/components/inputs/FURadioGroup.d.vue.ts +37 -0
- package/dist/runtime/components/inputs/FURadioGroup.vue +35 -0
- package/dist/runtime/components/inputs/FURadioGroup.vue.d.ts +37 -0
- package/dist/runtime/components/inputs/FUSelect.d.vue.ts +48 -0
- package/dist/runtime/components/inputs/FUSelect.vue +51 -0
- package/dist/runtime/components/inputs/FUSelect.vue.d.ts +48 -0
- package/dist/runtime/components/inputs/FUSelectMenu.d.vue.ts +73 -0
- package/dist/runtime/components/inputs/FUSelectMenu.vue +62 -0
- package/dist/runtime/components/inputs/FUSelectMenu.vue.d.ts +73 -0
- package/dist/runtime/components/inputs/FUSlider.d.vue.ts +29 -0
- package/dist/runtime/components/inputs/FUSlider.vue +36 -0
- package/dist/runtime/components/inputs/FUSlider.vue.d.ts +29 -0
- package/dist/runtime/components/inputs/FUSwitch.d.vue.ts +28 -0
- package/dist/runtime/components/inputs/FUSwitch.vue +34 -0
- package/dist/runtime/components/inputs/FUSwitch.vue.d.ts +28 -0
- package/dist/runtime/components/inputs/FUTextarea.d.vue.ts +44 -0
- package/dist/runtime/components/inputs/FUTextarea.vue +50 -0
- package/dist/runtime/components/inputs/FUTextarea.vue.d.ts +44 -0
- package/dist/runtime/components/output/FUIcon.d.vue.ts +38 -0
- package/dist/runtime/components/output/FUIcon.vue +21 -0
- package/dist/runtime/components/output/FUIcon.vue.d.ts +38 -0
- package/dist/runtime/components/output/FUOutputBoolean.d.vue.ts +30 -0
- package/dist/runtime/components/output/FUOutputBoolean.vue +56 -0
- package/dist/runtime/components/output/FUOutputBoolean.vue.d.ts +30 -0
- package/dist/runtime/components/output/FUOutputDate.d.vue.ts +30 -0
- package/dist/runtime/components/output/FUOutputDate.vue +52 -0
- package/dist/runtime/components/output/FUOutputDate.vue.d.ts +30 -0
- package/dist/runtime/components/output/FUOutputLink.d.vue.ts +28 -0
- package/dist/runtime/components/output/FUOutputLink.vue +78 -0
- package/dist/runtime/components/output/FUOutputLink.vue.d.ts +28 -0
- package/dist/runtime/components/output/FUOutputList.d.vue.ts +29 -0
- package/dist/runtime/components/output/FUOutputList.vue +143 -0
- package/dist/runtime/components/output/FUOutputList.vue.d.ts +29 -0
- package/dist/runtime/components/output/FUOutputNumber.d.vue.ts +28 -0
- package/dist/runtime/components/output/FUOutputNumber.vue +52 -0
- package/dist/runtime/components/output/FUOutputNumber.vue.d.ts +28 -0
- package/dist/runtime/components/output/FUOutputText.d.vue.ts +26 -0
- package/dist/runtime/components/output/FUOutputText.vue +35 -0
- package/dist/runtime/components/output/FUOutputText.vue.d.ts +26 -0
- package/dist/runtime/composables/useFormKitRepeater.d.ts +5 -0
- package/dist/runtime/composables/useFormKitRepeater.js +54 -0
- package/dist/runtime/composables/useFormKitSchema.d.ts +26 -0
- package/dist/runtime/composables/useFormKitSchema.js +58 -0
- package/dist/runtime/definitions/index.d.ts +26 -0
- package/dist/runtime/definitions/index.js +28 -0
- package/dist/runtime/definitions/input.d.ts +17 -0
- package/dist/runtime/definitions/input.js +81 -0
- package/dist/runtime/definitions/output.d.ts +7 -0
- package/dist/runtime/definitions/output.js +31 -0
- package/dist/runtime/formkit.config.d.ts +3 -0
- package/dist/runtime/formkit.config.js +33 -0
- package/dist/runtime/plugin.d.ts +2 -0
- package/dist/runtime/plugin.js +5 -0
- package/dist/runtime/plugins/index.d.ts +3 -0
- package/dist/runtime/plugins/index.js +55 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/utils/useFormKitInput.d.ts +13 -0
- package/dist/runtime/utils/useFormKitInput.js +42 -0
- package/dist/runtime/utils/useFormKitOutput.d.ts +10 -0
- package/dist/runtime/utils/useFormKitOutput.js +73 -0
- package/dist/types.d.mts +3 -0
- package/package.json +91 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { createInput } from "@formkit/vue";
|
|
2
|
+
import FUCheckbox from "../components/inputs/FUCheckbox.vue";
|
|
3
|
+
import FUCheckboxGroup from "../components/inputs/FUCheckboxGroup.vue";
|
|
4
|
+
import FUColorPicker from "../components/inputs/FUColorPicker.vue";
|
|
5
|
+
import FUInput from "../components/inputs/FUInput.vue";
|
|
6
|
+
import FUInputDate from "../components/inputs/FUInputDate.vue";
|
|
7
|
+
import FUInputMenu from "../components/inputs/FUInputMenu.vue";
|
|
8
|
+
import FUInputNumber from "../components/inputs/FUInputNumber.vue";
|
|
9
|
+
import FUInputTags from "../components/inputs/FUInputTags.vue";
|
|
10
|
+
import FUInputTime from "../components/inputs/FUInputTime.vue";
|
|
11
|
+
import FUPinInput from "../components/inputs/FUPinInput.vue";
|
|
12
|
+
import FURadioGroup from "../components/inputs/FURadioGroup.vue";
|
|
13
|
+
import FUSelect from "../components/inputs/FUSelect.vue";
|
|
14
|
+
import FUSelectMenu from "../components/inputs/FUSelectMenu.vue";
|
|
15
|
+
import FUSlider from "../components/inputs/FUSlider.vue";
|
|
16
|
+
import FUSwitch from "../components/inputs/FUSwitch.vue";
|
|
17
|
+
import FUTextarea from "../components/inputs/FUTextarea.vue";
|
|
18
|
+
export const nuxtUICheckboxDefinition = createInput(FUCheckbox, {
|
|
19
|
+
props: ["label", "description", "color", "variant", "size", "indicator", "icon", "indeterminateIcon", "autofocus", "ui"],
|
|
20
|
+
family: "NuxtUIInput"
|
|
21
|
+
});
|
|
22
|
+
export const nuxtUICheckboxGroupDefinition = createInput(FUCheckboxGroup, {
|
|
23
|
+
props: ["options", "legend", "valueKey", "labelKey", "descriptionKey", "size", "variant", "orientation", "loop", "color", "indicator", "icon", "ui", "items"],
|
|
24
|
+
family: "NuxtUIInput"
|
|
25
|
+
});
|
|
26
|
+
export const nuxtUIColorPickerDefinition = createInput(FUColorPicker, {
|
|
27
|
+
props: ["size", "inputClass", "format", "throttle", "ui"],
|
|
28
|
+
family: "NuxtUIInput"
|
|
29
|
+
});
|
|
30
|
+
export const nuxtUIInputDefinition = createInput(FUInput, {
|
|
31
|
+
props: ["inputType", "size", "autocomplete", "autofocus", "autofocusDelay", "highlight", "fixed", "color", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "placeholder", "list", "max", "maxLength", "min", "minLength", "pattern", "step", "variant", "ui"],
|
|
32
|
+
family: "NuxtUIInput"
|
|
33
|
+
});
|
|
34
|
+
export const nuxtUIInputDateDefinition = createInput(FUInputDate, {
|
|
35
|
+
props: ["defaultValue", "color", "variant", "size", "highlight", "fixed", "autofocus", "autofocusDelay", "range", "separatorIcon", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "placeholder", "defaultPlaceholder", "hourCycle", "step", "granularity", "hideTimeZone", "maxValue", "minValue", "isDateUnavailable", "ui"],
|
|
36
|
+
family: "NuxtUIInput"
|
|
37
|
+
});
|
|
38
|
+
export const nuxtUIInputMenuDefinition = createInput(FUInputMenu, {
|
|
39
|
+
props: ["options", "inputType", "placeholder", "color", "variant", "size", "autofocus", "autofocusDelay", "trailingIcon", "selectedIcon", "deleteIcon", "clear", "clearIcon", "arrow", "portal", "virtualize", "valueKey", "labelKey", "descriptionKey", "multiple", "highlight", "fixed", "createItem", "filterFields", "ignoreFilter", "defaultOpen", "resetSearchTermOnBlur", "resetSearchTermOnSelect", "resetModelValueOnClear", "highlightOnHover", "openOnClick", "openOnFocus", "icon", "leading", "leadingIcon", "trailing", "loading", "loadingIcon", "list", "autocomplete", "searchTerm", "ui"],
|
|
40
|
+
family: "NuxtUIInput"
|
|
41
|
+
});
|
|
42
|
+
export const nuxtUIInputNumberDefinition = createInput(FUInputNumber, {
|
|
43
|
+
props: ["placeholder", "color", "variant", "size", "highlight", "fixed", "orientation", "increment", "incrementIcon", "incrementDisabled", "decrement", "decrementIcon", "decrementDisabled", "autofocus", "autofocusDelay", "min", "max", "step", "stepSnapping", "formatOptions", "disableWheelChange", "invertWheelChange", "focusOnChange", "list", "autocomplete", "ui"],
|
|
44
|
+
family: "NuxtUIInput"
|
|
45
|
+
});
|
|
46
|
+
export const nuxtUIInputTagsDefinition = createInput(FUInputTags, {
|
|
47
|
+
props: ["placeholder", "maxLength", "color", "variant", "size", "autofocus", "autofocusDelay", "deleteIcon", "highlight", "fixed", "addOnPaste", "addOnTab", "addOnBlur", "duplicate", "delimiters", "max", "convertValue", "displayValue", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "list", "autocomplete", "ui"],
|
|
48
|
+
family: "NuxtUIInput"
|
|
49
|
+
});
|
|
50
|
+
export const nuxtUIInputTimeDefinition = createInput(FUInputTime, {
|
|
51
|
+
props: ["color", "variant", "size", "highlight", "fixed", "autofocus", "autofocusDelay", "defaultValue", "placeholder", "defaultPlaceholder", "hourCycle", "step", "stepSnapping", "granularity", "hideTimeZone", "maxValue", "minValue", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "ui"],
|
|
52
|
+
family: "NuxtUIInput"
|
|
53
|
+
});
|
|
54
|
+
export const nuxtUIPinInputDefinition = createInput(FUPinInput, {
|
|
55
|
+
props: ["color", "variant", "size", "length", "autofocus", "autofocusDelay", "highlight", "fixed", "defaultValue", "mask", "otp", "placeholder", "ui"],
|
|
56
|
+
family: "NuxtUIInput"
|
|
57
|
+
});
|
|
58
|
+
export const nuxtUIRadioGroupDefinition = createInput(FURadioGroup, {
|
|
59
|
+
props: ["options", "legend", "valueKey", "labelKey", "descriptionKey", "size", "variant", "orientation", "loop", "name", "color", "indicator", "ui"],
|
|
60
|
+
family: "NuxtUIInput"
|
|
61
|
+
});
|
|
62
|
+
export const nuxtUISelectDefinition = createInput(FUSelect, {
|
|
63
|
+
props: ["options", "placeholder", "color", "variant", "size", "selectedIcon", "arrow", "portal", "valueKey", "labelKey", "descriptionKey", "defaultValue", "multiple", "highlight", "fixed", "autofocus", "autofocusDelay", "open", "defaultOpen", "autocomplete", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "ui"],
|
|
64
|
+
family: "NuxtUIInput"
|
|
65
|
+
});
|
|
66
|
+
export const nuxtUISelectMenuDefinition = createInput(FUSelectMenu, {
|
|
67
|
+
props: ["options", "placeholder", "searchInput", "color", "variant", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "selectedIcon", "clear", "clearIcon", "arrow", "portal", "virtualize", "valueKey", "labelKey", "descriptionKey", "defaultValue", "multiple", "highlight", "fixed", "createItem", "filterFields", "ignoreFilter", "autofocus", "autofocusDelay", "open", "defaultOpen", "resetSearchTermOnBlur", "resetSearchTermOnSelect", "resetModelValueOnClear", "highlightOnHover", "searchTerm", "ui"],
|
|
68
|
+
family: "NuxtUIInput"
|
|
69
|
+
});
|
|
70
|
+
export const nuxtUISliderDefinition = createInput(FUSlider, {
|
|
71
|
+
props: ["color", "size", "orientation", "tooltip", "defaultValue", "name", "inverted", "min", "max", "step", "minStepsBetweenThumbs", "ui"],
|
|
72
|
+
family: "NuxtUIInput"
|
|
73
|
+
});
|
|
74
|
+
export const nuxtUISwitchDefinition = createInput(FUSwitch, {
|
|
75
|
+
props: ["color", "size", "loading", "loadingIcon", "checkedIcon", "uncheckedIcon", "label", "description", "defaultValue", "autofocus", "ui"],
|
|
76
|
+
family: "NuxtUIInput"
|
|
77
|
+
});
|
|
78
|
+
export const nuxtUITextareaDefinition = createInput(FUTextarea, {
|
|
79
|
+
props: ["color", "size", "variant", "placeholder", "autofocus", "autofocusDelay", "autoresize", "autoresizeDelay", "rows", "maxrows", "highlight", "fixed", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "cols", "dirname", "maxlength", "minlength", "wrap", "ui"],
|
|
80
|
+
family: "NuxtUIInput"
|
|
81
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FormKitTypeDefinition } from '@formkit/core';
|
|
2
|
+
export declare const nuxtUIOutputTextDefinition: FormKitTypeDefinition;
|
|
3
|
+
export declare const nuxtUIOutputBooleanDefinition: FormKitTypeDefinition;
|
|
4
|
+
export declare const nuxtUIOutputDateDefinition: FormKitTypeDefinition;
|
|
5
|
+
export declare const nuxtUIOutputLinkDefinition: FormKitTypeDefinition;
|
|
6
|
+
export declare const nuxtUIOutputNumberDefinition: FormKitTypeDefinition;
|
|
7
|
+
export declare const nuxtUIOutputListDefinition: FormKitTypeDefinition;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createInput } from "@formkit/vue";
|
|
2
|
+
import FUOutputDate from "../components/output/FUOutputDate.vue";
|
|
3
|
+
import FUOutputBoolean from "../components/output/FUOutputBoolean.vue";
|
|
4
|
+
import FUOutputText from "../components/output/FUOutputText.vue";
|
|
5
|
+
import FUOutputLink from "../components/output/FUOutputLink.vue";
|
|
6
|
+
import FUOutputNumber from "../components/output/FUOutputNumber.vue";
|
|
7
|
+
import FUOutputList from "../components/output/FUOutputList.vue";
|
|
8
|
+
export const nuxtUIOutputTextDefinition = createInput(FUOutputText, {
|
|
9
|
+
props: ["size", "color", "variant", "icon", "leadingIcon", "trailingIcon", "leading", "trailing", "onIconClicked", "onLeadingIconClicked", "onTrailingIconClicked"],
|
|
10
|
+
family: "NuxtUIOutput"
|
|
11
|
+
});
|
|
12
|
+
export const nuxtUIOutputBooleanDefinition = createInput(FUOutputBoolean, {
|
|
13
|
+
props: ["size", "color", "variant", "icon", "leadingIcon", "trailingIcon", "leading", "trailing", "trueValue", "falseValue", "trueIcon", "falseIcon", "onIconClicked", "onLeadingIconClicked", "onTrailingIconClicked"],
|
|
14
|
+
family: "NuxtUIOutput"
|
|
15
|
+
});
|
|
16
|
+
export const nuxtUIOutputDateDefinition = createInput(FUOutputDate, {
|
|
17
|
+
props: ["size", "color", "variant", "icon", "leadingIcon", "trailingIcon", "leading", "trailing", "dateStyle", "timeStyle", "locale", "relative", "onIconClicked", "onLeadingIconClicked", "onTrailingIconClicked"],
|
|
18
|
+
family: "NuxtUIOutput"
|
|
19
|
+
});
|
|
20
|
+
export const nuxtUIOutputLinkDefinition = createInput(FUOutputLink, {
|
|
21
|
+
props: ["size", "color", "variant", "icon", "leadingIcon", "trailingIcon", "leading", "trailing", "target", "rel", "underline", "onIconClicked", "onLeadingIconClicked", "onTrailingIconClicked"],
|
|
22
|
+
family: "NuxtUIOutput"
|
|
23
|
+
});
|
|
24
|
+
export const nuxtUIOutputNumberDefinition = createInput(FUOutputNumber, {
|
|
25
|
+
props: ["size", "color", "variant", "icon", "leadingIcon", "trailingIcon", "leading", "trailing", "locale", "formatOptions", "onIconClicked", "onLeadingIconClicked", "onTrailingIconClicked"],
|
|
26
|
+
family: "NuxtUIOutput"
|
|
27
|
+
});
|
|
28
|
+
export const nuxtUIOutputListDefinition = createInput(FUOutputList, {
|
|
29
|
+
props: ["size", "color", "variant", "icon", "leadingIcon", "trailingIcon", "leading", "trailing", "listType", "separator", "itemClass", "onIconClicked", "onLeadingIconClicked", "onTrailingIconClicked"],
|
|
30
|
+
family: "NuxtUIOutput"
|
|
31
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createAutoAnimatePlugin } from "@formkit/addons";
|
|
2
|
+
import { de, en } from "@formkit/i18n";
|
|
3
|
+
import { nuxtUIInputs, nuxtUIOutputs } from "../runtime/definitions";
|
|
4
|
+
import { addNuxtAsteriskPlugin } from "../runtime/plugins";
|
|
5
|
+
const config = {
|
|
6
|
+
locales: { en, de },
|
|
7
|
+
// Define the active locale
|
|
8
|
+
locale: "en",
|
|
9
|
+
inputs: { ...nuxtUIInputs, ...nuxtUIOutputs },
|
|
10
|
+
// ignore FormKit iconLoader since we use our own icons and don't want to load the default ones
|
|
11
|
+
iconLoader: (_) => {
|
|
12
|
+
return void 0;
|
|
13
|
+
},
|
|
14
|
+
plugins: [
|
|
15
|
+
createAutoAnimatePlugin(
|
|
16
|
+
{
|
|
17
|
+
/* optional AutoAnimate config */
|
|
18
|
+
// default:
|
|
19
|
+
duration: 250,
|
|
20
|
+
easing: "ease-in-out"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
/* optional animation targets object */
|
|
24
|
+
// default:
|
|
25
|
+
global: ["outer", "inner"],
|
|
26
|
+
form: ["form"],
|
|
27
|
+
repeater: ["items"]
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
addNuxtAsteriskPlugin
|
|
31
|
+
]
|
|
32
|
+
};
|
|
33
|
+
export default config;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export function addNuxtAsteriskPlugin(node) {
|
|
2
|
+
if (!node.props.type.startsWith("nuxtUI") || node.props.type.startsWith("UFOutput"))
|
|
3
|
+
return;
|
|
4
|
+
node.on("created", () => {
|
|
5
|
+
if (node.props.definition?.schema) {
|
|
6
|
+
const schemaFn = node.props.definition?.schema;
|
|
7
|
+
node.props.definition.schema = (sectionsSchema = {}) => {
|
|
8
|
+
sectionsSchema.label = {
|
|
9
|
+
children: ["$label", {
|
|
10
|
+
$el: "span",
|
|
11
|
+
if: "$state.required",
|
|
12
|
+
attrs: {
|
|
13
|
+
class: "text-error nuxt-ui-formkit--asterisk"
|
|
14
|
+
},
|
|
15
|
+
children: [" *"]
|
|
16
|
+
}]
|
|
17
|
+
};
|
|
18
|
+
return schemaFn(sectionsSchema);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export function addNuxtLabelPlugin(node) {
|
|
24
|
+
if (!node.props.type.startsWith("nuxtUi"))
|
|
25
|
+
return;
|
|
26
|
+
node.on("created", () => {
|
|
27
|
+
if (node.props.definition?.schema) {
|
|
28
|
+
const schemaFn = node.props.definition?.schema;
|
|
29
|
+
node.props.definition.schema = (sectionsSchema = {}) => {
|
|
30
|
+
sectionsSchema.label = {
|
|
31
|
+
children: [{
|
|
32
|
+
$el: "span",
|
|
33
|
+
attrs: {
|
|
34
|
+
title: "$help",
|
|
35
|
+
class: "p-formkit-label"
|
|
36
|
+
},
|
|
37
|
+
children: ["$label"]
|
|
38
|
+
}, {
|
|
39
|
+
$el: "span",
|
|
40
|
+
if: "$state.required",
|
|
41
|
+
attrs: {
|
|
42
|
+
class: "p-formkit-required",
|
|
43
|
+
title: "$help"
|
|
44
|
+
},
|
|
45
|
+
children: ["*"]
|
|
46
|
+
}]
|
|
47
|
+
};
|
|
48
|
+
sectionsSchema.help = {
|
|
49
|
+
children: []
|
|
50
|
+
};
|
|
51
|
+
return schemaFn(sectionsSchema);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FormKitFrameworkContext } from '@formkit/core';
|
|
2
|
+
export declare function useFormKitInput(context: FormKitFrameworkContext): {
|
|
3
|
+
isInvalid: import("vue").ComputedRef<boolean>;
|
|
4
|
+
validSlotNames: import("vue").ComputedRef<string[]>;
|
|
5
|
+
styleClass: import("vue").ComputedRef<string>;
|
|
6
|
+
color: import("vue").ComputedRef<"error" | "primary" | "secondary" | "success" | "info" | "warning" | "neutral">;
|
|
7
|
+
handleBlur: (event: FocusEvent) => void;
|
|
8
|
+
handleChange: (_: unknown) => void;
|
|
9
|
+
handleInput: (_: unknown) => void;
|
|
10
|
+
handleSelect: (e: unknown) => void;
|
|
11
|
+
modelValue: import("vue").WritableComputedRef<any, any>;
|
|
12
|
+
items: import("vue").ComputedRef<any[]>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
export function useFormKitInput(context) {
|
|
3
|
+
const isInvalid = computed(() => {
|
|
4
|
+
return context?.state?.validationVisible && !context?.state?.valid;
|
|
5
|
+
});
|
|
6
|
+
const styleClass = computed(() => {
|
|
7
|
+
return isInvalid.value ? `${context?.attrs?.class || ""} nuxt-ui-formkit--invalid` : String(context?.attrs?.class || "");
|
|
8
|
+
});
|
|
9
|
+
const color = computed(() => {
|
|
10
|
+
return isInvalid.value ? "error" : context?.color || "primary";
|
|
11
|
+
});
|
|
12
|
+
const formKitCreateInputSlots = /* @__PURE__ */ new Set(["label", "help", "messages", "message", "input"]);
|
|
13
|
+
const validSlotNames = computed(
|
|
14
|
+
() => Object.keys(context?.slots || {}).filter((slotName) => !formKitCreateInputSlots.has(slotName))
|
|
15
|
+
);
|
|
16
|
+
function handleBlur(event) {
|
|
17
|
+
context?.handlers?.blur?.(event);
|
|
18
|
+
}
|
|
19
|
+
function handleChange(_) {
|
|
20
|
+
context?.node?.input?.(context?._value);
|
|
21
|
+
}
|
|
22
|
+
function handleInput(_) {
|
|
23
|
+
context?.node?.input?.(context?._value);
|
|
24
|
+
}
|
|
25
|
+
function handleSelect(e) {
|
|
26
|
+
context?.node?.input?.(e);
|
|
27
|
+
}
|
|
28
|
+
const modelValue = computed({
|
|
29
|
+
get: () => context._value,
|
|
30
|
+
set: (value) => {
|
|
31
|
+
context.node.input(value);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const items = computed(() => {
|
|
35
|
+
const options = context.options ?? context.attrs.items;
|
|
36
|
+
if (Array.isArray(options)) {
|
|
37
|
+
return options;
|
|
38
|
+
}
|
|
39
|
+
return [];
|
|
40
|
+
});
|
|
41
|
+
return { isInvalid, validSlotNames, styleClass, color, handleBlur, handleChange, handleInput, handleSelect, modelValue, items };
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FormKitFrameworkContext } from '@formkit/core';
|
|
2
|
+
export declare function useFormKitOutput(context: FormKitFrameworkContext): {
|
|
3
|
+
colorClass: import("vue").ComputedRef<string>;
|
|
4
|
+
sizeClass: import("vue").ComputedRef<string>;
|
|
5
|
+
variantClass: import("vue").ComputedRef<string>;
|
|
6
|
+
containerClass: import("vue").ComputedRef<string>;
|
|
7
|
+
iconClass: import("vue").ComputedRef<string>;
|
|
8
|
+
leadingIconName: import("vue").ComputedRef<string | null>;
|
|
9
|
+
trailingIconName: import("vue").ComputedRef<string | null>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
export function useFormKitOutput(context) {
|
|
3
|
+
const colorClass = computed(() => {
|
|
4
|
+
const color = context.color ?? "neutral";
|
|
5
|
+
const colorMap = {
|
|
6
|
+
primary: "text-primary",
|
|
7
|
+
secondary: "text-secondary",
|
|
8
|
+
success: "text-success",
|
|
9
|
+
info: "text-info",
|
|
10
|
+
warning: "text-warning",
|
|
11
|
+
error: "text-error",
|
|
12
|
+
neutral: "text-gray-900 dark:text-gray-100"
|
|
13
|
+
};
|
|
14
|
+
return colorMap[color] || colorMap.neutral;
|
|
15
|
+
});
|
|
16
|
+
const sizeClass = computed(() => {
|
|
17
|
+
const size = context.size ?? "md";
|
|
18
|
+
const sizeMap = {
|
|
19
|
+
xs: "text-xs",
|
|
20
|
+
sm: "text-sm",
|
|
21
|
+
md: "text-base",
|
|
22
|
+
lg: "text-lg",
|
|
23
|
+
xl: "text-xl"
|
|
24
|
+
};
|
|
25
|
+
return sizeMap[size] || sizeMap.md;
|
|
26
|
+
});
|
|
27
|
+
const variantClass = computed(() => {
|
|
28
|
+
const variant = context.variant ?? "none";
|
|
29
|
+
const variantMap = {
|
|
30
|
+
outline: "border border-gray-300 dark:border-gray-700 rounded-md px-2 py-1",
|
|
31
|
+
soft: "bg-gray-100 dark:bg-gray-800 rounded-md",
|
|
32
|
+
subtle: "bg-gray-50 dark:bg-gray-900 rounded-md",
|
|
33
|
+
ghost: "hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md",
|
|
34
|
+
none: ""
|
|
35
|
+
};
|
|
36
|
+
return variantMap[variant] || variantMap.none;
|
|
37
|
+
});
|
|
38
|
+
const containerClass = computed(() => {
|
|
39
|
+
return [
|
|
40
|
+
"inline-flex items-center gap-2",
|
|
41
|
+
colorClass.value,
|
|
42
|
+
sizeClass.value,
|
|
43
|
+
variantClass.value,
|
|
44
|
+
context?.attrs?.class
|
|
45
|
+
].filter(Boolean).join(" ");
|
|
46
|
+
});
|
|
47
|
+
const iconClass = computed(() => {
|
|
48
|
+
const size = context.size ?? "md";
|
|
49
|
+
const iconSizeMap = {
|
|
50
|
+
xs: "h-3 w-3",
|
|
51
|
+
sm: "h-4 w-4",
|
|
52
|
+
md: "h-5 w-5",
|
|
53
|
+
lg: "h-6 w-6",
|
|
54
|
+
xl: "h-7 w-7"
|
|
55
|
+
};
|
|
56
|
+
return iconSizeMap[size] || iconSizeMap.md;
|
|
57
|
+
});
|
|
58
|
+
const leadingIconName = computed(() => {
|
|
59
|
+
return context.leadingIcon || context.leading && context.icon || null;
|
|
60
|
+
});
|
|
61
|
+
const trailingIconName = computed(() => {
|
|
62
|
+
return context.trailingIcon || context.trailing && context.icon || null;
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
colorClass,
|
|
66
|
+
sizeClass,
|
|
67
|
+
variantClass,
|
|
68
|
+
containerClass,
|
|
69
|
+
iconClass,
|
|
70
|
+
leadingIconName,
|
|
71
|
+
trailingIconName
|
|
72
|
+
};
|
|
73
|
+
}
|
package/dist/types.d.mts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sfxcode/formkit-nuxt-ui",
|
|
3
|
+
"version": "0.7.2",
|
|
4
|
+
"description": "FormKit integration for Nuxt UI - Seamlessly connect FormKit form handling with Nuxt UI components",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Tom",
|
|
7
|
+
"email": "tom@sfxcode.com"
|
|
8
|
+
},
|
|
9
|
+
"contributors": [
|
|
10
|
+
{
|
|
11
|
+
"name": "sfxcode",
|
|
12
|
+
"email": "tom@sfxcode.com"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"homepage": "https://github.com/sfxcode/formkit-nuxt-ui",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/sfxcode/formkit-nuxt-ui.git"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"nuxt",
|
|
23
|
+
"nuxt-module",
|
|
24
|
+
"nuxt3",
|
|
25
|
+
"nuxt4",
|
|
26
|
+
"formkit",
|
|
27
|
+
"nuxt-ui",
|
|
28
|
+
"vue",
|
|
29
|
+
"vue3",
|
|
30
|
+
"forms",
|
|
31
|
+
"form-validation",
|
|
32
|
+
"ui-components",
|
|
33
|
+
"typescript",
|
|
34
|
+
"design-system",
|
|
35
|
+
"form-builder"
|
|
36
|
+
],
|
|
37
|
+
"packageManager": "pnpm@10.30.1+sha512.3590e550d5384caa39bd5c7c739f72270234b2f6059e13018f975c313b1eb9fefcc09714048765d4d9efe961382c312e624572c0420762bdc5d5940cdf9be73a",
|
|
38
|
+
"type": "module",
|
|
39
|
+
"exports": {
|
|
40
|
+
".": {
|
|
41
|
+
"types": "./dist/types.d.mts",
|
|
42
|
+
"import": "./dist/module.mjs"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"main": "./dist/module.mjs",
|
|
46
|
+
"typesVersions": {
|
|
47
|
+
"*": {
|
|
48
|
+
".": [
|
|
49
|
+
"./dist/types.d.mts"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"dist"
|
|
55
|
+
],
|
|
56
|
+
"scripts": {
|
|
57
|
+
"prepack": "nuxt-module-build build",
|
|
58
|
+
"dev": "npm run dev:prepare && nuxi dev playground",
|
|
59
|
+
"dev:build": "nuxi build playground",
|
|
60
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
61
|
+
"release": "npm run lint && npm run test && npm run prepack && changelogen --patch --release && npm publish --access=public && git push --follow-tags",
|
|
62
|
+
"lint": "eslint .",
|
|
63
|
+
"test": "vitest run",
|
|
64
|
+
"test:watch": "vitest watch",
|
|
65
|
+
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
66
|
+
},
|
|
67
|
+
"dependencies": {
|
|
68
|
+
"@formkit/addons": "^1.7.2",
|
|
69
|
+
"@formkit/nuxt": "^1.7.2",
|
|
70
|
+
"@nuxt/kit": "^4.3.1",
|
|
71
|
+
"@nuxt/ui": "^4.4.0"
|
|
72
|
+
},
|
|
73
|
+
"devDependencies": {
|
|
74
|
+
"@iconify-json/heroicons": "^1.2.3",
|
|
75
|
+
"@iconify-json/lucide": "^1.2.92",
|
|
76
|
+
"@iconify-json/simple-icons": "^1.2.71",
|
|
77
|
+
"@nuxt/devtools": "^3.2.1",
|
|
78
|
+
"@nuxt/eslint-config": "^1.15.1",
|
|
79
|
+
"@nuxt/module-builder": "^1.0.2",
|
|
80
|
+
"@nuxt/schema": "^4.3.1",
|
|
81
|
+
"@nuxt/test-utils": "^4.0.0",
|
|
82
|
+
"@types/node": "latest",
|
|
83
|
+
"changelogen": "^0.6.2",
|
|
84
|
+
"eslint": "^10.0.1",
|
|
85
|
+
"nuxt": "^4.3.1",
|
|
86
|
+
"sass-embedded": "^1.97.3",
|
|
87
|
+
"typescript": "~5.9.3",
|
|
88
|
+
"vitest": "^4.0.18",
|
|
89
|
+
"vue-tsc": "^3.2.5"
|
|
90
|
+
}
|
|
91
|
+
}
|