@repere/react 0.0.0 → 0.0.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 CHANGED
@@ -1,104 +1,99 @@
1
- import { jsx as w, jsxs as K } from "react/jsx-runtime";
2
- import { getAnimationConfig as $, mergeAnimationConfigs as k, PositionTracker as Q, DEFAULT_POSITION as X, calculateDismissDuration as Y, waitForAnimations as Z, MemoryStore as oo, BeaconManager as eo, getPopoverAnimationStyles as no, combineTranslateWithAnimation as to } from "@repere/core";
3
- import { createContext as io, useContext as ro, useMemo as O, useState as b, useEffect as E, useCallback as x, isValidElement as _, cloneElement as so, useId as ao, forwardRef as B } from "react";
4
- import { createPortal as po } from "react-dom";
5
- import { motion as M } from "motion/react";
6
- const L = io(null);
7
- function N() {
8
- const o = ro(L);
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 co(o, e) {
14
- var a, l, t, p, m, d, c, u, v, A, I, R, h, T;
15
- const n = O(() => {
16
- var g, C, f, P;
17
- const y = (C = (g = e.trigger) == null ? void 0 : g.animations) == null ? void 0 : C.onRender, D = (P = (f = o.trigger) == null ? void 0 : f.animations) == null ? void 0 : P.onRender;
18
- return $(k(y, D));
19
- }, [(a = e.trigger) == null ? void 0 : a.animations, (l = o.trigger) == null ? void 0 : l.animations]), r = O(() => {
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
- (p = (t = e.trigger) == null ? void 0 : t.animations) == null ? void 0 : p.onDismiss,
25
- (d = (m = o.trigger) == null ? void 0 : m.animations) == null ? void 0 : d.onDismiss
26
- ]), i = O(() => {
27
- var g, C, f, P;
28
- const y = (C = (g = e.popover) == null ? void 0 : g.animations) == null ? void 0 : C.onOpen, D = (P = (f = o.popover) == null ? void 0 : f.animations) == null ? void 0 : P.onOpen;
29
- return $(k(y, D));
30
- }, [(u = (c = e.popover) == null ? void 0 : c.animations) == null ? void 0 : u.onOpen, (A = (v = o.popover) == null ? void 0 : v.animations) == null ? void 0 : A.onOpen]), s = O(() => {
31
- var g, C, f, P;
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
- (R = (I = e.popover) == null ? void 0 : I.animations) == null ? void 0 : R.onClose,
36
- (T = (h = o.popover) == null ? void 0 : h.animations) == null ? void 0 : T.onClose
30
+ e.popover?.animations?.onClose,
31
+ o.popover?.animations?.onClose
37
32
  ]);
38
33
  return {
39
- triggerAnimation: n,
34
+ triggerAnimation: t,
40
35
  triggerDismissAnimation: r,
41
36
  popoverOpenAnimation: i,
42
- popoverCloseAnimation: s
37
+ popoverCloseAnimation: p
43
38
  };
44
39
  }
45
- function lo({
40
+ function po({
46
41
  targetSelector: o,
47
42
  position: e,
48
- offset: n,
43
+ offset: t,
49
44
  zIndex: r = 9999,
50
45
  enabled: i = !0,
51
- debug: s = !1
46
+ debug: p = !1
52
47
  }) {
53
- const [a, l] = b(null), t = O(() => new Q(s), [s]);
54
- return E(() => {
48
+ const [n, s] = w(null), a = P(() => new H(p), [p]);
49
+ return O(() => {
55
50
  if (!i) {
56
- l(null);
51
+ s(null);
57
52
  return;
58
53
  }
59
- return t.subscribe(
54
+ return a.subscribe(
60
55
  o,
61
56
  e,
62
- l,
63
- { offset: n, zIndex: r }
57
+ s,
58
+ { offset: t, zIndex: r }
64
59
  );
65
- }, [t, o, e, n, r, i]), E(() => () => t.destroy(), [t]), {
66
- calculatedPosition: a,
67
- targetElement: a ? document.querySelector(o) : null
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 mo() {
71
- const [o, e] = b(!1), [n, r] = b(
65
+ function ao() {
66
+ const [o, e] = w(!1), [t, r] = w(
72
67
  null
73
- ), i = x((t) => {
74
- r(t);
75
- }, []), s = x(
76
- () => n == null ? void 0 : n.togglePopover(),
77
- [n]
78
- ), a = x(
79
- () => n == null ? void 0 : n.showPopover(),
80
- [n]
81
- ), l = x(
82
- () => n == null ? void 0 : n.hidePopover(),
83
- [n]
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 E(() => {
86
- if (!n) return;
87
- const t = (p) => {
88
- e(p.newState === "open");
80
+ return O(() => {
81
+ if (!t) return;
82
+ const a = (c) => {
83
+ e(c.newState === "open");
89
84
  };
90
- return n.addEventListener("toggle", t), () => n.removeEventListener("toggle", t);
91
- }, [n]), {
85
+ return t.addEventListener("toggle", a), () => t.removeEventListener("toggle", a);
86
+ }, [t]), {
92
87
  isOpen: o,
93
- popoverElement: n,
88
+ popoverElement: t,
94
89
  handlePopoverRef: i,
95
- togglePopover: s,
96
- showPopover: a,
97
- hidePopover: l
90
+ togglePopover: p,
91
+ showPopover: n,
92
+ hidePopover: s
98
93
  };
99
94
  }
100
- function uo(o, e) {
101
- return o ? _(o) ? o : /* @__PURE__ */ w(
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 vo(o, e) {
113
- let n;
114
- return _(o) ? n = o : n = /* @__PURE__ */ w(
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
- ), so(n, {
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 go(o, e) {
129
- var l, t, p, m, d, c, u, v, A;
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: n,
127
+ position: t,
133
128
  zIndex: r,
134
129
  offset: i,
135
- popoverPosition: s,
136
- popoverOffset: a
130
+ popoverPosition: p,
131
+ popoverOffset: n
137
132
  };
138
133
  }
139
- function fo({
134
+ function vo({
140
135
  beacon: o,
141
136
  config: e,
142
- store: n,
137
+ store: t,
143
138
  onDismiss: r,
144
139
  debug: i
145
140
  }) {
146
- var S, z, F;
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: t,
143
+ position: a,
150
144
  offset: m,
151
- zIndex: p,
145
+ zIndex: c,
152
146
  enabled: !0,
153
147
  debug: i
154
148
  }), {
155
- isOpen: A,
156
- popoverElement: I,
157
- handlePopoverRef: R,
158
- togglePopover: h,
159
- showPopover: T,
160
- hidePopover: y
161
- } = mo(), {
162
- triggerAnimation: D,
163
- triggerDismissAnimation: g,
164
- popoverOpenAnimation: C,
165
- popoverCloseAnimation: f
166
- } = co(o, e), P = async () => {
167
- l(!0), I == null || I.hidePopover();
168
- const J = Y(
169
- g,
170
- f
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 Z(J), await Promise.resolve(n.dismiss(o.id)), r();
173
- }, W = {
166
+ await Q(U), await Promise.resolve(t.dismiss(o.id)), r();
167
+ }, q = {
174
168
  beaconId: o.id,
175
- position: t,
176
- popoverPosition: d,
177
- popoverOffset: c,
178
- calculatedPosition: u,
179
- isOpen: A,
180
- isDismissing: a,
181
- toggle: h,
182
- open: T,
183
- close: y,
184
- dismiss: P,
185
- triggerAnimation: D,
186
- triggerDismissAnimation: g,
187
- popoverOpenAnimation: C,
188
- popoverCloseAnimation: f,
189
- popoverId: s
190
- }, H = ((S = o.trigger) == null ? void 0 : S.component) || ((z = e.trigger) == null ? void 0 : z.component), j = o.popover.component || ((F = e.popover) == null ? void 0 : F.component);
191
- return !u || !v ? (i && console.warn(
192
- `[Repere] ${o.id} waiting for target element: position=${!!u}, element=${!!v}`
193
- ), null) : j ? /* @__PURE__ */ K(L.Provider, { value: W, children: [
194
- uo(H, {
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: u,
197
- position: t,
198
- isOpen: A,
199
- togglePopover: h
190
+ calculatedPosition: v,
191
+ position: a,
192
+ isOpen: C,
193
+ togglePopover: g
200
194
  }),
201
- vo(j, {
195
+ lo(N, {
202
196
  beacon: o,
203
- position: t,
204
- handleDismiss: P,
205
- hidePopover: y,
206
- handlePopoverRef: R,
207
- popoverId: s
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 Bo({
208
+ function Ro({
215
209
  config: o,
216
210
  currentPath: e,
217
- enabled: n = !0,
211
+ enabled: t = !0,
218
212
  debug: r = !1
219
213
  }) {
220
- const i = O(
221
- () => o.store || new oo(),
214
+ const i = P(
215
+ () => o.store || new X(),
222
216
  [o.store]
223
- ), s = O(
224
- () => new eo(i, { debug: r }),
217
+ ), p = P(
218
+ () => new Y(i, { debug: r }),
225
219
  [i, r]
226
- ), [a, l] = b([]), [t, p] = b(
220
+ ), [n, s] = w([]), [a, c] = w(
227
221
  /* @__PURE__ */ new Set()
228
222
  );
229
- E(() => {
230
- if (!n) {
231
- l([]), p(/* @__PURE__ */ new Set());
223
+ O(() => {
224
+ if (!t) {
225
+ s([]), c(/* @__PURE__ */ new Set());
232
226
  return;
233
227
  }
234
228
  (async () => {
235
- const u = await s.getActiveBeacons(
229
+ const v = await p.getActiveBeacons(
236
230
  o.pages,
237
231
  e
238
232
  );
239
- l(u);
233
+ s(v);
240
234
  })();
241
- }, [s, o.pages, e, n]);
242
- const m = (c) => {
243
- p((u) => /* @__PURE__ */ new Set([...u, c]));
244
- }, d = a.filter(
245
- (c) => !t.has(c.id)
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 d.length === 0 ? null : po(
248
- d.map((c) => /* @__PURE__ */ w(
249
- fo,
241
+ return f.length === 0 ? null : ro(
242
+ f.map((l) => /* @__PURE__ */ u(
243
+ vo,
250
244
  {
251
- beacon: c,
245
+ beacon: l,
252
246
  config: o,
253
247
  store: i,
254
248
  debug: r,
255
- onDismiss: () => m(c.id)
249
+ onDismiss: () => m(l.id)
256
250
  },
257
- c.id
251
+ l.id
258
252
  )),
259
253
  document.body
260
254
  );
261
255
  }
262
- const V = B(
256
+ const z = A(
263
257
  ({
264
258
  children: o,
265
259
  style: e,
266
- popover: n = "auto",
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: s,
271
- onDismiss: a,
272
- onClose: l,
273
- ...t
274
- }, p) => {
264
+ position: p,
265
+ onDismiss: n,
266
+ onClose: s,
267
+ ...a
268
+ }, c) => {
275
269
  const {
276
270
  beaconId: m,
277
- popoverOpenAnimation: d,
278
- popoverCloseAnimation: c,
279
- popoverPosition: u,
280
- popoverOffset: v
281
- } = N(), A = x(
282
- (h) => {
283
- typeof p == "function" ? p(h) : p && (p.current = h);
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
- [p]
286
- ), R = {
279
+ [c]
280
+ ), h = {
287
281
  positionAnchor: m ? `--repere-trigger-${m}` : void 0,
288
- ...v && {
289
- marginLeft: v.x || 0,
290
- marginTop: v.y || 0
282
+ ...d && {
283
+ marginLeft: d.x || 0,
284
+ marginTop: d.y || 0
291
285
  },
292
- ...no(d, c),
286
+ ...Z(f, l),
293
287
  ...e
294
288
  };
295
- return /* @__PURE__ */ w(
289
+ return /* @__PURE__ */ u(
296
290
  "div",
297
291
  {
298
- ref: A,
292
+ ref: C,
299
293
  role: "dialog",
300
294
  "aria-labelledby": `repere-popover-${m}`,
301
295
  "data-repere-popover": "",
302
- "data-position": u,
303
- popover: n,
304
- ...t,
305
- style: R,
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
- V.displayName = "ReperePopover";
312
- const Po = B(
305
+ z.displayName = "ReperePopover";
306
+ const uo = A(
313
307
  ({
314
308
  children: o = "Got it",
315
309
  onClick: e,
316
- as: n,
310
+ as: t,
317
311
  ...r
318
312
  }, i) => {
319
- const s = N(), a = (s == null ? void 0 : s.dismiss) || (() => {
320
- }), l = s == null ? void 0 : s.popoverId;
321
- return /* @__PURE__ */ w(
322
- n || "button",
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
- a(), e == null || e(m);
320
+ n(), e?.(m);
327
321
  },
328
- popovertarget: l,
322
+ popovertarget: s,
329
323
  popovertargetaction: "hide",
330
324
  ...r,
331
325
  children: o
332
326
  }
333
327
  );
334
328
  }
335
- ), Ao = Object.assign(Po, {
329
+ ), go = Object.assign(uo, {
336
330
  displayName: "ReperePopover.AcknowledgeButton"
337
- }), q = B(({ children: o = "×", ...e }, n) => {
338
- const r = N(), i = r == null ? void 0 : r.popoverId;
339
- return /* @__PURE__ */ w(
331
+ }), F = A(({ children: o = "×", ...e }, t) => {
332
+ const i = I()?.popoverId;
333
+ return /* @__PURE__ */ u(
340
334
  "button",
341
335
  {
342
- ref: n,
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
- q.displayName = "ReperePopover.CloseButton";
352
- const G = B(
353
- ({ children: o, ...e }, n) => /* @__PURE__ */ w("div", { ref: n, ...e, children: o })
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
- G.displayName = "ReperePopover.Content";
356
- const U = B(
357
- ({ children: o, ...e }, n) => /* @__PURE__ */ w("div", { ref: n, ...e, children: o })
349
+ M.displayName = "ReperePopover.Content";
350
+ const _ = A(
351
+ ({ children: o, ...e }, t) => /* @__PURE__ */ u("div", { ref: t, ...e, children: o })
358
352
  );
359
- U.displayName = "ReperePopover.Footer";
360
- const Co = B(
361
- ({ children: o, as: e, ...n }, r) => {
362
- const i = N(), s = (i == null ? void 0 : i.beaconId) || "unknown";
363
- return /* @__PURE__ */ w(e || "h3", { ref: r, id: `repere-popover-${s}`, ...n, children: o });
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
- ), ho = Object.assign(Co, {
359
+ ), Po = Object.assign(fo, {
366
360
  displayName: "ReperePopover.Title"
367
- }), To = Object.assign(V, {
368
- Title: ho,
369
- Content: G,
370
- Footer: U,
371
- AcknowledgeButton: Ao,
372
- CloseButton: q
373
- }), wo = B(
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: n,
371
+ style: t,
378
372
  disableAnimation: r,
379
373
  ...i
380
- }, s) => {
374
+ }, p) => {
381
375
  const {
382
- calculatedPosition: a,
383
- beaconId: l,
384
- triggerAnimation: t,
385
- triggerDismissAnimation: p,
376
+ calculatedPosition: n,
377
+ beaconId: s,
378
+ triggerAnimation: a,
379
+ triggerDismissAnimation: c,
386
380
  isDismissing: m,
387
- popoverId: d
388
- } = N(), c = e || "button", u = O(() => !e || e === "button" ? M.button : M.create(c), [e, c]);
389
- if (!a) return null;
390
- const v = {
391
- position: a.position,
392
- top: a.top,
393
- left: a.left,
394
- zIndex: a.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-${l}`
398
- }, A = n ? { ...v, ...n } : v, I = !r && (t || p), R = {
399
- ref: s,
400
- popovertarget: d,
401
- "aria-label": `Beacon trigger for ${l}`,
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 (I) {
406
- const h = m && p ? p : t;
407
- if (!h) return null;
408
- const T = to(
409
- a.translate,
410
- h.variants
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__ */ w(
413
- u,
406
+ return /* @__PURE__ */ u(
407
+ v,
414
408
  {
415
409
  initial: "initial",
416
410
  animate: m ? "exit" : "animate",
417
- variants: T,
418
- transition: h.transition,
419
- ...R,
420
- style: A,
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__ */ w(
426
- c,
419
+ return /* @__PURE__ */ u(
420
+ l,
427
421
  {
428
- ...R,
422
+ ...h,
429
423
  style: {
430
- ...A,
431
- translate: `${a.translate.x} ${a.translate.y}`
424
+ ...C,
425
+ translate: `${n.translate.x} ${n.translate.y}`
432
426
  },
433
427
  children: o
434
428
  }
435
429
  );
436
430
  }
437
- ), bo = Object.assign(wo, {
431
+ ), Do = Object.assign(Co, {
438
432
  displayName: "RepereTrigger"
439
433
  });
440
434
  export {
441
- Bo as Beacons,
442
- To as ReperePopover,
443
- bo as RepereTrigger
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,CAsBd"}
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.0",
3
+ "version": "0.0.2",
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.0"
19
+ "@repere/core": "0.0.2"
21
20
  },
22
21
  "devDependencies": {
23
- "@types/react": "^18.3.18",
24
- "@types/react-dom": "^18.3.5",
25
- "@vitejs/plugin-react": "^4.3.4",
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
- "typescript": "^5.7.3",
30
- "vite": "^6.0.11",
31
- "vite-plugin-dts": "^4.4.2",
32
- "@repere/core": "0.0.0"
28
+ "vite": "^7.3.0",
29
+ "vite-plugin-dts": "^4.5.4",
30
+ "@repere/core": "0.0.2"
33
31
  },
34
32
  "keywords": [
35
33
  "react",