@actioneer/ads 0.5.7 → 0.5.8

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.
Files changed (140) hide show
  1. package/bin/ads-init.mjs +6 -0
  2. package/components/accordion.js +50 -48
  3. package/components/agent-icon.d.ts +12 -0
  4. package/components/agent-icon.js +133 -120
  5. package/components/ai-elements/chain-of-thought.d.ts +1 -1
  6. package/components/ai-elements/chain-of-thought.js +108 -108
  7. package/components/ai-elements/chart.js +16 -14
  8. package/components/ai-elements/inline-citation.js +41 -41
  9. package/components/ai-elements/message.js +4 -4
  10. package/components/ai-elements/queue.js +7 -7
  11. package/components/ai-elements/research-activity.js +114 -114
  12. package/components/ai-elements/shimmer.d.ts +2 -2
  13. package/components/ai-elements/speech-input.js +28 -28
  14. package/components/ai-elements/task-progress.js +26 -16
  15. package/components/ai-elements/task.js +17 -17
  16. package/components/ai-elements/tool.js +6 -6
  17. package/components/ai-elements/transcript.js +6 -5
  18. package/components/ai-elements/voice.js +1 -1
  19. package/components/alert.js +10 -10
  20. package/components/answer-sources.js +1 -1
  21. package/components/answer.js +115 -114
  22. package/components/assistant-ui/action-bar.js +94 -48
  23. package/components/assistant-ui/attachment.js +103 -75
  24. package/components/assistant-ui/badge.d.ts +1 -1
  25. package/components/assistant-ui/badge.js +17 -17
  26. package/components/assistant-ui/chain-of-thought.d.ts +1 -1
  27. package/components/assistant-ui/composer-add-context.js +9 -9
  28. package/components/assistant-ui/composer-deep-research.js +5 -5
  29. package/components/assistant-ui/composer-harness.js +11 -9
  30. package/components/assistant-ui/composer-trigger-popover.js +45 -34
  31. package/components/assistant-ui/composer.js +59 -59
  32. package/components/assistant-ui/error.js +14 -14
  33. package/components/assistant-ui/file.d.ts +1 -1
  34. package/components/assistant-ui/image.d.ts +1 -1
  35. package/components/assistant-ui/image.js +113 -103
  36. package/components/assistant-ui/markdown-text.js +18 -18
  37. package/components/assistant-ui/message.js +46 -45
  38. package/components/assistant-ui/quote.js +1 -1
  39. package/components/assistant-ui/reasoning.d.ts +1 -1
  40. package/components/assistant-ui/reasoning.js +66 -77
  41. package/components/assistant-ui/suggestions.js +4 -4
  42. package/components/assistant-ui/thread.js +22 -22
  43. package/components/assistant-ui/tool-fallback.js +60 -63
  44. package/components/assistant-ui/tool-group.d.ts +1 -1
  45. package/components/assistant-ui/tool-group.js +36 -42
  46. package/components/audio-waveform.js +25 -24
  47. package/components/autocomplete.d.ts +1 -0
  48. package/components/autocomplete.js +45 -43
  49. package/components/avatar.js +24 -24
  50. package/components/badge.d.ts +1 -1
  51. package/components/breadcrumbs.js +2 -2
  52. package/components/button.d.ts +2 -2
  53. package/components/button.js +22 -20
  54. package/components/card.js +8 -8
  55. package/components/carousel.js +105 -104
  56. package/components/chart.js +9 -7
  57. package/components/checkbox.js +74 -38
  58. package/components/chip.d.ts +1 -1
  59. package/components/code-block.js +3 -3
  60. package/components/collapsible.js +67 -23
  61. package/components/connector-card.js +6 -6
  62. package/components/drawer.d.ts +15 -10
  63. package/components/drawer.js +78 -77
  64. package/components/dropdown.d.ts +2 -0
  65. package/components/dropdown.js +88 -79
  66. package/components/empty-state.d.ts +1 -1
  67. package/components/empty-state.js +7 -7
  68. package/components/field.d.ts +4 -0
  69. package/components/field.js +45 -34
  70. package/components/file-dropzone.js +12 -12
  71. package/components/index.d.ts +3 -0
  72. package/components/index.js +584 -558
  73. package/components/input-field.js +51 -46
  74. package/components/input.js +20 -20
  75. package/components/link.js +9 -9
  76. package/components/modal.js +105 -73
  77. package/components/navbar.d.ts +1 -1
  78. package/components/navbar.js +1 -1
  79. package/components/number-field.js +38 -29
  80. package/components/page-header.js +12 -12
  81. package/components/pagination.js +19 -19
  82. package/components/panel.js +2 -2
  83. package/components/pixel-blast-svg.js +3 -3
  84. package/components/pixel-icon.js +0 -1
  85. package/components/popover.d.ts +1 -1
  86. package/components/popover.js +66 -64
  87. package/components/progress-circle.js +36 -32
  88. package/components/progress.js +28 -24
  89. package/components/radio.js +59 -49
  90. package/components/resizable-panel.js +1 -1
  91. package/components/reveal.d.ts +2 -2
  92. package/components/ripple.d.ts +3 -3
  93. package/components/scroll-area.js +17 -16
  94. package/components/segmented.js +26 -26
  95. package/components/select.d.ts +2 -0
  96. package/components/select.js +61 -57
  97. package/components/setting-row.js +45 -42
  98. package/components/sidebar.js +131 -127
  99. package/components/skeleton.js +5 -5
  100. package/components/spinner.d.ts +13 -4
  101. package/components/spinner.js +42 -42
  102. package/components/stepper.js +21 -21
  103. package/components/switch.js +41 -39
  104. package/components/table.d.ts +9 -0
  105. package/components/table.js +370 -247
  106. package/components/tabs.js +149 -137
  107. package/components/toast.js +66 -66
  108. package/components/tooltip.js +2 -2
  109. package/components/tree.js +62 -51
  110. package/components/typography.d.ts +2 -1
  111. package/components/typography.js +33 -32
  112. package/components/ui/button.d.ts +2 -2
  113. package/components/ui/button.js +19 -19
  114. package/components/ui/collapsible.d.ts +1 -5
  115. package/components/ui/dialog.d.ts +3 -3
  116. package/components/ui/dialog.js +95 -58
  117. package/components/ui/tooltip.d.ts +2 -2
  118. package/components/ui/tooltip.js +67 -33
  119. package/components/viz-charts.js +95 -95
  120. package/demo/components/add-to-artifact.js +341 -0
  121. package/demo/lib/artifact-library.js +134 -0
  122. package/fonts/aribau-grotesk-medium.woff2 +0 -0
  123. package/fonts/aribau-grotesk-regular.woff2 +0 -0
  124. package/fonts.css +11 -11
  125. package/hooks/agents-ui/use-agent-audio-visualizer-aura.js +17 -16
  126. package/hooks/agents-ui/use-agent-audio-visualizer-wave.js +21 -20
  127. package/lib/icons.d.ts +4 -0
  128. package/lib/icons.js +103 -102
  129. package/lib/motion.d.ts +42 -39
  130. package/lib/motion.js +112 -52
  131. package/lib/spinner-mark.d.ts +9 -0
  132. package/lib/spinner-mark.js +98 -0
  133. package/llms.txt +52 -18
  134. package/manifest.json +240 -31
  135. package/package.json +1 -1
  136. package/styles.css +143 -124
  137. package/theme.css +90 -93
  138. package/components/ui/collapsible.js +0 -35
  139. package/fonts/aribau-grotesk-500.otf +0 -0
  140. package/fonts/aribau-grotesk-600.woff2 +0 -0
@@ -1,67 +1,76 @@
1
1
  "use client";
2
- import { jsxs as k, jsx as r } from "react/jsx-runtime";
2
+ import { jsxs as k, jsx as s } from "react/jsx-runtime";
3
3
  import * as M from "react";
4
4
  import { Minus as _, Plus as j } from "../lib/icons.js";
5
- import { cn as c } from "../lib/cn.js";
5
+ import { cn as a } from "../lib/cn.js";
6
6
  import { inputBaseClass as h } from "./field.js";
7
7
  const D = {
8
- sm: { field: "h-8 text-xs", btn: "size-8 [&_svg]:size-3.5" },
9
- md: { field: "h-10 text-xs", btn: "size-10 [&_svg]:size-4" },
10
- lg: { field: "h-11 text-base", btn: "size-11 [&_svg]:size-4" }
8
+ sm: {
9
+ field: "h-8 rounded-sm text-xs",
10
+ btn: "size-8 rounded-sm [&_svg]:size-3.5"
11
+ },
12
+ md: {
13
+ field: "h-10 rounded-md text-xs",
14
+ btn: "size-10 rounded-md [&_svg]:size-4"
15
+ },
16
+ lg: {
17
+ field: "h-11 rounded-md text-base",
18
+ btn: "size-11 rounded-md [&_svg]:size-4"
19
+ }
11
20
  }, F = M.forwardRef(
12
21
  ({
13
22
  className: v,
14
- value: l,
23
+ value: c,
15
24
  onChange: t,
16
25
  min: i,
17
- max: s,
18
- step: d = 1,
26
+ max: n,
27
+ step: l = 1,
19
28
  size: x = "md",
20
29
  isInvalid: N,
21
30
  disabled: o,
22
31
  ...z
23
32
  }, w) => {
24
- const u = D[x], b = (n) => {
25
- let e = n;
26
- return i !== void 0 && (e = Math.max(i, e)), s !== void 0 && (e = Math.min(s, e)), e;
27
- }, a = l ?? 0, y = !o && (i === void 0 || a > i), g = !o && (s === void 0 || a < s), p = (n) => t == null ? void 0 : t(b(a + n * d)), m = c(
33
+ const u = D[x], b = (r) => {
34
+ let e = r;
35
+ return i !== void 0 && (e = Math.max(i, e)), n !== void 0 && (e = Math.min(n, e)), e;
36
+ }, d = c ?? 0, y = !o && (i === void 0 || d > i), g = !o && (n === void 0 || d < n), m = (r) => t == null ? void 0 : t(b(d + r * l)), p = a(
28
37
  "inline-flex items-center justify-center rounded-md border border-input bg-elevated text-foreground",
29
- "transition-[background,box-shadow] duration-(--duration-fast) hover:bg-muted",
38
+ "transition-[background,box-shadow] duration-150 hover:bg-muted",
30
39
  "outline-none focus-visible:ring-3 focus-visible:ring-ring",
31
40
  "disabled:pointer-events-none disabled:opacity-50",
32
41
  u.btn
33
42
  );
34
- return /* @__PURE__ */ k("div", { className: c("inline-flex items-center gap-1.5", v), children: [
35
- /* @__PURE__ */ r(
43
+ return /* @__PURE__ */ k("div", { className: a("inline-flex items-center gap-1.5", v), children: [
44
+ /* @__PURE__ */ s(
36
45
  "button",
37
46
  {
38
47
  type: "button",
39
48
  "aria-label": "Decrease",
40
49
  disabled: !y,
41
- onClick: () => p(-1),
42
- className: m,
43
- children: /* @__PURE__ */ r(_, {})
50
+ onClick: () => m(-1),
51
+ className: p,
52
+ children: /* @__PURE__ */ s(_, {})
44
53
  }
45
54
  ),
46
- /* @__PURE__ */ r(
55
+ /* @__PURE__ */ s(
47
56
  "input",
48
57
  {
49
58
  ref: w,
50
59
  type: "number",
51
60
  inputMode: "numeric",
52
- value: l ?? "",
61
+ value: c ?? "",
53
62
  min: i,
54
- max: s,
55
- step: d,
63
+ max: n,
64
+ step: l,
56
65
  disabled: o,
57
66
  "aria-invalid": N || void 0,
58
- onChange: (n) => {
59
- const e = n.target.value;
67
+ onChange: (r) => {
68
+ const e = r.target.value;
60
69
  if (e === "") return;
61
70
  const f = Number(e);
62
71
  Number.isNaN(f) || t == null || t(b(f));
63
72
  },
64
- className: c(
73
+ className: a(
65
74
  h,
66
75
  "w-20 text-center [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
67
76
  u.field
@@ -69,15 +78,15 @@ const D = {
69
78
  ...z
70
79
  }
71
80
  ),
72
- /* @__PURE__ */ r(
81
+ /* @__PURE__ */ s(
73
82
  "button",
74
83
  {
75
84
  type: "button",
76
85
  "aria-label": "Increase",
77
86
  disabled: !g,
78
- onClick: () => p(1),
79
- className: m,
80
- children: /* @__PURE__ */ r(j, {})
87
+ onClick: () => m(1),
88
+ className: p,
89
+ children: /* @__PURE__ */ s(j, {})
81
90
  }
82
91
  )
83
92
  ] });
@@ -1,27 +1,27 @@
1
1
  "use client";
2
2
  import { jsxs as t, jsx as e } from "react/jsx-runtime";
3
- import * as c from "react";
3
+ import * as o from "react";
4
4
  import { ArrowLeft as d } from "../lib/icons.js";
5
5
  import { cn as f } from "../lib/cn.js";
6
6
  import { Button as h } from "./button.js";
7
- const x = c.forwardRef(
7
+ const x = o.forwardRef(
8
8
  ({
9
- className: s,
10
- title: m,
9
+ className: m,
10
+ title: s,
11
11
  description: r,
12
12
  onBack: a,
13
- backLabel: l = "Back",
13
+ backLabel: n = "Back",
14
14
  actions: i,
15
- ...n
16
- }, o) => /* @__PURE__ */ t(
15
+ ...l
16
+ }, c) => /* @__PURE__ */ t(
17
17
  "header",
18
18
  {
19
- ref: o,
19
+ ref: c,
20
20
  className: f(
21
21
  "flex min-w-0 items-start justify-between gap-4",
22
- s
22
+ m
23
23
  ),
24
- ...n,
24
+ ...l,
25
25
  children: [
26
26
  /* @__PURE__ */ t("div", { className: "flex min-w-0 items-start gap-2", children: [
27
27
  a && /* @__PURE__ */ e(
@@ -30,14 +30,14 @@ const x = c.forwardRef(
30
30
  type: "button",
31
31
  size: "icon-sm",
32
32
  variant: "ghost",
33
- "aria-label": l,
33
+ "aria-label": n,
34
34
  className: "shrink-0",
35
35
  onClick: a,
36
36
  children: /* @__PURE__ */ e(d, { "aria-hidden": !0 })
37
37
  }
38
38
  ),
39
39
  /* @__PURE__ */ t("div", { className: "min-w-0", children: [
40
- /* @__PURE__ */ e("h1", { className: "flex min-h-8 items-center text-xl font-semibold tracking-tight text-foreground", children: m }),
40
+ /* @__PURE__ */ e("h1", { className: "flex min-h-8 items-center text-xl font-medium tracking-tight text-foreground", children: s }),
41
41
  r && /* @__PURE__ */ e("p", { className: "mt-1 max-w-2xl text-xs text-muted-foreground", children: r })
42
42
  ] })
43
43
  ] }),
@@ -12,7 +12,7 @@ function p(e, r) {
12
12
  function E(e, r, t) {
13
13
  if (t * 2 + 5 >= e)
14
14
  return p(1, e);
15
- const m = Math.max(r - t, 1), n = Math.min(r + t, e), d = m > 2, a = n < e - 1;
15
+ const m = Math.max(r - t, 1), s = Math.min(r + t, e), d = m > 2, a = s < e - 1;
16
16
  if (!d && a) {
17
17
  const c = t * 2 + 3;
18
18
  return [...p(1, c), "end-ellipsis", e];
@@ -24,7 +24,7 @@ function E(e, r, t) {
24
24
  return [
25
25
  1,
26
26
  "start-ellipsis",
27
- ...p(m, n),
27
+ ...p(m, s),
28
28
  "end-ellipsis",
29
29
  e
30
30
  ];
@@ -32,7 +32,7 @@ function E(e, r, t) {
32
32
  const A = (e) => o(
33
33
  "inline-flex items-center justify-center rounded-md font-normal",
34
34
  "outline-none focus-visible:ring-3 focus-visible:ring-ring",
35
- "transition active:scale-(--scale-press)",
35
+ "transition active:scale-[0.97] motion-reduce:transition-none motion-reduce:active:scale-100",
36
36
  "disabled:pointer-events-none disabled:opacity-40",
37
37
  e === "sm" ? "size-7 text-xs" : "size-9 text-xs"
38
38
  ), N = (e) => e === "sm" ? "w-auto gap-1.5 px-2" : "w-auto gap-1.5 px-2.5", F = j.forwardRef(
@@ -42,7 +42,7 @@ const A = (e) => o(
42
42
  page: t,
43
43
  onChange: i,
44
44
  siblings: m = 1,
45
- size: n = "md",
45
+ size: s = "md",
46
46
  summary: d,
47
47
  labels: a = !1,
48
48
  pageSize: c,
@@ -51,7 +51,7 @@ const A = (e) => o(
51
51
  ...C
52
52
  }, y) => {
53
53
  if (r <= 0) return null;
54
- const P = E(r, t, m), R = t <= 1, S = t >= r, f = A(n), x = n === "sm" ? "size-3.5" : "size-4", h = c != null && !!g, b = d != null || h;
54
+ const P = E(r, t, m), R = t <= 1, S = t >= r, f = A(s), x = s === "sm" ? "size-3.5" : "size-4", h = c != null && !!g, b = d != null || h;
55
55
  return /* @__PURE__ */ u(
56
56
  "nav",
57
57
  {
@@ -90,12 +90,12 @@ const A = (e) => o(
90
90
  size: "sm",
91
91
  className: "w-18",
92
92
  placement: "top",
93
- items: (w ?? [8, 16, 32]).map((s) => ({
94
- label: String(s),
95
- value: String(s)
93
+ items: (w ?? [8, 16, 32]).map((n) => ({
94
+ label: String(n),
95
+ value: String(n)
96
96
  })),
97
97
  value: String(c),
98
- onChange: (s) => g(Number(s))
98
+ onChange: (n) => g(Number(n))
99
99
  }
100
100
  )
101
101
  ]
@@ -112,7 +112,7 @@ const A = (e) => o(
112
112
  className: o(
113
113
  f,
114
114
  "text-foreground hover:bg-muted",
115
- a && N(n)
115
+ a && N(s)
116
116
  ),
117
117
  children: [
118
118
  /* @__PURE__ */ l(k, { className: x, "aria-hidden": !0 }),
@@ -120,8 +120,8 @@ const A = (e) => o(
120
120
  ]
121
121
  }
122
122
  ),
123
- P.map((s) => {
124
- if (s === "start-ellipsis" || s === "end-ellipsis")
123
+ P.map((n) => {
124
+ if (n === "start-ellipsis" || n === "end-ellipsis")
125
125
  return /* @__PURE__ */ l(
126
126
  "span",
127
127
  {
@@ -129,23 +129,23 @@ const A = (e) => o(
129
129
  className: o(f, "text-muted-foreground"),
130
130
  children: /* @__PURE__ */ l(L, { className: x })
131
131
  },
132
- s
132
+ n
133
133
  );
134
- const v = s === t;
134
+ const v = n === t;
135
135
  return /* @__PURE__ */ l(
136
136
  "button",
137
137
  {
138
138
  type: "button",
139
- "aria-label": `Go to page ${s}`,
139
+ "aria-label": `Go to page ${n}`,
140
140
  "aria-current": v ? "page" : void 0,
141
- onClick: () => i(s),
141
+ onClick: () => i(n),
142
142
  className: o(
143
143
  f,
144
144
  v ? "bg-foreground text-background" : "text-foreground hover:bg-muted"
145
145
  ),
146
- children: s
146
+ children: n
147
147
  },
148
- s
148
+ n
149
149
  );
150
150
  }),
151
151
  /* @__PURE__ */ u(
@@ -158,7 +158,7 @@ const A = (e) => o(
158
158
  className: o(
159
159
  f,
160
160
  "text-foreground hover:bg-muted",
161
- a && N(n)
161
+ a && N(s)
162
162
  ),
163
163
  children: [
164
164
  a && "Next",
@@ -37,7 +37,7 @@ const d = l.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ o(
37
37
  "h2",
38
38
  {
39
39
  ref: r,
40
- className: n("flex min-w-0 items-center gap-2 truncate text-xs font-semibold text-foreground", e),
40
+ className: n("flex min-w-0 items-center gap-2 truncate text-xs font-medium text-foreground", e),
41
41
  ...a
42
42
  }
43
43
  ));
@@ -47,7 +47,7 @@ const i = l.forwardRef(
47
47
  );
48
48
  i.displayName = "PanelToolbar";
49
49
  const f = l.forwardRef(
50
- ({ className: e, ...a }, r) => /* @__PURE__ */ o("div", { ref: r, className: n("min-h-0 flex-1 overflow-auto p-4", e), ...a })
50
+ ({ className: e, ...a }, r) => /* @__PURE__ */ o("div", { ref: r, tabIndex: 0, className: n("min-h-0 flex-1 overflow-auto p-4", e), ...a })
51
51
  );
52
52
  f.displayName = "PanelBody";
53
53
  const m = l.forwardRef(
@@ -13,7 +13,7 @@ const z = {
13
13
  preserveDrawingBuffer: !1
14
14
  }, O = 1e6, B = `uniform float u_type;
15
15
  uniform float u_patternDensity;
16
- uniform float u_pixelSizeJitter;`, k = " float res = step(.5, shape + dithering);", b = ` vec2 triangleUV = fract(pxSizeUV);
16
+ uniform float u_pixelSizeJitter;`, k = " float res = step(.5, shape + dithering);", G = ` vec2 triangleUV = fract(pxSizeUV);
17
17
  vec2 triangleCell = floor(pxSizeUV);
18
18
  float triangleFlip = mod(triangleCell.x + triangleCell.y, 2.0);
19
19
  triangleUV.x = mix(triangleUV.x, 1.0 - triangleUV.x, triangleFlip);
@@ -31,7 +31,7 @@ uniform float u_pixelSizeJitter;`, k = " float res = step(.5, shape + dithering
31
31
  float res = step(densityThreshold, shape + dithering) * triangleMask;`;
32
32
  if (!g.includes("uniform float u_type;") || !g.includes(k))
33
33
  throw new Error("The Paper dithering shader no longer exposes the expected cell output.");
34
- const G = g.replace("uniform float u_type;", B).replace(k, b), d = (e) => Math.max(0, Math.min(1, e)), J = "#0a0a0b", W = "#ffffff";
34
+ const b = g.replace("uniform float u_type;", B).replace(k, G), d = (e) => Math.max(0, Math.min(1, e)), J = "#202020", W = "#ffffff";
35
35
  function X(e, t) {
36
36
  if (typeof document > "u") return t;
37
37
  const r = (o, i = 0) => {
@@ -132,7 +132,7 @@ const $ = c.forwardRef(
132
132
  className: "size-full",
133
133
  width: "100%",
134
134
  height: "100%",
135
- fragmentShader: G,
135
+ fragmentShader: b,
136
136
  uniforms: A,
137
137
  speed: x || S ? 0 : o,
138
138
  minPixelRatio: 1,
@@ -801,7 +801,6 @@ const ee = P.forwardRef(
801
801
  c && "pixel-icon--hero",
802
802
  l
803
803
  ),
804
- tabIndex: 0,
805
804
  ...a
806
805
  }
807
806
  );
@@ -17,4 +17,4 @@ export interface PopoverContentProps extends React.HTMLAttributes<HTMLDivElement
17
17
  align?: "start" | "center" | "end";
18
18
  sideOffset?: number;
19
19
  }
20
- export declare function PopoverContent({ className, align, sideOffset, children, ...props }: PopoverContentProps): React.ReactPortal;
20
+ export declare function PopoverContent({ className, align, sideOffset, children, "aria-label": ariaLabel, ...props }: PopoverContentProps): React.ReactPortal;
@@ -1,97 +1,99 @@
1
1
  "use client";
2
- import { jsx as g, jsxs as b } from "react/jsx-runtime";
2
+ import { jsx as g, jsxs as C } from "react/jsx-runtime";
3
3
  import * as n from "react";
4
- import { createPortal as C } from "react-dom";
5
- import { MotionConfig as y, AnimatePresence as L, motion as R } from "motion/react";
6
- import { cn as k } from "../lib/cn.js";
7
- import { floatVariants as z } from "../lib/motion.js";
8
- import { Ripple as O } from "./ripple.js";
9
- const h = {
4
+ import { createPortal as y } from "react-dom";
5
+ import { MotionConfig as L, AnimatePresence as R, motion as k } from "motion/react";
6
+ import { cn as z } from "../lib/cn.js";
7
+ import { floatVariants as O } from "../lib/motion.js";
8
+ import { Ripple as j } from "./ripple.js";
9
+ const x = {
10
10
  start: "top left",
11
11
  center: "top",
12
12
  end: "top right"
13
- }, x = n.createContext(null);
14
- function E(o) {
15
- const e = n.useContext(x);
13
+ }, P = n.createContext(null);
14
+ function E(i) {
15
+ const e = n.useContext(P);
16
16
  if (!e)
17
- throw new Error(`${o} must be used within a <Popover>.`);
17
+ throw new Error(`${i} must be used within a <Popover>.`);
18
18
  return e;
19
19
  }
20
- function T({ children: o, defaultOpen: e = !1 }) {
21
- const [d, a] = n.useState(e), u = n.useRef(null);
22
- return /* @__PURE__ */ g(x.Provider, { value: { open: d, setOpen: a, triggerRef: u }, children: o });
20
+ function W({ children: i, defaultOpen: e = !1 }) {
21
+ const [c, l] = n.useState(e), d = n.useRef(null);
22
+ return /* @__PURE__ */ g(P.Provider, { value: { open: c, setOpen: l, triggerRef: d }, children: i });
23
23
  }
24
- function W({ children: o }) {
25
- const { open: e, setOpen: d, triggerRef: a } = E("PopoverTrigger"), u = o;
26
- return n.cloneElement(u, {
27
- ref: a,
24
+ function K({ children: i }) {
25
+ const { open: e, setOpen: c, triggerRef: l } = E("PopoverTrigger"), d = i;
26
+ return n.cloneElement(d, {
27
+ ref: l,
28
28
  "aria-expanded": e,
29
29
  "aria-haspopup": !0,
30
- onClick: (i) => {
31
- var f, s;
32
- (s = (f = u.props).onClick) == null || s.call(f, i), d(!e);
30
+ onClick: (w) => {
31
+ var r, u;
32
+ (u = (r = d.props).onClick) == null || u.call(r, w), c(!e);
33
33
  }
34
34
  });
35
35
  }
36
- function K({
37
- className: o,
36
+ function N({
37
+ className: i,
38
38
  align: e = "start",
39
- sideOffset: d = 8,
40
- children: a,
41
- ...u
39
+ sideOffset: c = 8,
40
+ children: l,
41
+ "aria-label": d = "Popover",
42
+ ...w
42
43
  }) {
43
- const { open: i, setOpen: f, triggerRef: s } = E("PopoverContent"), w = n.useRef(null), [c, P] = n.useState(null);
44
+ const { open: r, setOpen: u, triggerRef: v } = E("PopoverContent"), h = n.useRef(null), [s, b] = n.useState(null);
44
45
  return n.useLayoutEffect(() => {
45
- if (!i) return;
46
- const p = s.current;
47
- if (!p) return;
48
- const r = () => {
49
- var v;
50
- const t = p.getBoundingClientRect(), m = ((v = w.current) == null ? void 0 : v.offsetWidth) ?? 0;
51
- let l = t.left;
52
- e === "center" ? l = t.left + t.width / 2 - m / 2 : e === "end" && (l = t.right - m), P({ top: t.bottom + d, left: l });
46
+ if (!r) return;
47
+ const f = v.current;
48
+ if (!f) return;
49
+ const o = () => {
50
+ var m;
51
+ const t = f.getBoundingClientRect(), p = ((m = h.current) == null ? void 0 : m.offsetWidth) ?? 0;
52
+ let a = t.left;
53
+ e === "center" ? a = t.left + t.width / 2 - p / 2 : e === "end" && (a = t.right - p), b({ top: t.bottom + c, left: a });
53
54
  };
54
- return r(), window.addEventListener("resize", r), window.addEventListener("scroll", r, !0), () => {
55
- window.removeEventListener("resize", r), window.removeEventListener("scroll", r, !0);
55
+ return o(), window.addEventListener("resize", o), window.addEventListener("scroll", o, !0), () => {
56
+ window.removeEventListener("resize", o), window.removeEventListener("scroll", o, !0);
56
57
  };
57
- }, [i, e, d, s]), n.useEffect(() => {
58
- if (!i) return;
59
- const p = (t) => {
60
- t.key === "Escape" && f(!1);
61
- }, r = (t) => {
62
- var l, v;
63
- const m = t.target;
64
- (l = w.current) != null && l.contains(m) || (v = s.current) != null && v.contains(m) || f(!1);
58
+ }, [r, e, c, v]), n.useEffect(() => {
59
+ if (!r) return;
60
+ const f = (t) => {
61
+ t.key === "Escape" && u(!1);
62
+ }, o = (t) => {
63
+ var a, m;
64
+ const p = t.target;
65
+ (a = h.current) != null && a.contains(p) || (m = v.current) != null && m.contains(p) || u(!1);
65
66
  };
66
- return document.addEventListener("keydown", p), document.addEventListener("pointerdown", r), () => {
67
- document.removeEventListener("keydown", p), document.removeEventListener("pointerdown", r);
67
+ return document.addEventListener("keydown", f), document.addEventListener("pointerdown", o), () => {
68
+ document.removeEventListener("keydown", f), document.removeEventListener("pointerdown", o);
68
69
  };
69
- }, [i, f, s]), C(
70
- /* @__PURE__ */ g(y, { reducedMotion: "user", children: /* @__PURE__ */ g(L, { children: i && /* @__PURE__ */ b(
71
- R.div,
70
+ }, [r, u, v]), y(
71
+ /* @__PURE__ */ g(L, { reducedMotion: "user", children: /* @__PURE__ */ g(R, { children: r && /* @__PURE__ */ C(
72
+ k.div,
72
73
  {
73
- ref: w,
74
+ ref: h,
74
75
  role: "dialog",
75
- variants: z,
76
+ "aria-label": d,
77
+ variants: O,
76
78
  initial: "hidden",
77
79
  animate: "visible",
78
80
  exit: "hidden",
79
81
  style: {
80
82
  position: "fixed",
81
- top: (c == null ? void 0 : c.top) ?? 0,
82
- left: (c == null ? void 0 : c.left) ?? 0,
83
- visibility: c ? "visible" : "hidden",
84
- transformOrigin: h[e]
83
+ top: (s == null ? void 0 : s.top) ?? 0,
84
+ left: (s == null ? void 0 : s.left) ?? 0,
85
+ visibility: s ? "visible" : "hidden",
86
+ transformOrigin: x[e]
85
87
  },
86
- className: k(
88
+ className: z(
87
89
  "relative z-50 min-w-44 rounded-lg border border-border bg-elevated p-3",
88
90
  "text-xs text-foreground shadow-elevation",
89
- o
91
+ i
90
92
  ),
91
- ...u,
93
+ ...w,
92
94
  children: [
93
- /* @__PURE__ */ g(O, { origin: h[e] }),
94
- a
95
+ /* @__PURE__ */ g(j, { origin: x[e] }),
96
+ l
95
97
  ]
96
98
  }
97
99
  ) }) }),
@@ -99,7 +101,7 @@ function K({
99
101
  );
100
102
  }
101
103
  export {
102
- T as Popover,
103
- K as PopoverContent,
104
- W as PopoverTrigger
104
+ W as Popover,
105
+ N as PopoverContent,
106
+ K as PopoverTrigger
105
107
  };
@@ -1,32 +1,34 @@
1
1
  "use client";
2
- import { jsx as c, jsxs as g } from "react/jsx-runtime";
2
+ import { jsx as o, jsxs as v } from "react/jsx-runtime";
3
3
  import * as x from "react";
4
+ import { MotionConfig as w, motion as y } from "motion/react";
4
5
  import { cn as l } from "../lib/cn.js";
5
- const w = x.forwardRef(
6
+ import { springProgress as M } from "../lib/motion.js";
7
+ const N = x.forwardRef(
6
8
  ({
7
- className: f,
8
- value: m = 0,
9
- max: a = 100,
9
+ className: m,
10
+ value: f = 0,
11
+ max: e = 100,
10
12
  size: r = 40,
11
- strokeWidth: o = 4,
13
+ strokeWidth: i = 4,
12
14
  isIndeterminate: n = !1,
13
15
  label: d,
14
- ...u
16
+ ...p
15
17
  }, h) => {
16
- const i = Math.min(Math.max(m, 0), a), p = a > 0 ? i / a : 0, t = (r - o) / 2, s = 2 * Math.PI * t, v = n ? s * 0.75 : s * (1 - p), e = r / 2;
17
- return /* @__PURE__ */ c(
18
+ const c = Math.min(Math.max(f, 0), e), u = e > 0 ? c / e : 0, s = (r - i) / 2, t = 2 * Math.PI * s, g = n ? t * 0.75 : t * (1 - u), a = r / 2;
19
+ return /* @__PURE__ */ o(
18
20
  "div",
19
21
  {
20
22
  ref: h,
21
23
  role: "progressbar",
22
24
  "aria-label": d,
23
25
  "aria-valuemin": 0,
24
- "aria-valuemax": a,
25
- "aria-valuenow": n ? void 0 : i,
26
- className: l("inline-flex", f),
26
+ "aria-valuemax": e,
27
+ "aria-valuenow": n ? void 0 : c,
28
+ className: l("inline-flex", m),
27
29
  style: { width: r, height: r },
28
- ...u,
29
- children: /* @__PURE__ */ g(
30
+ ...p,
31
+ children: /* @__PURE__ */ v(
30
32
  "svg",
31
33
  {
32
34
  width: r,
@@ -34,34 +36,36 @@ const w = x.forwardRef(
34
36
  viewBox: `0 0 ${r} ${r}`,
35
37
  className: l(
36
38
  "-rotate-90",
37
- n && "animate-[ads-spin_var(--duration-spin)_linear_infinite]"
39
+ n && "animate-[ads-spin_800ms_linear_infinite]"
38
40
  ),
39
41
  children: [
40
- /* @__PURE__ */ c(
42
+ /* @__PURE__ */ o(
41
43
  "circle",
42
44
  {
43
45
  className: "stroke-muted",
44
46
  fill: "none",
45
- cx: e,
46
- cy: e,
47
- r: t,
48
- strokeWidth: o
47
+ cx: a,
48
+ cy: a,
49
+ r: s,
50
+ strokeWidth: i
49
51
  }
50
52
  ),
51
- /* @__PURE__ */ c(
52
- "circle",
53
+ /* @__PURE__ */ o(w, { reducedMotion: "user", children: /* @__PURE__ */ o(
54
+ y.circle,
53
55
  {
54
- className: "stroke-brand transition-[stroke-dashoffset] duration-(--duration-normal) ease-out motion-reduce:transition-none",
56
+ className: "stroke-brand",
55
57
  fill: "none",
56
- cx: e,
57
- cy: e,
58
- r: t,
59
- strokeWidth: o,
58
+ cx: a,
59
+ cy: a,
60
+ r: s,
61
+ strokeWidth: i,
60
62
  strokeLinecap: "round",
61
- strokeDasharray: s,
62
- strokeDashoffset: v
63
+ strokeDasharray: t,
64
+ initial: !1,
65
+ animate: { strokeDashoffset: g },
66
+ transition: M
63
67
  }
64
- )
68
+ ) })
65
69
  ]
66
70
  }
67
71
  )
@@ -69,7 +73,7 @@ const w = x.forwardRef(
69
73
  );
70
74
  }
71
75
  );
72
- w.displayName = "ProgressCircle";
76
+ N.displayName = "ProgressCircle";
73
77
  export {
74
- w as ProgressCircle
78
+ N as ProgressCircle
75
79
  };