@robuust-digital/vue-components 2.7.1 → 3.0.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.
- package/CHANGELOG.md +15 -0
- package/dist/_shared/ButtonBase-DyeIkb-l.js +76 -0
- package/dist/_shared/ChevronDownIcon-Y_yqpwON.js +39 -0
- package/dist/_shared/FormInput-k0vAk3VU.js +69 -0
- package/dist/_shared/Modal-D0x_VHiB.js +188 -0
- package/dist/_shared/Tooltip-B5w_Ojie.js +85 -0
- package/dist/_shared/XMarkIcon-CBoWSM1l.js +17 -0
- package/dist/_shared/combobox-yh0YQ8_d.js +265 -0
- package/dist/_shared/core-C0o6izrz.js +854 -0
- package/dist/_shared/dialogs-SvdPsILD.js +179 -0
- package/dist/_shared/dropdown-BPUpLokN.js +134 -0
- package/dist/_shared/icon-spinner-D3Dhustt.js +23 -0
- package/dist/_shared/lightswitch-CpyX1iA_.js +38 -0
- package/dist/_shared/rich-text-editor-DkHKNS2n.js +226 -0
- package/dist/_shared/toast-DNxJDQWN.js +84 -0
- package/dist/combobox/index.js +2 -5
- package/dist/core/file-upload.css +28 -1
- package/dist/core/index.js +5 -20
- package/dist/dialogs/index.js +3 -6
- package/dist/dropdown/index.js +2 -5
- package/dist/index/index.js +14 -36
- package/dist/lightswitch/index.js +2 -5
- package/dist/rich-text-editor/index.js +2 -5
- package/dist/toast/index.js +2 -5
- package/dist/tooltip/index.js +5 -5
- package/package.json +31 -31
- package/dist/_shared/ButtonBase.vue_vue_type_script_setup_true_lang-ZYVNEyNx.js +0 -60
- package/dist/_shared/ChevronDownIcon-BYWciGnh.js +0 -41
- package/dist/_shared/Combobox.vue_vue_type_script_setup_true_lang-BwTRzqr6.js +0 -256
- package/dist/_shared/Drawer.vue_vue_type_script_setup_true_lang-DeAu2U_2.js +0 -197
- package/dist/_shared/Dropdown.vue_vue_type_script_setup_true_lang-Cv3HwIyF.js +0 -150
- package/dist/_shared/FormInput.vue_vue_type_script_setup_true_lang-Bg7YPGyY.js +0 -74
- package/dist/_shared/Lightswitch.vue_vue_type_script_setup_true_lang-hiuDVfo5.js +0 -43
- package/dist/_shared/Modal.vue_vue_type_script_setup_true_lang-CdMsCCBi.js +0 -203
- package/dist/_shared/RichTextEditor.vue_vue_type_script_setup_true_lang-t8nRuJ6k.js +0 -247
- package/dist/_shared/Tabs.vue_vue_type_script_setup_true_lang-C4NAAuLp.js +0 -931
- package/dist/_shared/Toast.vue_vue_type_script_setup_true_lang-DS6keeu7.js +0 -78
- package/dist/_shared/Tooltip.vue_vue_type_script_setup_true_lang-B3MHy48T.js +0 -95
- package/dist/_shared/XMarkIcon-CPr_Rd8y.js +0 -19
- package/dist/_shared/icon-spinner-BYCMrTdL.js +0 -26
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { n as e, t } from "./ChevronDownIcon-Y_yqpwON.js";
|
|
2
|
+
import { t as n } from "./icon-spinner-D3Dhustt.js";
|
|
3
|
+
import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, mergeProps as f, normalizeClass as p, openBlock as m, ref as h, renderList as g, renderSlot as _, resolveDynamicComponent as v, toDisplayString as y, unref as b, withCtx as x, withModifiers as S } from "vue";
|
|
4
|
+
import { useDebounceFn as C } from "@vueuse/core";
|
|
5
|
+
import { Combobox as w, ComboboxButton as T, ComboboxInput as E, ComboboxOption as D, ComboboxOptions as O } from "@headlessui/vue";
|
|
6
|
+
//#region node_modules/@heroicons/vue/16/solid/esm/XCircleIcon.js
|
|
7
|
+
function k(e, t) {
|
|
8
|
+
return m(), s("svg", {
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
viewBox: "0 0 16 16",
|
|
11
|
+
fill: "currentColor",
|
|
12
|
+
"aria-hidden": "true",
|
|
13
|
+
"data-slot": "icon"
|
|
14
|
+
}, [c("path", {
|
|
15
|
+
"fill-rule": "evenodd",
|
|
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
|
+
"clip-rule": "evenodd"
|
|
18
|
+
})]);
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region node_modules/@heroicons/vue/20/solid/esm/XMarkIcon.js
|
|
22
|
+
function A(e, t) {
|
|
23
|
+
return m(), s("svg", {
|
|
24
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
25
|
+
viewBox: "0 0 20 20",
|
|
26
|
+
fill: "currentColor",
|
|
27
|
+
"aria-hidden": "true",
|
|
28
|
+
"data-slot": "icon"
|
|
29
|
+
}, [c("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
|
+
//#endregion
|
|
32
|
+
//#region src/components/Combobox.vue?vue&type=script&setup=true&lang.ts
|
|
33
|
+
var j = { class: "rvc-combobox-container" }, M = { class: "rvc-combobox-wrapper" }, N = { class: "rvc-combobox-field" }, ee = {
|
|
34
|
+
key: 0,
|
|
35
|
+
class: "rvc-combobox-chips"
|
|
36
|
+
}, te = ["onClick"], ne = {
|
|
37
|
+
key: 0,
|
|
38
|
+
class: "rvc-combobox-content"
|
|
39
|
+
}, P = {
|
|
40
|
+
key: 1,
|
|
41
|
+
class: "rvc-combobox-content"
|
|
42
|
+
}, F = { class: "rvc-combobox-option-text" }, I = /* @__PURE__ */ d({
|
|
43
|
+
inheritAttrs: !1,
|
|
44
|
+
__name: "Combobox",
|
|
45
|
+
props: {
|
|
46
|
+
id: {},
|
|
47
|
+
rootClass: { default: "" },
|
|
48
|
+
modelValue: { default: null },
|
|
49
|
+
endpoint: { default: void 0 },
|
|
50
|
+
requestParams: { default: () => ({}) },
|
|
51
|
+
manualInput: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: !1
|
|
54
|
+
},
|
|
55
|
+
responseData: {
|
|
56
|
+
type: Function,
|
|
57
|
+
default: (e) => e
|
|
58
|
+
},
|
|
59
|
+
displayValue: {
|
|
60
|
+
type: Function,
|
|
61
|
+
default: (e) => e?.name || null
|
|
62
|
+
},
|
|
63
|
+
optionText: {
|
|
64
|
+
type: Function,
|
|
65
|
+
default: (e) => e?.name || null
|
|
66
|
+
},
|
|
67
|
+
disabled: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: !1
|
|
70
|
+
},
|
|
71
|
+
minLength: { default: 2 },
|
|
72
|
+
itemKey: { default: "id" },
|
|
73
|
+
clearable: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: !1
|
|
76
|
+
},
|
|
77
|
+
rootAttrs: { default: () => ({}) },
|
|
78
|
+
multiple: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: !1
|
|
81
|
+
},
|
|
82
|
+
onSearch: {
|
|
83
|
+
type: Function,
|
|
84
|
+
default: () => Promise.resolve({ data: [] })
|
|
85
|
+
},
|
|
86
|
+
searchOnly: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: !1
|
|
89
|
+
},
|
|
90
|
+
icon: {
|
|
91
|
+
type: [
|
|
92
|
+
Function,
|
|
93
|
+
Object,
|
|
94
|
+
null
|
|
95
|
+
],
|
|
96
|
+
default: null
|
|
97
|
+
},
|
|
98
|
+
prefixIcon: {
|
|
99
|
+
type: [
|
|
100
|
+
Function,
|
|
101
|
+
Object,
|
|
102
|
+
null
|
|
103
|
+
],
|
|
104
|
+
default: null
|
|
105
|
+
},
|
|
106
|
+
size: { default: "base" },
|
|
107
|
+
debounce: { default: 150 },
|
|
108
|
+
minLoadingTime: { default: 0 },
|
|
109
|
+
onCancel: {
|
|
110
|
+
type: Function,
|
|
111
|
+
default: void 0
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
emits: [
|
|
115
|
+
"update:modelValue",
|
|
116
|
+
"update:requestParams",
|
|
117
|
+
"combobox:noResults",
|
|
118
|
+
"combobox:error"
|
|
119
|
+
],
|
|
120
|
+
setup(d, { emit: I }) {
|
|
121
|
+
let L = d, R = I, z = h([]), B = h(!1), V = h(null), H = h(!0), U = h(null), W = i({
|
|
122
|
+
get: () => L.multiple ? L.modelValue || [] : L.modelValue,
|
|
123
|
+
set: (e) => R("update:modelValue", e)
|
|
124
|
+
}), G = i({
|
|
125
|
+
get: () => L.requestParams,
|
|
126
|
+
set: (e) => R("update:requestParams", e)
|
|
127
|
+
}), K = (e) => L.displayValue(e) || "", q = (e) => new Promise((t) => {
|
|
128
|
+
setTimeout(t, e);
|
|
129
|
+
}), J = (e, t) => {
|
|
130
|
+
z.value = [], R("combobox:error", e), R("combobox:noResults", t);
|
|
131
|
+
}, Y = async (e) => {
|
|
132
|
+
if (!L.onSearch) return;
|
|
133
|
+
if (L.searchOnly && !e) {
|
|
134
|
+
z.value = [];
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (e && e.length < L.minLength) {
|
|
138
|
+
z.value = [];
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
U.value && L.onCancel && L.onCancel(U.value), B.value = !0;
|
|
142
|
+
let t = Date.now();
|
|
143
|
+
try {
|
|
144
|
+
let { data: n, error: r, cancel: i } = await L.onSearch(e, G.value, L.endpoint);
|
|
145
|
+
U.value = i || null;
|
|
146
|
+
let a = L.responseData(n), o = Date.now() - t;
|
|
147
|
+
!a.length && r && J(r, e), o < L.minLoadingTime && await q(L.minLoadingTime - o), a?.length ? z.value = a : (z.value = [], R("combobox:noResults", e));
|
|
148
|
+
} catch (t) {
|
|
149
|
+
t?.cancelled || J(t, e);
|
|
150
|
+
} finally {
|
|
151
|
+
B.value = !1;
|
|
152
|
+
}
|
|
153
|
+
}, X = C(Y, L.debounce), Z = (e) => {
|
|
154
|
+
H.value ? (H.value = !1, Y(e)) : X(e);
|
|
155
|
+
}, re = (e) => {
|
|
156
|
+
e.target.value?.length === 0 && (z.value = [], R("update:modelValue", null)), L.manualInput && R("update:modelValue", G.value.query);
|
|
157
|
+
}, Q = (e) => L.multiple ? W.value.some((t) => t[L.itemKey] === e) : W.value?.[L.itemKey] === e, $ = (e) => {
|
|
158
|
+
W.value = W.value.filter((t) => t[L.itemKey] !== e[L.itemKey]);
|
|
159
|
+
};
|
|
160
|
+
return (i, h) => (m(), a(b(w), f({
|
|
161
|
+
modelValue: W.value,
|
|
162
|
+
"onUpdate:modelValue": h[4] ||= (e) => W.value = e,
|
|
163
|
+
as: "div"
|
|
164
|
+
}, d.rootAttrs, {
|
|
165
|
+
multiple: d.multiple,
|
|
166
|
+
class: [
|
|
167
|
+
"rvc-combobox",
|
|
168
|
+
`rvc-combobox-${d.size}`,
|
|
169
|
+
d.rootClass
|
|
170
|
+
]
|
|
171
|
+
}), {
|
|
172
|
+
default: x(() => [c("div", j, [
|
|
173
|
+
c("div", M, [c("div", N, [
|
|
174
|
+
d.prefixIcon ? _(i.$slots, "prefixIcon", {
|
|
175
|
+
key: 0,
|
|
176
|
+
icon: d.prefixIcon
|
|
177
|
+
}, () => [(m(), a(v(d.prefixIcon), { "aria-hidden": "true" }))]) : o("", !0),
|
|
178
|
+
u(b(E), f(i.$attrs, {
|
|
179
|
+
id: d.id,
|
|
180
|
+
"display-value": K,
|
|
181
|
+
disabled: d.disabled,
|
|
182
|
+
autocomplete: "off",
|
|
183
|
+
onChange: h[0] ||= (e) => Z(e.target.value),
|
|
184
|
+
onSearch: re,
|
|
185
|
+
onInput: h[1] ||= (e) => V.value = e.target.value
|
|
186
|
+
}), null, 16, ["id", "disabled"]),
|
|
187
|
+
u(b(T), {
|
|
188
|
+
disabled: d.disabled,
|
|
189
|
+
class: "rvc-combobox-button",
|
|
190
|
+
onClick: h[2] ||= (e) => Z(V.value || null)
|
|
191
|
+
}, {
|
|
192
|
+
default: x(() => [B.value ? _(i.$slots, "spinner", {
|
|
193
|
+
key: 0,
|
|
194
|
+
spinning: B.value
|
|
195
|
+
}, () => [u(b(n), { class: "rvc-combobox-spinner" })]) : (!d.searchOnly || z.value?.length) && !B.value ? _(i.$slots, "icon", {
|
|
196
|
+
key: 1,
|
|
197
|
+
icon: d.icon
|
|
198
|
+
}, () => [(m(), a(v(d.icon ?? b(t)), { "aria-hidden": "true" }))]) : o("", !0)]),
|
|
199
|
+
_: 3
|
|
200
|
+
}, 8, ["disabled"])
|
|
201
|
+
]), d.clearable && (Array.isArray(d.modelValue) ? d.modelValue?.length : d.modelValue?.id) ? (m(), s("button", {
|
|
202
|
+
key: 0,
|
|
203
|
+
type: "button",
|
|
204
|
+
"aria-label": "Clear selection",
|
|
205
|
+
class: "rvc-combobox-clear",
|
|
206
|
+
onClick: h[3] ||= S((e) => R("update:modelValue", d.multiple ? [] : null), ["prevent"])
|
|
207
|
+
}, [_(i.$slots, "clear", {}, () => [u(b(A))])])) : o("", !0)]),
|
|
208
|
+
d.multiple && Array.isArray(W.value) && W.value?.length ? (m(), s("ul", ee, [(m(!0), s(r, null, g(W.value, (t) => (m(), s("li", { key: `${d.id}-selected-option-${t[d.itemKey]}` }, [_(i.$slots, "chip", {
|
|
209
|
+
optionText: d.optionText(t),
|
|
210
|
+
option: t,
|
|
211
|
+
removeOption: $
|
|
212
|
+
}, () => [u(e, {
|
|
213
|
+
color: "gray",
|
|
214
|
+
class: "rvc-combobox-chip",
|
|
215
|
+
size: d.size
|
|
216
|
+
}, {
|
|
217
|
+
default: x(() => [l(y(d.optionText(t)) + " ", 1), c("button", {
|
|
218
|
+
type: "button",
|
|
219
|
+
"aria-label": "Remove option",
|
|
220
|
+
onClick: S((e) => $(t), ["prevent"])
|
|
221
|
+
}, [u(b(k))], 8, te)]),
|
|
222
|
+
_: 2
|
|
223
|
+
}, 1032, ["size"])])]))), 128))])) : o("", !0),
|
|
224
|
+
(!d.searchOnly || V.value?.length) && (!B.value || z.value.length) ? (m(), a(b(O), {
|
|
225
|
+
key: 1,
|
|
226
|
+
class: "rvc-combobox-options"
|
|
227
|
+
}, {
|
|
228
|
+
default: x(() => [V.value && V.value.length < d.minLength ? (m(), s("div", ne, [c("div", null, [c("em", null, "Minimal " + y(d.minLength) + " characters.", 1)])])) : !B.value && !z.value.length ? (m(), s("div", P, [...h[5] ||= [c("div", null, " No results found. ", -1)]])) : (m(!0), s(r, { key: 2 }, g(z.value, (e) => (m(), a(b(D), {
|
|
229
|
+
key: `option-${e[d.itemKey]}`,
|
|
230
|
+
value: e,
|
|
231
|
+
as: "template"
|
|
232
|
+
}, {
|
|
233
|
+
default: x(({ active: t }) => [c("li", { class: p([
|
|
234
|
+
"rvc-combobox-option",
|
|
235
|
+
{ "rvc-combobox-option-hover": t },
|
|
236
|
+
{ "rvc-combobox-option-active": Q(e[d.itemKey]) }
|
|
237
|
+
]) }, [_(i.$slots, "option", {
|
|
238
|
+
option: e,
|
|
239
|
+
isActive: Q
|
|
240
|
+
}, () => [
|
|
241
|
+
_(i.$slots, "optionPrefix", {
|
|
242
|
+
option: e[d.itemKey],
|
|
243
|
+
isActive: Q
|
|
244
|
+
}),
|
|
245
|
+
c("span", F, y(d.optionText(e)), 1),
|
|
246
|
+
_(i.$slots, "optionSuffix", {
|
|
247
|
+
option: e[d.itemKey],
|
|
248
|
+
isActive: Q
|
|
249
|
+
})
|
|
250
|
+
])], 2)]),
|
|
251
|
+
_: 2
|
|
252
|
+
}, 1032, ["value"]))), 128))]),
|
|
253
|
+
_: 3
|
|
254
|
+
})) : o("", !0)
|
|
255
|
+
])]),
|
|
256
|
+
_: 3
|
|
257
|
+
}, 16, [
|
|
258
|
+
"modelValue",
|
|
259
|
+
"multiple",
|
|
260
|
+
"class"
|
|
261
|
+
]));
|
|
262
|
+
}
|
|
263
|
+
}), L = I;
|
|
264
|
+
//#endregion
|
|
265
|
+
export { I as n, L as t };
|