@robuust-digital/vue-components 2.4.0-beta.1 → 2.4.0-beta.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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 2.4.0 (16-12-2025)
2
+
3
+ ### Added
4
+
5
+ * Added `FormFile` component with file input, image preview, and delete/clear actions
6
+
1
7
  ## 2.3.2 (16-12-2025)
2
8
 
3
9
  ### Fixed
@@ -1,34 +1,23 @@
1
- import { createElementBlock as c, openBlock as n, createElementVNode as i, defineComponent as j, ref as h, computed as D, createBlock as x, unref as r, mergeProps as F, withCtx as g, createCommentVNode as p, renderSlot as m, createVNode as b, resolveDynamicComponent as O, withModifiers as P, Fragment as q, renderList as z, createTextVNode as U, toDisplayString as w, normalizeClass as G } from "vue";
1
+ import { createElementBlock as m, openBlock as n, createElementVNode as u, defineComponent as Z, ref as h, computed as D, createBlock as x, unref as r, mergeProps as F, withCtx as g, createCommentVNode as p, renderSlot as d, createVNode as b, resolveDynamicComponent as O, withModifiers as P, Fragment as q, renderList as z, createTextVNode as U, toDisplayString as $, normalizeClass as G } from "vue";
2
2
  import { useDebounceFn as H } from "@vueuse/core";
3
3
  import { Combobox as J, ComboboxInput as Q, ComboboxButton as W, ComboboxOptions as X, ComboboxOption as Y } from "@headlessui/vue";
4
- import { r as _, _ as ee } from "./ChevronDownIcon-CcE_K1lg.js";
5
- import { S as te } from "./icon-spinner-CP0VP_YM.js";
6
- function le(e, V) {
7
- return n(), c("svg", {
4
+ import { r as _, a as ee, _ as te } from "./XMarkIcon-DdMV8USU.js";
5
+ import { S as le } from "./icon-spinner-CP0VP_YM.js";
6
+ function oe(e, w) {
7
+ return n(), m("svg", {
8
8
  xmlns: "http://www.w3.org/2000/svg",
9
9
  viewBox: "0 0 16 16",
10
10
  fill: "currentColor",
11
11
  "aria-hidden": "true",
12
12
  "data-slot": "icon"
13
13
  }, [
14
- i("path", {
14
+ u("path", {
15
15
  "fill-rule": "evenodd",
16
16
  d: "M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14Zm2.78-4.22a.75.75 0 0 1-1.06 0L8 9.06l-1.72 1.72a.75.75 0 1 1-1.06-1.06L6.94 8 5.22 6.28a.75.75 0 0 1 1.06-1.06L8 6.94l1.72-1.72a.75.75 0 1 1 1.06 1.06L9.06 8l1.72 1.72a.75.75 0 0 1 0 1.06Z",
17
17
  "clip-rule": "evenodd"
18
18
  })
19
19
  ]);
20
20
  }
21
- function oe(e, V) {
22
- return n(), c("svg", {
23
- xmlns: "http://www.w3.org/2000/svg",
24
- viewBox: "0 0 20 20",
25
- fill: "currentColor",
26
- "aria-hidden": "true",
27
- "data-slot": "icon"
28
- }, [
29
- i("path", { d: "M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" })
30
- ]);
31
- }
32
21
  const ae = { class: "rvc-combobox-container" }, ne = { class: "rvc-combobox-wrapper" }, ie = { class: "rvc-combobox-field" }, ue = {
33
22
  key: 0,
34
23
  class: "rvc-combobox-chips"
@@ -38,7 +27,7 @@ const ae = { class: "rvc-combobox-container" }, ne = { class: "rvc-combobox-wrap
38
27
  }, ce = {
39
28
  key: 1,
40
29
  class: "rvc-combobox-content"
41
- }, de = { class: "rvc-combobox-option-text" }, he = /* @__PURE__ */ j({
30
+ }, de = { class: "rvc-combobox-option-text" }, he = /* @__PURE__ */ Z({
42
31
  inheritAttrs: !1,
43
32
  __name: "Combobox",
44
33
  props: {
@@ -67,44 +56,44 @@ const ae = { class: "rvc-combobox-container" }, ne = { class: "rvc-combobox-wrap
67
56
  onCancel: { type: Function, default: void 0 }
68
57
  },
69
58
  emits: ["update:modelValue", "update:requestParams", "combobox:noResults", "combobox:error"],
70
- setup(e, { emit: V }) {
71
- const a = e, d = V, u = h([]), v = h(!1), f = h(null), L = h(!0), k = h(null), s = D({
59
+ setup(e, { emit: w }) {
60
+ const a = e, c = w, i = h([]), v = h(!1), f = h(null), L = h(!0), V = h(null), s = D({
72
61
  get: () => a.multiple ? a.modelValue || [] : a.modelValue,
73
- set: (t) => d("update:modelValue", t)
62
+ set: (t) => c("update:modelValue", t)
74
63
  }), T = D({
75
64
  get: () => a.requestParams,
76
- set: (t) => d("update:requestParams", t)
77
- }), N = (t) => a.displayValue(t) || "", M = (t) => new Promise((o) => {
65
+ set: (t) => c("update:requestParams", t)
66
+ }), N = (t) => a.displayValue(t) || "", R = (t) => new Promise((o) => {
78
67
  setTimeout(o, t);
79
68
  }), A = (t, o) => {
80
- u.value = [], d("combobox:error", t), d("combobox:noResults", o);
81
- }, B = async (t) => {
69
+ i.value = [], c("combobox:error", t), c("combobox:noResults", o);
70
+ }, I = async (t) => {
82
71
  if (!a.onSearch) return;
83
72
  if (a.searchOnly && !t) {
84
- u.value = [];
73
+ i.value = [];
85
74
  return;
86
75
  }
87
76
  if (t && t.length < a.minLength) {
88
- u.value = [];
77
+ i.value = [];
89
78
  return;
90
79
  }
91
- k.value && a.onCancel && a.onCancel(k.value), v.value = !0;
80
+ V.value && a.onCancel && a.onCancel(V.value), v.value = !0;
92
81
  const o = Date.now();
93
82
  try {
94
- const { data: l, error: y, cancel: Z } = await a.onSearch(t, T.value, a.endpoint);
95
- k.value = Z || null;
96
- const $ = a.responseData(l), K = Date.now() - o;
97
- !$.length && y && A(y, t), K < a.minLoadingTime && await M(a.minLoadingTime - K), $?.length ? u.value = $ : (u.value = [], d("combobox:noResults", t));
83
+ const { data: l, error: y, cancel: j } = await a.onSearch(t, T.value, a.endpoint);
84
+ V.value = j || null;
85
+ const k = a.responseData(l), K = Date.now() - o;
86
+ !k.length && y && A(y, t), K < a.minLoadingTime && await R(a.minLoadingTime - K), k?.length ? i.value = k : (i.value = [], c("combobox:noResults", t));
98
87
  } catch (l) {
99
88
  l?.cancelled || A(l, t);
100
89
  } finally {
101
90
  v.value = !1;
102
91
  }
103
- }, R = H(B, a.debounce), I = (t) => {
104
- L.value ? (L.value = !1, B(t)) : R(t);
105
- }, E = (t) => {
106
- t.target.value?.length === 0 && (u.value = [], d("update:modelValue", null)), a.manualInput && d("update:modelValue", T.value.query);
107
- }, C = (t) => a.multiple ? s.value.some((o) => o[a.itemKey] === t) : s.value?.[a.itemKey] === t, S = (t) => {
92
+ }, E = H(I, a.debounce), S = (t) => {
93
+ L.value ? (L.value = !1, I(t)) : E(t);
94
+ }, M = (t) => {
95
+ t.target.value?.length === 0 && (i.value = [], c("update:modelValue", null)), a.manualInput && c("update:modelValue", T.value.query);
96
+ }, C = (t) => a.multiple ? s.value.some((o) => o[a.itemKey] === t) : s.value?.[a.itemKey] === t, B = (t) => {
108
97
  s.value = s.value.filter((o) => o[a.itemKey] !== t[a.itemKey]);
109
98
  };
110
99
  return (t, o) => (n(), x(r(J), F({
@@ -120,10 +109,10 @@ const ae = { class: "rvc-combobox-container" }, ne = { class: "rvc-combobox-wrap
120
109
  ]
121
110
  }), {
122
111
  default: g(() => [
123
- i("div", ae, [
124
- i("div", ne, [
125
- i("div", ie, [
126
- e.prefixIcon ? m(t.$slots, "prefixIcon", {
112
+ u("div", ae, [
113
+ u("div", ne, [
114
+ u("div", ie, [
115
+ e.prefixIcon ? d(t.$slots, "prefixIcon", {
127
116
  key: 0,
128
117
  icon: e.prefixIcon
129
118
  }, () => [
@@ -134,22 +123,22 @@ const ae = { class: "rvc-combobox-container" }, ne = { class: "rvc-combobox-wrap
134
123
  "display-value": N,
135
124
  disabled: e.disabled,
136
125
  autocomplete: "off",
137
- onChange: o[0] || (o[0] = (l) => I(l.target.value)),
138
- onSearch: E,
126
+ onChange: o[0] || (o[0] = (l) => S(l.target.value)),
127
+ onSearch: M,
139
128
  onInput: o[1] || (o[1] = (l) => f.value = l.target.value)
140
129
  }), null, 16, ["id", "disabled"]),
141
130
  b(r(W), {
142
131
  disabled: e.disabled,
143
132
  class: "rvc-combobox-button",
144
- onClick: o[2] || (o[2] = (l) => I(f.value || null))
133
+ onClick: o[2] || (o[2] = (l) => S(f.value || null))
145
134
  }, {
146
135
  default: g(() => [
147
- v.value ? m(t.$slots, "spinner", {
136
+ v.value ? d(t.$slots, "spinner", {
148
137
  key: 0,
149
138
  spinning: v.value
150
139
  }, () => [
151
- b(r(te), { class: "rvc-combobox-spinner" })
152
- ]) : (!e.searchOnly || u.value?.length) && !v.value ? m(t.$slots, "icon", {
140
+ b(r(le), { class: "rvc-combobox-spinner" })
141
+ ]) : (!e.searchOnly || i.value?.length) && !v.value ? d(t.$slots, "icon", {
153
142
  key: 1,
154
143
  icon: e.icon
155
144
  }, () => [
@@ -159,40 +148,40 @@ const ae = { class: "rvc-combobox-container" }, ne = { class: "rvc-combobox-wrap
159
148
  _: 3
160
149
  }, 8, ["disabled"])
161
150
  ]),
162
- e.clearable && (Array.isArray(e.modelValue) ? e.modelValue?.length : e.modelValue?.id) ? (n(), c("button", {
151
+ e.clearable && (Array.isArray(e.modelValue) ? e.modelValue?.length : e.modelValue?.id) ? (n(), m("button", {
163
152
  key: 0,
164
153
  type: "button",
165
154
  "aria-label": "Clear selection",
166
155
  class: "rvc-combobox-clear",
167
- onClick: o[3] || (o[3] = P((l) => d("update:modelValue", e.multiple ? [] : null), ["prevent"]))
156
+ onClick: o[3] || (o[3] = P((l) => c("update:modelValue", e.multiple ? [] : null), ["prevent"]))
168
157
  }, [
169
- m(t.$slots, "clear", {}, () => [
170
- b(r(oe))
158
+ d(t.$slots, "clear", {}, () => [
159
+ b(r(ee))
171
160
  ])
172
161
  ])) : p("", !0)
173
162
  ]),
174
- e.multiple && Array.isArray(s.value) && s.value?.length ? (n(), c("ul", ue, [
175
- (n(!0), c(q, null, z(s.value, (l) => (n(), c("li", {
163
+ e.multiple && Array.isArray(s.value) && s.value?.length ? (n(), m("ul", ue, [
164
+ (n(!0), m(q, null, z(s.value, (l) => (n(), m("li", {
176
165
  key: `${e.id}-selected-option-${l[e.itemKey]}`
177
166
  }, [
178
- m(t.$slots, "chip", {
167
+ d(t.$slots, "chip", {
179
168
  optionText: e.optionText(l),
180
169
  option: l,
181
- removeOption: S
170
+ removeOption: B
182
171
  }, () => [
183
- b(ee, {
172
+ b(te, {
184
173
  color: "gray",
185
174
  class: "rvc-combobox-chip",
186
175
  size: e.size
187
176
  }, {
188
177
  default: g(() => [
189
- U(w(e.optionText(l)) + " ", 1),
190
- i("button", {
178
+ U($(e.optionText(l)) + " ", 1),
179
+ u("button", {
191
180
  type: "button",
192
181
  "aria-label": "Remove option",
193
- onClick: P((y) => S(l), ["prevent"])
182
+ onClick: P((y) => B(l), ["prevent"])
194
183
  }, [
195
- b(r(le))
184
+ b(r(oe))
196
185
  ], 8, se)
197
186
  ]),
198
187
  _: 2
@@ -200,40 +189,40 @@ const ae = { class: "rvc-combobox-container" }, ne = { class: "rvc-combobox-wrap
200
189
  ])
201
190
  ]))), 128))
202
191
  ])) : p("", !0),
203
- (!e.searchOnly || f.value?.length) && (!v.value || u.value.length) ? (n(), x(r(X), {
192
+ (!e.searchOnly || f.value?.length) && (!v.value || i.value.length) ? (n(), x(r(X), {
204
193
  key: 1,
205
194
  class: "rvc-combobox-options"
206
195
  }, {
207
196
  default: g(() => [
208
- f.value && f.value.length < e.minLength ? (n(), c("div", re, [
209
- i("div", null, [
210
- i("em", null, "Minimal " + w(e.minLength) + " characters.", 1)
197
+ f.value && f.value.length < e.minLength ? (n(), m("div", re, [
198
+ u("div", null, [
199
+ u("em", null, "Minimal " + $(e.minLength) + " characters.", 1)
211
200
  ])
212
- ])) : !v.value && !u.value.length ? (n(), c("div", ce, [...o[5] || (o[5] = [
213
- i("div", null, " No results found. ", -1)
214
- ])])) : (n(!0), c(q, { key: 2 }, z(u.value, (l) => (n(), x(r(Y), {
201
+ ])) : !v.value && !i.value.length ? (n(), m("div", ce, [...o[5] || (o[5] = [
202
+ u("div", null, " No results found. ", -1)
203
+ ])])) : (n(!0), m(q, { key: 2 }, z(i.value, (l) => (n(), x(r(Y), {
215
204
  key: `option-${l[e.itemKey]}`,
216
205
  value: l,
217
206
  as: "template"
218
207
  }, {
219
208
  default: g(({ active: y }) => [
220
- i("li", {
209
+ u("li", {
221
210
  class: G([
222
211
  "rvc-combobox-option",
223
212
  { "rvc-combobox-option-hover": y },
224
213
  { "rvc-combobox-option-active": C(l[e.itemKey]) }
225
214
  ])
226
215
  }, [
227
- m(t.$slots, "option", {
216
+ d(t.$slots, "option", {
228
217
  option: l,
229
218
  isActive: C
230
219
  }, () => [
231
- m(t.$slots, "optionPrefix", {
220
+ d(t.$slots, "optionPrefix", {
232
221
  option: l[e.itemKey],
233
222
  isActive: C
234
223
  }),
235
- i("span", de, w(e.optionText(l)), 1),
236
- m(t.$slots, "optionSuffix", {
224
+ u("span", de, $(e.optionText(l)), 1),
225
+ d(t.$slots, "optionSuffix", {
237
226
  option: l[e.itemKey],
238
227
  isActive: C
239
228
  })