@leaflink/stash 42.1.0 → 42.2.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/Select.js CHANGED
@@ -1,4 +1,4 @@
1
- import { computed as B, unref as F, ref as k, shallowRef as bt, watch as Q, getCurrentScope as xt, onScopeDispose as _t, shallowReadonly as oe, defineComponent as Et, useAttrs as St, useSlots as Ct, nextTick as Ne, onMounted as Rt, onUnmounted as Ot, openBlock as T, createBlock as Re, normalizeClass as ue, createSlots as kt, withCtx as fe, createElementVNode as z, createElementBlock as I, Fragment as Oe, renderList as ke, toDisplayString as le, withDirectives as de, withKeys as je, createCommentVNode as pe, renderSlot as Be, createTextVNode as me, withModifiers as he, createVNode as se, Teleport as Bt, Transition as Tt, normalizeStyle as At, vModelText as Lt, vShow as Ve, pushScopeId as Mt, popScopeId as Dt } from "vue";
1
+ import { computed as T, unref as F, ref as k, shallowRef as bt, watch as Q, getCurrentScope as xt, onScopeDispose as _t, shallowReadonly as oe, defineComponent as Et, useAttrs as St, useSlots as Ct, nextTick as Ne, onMounted as Rt, onUnmounted as Ot, openBlock as B, createBlock as Re, normalizeClass as ue, createSlots as kt, withCtx as fe, createElementVNode as z, createElementBlock as I, Fragment as Oe, renderList as ke, toDisplayString as le, withDirectives as de, withKeys as je, createCommentVNode as pe, renderSlot as Te, createTextVNode as me, withModifiers as he, createVNode as se, Teleport as Tt, Transition as Bt, normalizeStyle as At, vModelText as Lt, vShow as Ve, pushScopeId as Mt, popScopeId as Dt } from "vue";
2
2
  import { d as Ft } from "./debounce-6aca1ca9.js";
3
3
  import { i as Pt } from "./isEmpty-2fbad344.js";
4
4
  import { i as qe } from "./isEqual-fca467fb.js";
@@ -34,7 +34,7 @@ import "./Icon.vue_used_vue_type_style_index_0_lang.module-d2507af3.js";
34
34
  import "./index-79ce320f.js";
35
35
  import "./Label.vue_vue_type_script_setup_true_lang-1d29d98a.js";
36
36
  import "./locale.js";
37
- const ge = Math.min, N = Math.max, Ae = Math.round, Te = Math.floor, X = (e) => ({
37
+ const ge = Math.min, N = Math.max, Ae = Math.round, Be = Math.floor, X = (e) => ({
38
38
  x: e,
39
39
  y: e
40
40
  }), Ut = {
@@ -801,7 +801,7 @@ function _n(e, n) {
801
801
  } = e.getBoundingClientRect();
802
802
  if (c || n(), !h || !g)
803
803
  return;
804
- const d = Te(p), f = Te(l.clientWidth - (u + h)), b = Te(l.clientHeight - (p + g)), _ = Te(u), y = {
804
+ const d = Be(p), f = Be(l.clientWidth - (u + h)), b = Be(l.clientHeight - (p + g)), _ = Be(u), y = {
805
805
  rootMargin: -d + "px " + -f + "px " + -b + "px " + -_ + "px",
806
806
  threshold: N(0, ge(1, r)) || 1
807
807
  };
@@ -890,19 +890,19 @@ function et(e, n) {
890
890
  }
891
891
  function Cn(e, n, t) {
892
892
  t === void 0 && (t = {});
893
- const o = t.whileElementsMounted, l = B(() => {
893
+ const o = t.whileElementsMounted, l = T(() => {
894
894
  var x;
895
895
  return (x = F(t.open)) != null ? x : !0;
896
- }), s = B(() => F(t.middleware)), i = B(() => {
896
+ }), s = T(() => F(t.middleware)), i = T(() => {
897
897
  var x;
898
898
  return (x = F(t.placement)) != null ? x : "bottom";
899
- }), c = B(() => {
899
+ }), c = T(() => {
900
900
  var x;
901
901
  return (x = F(t.strategy)) != null ? x : "absolute";
902
- }), r = B(() => {
902
+ }), r = T(() => {
903
903
  var x;
904
904
  return (x = F(t.transform)) != null ? x : !0;
905
- }), u = B(() => Ze(e.value)), p = B(() => Ze(n.value)), h = k(0), g = k(0), d = k(c.value), f = k(i.value), b = bt({}), _ = k(!1), v = B(() => {
905
+ }), u = T(() => Ze(e.value)), p = T(() => Ze(n.value)), h = k(0), g = k(0), d = k(c.value), f = k(i.value), b = bt({}), _ = k(!1), v = T(() => {
906
906
  const x = {
907
907
  position: d.value,
908
908
  left: "0",
@@ -966,7 +966,7 @@ function Cn(e, n, t) {
966
966
  update: E
967
967
  };
968
968
  }
969
- const Rn = (e) => (Mt("data-v-e1beefda"), e = e(), Dt(), e), On = ["id", "aria-errormessage", "aria-invalid", "disabled", "multiple", "name"], kn = ["selected", "value"], Bn = /* @__PURE__ */ Rn(() => /* @__PURE__ */ z("option", { value: "" }, null, -1)), Tn = ["aria-controls", "aria-expanded", "aria-label", "aria-disabled", "onKeyup"], An = ["id"], Ln = ["onKeypress", "onMousedown"], Mn = {
969
+ const Rn = (e) => (Mt("data-v-7e8a1bc4"), e = e(), Dt(), e), On = ["id", "aria-errormessage", "aria-invalid", "disabled", "multiple", "name"], kn = ["selected", "value"], Tn = /* @__PURE__ */ Rn(() => /* @__PURE__ */ z("option", { value: "" }, null, -1)), Bn = ["aria-controls", "aria-expanded", "aria-label", "aria-disabled", "onKeyup"], An = ["id"], Ln = ["onKeypress", "onMousedown"], Mn = {
970
970
  key: 0,
971
971
  class: "stash-select__total"
972
972
  }, Dn = {
@@ -986,7 +986,9 @@ const Rn = (e) => (Mt("data-v-e1beefda"), e = e(), Dt(), e), On = ["id", "aria-e
986
986
  searchBy: { default: () => [] },
987
987
  trackBy: { default: "id" },
988
988
  placeholder: { default: "Select option" },
989
+ errorText: { default: "" },
989
990
  error: { default: "" },
991
+ hintText: { default: "" },
990
992
  hint: { default: "" },
991
993
  icon: { type: [String, Boolean], default: "caret-down" },
992
994
  name: { default: void 0 },
@@ -1032,12 +1034,12 @@ const Rn = (e) => (Mt("data-v-e1beefda"), e = e(), Dt(), e), On = ["id", "aria-e
1032
1034
  }
1033
1035
  })
1034
1036
  ]
1035
- }), O = B(() => !t.hideSearch && t.searchable !== "false" && t.searchable !== !1), x = B(() => {
1037
+ }), O = T(() => !t.hideSearch && t.searchable !== "false" && t.searchable !== !1), x = T(() => {
1036
1038
  let a = (R.value && t.lazy ? t.lazy() : t.options).filter(Boolean);
1037
1039
  return It(a[0]) || (a = a.map((m, S) => ({ name: m, id: S }))), a;
1038
- }), M = B(() => t.searchLoading || Object.keys(E.value).length > 0), D = B(() => t.disableFiltering || !(_.value || "").trim() ? x.value : b.value(_.value)), xe = B(() => g.value <= d.value), _e = B(
1040
+ }), M = T(() => t.searchLoading || Object.keys(E.value).length > 0), D = T(() => t.disableFiltering || !(_.value || "").trim() ? x.value : b.value(_.value)), xe = T(() => g.value <= d.value), _e = T(
1039
1041
  () => !y.value && !t.single && !xe.value && f.value.length
1040
- ), K = B(() => [f.value.length, t.selectItemType, "selected"].filter(Boolean).join(" ")), Ee = B(() => t.preventEmpty || t.allowEmpty === "false" || t.allowEmpty === !1);
1042
+ ), K = T(() => [f.value.length, t.selectItemType, "selected"].filter(Boolean).join(" ")), Ee = T(() => t.preventEmpty || t.allowEmpty === "false" || t.allowEmpty === !1);
1041
1043
  Q(_, (a, m) => m !== a && Ce(-1)), Q(f, () => ce(), { deep: !0 }), Q(
1042
1044
  () => t.modelValue,
1043
1045
  (a) => {
@@ -1057,7 +1059,7 @@ const Rn = (e) => (Mt("data-v-e1beefda"), e = e(), Dt(), e), On = ["id", "aria-e
1057
1059
  () => t.options,
1058
1060
  () => {
1059
1061
  const { searchFor: a } = Vt({
1060
- items: B(() => x.value),
1062
+ items: T(() => x.value),
1061
1063
  fieldNames: t.searchBy.length ? t.searchBy : [t.displayBy],
1062
1064
  trackBy: t.trackBy
1063
1065
  });
@@ -1183,13 +1185,13 @@ const Rn = (e) => (Mt("data-v-e1beefda"), e = e(), Dt(), e), On = ["id", "aria-e
1183
1185
  window.addEventListener("resize", ce), ce();
1184
1186
  }), Ot(() => {
1185
1187
  window.removeEventListener("resize", ce);
1186
- }), (a, m) => (T(), Re(Wt, {
1188
+ }), (a, m) => (B(), Re(Wt, {
1187
1189
  id: t.id,
1188
1190
  class: ue(["input ll-select stash-select", F(s).class]),
1189
1191
  "data-test": "stash-select",
1190
1192
  "add-bottom-space": t.addBottomSpace,
1191
- "error-text": t.error,
1192
- "hint-text": t.hint,
1193
+ "error-text": t.errorText || t.error,
1194
+ "hint-text": t.hintText || t.hint,
1193
1195
  label: t.label,
1194
1196
  "show-optional-in-label": t.showOptionalInLabel
1195
1197
  }, kt({
@@ -1204,14 +1206,14 @@ const Rn = (e) => (Mt("data-v-e1beefda"), e = e(), Dt(), e), On = ["id", "aria-e
1204
1206
  name: t.name,
1205
1207
  onChange: q
1206
1208
  }, [
1207
- (T(!0), I(Oe, null, ke(D.value, (w, J) => (T(), I("option", {
1209
+ (B(!0), I(Oe, null, ke(D.value, (w, J) => (B(), I("option", {
1208
1210
  key: `srOnlyOption-${J}`,
1209
1211
  selected: ne(w),
1210
1212
  value: w[t.trackBy]
1211
1213
  }, le(w[t.displayBy] || ""), 9, kn))), 128)),
1212
- Bn
1214
+ Tn
1213
1215
  ], 40, On),
1214
- de((T(), I("div", {
1216
+ de((B(), I("div", {
1215
1217
  ref_key: "selectRef",
1216
1218
  ref: c,
1217
1219
  role: "listbox",
@@ -1219,7 +1221,7 @@ const Rn = (e) => (Mt("data-v-e1beefda"), e = e(), Dt(), e), On = ["id", "aria-e
1219
1221
  class: ue(["stash-select__content-wrapper", [
1220
1222
  {
1221
1223
  "stash-select--disabled": !!t.disabled,
1222
- "stash-select--error": !!t.error,
1224
+ "stash-select--error": !!(t.errorText || t.error),
1223
1225
  "stash-select--active": y.value,
1224
1226
  "stash-select--single": t.single
1225
1227
  },
@@ -1254,15 +1256,15 @@ const Rn = (e) => (Mt("data-v-e1beefda"), e = e(), Dt(), e), On = ["id", "aria-e
1254
1256
  ref: p,
1255
1257
  class: "stash-select__chips tw-pr-9"
1256
1258
  }, [
1257
- f.value.length ? pe("", !0) : (T(), I("li", {
1259
+ f.value.length ? pe("", !0) : (B(), I("li", {
1258
1260
  key: 0,
1259
1261
  class: ue(["stash-select__placeholder tw-pl-1.5 tw-mr-0", { "tw-truncate": !t.noTruncate }])
1260
1262
  }, le(t.placeholder), 3)),
1261
- t.single ? (T(!0), I(Oe, { key: 1 }, ke(f.value, (w) => (T(), I("li", {
1263
+ t.single ? (B(!0), I(Oe, { key: 1 }, ke(f.value, (w) => (B(), I("li", {
1262
1264
  key: `chip-${w[t.trackBy]}`,
1263
1265
  class: ue(["stash-select__selected tw-pl-1.5 tw-mr-0", { "tw-truncate": !t.noTruncate }])
1264
1266
  }, [
1265
- Be(a.$slots, "selected", { option: w }, () => [
1267
+ Te(a.$slots, "selected", { option: w }, () => [
1266
1268
  me(le(w[t.displayBy] || w) + " ", 1),
1267
1269
  z("button", {
1268
1270
  tabindex: "-1",
@@ -1277,7 +1279,7 @@ const Rn = (e) => (Mt("data-v-e1beefda"), e = e(), Dt(), e), On = ["id", "aria-e
1277
1279
  })
1278
1280
  ], 40, Ln)
1279
1281
  ], !0)
1280
- ], 2))), 128)) : (T(!0), I(Oe, { key: 2 }, ke(f.value, (w) => (T(), I("li", {
1282
+ ], 2))), 128)) : (B(!0), I(Oe, { key: 2 }, ke(f.value, (w) => (B(), I("li", {
1281
1283
  key: `chip-${w[t.trackBy]}`,
1282
1284
  class: "tw-inline-block"
1283
1285
  }, [
@@ -1295,7 +1297,7 @@ const Rn = (e) => (Mt("data-v-e1beefda"), e = e(), Dt(), e), On = ["id", "aria-e
1295
1297
  }, 1032, ["onRemove"])
1296
1298
  ]))), 128))
1297
1299
  ], 512),
1298
- _e.value ? (T(), I("div", Mn, [
1300
+ _e.value ? (B(), I("div", Mn, [
1299
1301
  se(Xe, {
1300
1302
  "bg-color": "blue",
1301
1303
  "is-removable": "",
@@ -1309,18 +1311,18 @@ const Rn = (e) => (Mt("data-v-e1beefda"), e = e(), Dt(), e), On = ["id", "aria-e
1309
1311
  _: 1
1310
1312
  })
1311
1313
  ])) : pe("", !0),
1312
- t.icon ? (T(), Re(ve, {
1314
+ t.icon ? (B(), Re(ve, {
1313
1315
  key: 1,
1314
1316
  class: "stash-select__icon",
1315
1317
  "data-test": "stash-select|toggle-icon",
1316
1318
  name: t.icon,
1317
1319
  onMousedown: m[0] || (m[0] = he((w) => y.value && te(), ["prevent"]))
1318
1320
  }, null, 8, ["name"])) : pe("", !0),
1319
- (T(), Re(Bt, {
1321
+ (B(), Re(Tt, {
1320
1322
  to: t.teleportTo,
1321
1323
  disabled: !t.enableTeleport
1322
1324
  }, [
1323
- se(Tt, { name: "fade" }, {
1325
+ se(Bt, { name: "fade" }, {
1324
1326
  default: fe(() => [
1325
1327
  de(z("div", {
1326
1328
  ref_key: "optionsWrapperRef",
@@ -1330,7 +1332,7 @@ const Rn = (e) => (Mt("data-v-e1beefda"), e = e(), Dt(), e), On = ["id", "aria-e
1330
1332
  onClick: m[3] || (m[3] = he(() => {
1331
1333
  }, ["stop"]))
1332
1334
  }, [
1333
- O.value ? (T(), I("div", Dn, [
1335
+ O.value ? (B(), I("div", Dn, [
1334
1336
  de(z("input", {
1335
1337
  ref_key: "searchRef",
1336
1338
  ref: h,
@@ -1352,17 +1354,17 @@ const Rn = (e) => (Mt("data-v-e1beefda"), e = e(), Dt(), e), On = ["id", "aria-e
1352
1354
  })
1353
1355
  ])) : pe("", !0),
1354
1356
  z("ul", Pn, [
1355
- (T(!0), I(Oe, null, ke(D.value, (w, J) => (T(), I("li", {
1357
+ (B(!0), I(Oe, null, ke(D.value, (w, J) => (B(), I("li", {
1356
1358
  key: `option-${w[t.trackBy]}`,
1357
1359
  "data-test": w[t.trackBy],
1358
1360
  class: ue(ht(w, J)),
1359
1361
  onClick: (wt) => $(w),
1360
1362
  onMouseenter: he((wt) => Ce(J), ["self"])
1361
1363
  }, [
1362
- Be(a.$slots, "option", { option: w }, () => [
1364
+ Te(a.$slots, "option", { option: w }, () => [
1363
1365
  me(le(w[t.displayBy] || w), 1)
1364
1366
  ], !0),
1365
- ne(w) && !t.hideCheck ? (T(), Re(ve, {
1367
+ ne(w) && !t.hideCheck ? (B(), Re(ve, {
1366
1368
  key: 0,
1367
1369
  class: "tw-text-blue tw-ml-auto",
1368
1370
  name: "check"
@@ -1378,7 +1380,7 @@ const Rn = (e) => (Mt("data-v-e1beefda"), e = e(), Dt(), e), On = ["id", "aria-e
1378
1380
  [Ve, t.loading || M.value]
1379
1381
  ]),
1380
1382
  de(z("li", Vn, [
1381
- Be(a.$slots, "no-options", {}, () => [
1383
+ Te(a.$slots, "no-options", {}, () => [
1382
1384
  me(" No options ")
1383
1385
  ], !0)
1384
1386
  ], 512), [
@@ -1393,7 +1395,7 @@ const Rn = (e) => (Mt("data-v-e1beefda"), e = e(), Dt(), e), On = ["id", "aria-e
1393
1395
  })
1394
1396
  ], 8, ["to", "disabled"]))
1395
1397
  ], 40, An)
1396
- ], 42, Tn)), [
1398
+ ], 42, Bn)), [
1397
1399
  [F(Ht), gt]
1398
1400
  ])
1399
1401
  ]),
@@ -1402,14 +1404,14 @@ const Rn = (e) => (Mt("data-v-e1beefda"), e = e(), Dt(), e), On = ["id", "aria-e
1402
1404
  F(i).hint ? {
1403
1405
  name: "hint",
1404
1406
  fn: fe(() => [
1405
- Be(a.$slots, "hint", {}, void 0, !0)
1407
+ Te(a.$slots, "hint", {}, void 0, !0)
1406
1408
  ]),
1407
1409
  key: "0"
1408
1410
  } : void 0
1409
1411
  ]), 1032, ["id", "add-bottom-space", "class", "error-text", "hint-text", "label", "show-optional-in-label"]));
1410
1412
  }
1411
1413
  });
1412
- const So = /* @__PURE__ */ Kt($n, [["__scopeId", "data-v-e1beefda"]]);
1414
+ const So = /* @__PURE__ */ Kt($n, [["__scopeId", "data-v-7e8a1bc4"]]);
1413
1415
  export {
1414
1416
  So as default
1415
1417
  };