@leaflink/stash 53.4.6 → 53.4.8

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 (58) hide show
  1. package/dist/AppSidebar.js +56 -52
  2. package/dist/AppSidebar.js.map +1 -1
  3. package/dist/AppTopbar.js +1 -1
  4. package/dist/Copy.js +1 -1
  5. package/dist/DataViewFilters.js +1 -1
  6. package/dist/DataViewFilters.js.map +1 -1
  7. package/dist/DataViewToolbar.js +139 -125
  8. package/dist/DataViewToolbar.js.map +1 -1
  9. package/dist/DatePicker.js +1114 -1113
  10. package/dist/DatePicker.js.map +1 -1
  11. package/dist/Modal.js +105 -89
  12. package/dist/Modal.js.map +1 -1
  13. package/dist/Modals.js +30 -26
  14. package/dist/Modals.js.map +1 -1
  15. package/dist/MoreActions.js +294 -288
  16. package/dist/MoreActions.js.map +1 -1
  17. package/dist/PageNavigation.js +1 -1
  18. package/dist/RadioGroup.js +69 -62
  19. package/dist/RadioGroup.js.map +1 -1
  20. package/dist/SearchBar.js +27 -25
  21. package/dist/SearchBar.js.map +1 -1
  22. package/dist/Select.js +103 -101
  23. package/dist/Select.js.map +1 -1
  24. package/dist/Stepper.js +1 -1
  25. package/dist/Tab.js +1 -1
  26. package/dist/Table.js +1 -1
  27. package/dist/Tabs.js +2 -2
  28. package/dist/Tabs.vue_vue_type_script_setup_true_lang-DEopbeSY.js +131 -0
  29. package/dist/Tabs.vue_vue_type_script_setup_true_lang-DEopbeSY.js.map +1 -0
  30. package/dist/Thumbnail.js +42 -42
  31. package/dist/Thumbnail.js.map +1 -1
  32. package/dist/ThumbnailGroup.js +24 -22
  33. package/dist/ThumbnailGroup.js.map +1 -1
  34. package/dist/Timeline.js +15 -13
  35. package/dist/Timeline.js.map +1 -1
  36. package/dist/Toast.vue.d.ts +1 -1
  37. package/dist/Tooltip.js +1 -1
  38. package/dist/{Tooltip.vue_vue_type_script_setup_true_lang-CFpM7Ldj.js → Tooltip.vue_vue_type_script_setup_true_lang-UUjw5O1x.js} +2 -2
  39. package/dist/{Tooltip.vue_vue_type_script_setup_true_lang-CFpM7Ldj.js.map → Tooltip.vue_vue_type_script_setup_true_lang-UUjw5O1x.js.map} +1 -1
  40. package/dist/components.css +1 -1
  41. package/dist/getContrastingTextColor.d.ts +8 -0
  42. package/dist/index-t9tXBnql.js +469 -0
  43. package/dist/{index-DA70nQCT.js.map → index-t9tXBnql.js.map} +1 -1
  44. package/dist/templateRefNarrowing-CeANDylX.js +22 -0
  45. package/dist/templateRefNarrowing-CeANDylX.js.map +1 -0
  46. package/dist/useMediaQuery.d.ts +12 -10
  47. package/dist/useMediaQuery.js +7 -29
  48. package/dist/useMediaQuery.js.map +1 -1
  49. package/dist/useSortable.js +1 -1
  50. package/dist/useValidation.d.ts +11 -1
  51. package/dist/useValidation.js +240 -198
  52. package/dist/useValidation.js.map +1 -1
  53. package/dist/utils/getContrastingTextColor.js +36 -24
  54. package/dist/utils/getContrastingTextColor.js.map +1 -1
  55. package/package.json +1 -2
  56. package/dist/Tabs.vue_vue_type_script_setup_true_lang-B3FBaVP5.js +0 -130
  57. package/dist/Tabs.vue_vue_type_script_setup_true_lang-B3FBaVP5.js.map +0 -1
  58. package/dist/index-DA70nQCT.js +0 -424
@@ -1,290 +1,332 @@
1
- import F from "lodash-es/debounce";
2
- import A from "lodash-es/get";
3
- import { toValue as c, computed as v, ref as T, watch as R, reactive as L, nextTick as I, readonly as w } from "vue";
4
- import { DECIMAL_PRECISION as j, DEBOUNCE as q } from "./constants.js";
5
- import { t as h } from "./locale.js";
6
- import { i as f } from "./isDefined-DzVx0B6k.js";
7
- import B from "lodash-es/round";
8
- function D(t) {
9
- return t && t.constructor && typeof t.constructor.isBuffer == "function" && t.constructor.isBuffer(t);
1
+ import k from "lodash-es/debounce";
2
+ import V from "lodash-es/get";
3
+ import { toValue as u, ref as A, reactive as R, computed as v, watch as j, effectScope as U, nextTick as M, readonly as w } from "vue";
4
+ import { DECIMAL_PRECISION as _, DEBOUNCE as B } from "./constants.js";
5
+ import { t as b } from "./locale.js";
6
+ import { i as p } from "./isDefined-DzVx0B6k.js";
7
+ import P from "lodash-es/round";
8
+ function W(e) {
9
+ const t = e.replace(/^\//, ""), r = "data/attributes/";
10
+ if (t.startsWith(r))
11
+ return t.slice(r.length).split("/").filter(Boolean).join(".");
12
+ const s = t.split("/").filter(Boolean);
13
+ return s.length ? s.join(".") : e;
10
14
  }
11
- function M(t) {
12
- return t;
13
- }
14
- function C(t, e) {
15
- e = e || {};
16
- const r = e.delimiter || ".", i = e.maxDepth, a = e.transformKey || M, u = {};
17
- function m(E, S, d) {
18
- d = d || 1, Object.keys(E).forEach(function(x) {
19
- const l = E[x], o = e.safe && Array.isArray(l), g = Object.prototype.toString.call(l), N = D(l), p = g === "[object Object]" || g === "[object Array]", n = S ? S + r + a(x) : a(x);
20
- if (!o && !N && p && Object.keys(l).length && (!e.maxDepth || d < i))
21
- return m(l, n, d + 1);
22
- u[n] = l;
23
- });
24
- }
25
- return m(t), u;
26
- }
27
- function k(t) {
28
- const e = t.replace(/^\//, ""), r = "data/attributes/";
29
- if (e.startsWith(r))
30
- return e.slice(r.length).split("/").filter(Boolean).join(".");
31
- const i = e.split("/").filter(Boolean);
32
- return i[i.length - 1] || t;
33
- }
34
- function U(t) {
15
+ function z(e) {
35
16
  var r;
36
- const e = {};
37
- for (const i of t) {
38
- const a = (r = i.source) == null ? void 0 : r.pointer;
39
- if (!a)
17
+ const t = {};
18
+ for (const s of e) {
19
+ const i = (r = s.source) == null ? void 0 : r.pointer;
20
+ if (!i)
40
21
  continue;
41
- const u = i.detail || i.title || "";
42
- if (!u)
22
+ const a = s.detail || s.title || "";
23
+ if (!a)
43
24
  continue;
44
- const m = k(a);
45
- e[m] = u;
25
+ const g = W(i);
26
+ t[g] = a;
46
27
  }
47
- return e;
28
+ return t;
48
29
  }
49
- function H(t = {}) {
30
+ function ne(e = {}) {
50
31
  return {
51
32
  name: "email",
52
- validator(e) {
53
- return !f(e) || typeof e == "string" && /^\S+@\S+\.\S+$/.test(e);
33
+ validator(t) {
34
+ return !p(t) || typeof t == "string" && /^\S+@\S+\.\S+$/.test(t);
54
35
  },
55
- message: t.message || h("ll.validation.email")
36
+ message: e.message || b("ll.validation.email")
56
37
  };
57
38
  }
58
- function Q(t) {
39
+ function re(e) {
59
40
  return {
60
41
  name: "maxLength",
61
- validator(e) {
62
- const r = c(t.max), i = c(e);
63
- if (!f(i))
42
+ validator(t) {
43
+ const r = u(e.max), s = u(t);
44
+ if (!p(s))
64
45
  return !0;
65
- let a = String(i);
66
- return t.trim && (a = a.trim()), a.length <= r;
46
+ let i = String(s);
47
+ return e.trim && (i = i.trim()), i.length <= r;
67
48
  },
68
- message: t.message || (() => h("ll.validation.maxLength", { max: String(c(t.max)) }))
49
+ message: e.message || (() => b("ll.validation.maxLength", { max: String(u(e.max)) }))
69
50
  };
70
51
  }
71
- function X(t) {
52
+ function se(e) {
72
53
  return {
73
54
  name: "maxValue",
74
- validator(e) {
75
- const r = c(t.max);
76
- return !f(e) || Number(e) <= r;
55
+ validator(t) {
56
+ const r = u(e.max);
57
+ return !p(t) || Number(t) <= r;
77
58
  },
78
- message: t.message || (() => h("ll.validation.maxValue", { max: String(c(t.max)) }))
59
+ message: e.message || (() => b("ll.validation.maxValue", { max: String(u(e.max)) }))
79
60
  };
80
61
  }
81
- function Z(t) {
62
+ function oe(e) {
82
63
  return {
83
64
  name: "minLength",
84
- validator(e) {
85
- const r = c(t.min), i = c(e);
86
- if (!f(i))
65
+ validator(t) {
66
+ const r = u(e.min), s = u(t);
67
+ if (!p(s))
87
68
  return !0;
88
- let a = String(i);
89
- return t.trim && (a = a.trim()), a.length >= r;
69
+ let i = String(s);
70
+ return e.trim && (i = i.trim()), i.length >= r;
90
71
  },
91
- message: t.message || (() => h("ll.validation.minLength", { min: String(c(t.min)) }))
72
+ message: e.message || (() => b("ll.validation.minLength", { min: String(u(e.min)) }))
92
73
  };
93
74
  }
94
- function ee(t) {
75
+ function ie(e) {
95
76
  return {
96
77
  name: "minValue",
97
- validator(e) {
98
- const r = c(t.min);
99
- return !f(e) || Number(e) >= r;
78
+ validator(t) {
79
+ const r = u(e.min);
80
+ return !p(t) || Number(t) >= r;
100
81
  },
101
- message: t.message || (() => h("ll.validation.minValue", { min: String(c(t.min)) }))
82
+ message: e.message || (() => b("ll.validation.minValue", { min: String(u(e.min)) }))
102
83
  };
103
84
  }
104
- function te(t) {
85
+ function ae(e) {
105
86
  return {
106
87
  name: "pattern",
107
- validator(e) {
108
- const r = c(e);
109
- return !f(r) || t.regex.test(String(r));
88
+ validator(t) {
89
+ const r = u(t);
90
+ return !p(r) || e.regex.test(String(r));
110
91
  },
111
92
  message: () => {
112
- if (typeof t.message != "string" || !t.message.trim())
93
+ if (typeof e.message != "string" || !e.message.trim())
113
94
  throw new Error(
114
95
  'The "pattern" ruleFactory requires a custom message informing the user of the required pattern.'
115
96
  );
116
- return t.message;
97
+ return e.message;
117
98
  }
118
99
  };
119
100
  }
120
- function re(t = {}) {
101
+ function ue(e = {}) {
121
102
  return {
122
103
  name: "positiveNumber",
123
- validator(e) {
124
- return !f(e) || Number(e) > 0;
104
+ validator(t) {
105
+ return !p(t) || Number(t) > 0;
125
106
  },
126
- message: t.message || h("ll.validation.positiveNumber")
107
+ message: e.message || b("ll.validation.positiveNumber")
127
108
  };
128
109
  }
129
- function ne(t = {}) {
110
+ function ce(e = {}) {
130
111
  return {
131
112
  name: "price",
132
- validator(e) {
133
- const r = Number(e);
134
- return !f(e) || r !== 1 / 0 && r >= 0 && r === B(r, j.CURRENCY);
113
+ validator(t) {
114
+ const r = Number(t);
115
+ return !p(t) || r !== 1 / 0 && r >= 0 && r === P(r, _.CURRENCY);
135
116
  },
136
- message: t.message || h("ll.validation.price")
117
+ message: e.message || b("ll.validation.price")
137
118
  };
138
119
  }
139
- function se(t = {}) {
120
+ function le(e = {}) {
140
121
  return {
141
122
  name: "required",
142
- validator(e) {
143
- return f(typeof e == "string" ? e.trim() : e);
123
+ validator(t) {
124
+ return p(typeof t == "string" ? t.trim() : t);
144
125
  },
145
- message: t.message || h("ll.validation.required")
126
+ message: e.message || b("ll.validation.required")
146
127
  };
147
128
  }
148
- function ae(t = {}) {
129
+ function me(e = {}) {
149
130
  return {
150
131
  name: "wholeNumber",
151
- validator(e) {
152
- return !f(e) || Number.isInteger(Number(e)) && Number(e) >= 0;
132
+ validator(t) {
133
+ return !p(t) || Number.isInteger(Number(t)) && Number(t) >= 0;
153
134
  },
154
- message: t.message || h("ll.validation.wholeNumber")
135
+ message: e.message || b("ll.validation.wholeNumber")
155
136
  };
156
137
  }
157
- const _ = "api";
158
- function ie({
159
- rules: t,
160
- values: e
138
+ const J = "api";
139
+ function $(e) {
140
+ return typeof e != "object" || e === null || !("validator" in e) ? !1 : typeof Reflect.get(e, "validator") == "function";
141
+ }
142
+ function Y(e) {
143
+ return Array.isArray(e) && e.every($);
144
+ }
145
+ function I(e, t = "") {
146
+ if (e === null || typeof e != "object")
147
+ return [];
148
+ if (Array.isArray(e)) {
149
+ if (e.length === 0)
150
+ return t ? [t] : [];
151
+ const s = e[0];
152
+ if ($(s))
153
+ return t ? [t] : [];
154
+ const i = [];
155
+ for (let a = 0; a < e.length; a++) {
156
+ const g = t === "" ? String(a) : `${t}.${a}`;
157
+ i.push(...I(e[a], g));
158
+ }
159
+ return i;
160
+ }
161
+ const r = [];
162
+ for (const s of Object.keys(e)) {
163
+ const i = e[s], a = t === "" ? s : `${t}.${s}`;
164
+ r.push(...I(i, a));
165
+ }
166
+ return r;
167
+ }
168
+ function fe({
169
+ rules: e,
170
+ values: t
161
171
  }) {
162
- const r = v(() => Object.keys(C(t, { safe: !0 }))), i = T({}), a = r.value.reduce(
163
- (n, s) => {
164
- const V = T(A(c(e), s)), y = (O) => {
165
- V.value = A(c(e), O);
166
- }, b = F(() => {
167
- y(s);
168
- }, q.FAST);
169
- return R(
170
- () => A(c(e), s),
171
- () => {
172
- b();
173
- }
174
- ), n[s] = K({
175
- fieldName: s,
176
- fieldValue: V,
172
+ const r = A({}), s = R({}), i = /* @__PURE__ */ new Map(), a = v(() => I(u(e)).sort());
173
+ function g(n) {
174
+ const o = i.get(n);
175
+ if (o && (o.cancelDebounced(), o.stop(), o.stopFieldScope(), i.delete(n)), s[n] && delete s[n], r.value[n]) {
176
+ const m = { ...r.value };
177
+ delete m[n], r.value = m;
178
+ }
179
+ }
180
+ function F(n) {
181
+ if (s[n])
182
+ return;
183
+ const o = A(V(u(t), n)), m = () => {
184
+ o.value = V(u(t), n);
185
+ }, f = k(() => {
186
+ m();
187
+ }, B.FAST), d = j(
188
+ () => V(u(t), n),
189
+ () => {
190
+ f();
191
+ }
192
+ ), h = U(), D = h.run(
193
+ () => G({
194
+ fieldName: n,
195
+ fieldValue: o,
177
196
  flush: () => {
178
- b.cancel(), y(s);
197
+ f.cancel(), m();
179
198
  },
180
- getApiError: () => i.value[s] || "",
181
- rules: A(t, s)
182
- }), n;
199
+ getApiError: () => r.value[n] || "",
200
+ getRules: () => {
201
+ const N = V(u(e), n);
202
+ return Y(N) ? N : [];
203
+ }
204
+ })
205
+ );
206
+ if (!D) {
207
+ d(), f.cancel(), h.stop();
208
+ return;
209
+ }
210
+ i.set(n, {
211
+ stop: d,
212
+ cancelDebounced: () => f.cancel(),
213
+ stopFieldScope: () => h.stop()
214
+ }), s[n] = D;
215
+ }
216
+ j(
217
+ a,
218
+ (n, o) => {
219
+ const m = o ?? [], f = new Set(n), d = new Set(m);
220
+ for (const h of m)
221
+ f.has(h) || g(h);
222
+ for (const h of n)
223
+ d.has(h) || F(h);
183
224
  },
184
- {}
185
- ), u = v(() => Object.values(a)), m = v(() => u.value.some((n) => n.errors.length > 0)), E = v(() => u.value.some((n) => n.isTouched)), S = v(() => u.value.filter((n) => n.isDirty)), d = async function({ preventScroll: n } = {}) {
186
- if (u.value.forEach((s) => {
187
- s.setTouched(!1), s.setTouched(!0);
188
- }), await I(), m.value && !n) {
189
- const s = Object.entries(a).find(([, b]) => b.errorMessage), V = (s == null ? void 0 : s[0]) || "", y = document == null ? void 0 : document.querySelector(`[name=${V}]`);
190
- y && y.scrollIntoView({ behavior: "smooth" });
225
+ { immediate: !0 }
226
+ );
227
+ const y = v(() => Object.values(s)), S = v(() => y.value.some((n) => n.errors.length > 0)), T = v(() => y.value.some((n) => n.isTouched)), x = v(() => y.value.filter((n) => n.isDirty)), c = async function({ preventScroll: n } = {}) {
228
+ if (y.value.forEach((o) => {
229
+ o.setTouched(!1), o.setTouched(!0);
230
+ }), await M(), S.value && !n) {
231
+ const o = Object.entries(s).find(([, d]) => d.errorMessage), m = (o == null ? void 0 : o[0]) || "", f = document == null ? void 0 : document.querySelector(`[name="${m}"]`);
232
+ f && f.scrollIntoView({ behavior: "smooth" });
191
233
  }
192
- return !m.value;
193
- }, x = function(n) {
194
- var s;
195
- return ((s = a[n]) == null ? void 0 : s.errorMessage) || "";
234
+ return !S.value;
196
235
  }, l = function(n) {
197
- if (!a[n])
236
+ var o;
237
+ return ((o = s[n]) == null ? void 0 : o.errorMessage) || "";
238
+ }, L = function(n) {
239
+ if (!s[n])
198
240
  throw new Error(`In touch: fieldName "${n}" does not exist in the validation fields.`);
199
- a[n].setTouched();
200
- }, o = async function() {
201
- await I(), u.value.forEach((n) => {
241
+ s[n].setTouched();
242
+ }, E = async function() {
243
+ await M(), y.value.forEach((n) => {
202
244
  n.setTouched(!1);
203
245
  });
204
- }, g = function(n) {
205
- u.value.forEach((s) => {
206
- s.setInitialValue(n[s.name]);
246
+ }, q = function(n) {
247
+ y.value.forEach((o) => {
248
+ o.setInitialValue(V(n, o.name));
207
249
  });
208
250
  };
209
- function N(n) {
210
- const s = U(n), V = r.value, y = {};
211
- for (const b of V)
212
- s[b] && (y[b] = s[b]);
213
- i.value = y;
251
+ function C(n) {
252
+ const o = z(n), m = a.value, f = {};
253
+ for (const d of m)
254
+ o[d] && (f[d] = o[d]);
255
+ r.value = f;
214
256
  }
215
- function p(n) {
257
+ function O(n) {
216
258
  if (n) {
217
- const s = { ...i.value };
218
- delete s[n], i.value = s;
259
+ const o = { ...r.value };
260
+ delete o[n], r.value = o;
219
261
  } else
220
- i.value = {};
262
+ r.value = {};
221
263
  }
222
- return L({
223
- validate: d,
224
- getError: x,
225
- touch: l,
226
- setAllUntouched: o,
227
- setInitialValues: g,
228
- setApiErrors: N,
229
- clearApiErrors: p,
230
- fields: a,
231
- dirtyFields: S,
232
- hasErrors: m,
233
- someTouched: E
264
+ return R({
265
+ validate: c,
266
+ getError: l,
267
+ touch: L,
268
+ setAllUntouched: E,
269
+ setInitialValues: q,
270
+ setApiErrors: C,
271
+ clearApiErrors: O,
272
+ fields: s,
273
+ dirtyFields: x,
274
+ hasErrors: S,
275
+ someTouched: T
234
276
  });
235
277
  }
236
- function K({
237
- fieldName: t,
238
- fieldValue: e,
239
- rules: r,
240
- flush: i,
241
- getApiError: a
278
+ function G({
279
+ fieldName: e,
280
+ fieldValue: t,
281
+ getRules: r,
282
+ flush: s,
283
+ getApiError: i
242
284
  }) {
243
- const u = T(e.value), m = T(!1), E = v(() => (e.value ?? "") !== (u.value ?? "")), S = v(() => m.value ? r.map((o) => ({
244
- fieldName: t,
245
- ruleName: o.name,
246
- isValid: o.validator(e.value),
247
- message: typeof o.message == "function" ? o.message(e.value) : o.message
248
- })) : []), d = v(() => {
249
- const o = a(), g = o !== "" ? [{ ruleName: _, message: o }] : [], N = S.value.filter((p) => !p.isValid).map((p) => ({
250
- ruleName: p.ruleName,
251
- message: p.message
285
+ const a = A(t.value), g = A(!1), F = v(() => (t.value ?? "") !== (a.value ?? "")), y = v(() => g.value ? r().map((l) => ({
286
+ fieldName: e,
287
+ ruleName: l.name,
288
+ isValid: l.validator(t.value),
289
+ message: typeof l.message == "function" ? l.message(t.value) : l.message
290
+ })) : []), S = v(() => {
291
+ const c = i(), l = c !== "" ? [{ ruleName: J, message: c }] : [], L = y.value.filter((E) => !E.isValid).map((E) => ({
292
+ ruleName: E.ruleName,
293
+ message: E.message
252
294
  }));
253
- return [...g, ...N];
295
+ return [...l, ...L];
254
296
  });
255
- function x(o = !0) {
256
- i(), m.value = o;
297
+ function T(c = !0) {
298
+ s(), g.value = c;
257
299
  }
258
- function l(o) {
259
- u.value = o;
300
+ function x(c) {
301
+ a.value = c;
260
302
  }
261
- return L({
262
- name: t,
263
- currentValue: w(e),
264
- initialValue: w(u),
265
- isTouched: w(m),
266
- isDirty: w(E),
303
+ return R({
304
+ name: e,
305
+ currentValue: w(t),
306
+ initialValue: w(a),
307
+ isTouched: w(g),
308
+ isDirty: w(F),
267
309
  errorMessage: v(() => {
268
- var o, g;
269
- return ((g = (o = d.value) == null ? void 0 : o[0]) == null ? void 0 : g.message) || "";
310
+ var c, l;
311
+ return ((l = (c = S.value) == null ? void 0 : c[0]) == null ? void 0 : l.message) || "";
270
312
  }),
271
- errors: d,
272
- setInitialValue: l,
273
- setTouched: x
313
+ errors: S,
314
+ setInitialValue: x,
315
+ setTouched: T
274
316
  });
275
317
  }
276
318
  export {
277
- ie as default,
278
- H as email,
279
- f as isDefined,
280
- Q as maxLength,
281
- X as maxValue,
282
- Z as minLength,
283
- ee as minValue,
284
- te as pattern,
285
- re as positiveNumber,
286
- ne as price,
287
- se as required,
288
- ae as wholeNumber
319
+ fe as default,
320
+ ne as email,
321
+ p as isDefined,
322
+ re as maxLength,
323
+ se as maxValue,
324
+ oe as minLength,
325
+ ie as minValue,
326
+ ae as pattern,
327
+ ue as positiveNumber,
328
+ ce as price,
329
+ le as required,
330
+ me as wholeNumber
289
331
  };
290
332
  //# sourceMappingURL=useValidation.js.map