impact-nova 2.6.1 → 2.6.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.
@@ -1,18 +1,18 @@
1
- import { jsx as a, jsxs as n } from "react/jsx-runtime";
1
+ import { jsx as a, jsxs as t } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import { Badge as m } from "../../../data-display/badge/badge.js";
4
4
  import { Dialog as i, DialogContent as x } from "../../../feedback/dialog/dialog.js";
5
- import { GuidanceStepProgressBar as b, GuidanceTourActionFooter as g, GuidanceTourProgressAndNav as h } from "./guidance-card-shared.js";
6
- import { GuidanceAnnouncementSurface as v } from "./guidance-announcement-surface.js";
7
- function k({
5
+ import { GuidanceStepProgressBar as b, GuidanceTourActionFooter as g, GuidanceTourProgressAndNav as h, GuidanceCloseButton as v } from "./guidance-card-shared.js";
6
+ import { GuidanceAnnouncementSurface as f } from "./guidance-announcement-surface.js";
7
+ function N({
8
8
  instruction: e,
9
- onNext: r,
10
- onSkip: c,
11
- onDismiss: p,
12
- onBack: o
9
+ onNext: c,
10
+ onSkip: p,
11
+ onDismiss: d,
12
+ onBack: l
13
13
  }) {
14
- const s = e.stepIndex + 1 >= e.totalSteps, d = e.content.badge?.trim(), l = e.interactionFooter === "keybinding";
15
- return /* @__PURE__ */ a(i, { open: !0, children: /* @__PURE__ */ a(
14
+ const s = e.stepIndex + 1 >= e.totalSteps, r = e.content.badge?.trim(), o = e.interactionFooter === "keybinding";
15
+ return /* @__PURE__ */ a(i, { open: !0, children: /* @__PURE__ */ t(
16
16
  x,
17
17
  {
18
18
  "data-component": "guidance-announcement",
@@ -21,74 +21,77 @@ function k({
21
21
  className: "max-w-[400px] gap-0 overflow-hidden border-0 bg-canvas p-0 sm:rounded-2xl sm:shadow-elevation-floating",
22
22
  "aria-labelledby": `guidance-announcement-title-${e.stepId}`,
23
23
  "aria-describedby": e.content.body ? `guidance-announcement-body-${e.stepId}` : void 0,
24
- onPointerDownOutside: (t) => {
25
- t.preventDefault();
24
+ onPointerDownOutside: (n) => {
25
+ n.preventDefault();
26
26
  },
27
- onInteractOutside: (t) => {
28
- t.preventDefault();
27
+ onInteractOutside: (n) => {
28
+ n.preventDefault();
29
29
  },
30
- onEscapeKeyDown: (t) => {
31
- t.preventDefault();
30
+ onEscapeKeyDown: (n) => {
31
+ n.preventDefault();
32
32
  },
33
- children: /* @__PURE__ */ n("div", { className: "relative overflow-hidden rounded-2xl", children: [
34
- /* @__PURE__ */ a(v, {}),
35
- /* @__PURE__ */ n("div", { className: "relative z-10 flex flex-col items-center px-8 pb-0 pt-10 text-center", children: [
36
- d ? /* @__PURE__ */ a(m, { variant: "subtle", color: "primary", shape: "circle", size: "sm", children: d }) : null,
37
- /* @__PURE__ */ a(
38
- "h2",
39
- {
40
- id: `guidance-announcement-title-${e.stepId}`,
41
- className: "mt-3 text-2xl font-bold leading-8 text-content",
42
- children: e.content.title
43
- }
44
- ),
45
- e.content.body ? /* @__PURE__ */ a(
46
- "p",
47
- {
48
- id: `guidance-announcement-body-${e.stepId}`,
49
- className: "mt-2 max-w-[22rem] text-sm leading-snug text-content-secondary",
50
- children: e.content.body
51
- }
52
- ) : null
53
- ] }),
54
- /* @__PURE__ */ a("div", { className: "relative z-10 px-8 pb-8 pt-6", children: l ? /* @__PURE__ */ n("div", { className: "flex w-full flex-col gap-3", children: [
55
- /* @__PURE__ */ a(
56
- b,
33
+ children: [
34
+ /* @__PURE__ */ t("div", { className: "relative overflow-hidden rounded-2xl", children: [
35
+ /* @__PURE__ */ a(f, {}),
36
+ /* @__PURE__ */ t("div", { className: "relative z-10 flex flex-col items-center px-8 pb-0 pt-10 text-center", children: [
37
+ r ? /* @__PURE__ */ a(m, { variant: "subtle", color: "primary", shape: "circle", size: "sm", children: r }) : null,
38
+ /* @__PURE__ */ a(
39
+ "h2",
40
+ {
41
+ id: `guidance-announcement-title-${e.stepId}`,
42
+ className: "mt-3 text-2xl font-bold leading-8 text-content",
43
+ children: e.content.title
44
+ }
45
+ ),
46
+ e.content.body ? /* @__PURE__ */ a(
47
+ "p",
48
+ {
49
+ id: `guidance-announcement-body-${e.stepId}`,
50
+ className: "mt-2 max-w-[22rem] text-sm leading-snug text-content-secondary",
51
+ children: e.content.body
52
+ }
53
+ ) : null
54
+ ] }),
55
+ /* @__PURE__ */ a("div", { className: "relative z-10 px-8 pb-8 pt-6", children: o ? /* @__PURE__ */ t("div", { className: "flex w-full flex-col gap-3", children: [
56
+ /* @__PURE__ */ a(
57
+ b,
58
+ {
59
+ activeStepIndex: e.stepIndex,
60
+ totalSteps: e.totalSteps
61
+ }
62
+ ),
63
+ /* @__PURE__ */ a(
64
+ g,
65
+ {
66
+ hint: e.content.footer ?? "Press the shortcut to continue.",
67
+ keybinding: e.content.keybinding,
68
+ activeStepIndex: e.stepIndex,
69
+ showBack: e.canGoBack,
70
+ onBack: l
71
+ }
72
+ )
73
+ ] }) : /* @__PURE__ */ a(
74
+ h,
57
75
  {
58
76
  activeStepIndex: e.stepIndex,
59
- totalSteps: e.totalSteps
60
- }
61
- ),
62
- /* @__PURE__ */ a(
63
- g,
64
- {
65
- hint: e.content.footer ?? "Press the shortcut to continue.",
66
- keybinding: e.content.keybinding,
67
- activeStepIndex: e.stepIndex,
77
+ totalSteps: e.totalSteps,
78
+ skippable: e.skippable,
79
+ showSkip: !1,
68
80
  showBack: e.canGoBack,
69
- onBack: o
81
+ onBack: l,
82
+ primaryActionLabel: s ? "Done" : "Next",
83
+ onSkip: p,
84
+ onPrimaryAction: c,
85
+ onEndTour: d,
86
+ showPrimaryAction: !o && e.advanceOn !== "auto"
70
87
  }
71
- )
72
- ] }) : /* @__PURE__ */ a(
73
- h,
74
- {
75
- activeStepIndex: e.stepIndex,
76
- totalSteps: e.totalSteps,
77
- skippable: e.skippable,
78
- showSkip: !1,
79
- showBack: e.canGoBack,
80
- onBack: o,
81
- primaryActionLabel: s ? "Done" : "Next",
82
- onSkip: c,
83
- onPrimaryAction: r,
84
- onEndTour: p,
85
- showPrimaryAction: !l && e.advanceOn !== "auto"
86
- }
87
- ) })
88
- ] })
88
+ ) })
89
+ ] }),
90
+ o ? /* @__PURE__ */ a(v, { onClose: d }) : null
91
+ ]
89
92
  }
90
93
  ) });
91
94
  }
92
95
  export {
93
- k as AnnouncementRenderer
96
+ N as AnnouncementRenderer
94
97
  };
@@ -39,7 +39,7 @@ export declare function useStableTargetRect(targetElement: HTMLElement | null |
39
39
  export declare function useAdvanceOnTargetClick(instruction: RenderInstruction, onNext: () => void): boolean;
40
40
  export declare function useElevateGuidanceTarget(targetElement: HTMLElement | null | undefined, shouldElevate?: boolean): void;
41
41
  export declare function buildHighlightRect(targetRect: HighlightRect, padding?: number, clipBounds?: HighlightRect): HighlightRect;
42
- export declare function buildHighlightRectForTarget(targetElement: HTMLElement, padding?: number): HighlightRect;
42
+ export declare function buildHighlightRectForTarget(targetElement: HTMLElement, padding?: number): HighlightRect | null;
43
43
  export declare function buildHighlightStyle(targetRect: HighlightRect, padding?: number): React.CSSProperties;
44
44
  export declare function computePopoverPosition(options: {
45
45
  targetRect: HighlightRect;
@@ -1,6 +1,6 @@
1
- import * as P from "react";
2
- const y = 16, L = 12, D = 12, G = 16, A = 32;
3
- function R(n) {
1
+ import * as L from "react";
2
+ const C = 16, R = 12, D = 12, G = 16, A = 32;
3
+ function W(n) {
4
4
  const t = window.getComputedStyle(n);
5
5
  return t.overflow === "hidden" || t.overflow === "auto" || t.overflow === "scroll" || t.overflow === "clip" || t.overflowY === "hidden" || t.overflowY === "auto" || t.overflowY === "scroll" || t.overflowY === "clip" || t.overflowX === "hidden" || t.overflowX === "auto" || t.overflowX === "scroll" || t.overflowX === "clip";
6
6
  }
@@ -8,25 +8,25 @@ function k(n) {
8
8
  const t = [];
9
9
  let e = n.parentElement;
10
10
  for (; e; )
11
- R(e) && t.push(e), e = e.parentElement;
11
+ W(e) && t.push(e), e = e.parentElement;
12
12
  return t;
13
13
  }
14
- function x(n, t) {
15
- const e = Math.max(n.x, t.x), o = Math.max(n.y, t.y), r = Math.min(
14
+ function b(n, t) {
15
+ const e = Math.max(n.x, t.x), o = Math.max(n.y, t.y), l = Math.min(
16
16
  n.x + n.width,
17
17
  t.x + t.width
18
18
  ), i = Math.min(
19
19
  n.y + n.height,
20
20
  t.y + t.height
21
21
  );
22
- return r <= e || i <= o ? null : {
22
+ return l <= e || i <= o ? null : {
23
23
  x: e,
24
24
  y: o,
25
- width: r - e,
25
+ width: l - e,
26
26
  height: i - o
27
27
  };
28
28
  }
29
- function C(n) {
29
+ function y(n) {
30
30
  return {
31
31
  x: n.left,
32
32
  y: n.top,
@@ -34,14 +34,14 @@ function C(n) {
34
34
  height: n.height
35
35
  };
36
36
  }
37
- function W(n) {
38
- let t = C(
37
+ function P(n) {
38
+ let t = y(
39
39
  n.getBoundingClientRect()
40
40
  );
41
- for (const r of k(n)) {
42
- const i = x(
41
+ for (const l of k(n)) {
42
+ const i = b(
43
43
  t,
44
- C(r.getBoundingClientRect())
44
+ y(l.getBoundingClientRect())
45
45
  );
46
46
  if (!i)
47
47
  break;
@@ -53,7 +53,7 @@ function W(n) {
53
53
  width: window.innerWidth,
54
54
  height: window.innerHeight
55
55
  };
56
- return x(
56
+ return b(
57
57
  t,
58
58
  e
59
59
  ) ?? t;
@@ -67,47 +67,47 @@ function E(n) {
67
67
  }
68
68
  return t;
69
69
  }
70
- function _(n) {
70
+ function V(n) {
71
71
  return E(n).map((t) => ({
72
72
  element: t,
73
73
  scrollTop: t.scrollTop,
74
74
  scrollLeft: t.scrollLeft
75
75
  }));
76
76
  }
77
- function B(n) {
77
+ function _(n) {
78
78
  for (const t of n)
79
79
  t.element.isConnected && (t.element.scrollTop = t.scrollTop, t.element.scrollLeft = t.scrollLeft);
80
80
  }
81
- let d = null;
82
- function j(n) {
83
- d === null && (d = _(n));
81
+ let u = null;
82
+ function z(n) {
83
+ u === null && (u = V(n));
84
84
  }
85
- function z() {
86
- d !== null && (B(d), d = null);
85
+ function J() {
86
+ u !== null && (_(u), u = null);
87
87
  }
88
- function N(n, t = A) {
88
+ function B(n, t = A) {
89
89
  const e = n.getBoundingClientRect(), o = window.innerHeight;
90
- return e.top < t || e.bottom > o - t;
90
+ return e.top <= t && e.bottom >= o - t && e.height >= o - t * 2 ? !1 : e.top < t || e.bottom > o - t;
91
91
  }
92
- function O(n) {
93
- const { targetElement: t, scrollContainer: e, viewportPadding: o } = n, r = e.getBoundingClientRect(), i = t.getBoundingClientRect(), u = e.clientHeight - o * 2;
94
- if (i.height >= u) {
95
- const h = i.top - r.top - o;
96
- Math.abs(h) > 1 && (e.scrollTop += h);
92
+ function N(n) {
93
+ const { targetElement: t, scrollContainer: e, viewportPadding: o } = n, l = e.getBoundingClientRect(), i = t.getBoundingClientRect(), p = e.clientHeight - o * 2;
94
+ if (i.height >= p) {
95
+ const a = i.top - l.top - o;
96
+ Math.abs(a) > 1 && (e.scrollTop += a);
97
97
  return;
98
98
  }
99
- if (i.top < r.top + o) {
100
- e.scrollTop -= r.top + o - i.top;
99
+ if (i.top < l.top + o) {
100
+ e.scrollTop -= l.top + o - i.top;
101
101
  return;
102
102
  }
103
- i.bottom > r.bottom - o && (e.scrollTop += i.bottom - (r.bottom - o));
103
+ i.bottom > l.bottom - o && (e.scrollTop += i.bottom - (l.bottom - o));
104
104
  }
105
- function J(n, t = A) {
106
- if (!N(n, t))
105
+ function K(n, t = A) {
106
+ if (!B(n, t))
107
107
  return;
108
108
  const o = E(n)[0];
109
109
  if (o) {
110
- O({
110
+ N({
111
111
  targetElement: n,
112
112
  scrollContainer: o,
113
113
  viewportPadding: t
@@ -120,23 +120,23 @@ function J(n, t = A) {
120
120
  inline: "nearest"
121
121
  });
122
122
  }
123
- function K(n, t) {
123
+ function Q(n, t) {
124
124
  const e = n.advanceOn === "click-target";
125
- return P.useEffect(() => {
125
+ return L.useEffect(() => {
126
126
  if (!e)
127
127
  return;
128
128
  const o = n.target?.element;
129
129
  if (!o)
130
130
  return;
131
- const r = () => {
131
+ const l = () => {
132
132
  requestAnimationFrame(() => {
133
133
  requestAnimationFrame(() => {
134
134
  t();
135
135
  });
136
136
  });
137
137
  };
138
- return o.addEventListener("click", r, { once: !0 }), () => {
139
- o.removeEventListener("click", r);
138
+ return o.addEventListener("click", l, { once: !0 }), () => {
139
+ o.removeEventListener("click", l);
140
140
  };
141
141
  }, [
142
142
  e,
@@ -145,7 +145,7 @@ function K(n, t) {
145
145
  t
146
146
  ]), e;
147
147
  }
148
- function V(n, t = y, e) {
148
+ function O(n, t = C, e) {
149
149
  return {
150
150
  x: n.x - t,
151
151
  y: n.y - t,
@@ -153,128 +153,137 @@ function V(n, t = y, e) {
153
153
  height: n.height + t * 2
154
154
  };
155
155
  }
156
- function Q(n, t = y) {
157
- const e = W(n);
158
- return V(e, t);
156
+ function Y(n) {
157
+ if (typeof window > "u")
158
+ return n;
159
+ const t = {
160
+ x: 0,
161
+ y: 0,
162
+ width: window.innerWidth,
163
+ height: window.innerHeight
164
+ };
165
+ return b(n, t);
166
+ }
167
+ function Z(n, t = C) {
168
+ const e = P(n);
169
+ return Y(
170
+ O(e, t)
171
+ );
159
172
  }
160
- function Y(n, t, e = 2) {
173
+ function F(n, t, e = 2) {
161
174
  return !(n.x + n.width <= t.x - e || t.x + t.width <= n.x - e || n.y + n.height <= t.y - e || t.y + t.height <= n.y - e);
162
175
  }
163
- function Z(n) {
176
+ function $(n) {
164
177
  const {
165
178
  targetRect: t,
166
179
  popoverWidth: e,
167
180
  popoverHeight: o,
168
- gap: r = L,
181
+ gap: l = R,
169
182
  viewportPadding: i = G,
170
- preferredPlacement: u = "auto"
171
- } = n, l = r + D, h = t.x + t.width, v = t.y + t.height, g = t.x, f = window.innerWidth - h, m = t.y, w = window.innerHeight - v, S = (s) => ({
172
- x: s.left,
173
- y: s.top,
183
+ preferredPlacement: p = "auto"
184
+ } = n, r = l + D, a = t.x + t.width, v = t.y + t.height, g = t.x, d = window.innerWidth - a, m = t.y, w = window.innerHeight - v, S = (c) => ({
185
+ x: c.left,
186
+ y: c.top,
174
187
  width: e,
175
188
  height: o
176
- }), p = (s) => {
177
- for (const a of s) {
178
- const c = b(a);
179
- if (!Y(S(c), t))
180
- return c;
189
+ }), f = (c) => {
190
+ for (const h of c) {
191
+ const s = x(h);
192
+ if (!F(S(s), t))
193
+ return s;
181
194
  }
182
- return b(s[0]);
183
- }, b = (s) => {
184
- let a, c;
185
- switch (s) {
195
+ return x(c[0]);
196
+ }, x = (c) => {
197
+ let h, s;
198
+ switch (c) {
186
199
  case "left":
187
- c = Math.max(
200
+ s = Math.max(
188
201
  i,
189
- t.x - e - l
190
- ), a = Math.max(
202
+ t.x - e - r
203
+ ), h = t.y + t.height / 2 - o / 2, h = Math.max(
191
204
  i,
192
- Math.min(
193
- t.y,
194
- window.innerHeight - o - i
195
- )
205
+ Math.min(h, window.innerHeight - o - i)
196
206
  );
197
207
  break;
198
208
  case "right":
199
- c = Math.min(
200
- h + l,
209
+ s = Math.min(
210
+ a + r,
201
211
  window.innerWidth - e - i
202
- ), a = Math.max(
212
+ ), h = t.y + t.height / 2 - o / 2, h = Math.max(
203
213
  i,
204
- Math.min(
205
- t.y,
206
- window.innerHeight - o - i
207
- )
214
+ Math.min(h, window.innerHeight - o - i)
208
215
  );
209
216
  break;
210
217
  case "top":
211
- a = Math.max(i, t.y - o - r), c = t.x + t.width / 2 - e / 2, c = Math.max(
218
+ h = Math.max(i, t.y - o - r), s = t.x + t.width / 2 - e / 2, s = Math.max(
212
219
  i,
213
- Math.min(c, window.innerWidth - e - i)
220
+ Math.min(s, window.innerWidth - e - i)
214
221
  );
215
222
  break;
216
223
  default:
217
- a = Math.min(
224
+ h = Math.min(
218
225
  v + r,
219
226
  window.innerHeight - o - i
220
- ), c = t.x + t.width / 2 - e / 2, c = Math.max(
227
+ ), s = t.x + t.width / 2 - e / 2, s = Math.max(
221
228
  i,
222
- Math.min(c, window.innerWidth - e - i)
229
+ Math.min(s, window.innerWidth - e - i)
223
230
  );
224
231
  break;
225
232
  }
226
- return { top: a, left: c, placement: s };
233
+ return { top: h, left: s, placement: c };
227
234
  };
228
- if (u !== "auto" && {
229
- left: g >= e + l,
230
- right: f >= e + l,
235
+ if (p !== "auto" && {
236
+ left: g >= e + r,
237
+ right: d >= e + r,
231
238
  top: m >= o + r,
232
239
  bottom: w >= o + r
233
- }[u])
234
- return p([u, "left", "right", "top", "bottom"]);
240
+ }[p])
241
+ return f([p, "left", "right", "top", "bottom"]);
235
242
  const H = t.width <= 320, M = e >= t.width * 1.15;
236
243
  if (H && M) {
237
- const s = g >= f ? ["left", "right"] : ["right", "left"];
238
- if (g >= e + l || f >= e + l)
239
- return p([...s, "top", "bottom"]);
244
+ const c = g >= d ? ["left", "right"] : ["right", "left"];
245
+ if (g >= e + r || d >= e + r)
246
+ return f([...c, "top", "bottom"]);
240
247
  }
241
- if (t.width <= 280 && t.x >= window.innerWidth * 0.35 && g >= e + l)
242
- return p(["left", "right", "top", "bottom"]);
243
- if (t.width >= 480 && h >= window.innerWidth - i - 80 && g >= e + l)
248
+ if (t.width <= 280 && t.x >= window.innerWidth * 0.35 && g >= e + r)
249
+ return f(["left", "right", "top", "bottom"]);
250
+ if (t.width >= 480 && a >= window.innerWidth - i - 80 && g >= e + r) {
251
+ const c = t.y + t.height / 2 - o / 2;
244
252
  return {
245
253
  placement: "left",
246
- left: Math.max(i, t.x - e - l),
254
+ left: Math.max(i, t.x - e - r),
247
255
  top: Math.max(
248
256
  i,
249
257
  Math.min(
250
- t.y + 16,
258
+ c,
251
259
  window.innerHeight - o - i
252
260
  )
253
261
  )
254
262
  };
263
+ }
255
264
  if (t.height > t.width * 2.5) {
256
- if (f >= e + l)
257
- return p(["right", "left", "top", "bottom"]);
258
- if (g >= e + l)
259
- return p(["left", "right", "top", "bottom"]);
265
+ if (d >= e + r)
266
+ return f(["right", "left", "top", "bottom"]);
267
+ if (g >= e + r)
268
+ return f(["left", "right", "top", "bottom"]);
260
269
  }
261
270
  const I = t.y + t.height / 2 > window.innerHeight * 0.55;
262
271
  let T;
263
- return I && m >= o + r && w < o + r * 2 ? T = "top" : T = w >= o + r || w >= m ? "bottom" : "top", p([T, "left", "right", "top", "bottom"]);
272
+ return I && m >= o + r && w < o + r * 2 ? T = "top" : T = w >= o + r || w >= m ? "bottom" : "top", f([T, "left", "right", "top", "bottom"]);
264
273
  }
265
274
  export {
266
275
  D as GUIDANCE_POPOVER_CARET_CLEARANCE,
267
- L as GUIDANCE_POPOVER_GAP,
268
- y as GUIDANCE_SPOTLIGHT_PADDING,
276
+ R as GUIDANCE_POPOVER_GAP,
277
+ C as GUIDANCE_SPOTLIGHT_PADDING,
269
278
  A as GUIDANCE_TARGET_SCROLL_PADDING,
270
279
  G as GUIDANCE_VIEWPORT_PADDING,
271
- j as beginTourScrollSnapshot,
272
- V as buildHighlightRect,
273
- Q as buildHighlightRectForTarget,
274
- Z as computePopoverPosition,
275
- z as endTourScrollSnapshot,
276
- W as getVisibleTargetRect,
277
- N as needsGuidanceTargetScroll,
278
- J as scrollGuidanceTargetIntoView,
279
- K as useAdvanceOnTargetClick
280
+ z as beginTourScrollSnapshot,
281
+ O as buildHighlightRect,
282
+ Z as buildHighlightRectForTarget,
283
+ $ as computePopoverPosition,
284
+ J as endTourScrollSnapshot,
285
+ P as getVisibleTargetRect,
286
+ B as needsGuidanceTargetScroll,
287
+ K as scrollGuidanceTargetIntoView,
288
+ Q as useAdvanceOnTargetClick
280
289
  };