@sfxcode/nuxt-ui-formkit 1.1.0 → 1.2.0

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 (32) hide show
  1. package/README.md +4 -1
  2. package/dist/module.json +1 -1
  3. package/dist/runtime/components/FUDataEdit.d.vue.ts +8 -4
  4. package/dist/runtime/components/FUDataEdit.vue +1 -1
  5. package/dist/runtime/components/FUDataEdit.vue.d.ts +8 -4
  6. package/dist/runtime/components/FUDataView.d.vue.ts +8 -4
  7. package/dist/runtime/components/FUDataView.vue +1 -1
  8. package/dist/runtime/components/FUDataView.vue.d.ts +8 -4
  9. package/dist/runtime/components/inputs/FUCalendar.d.vue.ts +38 -0
  10. package/dist/runtime/components/inputs/FUCalendar.vue +49 -0
  11. package/dist/runtime/components/inputs/FUCalendar.vue.d.ts +38 -0
  12. package/dist/runtime/components/inputs/FUEditor.d.vue.ts +60 -0
  13. package/dist/runtime/components/inputs/FUEditor.vue +121 -0
  14. package/dist/runtime/components/inputs/FUEditor.vue.d.ts +60 -0
  15. package/dist/runtime/components/inputs/FUFileUpload.d.vue.ts +39 -0
  16. package/dist/runtime/components/inputs/FUFileUpload.vue +56 -0
  17. package/dist/runtime/components/inputs/FUFileUpload.vue.d.ts +39 -0
  18. package/dist/runtime/components/inputs/FUListbox.d.vue.ts +2 -0
  19. package/dist/runtime/components/inputs/FUListbox.vue +226 -6
  20. package/dist/runtime/components/inputs/FUListbox.vue.d.ts +2 -0
  21. package/dist/runtime/components/output/FUOutputText.vue +3 -8
  22. package/dist/runtime/formkit/definitions/index.d.ts +27 -24
  23. package/dist/runtime/formkit/definitions/index.js +4 -1
  24. package/dist/runtime/formkit/definitions/index.mjs +4 -1
  25. package/dist/runtime/formkit/definitions/input.d.ts +3 -0
  26. package/dist/runtime/formkit/definitions/input.js +16 -1
  27. package/dist/runtime/formkit/definitions/input.mjs +16 -1
  28. package/dist/runtime/formkit/definitions/repeater.js +8 -1
  29. package/dist/runtime/formkit/definitions/repeater.mjs +8 -1
  30. package/dist/runtime/formkit/index.d.ts +13 -1
  31. package/dist/runtime/utils/useFormKitInput.d.ts +1 -1
  32. package/package.json +9 -17
package/README.md CHANGED
@@ -18,10 +18,13 @@ FormKit Nuxt UI bridges the gap between [FormKit](https://formkit.com/)'s powerf
18
18
 
19
19
  ## Features
20
20
 
21
- ✨ **17 Input Components** - Complete set of FormKit-wrapped Nuxt UI input components
21
+ ✨ **20 Input Components** - Complete set of FormKit-wrapped Nuxt UI input components
22
+ - `nuxtUICalendar` - Bare date-grid picker with range/multiple selection
22
23
  - `nuxtUICheckbox` - Single checkbox with label and description
23
24
  - `nuxtUICheckboxGroup` - Multiple checkbox selection
24
25
  - `nuxtUIColorPicker` - Color selection with multiple formats
26
+ - `nuxtUIEditor` - Tiptap-based rich text editor
27
+ - `nuxtUIFileUpload` - Drag/drop and click-to-browse file input
25
28
  - `nuxtUIInput` - Text input with various types (text, email, password, etc.)
26
29
  - `nuxtUIInputDate` - Date and time picker with range support
27
30
  - `nuxtUIInputMenu` - Dropdown menu with searchable options
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=4.0.0"
6
6
  },
7
- "version": "1.1.0",
7
+ "version": "1.2.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -73,9 +73,11 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
73
73
  type: BooleanConstructor;
74
74
  default: boolean;
75
75
  };
76
- modelValue: FormKitSchemaDefinition;
76
+ modelValue: {
77
+ type: PropType<FormKitSchemaDefinition>;
78
+ };
77
79
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
78
- "update:modelValue": (value: any) => any;
80
+ "update:modelValue": (value: FormKitSchemaDefinition | undefined) => any;
79
81
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
80
82
  id: {
81
83
  type: StringConstructor;
@@ -141,9 +143,11 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
141
143
  type: BooleanConstructor;
142
144
  default: boolean;
143
145
  };
144
- modelValue: FormKitSchemaDefinition;
146
+ modelValue: {
147
+ type: PropType<FormKitSchemaDefinition>;
148
+ };
145
149
  }>> & Readonly<{
146
- "onUpdate:modelValue"?: ((value: any) => any) | undefined;
150
+ "onUpdate:modelValue"?: ((value: FormKitSchemaDefinition | undefined) => any) | undefined;
147
151
  }>, {
148
152
  data: Record<string, any>;
149
153
  id: string;
@@ -71,7 +71,7 @@ const props = defineProps({
71
71
  });
72
72
  const emit = defineEmits(["dataSaved", "onReset"]);
73
73
  const formSchema = ref(props.schema);
74
- const formData = defineModel({ type: null });
74
+ const formData = defineModel({ type: [Object, String, Array] });
75
75
  watch(() => props.schema, (newSchema) => {
76
76
  formSchema.value = newSchema;
77
77
  }, { deep: true });
@@ -73,9 +73,11 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
73
73
  type: BooleanConstructor;
74
74
  default: boolean;
75
75
  };
76
- modelValue: FormKitSchemaDefinition;
76
+ modelValue: {
77
+ type: PropType<FormKitSchemaDefinition>;
78
+ };
77
79
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
78
- "update:modelValue": (value: any) => any;
80
+ "update:modelValue": (value: FormKitSchemaDefinition | undefined) => any;
79
81
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
80
82
  id: {
81
83
  type: StringConstructor;
@@ -141,9 +143,11 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
141
143
  type: BooleanConstructor;
142
144
  default: boolean;
143
145
  };
144
- modelValue: FormKitSchemaDefinition;
146
+ modelValue: {
147
+ type: PropType<FormKitSchemaDefinition>;
148
+ };
145
149
  }>> & Readonly<{
146
- "onUpdate:modelValue"?: ((value: any) => any) | undefined;
150
+ "onUpdate:modelValue"?: ((value: FormKitSchemaDefinition | undefined) => any) | undefined;
147
151
  }>, {
148
152
  data: Record<string, any>;
149
153
  id: string;
@@ -25,9 +25,11 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
25
25
  type: BooleanConstructor;
26
26
  default: boolean;
27
27
  };
28
- modelValue: FormKitSchemaDefinition;
28
+ modelValue: {
29
+ type: PropType<FormKitSchemaDefinition>;
30
+ };
29
31
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
30
- "update:modelValue": (value: any) => any;
32
+ "update:modelValue": (value: FormKitSchemaDefinition | undefined) => any;
31
33
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
32
34
  data: {
33
35
  type: ObjectConstructor;
@@ -49,9 +51,11 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
49
51
  type: BooleanConstructor;
50
52
  default: boolean;
51
53
  };
52
- modelValue: FormKitSchemaDefinition;
54
+ modelValue: {
55
+ type: PropType<FormKitSchemaDefinition>;
56
+ };
53
57
  }>> & Readonly<{
54
- "onUpdate:modelValue"?: ((value: any) => any) | undefined;
58
+ "onUpdate:modelValue"?: ((value: FormKitSchemaDefinition | undefined) => any) | undefined;
55
59
  }>, {
56
60
  data: Record<string, any>;
57
61
  schema: FormKitSchemaDefinition;
@@ -25,7 +25,7 @@ const props = defineProps({
25
25
  }
26
26
  });
27
27
  const formSchema = ref(props.schema);
28
- const formData = defineModel({ type: null });
28
+ const formData = defineModel({ type: [Object, String, Array] });
29
29
  watch(() => props.schema, (newSchema) => {
30
30
  formSchema.value = newSchema;
31
31
  }, { deep: true });
@@ -25,9 +25,11 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
25
25
  type: BooleanConstructor;
26
26
  default: boolean;
27
27
  };
28
- modelValue: FormKitSchemaDefinition;
28
+ modelValue: {
29
+ type: PropType<FormKitSchemaDefinition>;
30
+ };
29
31
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
30
- "update:modelValue": (value: any) => any;
32
+ "update:modelValue": (value: FormKitSchemaDefinition | undefined) => any;
31
33
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
32
34
  data: {
33
35
  type: ObjectConstructor;
@@ -49,9 +51,11 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
49
51
  type: BooleanConstructor;
50
52
  default: boolean;
51
53
  };
52
- modelValue: FormKitSchemaDefinition;
54
+ modelValue: {
55
+ type: PropType<FormKitSchemaDefinition>;
56
+ };
53
57
  }>> & Readonly<{
54
- "onUpdate:modelValue"?: ((value: any) => any) | undefined;
58
+ "onUpdate:modelValue"?: ((value: FormKitSchemaDefinition | undefined) => any) | undefined;
55
59
  }>, {
56
60
  data: Record<string, any>;
57
61
  schema: FormKitSchemaDefinition;
@@ -0,0 +1,38 @@
1
+ import type { FormKitFrameworkContext } from '@formkit/core';
2
+ import type { DateValue } from '@internationalized/date';
3
+ import type { PropType } from 'vue';
4
+ export interface CalendarDateRange {
5
+ start: DateValue;
6
+ end: DateValue;
7
+ }
8
+ export interface FormKitCalendarProps {
9
+ type?: 'date' | 'month' | 'year';
10
+ color?: 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'error' | 'neutral';
11
+ variant?: 'solid' | 'outline' | 'soft' | 'subtle';
12
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
13
+ range?: boolean;
14
+ multiple?: boolean;
15
+ weekNumbers?: boolean;
16
+ monthControls?: boolean;
17
+ yearControls?: boolean;
18
+ viewControl?: boolean;
19
+ defaultValue?: DateValue | DateValue[] | CalendarDateRange;
20
+ minValue?: DateValue;
21
+ maxValue?: DateValue;
22
+ isDateDisabled?: (date: DateValue) => boolean;
23
+ isDateUnavailable?: (date: DateValue) => boolean;
24
+ ui?: Record<string, unknown>;
25
+ }
26
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
27
+ context: {
28
+ type: PropType<FormKitFrameworkContext & FormKitCalendarProps>;
29
+ required: true;
30
+ };
31
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
32
+ context: {
33
+ type: PropType<FormKitFrameworkContext & FormKitCalendarProps>;
34
+ required: true;
35
+ };
36
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
37
+ declare const _default: typeof __VLS_export;
38
+ export default _default;
@@ -0,0 +1,49 @@
1
+ <script setup>
2
+ import { useFormKitInput } from "../../utils/useFormKitInput";
3
+ const props = defineProps({
4
+ context: {
5
+ type: Object,
6
+ required: true
7
+ }
8
+ });
9
+ const { handleInput, styleClass, color, modelValue, validSlotNames } = useFormKitInput(props.context);
10
+ </script>
11
+
12
+ <template>
13
+ <UCalendar
14
+ :id="context.id"
15
+ v-model="modelValue"
16
+ v-bind="{ ...context?.attrs }"
17
+ :class="styleClass"
18
+ :disabled="!!context?.disabled"
19
+ :style="context?.attrs.style"
20
+ :type="context.type ?? 'date'"
21
+ :color="color"
22
+ :variant="context.variant"
23
+ :size="context.size ?? 'md'"
24
+ :range="context.range"
25
+ :multiple="context.multiple"
26
+ :week-numbers="context.weekNumbers"
27
+ :month-controls="context.monthControls"
28
+ :year-controls="context.yearControls"
29
+ :view-control="context.viewControl"
30
+ :default-value="context.defaultValue"
31
+ :min-value="context.minValue"
32
+ :max-value="context.maxValue"
33
+ :is-date-disabled="context.isDateDisabled"
34
+ :is-date-unavailable="context.isDateUnavailable"
35
+ :ui="context.ui"
36
+ @update:model-value="handleInput"
37
+ >
38
+ <template
39
+ v-for="slotName in validSlotNames"
40
+ :key="slotName"
41
+ #[slotName]="slotProps"
42
+ >
43
+ <component
44
+ :is="context?.slots[slotName]"
45
+ v-bind="{ ...context, ...slotProps }"
46
+ />
47
+ </template>
48
+ </UCalendar>
49
+ </template>
@@ -0,0 +1,38 @@
1
+ import type { FormKitFrameworkContext } from '@formkit/core';
2
+ import type { DateValue } from '@internationalized/date';
3
+ import type { PropType } from 'vue';
4
+ export interface CalendarDateRange {
5
+ start: DateValue;
6
+ end: DateValue;
7
+ }
8
+ export interface FormKitCalendarProps {
9
+ type?: 'date' | 'month' | 'year';
10
+ color?: 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'error' | 'neutral';
11
+ variant?: 'solid' | 'outline' | 'soft' | 'subtle';
12
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
13
+ range?: boolean;
14
+ multiple?: boolean;
15
+ weekNumbers?: boolean;
16
+ monthControls?: boolean;
17
+ yearControls?: boolean;
18
+ viewControl?: boolean;
19
+ defaultValue?: DateValue | DateValue[] | CalendarDateRange;
20
+ minValue?: DateValue;
21
+ maxValue?: DateValue;
22
+ isDateDisabled?: (date: DateValue) => boolean;
23
+ isDateUnavailable?: (date: DateValue) => boolean;
24
+ ui?: Record<string, unknown>;
25
+ }
26
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
27
+ context: {
28
+ type: PropType<FormKitFrameworkContext & FormKitCalendarProps>;
29
+ required: true;
30
+ };
31
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
32
+ context: {
33
+ type: PropType<FormKitFrameworkContext & FormKitCalendarProps>;
34
+ required: true;
35
+ };
36
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
37
+ declare const _default: typeof __VLS_export;
38
+ export default _default;
@@ -0,0 +1,60 @@
1
+ import type { FormKitFrameworkContext } from '@formkit/core';
2
+ import type { AnyExtension } from '@tiptap/core';
3
+ import type { PropType } from 'vue';
4
+ export interface FormKitEditorHandler {
5
+ canExecute: (editor: unknown, cmd?: unknown) => boolean;
6
+ execute: (editor: unknown, cmd?: unknown) => unknown;
7
+ isActive: (editor: unknown, cmd?: unknown) => boolean;
8
+ isDisabled?: (editor: unknown, cmd?: unknown) => boolean;
9
+ }
10
+ export interface FormKitEditorItem {
11
+ kind: string;
12
+ icon?: string;
13
+ label?: string;
14
+ tooltip?: Record<string, unknown>;
15
+ [key: string]: unknown;
16
+ }
17
+ export interface FormKitEditorSuggestionItem extends FormKitEditorItem {
18
+ label: string;
19
+ }
20
+ export interface FormKitEditorMentionItem {
21
+ label: string;
22
+ description?: string;
23
+ icon?: string;
24
+ avatar?: Record<string, unknown>;
25
+ disabled?: boolean;
26
+ [key: string]: unknown;
27
+ }
28
+ export interface FormKitEditorProps {
29
+ contentType?: 'json' | 'html' | 'markdown';
30
+ starterKit?: Record<string, unknown>;
31
+ placeholder?: string | Record<string, unknown>;
32
+ markdown?: Record<string, unknown>;
33
+ image?: boolean | Record<string, unknown>;
34
+ mention?: boolean | Record<string, unknown>;
35
+ editorHandlers?: Record<string, FormKitEditorHandler>;
36
+ extensions?: AnyExtension[];
37
+ autofocus?: boolean;
38
+ toolbar?: boolean;
39
+ toolbarItems?: FormKitEditorItem[] | FormKitEditorItem[][];
40
+ bubbleToolbar?: boolean;
41
+ bubbleToolbarItems?: FormKitEditorItem[] | FormKitEditorItem[][];
42
+ dragHandle?: boolean;
43
+ suggestionMenu?: boolean;
44
+ suggestionMenuItems?: FormKitEditorSuggestionItem[] | FormKitEditorSuggestionItem[][];
45
+ mentionItems?: FormKitEditorMentionItem[];
46
+ ui?: Record<string, unknown>;
47
+ }
48
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
49
+ context: {
50
+ type: PropType<FormKitFrameworkContext & FormKitEditorProps>;
51
+ required: true;
52
+ };
53
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
54
+ context: {
55
+ type: PropType<FormKitFrameworkContext & FormKitEditorProps>;
56
+ required: true;
57
+ };
58
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
59
+ declare const _default: typeof __VLS_export;
60
+ export default _default;
@@ -0,0 +1,121 @@
1
+ <script setup>
2
+ import { useFormKitInput } from "../../utils/useFormKitInput";
3
+ const DEFAULT_EDITOR_TOOLBAR_ITEMS = [
4
+ [
5
+ { kind: "undo", icon: "i-lucide-undo", tooltip: { text: "Undo" } },
6
+ { kind: "redo", icon: "i-lucide-redo", tooltip: { text: "Redo" } }
7
+ ],
8
+ [
9
+ { kind: "heading", level: 1, icon: "i-lucide-heading-1", tooltip: { text: "Heading 1" } },
10
+ { kind: "heading", level: 2, icon: "i-lucide-heading-2", tooltip: { text: "Heading 2" } },
11
+ { kind: "heading", level: 3, icon: "i-lucide-heading-3", tooltip: { text: "Heading 3" } }
12
+ ],
13
+ [
14
+ { kind: "mark", mark: "bold", icon: "i-lucide-bold", tooltip: { text: "Bold" } },
15
+ { kind: "mark", mark: "italic", icon: "i-lucide-italic", tooltip: { text: "Italic" } },
16
+ { kind: "mark", mark: "underline", icon: "i-lucide-underline", tooltip: { text: "Underline" } },
17
+ { kind: "mark", mark: "strike", icon: "i-lucide-strikethrough", tooltip: { text: "Strikethrough" } },
18
+ { kind: "mark", mark: "code", icon: "i-lucide-code", tooltip: { text: "Code" } }
19
+ ],
20
+ [
21
+ { kind: "bulletList", icon: "i-lucide-list", tooltip: { text: "Bullet List" } },
22
+ { kind: "orderedList", icon: "i-lucide-list-ordered", tooltip: { text: "Ordered List" } },
23
+ { kind: "blockquote", icon: "i-lucide-quote", tooltip: { text: "Blockquote" } },
24
+ { kind: "codeBlock", icon: "i-lucide-square-code", tooltip: { text: "Code Block" } },
25
+ { kind: "horizontalRule", icon: "i-lucide-minus", tooltip: { text: "Horizontal Rule" } },
26
+ { kind: "link", icon: "i-lucide-link", tooltip: { text: "Link" } }
27
+ ]
28
+ ];
29
+ const DEFAULT_BUBBLE_TOOLBAR_ITEMS = [
30
+ [
31
+ { kind: "mark", mark: "bold", icon: "i-lucide-bold", tooltip: { text: "Bold" } },
32
+ { kind: "mark", mark: "italic", icon: "i-lucide-italic", tooltip: { text: "Italic" } },
33
+ { kind: "mark", mark: "underline", icon: "i-lucide-underline", tooltip: { text: "Underline" } },
34
+ { kind: "mark", mark: "strike", icon: "i-lucide-strikethrough", tooltip: { text: "Strikethrough" } },
35
+ { kind: "mark", mark: "code", icon: "i-lucide-code", tooltip: { text: "Code" } }
36
+ ],
37
+ [
38
+ { kind: "link", icon: "i-lucide-link", tooltip: { text: "Link" } }
39
+ ]
40
+ ];
41
+ const DEFAULT_SUGGESTION_MENU_ITEMS = [
42
+ [
43
+ { kind: "paragraph", label: "Paragraph", icon: "i-lucide-type" },
44
+ { kind: "heading", level: 1, label: "Heading 1", icon: "i-lucide-heading-1" },
45
+ { kind: "heading", level: 2, label: "Heading 2", icon: "i-lucide-heading-2" },
46
+ { kind: "heading", level: 3, label: "Heading 3", icon: "i-lucide-heading-3" },
47
+ { kind: "bulletList", label: "Bullet List", icon: "i-lucide-list" },
48
+ { kind: "orderedList", label: "Numbered List", icon: "i-lucide-list-ordered" },
49
+ { kind: "blockquote", label: "Blockquote", icon: "i-lucide-text-quote" },
50
+ { kind: "codeBlock", label: "Code Block", icon: "i-lucide-square-code" },
51
+ { kind: "horizontalRule", label: "Horizontal Rule", icon: "i-lucide-separator-horizontal" }
52
+ ]
53
+ ];
54
+ function bubbleToolbarShouldShow({ view, state }) {
55
+ return view.hasFocus() && !state.selection.empty;
56
+ }
57
+ const props = defineProps({
58
+ context: {
59
+ type: Object,
60
+ required: true
61
+ }
62
+ });
63
+ const { handleInput, styleClass, modelValue } = useFormKitInput(props.context);
64
+ </script>
65
+
66
+ <template>
67
+ <UEditor
68
+ :id="context.id"
69
+ v-model="modelValue"
70
+ v-bind="{ ...context?.attrs }"
71
+ :class="styleClass"
72
+ :editable="!context?.disabled"
73
+ :style="context?.attrs.style"
74
+ :content-type="context.contentType"
75
+ :starter-kit="context.starterKit"
76
+ :placeholder="context.placeholder"
77
+ :markdown="context.markdown"
78
+ :image="context.image"
79
+ :mention="context.mention"
80
+ :handlers="context.editorHandlers"
81
+ :extensions="context.extensions"
82
+ :autofocus="context.autofocus"
83
+ :ui="context.ui"
84
+ @update:model-value="handleInput"
85
+ >
86
+ <template #default="{ editor, handlers }">
87
+ <UEditorToolbar
88
+ v-if="context.toolbar !== false"
89
+ :editor="editor"
90
+ :items="context.toolbarItems ?? DEFAULT_EDITOR_TOOLBAR_ITEMS"
91
+ class="border-b border-default px-2 py-1 mb-2 flex-wrap"
92
+ />
93
+ <UEditorToolbar
94
+ v-if="context.bubbleToolbar !== false"
95
+ :editor="editor"
96
+ :items="context.bubbleToolbarItems ?? DEFAULT_BUBBLE_TOOLBAR_ITEMS"
97
+ layout="bubble"
98
+ :should-show="bubbleToolbarShouldShow"
99
+ />
100
+ <UEditorDragHandle
101
+ v-if="context.dragHandle"
102
+ :editor="editor"
103
+ />
104
+ <UEditorSuggestionMenu
105
+ v-if="context.suggestionMenu"
106
+ :editor="editor"
107
+ :items="context.suggestionMenuItems ?? DEFAULT_SUGGESTION_MENU_ITEMS"
108
+ />
109
+ <UEditorMentionMenu
110
+ v-if="context.mentionItems?.length"
111
+ :editor="editor"
112
+ :items="context.mentionItems"
113
+ />
114
+ <component
115
+ :is="context.slots.default"
116
+ v-if="context?.slots?.default"
117
+ v-bind="{ ...context, editor, handlers }"
118
+ />
119
+ </template>
120
+ </UEditor>
121
+ </template>
@@ -0,0 +1,60 @@
1
+ import type { FormKitFrameworkContext } from '@formkit/core';
2
+ import type { AnyExtension } from '@tiptap/core';
3
+ import type { PropType } from 'vue';
4
+ export interface FormKitEditorHandler {
5
+ canExecute: (editor: unknown, cmd?: unknown) => boolean;
6
+ execute: (editor: unknown, cmd?: unknown) => unknown;
7
+ isActive: (editor: unknown, cmd?: unknown) => boolean;
8
+ isDisabled?: (editor: unknown, cmd?: unknown) => boolean;
9
+ }
10
+ export interface FormKitEditorItem {
11
+ kind: string;
12
+ icon?: string;
13
+ label?: string;
14
+ tooltip?: Record<string, unknown>;
15
+ [key: string]: unknown;
16
+ }
17
+ export interface FormKitEditorSuggestionItem extends FormKitEditorItem {
18
+ label: string;
19
+ }
20
+ export interface FormKitEditorMentionItem {
21
+ label: string;
22
+ description?: string;
23
+ icon?: string;
24
+ avatar?: Record<string, unknown>;
25
+ disabled?: boolean;
26
+ [key: string]: unknown;
27
+ }
28
+ export interface FormKitEditorProps {
29
+ contentType?: 'json' | 'html' | 'markdown';
30
+ starterKit?: Record<string, unknown>;
31
+ placeholder?: string | Record<string, unknown>;
32
+ markdown?: Record<string, unknown>;
33
+ image?: boolean | Record<string, unknown>;
34
+ mention?: boolean | Record<string, unknown>;
35
+ editorHandlers?: Record<string, FormKitEditorHandler>;
36
+ extensions?: AnyExtension[];
37
+ autofocus?: boolean;
38
+ toolbar?: boolean;
39
+ toolbarItems?: FormKitEditorItem[] | FormKitEditorItem[][];
40
+ bubbleToolbar?: boolean;
41
+ bubbleToolbarItems?: FormKitEditorItem[] | FormKitEditorItem[][];
42
+ dragHandle?: boolean;
43
+ suggestionMenu?: boolean;
44
+ suggestionMenuItems?: FormKitEditorSuggestionItem[] | FormKitEditorSuggestionItem[][];
45
+ mentionItems?: FormKitEditorMentionItem[];
46
+ ui?: Record<string, unknown>;
47
+ }
48
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
49
+ context: {
50
+ type: PropType<FormKitFrameworkContext & FormKitEditorProps>;
51
+ required: true;
52
+ };
53
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
54
+ context: {
55
+ type: PropType<FormKitFrameworkContext & FormKitEditorProps>;
56
+ required: true;
57
+ };
58
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
59
+ declare const _default: typeof __VLS_export;
60
+ export default _default;
@@ -0,0 +1,39 @@
1
+ import type { FormKitFrameworkContext } from '@formkit/core';
2
+ import type { PropType } from 'vue';
3
+ export interface FormKitFileUploadProps {
4
+ multiple?: boolean;
5
+ accept?: string;
6
+ icon?: string | false;
7
+ label?: string;
8
+ description?: string;
9
+ color?: 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'error' | 'neutral';
10
+ variant?: 'area' | 'button';
11
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
12
+ layout?: 'list' | 'grid';
13
+ position?: 'inside' | 'outside';
14
+ highlight?: boolean;
15
+ dropzone?: boolean;
16
+ interactive?: boolean;
17
+ required?: boolean;
18
+ reset?: boolean;
19
+ fileIcon?: string;
20
+ fileImage?: boolean;
21
+ fileDelete?: boolean | Record<string, unknown>;
22
+ fileDeleteIcon?: string;
23
+ preview?: boolean;
24
+ name?: string;
25
+ ui?: Record<string, unknown>;
26
+ }
27
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
28
+ context: {
29
+ type: PropType<FormKitFrameworkContext & FormKitFileUploadProps>;
30
+ required: true;
31
+ };
32
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
33
+ context: {
34
+ type: PropType<FormKitFrameworkContext & FormKitFileUploadProps>;
35
+ required: true;
36
+ };
37
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
38
+ declare const _default: typeof __VLS_export;
39
+ export default _default;
@@ -0,0 +1,56 @@
1
+ <script setup>
2
+ import { useFormKitInput } from "../../utils/useFormKitInput";
3
+ const props = defineProps({
4
+ context: {
5
+ type: Object,
6
+ required: true
7
+ }
8
+ });
9
+ const { handleInput, handleChange, isInvalid, styleClass, color, modelValue, validSlotNames } = useFormKitInput(props.context);
10
+ </script>
11
+
12
+ <template>
13
+ <UFileUpload
14
+ :id="context.id"
15
+ v-model="modelValue"
16
+ v-bind="{ ...context?.attrs }"
17
+ :class="styleClass"
18
+ :disabled="!!context?.disabled"
19
+ :style="context?.attrs.style"
20
+ :highlight="isInvalid || context.highlight"
21
+ :multiple="context.multiple"
22
+ :accept="context.accept"
23
+ :icon="context.icon"
24
+ :label="context.label"
25
+ :description="context.description"
26
+ :color="color"
27
+ :variant="context.variant ?? 'area'"
28
+ :size="context.size ?? 'md'"
29
+ :layout="context.layout ?? 'list'"
30
+ :position="context.position ?? 'outside'"
31
+ :dropzone="context.dropzone"
32
+ :interactive="context.interactive"
33
+ :required="context.required"
34
+ :reset="context.reset"
35
+ :file-icon="context.fileIcon"
36
+ :file-image="context.fileImage"
37
+ :file-delete="context.fileDelete"
38
+ :file-delete-icon="context.fileDeleteIcon"
39
+ :preview="context.preview"
40
+ :name="context.name"
41
+ :ui="context.ui"
42
+ @change="handleChange"
43
+ @update:model-value="handleInput"
44
+ >
45
+ <template
46
+ v-for="slotName in validSlotNames"
47
+ :key="slotName"
48
+ #[slotName]="slotProps"
49
+ >
50
+ <component
51
+ :is="context?.slots[slotName]"
52
+ v-bind="{ ...context, ...slotProps }"
53
+ />
54
+ </template>
55
+ </UFileUpload>
56
+ </template>