@leaflink/stash 51.7.0 → 51.9.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/dist/Filters.vue.d.ts +20 -7
- package/dist/ListView.vue.d.ts +26 -7
- package/dist/Select.js +199 -189
- package/dist/Select.js.map +1 -1
- package/dist/Select.vue.d.ts +70 -9
- 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 Me, useAttrs as $e, useSlots as ze, ref as c, computed as h, watch as K, nextTick as Y, onMounted as He, onUnmounted as Pe, createBlock as J, openBlock as r, mergeProps as Ne, unref as g, createSlots as Ae, withCtx as T, createElementVNode as f, toDisplayString as b, withDirectives as F, createElementBlock as d, Fragment as G, renderList as q, withKeys as ce, normalizeClass as M, createCommentVNode as $, renderSlot as z, createTextVNode as H, withModifiers as P, createVNode as B, Teleport as De, Transition as Le, normalizeStyle as Ue, vModelText as Ve, vShow as Q } from "vue";
|
|
2
|
+
import { u as Ke, a as Ge, f as qe, o as je, s as We } from "./floating-ui.vue-pzUuloyX.js";
|
|
3
|
+
import Xe from "@leaflink/snitch";
|
|
4
|
+
import ue from "lodash-es/debounce";
|
|
5
|
+
import Ye from "lodash-es/isEmpty";
|
|
6
|
+
import de from "lodash-es/isEqual";
|
|
7
|
+
import Je from "lodash-es/isPlainObject";
|
|
8
|
+
import Qe from "lodash-es/uniqueId";
|
|
9
|
+
import Ze from "./useSearch.js";
|
|
10
|
+
import { DEBOUNCE as et, KEY_CODES as x } from "./constants.js";
|
|
11
|
+
import tt from "./directives/clickoutside.js";
|
|
12
|
+
import { D as lt } from "./MenusPlugin-Bk6UW6o9.js";
|
|
13
|
+
import fe from "./Chip.js";
|
|
14
|
+
import { _ as st } from "./Field.vue_vue_type_script_setup_true_lang-DI6z3AE9.js";
|
|
15
|
+
import N from "./Icon.js";
|
|
16
|
+
import { _ as at } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
17
|
+
const nt = { class: "tw-flex tw-h-input tw-items-center tw-text-sm" }, ot = ["id", "aria-labelledby"], rt = ["id", "aria-errormessage", "aria-invalid", "disabled", "multiple", "name"], it = ["selected", "value", "disabled"], ct = ["aria-controls", "aria-expanded", "aria-label", "aria-disabled"], ut = ["id"], dt = ["onKeypress", "onMousedown"], ft = {
|
|
18
18
|
key: 0,
|
|
19
19
|
class: "stash-select__total"
|
|
20
|
-
},
|
|
20
|
+
}, pt = {
|
|
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
|
+
}, ht = ["data-test", "placeholder"], vt = { class: "stash-select__options options tw-my-1.5 tw-w-full tw-border-white tw-bg-white" }, mt = ["data-test", "onClick", "onMouseenter"], yt = {
|
|
24
24
|
key: 0,
|
|
25
25
|
class: "tw-ml-auto tw-pl-1.5"
|
|
26
|
-
},
|
|
26
|
+
}, _t = { class: "tw-m-1.5 tw-cursor-default tw-p-1.5" }, wt = {
|
|
27
27
|
class: "tw-m-1.5 tw-cursor-default tw-p-1.5",
|
|
28
28
|
"data-test": "stash-select|no-options"
|
|
29
|
-
},
|
|
29
|
+
}, gt = /* @__PURE__ */ Me({
|
|
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: `#${lt}` },
|
|
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, A = $e(), ve = ze(), Z = c(null), m = c(null), C = c(null), O = c(null), ee = c(null), D = c(0), I = c(0), n = c([]), te = c(() => []), y = c(""), p = c(-1), u = c(!1), j = c({}), le = c(!1), { floatingStyles: me, update: ye } = Ke(Z, C, {
|
|
80
|
+
whileElementsMounted: Ge,
|
|
81
81
|
placement: t.menuPlacement,
|
|
82
82
|
middleware: [
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
qe(),
|
|
84
|
+
je(({ rects: e, placement: l }) => l.split("-")[0] === "bottom" && D.value > I.value ? D.value - e.reference.height + 6 : 6),
|
|
85
|
+
We({
|
|
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,32 +91,32 @@ const lt = { class: "tw-flex tw-h-input tw-items-center tw-text-sm" }, st = ["id
|
|
|
91
91
|
}
|
|
92
92
|
})
|
|
93
93
|
]
|
|
94
|
-
}), W = h(() => !t.hideSearch && t.searchable !== "false" && t.searchable !== !1),
|
|
94
|
+
}), se = new ResizeObserver(() => k()), W = h(() => !t.hideSearch && t.searchable !== "false" && t.searchable !== !1), L = h(() => {
|
|
95
95
|
let e = (le.value && t.lazy ? t.lazy() : t.options).filter(Boolean);
|
|
96
|
-
return
|
|
97
|
-
}),
|
|
98
|
-
() => !u.value && !t.single && !
|
|
99
|
-
),
|
|
100
|
-
|
|
96
|
+
return Je(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(", ") : ""), ae = h(() => t.searchLoading || Object.keys(j.value).length > 0), R = h(() => t.disableFiltering || !(y.value || "").trim() ? L.value : te.value(y.value)), we = h(() => D.value <= I.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
|
+
K(y, (e, l) => l !== e && V(-1)), K(n, () => k(), { deep: !0 }), K(
|
|
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 (!Ye(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
|
+
), K(
|
|
116
116
|
() => t.options,
|
|
117
117
|
() => {
|
|
118
|
-
const { searchFor: e } =
|
|
119
|
-
items: h(() =>
|
|
118
|
+
const { searchFor: e } = Ze({
|
|
119
|
+
items: h(() => L.value),
|
|
120
120
|
fieldNames: t.searchBy.length ? t.searchBy : [t.displayBy],
|
|
121
121
|
trackBy: t.trackBy
|
|
122
122
|
});
|
|
@@ -124,17 +124,17 @@ const lt = { class: "tw-flex tw-h-input tw-items-center tw-text-sm" }, st = ["id
|
|
|
124
124
|
},
|
|
125
125
|
{ immediate: !0 }
|
|
126
126
|
);
|
|
127
|
-
const X = (e) => e && typeof e == "object" && "disabled" in e && (e == null ? void 0 : e.disabled),
|
|
127
|
+
const k = ue(() => ie(), 50), X = (e) => e && typeof e == "object" && "disabled" in e && (e == null ? void 0 : e.disabled), ke = () => {
|
|
128
128
|
n.value = [], v("update:model-value", t.single ? void 0 : n.value), v("clear");
|
|
129
|
-
},
|
|
130
|
-
t.disabled || !e || X(e) || (
|
|
131
|
-
},
|
|
129
|
+
}, U = (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
|
+
}, Se = (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
|
+
U(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) || U(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
|
+
Xe.warn("ll-select: could not find option to remove", e);
|
|
161
161
|
return;
|
|
162
162
|
}
|
|
163
163
|
n.value.splice(l, 1), v("update:model-value", t.single ? n.value[0] : n.value), v("remove", e, l);
|
|
164
|
-
},
|
|
165
|
-
u.value || (
|
|
164
|
+
}, ne = () => {
|
|
165
|
+
u.value || (k(), u.value = !0, v("opened"), W.value && Y(() => {
|
|
166
166
|
var e;
|
|
167
167
|
(e = ee.value) == null || e.focus({ preventScroll: !0 });
|
|
168
168
|
}));
|
|
169
|
-
},
|
|
169
|
+
}, S = () => {
|
|
170
170
|
var e;
|
|
171
|
-
u.value && v("closed", n.value),
|
|
172
|
-
},
|
|
171
|
+
u.value && v("closed", n.value), V(-1), u.value = !1, t.preserveSearchTerm || (y.value = ""), (e = m.value) == null || e.blur();
|
|
172
|
+
}, Ee = 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
|
+
}, V = (e) => {
|
|
182
182
|
p.value = e;
|
|
183
|
-
},
|
|
184
|
-
if (e.keyCode ===
|
|
185
|
-
|
|
186
|
-
else if (e.keyCode ===
|
|
183
|
+
}, Te = (e) => {
|
|
184
|
+
if (e.keyCode === x.ESCAPE)
|
|
185
|
+
S();
|
|
186
|
+
else if (e.keyCode === x.DOWN && p.value < R.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
|
+
U(R.value[p.value]);
|
|
192
192
|
else
|
|
193
193
|
return;
|
|
194
|
-
e.preventDefault(),
|
|
195
|
-
},
|
|
196
|
-
|
|
197
|
-
},
|
|
194
|
+
e.preventDefault(), Ee(e);
|
|
195
|
+
}, oe = ue(function() {
|
|
196
|
+
xe();
|
|
197
|
+
}, et.FAST), xe = async function() {
|
|
198
198
|
if (!t.onSearch)
|
|
199
199
|
return;
|
|
200
|
-
const e =
|
|
200
|
+
const e = Qe("search-request-");
|
|
201
201
|
try {
|
|
202
|
-
j.value[e] = !0, await t.onSearch(
|
|
202
|
+
j.value[e] = !0, await t.onSearch(y.value);
|
|
203
203
|
} finally {
|
|
204
204
|
delete j.value[e];
|
|
205
205
|
}
|
|
206
|
-
},
|
|
206
|
+
}, Ce = (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 re(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 Oe(e) {
|
|
229
229
|
const l = e.relatedTarget;
|
|
230
|
-
!
|
|
230
|
+
!re(l) && l && S();
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function Ie(e) {
|
|
233
233
|
const l = e.target;
|
|
234
|
-
|
|
234
|
+
re(l) || S();
|
|
235
235
|
}
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
},
|
|
239
|
-
await Y(),
|
|
236
|
+
const Re = () => {
|
|
237
|
+
V(-1);
|
|
238
|
+
}, ie = async () => {
|
|
239
|
+
await Y(), O.value && m.value && (I.value = I.value === 0 ? m.value.clientHeight : I.value, D.value = O.value.clientHeight), ye();
|
|
240
240
|
};
|
|
241
|
-
return
|
|
242
|
-
if (
|
|
241
|
+
return He(() => {
|
|
242
|
+
if (A.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",
|
|
244
|
+
O.value && se.observe(O.value), window.addEventListener("resize", k), k();
|
|
245
|
+
}), Pe(() => {
|
|
246
|
+
window.removeEventListener("resize", ie), se.disconnect(), k.cancel();
|
|
247
|
+
}), (e, l) => (r(), J(st, Ne(t, {
|
|
248
|
+
class: ["input ll-select stash-select", g(A).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
|
+
}), Ae({ _: 2 }, [
|
|
253
253
|
t.isReadOnly ? {
|
|
254
254
|
name: "default",
|
|
255
|
-
fn:
|
|
256
|
-
f("div",
|
|
255
|
+
fn: T(({ fieldId: a, labelId: o }) => [
|
|
256
|
+
f("div", nt, [
|
|
257
257
|
f("span", {
|
|
258
258
|
id: a,
|
|
259
259
|
"aria-labelledby": o,
|
|
260
260
|
class: "show-empty tw-h-min"
|
|
261
|
-
},
|
|
261
|
+
}, b(_e.value), 9, ot)
|
|
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: Se
|
|
277
277
|
}, [
|
|
278
|
-
(r(!0), d(
|
|
279
|
-
key: `srOnlyOption-${
|
|
280
|
-
selected:
|
|
278
|
+
(r(!0), d(G, null, q(R.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
|
-
},
|
|
283
|
+
}, b(s[t.displayBy] || ""), 9, it))), 128)),
|
|
284
284
|
l[5] || (l[5] = f("option", { value: "" }, null, -1))
|
|
285
|
-
], 40,
|
|
286
|
-
|
|
285
|
+
], 40, rt),
|
|
286
|
+
F((r(), d("div", {
|
|
287
287
|
ref_key: "selectRef",
|
|
288
288
|
ref: Z,
|
|
289
289
|
role: "listbox",
|
|
290
290
|
"aria-hidden": "true",
|
|
291
|
-
class:
|
|
291
|
+
class: M(["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: Te,
|
|
311
|
+
onKeyup: ce(S, ["esc"])
|
|
312
312
|
}, [
|
|
313
313
|
f("div", {
|
|
314
314
|
id: "listbox-" + a,
|
|
@@ -317,147 +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:
|
|
320
|
+
onFocusin: ne,
|
|
321
321
|
onFocusinOnce: l[4] || (l[4] = (s) => le.value = !0),
|
|
322
|
-
onFocusout:
|
|
323
|
-
onKeydown:
|
|
324
|
-
onMouseleave:
|
|
322
|
+
onFocusout: Oe,
|
|
323
|
+
onKeydown: ne,
|
|
324
|
+
onMouseleave: Re
|
|
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 ? $("", !0) : (r(), d("li", {
|
|
332
332
|
key: 0,
|
|
333
|
-
class:
|
|
334
|
-
},
|
|
335
|
-
t.single ? (r(!0), d(
|
|
333
|
+
class: M(["stash-select__placeholder tw-mr-0 tw-pl-1.5", { "tw-truncate": !t.noTruncate }])
|
|
334
|
+
}, b(t.placeholder), 3)),
|
|
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: M(["stash-select__selected tw-mr-0 tw-pl-1.5", { "tw-truncate": !t.noTruncate }])
|
|
338
338
|
}, [
|
|
339
|
-
|
|
340
|
-
|
|
339
|
+
z(e.$slots, "selected", {
|
|
340
|
+
option: s,
|
|
341
|
+
onRemove: () => _(s),
|
|
342
|
+
chipSelectedClass: "stash-select__chip"
|
|
343
|
+
}, () => [
|
|
344
|
+
H(b(s[t.displayBy] || s) + " ", 1),
|
|
341
345
|
f("button", {
|
|
342
346
|
tabindex: "-1",
|
|
343
347
|
class: "stash-select__remove",
|
|
344
|
-
onKeypress:
|
|
345
|
-
onMousedown: P((
|
|
348
|
+
onKeypress: ce(P((w) => _(s), ["prevent"]), ["enter"]),
|
|
349
|
+
onMousedown: P((w) => _(s), ["prevent", "stop"])
|
|
346
350
|
}, [
|
|
347
|
-
|
|
351
|
+
B(N, {
|
|
348
352
|
icon: "close",
|
|
349
353
|
name: "close",
|
|
350
354
|
size: "small"
|
|
351
355
|
})
|
|
352
|
-
], 40,
|
|
356
|
+
], 40, dt)
|
|
353
357
|
], !0)
|
|
354
|
-
], 2))), 128)) : (r(!0), d(
|
|
358
|
+
], 2))), 128)) : (r(!0), d(G, { key: 2 }, q(n.value, (s) => (r(), d("li", {
|
|
355
359
|
key: `chip-${s[t.trackBy]}`,
|
|
356
360
|
class: "tw-inline-block"
|
|
357
361
|
}, [
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
362
|
+
z(e.$slots, "selected", {
|
|
363
|
+
option: s,
|
|
364
|
+
onRemove: () => _(s),
|
|
365
|
+
chipSelectedClass: "stash-select__chip"
|
|
366
|
+
}, () => [
|
|
367
|
+
B(fe, {
|
|
368
|
+
"bg-color": "blue-500",
|
|
369
|
+
"is-removable": "",
|
|
370
|
+
"text-color": "white",
|
|
371
|
+
class: "stash-select__chip",
|
|
372
|
+
onRemove: (w) => _(s)
|
|
373
|
+
}, {
|
|
374
|
+
default: T(() => [
|
|
375
|
+
H(b(s[t.displayBy] || s), 1)
|
|
376
|
+
]),
|
|
377
|
+
_: 2
|
|
378
|
+
}, 1032, ["onRemove"])
|
|
379
|
+
], !0)
|
|
370
380
|
]))), 128))
|
|
371
381
|
], 512),
|
|
372
|
-
|
|
373
|
-
|
|
382
|
+
ge.value ? (r(), d("div", ft, [
|
|
383
|
+
B(fe, {
|
|
374
384
|
"bg-color": "blue-500",
|
|
375
385
|
"is-removable": "",
|
|
376
386
|
"text-color": "white",
|
|
377
387
|
class: "stash-select__chip",
|
|
378
|
-
onRemove:
|
|
388
|
+
onRemove: ke
|
|
379
389
|
}, {
|
|
380
|
-
default:
|
|
381
|
-
|
|
390
|
+
default: T(() => [
|
|
391
|
+
H(b(be.value), 1)
|
|
382
392
|
]),
|
|
383
393
|
_: 1
|
|
384
394
|
})
|
|
385
|
-
])) :
|
|
386
|
-
t.icon ? (r(), J(
|
|
395
|
+
])) : $("", !0),
|
|
396
|
+
t.icon ? (r(), J(N, {
|
|
387
397
|
key: 1,
|
|
388
|
-
class:
|
|
398
|
+
class: M(["stash-select__icon", { "tw-text-ice-500": t.disabled }]),
|
|
389
399
|
"data-test": "stash-select|toggle-icon",
|
|
390
400
|
name: t.icon,
|
|
391
|
-
onMousedown: l[0] || (l[0] = P((s) => u.value &&
|
|
392
|
-
}, null, 8, ["name", "class"])) :
|
|
393
|
-
(r(), J(
|
|
401
|
+
onMousedown: l[0] || (l[0] = P((s) => u.value && S(), ["prevent"]))
|
|
402
|
+
}, null, 8, ["name", "class"])) : $("", !0),
|
|
403
|
+
(r(), J(De, {
|
|
394
404
|
to: t.teleportTo,
|
|
395
405
|
disabled: !t.enableTeleport
|
|
396
406
|
}, [
|
|
397
|
-
|
|
398
|
-
default:
|
|
399
|
-
|
|
407
|
+
B(Le, { name: "fade" }, {
|
|
408
|
+
default: T(() => [
|
|
409
|
+
F(f("div", {
|
|
400
410
|
ref_key: "optionsWrapperRef",
|
|
401
|
-
ref:
|
|
411
|
+
ref: C,
|
|
402
412
|
class: "stash-select__border-selector tw-w-full tw-shadow-2xl",
|
|
403
|
-
style:
|
|
413
|
+
style: Ue(g(me)),
|
|
404
414
|
onClick: l[3] || (l[3] = P(() => {
|
|
405
415
|
}, ["stop"]))
|
|
406
416
|
}, [
|
|
407
|
-
W.value ? (r(), d("div",
|
|
408
|
-
|
|
417
|
+
W.value ? (r(), d("div", pt, [
|
|
418
|
+
F(f("input", {
|
|
409
419
|
ref_key: "searchRef",
|
|
410
420
|
ref: ee,
|
|
411
|
-
"onUpdate:modelValue": l[1] || (l[1] = (s) =>
|
|
421
|
+
"onUpdate:modelValue": l[1] || (l[1] = (s) => y.value = s),
|
|
412
422
|
type: "text",
|
|
413
423
|
autocomplete: "off",
|
|
414
424
|
class: "stash-select__search",
|
|
415
|
-
"data-test":
|
|
425
|
+
"data-test": g(A)["data-test"] ? g(A)["data-test"] + "-search" : "stash-select|search",
|
|
416
426
|
placeholder: t.searchPlaceholder,
|
|
417
427
|
spellcheck: !1,
|
|
418
428
|
onInput: l[2] || (l[2] = //@ts-ignore
|
|
419
|
-
(...s) =>
|
|
420
|
-
}, null, 40,
|
|
421
|
-
[
|
|
429
|
+
(...s) => g(oe) && g(oe)(...s))
|
|
430
|
+
}, null, 40, ht), [
|
|
431
|
+
[Ve, y.value]
|
|
422
432
|
]),
|
|
423
|
-
|
|
433
|
+
B(N, {
|
|
424
434
|
name: "search",
|
|
425
435
|
class: "tw-text-ice-500"
|
|
426
436
|
})
|
|
427
|
-
])) :
|
|
428
|
-
f("ul",
|
|
429
|
-
(r(!0), d(
|
|
437
|
+
])) : $("", !0),
|
|
438
|
+
f("ul", vt, [
|
|
439
|
+
(r(!0), d(G, null, q(R.value, (s, w) => (r(), d("li", {
|
|
430
440
|
key: `option-${s[t.trackBy]}`,
|
|
431
441
|
"data-test": s[t.trackBy],
|
|
432
|
-
class:
|
|
433
|
-
onClick: (
|
|
434
|
-
onMouseenter: P((
|
|
442
|
+
class: M(Ce(s, w)),
|
|
443
|
+
onClick: (Fe) => U(s),
|
|
444
|
+
onMouseenter: P((Fe) => V(w), ["self"])
|
|
435
445
|
}, [
|
|
436
|
-
|
|
437
|
-
|
|
446
|
+
z(e.$slots, "option", { option: s }, () => [
|
|
447
|
+
H(b(s[t.displayBy] || s), 1)
|
|
438
448
|
], !0),
|
|
439
|
-
|
|
440
|
-
|
|
449
|
+
E(s) && !t.hideCheck ? (r(), d("span", yt, [
|
|
450
|
+
B(N, {
|
|
441
451
|
class: "tw-text-blue-500",
|
|
442
452
|
name: "check"
|
|
443
453
|
})
|
|
444
|
-
])) :
|
|
445
|
-
], 42,
|
|
446
|
-
|
|
447
|
-
|
|
454
|
+
])) : $("", !0)
|
|
455
|
+
], 42, mt))), 128)),
|
|
456
|
+
F(f("li", _t, [
|
|
457
|
+
B(N, {
|
|
448
458
|
"data-test": "stash-select|options-loading",
|
|
449
459
|
name: "working",
|
|
450
460
|
class: "tw-animate-spin tw-text-ice-500"
|
|
451
461
|
})
|
|
452
462
|
], 512), [
|
|
453
|
-
[Q, t.loading ||
|
|
463
|
+
[Q, t.loading || ae.value]
|
|
454
464
|
]),
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
l[6] || (l[6] =
|
|
465
|
+
F(f("li", wt, [
|
|
466
|
+
z(e.$slots, "no-options", {}, () => [
|
|
467
|
+
l[6] || (l[6] = H(" No options "))
|
|
458
468
|
], !0)
|
|
459
469
|
], 512), [
|
|
460
|
-
[Q, !t.loading && !
|
|
470
|
+
[Q, !t.loading && !ae.value && !R.value.length]
|
|
461
471
|
])
|
|
462
472
|
])
|
|
463
473
|
], 4), [
|
|
@@ -467,24 +477,24 @@ const lt = { class: "tw-flex tw-h-input tw-items-center tw-text-sm" }, st = ["id
|
|
|
467
477
|
_: 3
|
|
468
478
|
})
|
|
469
479
|
], 8, ["to", "disabled"]))
|
|
470
|
-
], 40,
|
|
471
|
-
], 42,
|
|
472
|
-
[
|
|
480
|
+
], 40, ut)
|
|
481
|
+
], 42, ct)), [
|
|
482
|
+
[g(tt), Ie]
|
|
473
483
|
])
|
|
474
484
|
]),
|
|
475
485
|
key: "1"
|
|
476
486
|
},
|
|
477
|
-
|
|
487
|
+
ve.hint ? {
|
|
478
488
|
name: "hint",
|
|
479
|
-
fn:
|
|
480
|
-
|
|
489
|
+
fn: T(() => [
|
|
490
|
+
z(e.$slots, "hint", {}, void 0, !0)
|
|
481
491
|
]),
|
|
482
492
|
key: "2"
|
|
483
493
|
} : void 0
|
|
484
494
|
]), 1040, ["class", "error-text", "hint-text"]));
|
|
485
495
|
}
|
|
486
|
-
}),
|
|
496
|
+
}), At = /* @__PURE__ */ at(gt, [["__scopeId", "data-v-cb7a2d07"]]);
|
|
487
497
|
export {
|
|
488
|
-
|
|
498
|
+
At as default
|
|
489
499
|
};
|
|
490
500
|
//# sourceMappingURL=Select.js.map
|