@robuust-digital/vue-components 2.4.0-beta.1 → 2.5.0-beta.1
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 +6 -0
- package/dist/_shared/{Combobox.vue_vue_type_script_setup_true_lang-CxRv55TC.js → Combobox.vue_vue_type_script_setup_true_lang-C3AfEWj5.js} +61 -72
- package/dist/_shared/Tabs.vue_vue_type_script_setup_true_lang-Dc0jC2cn.js +836 -0
- package/dist/_shared/XMarkIcon-DdMV8USU.js +53 -0
- package/dist/combobox/index.js +1 -1
- package/dist/core/file.css +206 -0
- package/dist/core/index.js +10 -9
- package/dist/core/styles.css +1 -0
- package/dist/core.d.ts +100 -31
- package/dist/index/index.js +18 -17
- package/dist/index.d.ts +147 -78
- package/package.json +1 -1
- package/dist/_shared/ChevronDownIcon-CcE_K1lg.js +0 -41
- package/dist/_shared/Tabs.vue_vue_type_script_setup_true_lang-DMUJ5Emt.js +0 -670
package/CHANGELOG.md
CHANGED
|
@@ -1,34 +1,23 @@
|
|
|
1
|
-
import { createElementBlock as
|
|
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 _,
|
|
5
|
-
import { S as
|
|
6
|
-
function
|
|
7
|
-
return n(),
|
|
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
|
-
|
|
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__ */
|
|
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:
|
|
71
|
-
const a = e,
|
|
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) =>
|
|
62
|
+
set: (t) => c("update:modelValue", t)
|
|
74
63
|
}), T = D({
|
|
75
64
|
get: () => a.requestParams,
|
|
76
|
-
set: (t) =>
|
|
77
|
-
}), N = (t) => a.displayValue(t) || "",
|
|
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
|
-
|
|
81
|
-
},
|
|
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
|
-
|
|
73
|
+
i.value = [];
|
|
85
74
|
return;
|
|
86
75
|
}
|
|
87
76
|
if (t && t.length < a.minLength) {
|
|
88
|
-
|
|
77
|
+
i.value = [];
|
|
89
78
|
return;
|
|
90
79
|
}
|
|
91
|
-
|
|
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:
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
|
|
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
|
-
},
|
|
104
|
-
L.value ? (L.value = !1,
|
|
105
|
-
},
|
|
106
|
-
t.target.value?.length === 0 && (
|
|
107
|
-
}, C = (t) => a.multiple ? s.value.some((o) => o[a.itemKey] === t) : s.value?.[a.itemKey] === 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
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
e.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) =>
|
|
138
|
-
onSearch:
|
|
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) =>
|
|
133
|
+
onClick: o[2] || (o[2] = (l) => S(f.value || null))
|
|
145
134
|
}, {
|
|
146
135
|
default: g(() => [
|
|
147
|
-
v.value ?
|
|
136
|
+
v.value ? d(t.$slots, "spinner", {
|
|
148
137
|
key: 0,
|
|
149
138
|
spinning: v.value
|
|
150
139
|
}, () => [
|
|
151
|
-
b(r(
|
|
152
|
-
]) : (!e.searchOnly ||
|
|
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(),
|
|
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) =>
|
|
156
|
+
onClick: o[3] || (o[3] = P((l) => c("update:modelValue", e.multiple ? [] : null), ["prevent"]))
|
|
168
157
|
}, [
|
|
169
|
-
|
|
170
|
-
b(r(
|
|
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(),
|
|
175
|
-
(n(!0),
|
|
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
|
-
|
|
167
|
+
d(t.$slots, "chip", {
|
|
179
168
|
optionText: e.optionText(l),
|
|
180
169
|
option: l,
|
|
181
|
-
removeOption:
|
|
170
|
+
removeOption: B
|
|
182
171
|
}, () => [
|
|
183
|
-
b(
|
|
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(
|
|
190
|
-
|
|
178
|
+
U($(e.optionText(l)) + " ", 1),
|
|
179
|
+
u("button", {
|
|
191
180
|
type: "button",
|
|
192
181
|
"aria-label": "Remove option",
|
|
193
|
-
onClick: P((y) =>
|
|
182
|
+
onClick: P((y) => B(l), ["prevent"])
|
|
194
183
|
}, [
|
|
195
|
-
b(r(
|
|
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 ||
|
|
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(),
|
|
209
|
-
|
|
210
|
-
|
|
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 && !
|
|
213
|
-
|
|
214
|
-
])])) : (n(!0),
|
|
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
|
-
|
|
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
|
-
|
|
216
|
+
d(t.$slots, "option", {
|
|
228
217
|
option: l,
|
|
229
218
|
isActive: C
|
|
230
219
|
}, () => [
|
|
231
|
-
|
|
220
|
+
d(t.$slots, "optionPrefix", {
|
|
232
221
|
option: l[e.itemKey],
|
|
233
222
|
isActive: C
|
|
234
223
|
}),
|
|
235
|
-
|
|
236
|
-
|
|
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
|
})
|