@repere/react 0.0.3 → 0.1.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.
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +641 -307
- package/dist/styles.css +1 -0
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export type * from '@repere/core';
|
|
2
|
+
export { Animation, Position } from '@repere/core';
|
|
1
3
|
export { Beacons, type BeaconsProps } from './components/Beacons';
|
|
2
4
|
export { ReperePopover } from './components/Popover';
|
|
3
5
|
export { RepereTrigger } from './components/RepereTrigger';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,YAAY,EACV,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,cAAc,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,YAAY,EACV,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,438 +1,772 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsx as g, jsxs as J } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as K, useContext as Q, useMemo as y, useState as C, useEffect as $, useCallback as A, isValidElement as N, cloneElement as W, useId as Z, forwardRef as b } from "react";
|
|
3
|
+
import { createPortal as ee } from "react-dom";
|
|
4
|
+
import { motion as M } from "motion/react";
|
|
5
|
+
var m = /* @__PURE__ */ ((e) => (e.TopLeft = "top-left", e.TopCenter = "top-center", e.TopRight = "top-right", e.RightCenter = "right-center", e.BottomRight = "bottom-right", e.BottomCenter = "bottom-center", e.BottomLeft = "bottom-left", e.LeftCenter = "left-center", e))(m || {});
|
|
6
|
+
const te = m.TopRight;
|
|
7
|
+
class oe {
|
|
8
|
+
state = /* @__PURE__ */ new Map();
|
|
9
|
+
isDismissed(t) {
|
|
10
|
+
return this.state.get(t)?.isDismissed ?? !1;
|
|
11
|
+
}
|
|
12
|
+
dismiss(t) {
|
|
13
|
+
this.state.set(t, {
|
|
14
|
+
id: t,
|
|
15
|
+
isDismissed: !0
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
reset(t) {
|
|
19
|
+
this.state.delete(t);
|
|
20
|
+
}
|
|
21
|
+
resetAll() {
|
|
22
|
+
this.state.clear();
|
|
23
|
+
}
|
|
24
|
+
getAll() {
|
|
25
|
+
return Array.from(this.state.values());
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
var v = /* @__PURE__ */ ((e) => (e.Fade = "fade", e.Scale = "scale", e.Grow = "grow", e.Shrink = "shrink", e.SlideUp = "slide-up", e.SlideDown = "slide-down", e.SlideLeft = "slide-left", e.SlideRight = "slide-right", e.None = "none", e))(v || {});
|
|
29
|
+
const ne = {
|
|
30
|
+
[v.SlideDown]: {
|
|
31
|
+
initial: { y: -20, opacity: 0 },
|
|
32
|
+
animate: { y: 0, opacity: 1 },
|
|
33
|
+
exit: { y: -20, opacity: 0 }
|
|
34
|
+
},
|
|
35
|
+
[v.SlideUp]: {
|
|
36
|
+
initial: { y: 20, opacity: 0 },
|
|
37
|
+
animate: { y: 0, opacity: 1 },
|
|
38
|
+
exit: { y: 20, opacity: 0 }
|
|
39
|
+
},
|
|
40
|
+
[v.SlideLeft]: {
|
|
41
|
+
initial: { x: 20, opacity: 0 },
|
|
42
|
+
animate: { x: 0, opacity: 1 },
|
|
43
|
+
exit: { x: 20, opacity: 0 }
|
|
44
|
+
},
|
|
45
|
+
[v.SlideRight]: {
|
|
46
|
+
initial: { x: -20, opacity: 0 },
|
|
47
|
+
animate: { x: 0, opacity: 1 },
|
|
48
|
+
exit: { x: -20, opacity: 0 }
|
|
49
|
+
},
|
|
50
|
+
[v.Fade]: {
|
|
51
|
+
initial: { opacity: 0 },
|
|
52
|
+
animate: { opacity: 1 },
|
|
53
|
+
exit: { opacity: 0 }
|
|
54
|
+
},
|
|
55
|
+
[v.Shrink]: {
|
|
56
|
+
initial: { scale: 1.1, opacity: 0 },
|
|
57
|
+
animate: { scale: 1, opacity: 1 },
|
|
58
|
+
exit: { scale: 0.9, opacity: 0 }
|
|
59
|
+
},
|
|
60
|
+
[v.Grow]: {
|
|
61
|
+
initial: { scale: 0.9, opacity: 0 },
|
|
62
|
+
animate: { scale: 1, opacity: 1 },
|
|
63
|
+
exit: { scale: 1.1, opacity: 0 }
|
|
64
|
+
},
|
|
65
|
+
[v.Scale]: {
|
|
66
|
+
initial: { scale: 0, opacity: 0 },
|
|
67
|
+
animate: { scale: 1, opacity: 1 },
|
|
68
|
+
exit: { scale: 0, opacity: 0 }
|
|
69
|
+
},
|
|
70
|
+
[v.None]: {
|
|
71
|
+
initial: {},
|
|
72
|
+
animate: {},
|
|
73
|
+
exit: {}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
function z(e) {
|
|
77
|
+
return e ? typeof e == "string" ? { variant: e } : e : null;
|
|
78
|
+
}
|
|
79
|
+
function L(e, t) {
|
|
80
|
+
const o = z(e), i = z(t);
|
|
81
|
+
return !o && !i ? null : o ? i ? {
|
|
82
|
+
variant: i.variant ?? o.variant,
|
|
83
|
+
duration: i.duration ?? o.duration,
|
|
84
|
+
delay: i.delay ?? o.delay,
|
|
85
|
+
ease: i.ease ?? o.ease
|
|
86
|
+
} : o : i;
|
|
87
|
+
}
|
|
88
|
+
function B(e) {
|
|
89
|
+
const t = z(e);
|
|
90
|
+
if (!t) return null;
|
|
91
|
+
const o = ne[t.variant];
|
|
92
|
+
return o ? {
|
|
93
|
+
variants: o,
|
|
94
|
+
transition: {
|
|
95
|
+
duration: (t.duration || 300) / 1e3,
|
|
96
|
+
// Convert ms to seconds
|
|
97
|
+
delay: (t.delay || 0) / 1e3,
|
|
98
|
+
ease: t.ease || [0.4, 0, 0.2, 1]
|
|
99
|
+
// cubic-bezier
|
|
100
|
+
}
|
|
101
|
+
} : (console.warn(`[Repere] Unknown animation variant: ${t.variant}`), null);
|
|
102
|
+
}
|
|
103
|
+
function ie(e, t) {
|
|
104
|
+
const o = (n) => {
|
|
105
|
+
const a = n.match(/(-?\d+)%/);
|
|
106
|
+
return a ? parseFloat(a[1]) : 0;
|
|
107
|
+
}, i = o(e.x), r = o(e.y), s = (n = 0) => r === 0 && n === 0 ? `translate(${i}%, 0)` : n === 0 ? `translate(${i}%, ${r}%)` : `translate(${i}%, calc(${r}% + ${n}px))`;
|
|
108
|
+
return {
|
|
109
|
+
initial: {
|
|
110
|
+
...t.initial,
|
|
111
|
+
transform: s(t.initial.y || 0)
|
|
112
|
+
},
|
|
113
|
+
animate: {
|
|
114
|
+
...t.animate,
|
|
115
|
+
transform: s(t.animate.y || 0)
|
|
116
|
+
},
|
|
117
|
+
exit: {
|
|
118
|
+
...t.exit,
|
|
119
|
+
transform: s(t.exit.y || 0)
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function se(e, t) {
|
|
124
|
+
if (!e && !t) return {};
|
|
125
|
+
const o = e?.variants, i = e?.transition, r = t?.variants, s = t?.transition, n = s?.ease ?? i?.ease ?? [0.4, 0, 0.2, 1], a = Array.isArray(n) ? `cubic-bezier(${n.join(", ")})` : n;
|
|
126
|
+
return {
|
|
127
|
+
// Initial state (when opening starts) - from onOpen animation
|
|
128
|
+
"--repere-initial-opacity": o?.initial.opacity ?? 0,
|
|
129
|
+
"--repere-initial-x": `${o?.initial.x ?? 0}px`,
|
|
130
|
+
"--repere-initial-y": `${o?.initial.y ?? 0}px`,
|
|
131
|
+
"--repere-initial-scale": o?.initial.scale ?? 1,
|
|
132
|
+
// Animate state (fully open) - from onOpen animation
|
|
133
|
+
"--repere-animate-opacity": o?.animate.opacity ?? 1,
|
|
134
|
+
"--repere-animate-x": `${o?.animate.x ?? 0}px`,
|
|
135
|
+
"--repere-animate-y": `${o?.animate.y ?? 0}px`,
|
|
136
|
+
"--repere-animate-scale": o?.animate.scale ?? 1,
|
|
137
|
+
// Exit state (when closing) - from onClose animation
|
|
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
|
+
// Transition timing
|
|
143
|
+
"--repere-transition-duration": `${s?.duration ?? i?.duration ?? 0.3}s`,
|
|
144
|
+
"--repere-transition-timing": a
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function re(e, t) {
|
|
148
|
+
const o = e?.transition.duration ?? 0, i = t?.transition.duration ?? 0;
|
|
149
|
+
return Math.max(o, i) * 1e3;
|
|
150
|
+
}
|
|
151
|
+
function ae(e) {
|
|
152
|
+
return new Promise((t) => setTimeout(t, e));
|
|
153
|
+
}
|
|
154
|
+
function le(e, t) {
|
|
155
|
+
if (t instanceof RegExp)
|
|
156
|
+
return t.test(e);
|
|
157
|
+
if (t === e)
|
|
158
|
+
return !0;
|
|
159
|
+
if (t.includes("*")) {
|
|
160
|
+
const o = t.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
|
|
161
|
+
return new RegExp(`^${o}$`).test(e);
|
|
162
|
+
}
|
|
163
|
+
return !1;
|
|
164
|
+
}
|
|
165
|
+
class ce {
|
|
166
|
+
store;
|
|
167
|
+
debug;
|
|
168
|
+
constructor(t, o = {}) {
|
|
169
|
+
this.store = t, this.debug = o.debug ?? !1;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Find all pages that match the current path
|
|
173
|
+
* This supports wildcards - e.g., path="*" will match all pages
|
|
174
|
+
*/
|
|
175
|
+
findMatchingPages(t, o) {
|
|
176
|
+
const i = t.filter((r) => typeof r.path == "function" ? r.path(o) : le(o, r.path));
|
|
177
|
+
return this.debug && console.log(
|
|
178
|
+
"[BeaconManager] Path:",
|
|
179
|
+
o,
|
|
180
|
+
"Matched pages:",
|
|
181
|
+
i.map((r) => r.id).join(", ") || "none"
|
|
182
|
+
), i;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Get all active (non-dismissed) beacons for the current path
|
|
186
|
+
* Includes beacons from all matching pages (supports wildcards)
|
|
187
|
+
*/
|
|
188
|
+
async getActiveBeacons(t, o) {
|
|
189
|
+
const i = this.findMatchingPages(t, o);
|
|
190
|
+
if (i.length === 0)
|
|
191
|
+
return this.debug && console.log("[BeaconManager] No matching pages found"), [];
|
|
192
|
+
this.debug && console.log(
|
|
193
|
+
"[BeaconManager] Found",
|
|
194
|
+
i.length,
|
|
195
|
+
"matching page(s):",
|
|
196
|
+
i.map((a) => a.id).join(", ")
|
|
197
|
+
);
|
|
198
|
+
const r = [], s = /* @__PURE__ */ new Set();
|
|
199
|
+
for (const a of i)
|
|
200
|
+
for (const l of a.beacons) {
|
|
201
|
+
if (s.has(l.id)) {
|
|
202
|
+
this.debug && console.warn(
|
|
203
|
+
`[BeaconManager] Duplicate beacon ID "${l.id}" in page "${a.id}", skipping`
|
|
204
|
+
);
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
s.add(l.id), r.push(l);
|
|
208
|
+
}
|
|
209
|
+
const n = [];
|
|
210
|
+
for (const a of r)
|
|
211
|
+
await Promise.resolve(
|
|
212
|
+
this.store.isDismissed(a.id)
|
|
213
|
+
) ? this.debug && console.log("[BeaconManager] Beacon", a.id, "is dismissed") : n.push(a);
|
|
214
|
+
return this.debug && console.log("[BeaconManager] Active beacons:", n.length), n;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Get the store instance
|
|
218
|
+
*/
|
|
219
|
+
getStore() {
|
|
220
|
+
return this.store;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function pe(e, t = m.TopRight, o = { x: 0, y: 0 }) {
|
|
224
|
+
const { x: i = 0, y: r = 0 } = o;
|
|
225
|
+
let s = 0, n = 0, a = "0", l = "0";
|
|
226
|
+
switch (t) {
|
|
227
|
+
// Top positions
|
|
228
|
+
case m.TopLeft:
|
|
229
|
+
s = e.top + window.scrollY, n = e.left + window.scrollX, a = "-50%", l = "-100%";
|
|
230
|
+
break;
|
|
231
|
+
case m.TopCenter:
|
|
232
|
+
s = e.top + window.scrollY, n = e.left + window.scrollX + e.width / 2, a = "-50%", l = "-100%";
|
|
233
|
+
break;
|
|
234
|
+
case m.TopRight:
|
|
235
|
+
s = e.top + window.scrollY, n = e.right + window.scrollX, a = "-50%", l = "-100%";
|
|
236
|
+
break;
|
|
237
|
+
// Right positions
|
|
238
|
+
case m.RightCenter:
|
|
239
|
+
s = e.top + window.scrollY + e.height / 2, n = e.right + window.scrollX, a = "0", l = "-50%";
|
|
240
|
+
break;
|
|
241
|
+
// Bottom positions
|
|
242
|
+
case m.BottomLeft:
|
|
243
|
+
s = e.bottom + window.scrollY, n = e.left + window.scrollX, a = "-50%", l = "0";
|
|
244
|
+
break;
|
|
245
|
+
case m.BottomCenter:
|
|
246
|
+
s = e.bottom + window.scrollY, n = e.left + window.scrollX + e.width / 2, a = "-50%", l = "0";
|
|
247
|
+
break;
|
|
248
|
+
case m.BottomRight:
|
|
249
|
+
s = e.bottom + window.scrollY, n = e.right + window.scrollX, a = "-50%", l = "0";
|
|
250
|
+
break;
|
|
251
|
+
// Left positions
|
|
252
|
+
case m.LeftCenter:
|
|
253
|
+
s = e.top + window.scrollY + e.height / 2, n = e.left + window.scrollX, a = "-100%", l = "-50%";
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
return s += r, n += i, {
|
|
257
|
+
top: s,
|
|
258
|
+
left: n,
|
|
259
|
+
translate: { x: a, y: l }
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
class de {
|
|
263
|
+
tracked = /* @__PURE__ */ new Map();
|
|
264
|
+
scrollListener = null;
|
|
265
|
+
resizeListener = null;
|
|
266
|
+
resizeObserver = null;
|
|
267
|
+
mutationObserver = null;
|
|
268
|
+
debug = !1;
|
|
269
|
+
constructor(t = !1) {
|
|
270
|
+
this.debug = t;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Subscribe to position updates for an element
|
|
274
|
+
*/
|
|
275
|
+
subscribe(t, o, i, r = {}) {
|
|
276
|
+
const s = t;
|
|
277
|
+
return this.tracked.has(s) || this.tracked.set(s, {
|
|
278
|
+
selector: t,
|
|
279
|
+
position: o,
|
|
280
|
+
offset: r.offset,
|
|
281
|
+
zIndex: r.zIndex ?? 9999,
|
|
282
|
+
callbacks: /* @__PURE__ */ new Set(),
|
|
283
|
+
element: null
|
|
284
|
+
}), this.tracked.get(s)?.callbacks.add(i), this.tracked.size === 1 && this.startListening(), this.updatePosition(s), () => {
|
|
285
|
+
const n = this.tracked.get(s);
|
|
286
|
+
n && (n.callbacks.delete(i), n.callbacks.size === 0 && (this.tracked.delete(s), this.tracked.size === 0 && this.stopListening()));
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
updatePosition(t) {
|
|
290
|
+
const o = this.tracked.get(t);
|
|
291
|
+
if (!o) return;
|
|
292
|
+
const i = document.querySelector(o.selector);
|
|
293
|
+
if (!i) {
|
|
294
|
+
this.debug && console.log(`[PositionTracker] Element not found: ${o.selector}`), o.element = null;
|
|
295
|
+
for (const n of o.callbacks)
|
|
296
|
+
n(null);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
o.element = i;
|
|
300
|
+
const r = i.getBoundingClientRect(), s = {
|
|
301
|
+
...pe(
|
|
302
|
+
r,
|
|
303
|
+
o.position,
|
|
304
|
+
o.offset
|
|
305
|
+
),
|
|
306
|
+
position: "fixed",
|
|
307
|
+
zIndex: o.zIndex
|
|
308
|
+
};
|
|
309
|
+
this.debug && console.log(
|
|
310
|
+
`[PositionTracker] Updated position for ${o.selector}:`,
|
|
311
|
+
s
|
|
312
|
+
);
|
|
313
|
+
for (const n of o.callbacks)
|
|
314
|
+
n(s);
|
|
315
|
+
}
|
|
316
|
+
updateAllPositions = () => {
|
|
317
|
+
for (const [t] of this.tracked)
|
|
318
|
+
this.updatePosition(t);
|
|
319
|
+
};
|
|
320
|
+
startListening() {
|
|
321
|
+
this.scrollListener = this.updateAllPositions, window.addEventListener("scroll", this.scrollListener, !0), this.resizeListener = this.updateAllPositions, window.addEventListener("resize", this.resizeListener), "ResizeObserver" in window && (this.resizeObserver = new ResizeObserver(this.updateAllPositions)), this.mutationObserver = new MutationObserver(() => {
|
|
322
|
+
this.updateAllPositions();
|
|
323
|
+
}), this.mutationObserver.observe(document.body, {
|
|
324
|
+
childList: !0,
|
|
325
|
+
subtree: !0
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
stopListening() {
|
|
329
|
+
this.scrollListener && (window.removeEventListener("scroll", this.scrollListener, !0), this.scrollListener = null), this.resizeListener && (window.removeEventListener("resize", this.resizeListener), this.resizeListener = null), this.resizeObserver?.disconnect(), this.resizeObserver = null, this.mutationObserver?.disconnect(), this.mutationObserver = null;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Clean up all listeners and subscriptions
|
|
333
|
+
*/
|
|
334
|
+
destroy() {
|
|
335
|
+
this.stopListening(), this.tracked.clear();
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
const j = K(null);
|
|
339
|
+
function k() {
|
|
340
|
+
const e = Q(j);
|
|
341
|
+
if (!e)
|
|
10
342
|
throw new Error("useRepereContext must be used within a Repere provider.");
|
|
11
|
-
return
|
|
343
|
+
return e;
|
|
12
344
|
}
|
|
13
|
-
function
|
|
14
|
-
const
|
|
15
|
-
const n =
|
|
16
|
-
return
|
|
17
|
-
}, [
|
|
18
|
-
const n =
|
|
19
|
-
return
|
|
345
|
+
function ue(e, t) {
|
|
346
|
+
const o = y(() => {
|
|
347
|
+
const n = t.trigger?.animations?.onRender, a = e.trigger?.animations?.onRender;
|
|
348
|
+
return B(L(n, a));
|
|
349
|
+
}, [t.trigger?.animations, e.trigger?.animations]), i = y(() => {
|
|
350
|
+
const n = t.trigger?.animations?.onDismiss, a = e.trigger?.animations?.onDismiss;
|
|
351
|
+
return B(L(n, a));
|
|
20
352
|
}, [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
]),
|
|
24
|
-
const n =
|
|
25
|
-
return
|
|
26
|
-
}, [
|
|
27
|
-
const n =
|
|
28
|
-
return
|
|
353
|
+
t.trigger?.animations?.onDismiss,
|
|
354
|
+
e.trigger?.animations?.onDismiss
|
|
355
|
+
]), r = y(() => {
|
|
356
|
+
const n = t.popover?.animations?.onOpen, a = e.popover?.animations?.onOpen;
|
|
357
|
+
return B(L(n, a));
|
|
358
|
+
}, [t.popover?.animations?.onOpen, e.popover?.animations?.onOpen]), s = y(() => {
|
|
359
|
+
const n = t.popover?.animations?.onClose, a = e.popover?.animations?.onClose;
|
|
360
|
+
return B(L(n, a));
|
|
29
361
|
}, [
|
|
30
|
-
|
|
31
|
-
|
|
362
|
+
t.popover?.animations?.onClose,
|
|
363
|
+
e.popover?.animations?.onClose
|
|
32
364
|
]);
|
|
33
365
|
return {
|
|
34
|
-
triggerAnimation:
|
|
35
|
-
triggerDismissAnimation:
|
|
36
|
-
popoverOpenAnimation:
|
|
37
|
-
popoverCloseAnimation:
|
|
366
|
+
triggerAnimation: o,
|
|
367
|
+
triggerDismissAnimation: i,
|
|
368
|
+
popoverOpenAnimation: r,
|
|
369
|
+
popoverCloseAnimation: s
|
|
38
370
|
};
|
|
39
371
|
}
|
|
40
|
-
function
|
|
41
|
-
targetSelector:
|
|
42
|
-
position:
|
|
43
|
-
offset:
|
|
44
|
-
zIndex:
|
|
45
|
-
enabled:
|
|
46
|
-
debug:
|
|
372
|
+
function me({
|
|
373
|
+
targetSelector: e,
|
|
374
|
+
position: t,
|
|
375
|
+
offset: o,
|
|
376
|
+
zIndex: i = 9999,
|
|
377
|
+
enabled: r = !0,
|
|
378
|
+
debug: s = !1
|
|
47
379
|
}) {
|
|
48
|
-
const [n,
|
|
49
|
-
return
|
|
50
|
-
if (!
|
|
51
|
-
|
|
380
|
+
const [n, a] = C(null), l = y(() => new de(s), [s]);
|
|
381
|
+
return $(() => {
|
|
382
|
+
if (!r) {
|
|
383
|
+
a(null);
|
|
52
384
|
return;
|
|
53
385
|
}
|
|
54
|
-
return
|
|
55
|
-
o,
|
|
386
|
+
return l.subscribe(
|
|
56
387
|
e,
|
|
57
|
-
|
|
58
|
-
|
|
388
|
+
t,
|
|
389
|
+
a,
|
|
390
|
+
{ offset: o, zIndex: i }
|
|
59
391
|
);
|
|
60
|
-
}, [
|
|
392
|
+
}, [l, e, t, o, i, r]), $(() => () => l.destroy(), [l]), {
|
|
61
393
|
calculatedPosition: n,
|
|
62
|
-
targetElement: n ? document.querySelector(
|
|
394
|
+
targetElement: n ? document.querySelector(e) : null
|
|
63
395
|
};
|
|
64
396
|
}
|
|
65
|
-
function
|
|
66
|
-
const [
|
|
397
|
+
function ge() {
|
|
398
|
+
const [e, t] = C(!1), [o, i] = C(
|
|
67
399
|
null
|
|
68
|
-
),
|
|
69
|
-
|
|
70
|
-
}, []),
|
|
71
|
-
() =>
|
|
72
|
-
[
|
|
73
|
-
), n =
|
|
74
|
-
() =>
|
|
75
|
-
[
|
|
76
|
-
),
|
|
77
|
-
() =>
|
|
78
|
-
[
|
|
400
|
+
), r = A((l) => {
|
|
401
|
+
i(l);
|
|
402
|
+
}, []), s = A(
|
|
403
|
+
() => o?.togglePopover(),
|
|
404
|
+
[o]
|
|
405
|
+
), n = A(
|
|
406
|
+
() => o?.showPopover(),
|
|
407
|
+
[o]
|
|
408
|
+
), a = A(
|
|
409
|
+
() => o?.hidePopover(),
|
|
410
|
+
[o]
|
|
79
411
|
);
|
|
80
|
-
return
|
|
81
|
-
if (!
|
|
82
|
-
const
|
|
83
|
-
|
|
412
|
+
return $(() => {
|
|
413
|
+
if (!o) return;
|
|
414
|
+
const l = (c) => {
|
|
415
|
+
t(c.newState === "open");
|
|
84
416
|
};
|
|
85
|
-
return
|
|
86
|
-
}, [
|
|
87
|
-
isOpen:
|
|
88
|
-
popoverElement:
|
|
89
|
-
handlePopoverRef:
|
|
90
|
-
togglePopover:
|
|
417
|
+
return o.addEventListener("toggle", l), () => o.removeEventListener("toggle", l);
|
|
418
|
+
}, [o]), {
|
|
419
|
+
isOpen: e,
|
|
420
|
+
popoverElement: o,
|
|
421
|
+
handlePopoverRef: r,
|
|
422
|
+
togglePopover: s,
|
|
91
423
|
showPopover: n,
|
|
92
|
-
hidePopover:
|
|
424
|
+
hidePopover: a
|
|
93
425
|
};
|
|
94
426
|
}
|
|
95
|
-
function
|
|
96
|
-
return
|
|
97
|
-
|
|
427
|
+
function ve(e, t) {
|
|
428
|
+
return e ? N(e) ? e : /* @__PURE__ */ g(
|
|
429
|
+
e,
|
|
98
430
|
{
|
|
99
|
-
beacon:
|
|
100
|
-
style:
|
|
101
|
-
position:
|
|
102
|
-
isOpen:
|
|
103
|
-
onClick:
|
|
431
|
+
beacon: t.beacon,
|
|
432
|
+
style: t.calculatedPosition,
|
|
433
|
+
position: t.position,
|
|
434
|
+
isOpen: t.isOpen,
|
|
435
|
+
onClick: t.togglePopover
|
|
104
436
|
}
|
|
105
437
|
) : null;
|
|
106
438
|
}
|
|
107
|
-
function
|
|
108
|
-
let
|
|
109
|
-
return
|
|
110
|
-
|
|
439
|
+
function he(e, t) {
|
|
440
|
+
let o;
|
|
441
|
+
return N(e) ? o = e : o = /* @__PURE__ */ g(
|
|
442
|
+
e,
|
|
111
443
|
{
|
|
112
|
-
beacon:
|
|
113
|
-
position:
|
|
114
|
-
onDismiss:
|
|
115
|
-
onClose:
|
|
444
|
+
beacon: t.beacon,
|
|
445
|
+
position: t.position,
|
|
446
|
+
onDismiss: t.handleDismiss,
|
|
447
|
+
onClose: t.hidePopover
|
|
116
448
|
}
|
|
117
|
-
),
|
|
449
|
+
), W(o, {
|
|
118
450
|
// @ts-expect-error - cloneElement ref typing doesn't handle callback refs properly
|
|
119
|
-
ref:
|
|
120
|
-
id:
|
|
451
|
+
ref: t.handlePopoverRef,
|
|
452
|
+
id: t.popoverId,
|
|
121
453
|
popover: "auto"
|
|
122
454
|
});
|
|
123
455
|
}
|
|
124
|
-
function
|
|
125
|
-
const
|
|
456
|
+
function fe(e, t) {
|
|
457
|
+
const o = e.trigger?.position || t.trigger?.position || te, i = e.trigger?.zIndex || t.trigger?.zIndex || 9999, r = e.trigger?.offset, s = e.popover?.position || t.popover?.position || o, n = e.popover?.offset || t.popover?.offset || { x: 0, y: 0 };
|
|
126
458
|
return {
|
|
127
|
-
position:
|
|
128
|
-
zIndex:
|
|
129
|
-
offset:
|
|
130
|
-
popoverPosition:
|
|
459
|
+
position: o,
|
|
460
|
+
zIndex: i,
|
|
461
|
+
offset: r,
|
|
462
|
+
popoverPosition: s,
|
|
131
463
|
popoverOffset: n
|
|
132
464
|
};
|
|
133
465
|
}
|
|
134
|
-
function
|
|
135
|
-
beacon:
|
|
136
|
-
config:
|
|
137
|
-
store:
|
|
138
|
-
onDismiss:
|
|
139
|
-
debug:
|
|
466
|
+
function we({
|
|
467
|
+
beacon: e,
|
|
468
|
+
config: t,
|
|
469
|
+
store: o,
|
|
470
|
+
onDismiss: i,
|
|
471
|
+
debug: r
|
|
140
472
|
}) {
|
|
141
|
-
const
|
|
142
|
-
targetSelector:
|
|
143
|
-
position:
|
|
144
|
-
offset:
|
|
473
|
+
const s = Z(), [n, a] = C(!1), { position: l, zIndex: c, offset: d, popoverPosition: w, popoverOffset: p } = fe(e, t), { calculatedPosition: u, targetElement: h } = me({
|
|
474
|
+
targetSelector: e.selector,
|
|
475
|
+
position: l,
|
|
476
|
+
offset: d,
|
|
145
477
|
zIndex: c,
|
|
146
478
|
enabled: !0,
|
|
147
|
-
debug:
|
|
479
|
+
debug: r
|
|
148
480
|
}), {
|
|
149
|
-
isOpen:
|
|
481
|
+
isOpen: x,
|
|
150
482
|
popoverElement: R,
|
|
151
|
-
handlePopoverRef:
|
|
152
|
-
togglePopover:
|
|
153
|
-
showPopover:
|
|
154
|
-
hidePopover:
|
|
155
|
-
} =
|
|
156
|
-
triggerAnimation:
|
|
157
|
-
triggerDismissAnimation:
|
|
158
|
-
popoverOpenAnimation:
|
|
159
|
-
popoverCloseAnimation:
|
|
160
|
-
} =
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
483
|
+
handlePopoverRef: P,
|
|
484
|
+
togglePopover: f,
|
|
485
|
+
showPopover: O,
|
|
486
|
+
hidePopover: I
|
|
487
|
+
} = ge(), {
|
|
488
|
+
triggerAnimation: _,
|
|
489
|
+
triggerDismissAnimation: D,
|
|
490
|
+
popoverOpenAnimation: G,
|
|
491
|
+
popoverCloseAnimation: T
|
|
492
|
+
} = ue(e, t), E = async () => {
|
|
493
|
+
a(!0), R?.hidePopover();
|
|
494
|
+
const H = re(
|
|
495
|
+
D,
|
|
496
|
+
T
|
|
165
497
|
);
|
|
166
|
-
await
|
|
167
|
-
},
|
|
168
|
-
beaconId:
|
|
169
|
-
position:
|
|
170
|
-
popoverPosition:
|
|
171
|
-
popoverOffset:
|
|
172
|
-
calculatedPosition:
|
|
173
|
-
isOpen:
|
|
498
|
+
await ae(H), await Promise.resolve(o.dismiss(e.id)), i();
|
|
499
|
+
}, V = {
|
|
500
|
+
beaconId: e.id,
|
|
501
|
+
position: l,
|
|
502
|
+
popoverPosition: w,
|
|
503
|
+
popoverOffset: p,
|
|
504
|
+
calculatedPosition: u,
|
|
505
|
+
isOpen: x,
|
|
174
506
|
isDismissing: n,
|
|
175
|
-
toggle:
|
|
176
|
-
open:
|
|
177
|
-
close:
|
|
178
|
-
dismiss:
|
|
179
|
-
triggerAnimation:
|
|
180
|
-
triggerDismissAnimation:
|
|
181
|
-
popoverOpenAnimation:
|
|
182
|
-
popoverCloseAnimation:
|
|
183
|
-
popoverId:
|
|
184
|
-
},
|
|
185
|
-
return !
|
|
186
|
-
`[Repere] ${
|
|
187
|
-
), null) :
|
|
188
|
-
|
|
189
|
-
beacon:
|
|
190
|
-
calculatedPosition:
|
|
191
|
-
position:
|
|
192
|
-
isOpen:
|
|
193
|
-
togglePopover:
|
|
507
|
+
toggle: f,
|
|
508
|
+
open: O,
|
|
509
|
+
close: I,
|
|
510
|
+
dismiss: E,
|
|
511
|
+
triggerAnimation: _,
|
|
512
|
+
triggerDismissAnimation: D,
|
|
513
|
+
popoverOpenAnimation: G,
|
|
514
|
+
popoverCloseAnimation: T,
|
|
515
|
+
popoverId: s
|
|
516
|
+
}, q = e.trigger?.component || t.trigger?.component, S = e.popover.component || t.popover?.component;
|
|
517
|
+
return !u || !h ? (r && console.warn(
|
|
518
|
+
`[Repere] ${e.id} waiting for target element: position=${!!u}, element=${!!h}`
|
|
519
|
+
), null) : S ? /* @__PURE__ */ J(j.Provider, { value: V, children: [
|
|
520
|
+
ve(q, {
|
|
521
|
+
beacon: e,
|
|
522
|
+
calculatedPosition: u,
|
|
523
|
+
position: l,
|
|
524
|
+
isOpen: x,
|
|
525
|
+
togglePopover: f
|
|
194
526
|
}),
|
|
195
|
-
|
|
196
|
-
beacon:
|
|
197
|
-
position:
|
|
198
|
-
handleDismiss:
|
|
199
|
-
hidePopover:
|
|
200
|
-
handlePopoverRef:
|
|
201
|
-
popoverId:
|
|
527
|
+
he(S, {
|
|
528
|
+
beacon: e,
|
|
529
|
+
position: l,
|
|
530
|
+
handleDismiss: E,
|
|
531
|
+
hidePopover: I,
|
|
532
|
+
handlePopoverRef: P,
|
|
533
|
+
popoverId: s
|
|
202
534
|
})
|
|
203
|
-
] }) : (
|
|
535
|
+
] }) : (r && console.warn(
|
|
204
536
|
"[Repere] No popover component provided for beacon:",
|
|
205
|
-
|
|
537
|
+
e.id
|
|
206
538
|
), null);
|
|
207
539
|
}
|
|
208
|
-
function
|
|
209
|
-
config:
|
|
210
|
-
currentPath:
|
|
211
|
-
enabled:
|
|
212
|
-
debug:
|
|
540
|
+
function Be({
|
|
541
|
+
config: e,
|
|
542
|
+
currentPath: t,
|
|
543
|
+
enabled: o = !0,
|
|
544
|
+
debug: i = !1
|
|
213
545
|
}) {
|
|
214
|
-
const
|
|
215
|
-
() =>
|
|
216
|
-
[
|
|
217
|
-
),
|
|
218
|
-
() => new
|
|
219
|
-
[
|
|
220
|
-
), [n,
|
|
546
|
+
const r = y(
|
|
547
|
+
() => e.store || new oe(),
|
|
548
|
+
[e.store]
|
|
549
|
+
), s = y(
|
|
550
|
+
() => new ce(r, { debug: i }),
|
|
551
|
+
[r, i]
|
|
552
|
+
), [n, a] = C([]), [l, c] = C(
|
|
221
553
|
/* @__PURE__ */ new Set()
|
|
222
554
|
);
|
|
223
|
-
|
|
224
|
-
if (!
|
|
225
|
-
|
|
555
|
+
$(() => {
|
|
556
|
+
if (!o) {
|
|
557
|
+
a([]), c(/* @__PURE__ */ new Set());
|
|
226
558
|
return;
|
|
227
559
|
}
|
|
228
560
|
(async () => {
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
|
|
561
|
+
const u = await s.getActiveBeacons(
|
|
562
|
+
e.pages,
|
|
563
|
+
t
|
|
232
564
|
);
|
|
233
|
-
|
|
565
|
+
a(u);
|
|
234
566
|
})();
|
|
235
|
-
}, [
|
|
236
|
-
const
|
|
237
|
-
c((
|
|
238
|
-
},
|
|
239
|
-
(
|
|
567
|
+
}, [s, e.pages, t, o]);
|
|
568
|
+
const d = (p) => {
|
|
569
|
+
c((u) => /* @__PURE__ */ new Set([...u, p]));
|
|
570
|
+
}, w = n.filter(
|
|
571
|
+
(p) => !l.has(p.id)
|
|
240
572
|
);
|
|
241
|
-
return
|
|
242
|
-
|
|
243
|
-
|
|
573
|
+
return w.length === 0 ? null : ee(
|
|
574
|
+
w.map((p) => /* @__PURE__ */ g(
|
|
575
|
+
we,
|
|
244
576
|
{
|
|
245
|
-
beacon:
|
|
246
|
-
config:
|
|
247
|
-
store:
|
|
248
|
-
debug:
|
|
249
|
-
onDismiss: () =>
|
|
577
|
+
beacon: p,
|
|
578
|
+
config: e,
|
|
579
|
+
store: r,
|
|
580
|
+
debug: i,
|
|
581
|
+
onDismiss: () => d(p.id)
|
|
250
582
|
},
|
|
251
|
-
|
|
583
|
+
p.id
|
|
252
584
|
)),
|
|
253
585
|
document.body
|
|
254
586
|
);
|
|
255
587
|
}
|
|
256
|
-
const
|
|
588
|
+
const X = b(
|
|
257
589
|
({
|
|
258
|
-
children:
|
|
259
|
-
style:
|
|
260
|
-
popover:
|
|
261
|
-
disableAnimation:
|
|
590
|
+
children: e,
|
|
591
|
+
style: t,
|
|
592
|
+
popover: o = "auto",
|
|
593
|
+
disableAnimation: i,
|
|
262
594
|
// Destructure and discard internal props so they don't spread to DOM
|
|
263
|
-
beacon:
|
|
264
|
-
position:
|
|
595
|
+
beacon: r,
|
|
596
|
+
position: s,
|
|
265
597
|
onDismiss: n,
|
|
266
|
-
onClose:
|
|
267
|
-
...
|
|
598
|
+
onClose: a,
|
|
599
|
+
...l
|
|
268
600
|
}, c) => {
|
|
269
601
|
const {
|
|
270
|
-
beaconId:
|
|
271
|
-
popoverOpenAnimation:
|
|
272
|
-
popoverCloseAnimation:
|
|
273
|
-
popoverPosition:
|
|
274
|
-
popoverOffset:
|
|
275
|
-
} =
|
|
276
|
-
(
|
|
277
|
-
typeof c == "function" ? c(
|
|
602
|
+
beaconId: d,
|
|
603
|
+
popoverOpenAnimation: w,
|
|
604
|
+
popoverCloseAnimation: p,
|
|
605
|
+
popoverPosition: u,
|
|
606
|
+
popoverOffset: h
|
|
607
|
+
} = k(), x = A(
|
|
608
|
+
(f) => {
|
|
609
|
+
typeof c == "function" ? c(f) : c && (c.current = f);
|
|
278
610
|
},
|
|
279
611
|
[c]
|
|
280
|
-
),
|
|
281
|
-
positionAnchor:
|
|
282
|
-
...
|
|
283
|
-
marginLeft:
|
|
284
|
-
marginTop:
|
|
612
|
+
), P = {
|
|
613
|
+
positionAnchor: d ? `--repere-trigger-${d}` : void 0,
|
|
614
|
+
...h && {
|
|
615
|
+
marginLeft: h.x || 0,
|
|
616
|
+
marginTop: h.y || 0
|
|
285
617
|
},
|
|
286
|
-
...
|
|
287
|
-
...
|
|
618
|
+
...se(w, p),
|
|
619
|
+
...t
|
|
288
620
|
};
|
|
289
|
-
return /* @__PURE__ */
|
|
621
|
+
return /* @__PURE__ */ g(
|
|
290
622
|
"div",
|
|
291
623
|
{
|
|
292
|
-
ref:
|
|
624
|
+
ref: x,
|
|
293
625
|
role: "dialog",
|
|
294
|
-
"aria-labelledby": `repere-popover-${
|
|
626
|
+
"aria-labelledby": `repere-popover-${d}`,
|
|
295
627
|
"data-repere-popover": "",
|
|
296
|
-
"data-position":
|
|
297
|
-
popover:
|
|
298
|
-
...
|
|
299
|
-
style:
|
|
300
|
-
children:
|
|
628
|
+
"data-position": u,
|
|
629
|
+
popover: o,
|
|
630
|
+
...l,
|
|
631
|
+
style: P,
|
|
632
|
+
children: e
|
|
301
633
|
}
|
|
302
634
|
);
|
|
303
635
|
}
|
|
304
636
|
);
|
|
305
|
-
|
|
306
|
-
const
|
|
637
|
+
X.displayName = "ReperePopover";
|
|
638
|
+
const ye = b(
|
|
307
639
|
({
|
|
308
|
-
children:
|
|
309
|
-
onClick:
|
|
310
|
-
as:
|
|
311
|
-
...
|
|
312
|
-
},
|
|
313
|
-
const
|
|
314
|
-
}),
|
|
315
|
-
return /* @__PURE__ */
|
|
316
|
-
|
|
640
|
+
children: e = "Got it",
|
|
641
|
+
onClick: t,
|
|
642
|
+
as: o,
|
|
643
|
+
...i
|
|
644
|
+
}, r) => {
|
|
645
|
+
const s = k(), n = s?.dismiss || (() => {
|
|
646
|
+
}), a = s?.popoverId;
|
|
647
|
+
return /* @__PURE__ */ g(
|
|
648
|
+
o || "button",
|
|
317
649
|
{
|
|
318
|
-
ref:
|
|
319
|
-
onClick: (
|
|
320
|
-
n(),
|
|
650
|
+
ref: r,
|
|
651
|
+
onClick: (d) => {
|
|
652
|
+
n(), t?.(d);
|
|
321
653
|
},
|
|
322
|
-
popovertarget:
|
|
654
|
+
popovertarget: a,
|
|
323
655
|
popovertargetaction: "hide",
|
|
324
|
-
...
|
|
325
|
-
children:
|
|
656
|
+
...i,
|
|
657
|
+
children: e
|
|
326
658
|
}
|
|
327
659
|
);
|
|
328
660
|
}
|
|
329
|
-
),
|
|
661
|
+
), xe = Object.assign(ye, {
|
|
330
662
|
displayName: "ReperePopover.AcknowledgeButton"
|
|
331
|
-
}),
|
|
332
|
-
const
|
|
333
|
-
return /* @__PURE__ */
|
|
663
|
+
}), Y = b(({ children: e = "×", ...t }, o) => {
|
|
664
|
+
const r = k()?.popoverId;
|
|
665
|
+
return /* @__PURE__ */ g(
|
|
334
666
|
"button",
|
|
335
667
|
{
|
|
336
|
-
ref:
|
|
337
|
-
popovertarget:
|
|
668
|
+
ref: o,
|
|
669
|
+
popovertarget: r,
|
|
338
670
|
popovertargetaction: "hide",
|
|
339
671
|
"aria-label": "Close",
|
|
340
|
-
...
|
|
341
|
-
children:
|
|
672
|
+
...t,
|
|
673
|
+
children: e
|
|
342
674
|
}
|
|
343
675
|
);
|
|
344
676
|
});
|
|
345
|
-
|
|
346
|
-
const
|
|
347
|
-
({ children:
|
|
677
|
+
Y.displayName = "ReperePopover.CloseButton";
|
|
678
|
+
const F = b(
|
|
679
|
+
({ children: e, ...t }, o) => /* @__PURE__ */ g("div", { ref: o, ...t, children: e })
|
|
348
680
|
);
|
|
349
|
-
|
|
350
|
-
const
|
|
351
|
-
({ children:
|
|
681
|
+
F.displayName = "ReperePopover.Content";
|
|
682
|
+
const U = b(
|
|
683
|
+
({ children: e, ...t }, o) => /* @__PURE__ */ g("div", { ref: o, ...t, children: e })
|
|
352
684
|
);
|
|
353
|
-
|
|
354
|
-
const
|
|
355
|
-
({ children:
|
|
356
|
-
const
|
|
357
|
-
return /* @__PURE__ */
|
|
685
|
+
U.displayName = "ReperePopover.Footer";
|
|
686
|
+
const be = b(
|
|
687
|
+
({ children: e, as: t, ...o }, i) => {
|
|
688
|
+
const s = k()?.beaconId || "unknown";
|
|
689
|
+
return /* @__PURE__ */ g(t || "h3", { ref: i, id: `repere-popover-${s}`, ...o, children: e });
|
|
358
690
|
}
|
|
359
|
-
),
|
|
691
|
+
), Pe = Object.assign(be, {
|
|
360
692
|
displayName: "ReperePopover.Title"
|
|
361
|
-
}),
|
|
362
|
-
Title:
|
|
363
|
-
Content:
|
|
364
|
-
Footer:
|
|
365
|
-
AcknowledgeButton:
|
|
366
|
-
CloseButton:
|
|
367
|
-
}),
|
|
693
|
+
}), $e = Object.assign(X, {
|
|
694
|
+
Title: Pe,
|
|
695
|
+
Content: F,
|
|
696
|
+
Footer: U,
|
|
697
|
+
AcknowledgeButton: xe,
|
|
698
|
+
CloseButton: Y
|
|
699
|
+
}), Ce = b(
|
|
368
700
|
({
|
|
369
|
-
children:
|
|
370
|
-
as:
|
|
371
|
-
style:
|
|
372
|
-
disableAnimation:
|
|
373
|
-
...
|
|
374
|
-
},
|
|
701
|
+
children: e,
|
|
702
|
+
as: t,
|
|
703
|
+
style: o,
|
|
704
|
+
disableAnimation: i,
|
|
705
|
+
...r
|
|
706
|
+
}, s) => {
|
|
375
707
|
const {
|
|
376
708
|
calculatedPosition: n,
|
|
377
|
-
beaconId:
|
|
378
|
-
triggerAnimation:
|
|
709
|
+
beaconId: a,
|
|
710
|
+
triggerAnimation: l,
|
|
379
711
|
triggerDismissAnimation: c,
|
|
380
|
-
isDismissing:
|
|
381
|
-
popoverId:
|
|
382
|
-
} =
|
|
712
|
+
isDismissing: d,
|
|
713
|
+
popoverId: w
|
|
714
|
+
} = k(), p = t || "button", u = y(() => !t || t === "button" ? M.button : M.create(p), [t, p]);
|
|
383
715
|
if (!n) return null;
|
|
384
|
-
const
|
|
716
|
+
const h = {
|
|
385
717
|
position: n.position,
|
|
386
718
|
top: n.top,
|
|
387
719
|
left: n.left,
|
|
388
720
|
zIndex: n.zIndex,
|
|
389
721
|
pointerEvents: "auto",
|
|
390
722
|
cursor: "pointer",
|
|
391
|
-
anchorName: `--repere-trigger-${
|
|
392
|
-
},
|
|
393
|
-
ref:
|
|
394
|
-
popovertarget:
|
|
395
|
-
"aria-label": `Beacon trigger for ${
|
|
723
|
+
anchorName: `--repere-trigger-${a}`
|
|
724
|
+
}, x = o ? { ...h, ...o } : h, R = !i && (l || c), P = {
|
|
725
|
+
ref: s,
|
|
726
|
+
popovertarget: w,
|
|
727
|
+
"aria-label": `Beacon trigger for ${a}`,
|
|
396
728
|
"data-repere-trigger": "",
|
|
397
|
-
...
|
|
729
|
+
...r
|
|
398
730
|
};
|
|
399
731
|
if (R) {
|
|
400
|
-
const
|
|
401
|
-
if (!
|
|
402
|
-
const
|
|
732
|
+
const f = d && c ? c : l;
|
|
733
|
+
if (!f) return null;
|
|
734
|
+
const O = ie(
|
|
403
735
|
n.translate,
|
|
404
|
-
|
|
736
|
+
f.variants
|
|
405
737
|
);
|
|
406
|
-
return /* @__PURE__ */
|
|
407
|
-
|
|
738
|
+
return /* @__PURE__ */ g(
|
|
739
|
+
u,
|
|
408
740
|
{
|
|
409
741
|
initial: "initial",
|
|
410
|
-
animate:
|
|
411
|
-
variants:
|
|
412
|
-
transition:
|
|
413
|
-
...
|
|
414
|
-
style:
|
|
415
|
-
children:
|
|
742
|
+
animate: d ? "exit" : "animate",
|
|
743
|
+
variants: O,
|
|
744
|
+
transition: f.transition,
|
|
745
|
+
...P,
|
|
746
|
+
style: x,
|
|
747
|
+
children: e
|
|
416
748
|
}
|
|
417
749
|
);
|
|
418
750
|
}
|
|
419
|
-
return /* @__PURE__ */
|
|
420
|
-
|
|
751
|
+
return /* @__PURE__ */ g(
|
|
752
|
+
p,
|
|
421
753
|
{
|
|
422
|
-
...
|
|
754
|
+
...P,
|
|
423
755
|
style: {
|
|
424
|
-
...
|
|
756
|
+
...x,
|
|
425
757
|
translate: `${n.translate.x} ${n.translate.y}`
|
|
426
758
|
},
|
|
427
|
-
children:
|
|
759
|
+
children: e
|
|
428
760
|
}
|
|
429
761
|
);
|
|
430
762
|
}
|
|
431
|
-
),
|
|
763
|
+
), Oe = Object.assign(Ce, {
|
|
432
764
|
displayName: "RepereTrigger"
|
|
433
765
|
});
|
|
434
766
|
export {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
767
|
+
v as Animation,
|
|
768
|
+
Be as Beacons,
|
|
769
|
+
m as Position,
|
|
770
|
+
$e as ReperePopover,
|
|
771
|
+
Oe as RepereTrigger
|
|
438
772
|
};
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[data-repere-popover]{position:absolute;position-anchor:var(--repere-anchor);inset:unset;margin:0;opacity:var(--repere-exit-opacity, 0);transform:translate(var(--repere-exit-x, 0)) translateY(var(--repere-exit-y, -20px)) scale(var(--repere-exit-scale, 1));transition-property:opacity,transform,overlay,display;transition-duration:var(--repere-transition-duration, .3s);transition-timing-function:var( --repere-transition-timing, cubic-bezier(.4, 0, .2, 1) );transition-behavior:allow-discrete}[data-repere-popover]:popover-open{opacity:var(--repere-animate-opacity, 1);transform:translate(var(--repere-animate-x, 0)) translateY(var(--repere-animate-y, 0)) scale(var(--repere-animate-scale, 1))}@starting-style{[data-repere-popover]:popover-open{opacity:var(--repere-initial-opacity, 0);transform:translate(var(--repere-initial-x, 0)) translateY(var(--repere-initial-y, -20px)) scale(var(--repere-initial-scale, 1))}}[data-repere-popover][data-position=bottom-left]{top:anchor(bottom);left:anchor(left);position-try-fallbacks:--bottom-right,--top-left,--top-right}[data-repere-popover][data-position=bottom-center]{top:anchor(bottom);left:anchor(center);translate:-50% 0;position-try-fallbacks:--bottom-left,--bottom-right,--top-center}[data-repere-popover][data-position=bottom-right]{top:anchor(bottom);right:anchor(right);position-try-fallbacks:--bottom-left,--top-right,--top-left}[data-repere-popover][data-position=top-left]{bottom:anchor(top);left:anchor(left);position-try-fallbacks:--top-right,--bottom-left,--bottom-right}[data-repere-popover][data-position=top-center]{bottom:anchor(top);left:anchor(center);translate:-50% 0;position-try-fallbacks:--top-left,--top-right,--bottom-center}[data-repere-popover][data-position=top-right]{bottom:anchor(top);right:anchor(right);position-try-fallbacks:--top-left,--bottom-right,--bottom-left}[data-repere-popover][data-position=left-center]:popover-open{top:anchor(center);right:anchor(left);translate:0 -50%;position-try-fallbacks:--right-center,--bottom-center,--top-center}[data-repere-popover][data-position=right-center]:popover-open{top:anchor(center);left:anchor(right);translate:0 -50%;position-try-fallbacks:--left-center,--bottom-center,--top-center}[data-repere-trigger]{anchor-name:var(--repere-anchor)}@position-try --bottom-left{top:anchor(bottom);left:anchor(left);right:auto;bottom:auto;translate:0 0}@position-try --bottom-right{top:anchor(bottom);right:anchor(right);left:auto;bottom:auto;translate:0 0}@position-try --bottom-center{top:anchor(bottom);left:anchor(center);right:auto;bottom:auto;translate:-50% 0}@position-try --top-left{bottom:anchor(top);left:anchor(left);right:auto;top:auto;translate:0 0}@position-try --top-right{bottom:anchor(top);right:anchor(right);left:auto;top:auto;translate:0 0}@position-try --top-center{bottom:anchor(top);left:anchor(center);right:auto;top:auto;translate:-50% 0}@position-try --left-center{top:anchor(center);right:anchor(left);left:auto;bottom:auto;translate:0 -50%}@position-try --right-center{top:anchor(center);left:anchor(right);right:auto;bottom:auto;translate:0 -50%}
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@repere/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"import": "./dist/index.js"
|
|
10
|
-
}
|
|
10
|
+
},
|
|
11
|
+
"./styles.css": "./dist/styles.css"
|
|
11
12
|
},
|
|
12
13
|
"files": [
|
|
13
14
|
"dist"
|
|
@@ -15,10 +16,10 @@
|
|
|
15
16
|
"peerDependencies": {
|
|
16
17
|
"motion": "^12.0.0",
|
|
17
18
|
"react": "^18.0.0 || ^19.0.0",
|
|
18
|
-
"react-dom": "^18.0.0 || ^19.0.0"
|
|
19
|
-
"@repere/core": "0.0.3"
|
|
19
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
+
"@types/node": "^25.0.3",
|
|
22
23
|
"@types/react": "^19.2.7",
|
|
23
24
|
"@types/react-dom": "^19.2.3",
|
|
24
25
|
"@vitejs/plugin-react": "^5.1.2",
|