@leaflink/stash 51.8.0 → 51.9.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/dist/Filters.vue.d.ts +4 -6
- package/dist/ListView.vue.d.ts +10 -2
- package/dist/Select.js +193 -191
- package/dist/Select.js.map +1 -1
- package/dist/Select.vue.d.ts +26 -2
- package/dist/components.css +1 -1
- package/package.json +1 -1
package/dist/Select.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { u as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { DEBOUNCE as
|
|
11
|
-
import
|
|
12
|
-
import { D as
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { _ as
|
|
17
|
-
const
|
|
1
|
+
import { defineComponent as $e, useAttrs as ze, useSlots as He, ref as c, computed as h, watch as M, nextTick as Y, onMounted as Pe, onUnmounted as Ne, createBlock as J, openBlock as r, mergeProps as Ae, unref as g, createSlots as De, withCtx as T, createElementVNode as f, toDisplayString as b, withDirectives as $, createElementBlock as d, Fragment as G, renderList as q, withKeys as ue, normalizeClass as z, createCommentVNode as H, renderSlot as P, createTextVNode as N, withModifiers as A, createVNode as B, Teleport as Ue, Transition as Le, normalizeStyle as Ve, vModelText as Ke, vShow as Q } from "vue";
|
|
2
|
+
import { u as Ge, a as qe, f as je, o as We, s as Xe } from "./floating-ui.vue-pzUuloyX.js";
|
|
3
|
+
import Ye from "@leaflink/snitch";
|
|
4
|
+
import Z from "lodash-es/debounce";
|
|
5
|
+
import Je from "lodash-es/isEmpty";
|
|
6
|
+
import de from "lodash-es/isEqual";
|
|
7
|
+
import Qe from "lodash-es/isPlainObject";
|
|
8
|
+
import Ze from "lodash-es/uniqueId";
|
|
9
|
+
import et from "./useSearch.js";
|
|
10
|
+
import { DEBOUNCE as tt, KEY_CODES as x } from "./constants.js";
|
|
11
|
+
import lt from "./directives/clickoutside.js";
|
|
12
|
+
import { D as st } from "./MenusPlugin-Bk6UW6o9.js";
|
|
13
|
+
import fe from "./Chip.js";
|
|
14
|
+
import { _ as at } from "./Field.vue_vue_type_script_setup_true_lang-DI6z3AE9.js";
|
|
15
|
+
import D from "./Icon.js";
|
|
16
|
+
import { _ as nt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
17
|
+
const ot = { class: "tw-flex tw-h-input tw-items-center tw-text-sm" }, rt = ["id", "aria-labelledby"], it = ["id", "aria-errormessage", "aria-invalid", "disabled", "multiple", "name"], ct = ["selected", "value", "disabled"], ut = ["aria-controls", "aria-expanded", "aria-label", "aria-disabled"], dt = ["id"], ft = ["onKeypress", "onMousedown"], pt = {
|
|
18
18
|
key: 0,
|
|
19
19
|
class: "stash-select__total"
|
|
20
|
-
},
|
|
20
|
+
}, ht = {
|
|
21
21
|
key: 0,
|
|
22
22
|
class: "tw-flex tw-items-center tw-border-b tw-border-blue-500 tw-pr-1.5"
|
|
23
|
-
},
|
|
23
|
+
}, vt = ["data-test", "placeholder"], mt = { class: "stash-select__options options tw-my-1.5 tw-w-full tw-border-white tw-bg-white" }, yt = ["data-test", "onClick", "onMouseenter"], _t = {
|
|
24
24
|
key: 0,
|
|
25
25
|
class: "tw-ml-auto tw-pl-1.5"
|
|
26
|
-
},
|
|
26
|
+
}, wt = { class: "tw-m-1.5 tw-cursor-default tw-p-1.5" }, gt = {
|
|
27
27
|
class: "tw-m-1.5 tw-cursor-default tw-p-1.5",
|
|
28
28
|
"data-test": "stash-select|no-options"
|
|
29
|
-
},
|
|
29
|
+
}, bt = /* @__PURE__ */ $e({
|
|
30
30
|
name: "ll-select",
|
|
31
31
|
__name: "Select",
|
|
32
32
|
props: {
|
|
@@ -59,7 +59,7 @@ const lt = { class: "tw-flex tw-h-input tw-items-center tw-text-sm" }, st = ["id
|
|
|
59
59
|
useFuzzySearch: { type: Boolean, default: !1 },
|
|
60
60
|
menuPlacement: { default: "bottom-start" },
|
|
61
61
|
enableTeleport: { type: Boolean, default: !1 },
|
|
62
|
-
teleportTo: { default: `#${
|
|
62
|
+
teleportTo: { default: `#${st}` },
|
|
63
63
|
addBottomSpace: { type: Boolean },
|
|
64
64
|
errorText: {},
|
|
65
65
|
hintText: {},
|
|
@@ -75,14 +75,14 @@ const lt = { class: "tw-flex tw-h-input tw-items-center tw-text-sm" }, st = ["id
|
|
|
75
75
|
disabled: { type: Boolean }
|
|
76
76
|
},
|
|
77
77
|
emits: ["update:model-value", "clear", "add", "remove", "opened", "closed"],
|
|
78
|
-
setup(
|
|
79
|
-
const t =
|
|
80
|
-
whileElementsMounted:
|
|
78
|
+
setup(pe, { emit: he }) {
|
|
79
|
+
const t = pe, v = he, U = ze(), ve = He(), ee = c(null), m = c(null), C = c(null), O = c(null), te = c(null), I = c(0), R = c(0), n = c([]), le = c(() => []), y = c(""), p = c(-1), u = c(!1), j = c({}), se = c(!1), { floatingStyles: me, update: ye } = Ge(ee, C, {
|
|
80
|
+
whileElementsMounted: qe,
|
|
81
81
|
placement: t.menuPlacement,
|
|
82
82
|
middleware: [
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
je(),
|
|
84
|
+
We(({ rects: e, placement: l }) => l.split("-")[0] === "bottom" && I.value > R.value ? I.value - e.reference.height + 6 : 6),
|
|
85
|
+
Xe({
|
|
86
86
|
apply({ availableHeight: e, elements: l, rects: a }) {
|
|
87
87
|
t.enableTeleport && Object.assign(l.floating.style, {
|
|
88
88
|
maxWidth: `${a.reference.width}px`,
|
|
@@ -91,50 +91,50 @@ const lt = { class: "tw-flex tw-h-input tw-items-center tw-text-sm" }, st = ["id
|
|
|
91
91
|
}
|
|
92
92
|
})
|
|
93
93
|
]
|
|
94
|
-
}), W =
|
|
95
|
-
let e = (
|
|
96
|
-
return
|
|
97
|
-
}),
|
|
98
|
-
() => !u.value && !t.single && !
|
|
99
|
-
),
|
|
100
|
-
|
|
94
|
+
}), ae = new ResizeObserver(() => k()), W = h(() => !t.hideSearch && t.searchable !== "false" && t.searchable !== !1), L = h(() => {
|
|
95
|
+
let e = (se.value && t.lazy ? t.lazy() : t.options).filter(Boolean);
|
|
96
|
+
return Qe(e[0]) || (e = e.map((l, a) => ({ name: l, id: a }))), e;
|
|
97
|
+
}), _e = h(() => n.value.length ? n.value.map((e) => e[t.displayBy] || e).join(", ") : ""), ne = h(() => t.searchLoading || Object.keys(j.value).length > 0), F = h(() => t.disableFiltering || !(y.value || "").trim() ? L.value : le.value(y.value)), we = h(() => I.value <= R.value), ge = h(
|
|
98
|
+
() => !u.value && !t.single && !we.value && n.value.length
|
|
99
|
+
), be = h(() => [n.value.length, t.selectItemType, "selected"].filter(Boolean).join(" ")), Be = h(() => t.preventEmpty || t.allowEmpty === "false" || t.allowEmpty === !1);
|
|
100
|
+
M(y, (e, l) => l !== e && K(-1)), M(n, () => k(), { deep: !0 }), M(
|
|
101
101
|
() => t.modelValue,
|
|
102
102
|
(e) => {
|
|
103
103
|
if (Array.isArray(e)) {
|
|
104
104
|
const l = e.filter(Boolean);
|
|
105
|
-
|
|
105
|
+
de(l, n.value) || (n.value = l);
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
|
-
if (!
|
|
109
|
-
|
|
108
|
+
if (!Je(e)) {
|
|
109
|
+
de(e, n.value[0]) || (n.value[0] = e);
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
112
|
n.value = [];
|
|
113
113
|
},
|
|
114
114
|
{ immediate: !0 }
|
|
115
|
-
),
|
|
115
|
+
), M(
|
|
116
116
|
() => t.options,
|
|
117
117
|
() => {
|
|
118
|
-
const { searchFor: e } =
|
|
119
|
-
items:
|
|
118
|
+
const { searchFor: e } = et({
|
|
119
|
+
items: h(() => L.value),
|
|
120
120
|
fieldNames: t.searchBy.length ? t.searchBy : [t.displayBy],
|
|
121
121
|
trackBy: t.trackBy
|
|
122
122
|
});
|
|
123
|
-
|
|
123
|
+
le.value = (l) => e(l, { fuzzy: t.useFuzzySearch });
|
|
124
124
|
},
|
|
125
125
|
{ immediate: !0 }
|
|
126
|
-
);
|
|
127
|
-
const X = (e) => e && typeof e == "object" && "disabled" in e && (e == null ? void 0 : e.disabled),
|
|
128
|
-
n.value = [],
|
|
129
|
-
},
|
|
130
|
-
t.disabled || !e || X(e) || (
|
|
131
|
-
},
|
|
126
|
+
), M(I, () => ke());
|
|
127
|
+
const ke = Z(() => ye(), 50), k = Z(() => ce(), 50), X = (e) => e && typeof e == "object" && "disabled" in e && (e == null ? void 0 : e.disabled), Se = () => {
|
|
128
|
+
n.value = [], v("update:model-value", t.single ? void 0 : n.value), v("clear");
|
|
129
|
+
}, V = (e) => {
|
|
130
|
+
t.disabled || !e || X(e) || (E(e) ? _(e) : (t.single && (n.value = []), n.value.push(e), v("update:model-value", t.single ? n.value[0] : n.value), v("add", e)), t.single && S());
|
|
131
|
+
}, Ee = (e) => {
|
|
132
132
|
if (t.single) {
|
|
133
|
-
const a =
|
|
133
|
+
const a = L.value.find((o) => {
|
|
134
134
|
var i;
|
|
135
135
|
return ((i = o[t.trackBy]) == null ? void 0 : i.toString()) === e.target.value;
|
|
136
136
|
});
|
|
137
|
-
|
|
137
|
+
V(a);
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
140
|
const l = [...e.target.selectedOptions];
|
|
@@ -142,129 +142,129 @@ const lt = { class: "tw-flex tw-h-input tw-items-center tw-text-sm" }, st = ["id
|
|
|
142
142
|
l.find((i) => {
|
|
143
143
|
var s;
|
|
144
144
|
return i.value === ((s = a[t.trackBy]) == null ? void 0 : s.toString());
|
|
145
|
-
}) ||
|
|
145
|
+
}) || _(a);
|
|
146
146
|
for (const a of l) {
|
|
147
|
-
const o =
|
|
147
|
+
const o = L.value.find(
|
|
148
148
|
(i) => {
|
|
149
149
|
var s;
|
|
150
150
|
return ((s = i[t.trackBy]) == null ? void 0 : s.toString()) === a.value;
|
|
151
151
|
}
|
|
152
152
|
);
|
|
153
|
-
|
|
153
|
+
E(o) || V(o);
|
|
154
154
|
}
|
|
155
|
-
},
|
|
156
|
-
if (t.disabled ||
|
|
155
|
+
}, _ = (e) => {
|
|
156
|
+
if (t.disabled || Be.value && n.value.length === 1)
|
|
157
157
|
return;
|
|
158
158
|
const l = n.value.findIndex((a) => a[t.trackBy] === e[t.trackBy]);
|
|
159
159
|
if (l === -1) {
|
|
160
|
-
|
|
160
|
+
Ye.warn("ll-select: could not find option to remove", e);
|
|
161
161
|
return;
|
|
162
162
|
}
|
|
163
|
-
n.value.splice(l, 1),
|
|
164
|
-
},
|
|
165
|
-
u.value || (
|
|
163
|
+
n.value.splice(l, 1), v("update:model-value", t.single ? n.value[0] : n.value), v("remove", e, l);
|
|
164
|
+
}, oe = () => {
|
|
165
|
+
u.value || (k(), u.value = !0, v("opened"), W.value && Y(() => {
|
|
166
166
|
var e;
|
|
167
|
-
(e =
|
|
167
|
+
(e = te.value) == null || e.focus({ preventScroll: !0 });
|
|
168
168
|
}));
|
|
169
|
-
},
|
|
169
|
+
}, S = () => {
|
|
170
170
|
var e;
|
|
171
|
-
u.value &&
|
|
172
|
-
},
|
|
171
|
+
u.value && v("closed", n.value), K(-1), u.value = !1, t.preserveSearchTerm || (y.value = ""), (e = m.value) == null || e.blur();
|
|
172
|
+
}, Te = async (e) => {
|
|
173
173
|
if (await Y(), !m.value)
|
|
174
174
|
return;
|
|
175
|
-
if (![
|
|
175
|
+
if (![x.ENTER, x.ESCAPE].includes(e.keyCode)) {
|
|
176
176
|
const a = m.value.querySelector(".stash-select__option--highlighted"), o = a == null ? void 0 : a.getBoundingClientRect(), i = m.value.getBoundingClientRect();
|
|
177
177
|
if (!o || !i)
|
|
178
178
|
return;
|
|
179
179
|
(o.bottom >= i.bottom || o.top <= i.top + o.height) && (a == null || a.scrollIntoView({ block: "nearest", inline: "nearest" }));
|
|
180
180
|
}
|
|
181
|
-
},
|
|
181
|
+
}, K = (e) => {
|
|
182
182
|
p.value = e;
|
|
183
|
-
},
|
|
184
|
-
if (e.keyCode ===
|
|
185
|
-
|
|
186
|
-
else if (e.keyCode ===
|
|
183
|
+
}, xe = (e) => {
|
|
184
|
+
if (e.keyCode === x.ESCAPE)
|
|
185
|
+
S();
|
|
186
|
+
else if (e.keyCode === x.DOWN && p.value < F.value.length - 1 && u.value)
|
|
187
187
|
p.value++;
|
|
188
|
-
else if (e.keyCode ===
|
|
189
|
-
u.value && p.value--,
|
|
190
|
-
else if (e.keyCode ===
|
|
191
|
-
|
|
188
|
+
else if (e.keyCode === x.UP && p.value > 0)
|
|
189
|
+
u.value && p.value--, C.value && W.value && p.value === 0 && (C.value.scrollTop -= 100);
|
|
190
|
+
else if (e.keyCode === x.ENTER && p.value !== -1 && u.value)
|
|
191
|
+
V(F.value[p.value]);
|
|
192
192
|
else
|
|
193
193
|
return;
|
|
194
|
-
e.preventDefault(),
|
|
195
|
-
},
|
|
196
|
-
|
|
197
|
-
},
|
|
194
|
+
e.preventDefault(), Te(e);
|
|
195
|
+
}, re = Z(function() {
|
|
196
|
+
Ce();
|
|
197
|
+
}, tt.FAST), Ce = async function() {
|
|
198
198
|
if (!t.onSearch)
|
|
199
199
|
return;
|
|
200
|
-
const e =
|
|
200
|
+
const e = Ze("search-request-");
|
|
201
201
|
try {
|
|
202
202
|
j.value[e] = !0, await t.onSearch(y.value);
|
|
203
203
|
} finally {
|
|
204
204
|
delete j.value[e];
|
|
205
205
|
}
|
|
206
|
-
},
|
|
206
|
+
}, Oe = (e, l) => [
|
|
207
207
|
{
|
|
208
208
|
"stash-select__option": !0,
|
|
209
209
|
"stash-select__option--disabled": X(e),
|
|
210
210
|
"stash-select__option--highlighted": p.value === l,
|
|
211
|
-
"stash-select__option--selected":
|
|
211
|
+
"stash-select__option--selected": E(e)
|
|
212
212
|
},
|
|
213
213
|
// @deprecated
|
|
214
214
|
// backwards compatibility
|
|
215
215
|
{
|
|
216
216
|
"is-selected": p.value === l,
|
|
217
217
|
"tw-bg-ice-200": p.value === l,
|
|
218
|
-
"tw-bg-blue-100 tw-text-ice-700":
|
|
218
|
+
"tw-bg-blue-100 tw-text-ice-700": E(e)
|
|
219
219
|
}
|
|
220
|
-
],
|
|
221
|
-
function
|
|
220
|
+
], E = (e) => e == null ? !1 : n.value.some((l) => (l == null ? void 0 : l[t.trackBy]) === e[t.trackBy]);
|
|
221
|
+
function ie(e) {
|
|
222
222
|
var o, i;
|
|
223
223
|
if (!e)
|
|
224
224
|
return !1;
|
|
225
|
-
const l = (o = m.value) == null ? void 0 : o.contains(e), a = (i =
|
|
225
|
+
const l = (o = m.value) == null ? void 0 : o.contains(e), a = (i = C.value) == null ? void 0 : i.contains(e);
|
|
226
226
|
return l || a;
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function Ie(e) {
|
|
229
229
|
const l = e.relatedTarget;
|
|
230
|
-
!
|
|
230
|
+
!ie(l) && l && S();
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function Re(e) {
|
|
233
233
|
const l = e.target;
|
|
234
|
-
|
|
234
|
+
ie(l) || S();
|
|
235
235
|
}
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
},
|
|
239
|
-
await Y(),
|
|
236
|
+
const Fe = () => {
|
|
237
|
+
K(-1);
|
|
238
|
+
}, ce = async () => {
|
|
239
|
+
await Y(), O.value && m.value && (R.value = R.value === 0 ? m.value.clientHeight : R.value, I.value = O.value.clientHeight);
|
|
240
240
|
};
|
|
241
|
-
return
|
|
242
|
-
if (
|
|
241
|
+
return Pe(() => {
|
|
242
|
+
if (U.onInput)
|
|
243
243
|
throw new Error("ll-select: use the @update:model-value event instead of @input.");
|
|
244
|
-
window.addEventListener("resize",
|
|
245
|
-
}),
|
|
246
|
-
window.removeEventListener("resize",
|
|
247
|
-
}), (e, l) => (r(), J(
|
|
248
|
-
class: ["input ll-select stash-select", g(
|
|
244
|
+
O.value && ae.observe(O.value), window.addEventListener("resize", k), k();
|
|
245
|
+
}), Ne(() => {
|
|
246
|
+
window.removeEventListener("resize", ce), ae.disconnect(), k.cancel();
|
|
247
|
+
}), (e, l) => (r(), J(at, Ae(t, {
|
|
248
|
+
class: ["input ll-select stash-select", g(U).class],
|
|
249
249
|
"data-test": "stash-select",
|
|
250
250
|
"error-text": t.errorText || t.error,
|
|
251
251
|
"hint-text": t.hintText || t.hint
|
|
252
|
-
}),
|
|
252
|
+
}), De({ _: 2 }, [
|
|
253
253
|
t.isReadOnly ? {
|
|
254
254
|
name: "default",
|
|
255
|
-
fn:
|
|
256
|
-
f("div",
|
|
255
|
+
fn: T(({ fieldId: a, labelId: o }) => [
|
|
256
|
+
f("div", ot, [
|
|
257
257
|
f("span", {
|
|
258
258
|
id: a,
|
|
259
259
|
"aria-labelledby": o,
|
|
260
260
|
class: "show-empty tw-h-min"
|
|
261
|
-
}, b(
|
|
261
|
+
}, b(_e.value), 9, rt)
|
|
262
262
|
])
|
|
263
263
|
]),
|
|
264
264
|
key: "0"
|
|
265
265
|
} : {
|
|
266
266
|
name: "default",
|
|
267
|
-
fn:
|
|
267
|
+
fn: T(({ fieldId: a, fieldErrorId: o, hasError: i }) => [
|
|
268
268
|
f("select", {
|
|
269
269
|
id: a,
|
|
270
270
|
"aria-errormessage": o,
|
|
@@ -273,22 +273,22 @@ const lt = { class: "tw-flex tw-h-input tw-items-center tw-text-sm" }, st = ["id
|
|
|
273
273
|
disabled: t.disabled,
|
|
274
274
|
multiple: !t.single,
|
|
275
275
|
name: t.name,
|
|
276
|
-
onChange:
|
|
276
|
+
onChange: Ee
|
|
277
277
|
}, [
|
|
278
|
-
(r(!0), d(
|
|
279
|
-
key: `srOnlyOption-${
|
|
280
|
-
selected:
|
|
278
|
+
(r(!0), d(G, null, q(F.value, (s, w) => (r(), d("option", {
|
|
279
|
+
key: `srOnlyOption-${w}`,
|
|
280
|
+
selected: E(s),
|
|
281
281
|
value: s[t.trackBy],
|
|
282
282
|
disabled: X(s)
|
|
283
|
-
}, b(s[t.displayBy] || ""), 9,
|
|
283
|
+
}, b(s[t.displayBy] || ""), 9, ct))), 128)),
|
|
284
284
|
l[5] || (l[5] = f("option", { value: "" }, null, -1))
|
|
285
|
-
], 40,
|
|
286
|
-
|
|
285
|
+
], 40, it),
|
|
286
|
+
$((r(), d("div", {
|
|
287
287
|
ref_key: "selectRef",
|
|
288
|
-
ref:
|
|
288
|
+
ref: ee,
|
|
289
289
|
role: "listbox",
|
|
290
290
|
"aria-hidden": "true",
|
|
291
|
-
class:
|
|
291
|
+
class: z(["stash-select__content-wrapper", [
|
|
292
292
|
{
|
|
293
293
|
"stash-select--disabled": !!t.disabled,
|
|
294
294
|
"stash-select--error": !!(t.errorText || t.error),
|
|
@@ -307,8 +307,8 @@ const lt = { class: "tw-flex tw-h-input tw-items-center tw-text-sm" }, st = ["id
|
|
|
307
307
|
"aria-expanded": u.value,
|
|
308
308
|
"aria-label": t.placeholder,
|
|
309
309
|
"aria-disabled": t.disabled || void 0,
|
|
310
|
-
onKeydown:
|
|
311
|
-
onKeyup:
|
|
310
|
+
onKeydown: xe,
|
|
311
|
+
onKeyup: ue(S, ["esc"])
|
|
312
312
|
}, [
|
|
313
313
|
f("div", {
|
|
314
314
|
id: "listbox-" + a,
|
|
@@ -317,155 +317,157 @@ const lt = { class: "tw-flex tw-h-input tw-items-center tw-text-sm" }, st = ["id
|
|
|
317
317
|
class: "input-field stash-select__content",
|
|
318
318
|
tabindex: "0",
|
|
319
319
|
"data-test": "stash-select|dropdown-trigger",
|
|
320
|
-
onFocusin:
|
|
321
|
-
onFocusinOnce: l[4] || (l[4] = (s) =>
|
|
322
|
-
onFocusout:
|
|
323
|
-
onKeydown:
|
|
324
|
-
onMouseleave:
|
|
320
|
+
onFocusin: oe,
|
|
321
|
+
onFocusinOnce: l[4] || (l[4] = (s) => se.value = !0),
|
|
322
|
+
onFocusout: Ie,
|
|
323
|
+
onKeydown: oe,
|
|
324
|
+
onMouseleave: Fe
|
|
325
325
|
}, [
|
|
326
326
|
f("ul", {
|
|
327
327
|
ref_key: "chipsRef",
|
|
328
|
-
ref:
|
|
328
|
+
ref: O,
|
|
329
329
|
class: "stash-select__chips"
|
|
330
330
|
}, [
|
|
331
|
-
n.value.length ?
|
|
331
|
+
n.value.length ? H("", !0) : (r(), d("li", {
|
|
332
332
|
key: 0,
|
|
333
|
-
class:
|
|
333
|
+
class: z(["stash-select__placeholder tw-mr-0 tw-pl-1.5", { "tw-truncate": !t.noTruncate }])
|
|
334
334
|
}, b(t.placeholder), 3)),
|
|
335
|
-
t.single ? (r(!0), d(
|
|
335
|
+
t.single ? (r(!0), d(G, { key: 1 }, q(n.value, (s) => (r(), d("li", {
|
|
336
336
|
key: `chip-${s[t.trackBy]}`,
|
|
337
|
-
class:
|
|
337
|
+
class: z(["stash-select__selected tw-mr-0 tw-pl-1.5", { "tw-truncate": !t.noTruncate }])
|
|
338
338
|
}, [
|
|
339
|
-
|
|
339
|
+
P(e.$slots, "selected", {
|
|
340
340
|
option: s,
|
|
341
|
-
onRemove: () =>
|
|
341
|
+
onRemove: () => _(s),
|
|
342
|
+
chipSelectedClass: "stash-select__chip"
|
|
342
343
|
}, () => [
|
|
343
|
-
|
|
344
|
+
N(b(s[t.displayBy] || s) + " ", 1),
|
|
344
345
|
f("button", {
|
|
345
346
|
tabindex: "-1",
|
|
346
347
|
class: "stash-select__remove",
|
|
347
|
-
onKeypress:
|
|
348
|
-
onMousedown:
|
|
348
|
+
onKeypress: ue(A((w) => _(s), ["prevent"]), ["enter"]),
|
|
349
|
+
onMousedown: A((w) => _(s), ["prevent", "stop"])
|
|
349
350
|
}, [
|
|
350
|
-
B(
|
|
351
|
+
B(D, {
|
|
351
352
|
icon: "close",
|
|
352
353
|
name: "close",
|
|
353
354
|
size: "small"
|
|
354
355
|
})
|
|
355
|
-
], 40,
|
|
356
|
+
], 40, ft)
|
|
356
357
|
], !0)
|
|
357
|
-
], 2))), 128)) : (r(!0), d(
|
|
358
|
+
], 2))), 128)) : (r(!0), d(G, { key: 2 }, q(n.value, (s) => (r(), d("li", {
|
|
358
359
|
key: `chip-${s[t.trackBy]}`,
|
|
359
360
|
class: "tw-inline-block"
|
|
360
361
|
}, [
|
|
361
|
-
|
|
362
|
+
P(e.$slots, "selected", {
|
|
362
363
|
option: s,
|
|
363
|
-
onRemove: () =>
|
|
364
|
+
onRemove: () => _(s),
|
|
365
|
+
chipSelectedClass: "stash-select__chip"
|
|
364
366
|
}, () => [
|
|
365
|
-
B(
|
|
367
|
+
B(fe, {
|
|
366
368
|
"bg-color": "blue-500",
|
|
367
369
|
"is-removable": "",
|
|
368
370
|
"text-color": "white",
|
|
369
371
|
class: "stash-select__chip",
|
|
370
|
-
onRemove: (
|
|
372
|
+
onRemove: (w) => _(s)
|
|
371
373
|
}, {
|
|
372
|
-
default:
|
|
373
|
-
|
|
374
|
+
default: T(() => [
|
|
375
|
+
N(b(s[t.displayBy] || s), 1)
|
|
374
376
|
]),
|
|
375
377
|
_: 2
|
|
376
378
|
}, 1032, ["onRemove"])
|
|
377
379
|
], !0)
|
|
378
380
|
]))), 128))
|
|
379
381
|
], 512),
|
|
380
|
-
|
|
381
|
-
B(
|
|
382
|
+
ge.value ? (r(), d("div", pt, [
|
|
383
|
+
B(fe, {
|
|
382
384
|
"bg-color": "blue-500",
|
|
383
385
|
"is-removable": "",
|
|
384
386
|
"text-color": "white",
|
|
385
387
|
class: "stash-select__chip",
|
|
386
|
-
onRemove:
|
|
388
|
+
onRemove: Se
|
|
387
389
|
}, {
|
|
388
|
-
default:
|
|
389
|
-
|
|
390
|
+
default: T(() => [
|
|
391
|
+
N(b(be.value), 1)
|
|
390
392
|
]),
|
|
391
393
|
_: 1
|
|
392
394
|
})
|
|
393
|
-
])) :
|
|
394
|
-
t.icon ? (r(), J(
|
|
395
|
+
])) : H("", !0),
|
|
396
|
+
t.icon ? (r(), J(D, {
|
|
395
397
|
key: 1,
|
|
396
|
-
class:
|
|
398
|
+
class: z(["stash-select__icon", { "tw-text-ice-500": t.disabled }]),
|
|
397
399
|
"data-test": "stash-select|toggle-icon",
|
|
398
400
|
name: t.icon,
|
|
399
|
-
onMousedown: l[0] || (l[0] =
|
|
400
|
-
}, null, 8, ["name", "class"])) :
|
|
401
|
-
(r(), J(
|
|
401
|
+
onMousedown: l[0] || (l[0] = A((s) => u.value && S(), ["prevent"]))
|
|
402
|
+
}, null, 8, ["name", "class"])) : H("", !0),
|
|
403
|
+
(r(), J(Ue, {
|
|
402
404
|
to: t.teleportTo,
|
|
403
405
|
disabled: !t.enableTeleport
|
|
404
406
|
}, [
|
|
405
|
-
B(
|
|
406
|
-
default:
|
|
407
|
-
|
|
407
|
+
B(Le, { name: "fade" }, {
|
|
408
|
+
default: T(() => [
|
|
409
|
+
$(f("div", {
|
|
408
410
|
ref_key: "optionsWrapperRef",
|
|
409
|
-
ref:
|
|
411
|
+
ref: C,
|
|
410
412
|
class: "stash-select__border-selector tw-w-full tw-shadow-2xl",
|
|
411
|
-
style:
|
|
412
|
-
onClick: l[3] || (l[3] =
|
|
413
|
+
style: Ve(g(me)),
|
|
414
|
+
onClick: l[3] || (l[3] = A(() => {
|
|
413
415
|
}, ["stop"]))
|
|
414
416
|
}, [
|
|
415
|
-
W.value ? (r(), d("div",
|
|
416
|
-
|
|
417
|
+
W.value ? (r(), d("div", ht, [
|
|
418
|
+
$(f("input", {
|
|
417
419
|
ref_key: "searchRef",
|
|
418
|
-
ref:
|
|
420
|
+
ref: te,
|
|
419
421
|
"onUpdate:modelValue": l[1] || (l[1] = (s) => y.value = s),
|
|
420
422
|
type: "text",
|
|
421
423
|
autocomplete: "off",
|
|
422
424
|
class: "stash-select__search",
|
|
423
|
-
"data-test": g(
|
|
425
|
+
"data-test": g(U)["data-test"] ? g(U)["data-test"] + "-search" : "stash-select|search",
|
|
424
426
|
placeholder: t.searchPlaceholder,
|
|
425
427
|
spellcheck: !1,
|
|
426
428
|
onInput: l[2] || (l[2] = //@ts-ignore
|
|
427
|
-
(...s) => g(
|
|
428
|
-
}, null, 40,
|
|
429
|
-
[
|
|
429
|
+
(...s) => g(re) && g(re)(...s))
|
|
430
|
+
}, null, 40, vt), [
|
|
431
|
+
[Ke, y.value]
|
|
430
432
|
]),
|
|
431
|
-
B(
|
|
433
|
+
B(D, {
|
|
432
434
|
name: "search",
|
|
433
435
|
class: "tw-text-ice-500"
|
|
434
436
|
})
|
|
435
|
-
])) :
|
|
436
|
-
f("ul",
|
|
437
|
-
(r(!0), d(
|
|
437
|
+
])) : H("", !0),
|
|
438
|
+
f("ul", mt, [
|
|
439
|
+
(r(!0), d(G, null, q(F.value, (s, w) => (r(), d("li", {
|
|
438
440
|
key: `option-${s[t.trackBy]}`,
|
|
439
441
|
"data-test": s[t.trackBy],
|
|
440
|
-
class:
|
|
441
|
-
onClick: (
|
|
442
|
-
onMouseenter:
|
|
442
|
+
class: z(Oe(s, w)),
|
|
443
|
+
onClick: (Me) => V(s),
|
|
444
|
+
onMouseenter: A((Me) => K(w), ["self"])
|
|
443
445
|
}, [
|
|
444
|
-
|
|
445
|
-
|
|
446
|
+
P(e.$slots, "option", { option: s }, () => [
|
|
447
|
+
N(b(s[t.displayBy] || s), 1)
|
|
446
448
|
], !0),
|
|
447
|
-
|
|
448
|
-
B(
|
|
449
|
+
E(s) && !t.hideCheck ? (r(), d("span", _t, [
|
|
450
|
+
B(D, {
|
|
449
451
|
class: "tw-text-blue-500",
|
|
450
452
|
name: "check"
|
|
451
453
|
})
|
|
452
|
-
])) :
|
|
453
|
-
], 42,
|
|
454
|
-
|
|
455
|
-
B(
|
|
454
|
+
])) : H("", !0)
|
|
455
|
+
], 42, yt))), 128)),
|
|
456
|
+
$(f("li", wt, [
|
|
457
|
+
B(D, {
|
|
456
458
|
"data-test": "stash-select|options-loading",
|
|
457
459
|
name: "working",
|
|
458
460
|
class: "tw-animate-spin tw-text-ice-500"
|
|
459
461
|
})
|
|
460
462
|
], 512), [
|
|
461
|
-
[Q, t.loading ||
|
|
463
|
+
[Q, t.loading || ne.value]
|
|
462
464
|
]),
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
l[6] || (l[6] =
|
|
465
|
+
$(f("li", gt, [
|
|
466
|
+
P(e.$slots, "no-options", {}, () => [
|
|
467
|
+
l[6] || (l[6] = N(" No options "))
|
|
466
468
|
], !0)
|
|
467
469
|
], 512), [
|
|
468
|
-
[Q, !t.loading && !
|
|
470
|
+
[Q, !t.loading && !ne.value && !F.value.length]
|
|
469
471
|
])
|
|
470
472
|
])
|
|
471
473
|
], 4), [
|
|
@@ -475,24 +477,24 @@ const lt = { class: "tw-flex tw-h-input tw-items-center tw-text-sm" }, st = ["id
|
|
|
475
477
|
_: 3
|
|
476
478
|
})
|
|
477
479
|
], 8, ["to", "disabled"]))
|
|
478
|
-
], 40,
|
|
479
|
-
], 42,
|
|
480
|
-
[g(
|
|
480
|
+
], 40, dt)
|
|
481
|
+
], 42, ut)), [
|
|
482
|
+
[g(lt), Re]
|
|
481
483
|
])
|
|
482
484
|
]),
|
|
483
485
|
key: "1"
|
|
484
486
|
},
|
|
485
|
-
|
|
487
|
+
ve.hint ? {
|
|
486
488
|
name: "hint",
|
|
487
|
-
fn:
|
|
488
|
-
|
|
489
|
+
fn: T(() => [
|
|
490
|
+
P(e.$slots, "hint", {}, void 0, !0)
|
|
489
491
|
]),
|
|
490
492
|
key: "2"
|
|
491
493
|
} : void 0
|
|
492
494
|
]), 1040, ["class", "error-text", "hint-text"]));
|
|
493
495
|
}
|
|
494
|
-
}),
|
|
496
|
+
}), Dt = /* @__PURE__ */ nt(bt, [["__scopeId", "data-v-f71e0e77"]]);
|
|
495
497
|
export {
|
|
496
|
-
|
|
498
|
+
Dt as default
|
|
497
499
|
};
|
|
498
500
|
//# sourceMappingURL=Select.js.map
|