@signal24/vue-foundation 4.6.0 → 4.6.1

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.
@@ -4,7 +4,7 @@ import type { OverlayAnchorOptions } from './overlay-types';
4
4
  interface OverlayOptions {
5
5
  anchor?: OverlayAnchorOptions;
6
6
  }
7
- interface OverlayInjection<C extends OverlayComponent> {
7
+ export interface OverlayInjection<C extends OverlayComponent> {
8
8
  id: string;
9
9
  component: OverlayComponentUnwrapped<C>;
10
10
  props: OverlayComponentProps<C>;
@@ -1,11 +1,11 @@
1
1
  var Ve = Object.defineProperty;
2
2
  var Fe = (e, t, n) => t in e ? Ve(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var v = (e, t, n) => (Fe(e, typeof t != "symbol" ? t + "" : t, n), n);
4
- import { defineComponent as S, defineProps as Ne, defineEmits as Re, ref as T, computed as K, openBlock as d, createElementBlock as u, createElementVNode as E, toDisplayString as x, withDirectives as U, createCommentVNode as O, Fragment as j, renderList as Q, vModelSelect as Ke, getCurrentInstance as J, onMounted as C, normalizeClass as w, normalizeStyle as Ue, withModifiers as ee, renderSlot as R, reactive as je, h as W, Teleport as We, markRaw as Pe, onBeforeUnmount as te, resolveDirective as Te, createBlock as ke, createSlots as qe, withCtx as X, createTextVNode as ae, vModelText as ze, watch as ce, onActivated as Se, onDeactivated as xe } from "vue";
4
+ import { defineComponent as S, defineProps as Ne, defineEmits as Re, ref as T, computed as K, openBlock as d, createElementBlock as u, createElementVNode as E, toDisplayString as x, withDirectives as U, createCommentVNode as O, Fragment as j, renderList as J, vModelSelect as Ke, getCurrentInstance as ee, onMounted as C, normalizeClass as w, normalizeStyle as Ue, withModifiers as te, renderSlot as R, reactive as je, h as W, Teleport as We, markRaw as Pe, onBeforeUnmount as ne, resolveDirective as Te, createBlock as ke, createSlots as qe, withCtx as Y, createTextVNode as ae, vModelText as ze, watch as ce, onActivated as Se, onDeactivated as xe } from "vue";
5
5
  import { debounce as Xe, isEqual as Ce, upperFirst as Ye, startCase as Ze, cloneDeep as Ge, remove as Qe } from "lodash";
6
6
  import { escapeHtml as Je } from "@vue/shared";
7
7
  import { escapeHtml as ss } from "@vue/shared";
8
- import { format as Z } from "date-fns";
8
+ import { format as G } from "date-fns";
9
9
  const et = S({
10
10
  setup() {
11
11
  const e = Ne();
@@ -50,7 +50,7 @@ function it(e, t, n, s, i, o) {
50
50
  "onUpdate:modelValue": t[0] || (t[0] = (r) => e.selectedItem = r)
51
51
  }, [
52
52
  e.props.nullText ? (d(), u("option", nt, x(e.props.nullText), 1)) : O("", !0),
53
- (d(!0), u(j, null, Q(e.renderOptions, (r, l) => {
53
+ (d(!0), u(j, null, J(e.renderOptions, (r, l) => {
54
54
  var c;
55
55
  return d(), u("option", {
56
56
  key: l,
@@ -70,7 +70,7 @@ const In = /* @__PURE__ */ Le(et, [["render", it]]), ot = ["onClick"], lt = /* @
70
70
  anchor: {}
71
71
  },
72
72
  setup(e) {
73
- const t = e, n = t.anchor instanceof HTMLElement ? t.anchor : t.anchor.el, s = T({ visibility: "hidden", top: "0", left: "0" }), i = T([]), o = J();
73
+ const t = e, n = t.anchor instanceof HTMLElement ? t.anchor : t.anchor.el, s = T({ visibility: "hidden", top: "0", left: "0" }), i = T([]), o = ee();
74
74
  C(r);
75
75
  function r() {
76
76
  const y = o.vnode.el, { styles: h, classes: a } = l(y, n);
@@ -113,7 +113,7 @@ const In = /* @__PURE__ */ Le(et, [["render", it]]), ot = ["onClick"], lt = /* @
113
113
  }), (y, h) => (d(), u("div", {
114
114
  class: w(["vf-overlay-anchor", i.value]),
115
115
  style: Ue(s.value),
116
- onClick: ee(c, ["stop"])
116
+ onClick: te(c, ["stop"])
117
117
  }, [
118
118
  R(y.$slots, "default")
119
119
  ], 14, ot));
@@ -123,11 +123,11 @@ let rt = 0;
123
123
  const k = je([]), _n = S({
124
124
  setup() {
125
125
  return () => W("div", [
126
- Q(k, (e) => W(We, { key: e.id, to: "#vf-overlay-target" }, [e.wrapperVnode ?? e.vnode]))
126
+ J(k, (e) => W(We, { key: e.id, to: "#vf-overlay-target" }, [e.wrapperVnode ?? e.vnode]))
127
127
  ]);
128
128
  }
129
129
  });
130
- function ne(e, t, n) {
130
+ function se(e, t, n) {
131
131
  const s = document.getElementById("vf-overlay-target") ?? document.createElement("div");
132
132
  s.id = "vf-overlay-target", s.removeAttribute("inert"), document.body.appendChild(s);
133
133
  const i = String(++rt), o = Pe(e), r = W(o, t), l = n != null && n.anchor ? W(lt, { overlayId: i, anchor: n.anchor }, () => [r]) : void 0, c = {
@@ -156,7 +156,7 @@ function ct(e) {
156
156
  const t = k.findIndex((n) => n.id === e);
157
157
  return t >= 0 ? (k[t].props.callback(), !0) : !1;
158
158
  }
159
- function se(e) {
159
+ function P(e) {
160
160
  const t = k.indexOf(e);
161
161
  t >= 0 && k.splice(t, 1);
162
162
  }
@@ -164,39 +164,39 @@ async function ie(e, t, n) {
164
164
  return new Promise((s) => {
165
165
  let i = null;
166
166
  const r = { ...t, callback: (l) => {
167
- se(i), s(l);
167
+ P(i), s(l);
168
168
  } };
169
- i = ne(e, r, n);
169
+ i = se(e, r, n);
170
170
  });
171
171
  }
172
- function P(e, t) {
172
+ function q(e, t) {
173
173
  return { title: t ? e : void 0, message: t ?? e };
174
174
  }
175
175
  async function de(e, t) {
176
- await ie(z, P(e, t));
176
+ await ie(X, q(e, t));
177
177
  }
178
178
  async function Dn(e, t) {
179
- return await ie(z, {
180
- ...P(e, t),
179
+ return await ie(X, {
180
+ ...q(e, t),
181
181
  shouldConfirm: !0
182
182
  }) === !0;
183
183
  }
184
184
  async function $n(e, t) {
185
- return await ie(z, {
186
- ...P(e, t),
185
+ return await ie(X, {
186
+ ...q(e, t),
187
187
  shouldConfirm: !0,
188
188
  classes: ["destructive"]
189
189
  }) === !0;
190
190
  }
191
191
  function An(e, t) {
192
- const n = ne(z, {
193
- ...P(e, t),
192
+ const n = se(X, {
193
+ ...q(e, t),
194
194
  isBare: !0,
195
195
  classes: ["wait"],
196
196
  callback: () => {
197
197
  }
198
198
  });
199
- return () => se(n);
199
+ return () => P(n);
200
200
  }
201
201
  const V = {
202
202
  unhandledErrorSupportText: "please contact support",
@@ -206,13 +206,13 @@ const V = {
206
206
  function Bn(e) {
207
207
  Object.assign(V, e);
208
208
  }
209
- class q extends Error {
209
+ class z extends Error {
210
210
  constructor(t) {
211
211
  super(t), this.name = "UserError";
212
212
  }
213
213
  }
214
214
  function dt(e) {
215
- return e instanceof q ? e.message : `An application error has occurred:
215
+ return e instanceof z ? e.message : `An application error has occurred:
216
216
 
217
217
  ${oe(e).message}
218
218
 
@@ -223,11 +223,11 @@ function oe(e) {
223
223
  }
224
224
  async function Vn(e, t) {
225
225
  const n = oe(e);
226
- return n instanceof q || V.errorHandler(n), t ? de(t, n) : de(n);
226
+ return n instanceof z || V.errorHandler(n), t ? de(t, n) : de(n);
227
227
  }
228
228
  async function Fn(e) {
229
229
  const t = oe(e);
230
- t instanceof q || V.errorHandler(t);
230
+ t instanceof z || V.errorHandler(t);
231
231
  }
232
232
  const D = Symbol("MaskState");
233
233
  function Nn(e, t) {
@@ -248,22 +248,22 @@ function ut(e, t) {
248
248
  function Ie(e) {
249
249
  e[D] && e.removeChild(e[D].maskEl);
250
250
  }
251
- const G = Symbol("FormMaskState");
251
+ const Q = Symbol("FormMaskState");
252
252
  function ht(e, t, n) {
253
253
  const s = e instanceof Element ? e : He(e);
254
254
  s.classList.add("vf-masked");
255
255
  const i = t instanceof Element ? t : s.querySelectorAll(t ?? 'button:not([disabled]):not([type="button"])')[0], o = i.tagName === "INPUT" ? i.value : i.innerHTML;
256
256
  i.setAttribute("disabled", "disabled"), i.innerText = n ?? "Please wait...";
257
257
  const l = [...s.querySelectorAll("input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled])")];
258
- return l.forEach((c) => c.setAttribute("disabled", "disabled")), s[G] = {
258
+ return l.forEach((c) => c.setAttribute("disabled", "disabled")), s[Q] = {
259
259
  disabledElements: l,
260
260
  waitButton: i,
261
261
  buttonHtml: o
262
262
  }, () => _e(s);
263
263
  }
264
264
  function _e(e) {
265
- const t = e instanceof Element ? e : He(e), n = t[G];
266
- n && (t.classList.remove("vf-masked"), n.disabledElements.forEach((s) => s.removeAttribute("disabled")), n.waitButton.innerHTML = n.buttonHtml, n.waitButton.removeAttribute("disabled"), delete t[G]);
265
+ const t = e instanceof Element ? e : He(e), n = t[Q];
266
+ n && (t.classList.remove("vf-masked"), n.disabledElements.forEach((s) => s.removeAttribute("disabled")), n.waitButton.innerHTML = n.buttonHtml, n.waitButton.removeAttribute("disabled"), delete t[Q]);
267
267
  }
268
268
  function He(e) {
269
269
  const t = e.$.vnode.el;
@@ -286,13 +286,13 @@ const ft = ["id"], pt = {
286
286
  },
287
287
  emits: ["formSubmit"],
288
288
  setup(e, { expose: t }) {
289
- const n = e, s = J();
289
+ const n = e, s = ee();
290
290
  t({ mask: y, unmask: h });
291
291
  const i = T(), o = T();
292
292
  C(() => {
293
293
  var a;
294
294
  document.body.classList.add("vf-modal-open"), n.closeOnMaskClick && (window.addEventListener("keydown", l), (a = i.value) == null || a.addEventListener("click", r));
295
- }), te(() => {
295
+ }), ne(() => {
296
296
  window.removeEventListener("keydown", l), document.body.querySelectorAll(".vf-modal").length > 0 || document.body.classList.remove("vf-modal-open");
297
297
  });
298
298
  function r(a) {
@@ -322,7 +322,7 @@ const ft = ["id"], pt = {
322
322
  E("form", {
323
323
  action: ".",
324
324
  class: w(["vf-modal", { scrolls: a.scrolls }]),
325
- onSubmit: m[0] || (m[0] = ee((p) => a.$emit("formSubmit"), ["prevent"])),
325
+ onSubmit: m[0] || (m[0] = te((p) => a.$emit("formSubmit"), ["prevent"])),
326
326
  ref_key: "form",
327
327
  ref: o
328
328
  }, [
@@ -344,7 +344,7 @@ const ft = ["id"], pt = {
344
344
  ], 10, ft));
345
345
  }
346
346
  });
347
- const gt = ["innerHtml"], bt = ["innerText"], z = /* @__PURE__ */ S({
347
+ const gt = ["innerHtml"], bt = ["innerText"], X = /* @__PURE__ */ S({
348
348
  __name: "alert-modal",
349
349
  props: {
350
350
  isBare: { type: Boolean },
@@ -362,7 +362,7 @@ const gt = ["innerHtml"], bt = ["innerText"], z = /* @__PURE__ */ S({
362
362
  return d(), ke(yt, {
363
363
  class: w(["vf-alert", s.classes])
364
364
  }, qe({
365
- default: X(() => [
365
+ default: Y(() => [
366
366
  s.isHtml ? (d(), u("div", {
367
367
  key: 0,
368
368
  innerHtml: s.message,
@@ -376,14 +376,14 @@ const gt = ["innerHtml"], bt = ["innerText"], z = /* @__PURE__ */ S({
376
376
  }, [
377
377
  s.title ? {
378
378
  name: "header",
379
- fn: X(() => [
379
+ fn: Y(() => [
380
380
  E("h1", null, x(s.title), 1)
381
381
  ]),
382
382
  key: "0"
383
383
  } : void 0,
384
384
  s.isBare ? void 0 : {
385
385
  name: "footer",
386
- fn: X(() => [
386
+ fn: Y(() => [
387
387
  s.shouldConfirm ? (d(), u(j, { key: 0 }, [
388
388
  U((d(), u("button", {
389
389
  class: "primary",
@@ -756,7 +756,7 @@ function Vt(e, t, n, s, i, o) {
756
756
  ]),
757
757
  e.shouldDisplayOptions ? (d(), u("div", _t, [
758
758
  e.isLoaded ? (d(), u(j, { key: 1 }, [
759
- (d(!0), u(j, null, Q(o.effectiveOptions, (l) => (d(), u("div", {
759
+ (d(!0), u(j, null, J(o.effectiveOptions, (l) => (d(), u("div", {
760
760
  key: String(l.key),
761
761
  class: w(["option", {
762
762
  highlighted: e.highlightedOptionKey === l.key
@@ -844,7 +844,7 @@ const Ft = /* @__PURE__ */ Le(Mt, [["render", Vt]]), jn = /* @__PURE__ */ S({
844
844
  }), setTimeout(() => t.callback(), i * 1e3);
845
845
  }), (i, o) => (d(), u("div", {
846
846
  class: w(["vf-toast", i.className]),
847
- onClick: ee(n, ["stop"])
847
+ onClick: te(n, ["stop"])
848
848
  }, [
849
849
  E("div", Rt, [
850
850
  E("div", Kt, x(i.message), 1),
@@ -861,12 +861,11 @@ const Ft = /* @__PURE__ */ Le(Mt, [["render", Vt]]), jn = /* @__PURE__ */ S({
861
861
  }
862
862
  });
863
863
  function Wn(e) {
864
- const t = ne(Wt, {
864
+ const t = se(Wt, {
865
865
  ...e,
866
- callback: () => {
867
- }
866
+ callback: () => P(t)
868
867
  });
869
- return () => se(t);
868
+ return () => P(t);
870
869
  }
871
870
  function Pt(e) {
872
871
  const t = Math.floor(Math.log(e) / Math.log(1024)), s = (e / Math.pow(1024, t)).toFixed(2), i = ["B", "KB", "MB", "GB", "TB"][t];
@@ -974,7 +973,7 @@ function Gn({ apiClient: e, onRequest: t, onError: n, CancelablePromise: s }) {
974
973
  c(y.cancel), y.then(r).catch((h) => {
975
974
  if (sn(h) && typeof h.body == "object" && "error" in h.body) {
976
975
  if (h.status === 422)
977
- return l(new q(h.body.error));
976
+ return l(new z(h.body.error));
978
977
  h.message = `${h.body.error} (${h.status})`;
979
978
  }
980
979
  if (n) {
@@ -1014,8 +1013,8 @@ function on(e) {
1014
1013
  }
1015
1014
  const le = Symbol("HookState");
1016
1015
  function Qn(e, t) {
1017
- const n = t ?? J();
1018
- C(() => ln(n, e), n), Se(() => rn(n), n), xe(() => me(n), n), te(() => me(n), n);
1016
+ const n = t ?? ee();
1017
+ C(() => ln(n, e), n), Se(() => rn(n), n), xe(() => me(n), n), ne(() => me(n), n);
1019
1018
  }
1020
1019
  function ln(e, t) {
1021
1020
  const n = {};
@@ -1035,13 +1034,13 @@ function me(e) {
1035
1034
  const t = e[le];
1036
1035
  (n = t == null ? void 0 : t.el) == null || n.uninstall(), (s = t == null ? void 0 : t.ancestor) == null || s.uninstall(), (i = t == null ? void 0 : t.window) == null || i.uninstall();
1037
1036
  }
1038
- const Y = ["auto", "scroll"];
1037
+ const Z = ["auto", "scroll"];
1039
1038
  function De(e) {
1040
1039
  const t = e.parentElement;
1041
1040
  if (!t)
1042
1041
  return null;
1043
1042
  const n = window.getComputedStyle(t);
1044
- return Y.includes(n.overflow) || Y.includes(n.overflowX) || Y.includes(n.overflowY) ? t : De(t);
1043
+ return Z.includes(n.overflow) || Z.includes(n.overflowX) || Z.includes(n.overflowY) ? t : De(t);
1045
1044
  }
1046
1045
  class $ {
1047
1046
  constructor(t, n) {
@@ -1060,7 +1059,7 @@ class $ {
1060
1059
  }
1061
1060
  }
1062
1061
  function Jn(e) {
1063
- C(() => window.addEventListener("resize", e)), Se(() => window.addEventListener("resize", e)), xe(() => window.removeEventListener("resize", e)), te(() => window.removeEventListener("resize", e));
1062
+ C(() => window.addEventListener("resize", e)), Se(() => window.addEventListener("resize", e)), xe(() => window.removeEventListener("resize", e)), ne(() => window.removeEventListener("resize", e));
1064
1063
  }
1065
1064
  const an = {
1066
1065
  mounted: ye,
@@ -1102,9 +1101,9 @@ const un = {
1102
1101
  function hn(e) {
1103
1102
  e.addEventListener("blur", () => {
1104
1103
  let t = e.value;
1105
- /^\d{1,2}\/\d{1,2}$/.test(t) && (t += "/" + Z(/* @__PURE__ */ new Date(), "yy"));
1104
+ /^\d{1,2}\/\d{1,2}$/.test(t) && (t += "/" + G(/* @__PURE__ */ new Date(), "yy"));
1106
1105
  const n = Date.parse(t);
1107
- isNaN(n) ? e.value = "" : e.value = Z(n, "MM/dd/yyyy"), e.dispatchEvent(new Event("input"));
1106
+ isNaN(n) ? e.value = "" : e.value = G(n, "MM/dd/yyyy"), e.dispatchEvent(new Event("input"));
1108
1107
  });
1109
1108
  }
1110
1109
  const fn = {
@@ -1127,7 +1126,7 @@ function pn(e, t) {
1127
1126
  h.getFullYear() == o.getFullYear() && h.getMonth() == o.getMonth() && h.getDate() == o.getDate() && (n = "at", r = "HH:mm");
1128
1127
  }
1129
1128
  r || (r = V.defaultDateTimeFormat);
1130
- let l = Z(o, r);
1129
+ let l = G(o, r);
1131
1130
  return n && (l = n + " " + l), l;
1132
1131
  }
1133
1132
  const mn = {
@@ -1274,16 +1273,16 @@ function es(e) {
1274
1273
  export {
1275
1274
  pe as FileUploadRequest,
1276
1275
  _n as OverlayContainer,
1277
- q as UserError,
1276
+ z as UserError,
1278
1277
  In as VfAjaxSelect,
1279
- z as VfAlertModal,
1278
+ X as VfAlertModal,
1280
1279
  jn as VfEzSmartSelect,
1281
1280
  yt as VfModal,
1282
1281
  Ft as VfSmartSelect,
1283
1282
  Yn as cloneProp,
1284
1283
  Bn as configureVf,
1285
1284
  Pn as createFilters,
1286
- ne as createOverlayInjection,
1285
+ se as createOverlayInjection,
1287
1286
  St as desnakeCase,
1288
1287
  ct as dismissOverlayInjectionById,
1289
1288
  Hn as dismissOverlayInjectionByInstance,
@@ -1305,7 +1304,7 @@ export {
1305
1304
  Kn as nl2br,
1306
1305
  Zn as nullifyEmptyInputs,
1307
1306
  ie as presentOverlay,
1308
- se as removeOverlayInjection,
1307
+ P as removeOverlayInjection,
1309
1308
  qn as replaceElement,
1310
1309
  de as showAlert,
1311
1310
  Dn as showConfirm,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@signal24/vue-foundation",
3
3
  "type": "module",
4
- "version": "4.6.0",
4
+ "version": "4.6.1",
5
5
  "description": "Common components, directives, and helpers for Vue 3 apps",
6
6
  "module": "./dist/vue-foundation.es.js",
7
7
  "bin": {
@@ -23,7 +23,7 @@ interface OverlayOptions {
23
23
  anchor?: OverlayAnchorOptions;
24
24
  }
25
25
 
26
- interface OverlayInjection<C extends OverlayComponent> {
26
+ export interface OverlayInjection<C extends OverlayComponent> {
27
27
  id: string;
28
28
  component: OverlayComponentUnwrapped<C>;
29
29
  props: OverlayComponentProps<C>;
@@ -1,10 +1,10 @@
1
- import { createOverlayInjection, removeOverlayInjection } from './overlay-container';
1
+ import { createOverlayInjection, type OverlayInjection, removeOverlayInjection } from './overlay-container';
2
2
  import Toast, { type IToastOptions } from './toast.vue';
3
3
 
4
4
  export function showToast(options: IToastOptions) {
5
- const injection = createOverlayInjection(Toast, {
5
+ const injection: OverlayInjection<typeof Toast> = createOverlayInjection(Toast, {
6
6
  ...options,
7
- callback: () => {}
7
+ callback: () => removeOverlayInjection(injection)
8
8
  });
9
9
  return () => removeOverlayInjection(injection);
10
10
  }