@repere/react 0.0.0 → 0.0.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.js +249 -255
- package/dist/utils/renderRepereComponents.d.ts.map +1 -1
- package/package.json +8 -10
package/dist/index.js
CHANGED
|
@@ -1,104 +1,99 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { getAnimationConfig as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { motion as
|
|
6
|
-
const
|
|
7
|
-
function
|
|
8
|
-
const o =
|
|
1
|
+
import { jsx as u, jsxs as W } from "react/jsx-runtime";
|
|
2
|
+
import { getAnimationConfig as x, mergeAnimationConfigs as D, PositionTracker as H, DEFAULT_POSITION as J, calculateDismissDuration as K, waitForAnimations as Q, MemoryStore as X, BeaconManager as Y, getPopoverAnimationStyles as Z, combineTranslateWithAnimation as oo } from "@repere/core";
|
|
3
|
+
import { createContext as eo, useContext as to, useMemo as P, useState as w, useEffect as O, useCallback as y, isValidElement as j, cloneElement as no, useId as io, forwardRef as A } from "react";
|
|
4
|
+
import { createPortal as ro } from "react-dom";
|
|
5
|
+
import { motion as $ } from "motion/react";
|
|
6
|
+
const S = eo(null);
|
|
7
|
+
function I() {
|
|
8
|
+
const o = to(S);
|
|
9
9
|
if (!o)
|
|
10
10
|
throw new Error("useRepereContext must be used within a Repere provider.");
|
|
11
11
|
return o;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var g, C, f, P;
|
|
21
|
-
const y = (C = (g = e.trigger) == null ? void 0 : g.animations) == null ? void 0 : C.onDismiss, D = (P = (f = o.trigger) == null ? void 0 : f.animations) == null ? void 0 : P.onDismiss;
|
|
22
|
-
return $(k(y, D));
|
|
13
|
+
function so(o, e) {
|
|
14
|
+
const t = P(() => {
|
|
15
|
+
const n = e.trigger?.animations?.onRender, s = o.trigger?.animations?.onRender;
|
|
16
|
+
return x(D(n, s));
|
|
17
|
+
}, [e.trigger?.animations, o.trigger?.animations]), r = P(() => {
|
|
18
|
+
const n = e.trigger?.animations?.onDismiss, s = o.trigger?.animations?.onDismiss;
|
|
19
|
+
return x(D(n, s));
|
|
23
20
|
}, [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
]), i =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const y = (C = (g = e.popover) == null ? void 0 : g.animations) == null ? void 0 : C.onClose, D = (P = (f = o.popover) == null ? void 0 : f.animations) == null ? void 0 : P.onClose;
|
|
33
|
-
return $(k(y, D));
|
|
21
|
+
e.trigger?.animations?.onDismiss,
|
|
22
|
+
o.trigger?.animations?.onDismiss
|
|
23
|
+
]), i = P(() => {
|
|
24
|
+
const n = e.popover?.animations?.onOpen, s = o.popover?.animations?.onOpen;
|
|
25
|
+
return x(D(n, s));
|
|
26
|
+
}, [e.popover?.animations?.onOpen, o.popover?.animations?.onOpen]), p = P(() => {
|
|
27
|
+
const n = e.popover?.animations?.onClose, s = o.popover?.animations?.onClose;
|
|
28
|
+
return x(D(n, s));
|
|
34
29
|
}, [
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
e.popover?.animations?.onClose,
|
|
31
|
+
o.popover?.animations?.onClose
|
|
37
32
|
]);
|
|
38
33
|
return {
|
|
39
|
-
triggerAnimation:
|
|
34
|
+
triggerAnimation: t,
|
|
40
35
|
triggerDismissAnimation: r,
|
|
41
36
|
popoverOpenAnimation: i,
|
|
42
|
-
popoverCloseAnimation:
|
|
37
|
+
popoverCloseAnimation: p
|
|
43
38
|
};
|
|
44
39
|
}
|
|
45
|
-
function
|
|
40
|
+
function po({
|
|
46
41
|
targetSelector: o,
|
|
47
42
|
position: e,
|
|
48
|
-
offset:
|
|
43
|
+
offset: t,
|
|
49
44
|
zIndex: r = 9999,
|
|
50
45
|
enabled: i = !0,
|
|
51
|
-
debug:
|
|
46
|
+
debug: p = !1
|
|
52
47
|
}) {
|
|
53
|
-
const [
|
|
54
|
-
return
|
|
48
|
+
const [n, s] = w(null), a = P(() => new H(p), [p]);
|
|
49
|
+
return O(() => {
|
|
55
50
|
if (!i) {
|
|
56
|
-
|
|
51
|
+
s(null);
|
|
57
52
|
return;
|
|
58
53
|
}
|
|
59
|
-
return
|
|
54
|
+
return a.subscribe(
|
|
60
55
|
o,
|
|
61
56
|
e,
|
|
62
|
-
|
|
63
|
-
{ offset:
|
|
57
|
+
s,
|
|
58
|
+
{ offset: t, zIndex: r }
|
|
64
59
|
);
|
|
65
|
-
}, [
|
|
66
|
-
calculatedPosition:
|
|
67
|
-
targetElement:
|
|
60
|
+
}, [a, o, e, t, r, i]), O(() => () => a.destroy(), [a]), {
|
|
61
|
+
calculatedPosition: n,
|
|
62
|
+
targetElement: n ? document.querySelector(o) : null
|
|
68
63
|
};
|
|
69
64
|
}
|
|
70
|
-
function
|
|
71
|
-
const [o, e] =
|
|
65
|
+
function ao() {
|
|
66
|
+
const [o, e] = w(!1), [t, r] = w(
|
|
72
67
|
null
|
|
73
|
-
), i =
|
|
74
|
-
r(
|
|
75
|
-
}, []),
|
|
76
|
-
() =>
|
|
77
|
-
[
|
|
78
|
-
),
|
|
79
|
-
() =>
|
|
80
|
-
[
|
|
81
|
-
),
|
|
82
|
-
() =>
|
|
83
|
-
[
|
|
68
|
+
), i = y((a) => {
|
|
69
|
+
r(a);
|
|
70
|
+
}, []), p = y(
|
|
71
|
+
() => t?.togglePopover(),
|
|
72
|
+
[t]
|
|
73
|
+
), n = y(
|
|
74
|
+
() => t?.showPopover(),
|
|
75
|
+
[t]
|
|
76
|
+
), s = y(
|
|
77
|
+
() => t?.hidePopover(),
|
|
78
|
+
[t]
|
|
84
79
|
);
|
|
85
|
-
return
|
|
86
|
-
if (!
|
|
87
|
-
const
|
|
88
|
-
e(
|
|
80
|
+
return O(() => {
|
|
81
|
+
if (!t) return;
|
|
82
|
+
const a = (c) => {
|
|
83
|
+
e(c.newState === "open");
|
|
89
84
|
};
|
|
90
|
-
return
|
|
91
|
-
}, [
|
|
85
|
+
return t.addEventListener("toggle", a), () => t.removeEventListener("toggle", a);
|
|
86
|
+
}, [t]), {
|
|
92
87
|
isOpen: o,
|
|
93
|
-
popoverElement:
|
|
88
|
+
popoverElement: t,
|
|
94
89
|
handlePopoverRef: i,
|
|
95
|
-
togglePopover:
|
|
96
|
-
showPopover:
|
|
97
|
-
hidePopover:
|
|
90
|
+
togglePopover: p,
|
|
91
|
+
showPopover: n,
|
|
92
|
+
hidePopover: s
|
|
98
93
|
};
|
|
99
94
|
}
|
|
100
|
-
function
|
|
101
|
-
return o ?
|
|
95
|
+
function co(o, e) {
|
|
96
|
+
return o ? j(o) ? o : /* @__PURE__ */ u(
|
|
102
97
|
o,
|
|
103
98
|
{
|
|
104
99
|
beacon: e.beacon,
|
|
@@ -109,9 +104,9 @@ function uo(o, e) {
|
|
|
109
104
|
}
|
|
110
105
|
) : null;
|
|
111
106
|
}
|
|
112
|
-
function
|
|
113
|
-
let
|
|
114
|
-
return
|
|
107
|
+
function lo(o, e) {
|
|
108
|
+
let t;
|
|
109
|
+
return j(o) ? t = o : t = /* @__PURE__ */ u(
|
|
115
110
|
o,
|
|
116
111
|
{
|
|
117
112
|
beacon: e.beacon,
|
|
@@ -119,227 +114,226 @@ function vo(o, e) {
|
|
|
119
114
|
onDismiss: e.handleDismiss,
|
|
120
115
|
onClose: e.hidePopover
|
|
121
116
|
}
|
|
122
|
-
),
|
|
117
|
+
), no(t, {
|
|
118
|
+
// @ts-expect-error - cloneElement ref typing doesn't handle callback refs properly
|
|
123
119
|
ref: e.handlePopoverRef,
|
|
124
120
|
id: e.popoverId,
|
|
125
121
|
popover: "auto"
|
|
126
122
|
});
|
|
127
123
|
}
|
|
128
|
-
function
|
|
129
|
-
|
|
130
|
-
const n = ((l = o.trigger) == null ? void 0 : l.position) || ((t = e.trigger) == null ? void 0 : t.position) || X, r = ((p = o.trigger) == null ? void 0 : p.zIndex) || ((m = e.trigger) == null ? void 0 : m.zIndex) || 9999, i = (d = o.trigger) == null ? void 0 : d.offset, s = ((c = o.popover) == null ? void 0 : c.position) || ((u = e.popover) == null ? void 0 : u.position) || n, a = ((v = o.popover) == null ? void 0 : v.offset) || ((A = e.popover) == null ? void 0 : A.offset) || { x: 0, y: 0 };
|
|
124
|
+
function mo(o, e) {
|
|
125
|
+
const t = o.trigger?.position || e.trigger?.position || J, r = o.trigger?.zIndex || e.trigger?.zIndex || 9999, i = o.trigger?.offset, p = o.popover?.position || e.popover?.position || t, n = o.popover?.offset || e.popover?.offset || { x: 0, y: 0 };
|
|
131
126
|
return {
|
|
132
|
-
position:
|
|
127
|
+
position: t,
|
|
133
128
|
zIndex: r,
|
|
134
129
|
offset: i,
|
|
135
|
-
popoverPosition:
|
|
136
|
-
popoverOffset:
|
|
130
|
+
popoverPosition: p,
|
|
131
|
+
popoverOffset: n
|
|
137
132
|
};
|
|
138
133
|
}
|
|
139
|
-
function
|
|
134
|
+
function vo({
|
|
140
135
|
beacon: o,
|
|
141
136
|
config: e,
|
|
142
|
-
store:
|
|
137
|
+
store: t,
|
|
143
138
|
onDismiss: r,
|
|
144
139
|
debug: i
|
|
145
140
|
}) {
|
|
146
|
-
|
|
147
|
-
const s = ao(), [a, l] = b(!1), { position: t, zIndex: p, offset: m, popoverPosition: d, popoverOffset: c } = go(o, e), { calculatedPosition: u, targetElement: v } = lo({
|
|
141
|
+
const p = io(), [n, s] = w(!1), { position: a, zIndex: c, offset: m, popoverPosition: f, popoverOffset: l } = mo(o, e), { calculatedPosition: v, targetElement: d } = po({
|
|
148
142
|
targetSelector: o.selector,
|
|
149
|
-
position:
|
|
143
|
+
position: a,
|
|
150
144
|
offset: m,
|
|
151
|
-
zIndex:
|
|
145
|
+
zIndex: c,
|
|
152
146
|
enabled: !0,
|
|
153
147
|
debug: i
|
|
154
148
|
}), {
|
|
155
|
-
isOpen:
|
|
156
|
-
popoverElement:
|
|
157
|
-
handlePopoverRef:
|
|
158
|
-
togglePopover:
|
|
159
|
-
showPopover:
|
|
160
|
-
hidePopover:
|
|
161
|
-
} =
|
|
162
|
-
triggerAnimation:
|
|
163
|
-
triggerDismissAnimation:
|
|
164
|
-
popoverOpenAnimation:
|
|
165
|
-
popoverCloseAnimation:
|
|
166
|
-
} =
|
|
167
|
-
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
149
|
+
isOpen: C,
|
|
150
|
+
popoverElement: R,
|
|
151
|
+
handlePopoverRef: h,
|
|
152
|
+
togglePopover: g,
|
|
153
|
+
showPopover: B,
|
|
154
|
+
hidePopover: T
|
|
155
|
+
} = ao(), {
|
|
156
|
+
triggerAnimation: L,
|
|
157
|
+
triggerDismissAnimation: b,
|
|
158
|
+
popoverOpenAnimation: V,
|
|
159
|
+
popoverCloseAnimation: E
|
|
160
|
+
} = so(o, e), k = async () => {
|
|
161
|
+
s(!0), R?.hidePopover();
|
|
162
|
+
const U = K(
|
|
163
|
+
b,
|
|
164
|
+
E
|
|
171
165
|
);
|
|
172
|
-
await
|
|
173
|
-
},
|
|
166
|
+
await Q(U), await Promise.resolve(t.dismiss(o.id)), r();
|
|
167
|
+
}, q = {
|
|
174
168
|
beaconId: o.id,
|
|
175
|
-
position:
|
|
176
|
-
popoverPosition:
|
|
177
|
-
popoverOffset:
|
|
178
|
-
calculatedPosition:
|
|
179
|
-
isOpen:
|
|
180
|
-
isDismissing:
|
|
181
|
-
toggle:
|
|
182
|
-
open:
|
|
183
|
-
close:
|
|
184
|
-
dismiss:
|
|
185
|
-
triggerAnimation:
|
|
186
|
-
triggerDismissAnimation:
|
|
187
|
-
popoverOpenAnimation:
|
|
188
|
-
popoverCloseAnimation:
|
|
189
|
-
popoverId:
|
|
190
|
-
},
|
|
191
|
-
return !
|
|
192
|
-
`[Repere] ${o.id} waiting for target element: position=${!!
|
|
193
|
-
), null) :
|
|
194
|
-
|
|
169
|
+
position: a,
|
|
170
|
+
popoverPosition: f,
|
|
171
|
+
popoverOffset: l,
|
|
172
|
+
calculatedPosition: v,
|
|
173
|
+
isOpen: C,
|
|
174
|
+
isDismissing: n,
|
|
175
|
+
toggle: g,
|
|
176
|
+
open: B,
|
|
177
|
+
close: T,
|
|
178
|
+
dismiss: k,
|
|
179
|
+
triggerAnimation: L,
|
|
180
|
+
triggerDismissAnimation: b,
|
|
181
|
+
popoverOpenAnimation: V,
|
|
182
|
+
popoverCloseAnimation: E,
|
|
183
|
+
popoverId: p
|
|
184
|
+
}, G = o.trigger?.component || e.trigger?.component, N = o.popover.component || e.popover?.component;
|
|
185
|
+
return !v || !d ? (i && console.warn(
|
|
186
|
+
`[Repere] ${o.id} waiting for target element: position=${!!v}, element=${!!d}`
|
|
187
|
+
), null) : N ? /* @__PURE__ */ W(S.Provider, { value: q, children: [
|
|
188
|
+
co(G, {
|
|
195
189
|
beacon: o,
|
|
196
|
-
calculatedPosition:
|
|
197
|
-
position:
|
|
198
|
-
isOpen:
|
|
199
|
-
togglePopover:
|
|
190
|
+
calculatedPosition: v,
|
|
191
|
+
position: a,
|
|
192
|
+
isOpen: C,
|
|
193
|
+
togglePopover: g
|
|
200
194
|
}),
|
|
201
|
-
|
|
195
|
+
lo(N, {
|
|
202
196
|
beacon: o,
|
|
203
|
-
position:
|
|
204
|
-
handleDismiss:
|
|
205
|
-
hidePopover:
|
|
206
|
-
handlePopoverRef:
|
|
207
|
-
popoverId:
|
|
197
|
+
position: a,
|
|
198
|
+
handleDismiss: k,
|
|
199
|
+
hidePopover: T,
|
|
200
|
+
handlePopoverRef: h,
|
|
201
|
+
popoverId: p
|
|
208
202
|
})
|
|
209
203
|
] }) : (i && console.warn(
|
|
210
204
|
"[Repere] No popover component provided for beacon:",
|
|
211
205
|
o.id
|
|
212
206
|
), null);
|
|
213
207
|
}
|
|
214
|
-
function
|
|
208
|
+
function Ro({
|
|
215
209
|
config: o,
|
|
216
210
|
currentPath: e,
|
|
217
|
-
enabled:
|
|
211
|
+
enabled: t = !0,
|
|
218
212
|
debug: r = !1
|
|
219
213
|
}) {
|
|
220
|
-
const i =
|
|
221
|
-
() => o.store || new
|
|
214
|
+
const i = P(
|
|
215
|
+
() => o.store || new X(),
|
|
222
216
|
[o.store]
|
|
223
|
-
),
|
|
224
|
-
() => new
|
|
217
|
+
), p = P(
|
|
218
|
+
() => new Y(i, { debug: r }),
|
|
225
219
|
[i, r]
|
|
226
|
-
), [
|
|
220
|
+
), [n, s] = w([]), [a, c] = w(
|
|
227
221
|
/* @__PURE__ */ new Set()
|
|
228
222
|
);
|
|
229
|
-
|
|
230
|
-
if (!
|
|
231
|
-
|
|
223
|
+
O(() => {
|
|
224
|
+
if (!t) {
|
|
225
|
+
s([]), c(/* @__PURE__ */ new Set());
|
|
232
226
|
return;
|
|
233
227
|
}
|
|
234
228
|
(async () => {
|
|
235
|
-
const
|
|
229
|
+
const v = await p.getActiveBeacons(
|
|
236
230
|
o.pages,
|
|
237
231
|
e
|
|
238
232
|
);
|
|
239
|
-
|
|
233
|
+
s(v);
|
|
240
234
|
})();
|
|
241
|
-
}, [
|
|
242
|
-
const m = (
|
|
243
|
-
|
|
244
|
-
},
|
|
245
|
-
(
|
|
235
|
+
}, [p, o.pages, e, t]);
|
|
236
|
+
const m = (l) => {
|
|
237
|
+
c((v) => /* @__PURE__ */ new Set([...v, l]));
|
|
238
|
+
}, f = n.filter(
|
|
239
|
+
(l) => !a.has(l.id)
|
|
246
240
|
);
|
|
247
|
-
return
|
|
248
|
-
|
|
249
|
-
|
|
241
|
+
return f.length === 0 ? null : ro(
|
|
242
|
+
f.map((l) => /* @__PURE__ */ u(
|
|
243
|
+
vo,
|
|
250
244
|
{
|
|
251
|
-
beacon:
|
|
245
|
+
beacon: l,
|
|
252
246
|
config: o,
|
|
253
247
|
store: i,
|
|
254
248
|
debug: r,
|
|
255
|
-
onDismiss: () => m(
|
|
249
|
+
onDismiss: () => m(l.id)
|
|
256
250
|
},
|
|
257
|
-
|
|
251
|
+
l.id
|
|
258
252
|
)),
|
|
259
253
|
document.body
|
|
260
254
|
);
|
|
261
255
|
}
|
|
262
|
-
const
|
|
256
|
+
const z = A(
|
|
263
257
|
({
|
|
264
258
|
children: o,
|
|
265
259
|
style: e,
|
|
266
|
-
popover:
|
|
260
|
+
popover: t = "auto",
|
|
267
261
|
disableAnimation: r,
|
|
268
262
|
// Destructure and discard internal props so they don't spread to DOM
|
|
269
263
|
beacon: i,
|
|
270
|
-
position:
|
|
271
|
-
onDismiss:
|
|
272
|
-
onClose:
|
|
273
|
-
...
|
|
274
|
-
},
|
|
264
|
+
position: p,
|
|
265
|
+
onDismiss: n,
|
|
266
|
+
onClose: s,
|
|
267
|
+
...a
|
|
268
|
+
}, c) => {
|
|
275
269
|
const {
|
|
276
270
|
beaconId: m,
|
|
277
|
-
popoverOpenAnimation:
|
|
278
|
-
popoverCloseAnimation:
|
|
279
|
-
popoverPosition:
|
|
280
|
-
popoverOffset:
|
|
281
|
-
} =
|
|
282
|
-
(
|
|
283
|
-
typeof
|
|
271
|
+
popoverOpenAnimation: f,
|
|
272
|
+
popoverCloseAnimation: l,
|
|
273
|
+
popoverPosition: v,
|
|
274
|
+
popoverOffset: d
|
|
275
|
+
} = I(), C = y(
|
|
276
|
+
(g) => {
|
|
277
|
+
typeof c == "function" ? c(g) : c && (c.current = g);
|
|
284
278
|
},
|
|
285
|
-
[
|
|
286
|
-
),
|
|
279
|
+
[c]
|
|
280
|
+
), h = {
|
|
287
281
|
positionAnchor: m ? `--repere-trigger-${m}` : void 0,
|
|
288
|
-
...
|
|
289
|
-
marginLeft:
|
|
290
|
-
marginTop:
|
|
282
|
+
...d && {
|
|
283
|
+
marginLeft: d.x || 0,
|
|
284
|
+
marginTop: d.y || 0
|
|
291
285
|
},
|
|
292
|
-
...
|
|
286
|
+
...Z(f, l),
|
|
293
287
|
...e
|
|
294
288
|
};
|
|
295
|
-
return /* @__PURE__ */
|
|
289
|
+
return /* @__PURE__ */ u(
|
|
296
290
|
"div",
|
|
297
291
|
{
|
|
298
|
-
ref:
|
|
292
|
+
ref: C,
|
|
299
293
|
role: "dialog",
|
|
300
294
|
"aria-labelledby": `repere-popover-${m}`,
|
|
301
295
|
"data-repere-popover": "",
|
|
302
|
-
"data-position":
|
|
303
|
-
popover:
|
|
304
|
-
...
|
|
305
|
-
style:
|
|
296
|
+
"data-position": v,
|
|
297
|
+
popover: t,
|
|
298
|
+
...a,
|
|
299
|
+
style: h,
|
|
306
300
|
children: o
|
|
307
301
|
}
|
|
308
302
|
);
|
|
309
303
|
}
|
|
310
304
|
);
|
|
311
|
-
|
|
312
|
-
const
|
|
305
|
+
z.displayName = "ReperePopover";
|
|
306
|
+
const uo = A(
|
|
313
307
|
({
|
|
314
308
|
children: o = "Got it",
|
|
315
309
|
onClick: e,
|
|
316
|
-
as:
|
|
310
|
+
as: t,
|
|
317
311
|
...r
|
|
318
312
|
}, i) => {
|
|
319
|
-
const
|
|
320
|
-
}),
|
|
321
|
-
return /* @__PURE__ */
|
|
322
|
-
|
|
313
|
+
const p = I(), n = p?.dismiss || (() => {
|
|
314
|
+
}), s = p?.popoverId;
|
|
315
|
+
return /* @__PURE__ */ u(
|
|
316
|
+
t || "button",
|
|
323
317
|
{
|
|
324
318
|
ref: i,
|
|
325
319
|
onClick: (m) => {
|
|
326
|
-
|
|
320
|
+
n(), e?.(m);
|
|
327
321
|
},
|
|
328
|
-
popovertarget:
|
|
322
|
+
popovertarget: s,
|
|
329
323
|
popovertargetaction: "hide",
|
|
330
324
|
...r,
|
|
331
325
|
children: o
|
|
332
326
|
}
|
|
333
327
|
);
|
|
334
328
|
}
|
|
335
|
-
),
|
|
329
|
+
), go = Object.assign(uo, {
|
|
336
330
|
displayName: "ReperePopover.AcknowledgeButton"
|
|
337
|
-
}),
|
|
338
|
-
const
|
|
339
|
-
return /* @__PURE__ */
|
|
331
|
+
}), F = A(({ children: o = "×", ...e }, t) => {
|
|
332
|
+
const i = I()?.popoverId;
|
|
333
|
+
return /* @__PURE__ */ u(
|
|
340
334
|
"button",
|
|
341
335
|
{
|
|
342
|
-
ref:
|
|
336
|
+
ref: t,
|
|
343
337
|
popovertarget: i,
|
|
344
338
|
popovertargetaction: "hide",
|
|
345
339
|
"aria-label": "Close",
|
|
@@ -348,97 +342,97 @@ const Po = B(
|
|
|
348
342
|
}
|
|
349
343
|
);
|
|
350
344
|
});
|
|
351
|
-
|
|
352
|
-
const
|
|
353
|
-
({ children: o, ...e },
|
|
345
|
+
F.displayName = "ReperePopover.CloseButton";
|
|
346
|
+
const M = A(
|
|
347
|
+
({ children: o, ...e }, t) => /* @__PURE__ */ u("div", { ref: t, ...e, children: o })
|
|
354
348
|
);
|
|
355
|
-
|
|
356
|
-
const
|
|
357
|
-
({ children: o, ...e },
|
|
349
|
+
M.displayName = "ReperePopover.Content";
|
|
350
|
+
const _ = A(
|
|
351
|
+
({ children: o, ...e }, t) => /* @__PURE__ */ u("div", { ref: t, ...e, children: o })
|
|
358
352
|
);
|
|
359
|
-
|
|
360
|
-
const
|
|
361
|
-
({ children: o, as: e, ...
|
|
362
|
-
const
|
|
363
|
-
return /* @__PURE__ */
|
|
353
|
+
_.displayName = "ReperePopover.Footer";
|
|
354
|
+
const fo = A(
|
|
355
|
+
({ children: o, as: e, ...t }, r) => {
|
|
356
|
+
const p = I()?.beaconId || "unknown";
|
|
357
|
+
return /* @__PURE__ */ u(e || "h3", { ref: r, id: `repere-popover-${p}`, ...t, children: o });
|
|
364
358
|
}
|
|
365
|
-
),
|
|
359
|
+
), Po = Object.assign(fo, {
|
|
366
360
|
displayName: "ReperePopover.Title"
|
|
367
|
-
}),
|
|
368
|
-
Title:
|
|
369
|
-
Content:
|
|
370
|
-
Footer:
|
|
371
|
-
AcknowledgeButton:
|
|
372
|
-
CloseButton:
|
|
373
|
-
}),
|
|
361
|
+
}), xo = Object.assign(z, {
|
|
362
|
+
Title: Po,
|
|
363
|
+
Content: M,
|
|
364
|
+
Footer: _,
|
|
365
|
+
AcknowledgeButton: go,
|
|
366
|
+
CloseButton: F
|
|
367
|
+
}), Co = A(
|
|
374
368
|
({
|
|
375
369
|
children: o,
|
|
376
370
|
as: e,
|
|
377
|
-
style:
|
|
371
|
+
style: t,
|
|
378
372
|
disableAnimation: r,
|
|
379
373
|
...i
|
|
380
|
-
},
|
|
374
|
+
}, p) => {
|
|
381
375
|
const {
|
|
382
|
-
calculatedPosition:
|
|
383
|
-
beaconId:
|
|
384
|
-
triggerAnimation:
|
|
385
|
-
triggerDismissAnimation:
|
|
376
|
+
calculatedPosition: n,
|
|
377
|
+
beaconId: s,
|
|
378
|
+
triggerAnimation: a,
|
|
379
|
+
triggerDismissAnimation: c,
|
|
386
380
|
isDismissing: m,
|
|
387
|
-
popoverId:
|
|
388
|
-
} =
|
|
389
|
-
if (!
|
|
390
|
-
const
|
|
391
|
-
position:
|
|
392
|
-
top:
|
|
393
|
-
left:
|
|
394
|
-
zIndex:
|
|
381
|
+
popoverId: f
|
|
382
|
+
} = I(), l = e || "button", v = P(() => !e || e === "button" ? $.button : $.create(l), [e, l]);
|
|
383
|
+
if (!n) return null;
|
|
384
|
+
const d = {
|
|
385
|
+
position: n.position,
|
|
386
|
+
top: n.top,
|
|
387
|
+
left: n.left,
|
|
388
|
+
zIndex: n.zIndex,
|
|
395
389
|
pointerEvents: "auto",
|
|
396
390
|
cursor: "pointer",
|
|
397
|
-
anchorName: `--repere-trigger-${
|
|
398
|
-
},
|
|
399
|
-
ref:
|
|
400
|
-
popovertarget:
|
|
401
|
-
"aria-label": `Beacon trigger for ${
|
|
391
|
+
anchorName: `--repere-trigger-${s}`
|
|
392
|
+
}, C = t ? { ...d, ...t } : d, R = !r && (a || c), h = {
|
|
393
|
+
ref: p,
|
|
394
|
+
popovertarget: f,
|
|
395
|
+
"aria-label": `Beacon trigger for ${s}`,
|
|
402
396
|
"data-repere-trigger": "",
|
|
403
397
|
...i
|
|
404
398
|
};
|
|
405
|
-
if (
|
|
406
|
-
const
|
|
407
|
-
if (!
|
|
408
|
-
const
|
|
409
|
-
|
|
410
|
-
|
|
399
|
+
if (R) {
|
|
400
|
+
const g = m && c ? c : a;
|
|
401
|
+
if (!g) return null;
|
|
402
|
+
const B = oo(
|
|
403
|
+
n.translate,
|
|
404
|
+
g.variants
|
|
411
405
|
);
|
|
412
|
-
return /* @__PURE__ */
|
|
413
|
-
|
|
406
|
+
return /* @__PURE__ */ u(
|
|
407
|
+
v,
|
|
414
408
|
{
|
|
415
409
|
initial: "initial",
|
|
416
410
|
animate: m ? "exit" : "animate",
|
|
417
|
-
variants:
|
|
418
|
-
transition:
|
|
419
|
-
...
|
|
420
|
-
style:
|
|
411
|
+
variants: B,
|
|
412
|
+
transition: g.transition,
|
|
413
|
+
...h,
|
|
414
|
+
style: C,
|
|
421
415
|
children: o
|
|
422
416
|
}
|
|
423
417
|
);
|
|
424
418
|
}
|
|
425
|
-
return /* @__PURE__ */
|
|
426
|
-
|
|
419
|
+
return /* @__PURE__ */ u(
|
|
420
|
+
l,
|
|
427
421
|
{
|
|
428
|
-
...
|
|
422
|
+
...h,
|
|
429
423
|
style: {
|
|
430
|
-
...
|
|
431
|
-
translate: `${
|
|
424
|
+
...C,
|
|
425
|
+
translate: `${n.translate.x} ${n.translate.y}`
|
|
432
426
|
},
|
|
433
427
|
children: o
|
|
434
428
|
}
|
|
435
429
|
);
|
|
436
430
|
}
|
|
437
|
-
),
|
|
431
|
+
), Do = Object.assign(Co, {
|
|
438
432
|
displayName: "RepereTrigger"
|
|
439
433
|
});
|
|
440
434
|
export {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
435
|
+
Ro as Beacons,
|
|
436
|
+
xo as ReperePopover,
|
|
437
|
+
Do as RepereTrigger
|
|
444
438
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderRepereComponents.d.ts","sourceRoot":"","sources":["../../src/utils/renderRepereComponents.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,wBAAwB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAgC,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAiB/C,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,cAAc,GAAG,SAAS,EACzC,KAAK,EAAE;IACL,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,wBAAwB,CAAC;IAC7C,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B,GACA,YAAY,GAAG,IAAI,CAiBrB;AAED,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,cAAc,EAC7B,KAAK,EAAE;IACL,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,gBAAgB,EAAE,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IACxD,SAAS,EAAE,MAAM,CAAC;CACnB,GACA,YAAY,
|
|
1
|
+
{"version":3,"file":"renderRepereComponents.d.ts","sourceRoot":"","sources":["../../src/utils/renderRepereComponents.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,wBAAwB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAgC,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAiB/C,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,cAAc,GAAG,SAAS,EACzC,KAAK,EAAE;IACL,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,wBAAwB,CAAC;IAC7C,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B,GACA,YAAY,GAAG,IAAI,CAiBrB;AAED,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,cAAc,EAC7B,KAAK,EAAE;IACL,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,gBAAgB,EAAE,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IACxD,SAAS,EAAE,MAAM,CAAC;CACnB,GACA,YAAY,CAuBd"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@repere/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -12,24 +12,22 @@
|
|
|
12
12
|
"files": [
|
|
13
13
|
"dist"
|
|
14
14
|
],
|
|
15
|
-
"dependencies": {},
|
|
16
15
|
"peerDependencies": {
|
|
17
16
|
"motion": "^12.0.0",
|
|
18
17
|
"react": "^18.0.0 || ^19.0.0",
|
|
19
18
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
20
|
-
"@repere/core": "0.0.
|
|
19
|
+
"@repere/core": "0.0.1"
|
|
21
20
|
},
|
|
22
21
|
"devDependencies": {
|
|
23
|
-
"@types/react": "^
|
|
24
|
-
"@types/react-dom": "^
|
|
25
|
-
"@vitejs/plugin-react": "^
|
|
22
|
+
"@types/react": "^19.2.7",
|
|
23
|
+
"@types/react-dom": "^19.2.3",
|
|
24
|
+
"@vitejs/plugin-react": "^5.1.2",
|
|
26
25
|
"motion": "^12.23.26",
|
|
27
26
|
"react": "^19.2.3",
|
|
28
27
|
"react-dom": "^19.2.3",
|
|
29
|
-
"
|
|
30
|
-
"vite": "^
|
|
31
|
-
"
|
|
32
|
-
"@repere/core": "0.0.0"
|
|
28
|
+
"vite": "^7.3.0",
|
|
29
|
+
"vite-plugin-dts": "^4.5.4",
|
|
30
|
+
"@repere/core": "0.0.1"
|
|
33
31
|
},
|
|
34
32
|
"keywords": [
|
|
35
33
|
"react",
|