@leaflink/stash 50.0.5 → 50.0.7

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