@repere/react 0.2.1 → 0.2.2
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/index.js +143 -143
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -102,27 +102,27 @@ function $(e) {
|
|
|
102
102
|
}
|
|
103
103
|
function re(e, t) {
|
|
104
104
|
const o = (i) => {
|
|
105
|
-
const
|
|
106
|
-
return
|
|
107
|
-
}, n = o(e.x),
|
|
105
|
+
const s = i.match(/(-?\d+)%/);
|
|
106
|
+
return s ? parseFloat(s[1]) : 0;
|
|
107
|
+
}, n = o(e.x), r = o(e.y), a = (i = 0) => r === 0 && i === 0 ? `translate(${n}%, 0)` : i === 0 ? `translate(${n}%, ${r}%)` : `translate(${n}%, calc(${r}% + ${i}px))`;
|
|
108
108
|
return {
|
|
109
109
|
initial: {
|
|
110
110
|
...t.initial,
|
|
111
|
-
transform:
|
|
111
|
+
transform: a(t.initial.y || 0)
|
|
112
112
|
},
|
|
113
113
|
animate: {
|
|
114
114
|
...t.animate,
|
|
115
|
-
transform:
|
|
115
|
+
transform: a(t.animate.y || 0)
|
|
116
116
|
},
|
|
117
117
|
exit: {
|
|
118
118
|
...t.exit,
|
|
119
|
-
transform:
|
|
119
|
+
transform: a(t.exit.y || 0)
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
function ae(e, t) {
|
|
124
124
|
if (!e && !t) return {};
|
|
125
|
-
const o = e?.variants, n = e?.transition,
|
|
125
|
+
const o = e?.variants, n = e?.transition, r = t?.variants, a = t?.transition, i = a?.ease ?? n?.ease ?? [0.4, 0, 0.2, 1], s = Array.isArray(i) ? `cubic-bezier(${i.join(", ")})` : i;
|
|
126
126
|
return {
|
|
127
127
|
// Initial state (when opening starts) - from onOpen animation
|
|
128
128
|
"--repere-initial-opacity": o?.initial.opacity ?? 0,
|
|
@@ -135,13 +135,13 @@ function ae(e, t) {
|
|
|
135
135
|
"--repere-animate-y": `${o?.animate.y ?? 0}px`,
|
|
136
136
|
"--repere-animate-scale": o?.animate.scale ?? 1,
|
|
137
137
|
// Exit state (when closing) - from onClose animation
|
|
138
|
-
"--repere-exit-opacity":
|
|
139
|
-
"--repere-exit-x": `${
|
|
140
|
-
"--repere-exit-y": `${
|
|
141
|
-
"--repere-exit-scale":
|
|
138
|
+
"--repere-exit-opacity": r?.exit.opacity ?? 0,
|
|
139
|
+
"--repere-exit-x": `${r?.exit.x ?? 0}px`,
|
|
140
|
+
"--repere-exit-y": `${r?.exit.y ?? 0}px`,
|
|
141
|
+
"--repere-exit-scale": r?.exit.scale ?? 1,
|
|
142
142
|
// Transition timing
|
|
143
|
-
"--repere-transition-duration": `${
|
|
144
|
-
"--repere-transition-timing":
|
|
143
|
+
"--repere-transition-duration": `${a?.duration ?? n?.duration ?? 0.3}s`,
|
|
144
|
+
"--repere-transition-timing": s
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
function le(e, t) {
|
|
@@ -173,12 +173,12 @@ class de {
|
|
|
173
173
|
* This supports wildcards - e.g., path="*" will match all pages
|
|
174
174
|
*/
|
|
175
175
|
findMatchingPages(t, o) {
|
|
176
|
-
const n = t.filter((
|
|
176
|
+
const n = t.filter((r) => typeof r.path == "function" ? r.path(o) : pe(o, r.path));
|
|
177
177
|
return this.debug && console.log(
|
|
178
178
|
"[BeaconManager] Path:",
|
|
179
179
|
o,
|
|
180
180
|
"Matched pages:",
|
|
181
|
-
n.map((
|
|
181
|
+
n.map((r) => r.id).join(", ") || "none"
|
|
182
182
|
), n;
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
@@ -193,24 +193,24 @@ class de {
|
|
|
193
193
|
"[BeaconManager] Found",
|
|
194
194
|
n.length,
|
|
195
195
|
"matching page(s):",
|
|
196
|
-
n.map((
|
|
196
|
+
n.map((s) => s.id).join(", ")
|
|
197
197
|
);
|
|
198
|
-
const
|
|
199
|
-
for (const
|
|
200
|
-
for (const l of
|
|
201
|
-
if (
|
|
198
|
+
const r = [], a = /* @__PURE__ */ new Set();
|
|
199
|
+
for (const s of n)
|
|
200
|
+
for (const l of s.beacons) {
|
|
201
|
+
if (a.has(l.id)) {
|
|
202
202
|
this.debug && console.warn(
|
|
203
|
-
`[BeaconManager] Duplicate beacon ID "${l.id}" in page "${
|
|
203
|
+
`[BeaconManager] Duplicate beacon ID "${l.id}" in page "${s.id}", skipping`
|
|
204
204
|
);
|
|
205
205
|
continue;
|
|
206
206
|
}
|
|
207
|
-
|
|
207
|
+
a.add(l.id), r.push(l);
|
|
208
208
|
}
|
|
209
209
|
const i = [];
|
|
210
|
-
for (const
|
|
210
|
+
for (const s of r)
|
|
211
211
|
await Promise.resolve(
|
|
212
|
-
this.store.isDismissed(
|
|
213
|
-
) ? this.debug && console.log("[BeaconManager] Beacon",
|
|
212
|
+
this.store.isDismissed(s.id)
|
|
213
|
+
) ? this.debug && console.log("[BeaconManager] Beacon", s.id, "is dismissed") : i.push(s);
|
|
214
214
|
return this.debug && console.log("[BeaconManager] Active beacons:", i.length), i;
|
|
215
215
|
}
|
|
216
216
|
/**
|
|
@@ -221,42 +221,42 @@ class de {
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
function N(e, t = m.TopRight, o = { x: 0, y: 0 }) {
|
|
224
|
-
const { x: n = 0, y:
|
|
225
|
-
let
|
|
224
|
+
const { x: n = 0, y: r = 0 } = o;
|
|
225
|
+
let a = 0, i = 0, s = "0", l = "0";
|
|
226
226
|
switch (t) {
|
|
227
227
|
// Top positions
|
|
228
228
|
case m.TopLeft:
|
|
229
|
-
|
|
229
|
+
a = e.top + window.scrollY, i = e.left + window.scrollX, s = "-50%", l = "-100%";
|
|
230
230
|
break;
|
|
231
231
|
case m.TopCenter:
|
|
232
|
-
|
|
232
|
+
a = e.top + window.scrollY, i = e.left + window.scrollX + e.width / 2, s = "-50%", l = "-100%";
|
|
233
233
|
break;
|
|
234
234
|
case m.TopRight:
|
|
235
|
-
|
|
235
|
+
a = e.top + window.scrollY, i = e.right + window.scrollX, s = "-50%", l = "-100%";
|
|
236
236
|
break;
|
|
237
237
|
// Right positions
|
|
238
238
|
case m.RightCenter:
|
|
239
|
-
|
|
239
|
+
a = e.top + window.scrollY + e.height / 2, i = e.right + window.scrollX, s = "0", l = "-50%";
|
|
240
240
|
break;
|
|
241
241
|
// Bottom positions
|
|
242
242
|
case m.BottomLeft:
|
|
243
|
-
|
|
243
|
+
a = e.bottom + window.scrollY, i = e.left + window.scrollX, s = "-50%", l = "0";
|
|
244
244
|
break;
|
|
245
245
|
case m.BottomCenter:
|
|
246
|
-
|
|
246
|
+
a = e.bottom + window.scrollY, i = e.left + window.scrollX + e.width / 2, s = "-50%", l = "0";
|
|
247
247
|
break;
|
|
248
248
|
case m.BottomRight:
|
|
249
|
-
|
|
249
|
+
a = e.bottom + window.scrollY, i = e.right + window.scrollX, s = "-50%", l = "0";
|
|
250
250
|
break;
|
|
251
251
|
// Left positions
|
|
252
252
|
case m.LeftCenter:
|
|
253
|
-
|
|
253
|
+
a = e.top + window.scrollY + e.height / 2, i = e.left + window.scrollX, s = "-100%", l = "-50%";
|
|
254
254
|
break;
|
|
255
255
|
}
|
|
256
|
-
return
|
|
257
|
-
top:
|
|
256
|
+
return a += r, i += n, {
|
|
257
|
+
top: a,
|
|
258
258
|
left: i,
|
|
259
|
-
translate: { x:
|
|
259
|
+
translate: { x: s, y: l }
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
262
|
class ue {
|
|
@@ -272,30 +272,30 @@ class ue {
|
|
|
272
272
|
/**
|
|
273
273
|
* Subscribe to position updates for an element
|
|
274
274
|
*/
|
|
275
|
-
subscribe(t, o, n,
|
|
276
|
-
const
|
|
277
|
-
this.tracked.has(
|
|
275
|
+
subscribe(t, o, n, r = {}) {
|
|
276
|
+
const a = t;
|
|
277
|
+
this.tracked.has(a) || this.tracked.set(a, {
|
|
278
278
|
selector: t,
|
|
279
279
|
position: o,
|
|
280
|
-
offset:
|
|
281
|
-
zIndex:
|
|
282
|
-
delay:
|
|
280
|
+
offset: r.offset,
|
|
281
|
+
zIndex: r.zIndex ?? 9999,
|
|
282
|
+
delay: r.delay,
|
|
283
283
|
callbacks: /* @__PURE__ */ new Map(),
|
|
284
284
|
element: null,
|
|
285
285
|
delayTimeoutIds: /* @__PURE__ */ new Map()
|
|
286
286
|
});
|
|
287
|
-
const i = this.tracked.get(
|
|
287
|
+
const i = this.tracked.get(a);
|
|
288
288
|
return i ? (i.callbacks.set(n, {
|
|
289
289
|
callback: n,
|
|
290
|
-
needsInitialDelay: (
|
|
291
|
-
}), this.tracked.size === 1 && this.startListening(), this.scheduleInitialUpdate(
|
|
292
|
-
const
|
|
293
|
-
if (
|
|
294
|
-
const l =
|
|
295
|
-
if (l !== void 0 && (clearTimeout(l),
|
|
296
|
-
for (const [, c] of
|
|
290
|
+
needsInitialDelay: (r.delay ?? 0) > 0
|
|
291
|
+
}), this.tracked.size === 1 && this.startListening(), this.scheduleInitialUpdate(a, n), () => {
|
|
292
|
+
const s = this.tracked.get(a);
|
|
293
|
+
if (s) {
|
|
294
|
+
const l = s.delayTimeoutIds.get(n);
|
|
295
|
+
if (l !== void 0 && (clearTimeout(l), s.delayTimeoutIds.delete(n)), s.callbacks.delete(n), s.callbacks.size === 0) {
|
|
296
|
+
for (const [, c] of s.delayTimeoutIds)
|
|
297
297
|
clearTimeout(c);
|
|
298
|
-
|
|
298
|
+
s.delayTimeoutIds.clear(), this.tracked.delete(a), this.tracked.size === 0 && this.stopListening();
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
}) : () => {
|
|
@@ -304,35 +304,35 @@ class ue {
|
|
|
304
304
|
scheduleInitialUpdate(t, o) {
|
|
305
305
|
const n = this.tracked.get(t);
|
|
306
306
|
if (!n) return;
|
|
307
|
-
const
|
|
308
|
-
if (
|
|
309
|
-
if (
|
|
307
|
+
const r = n.callbacks.get(o);
|
|
308
|
+
if (r)
|
|
309
|
+
if (r.needsInitialDelay && n.delay && n.delay > 0) {
|
|
310
310
|
this.debug && console.log(
|
|
311
311
|
`[PositionTracker] Delaying initial position calculation for ${t} by ${n.delay}ms`
|
|
312
312
|
);
|
|
313
|
-
const
|
|
313
|
+
const a = setTimeout(() => {
|
|
314
314
|
this.debug && console.log(
|
|
315
315
|
`[PositionTracker] Calculating position for ${t} after delay`
|
|
316
316
|
);
|
|
317
317
|
const i = n.callbacks.get(o);
|
|
318
318
|
i && (i.needsInitialDelay = !1), n.delayTimeoutIds.delete(o), this.updatePositionForCallback(t, o);
|
|
319
319
|
}, n.delay);
|
|
320
|
-
n.delayTimeoutIds.set(o,
|
|
320
|
+
n.delayTimeoutIds.set(o, a);
|
|
321
321
|
} else
|
|
322
322
|
this.updatePositionForCallback(t, o);
|
|
323
323
|
}
|
|
324
324
|
updatePositionForCallback(t, o) {
|
|
325
325
|
const n = this.tracked.get(t);
|
|
326
326
|
if (!n) return;
|
|
327
|
-
const
|
|
328
|
-
if (!
|
|
327
|
+
const r = document.querySelector(n.selector);
|
|
328
|
+
if (!r) {
|
|
329
329
|
this.debug && console.log(`[PositionTracker] Element not found: ${n.selector}`), n.element = null, o(null);
|
|
330
330
|
return;
|
|
331
331
|
}
|
|
332
|
-
n.element =
|
|
333
|
-
const
|
|
332
|
+
n.element = r;
|
|
333
|
+
const a = r.getBoundingClientRect(), i = {
|
|
334
334
|
...N(
|
|
335
|
-
|
|
335
|
+
a,
|
|
336
336
|
n.position,
|
|
337
337
|
n.offset
|
|
338
338
|
),
|
|
@@ -350,14 +350,14 @@ class ue {
|
|
|
350
350
|
const n = document.querySelector(o.selector);
|
|
351
351
|
if (!n) {
|
|
352
352
|
this.debug && console.log(`[PositionTracker] Element not found: ${o.selector}`), o.element = null;
|
|
353
|
-
for (const [i] of o.callbacks)
|
|
354
|
-
i(null);
|
|
353
|
+
for (const [i, s] of o.callbacks)
|
|
354
|
+
s.needsInitialDelay || i(null);
|
|
355
355
|
return;
|
|
356
356
|
}
|
|
357
357
|
o.element = n;
|
|
358
|
-
const
|
|
358
|
+
const r = n.getBoundingClientRect(), a = {
|
|
359
359
|
...N(
|
|
360
|
-
|
|
360
|
+
r,
|
|
361
361
|
o.position,
|
|
362
362
|
o.offset
|
|
363
363
|
),
|
|
@@ -366,10 +366,10 @@ class ue {
|
|
|
366
366
|
};
|
|
367
367
|
this.debug && console.log(
|
|
368
368
|
`[PositionTracker] Updated position for ${o.selector}:`,
|
|
369
|
-
|
|
369
|
+
a
|
|
370
370
|
);
|
|
371
|
-
for (const [i] of o.callbacks)
|
|
372
|
-
i(
|
|
371
|
+
for (const [i, s] of o.callbacks)
|
|
372
|
+
s.needsInitialDelay || i(a);
|
|
373
373
|
}
|
|
374
374
|
updateAllPositions = () => {
|
|
375
375
|
for (const [t] of this.tracked)
|
|
@@ -407,20 +407,20 @@ function I() {
|
|
|
407
407
|
}
|
|
408
408
|
function me(e, t) {
|
|
409
409
|
const o = w(() => {
|
|
410
|
-
const i = t.trigger?.animations?.onRender,
|
|
411
|
-
return $(T(i,
|
|
410
|
+
const i = t.trigger?.animations?.onRender, s = e.trigger?.animations?.onRender;
|
|
411
|
+
return $(T(i, s));
|
|
412
412
|
}, [t.trigger?.animations, e.trigger?.animations]), n = w(() => {
|
|
413
|
-
const i = t.trigger?.animations?.onDismiss,
|
|
414
|
-
return $(T(i,
|
|
413
|
+
const i = t.trigger?.animations?.onDismiss, s = e.trigger?.animations?.onDismiss;
|
|
414
|
+
return $(T(i, s));
|
|
415
415
|
}, [
|
|
416
416
|
t.trigger?.animations?.onDismiss,
|
|
417
417
|
e.trigger?.animations?.onDismiss
|
|
418
|
-
]),
|
|
419
|
-
const i = t.popover?.animations?.onOpen,
|
|
420
|
-
return $(T(i,
|
|
421
|
-
}, [t.popover?.animations?.onOpen, e.popover?.animations?.onOpen]),
|
|
422
|
-
const i = t.popover?.animations?.onClose,
|
|
423
|
-
return $(T(i,
|
|
418
|
+
]), r = w(() => {
|
|
419
|
+
const i = t.popover?.animations?.onOpen, s = e.popover?.animations?.onOpen;
|
|
420
|
+
return $(T(i, s));
|
|
421
|
+
}, [t.popover?.animations?.onOpen, e.popover?.animations?.onOpen]), a = w(() => {
|
|
422
|
+
const i = t.popover?.animations?.onClose, s = e.popover?.animations?.onClose;
|
|
423
|
+
return $(T(i, s));
|
|
424
424
|
}, [
|
|
425
425
|
t.popover?.animations?.onClose,
|
|
426
426
|
e.popover?.animations?.onClose
|
|
@@ -428,8 +428,8 @@ function me(e, t) {
|
|
|
428
428
|
return {
|
|
429
429
|
triggerAnimation: o,
|
|
430
430
|
triggerDismissAnimation: n,
|
|
431
|
-
popoverOpenAnimation:
|
|
432
|
-
popoverCloseAnimation:
|
|
431
|
+
popoverOpenAnimation: r,
|
|
432
|
+
popoverCloseAnimation: a
|
|
433
433
|
};
|
|
434
434
|
}
|
|
435
435
|
function ge({
|
|
@@ -437,13 +437,13 @@ function ge({
|
|
|
437
437
|
position: t,
|
|
438
438
|
offset: o,
|
|
439
439
|
zIndex: n = 9999,
|
|
440
|
-
delay:
|
|
441
|
-
enabled:
|
|
440
|
+
delay: r,
|
|
441
|
+
enabled: a = !0,
|
|
442
442
|
debug: i = !1
|
|
443
443
|
}) {
|
|
444
|
-
const [
|
|
444
|
+
const [s, l] = k(null), c = w(() => new ue(i), [i]);
|
|
445
445
|
return B(() => {
|
|
446
|
-
if (!
|
|
446
|
+
if (!a) {
|
|
447
447
|
l(null);
|
|
448
448
|
return;
|
|
449
449
|
}
|
|
@@ -451,25 +451,25 @@ function ge({
|
|
|
451
451
|
e,
|
|
452
452
|
t,
|
|
453
453
|
l,
|
|
454
|
-
{ offset: o, zIndex: n, delay:
|
|
454
|
+
{ offset: o, zIndex: n, delay: r }
|
|
455
455
|
);
|
|
456
|
-
}, [c, e, t, o, n,
|
|
457
|
-
calculatedPosition:
|
|
458
|
-
targetElement:
|
|
456
|
+
}, [c, e, t, o, n, r, a]), B(() => () => c.destroy(), [c]), {
|
|
457
|
+
calculatedPosition: s,
|
|
458
|
+
targetElement: s ? document.querySelector(e) : null
|
|
459
459
|
};
|
|
460
460
|
}
|
|
461
461
|
function fe() {
|
|
462
462
|
const [e, t] = k(!1), [o, n] = k(
|
|
463
463
|
null
|
|
464
|
-
),
|
|
464
|
+
), r = A((l) => {
|
|
465
465
|
n(l);
|
|
466
|
-
}, []),
|
|
466
|
+
}, []), a = A(
|
|
467
467
|
() => o?.togglePopover(),
|
|
468
468
|
[o]
|
|
469
469
|
), i = A(
|
|
470
470
|
() => o?.showPopover(),
|
|
471
471
|
[o]
|
|
472
|
-
),
|
|
472
|
+
), s = A(
|
|
473
473
|
() => o?.hidePopover(),
|
|
474
474
|
[o]
|
|
475
475
|
);
|
|
@@ -482,10 +482,10 @@ function fe() {
|
|
|
482
482
|
}, [o]), {
|
|
483
483
|
isOpen: e,
|
|
484
484
|
popoverElement: o,
|
|
485
|
-
handlePopoverRef:
|
|
486
|
-
togglePopover:
|
|
485
|
+
handlePopoverRef: r,
|
|
486
|
+
togglePopover: a,
|
|
487
487
|
showPopover: i,
|
|
488
|
-
hidePopover:
|
|
488
|
+
hidePopover: s
|
|
489
489
|
};
|
|
490
490
|
}
|
|
491
491
|
function ve(e, t) {
|
|
@@ -518,14 +518,14 @@ function he(e, t) {
|
|
|
518
518
|
});
|
|
519
519
|
}
|
|
520
520
|
function ye(e, t) {
|
|
521
|
-
const o = e.trigger?.position || t.trigger?.position || ne, n = e.trigger?.zIndex || t.trigger?.zIndex || 9999,
|
|
521
|
+
const o = e.trigger?.position || t.trigger?.position || ne, n = e.trigger?.zIndex || t.trigger?.zIndex || 9999, r = e.trigger?.offset, a = e.trigger?.delay ?? t.trigger?.delay, i = e.popover?.position || t.popover?.position || o, s = e.popover?.offset || t.popover?.offset || { x: 0, y: 0 };
|
|
522
522
|
return {
|
|
523
523
|
position: o,
|
|
524
524
|
zIndex: n,
|
|
525
|
-
offset:
|
|
526
|
-
delay:
|
|
525
|
+
offset: r,
|
|
526
|
+
delay: a,
|
|
527
527
|
popoverPosition: i,
|
|
528
|
-
popoverOffset:
|
|
528
|
+
popoverOffset: s
|
|
529
529
|
};
|
|
530
530
|
}
|
|
531
531
|
function we({
|
|
@@ -533,32 +533,32 @@ function we({
|
|
|
533
533
|
config: t,
|
|
534
534
|
store: o,
|
|
535
535
|
onDismiss: n,
|
|
536
|
-
debug:
|
|
536
|
+
debug: r
|
|
537
537
|
}) {
|
|
538
|
-
const
|
|
538
|
+
const a = te(), [i, s] = k(!1), { position: l, zIndex: c, offset: d, delay: h, popoverPosition: p, popoverOffset: v } = ye(e, t), { calculatedPosition: u, targetElement: b } = ge({
|
|
539
539
|
targetSelector: e.selector,
|
|
540
540
|
position: l,
|
|
541
541
|
offset: d,
|
|
542
542
|
zIndex: c,
|
|
543
543
|
delay: h,
|
|
544
544
|
enabled: !0,
|
|
545
|
-
debug:
|
|
545
|
+
debug: r
|
|
546
546
|
}), {
|
|
547
547
|
isOpen: C,
|
|
548
548
|
popoverElement: P,
|
|
549
549
|
handlePopoverRef: y,
|
|
550
550
|
togglePopover: R,
|
|
551
551
|
showPopover: q,
|
|
552
|
-
hidePopover:
|
|
552
|
+
hidePopover: D
|
|
553
553
|
} = fe(), {
|
|
554
554
|
triggerAnimation: G,
|
|
555
|
-
triggerDismissAnimation:
|
|
555
|
+
triggerDismissAnimation: O,
|
|
556
556
|
popoverOpenAnimation: V,
|
|
557
557
|
popoverCloseAnimation: z
|
|
558
558
|
} = me(e, t), E = async () => {
|
|
559
|
-
|
|
559
|
+
s(!0), P?.hidePopover();
|
|
560
560
|
const K = le(
|
|
561
|
-
|
|
561
|
+
O,
|
|
562
562
|
z
|
|
563
563
|
);
|
|
564
564
|
await ce(K), await Promise.resolve(o.dismiss(e.id)), n();
|
|
@@ -572,15 +572,15 @@ function we({
|
|
|
572
572
|
isDismissing: i,
|
|
573
573
|
toggle: R,
|
|
574
574
|
open: q,
|
|
575
|
-
close:
|
|
575
|
+
close: D,
|
|
576
576
|
dismiss: E,
|
|
577
577
|
triggerAnimation: G,
|
|
578
|
-
triggerDismissAnimation:
|
|
578
|
+
triggerDismissAnimation: O,
|
|
579
579
|
popoverOpenAnimation: V,
|
|
580
580
|
popoverCloseAnimation: z,
|
|
581
|
-
popoverId:
|
|
581
|
+
popoverId: a
|
|
582
582
|
}, J = e.trigger?.component || t.trigger?.component, S = e.popover.component || t.popover?.component;
|
|
583
|
-
return !u || !b ? (
|
|
583
|
+
return !u || !b ? (r && console.warn(
|
|
584
584
|
`[Repere] ${e.id} waiting for target element: position=${!!u}, element=${!!b}`
|
|
585
585
|
), null) : S ? /* @__PURE__ */ Q(j.Provider, { value: H, children: [
|
|
586
586
|
ve(J, {
|
|
@@ -594,11 +594,11 @@ function we({
|
|
|
594
594
|
beacon: e,
|
|
595
595
|
position: l,
|
|
596
596
|
handleDismiss: E,
|
|
597
|
-
hidePopover:
|
|
597
|
+
hidePopover: D,
|
|
598
598
|
handlePopoverRef: y,
|
|
599
|
-
popoverId:
|
|
599
|
+
popoverId: a
|
|
600
600
|
})
|
|
601
|
-
] }) : (
|
|
601
|
+
] }) : (r && console.warn(
|
|
602
602
|
"[Repere] No popover component provided for beacon:",
|
|
603
603
|
e.id
|
|
604
604
|
), null);
|
|
@@ -609,28 +609,28 @@ function $e({
|
|
|
609
609
|
enabled: o = !0,
|
|
610
610
|
debug: n = !1
|
|
611
611
|
}) {
|
|
612
|
-
const
|
|
612
|
+
const r = w(
|
|
613
613
|
() => e.store || new ie(),
|
|
614
614
|
[e.store]
|
|
615
|
-
),
|
|
616
|
-
() => new de(
|
|
617
|
-
[
|
|
618
|
-
), [i,
|
|
615
|
+
), a = w(
|
|
616
|
+
() => new de(r, { debug: n }),
|
|
617
|
+
[r, n]
|
|
618
|
+
), [i, s] = k([]), [l, c] = k(
|
|
619
619
|
/* @__PURE__ */ new Set()
|
|
620
620
|
);
|
|
621
621
|
B(() => {
|
|
622
622
|
if (!o) {
|
|
623
|
-
|
|
623
|
+
s([]), c(/* @__PURE__ */ new Set());
|
|
624
624
|
return;
|
|
625
625
|
}
|
|
626
626
|
(async () => {
|
|
627
|
-
const v = await
|
|
627
|
+
const v = await a.getActiveBeacons(
|
|
628
628
|
e.pages,
|
|
629
629
|
t
|
|
630
630
|
);
|
|
631
|
-
|
|
631
|
+
s(v);
|
|
632
632
|
})();
|
|
633
|
-
}, [
|
|
633
|
+
}, [a, e.pages, t, o]);
|
|
634
634
|
const d = (p) => {
|
|
635
635
|
c((v) => /* @__PURE__ */ new Set([...v, p]));
|
|
636
636
|
}, h = i.filter(
|
|
@@ -642,7 +642,7 @@ function $e({
|
|
|
642
642
|
{
|
|
643
643
|
beacon: p,
|
|
644
644
|
config: e,
|
|
645
|
-
store:
|
|
645
|
+
store: r,
|
|
646
646
|
debug: n,
|
|
647
647
|
onDismiss: () => d(p.id)
|
|
648
648
|
},
|
|
@@ -658,10 +658,10 @@ const X = x(
|
|
|
658
658
|
popover: o = "auto",
|
|
659
659
|
disableAnimation: n,
|
|
660
660
|
// Destructure and discard internal props so they don't spread to DOM
|
|
661
|
-
beacon:
|
|
662
|
-
position:
|
|
661
|
+
beacon: r,
|
|
662
|
+
position: a,
|
|
663
663
|
onDismiss: i,
|
|
664
|
-
onClose:
|
|
664
|
+
onClose: s,
|
|
665
665
|
...l
|
|
666
666
|
}, c) => {
|
|
667
667
|
const {
|
|
@@ -707,17 +707,17 @@ const be = x(
|
|
|
707
707
|
onClick: t,
|
|
708
708
|
as: o,
|
|
709
709
|
...n
|
|
710
|
-
},
|
|
711
|
-
const
|
|
712
|
-
}),
|
|
710
|
+
}, r) => {
|
|
711
|
+
const a = I(), i = a?.dismiss || (() => {
|
|
712
|
+
}), s = a?.popoverId;
|
|
713
713
|
return /* @__PURE__ */ g(
|
|
714
714
|
o || "button",
|
|
715
715
|
{
|
|
716
|
-
ref:
|
|
716
|
+
ref: r,
|
|
717
717
|
onClick: (d) => {
|
|
718
718
|
i(), t?.(d);
|
|
719
719
|
},
|
|
720
|
-
popovertarget:
|
|
720
|
+
popovertarget: s,
|
|
721
721
|
popovertargetaction: "hide",
|
|
722
722
|
...n,
|
|
723
723
|
children: e
|
|
@@ -727,12 +727,12 @@ const be = x(
|
|
|
727
727
|
), xe = Object.assign(be, {
|
|
728
728
|
displayName: "ReperePopover.AcknowledgeButton"
|
|
729
729
|
}), Y = x(({ children: e = "×", ...t }, o) => {
|
|
730
|
-
const
|
|
730
|
+
const r = I()?.popoverId;
|
|
731
731
|
return /* @__PURE__ */ g(
|
|
732
732
|
"button",
|
|
733
733
|
{
|
|
734
734
|
ref: o,
|
|
735
|
-
popovertarget:
|
|
735
|
+
popovertarget: r,
|
|
736
736
|
popovertargetaction: "hide",
|
|
737
737
|
"aria-label": "Close",
|
|
738
738
|
...t,
|
|
@@ -751,8 +751,8 @@ const _ = x(
|
|
|
751
751
|
_.displayName = "ReperePopover.Footer";
|
|
752
752
|
const Pe = x(
|
|
753
753
|
({ children: e, as: t, ...o }, n) => {
|
|
754
|
-
const
|
|
755
|
-
return /* @__PURE__ */ g(t || "h3", { ref: n, id: `repere-popover-${
|
|
754
|
+
const a = I()?.beaconId || "unknown";
|
|
755
|
+
return /* @__PURE__ */ g(t || "h3", { ref: n, id: `repere-popover-${a}`, ...o, children: e });
|
|
756
756
|
}
|
|
757
757
|
), ke = Object.assign(Pe, {
|
|
758
758
|
displayName: "ReperePopover.Title"
|
|
@@ -768,11 +768,11 @@ const Pe = x(
|
|
|
768
768
|
as: t,
|
|
769
769
|
style: o,
|
|
770
770
|
disableAnimation: n,
|
|
771
|
-
...
|
|
772
|
-
},
|
|
771
|
+
...r
|
|
772
|
+
}, a) => {
|
|
773
773
|
const {
|
|
774
774
|
calculatedPosition: i,
|
|
775
|
-
beaconId:
|
|
775
|
+
beaconId: s,
|
|
776
776
|
triggerAnimation: l,
|
|
777
777
|
triggerDismissAnimation: c,
|
|
778
778
|
isDismissing: d,
|
|
@@ -786,13 +786,13 @@ const Pe = x(
|
|
|
786
786
|
zIndex: i.zIndex,
|
|
787
787
|
pointerEvents: "auto",
|
|
788
788
|
cursor: "pointer",
|
|
789
|
-
anchorName: `--repere-trigger-${
|
|
789
|
+
anchorName: `--repere-trigger-${s}`
|
|
790
790
|
}, b = o ? { ...u, ...o } : u, C = !n && (l || c), P = {
|
|
791
|
-
ref:
|
|
791
|
+
ref: a,
|
|
792
792
|
popovertarget: h,
|
|
793
|
-
"aria-label": `Beacon trigger for ${
|
|
793
|
+
"aria-label": `Beacon trigger for ${s}`,
|
|
794
794
|
"data-repere-trigger": "",
|
|
795
|
-
...
|
|
795
|
+
...r
|
|
796
796
|
};
|
|
797
797
|
if (C) {
|
|
798
798
|
const y = d && c ? c : l;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@repere/react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@repere/core": "0.1.
|
|
17
|
+
"@repere/core": "0.1.2"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"motion": "^12.0.0",
|