@rankingcoach/vanguard 1.12.0 → 1.12.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.
@@ -1,102 +1,104 @@
1
- var N = Object.defineProperty;
2
- var W = (d, e, o) => e in d ? N(d, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : d[e] = o;
3
- var c = (d, e, o) => W(d, typeof e != "symbol" ? e + "" : e, o);
4
- import { jsx as n, jsxs as C } from "react/jsx-runtime";
5
- import { mt2 as A } from "./index-general.module.js";
1
+ var S = Object.defineProperty;
2
+ var A = (n, e, o) => e in n ? S(n, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : n[e] = o;
3
+ var m = (n, e, o) => A(n, typeof e != "symbol" ? e + "" : e, o);
4
+ import { jsx as r, jsxs as C } from "react/jsx-runtime";
5
+ import { mt2 as N } from "./index-general.module.js";
6
6
  import { classNames as F } from "./index-classNames.js";
7
- import { uuidv4 as _ } from "./index-generate-uid.js";
8
- import { pubSubService as v, PUB_SUB_EVENTS as T } from "./index-pub-sub.js";
7
+ import { uuidv4 as W } from "./index-generate-uid.js";
8
+ import { pubSubService as v, PUB_SUB_EVENTS as I } from "./index-pub-sub.js";
9
9
  import { deviceService as R } from "./index-device.service.js";
10
10
  import { PublicWidgetData as $ } from "./index-public-widgets-data.store.js";
11
11
  import { Modal as j } from "./index-Modal.js";
12
- import { ModalHeader as U } from "./index-ModalHeader.js";
13
- import { Render as I } from "./index-Render.js";
14
- import { AcceptModal as V } from "./index-AcceptModal.js";
15
- import { ErrorModal as k } from "./index-ErrorModal.js";
16
- import { Text as y, FontWeights as x, TextTypes as D } from "./index-Text.js";
17
- import E from "react";
18
- import { PhotoCarouselModal as G } from "./index-PhotoCarouselModal.js";
19
- import { ConfirmModal as q } from "./index-ConfirmModal.js";
20
- import { LoadingModal as z } from "./index-LoadingModal.js";
21
- const J = (d) => {
12
+ import { ModalHeader as D } from "./index-ModalHeader.js";
13
+ import { Render as T } from "./index-Render.js";
14
+ import { AcceptModal as U } from "./index-AcceptModal.js";
15
+ import { ErrorModal as V } from "./index-ErrorModal.js";
16
+ import { Text as x, FontWeights as E, TextTypes as Z } from "./index-Text.js";
17
+ import y from "react";
18
+ import { PhotoCarouselModal as k } from "./index-PhotoCarouselModal.js";
19
+ import { ConfirmModal as G } from "./index-ConfirmModal.js";
20
+ import { LoadingModal as X } from "./index-LoadingModal.js";
21
+ const q = (n) => {
22
22
  const {
23
23
  close: e,
24
24
  children: o,
25
- title: i,
26
- headerType: t,
25
+ title: t,
26
+ headerType: i,
27
27
  message: l,
28
28
  hideHeaderCloseBtn: a,
29
29
  padding: s
30
- } = d;
30
+ } = n;
31
31
  return C(j, {
32
- ...d,
33
- children: [C(U, {
32
+ ...n,
33
+ children: [C(D, {
34
34
  closeFn: e,
35
35
  hideCloseButtonOnMobile: !1,
36
36
  hideHeaderCloseBtn: a,
37
- type: t,
38
- children: [n(I, {
39
- if: !!i,
40
- children: n(y, {
41
- type: D.heading4,
42
- fontWeight: x.bold,
43
- children: i
37
+ type: i,
38
+ children: [r(T, {
39
+ if: !!t,
40
+ children: r(x, {
41
+ type: Z.heading4,
42
+ fontWeight: E.bold,
43
+ children: t
44
44
  })
45
- }), n(I, {
45
+ }), r(T, {
46
46
  if: !!l && typeof l == "string",
47
- children: n("div", {
48
- className: F(A),
49
- children: n(y, {
50
- fontWeight: x.regular,
47
+ children: r("div", {
48
+ className: F(N),
49
+ children: r(x, {
50
+ fontWeight: E.regular,
51
51
  children: l
52
52
  })
53
53
  })
54
54
  })]
55
- }), n("span", {
55
+ }), r("span", {
56
56
  style: {
57
57
  padding: s
58
58
  },
59
59
  children: o
60
60
  })]
61
61
  });
62
- };
63
- class K {
62
+ }, L = 1100;
63
+ class z {
64
64
  constructor() {
65
- c(this, "loadingModalId");
66
- c(this, "confirmModalId");
67
- c(this, "errorModalId");
68
- c(this, "modalCloseListeners");
69
- c(this, "modalComponents");
70
- c(this, "openErrorModal", ({
65
+ m(this, "loadingModalId");
66
+ m(this, "confirmModalId");
67
+ m(this, "errorModalId");
68
+ m(this, "modalCloseListeners");
69
+ m(this, "modalComponents");
70
+ m(this, "modalOrder");
71
+ m(this, "popoverOrder");
72
+ m(this, "openErrorModal", ({
71
73
  err: e,
72
74
  source: o,
73
- message: i,
74
- title: t,
75
+ message: t,
76
+ title: i,
75
77
  ctaPositive: l,
76
78
  onClose: a
77
79
  }) => {
78
- this.errorModalId = this.open(n(k, {
80
+ this.errorModalId = this.open(r(V, {
79
81
  close: () => {
80
82
  a && a();
81
83
  },
82
84
  err: e,
83
85
  source: o,
84
- message: i,
85
- title: t,
86
+ message: t,
87
+ title: i,
86
88
  ctaPositive: l
87
89
  }));
88
90
  });
89
- this.loadingModalId = null, this.confirmModalId = null, this.errorModalId = null, this.modalCloseListeners = /* @__PURE__ */ new Map(), this.modalComponents = /* @__PURE__ */ new Map();
91
+ this.loadingModalId = null, this.confirmModalId = null, this.errorModalId = null, this.modalCloseListeners = /* @__PURE__ */ new Map(), this.modalComponents = /* @__PURE__ */ new Map(), this.modalOrder = /* @__PURE__ */ new Map(), this.popoverOrder = /* @__PURE__ */ new Map();
90
92
  }
91
93
  on(e, o) {
92
- document.addEventListener(e, (i) => o(i.detail));
94
+ document.addEventListener(e, (t) => o(t.detail));
93
95
  }
94
- onModalClose(e, o, i) {
95
- var t, l;
96
+ onModalClose(e, o, t) {
97
+ var i, l;
96
98
  this.modalCloseListeners.has(e) || this.modalCloseListeners.set(e, {
97
99
  cbs: [],
98
- data: i
99
- }), o && ((l = (t = this.modalCloseListeners.get(e)) == null ? void 0 : t.cbs) == null || l.push(o));
100
+ data: t
101
+ }), o && ((l = (i = this.modalCloseListeners.get(e)) == null ? void 0 : i.cbs) == null || l.push(o));
100
102
  }
101
103
  cleanModalClose(e) {
102
104
  this.modalCloseListeners.delete(e);
@@ -105,74 +107,74 @@ class K {
105
107
  return this.modalComponents.get(e);
106
108
  }
107
109
  removeModalComponent(e) {
108
- this.modalComponents.delete(e);
110
+ this.modalComponents.delete(e), this.modalOrder.delete(e);
109
111
  }
110
- openConfirmModal(e, o = "", i = "", t = "", l = "", a = "default", s = void 0, r = void 0, m, h, p) {
111
- let f;
112
- typeof e == "function" ? f = {
112
+ openConfirmModal(e, o = "", t = "", i = "", l = "", a = "default", s = void 0, d = void 0, c, f, p) {
113
+ let h;
114
+ typeof e == "function" ? h = {
113
115
  closeFn: e,
114
116
  title: o,
115
- message: i,
116
- positiveCtaText: t,
117
+ message: t,
118
+ positiveCtaText: i,
117
119
  negativeCtaText: l,
118
120
  headerType: a,
119
121
  positiveIconLeft: s,
120
- replacements: r,
121
- hideHeaderCloseBtn: m,
122
- customNegativeFn: h,
122
+ replacements: d,
123
+ hideHeaderCloseBtn: c,
124
+ customNegativeFn: f,
123
125
  hideNegativeBtn: p
124
- } : f = e;
126
+ } : h = e;
125
127
  const {
126
128
  closeFn: M,
127
129
  title: u = "",
128
130
  message: g = "",
129
- positiveCtaText: L = "",
130
- negativeCtaText: H = "",
131
- headerType: P = "default",
131
+ positiveCtaText: P = "",
132
+ negativeCtaText: w = "",
133
+ headerType: H = "default",
132
134
  positiveIconLeft: b,
133
- replacements: w,
134
- hideHeaderCloseBtn: B,
135
- customNegativeFn: S
136
- } = f;
137
- return this.confirmModalId = this.open(n(q, {
135
+ replacements: B,
136
+ hideHeaderCloseBtn: O,
137
+ customNegativeFn: _
138
+ } = h;
139
+ return this.confirmModalId = this.open(r(G, {
138
140
  close: M,
139
141
  message: g,
140
142
  title: u,
141
- positiveCtaText: L,
143
+ positiveCtaText: P,
142
144
  positiveIconLeft: b,
143
- negativeCtaText: H,
144
- headerType: P,
145
- replacements: w,
146
- hideHeaderCloseBtn: B,
147
- customNegativeFn: S
145
+ negativeCtaText: w,
146
+ headerType: H,
147
+ replacements: B,
148
+ hideHeaderCloseBtn: O,
149
+ customNegativeFn: _
148
150
  })), this.confirmModalId;
149
151
  }
150
- openAcceptModal(e, o = "", i = "", t = "default", l = "", a = void 0, s) {
151
- let r;
152
- typeof e == "function" ? r = {
152
+ openAcceptModal(e, o = "", t = "", i = "default", l = "", a = void 0, s) {
153
+ let d;
154
+ typeof e == "function" ? d = {
153
155
  closeFn: e,
154
156
  title: o,
155
- message: i,
156
- headerType: t,
157
+ message: t,
158
+ headerType: i,
157
159
  positiveCtaText: l,
158
160
  replacements: a,
159
161
  hideHeaderCloseBtn: s
160
- } : r = e;
162
+ } : d = e;
161
163
  const {
162
- closeFn: m,
163
- title: h = "",
164
+ closeFn: c,
165
+ title: f = "",
164
166
  message: p = "",
165
- headerType: f = "default",
167
+ headerType: h = "default",
166
168
  positiveCtaText: M = "",
167
169
  replacements: u,
168
170
  hideHeaderCloseBtn: g
169
- } = r;
170
- return this.confirmModalId = this.open(n(V, {
171
- close: m,
171
+ } = d;
172
+ return this.confirmModalId = this.open(r(U, {
173
+ close: c,
172
174
  message: p,
173
- title: h,
175
+ title: f,
174
176
  positiveCtaText: M,
175
- headerType: f,
177
+ headerType: h,
176
178
  replacements: u,
177
179
  hideHeaderCloseBtn: g
178
180
  })), this.confirmModalId;
@@ -180,25 +182,25 @@ class K {
180
182
  closeConfirmModal() {
181
183
  this.closeEv(this.confirmModalId), this.confirmModalId = null;
182
184
  }
183
- openLoadingModal(e, o, i, t) {
185
+ openLoadingModal(e, o, t, i) {
184
186
  let l;
185
187
  typeof e == "object" && e !== null ? l = e : l = {
186
188
  title: e,
187
189
  message: o,
188
- loadingAnimation: i,
189
- headerTitle: t
190
+ loadingAnimation: t,
191
+ headerTitle: i
190
192
  };
191
193
  const {
192
194
  title: a,
193
195
  message: s,
194
- loadingAnimation: r = "default",
195
- headerTitle: m
196
+ loadingAnimation: d = "default",
197
+ headerTitle: c
196
198
  } = l;
197
- return this.loadingModalId = this.open(n(z, {
199
+ return this.loadingModalId = this.open(r(X, {
198
200
  title: a,
199
201
  message: s,
200
- loadingAnimation: r,
201
- headerTitle: m,
202
+ loadingAnimation: d,
203
+ headerTitle: c,
202
204
  close: () => {
203
205
  }
204
206
  }), {
@@ -212,7 +214,7 @@ class K {
212
214
  this.closeEv(this.loadingModalId), this.loadingModalId = null;
213
215
  }
214
216
  openPhotoGalleryModal(e, o) {
215
- return this.open(n(G, {
217
+ return this.open(r(k, {
216
218
  defaultMediaItem: o,
217
219
  gallery: e,
218
220
  close: () => {
@@ -238,12 +240,62 @@ class K {
238
240
  this.closeEv(o);
239
241
  });
240
242
  }
243
+ /**
244
+ * Highest order across modals AND popovers — used internally when assigning
245
+ * the next slot so modals/popovers never tie or interleave wrongly.
246
+ */
247
+ getCurrentMaxOrder() {
248
+ let e = 0;
249
+ return this.modalOrder.forEach((o) => {
250
+ o > e && (e = o);
251
+ }), this.popoverOrder.forEach((o) => {
252
+ o > e && (e = o);
253
+ }), e;
254
+ }
255
+ getMaxModalOrder() {
256
+ let e = 0;
257
+ return this.modalOrder.forEach((o) => {
258
+ o > e && (e = o);
259
+ }), e;
260
+ }
261
+ /**
262
+ * Z-index of the topmost mounted modal, or MODAL_BASE_Z_INDEX (the stacking
263
+ * floor) when no modal is open. Popovers are excluded — this reports modal
264
+ * stacking only. Mirrors ModalTransition's formula: BASE + order.
265
+ */
266
+ getTopmostModalZIndex() {
267
+ return L + this.getMaxModalOrder();
268
+ }
269
+ /**
270
+ * Single source of truth for a modal's stack order. ModalContext delegates
271
+ * to this so the dropdown and ModalTransition cannot drift apart.
272
+ */
273
+ getModalOrder(e) {
274
+ return this.modalOrder.get(e) ?? 0;
275
+ }
276
+ /**
277
+ * Register a popover (e.g. DropdownMenu) into the shared stacking ledger.
278
+ * Returns its z-index so the caller can position itself. Modals opened
279
+ * after this call will land above the popover; closing the popover with
280
+ * `unregisterPopover` frees the slot.
281
+ */
282
+ registerPopover(e) {
283
+ const o = this.getCurrentMaxOrder() + 1;
284
+ return this.popoverOrder.set(e, o), L + o;
285
+ }
286
+ unregisterPopover(e) {
287
+ this.popoverOrder.delete(e);
288
+ }
289
+ /** Test-only: wipe internal state. Not for production code paths. */
290
+ __resetForTests() {
291
+ this.loadingModalId = null, this.confirmModalId = null, this.errorModalId = null, this.modalCloseListeners.clear(), this.modalComponents.clear(), this.modalOrder.clear(), this.popoverOrder.clear();
292
+ }
241
293
  open(e, o) {
242
- let i = _();
243
- const t = $.getInstance(), {
294
+ let t = W();
295
+ const i = $.getInstance(), {
244
296
  widgetId: l
245
- } = t.get();
246
- l && (i = `${i}_${l}`), R.isMobile() && (!o || !o.hasOwnProperty("fullscreen")) ? o = {
297
+ } = i.get();
298
+ l && (t = `${t}_${l}`), R.isMobile() && (!o || !o.hasOwnProperty("fullscreen")) ? o = {
247
299
  fullscreen: !1,
248
300
  animation: "pop",
249
301
  ...o
@@ -254,51 +306,52 @@ class K {
254
306
  };
255
307
  const a = {
256
308
  ...e
257
- }, s = (m) => {
258
- a.props.close && a.props.close(m), this.closeEv(i, m);
309
+ }, s = (c) => {
310
+ a.props.close && a.props.close(c), this.closeEv(t, c);
259
311
  };
260
- o != null && o.wrapInModal && (e = n(J, {
312
+ o != null && o.wrapInModal && (e = r(q, {
261
313
  close: s,
262
314
  padding: o.padding,
263
315
  headerType: o.type,
264
316
  title: o.title,
265
317
  message: o.message,
266
- children: E.isValidElement(e) ? E.cloneElement(e, {
267
- modalId: i,
318
+ children: y.isValidElement(e) ? y.cloneElement(e, {
319
+ modalId: t,
268
320
  close: s
269
321
  }) : e
270
322
  }));
271
- const r = {
323
+ const d = {
272
324
  ...e.props,
273
325
  close: s,
274
326
  ...o
275
327
  };
276
- return this.modalComponents.set(i, {
328
+ return this.modalComponents.set(t, {
277
329
  ...e,
278
330
  props: {
279
- ...r
331
+ ...d
280
332
  },
281
- modalId: i
282
- }), v.$pub(T.reactModalOpen, {
283
- modalId: i,
333
+ modalId: t
334
+ }), this.modalOrder.set(t, this.getCurrentMaxOrder() + 1), v.$pub(I.reactModalOpen, {
335
+ modalId: t,
284
336
  animation: (o == null ? void 0 : o.animation) || "grow"
285
- }), i;
337
+ }), t;
286
338
  }
287
339
  closeEv(e, o) {
288
- return e ? new Promise((i) => {
340
+ return e ? new Promise((t) => {
289
341
  setTimeout(() => {
290
- v.$pub(T.reactModalClose, {
342
+ v.$pub(I.reactModalClose, {
291
343
  modalId: e
292
344
  });
293
- const t = this.modalCloseListeners.get(e);
294
- t && t.cbs.forEach((l) => l(o)), this.cleanModalClose(e), this.removeModalComponent(e), i(t == null ? void 0 : t.data);
345
+ const i = this.modalCloseListeners.get(e);
346
+ i && i.cbs.forEach((l) => l(o)), this.cleanModalClose(e), this.removeModalComponent(e), t(i == null ? void 0 : i.data);
295
347
  }, 0);
296
- }) : new Promise((i) => {
297
- i(void 0);
348
+ }) : new Promise((t) => {
349
+ t(void 0);
298
350
  });
299
351
  }
300
352
  }
301
- const he = new K();
353
+ const pe = new z();
302
354
  export {
303
- he as ModalService
355
+ L as MODAL_BASE_Z_INDEX,
356
+ pe as ModalService
304
357
  };
@@ -1,10 +1,10 @@
1
- import { __exports as y } from "./index-_virtual70.js";
1
+ import { __exports as y } from "./index-_virtual69.js";
2
2
  import de from "react";
3
3
  import { __require as me } from "./index-prop-types.js";
4
4
  import { __require as he } from "./index-DayCell.js";
5
5
  import ye from "./index-_virtual54.js";
6
6
  import ve from "./index-_virtual37.js";
7
- import Oe from "./index-_virtual71.js";
7
+ import Oe from "./index-_virtual70.js";
8
8
  import _e from "./index-_virtual68.js";
9
9
  import De from "./index-_virtual51.js";
10
10
  import ge from "./index-_virtual41.js";
@@ -1,6 +1,6 @@
1
1
  import { jsx as k } from "react/jsx-runtime";
2
2
  import { useRef as C, useState as B, useEffect as A, useReducer as F, useCallback as a, isValidElement as H, cloneElement as j } from "react";
3
- import z from "./index-esm5.js";
3
+ import z from "./index-esm4.js";
4
4
  import { STATUS as t } from "./index-config.js";
5
5
  import J from "./index-cache.js";
6
6
  import { randomString as K, request as Q, canUseDOM as L, isSupportedEnvironment as W, omit as X } from "./index-helpers.js";
@@ -1,5 +1,4 @@
1
- import { __require as r } from "./index-dist4.js";
2
- var i = r();
1
+ var r = {};
3
2
  export {
4
- i as d
3
+ r as __exports
5
4
  };
@@ -1,4 +1,4 @@
1
- var e = {};
1
+ var o = {};
2
2
  export {
3
- e as __exports
3
+ o as __exports
4
4
  };
@@ -1,4 +1,6 @@
1
- var o = {};
1
+ import { getAugmentedNamespace as e } from "./index-_commonjsHelpers.js";
2
+ import * as r from "./index-isWeekend.js";
3
+ const m = /* @__PURE__ */ e(r);
2
4
  export {
3
- o as __exports
5
+ m as default
4
6
  };
@@ -1,6 +1,4 @@
1
- import { getAugmentedNamespace as e } from "./index-_commonjsHelpers.js";
2
- import * as r from "./index-isWeekend.js";
3
- const m = /* @__PURE__ */ e(r);
1
+ var t = {};
4
2
  export {
5
- m as default
3
+ t as __exports
6
4
  };
@@ -1,4 +1,6 @@
1
- var t = {};
1
+ import { getAugmentedNamespace as e } from "./index-_commonjsHelpers.js";
2
+ import * as r from "./index-isEqual.js";
3
+ const m = /* @__PURE__ */ e(r);
2
4
  export {
3
- t as __exports
5
+ m as default
4
6
  };
@@ -1,5 +1,5 @@
1
1
  import { getAugmentedNamespace as e } from "./index-_commonjsHelpers.js";
2
- import * as r from "./index-isEqual.js";
2
+ import * as r from "./index-isValid2.js";
3
3
  const m = /* @__PURE__ */ e(r);
4
4
  export {
5
5
  m as default
@@ -1,5 +1,5 @@
1
1
  import { getAugmentedNamespace as e } from "./index-_commonjsHelpers.js";
2
- import * as r from "./index-isValid2.js";
2
+ import * as r from "./index-parse3.js";
3
3
  const m = /* @__PURE__ */ e(r);
4
4
  export {
5
5
  m as default
@@ -1,6 +1,4 @@
1
- import { getAugmentedNamespace as e } from "./index-_commonjsHelpers.js";
2
- import * as r from "./index-parse3.js";
3
- const m = /* @__PURE__ */ e(r);
1
+ var s = {};
4
2
  export {
5
- m as default
3
+ s as __exports
6
4
  };
@@ -1,4 +1,4 @@
1
- var s = {};
1
+ var e = {};
2
2
  export {
3
- s as __exports
3
+ e as __exports
4
4
  };
@@ -1,4 +1,5 @@
1
- var r = {};
1
+ import { __require as r } from "./index-dist4.js";
2
+ var i = r();
2
3
  export {
3
- r as __exports
4
+ i as d
4
5
  };
@@ -1,4 +1,4 @@
1
- import { __exports as t } from "./index-_virtual76.js";
1
+ import { __exports as t } from "./index-_virtual75.js";
2
2
  import { __require as s } from "./index-prop-types.js";
3
3
  var a;
4
4
  function f() {
@@ -1,4 +1,4 @@
1
- import { __exports as t } from "./index-_virtual9.js";
1
+ import { __exports as t } from "./index-_virtual10.js";
2
2
  import { __require as c } from "./index-normalizeText.js";
3
3
  import { __require as i } from "./index-impl.js";
4
4
  var a;