@leaflink/stash 50.0.5 → 50.0.6

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