@sfxcode/nuxt-ui-formkit 0.8.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.
Files changed (116) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +430 -0
  3. package/dist/module.d.mts +7 -0
  4. package/dist/module.d.ts +7 -0
  5. package/dist/module.json +12 -0
  6. package/dist/module.mjs +29 -0
  7. package/dist/runtime/components/FUDataDebug.d.vue.ts +43 -0
  8. package/dist/runtime/components/FUDataDebug.vue +32 -0
  9. package/dist/runtime/components/FUDataDebug.vue.d.ts +43 -0
  10. package/dist/runtime/components/FUDataEdit.d.vue.ts +180 -0
  11. package/dist/runtime/components/FUDataEdit.vue +143 -0
  12. package/dist/runtime/components/FUDataEdit.vue.d.ts +180 -0
  13. package/dist/runtime/components/FUDataView.d.vue.ts +73 -0
  14. package/dist/runtime/components/FUDataView.vue +59 -0
  15. package/dist/runtime/components/FUDataView.vue.d.ts +73 -0
  16. package/dist/runtime/components/inputs/FUCheckbox.d.vue.ts +27 -0
  17. package/dist/runtime/components/inputs/FUCheckbox.vue +44 -0
  18. package/dist/runtime/components/inputs/FUCheckbox.vue.d.ts +27 -0
  19. package/dist/runtime/components/inputs/FUCheckboxGroup.d.vue.ts +38 -0
  20. package/dist/runtime/components/inputs/FUCheckboxGroup.vue +45 -0
  21. package/dist/runtime/components/inputs/FUCheckboxGroup.vue.d.ts +38 -0
  22. package/dist/runtime/components/inputs/FUColorPicker.d.vue.ts +22 -0
  23. package/dist/runtime/components/inputs/FUColorPicker.vue +27 -0
  24. package/dist/runtime/components/inputs/FUColorPicker.vue.d.ts +22 -0
  25. package/dist/runtime/components/inputs/FUInput.d.vue.ts +44 -0
  26. package/dist/runtime/components/inputs/FUInput.vue +61 -0
  27. package/dist/runtime/components/inputs/FUInput.vue.d.ts +44 -0
  28. package/dist/runtime/components/inputs/FUInputDate.d.vue.ts +51 -0
  29. package/dist/runtime/components/inputs/FUInputDate.vue +63 -0
  30. package/dist/runtime/components/inputs/FUInputDate.vue.d.ts +51 -0
  31. package/dist/runtime/components/inputs/FUInputMenu.d.vue.ts +73 -0
  32. package/dist/runtime/components/inputs/FUInputMenu.vue +76 -0
  33. package/dist/runtime/components/inputs/FUInputMenu.vue.d.ts +73 -0
  34. package/dist/runtime/components/inputs/FUInputNumber.d.vue.ts +43 -0
  35. package/dist/runtime/components/inputs/FUInputNumber.vue +60 -0
  36. package/dist/runtime/components/inputs/FUInputNumber.vue.d.ts +43 -0
  37. package/dist/runtime/components/inputs/FUInputTags.d.vue.ts +47 -0
  38. package/dist/runtime/components/inputs/FUInputTags.vue +64 -0
  39. package/dist/runtime/components/inputs/FUInputTags.vue.d.ts +47 -0
  40. package/dist/runtime/components/inputs/FUInputTime.d.vue.ts +50 -0
  41. package/dist/runtime/components/inputs/FUInputTime.vue +61 -0
  42. package/dist/runtime/components/inputs/FUInputTime.vue.d.ts +50 -0
  43. package/dist/runtime/components/inputs/FUPinInput.d.vue.ts +30 -0
  44. package/dist/runtime/components/inputs/FUPinInput.vue +37 -0
  45. package/dist/runtime/components/inputs/FUPinInput.vue.d.ts +30 -0
  46. package/dist/runtime/components/inputs/FURadioGroup.d.vue.ts +37 -0
  47. package/dist/runtime/components/inputs/FURadioGroup.vue +46 -0
  48. package/dist/runtime/components/inputs/FURadioGroup.vue.d.ts +37 -0
  49. package/dist/runtime/components/inputs/FUSelect.d.vue.ts +48 -0
  50. package/dist/runtime/components/inputs/FUSelect.vue +62 -0
  51. package/dist/runtime/components/inputs/FUSelect.vue.d.ts +48 -0
  52. package/dist/runtime/components/inputs/FUSelectMenu.d.vue.ts +73 -0
  53. package/dist/runtime/components/inputs/FUSelectMenu.vue +73 -0
  54. package/dist/runtime/components/inputs/FUSelectMenu.vue.d.ts +73 -0
  55. package/dist/runtime/components/inputs/FUSlider.d.vue.ts +29 -0
  56. package/dist/runtime/components/inputs/FUSlider.vue +36 -0
  57. package/dist/runtime/components/inputs/FUSlider.vue.d.ts +29 -0
  58. package/dist/runtime/components/inputs/FUSwitch.d.vue.ts +28 -0
  59. package/dist/runtime/components/inputs/FUSwitch.vue +45 -0
  60. package/dist/runtime/components/inputs/FUSwitch.vue.d.ts +28 -0
  61. package/dist/runtime/components/inputs/FUTextarea.d.vue.ts +44 -0
  62. package/dist/runtime/components/inputs/FUTextarea.vue +61 -0
  63. package/dist/runtime/components/inputs/FUTextarea.vue.d.ts +44 -0
  64. package/dist/runtime/components/output/FUIcon.d.vue.ts +38 -0
  65. package/dist/runtime/components/output/FUIcon.vue +20 -0
  66. package/dist/runtime/components/output/FUIcon.vue.d.ts +38 -0
  67. package/dist/runtime/components/output/FUOutputBoolean.d.vue.ts +30 -0
  68. package/dist/runtime/components/output/FUOutputBoolean.vue +56 -0
  69. package/dist/runtime/components/output/FUOutputBoolean.vue.d.ts +30 -0
  70. package/dist/runtime/components/output/FUOutputDate.d.vue.ts +30 -0
  71. package/dist/runtime/components/output/FUOutputDate.vue +52 -0
  72. package/dist/runtime/components/output/FUOutputDate.vue.d.ts +30 -0
  73. package/dist/runtime/components/output/FUOutputLink.d.vue.ts +28 -0
  74. package/dist/runtime/components/output/FUOutputLink.vue +78 -0
  75. package/dist/runtime/components/output/FUOutputLink.vue.d.ts +28 -0
  76. package/dist/runtime/components/output/FUOutputList.d.vue.ts +29 -0
  77. package/dist/runtime/components/output/FUOutputList.vue +143 -0
  78. package/dist/runtime/components/output/FUOutputList.vue.d.ts +29 -0
  79. package/dist/runtime/components/output/FUOutputNumber.d.vue.ts +28 -0
  80. package/dist/runtime/components/output/FUOutputNumber.vue +52 -0
  81. package/dist/runtime/components/output/FUOutputNumber.vue.d.ts +28 -0
  82. package/dist/runtime/components/output/FUOutputText.d.vue.ts +27 -0
  83. package/dist/runtime/components/output/FUOutputText.vue +90 -0
  84. package/dist/runtime/components/output/FUOutputText.vue.d.ts +27 -0
  85. package/dist/runtime/composables/useFormKitRepeater.d.ts +5 -0
  86. package/dist/runtime/composables/useFormKitRepeater.js +53 -0
  87. package/dist/runtime/composables/useFormKitSchema.d.ts +26 -0
  88. package/dist/runtime/composables/useFormKitSchema.js +58 -0
  89. package/dist/runtime/formkit/definitions/index.d.ts +28 -0
  90. package/dist/runtime/formkit/definitions/index.js +30 -0
  91. package/dist/runtime/formkit/definitions/index.mjs +30 -0
  92. package/dist/runtime/formkit/definitions/input.d.ts +17 -0
  93. package/dist/runtime/formkit/definitions/input.js +81 -0
  94. package/dist/runtime/formkit/definitions/input.mjs +81 -0
  95. package/dist/runtime/formkit/definitions/output.d.ts +7 -0
  96. package/dist/runtime/formkit/definitions/output.js +31 -0
  97. package/dist/runtime/formkit/definitions/output.mjs +31 -0
  98. package/dist/runtime/formkit/index.d.ts +93 -0
  99. package/dist/runtime/formkit/index.js +2 -0
  100. package/dist/runtime/formkit/index.mjs +2 -0
  101. package/dist/runtime/formkit/plugins/index.d.ts +3 -0
  102. package/dist/runtime/formkit/plugins/index.js +55 -0
  103. package/dist/runtime/formkit/plugins/index.mjs +55 -0
  104. package/dist/runtime/plugin.d.ts +2 -0
  105. package/dist/runtime/plugin.js +3 -0
  106. package/dist/runtime/server/tsconfig.json +3 -0
  107. package/dist/runtime/utils/colorConverter.d.ts +5 -0
  108. package/dist/runtime/utils/colorConverter.js +134 -0
  109. package/dist/runtime/utils/durationConverter.d.ts +2 -0
  110. package/dist/runtime/utils/durationConverter.js +32 -0
  111. package/dist/runtime/utils/useFormKitInput.d.ts +13 -0
  112. package/dist/runtime/utils/useFormKitInput.js +42 -0
  113. package/dist/runtime/utils/useFormKitOutput.d.ts +10 -0
  114. package/dist/runtime/utils/useFormKitOutput.js +73 -0
  115. package/dist/types.d.mts +3 -0
  116. package/package.json +114 -0
@@ -0,0 +1,55 @@
1
+ export function addNuxtAsteriskPlugin(node) {
2
+ if (!node.props.type.startsWith("nuxtUI") || node.props.type.startsWith("FUOutput"))
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,55 @@
1
+ export function addNuxtAsteriskPlugin(node) {
2
+ if (!node.props.type.startsWith("nuxtUI") || node.props.type.startsWith("FUOutput"))
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,2 @@
1
+ declare const _default: import("#app").Plugin<Record<string, unknown>> & import("#app").ObjectPlugin<Record<string, unknown>>;
2
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { defineNuxtPlugin } from "#app";
2
+ export default defineNuxtPlugin((_nuxtApp) => {
3
+ });
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "../../../.nuxt/tsconfig.server.json",
3
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Converts various color formats to hex
3
+ * Supports: hex, rgb, rgba, hsl, hsla, cmyk, lab
4
+ */
5
+ export declare function convertColorToHex(color: string): string;
@@ -0,0 +1,134 @@
1
+ export function convertColorToHex(color) {
2
+ if (!color)
3
+ return "#000000";
4
+ const trimmedColor = color.trim();
5
+ if (trimmedColor.startsWith("#")) {
6
+ return normalizeHex(trimmedColor);
7
+ }
8
+ if (trimmedColor.toLowerCase().startsWith("rgb")) {
9
+ return rgbToHex(trimmedColor);
10
+ }
11
+ if (trimmedColor.toLowerCase().startsWith("hsl")) {
12
+ return hslToHex(trimmedColor);
13
+ }
14
+ if (trimmedColor.toLowerCase().startsWith("cmyk")) {
15
+ return cmykToHex(trimmedColor);
16
+ }
17
+ if (trimmedColor.toLowerCase().startsWith("lab")) {
18
+ return labToHex(trimmedColor);
19
+ }
20
+ if (/^[\da-f]{3,8}$/i.test(trimmedColor)) {
21
+ return normalizeHex(`#${trimmedColor}`);
22
+ }
23
+ return "#000000";
24
+ }
25
+ function normalizeHex(hex) {
26
+ const cleaned = hex.replace("#", "").toLowerCase();
27
+ if (!/^[\da-f]+$/i.test(cleaned) || cleaned.length === 0) {
28
+ return "#000000";
29
+ }
30
+ if (cleaned.length === 3) {
31
+ return `#${cleaned[0]}${cleaned[0]}${cleaned[1]}${cleaned[1]}${cleaned[2]}${cleaned[2]}`;
32
+ }
33
+ if (cleaned.length === 4) {
34
+ return `#${cleaned[0]}${cleaned[0]}${cleaned[1]}${cleaned[1]}${cleaned[2]}${cleaned[2]}`;
35
+ }
36
+ if (cleaned.length === 8) {
37
+ return `#${cleaned.substring(0, 6)}`;
38
+ }
39
+ if (cleaned.length === 6) {
40
+ return `#${cleaned}`;
41
+ }
42
+ if (cleaned.length < 6) {
43
+ return `#${cleaned.padEnd(6, "0")}`;
44
+ }
45
+ return `#${cleaned.substring(0, 6)}`;
46
+ }
47
+ function rgbToHex(rgb) {
48
+ const match = rgb.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)/i);
49
+ if (!match)
50
+ return "#000000";
51
+ const r = Number.parseInt(match[1], 10);
52
+ const g = Number.parseInt(match[2], 10);
53
+ const b = Number.parseInt(match[3], 10);
54
+ return `#${componentToHex(r)}${componentToHex(g)}${componentToHex(b)}`;
55
+ }
56
+ function hslToHex(hsl) {
57
+ const match = hsl.match(/hsla?\((\d+),\s*([\d.]+)%,\s*([\d.]+)%(?:,\s*[\d.]+)?\)/);
58
+ if (!match)
59
+ return "#000000";
60
+ const h = Number.parseInt(match[1], 10) / 360;
61
+ const s = Number.parseFloat(match[2]) / 100;
62
+ const l = Number.parseFloat(match[3]) / 100;
63
+ let r, g, b;
64
+ if (s === 0) {
65
+ r = g = b = l;
66
+ } else {
67
+ const hue2rgb = (p2, q2, t) => {
68
+ if (t < 0)
69
+ t += 1;
70
+ if (t > 1)
71
+ t -= 1;
72
+ if (t < 1 / 6)
73
+ return p2 + (q2 - p2) * 6 * t;
74
+ if (t < 1 / 2)
75
+ return q2;
76
+ if (t < 2 / 3)
77
+ return p2 + (q2 - p2) * (2 / 3 - t) * 6;
78
+ return p2;
79
+ };
80
+ const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
81
+ const p = 2 * l - q;
82
+ r = hue2rgb(p, q, h + 1 / 3);
83
+ g = hue2rgb(p, q, h);
84
+ b = hue2rgb(p, q, h - 1 / 3);
85
+ }
86
+ return `#${componentToHex(Math.round(r * 255))}${componentToHex(Math.round(g * 255))}${componentToHex(Math.round(b * 255))}`;
87
+ }
88
+ function cmykToHex(cmyk) {
89
+ const match = cmyk.match(/cmyk\(([\d.]+)%?,\s*([\d.]+)%?,\s*([\d.]+)%?,\s*([\d.]+)%?\)/);
90
+ if (!match)
91
+ return "#000000";
92
+ const c = Number.parseFloat(match[1]) / 100;
93
+ const m = Number.parseFloat(match[2]) / 100;
94
+ const y = Number.parseFloat(match[3]) / 100;
95
+ const k = Number.parseFloat(match[4]) / 100;
96
+ const r = Math.round(255 * (1 - c) * (1 - k));
97
+ const g = Math.round(255 * (1 - m) * (1 - k));
98
+ const b = Math.round(255 * (1 - y) * (1 - k));
99
+ return `#${componentToHex(r)}${componentToHex(g)}${componentToHex(b)}`;
100
+ }
101
+ function labToHex(lab) {
102
+ const match = lab.match(/lab\(([\d.]+)%?,\s*([-\d.]+),\s*([-\d.]+)\)/);
103
+ if (!match)
104
+ return "#000000";
105
+ const l = Number.parseFloat(match[1]);
106
+ const a = Number.parseFloat(match[2]);
107
+ const b = Number.parseFloat(match[3]);
108
+ let y = (l + 16) / 116;
109
+ let x = a / 500 + y;
110
+ let z = y - b / 200;
111
+ const labToXyzHelper = (t) => {
112
+ return t > 0.206897 ? t ** 3 : (t - 16 / 116) / 7.787;
113
+ };
114
+ x = 95.047 * labToXyzHelper(x);
115
+ y = 100 * labToXyzHelper(y);
116
+ z = 108.883 * labToXyzHelper(z);
117
+ x = x / 100;
118
+ y = y / 100;
119
+ z = z / 100;
120
+ let r = x * 3.2406 + y * -1.5372 + z * -0.4986;
121
+ let g = x * -0.9689 + y * 1.8758 + z * 0.0415;
122
+ let bl = x * 0.0557 + y * -0.204 + z * 1.057;
123
+ const xyzToRgbHelper = (t) => {
124
+ return t > 31308e-7 ? 1.055 * t ** (1 / 2.4) - 0.055 : 12.92 * t;
125
+ };
126
+ r = xyzToRgbHelper(r);
127
+ g = xyzToRgbHelper(g);
128
+ bl = xyzToRgbHelper(bl);
129
+ return `#${componentToHex(Math.max(0, Math.min(255, Math.round(r * 255))))}${componentToHex(Math.max(0, Math.min(255, Math.round(g * 255))))}${componentToHex(Math.max(0, Math.min(255, Math.round(bl * 255))))}`;
130
+ }
131
+ function componentToHex(c) {
132
+ const hex = Math.max(0, Math.min(255, c)).toString(16);
133
+ return hex.length === 1 ? `0${hex}` : hex;
134
+ }
@@ -0,0 +1,2 @@
1
+ export declare function durationToMinutes(duration: string): number;
2
+ export declare function formattedDuration(duration: string): string;
@@ -0,0 +1,32 @@
1
+ export function durationToMinutes(duration) {
2
+ let hours = 0;
3
+ let minutes = 0;
4
+ const lowerDuration = duration.toLowerCase();
5
+ if (lowerDuration.includes(":")) {
6
+ const [h, m] = lowerDuration.split(":").map((part) => +(part?.trim() || "0"));
7
+ hours = h ?? 0;
8
+ minutes = m ?? 0;
9
+ } else {
10
+ if (lowerDuration.includes("h")) {
11
+ hours = +(lowerDuration.split("h")[0]?.trim() || "0");
12
+ const remainder = lowerDuration.split("h")[1] || "";
13
+ if (remainder.includes("m"))
14
+ minutes = +(remainder.split("m")[0]?.trim() || "0");
15
+ else if (/^\d+$/.test(remainder))
16
+ minutes = +remainder;
17
+ } else if (lowerDuration.includes("m")) {
18
+ minutes = +(lowerDuration.split("m")[0]?.trim() || "0");
19
+ } else if (/^\d+$/.test(lowerDuration)) {
20
+ minutes = +lowerDuration;
21
+ }
22
+ }
23
+ return hours * 60 + minutes;
24
+ }
25
+ export function formattedDuration(duration) {
26
+ const minutes = durationToMinutes(duration);
27
+ const hours = Math.trunc(minutes / 60);
28
+ const remainingMinutes = minutes % 60;
29
+ if (minutes === 0)
30
+ return "0";
31
+ return `${hours > 0 ? `${hours}h` : ""}${hours > 0 && remainingMinutes > 0 ? " " : ""}${remainingMinutes > 0 ? `${remainingMinutes}m` : ""}`;
32
+ }
@@ -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
+ }
@@ -0,0 +1,3 @@
1
+ export { default } from './module.mjs'
2
+
3
+ export { type ModuleOptions } from './module.mjs'
package/package.json ADDED
@@ -0,0 +1,114 @@
1
+ {
2
+ "name": "@sfxcode/nuxt-ui-formkit",
3
+ "version": "0.8.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/nuxt-ui-formkit",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/sfxcode/nuxt-ui-formkit.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
+ "./definitions": {
45
+ "types": "./dist/runtime/formkit/definitions/index.d.ts",
46
+ "import": "./dist/runtime/formkit/definitions/index.mjs"
47
+ },
48
+ "./plugins": {
49
+ "types": "./dist/runtime/formkit/plugins/index.d.ts",
50
+ "import": "./dist/runtime/formkit/plugins/index.mjs"
51
+ },
52
+ "./formkit": {
53
+ "types": "./dist/runtime/formkit/index.d.ts",
54
+ "import": "./dist/runtime/formkit/index.mjs"
55
+ }
56
+ },
57
+ "main": "./dist/module.mjs",
58
+ "typesVersions": {
59
+ "*": {
60
+ ".": [
61
+ "./dist/types.d.mts"
62
+ ],
63
+ "definitions": [
64
+ "./dist/runtime/formkit/definitions/index.d.ts"
65
+ ],
66
+ "plugins": [
67
+ "./dist/runtime/formkit/plugins/index.d.ts"
68
+ ],
69
+ "formkit": [
70
+ "./dist/runtime/formkit/index.d.ts"
71
+ ]
72
+ }
73
+ },
74
+ "files": [
75
+ "dist"
76
+ ],
77
+ "scripts": {
78
+ "prepack": "nuxt-module-build build",
79
+ "dev": "npm run dev:prepare && nuxi dev playground",
80
+ "dev:build": "nuxi build playground",
81
+ "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
82
+ "release": "npm run lint && npm run test && npm run prepack && changelogen --patch --release && npm publish --access=public && git push --follow-tags",
83
+ "lint": "eslint .",
84
+ "test": "vitest run",
85
+ "test:watch": "vitest watch",
86
+ "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
87
+ },
88
+ "dependencies": {
89
+ "@formkit/addons": "^1.7.2",
90
+ "@formkit/nuxt": "^1.7.2",
91
+ "@nuxt/kit": "^4.3.1",
92
+ "@nuxt/ui": "^4.4.0"
93
+ },
94
+ "devDependencies": {
95
+ "@iconify-json/heroicons": "^1.2.3",
96
+ "@iconify-json/lucide": "^1.2.92",
97
+ "@iconify-json/simple-icons": "^1.2.71",
98
+ "@nuxt/devtools": "^3.2.1",
99
+ "@nuxt/eslint-config": "^1.15.1",
100
+ "@nuxt/module-builder": "^1.0.2",
101
+ "@nuxt/schema": "^4.3.1",
102
+ "@nuxt/test-utils": "^4.0.0",
103
+ "@types/node": "latest",
104
+ "changelogen": "^0.6.2",
105
+ "eslint": "^10.0.1",
106
+ "mkdist": "^2.4.1",
107
+ "nuxt": "^4.3.1",
108
+ "sass-embedded": "^1.97.3",
109
+ "typescript": "~5.9.3",
110
+ "unbuild": "^3.6.1",
111
+ "vitest": "^4.0.18",
112
+ "vue-tsc": "^3.2.5"
113
+ }
114
+ }