@box-kite/react 2.2.15 → 2.2.17

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 (144) hide show
  1. package/.claude/rules/box-kite-rules.md +1 -1
  2. package/.claude/skills/box-kite/SKILL.md +1 -1
  3. package/.claude/skills/box-kite/references/styling.md +1 -1
  4. package/.cursor/rules/box-kite.mdc +1 -1
  5. package/AGENTS.md +1 -1
  6. package/BOX_AI_CONTEXT.md +16 -0
  7. package/BOX_KITE_AI_CONTEXT.md +16 -0
  8. package/behavior.cjs +1 -1
  9. package/behavior.mjs +16 -16
  10. package/catalog.cjs +1 -1
  11. package/catalog.mjs +1 -1
  12. package/client.cjs +1 -1
  13. package/client.mjs +10 -10
  14. package/components/accordion.cjs +1 -1
  15. package/components/accordion.mjs +95 -91
  16. package/components/calendar.cjs +1 -1
  17. package/components/calendar.mjs +212 -210
  18. package/components/chart.cjs +1 -1
  19. package/components/chart.d.ts +8 -3
  20. package/components/chart.mjs +70 -65
  21. package/components/combobox.cjs +1 -1
  22. package/components/combobox.mjs +187 -186
  23. package/components/dashboard.cjs +1 -1
  24. package/components/dashboard.d.ts +1 -44
  25. package/components/dashboard.mjs +202 -201
  26. package/components/dataGrid/components/dataGridListLayout.d.ts +1 -1
  27. package/components/dataGrid/contracts/dataGridContract.d.ts +1 -1
  28. package/components/dataGrid/models/gridModel.d.ts +1 -1
  29. package/components/dataGrid.cjs +2 -2
  30. package/components/dataGrid.mjs +10 -10
  31. package/components/dateField.cjs +1 -1
  32. package/components/dateField.mjs +96 -96
  33. package/components/datePicker.cjs +1 -1
  34. package/components/datePicker.mjs +286 -285
  35. package/components/dialog.cjs +1 -1
  36. package/components/dialog.d.ts +2 -64
  37. package/components/dialog.mjs +131 -126
  38. package/components/form.cjs +1 -1
  39. package/components/form.d.ts +4 -3
  40. package/components/form.mjs +25 -22
  41. package/components/menu.cjs +1 -1
  42. package/components/menu.d.ts +2 -73
  43. package/components/menu.mjs +220 -215
  44. package/components/overlay.cjs +1 -1
  45. package/components/overlay.mjs +44 -43
  46. package/components/popover.cjs +1 -1
  47. package/components/popover.d.ts +1 -41
  48. package/components/popover.mjs +56 -51
  49. package/components/presence.cjs +1 -1
  50. package/components/presence.mjs +1 -1
  51. package/components/radioGroup.cjs +1 -1
  52. package/components/radioGroup.mjs +59 -55
  53. package/components/semantics.d.ts +29 -29
  54. package/components/slider.cjs +1 -1
  55. package/components/slider.d.ts +1 -55
  56. package/components/slider.mjs +92 -90
  57. package/components/sortableList.cjs +1 -1
  58. package/components/sortableList.mjs +149 -148
  59. package/components/swipeItem.cjs +1 -1
  60. package/components/swipeItem.mjs +100 -100
  61. package/components/tabs.cjs +1 -1
  62. package/components/tabs.mjs +135 -132
  63. package/components/toaster.cjs +1 -1
  64. package/components/toaster.d.ts +1 -37
  65. package/components/toaster.mjs +130 -128
  66. package/components/tooltip.cjs +1 -1
  67. package/components/tooltip.d.ts +1 -34
  68. package/components/tooltip.mjs +73 -69
  69. package/components/virtualList.cjs +1 -1
  70. package/components/virtualList.mjs +88 -87
  71. package/docs/props.md +2 -2
  72. package/interactionListening.cjs +1 -1
  73. package/interactionListening.mjs +3 -3
  74. package/layer.cjs +1 -1
  75. package/layer.mjs +1 -1
  76. package/motion.cjs +1 -1
  77. package/motion.mjs +30 -20
  78. package/package.json +41 -40
  79. package/placement.cjs +1 -1
  80. package/placement.mjs +1 -1
  81. package/platform.cjs +1 -1
  82. package/platform.mjs +17 -14
  83. package/react/animation/useHeldContent.d.ts +6 -0
  84. package/react/animation/usePresence.d.ts +4 -0
  85. package/react/componentsContext.d.ts +1 -1
  86. package/react-shared.cjs +1 -1
  87. package/react-shared.mjs +1 -1
  88. package/scrolling.cjs +1 -1
  89. package/scrolling.mjs +1 -1
  90. package/utils/chart/chartUtils.d.ts +3 -2
  91. package/utils/dashboard/dashboardUtils.d.ts +1 -1
  92. package/utils/dom/domUtils.d.ts +6 -0
  93. package/create/src/agents.d.ts +0 -22
  94. package/create/src/agents.test.d.ts +0 -1
  95. package/create/src/index.d.ts +0 -1
  96. package/create/src/options.d.ts +0 -31
  97. package/create/src/options.test.d.ts +0 -1
  98. package/create/src/packageManager.d.ts +0 -5
  99. package/create/src/project.d.ts +0 -27
  100. package/create/src/project.test.d.ts +0 -1
  101. package/create/templates/ts/designs/azure.d.ts +0 -5
  102. package/create/templates/ts/designs/ember.d.ts +0 -5
  103. package/create/templates/ts/designs/mono.d.ts +0 -5
  104. package/create/templates/ts/src/App.d.ts +0 -2
  105. package/create/templates/ts/src/design.d.ts +0 -5
  106. package/create/templates/ts/src/main.d.ts +0 -0
  107. package/mcp/src/data.d.ts +0 -90
  108. package/mcp/src/data.test.d.ts +0 -1
  109. package/mcp/src/engine.d.ts +0 -23
  110. package/mcp/src/index.d.ts +0 -1
  111. package/mcp/src/search.d.ts +0 -38
  112. package/mcp/src/search.test.d.ts +0 -1
  113. package/mcp/src/server.d.ts +0 -18
  114. package/mcp/src/server.test.d.ts +0 -1
  115. package/mcp/src/styles.d.ts +0 -27
  116. package/mcp/src/styles.test.d.ts +0 -1
  117. package/mcp/src/tools.d.ts +0 -18
  118. package/mcp/src/vocabulary.d.ts +0 -41
  119. package/registry/blocks/dashboard-shell/dashboard-shell.d.ts +0 -24
  120. package/registry/blocks/dashboard-shell/dashboard-stats.d.ts +0 -13
  121. package/registry/blocks/data-grid/invoice-rows.d.ts +0 -15
  122. package/registry/blocks/data-grid/invoices-grid.d.ts +0 -1
  123. package/registry/blocks/settings-form/settings-form.d.ts +0 -17
  124. package/registry/designs/store/address-form.d.ts +0 -11
  125. package/registry/designs/store/cart-items.d.ts +0 -10
  126. package/registry/designs/store/cart-page.d.ts +0 -4
  127. package/registry/designs/store/checkout-page.d.ts +0 -7
  128. package/registry/designs/store/credit-card-form.d.ts +0 -10
  129. package/registry/designs/store/form-field.d.ts +0 -19
  130. package/registry/designs/store/order-summary.d.ts +0 -18
  131. package/registry/designs/store/product-art.d.ts +0 -26
  132. package/registry/designs/store/product-card.d.ts +0 -11
  133. package/registry/designs/store/product-gallery.d.ts +0 -11
  134. package/registry/designs/store/product-grid.d.ts +0 -10
  135. package/registry/designs/store/product-page.d.ts +0 -5
  136. package/registry/designs/store/quantity-stepper.d.ts +0 -13
  137. package/registry/designs/store/shipping-method.d.ts +0 -14
  138. package/registry/designs/store/store-data.d.ts +0 -53
  139. package/registry/designs/store/store-design.d.ts +0 -63
  140. package/registry/designs/store/store-shell.d.ts +0 -12
  141. package/registry/designs/store/storefront-page.d.ts +0 -4
  142. package/registry/designs/store/variant-picker.d.ts +0 -15
  143. package/supabase/functions/collect/index.d.ts +0 -30
  144. package/supabase/functions/collect/index.test.d.ts +0 -1
@@ -1,26 +1,27 @@
1
1
  "use client";
2
- import { c as e, t } from "../platform.mjs";
3
- import { t as n } from "../client.mjs";
4
- import { n as r } from "../effects.mjs";
5
- import { t as i } from "../interactions.mjs";
6
- import a from "../box.mjs";
7
- import { i as o } from "../reporting.mjs";
8
- import { n as s } from "../layer.mjs";
9
- import { t as c } from "../motion.mjs";
10
- import { useCallback as l, useRef as u } from "react";
11
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
12
- import { createPortal as p } from "react-dom";
13
- import { useSyncExternalStore as m } from "use-sync-external-store/shim";
2
+ import { f as e } from "../react-shared.mjs";
3
+ import { c as t, l as n, t as r } from "../platform.mjs";
4
+ import { t as i } from "../client.mjs";
5
+ import { n as a } from "../effects.mjs";
6
+ import { t as o } from "../interactions.mjs";
7
+ import s from "../box.mjs";
8
+ import { i as c } from "../reporting.mjs";
9
+ import { n as l } from "../layer.mjs";
10
+ import { r as u } from "../motion.mjs";
11
+ import { useCallback as d, useRef as f } from "react";
12
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
13
+ import { createPortal as h } from "react-dom";
14
+ import { useSyncExternalStore as g } from "use-sync-external-store/shim";
14
15
  //#region src/utils/toast/toastStore.ts
15
- var h = ["value"], g = {
16
+ var _ = ["value"], v = {
16
17
  toasts: [],
17
18
  overflow: 0
18
- }, _ = 0;
19
- function v() {
20
- return _ += 1, `toast-${_}`;
19
+ }, y = 0;
20
+ function b() {
21
+ return y += 1, `toast-${y}`;
21
22
  }
22
- function y(e) {
23
- let t = [], n = g, r = e?.limit ?? 3, a = e?.duration ?? 5e3, o = !1, s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Map(), l = (e) => {
23
+ function x(e) {
24
+ let t = [], n = v, r = e?.limit ?? 3, i = e?.duration ?? 5e3, a = !1, s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Map(), l = (e) => {
24
25
  let t = c.get(e);
25
26
  t?.handle && clearTimeout(t.handle), c.delete(e);
26
27
  }, u = () => {
@@ -46,20 +47,20 @@ function y(e) {
46
47
  remaining: n.duration,
47
48
  startedAt: 0
48
49
  };
49
- c.set(n.id, t), !(o || t.handle) && (t.startedAt = Date.now(), t.handle = setTimeout(() => {
50
+ c.set(n.id, t), !(a || t.handle) && (t.startedAt = Date.now(), t.handle = setTimeout(() => {
50
51
  c.delete(n.id), p(n.id, "timeout");
51
52
  }, t.remaining));
52
53
  }
53
54
  for (let t of [...c.keys()]) e.has(t) || l(t);
54
55
  }
55
- let f = (e, t) => t ?? (e === "loading" ? Infinity : a);
56
+ let f = (e, t) => t ?? (e === "loading" ? Infinity : i);
56
57
  function p(e, n = "imperative") {
57
58
  let r = [];
58
59
  t = t.map((t) => !t.open || e !== void 0 && t.id !== e ? t : (r.push(t), l(t.id), {
59
60
  ...t,
60
61
  open: !1
61
62
  })), r.length && (u(), r.forEach((e) => {
62
- e.onDismiss?.(n), i({
63
+ e.onDismiss?.(n), o({
63
64
  component: "toaster",
64
65
  type: "dismiss",
65
66
  reason: n,
@@ -68,61 +69,61 @@ function y(e) {
68
69
  id: e.id,
69
70
  kind: e.kind
70
71
  },
71
- content: h
72
+ content: _
72
73
  });
73
74
  }));
74
75
  }
75
76
  function m(e, n, r) {
76
- let a = !1;
77
+ let i = !1;
77
78
  t = t.map((t) => {
78
79
  if (t.id !== e) return t;
79
- a = !0, l(e);
80
- let i = r?.kind ?? t.kind;
80
+ i = !0, l(e);
81
+ let a = r?.kind ?? t.kind;
81
82
  return {
82
83
  ...t,
83
84
  ...r,
84
85
  id: e,
85
86
  message: n,
86
- kind: i,
87
- duration: r?.duration ?? (r?.kind ? f(i) : t.duration),
87
+ kind: a,
88
+ duration: r?.duration ?? (r?.kind ? f(a) : t.duration),
88
89
  open: !0
89
90
  };
90
- }), a && (u(), i({
91
+ }), i && (u(), o({
91
92
  component: "toaster",
92
93
  type: "update",
93
94
  reason: r?.kind,
94
95
  value: n,
95
96
  details: { id: e },
96
97
  source: "app",
97
- content: h
98
+ content: _
98
99
  }));
99
100
  }
100
- function _(e, n) {
101
- let r = n?.id ?? v();
101
+ function h(e, n) {
102
+ let r = n?.id ?? b();
102
103
  if (n?.id && t.some((e) => e.id === r)) return m(r, e, n), r;
103
- let a = n?.kind ?? "default";
104
+ let i = n?.kind ?? "default";
104
105
  return t = [...t, {
105
106
  id: r,
106
- kind: a,
107
+ kind: i,
107
108
  message: e,
108
109
  description: n?.description,
109
- duration: f(a, n?.duration),
110
+ duration: f(i, n?.duration),
110
111
  action: n?.action,
111
112
  dismissible: n?.dismissible ?? !0,
112
113
  onDismiss: n?.onDismiss,
113
114
  open: !0,
114
115
  visible: !1
115
- }], u(), i({
116
+ }], u(), o({
116
117
  component: "toaster",
117
118
  type: "show",
118
- reason: a,
119
+ reason: i,
119
120
  value: e,
120
121
  details: {
121
122
  id: r,
122
- kind: a
123
+ kind: i
123
124
  },
124
125
  source: "app",
125
- content: h
126
+ content: _
126
127
  }), r;
127
128
  }
128
129
  return {
@@ -130,8 +131,8 @@ function y(e) {
130
131
  return s.add(e), () => s.delete(e);
131
132
  },
132
133
  getSnapshot: () => n,
133
- getServerSnapshot: () => g,
134
- add: _,
134
+ getServerSnapshot: () => v,
135
+ add: h,
135
136
  update: m,
136
137
  dismiss: p,
137
138
  remove(e) {
@@ -142,45 +143,45 @@ function y(e) {
142
143
  e !== r && (r = e, u());
143
144
  },
144
145
  setDefaultDuration(e) {
145
- a = e;
146
+ i = e;
146
147
  },
147
148
  pause() {
148
- if (!o) {
149
- o = !0;
149
+ if (!a) {
150
+ a = !0;
150
151
  for (let e of c.values()) e.handle && (clearTimeout(e.handle), e.handle = null, e.remaining = Math.max(0, e.remaining - (Date.now() - e.startedAt)));
151
152
  }
152
153
  },
153
154
  resume() {
154
- o && (o = !1, d());
155
+ a && (a = !1, d());
155
156
  },
156
157
  reset() {
157
158
  for (let e of [...c.keys()]) l(e);
158
- t = [], n = g, s.forEach((e) => e());
159
+ t = [], n = v, s.forEach((e) => e());
159
160
  }
160
161
  };
161
162
  }
162
163
  //#endregion
163
164
  //#region src/components/toaster.tsx
164
- var b = y(), x = (e) => (t, n) => b.add(t, {
165
+ var S = x(), C = (e) => (t, n) => S.add(t, {
165
166
  ...n,
166
167
  kind: e
167
- }), S = Object.assign((e, t) => b.add(e, t), {
168
- success: x("success"),
169
- error: x("error"),
170
- warning: x("warning"),
171
- info: x("info"),
172
- loading: x("loading"),
173
- update: (e, t, n) => b.update(e, t, n),
174
- dismiss: (e) => b.dismiss(e, "imperative"),
168
+ }), w = Object.assign((e, t) => S.add(e, t), {
169
+ success: C("success"),
170
+ error: C("error"),
171
+ warning: C("warning"),
172
+ info: C("info"),
173
+ loading: C("loading"),
174
+ update: (e, t, n) => S.update(e, t, n),
175
+ dismiss: (e) => S.dismiss(e, "imperative"),
175
176
  promise(e, t, n) {
176
- let r = b.add(t.loading, {
177
+ let r = S.add(t.loading, {
177
178
  ...n,
178
179
  id: n?.id,
179
180
  kind: "loading"
180
181
  }), i = (e, t) => typeof e == "function" ? e(t) : e;
181
- return e.then((e) => b.update(r, i(t.success, e), { kind: "success" }), (e) => b.update(r, i(t.error, e), { kind: "error" })), e;
182
+ return e.then((e) => S.update(r, i(t.success, e), { kind: "success" }), (e) => S.update(r, i(t.error, e), { kind: "error" })), e;
182
183
  }
183
- }), C = {
184
+ }), T = {
184
185
  "top-start": "topStart",
185
186
  "top-center": "topCenter",
186
187
  "top-end": "topEnd",
@@ -188,49 +189,49 @@ var b = y(), x = (e) => (t, n) => b.add(t, {
188
189
  "bottom-center": "bottomCenter",
189
190
  "bottom-end": "bottomEnd"
190
191
  };
191
- function w(e, t) {
192
+ function E(e, t) {
192
193
  let n = t.toLowerCase().split("+"), r = n[n.length - 1], i = new Set(n.slice(0, -1));
193
194
  return e.key.toLowerCase() === r && e.altKey === i.has("alt") && e.ctrlKey === i.has("ctrl") && e.shiftKey === i.has("shift") && e.metaKey === i.has("meta");
194
195
  }
195
- function T(e) {
196
- let { toast: t, store: n, fromTop: i, closeLabel: s } = e, { mounted: l, ref: u, props: p } = c({ present: t.open }), m = o("toaster");
197
- if (r(() => {
198
- l || n.remove(t.id);
196
+ function D(e) {
197
+ let { toast: t, store: n, fromTop: r, closeLabel: i } = e, { mounted: o, ref: l, props: d } = u({ present: t.open }), f = c("toaster");
198
+ if (a(() => {
199
+ o || n.remove(t.id);
199
200
  }, [
200
- l,
201
+ o,
201
202
  n,
202
203
  t.id
203
- ]), !l) return null;
204
+ ]), !o) return null;
204
205
  let h = t.action, g = () => {
205
- h?.onClick(), h?.closeOnClick === !1 ? m("action", t.message, {
206
+ h?.onClick(), h?.closeOnClick === !1 ? f("action", t.message, {
206
207
  reason: "action",
207
208
  id: t.id,
208
209
  kind: t.kind,
209
210
  content: ["value"]
210
211
  }) : n.dismiss(t.id, "action");
211
212
  };
212
- return /* @__PURE__ */ f(a, {
213
- ref: u,
213
+ return /* @__PURE__ */ m(s, {
214
+ ref: l,
214
215
  component: "toaster.toast",
215
216
  variant: {
216
217
  [t.kind]: t.kind !== "default",
217
- fromTop: i
218
+ fromTop: r
218
219
  },
219
220
  props: {
220
221
  ...t.kind === "error" ? { role: "alert" } : {},
221
222
  "data-toast-id": t.id,
222
- ...p
223
+ ...d
223
224
  },
224
225
  children: [
225
- /* @__PURE__ */ d(a, {
226
+ /* @__PURE__ */ p(s, {
226
227
  component: "toaster.message",
227
228
  children: t.message
228
229
  }),
229
- t.description !== void 0 && /* @__PURE__ */ d(a, {
230
+ t.description !== void 0 && /* @__PURE__ */ p(s, {
230
231
  component: "toaster.description",
231
232
  children: t.description
232
233
  }),
233
- h && /* @__PURE__ */ d(a, {
234
+ h && /* @__PURE__ */ p(s, {
234
235
  tag: "button",
235
236
  component: "toaster.action",
236
237
  props: {
@@ -239,94 +240,95 @@ function T(e) {
239
240
  },
240
241
  children: h.label
241
242
  }),
242
- t.dismissible && /* @__PURE__ */ d(a, {
243
+ t.dismissible && /* @__PURE__ */ p(s, {
243
244
  tag: "button",
244
245
  component: "toaster.close",
245
246
  props: {
246
247
  type: "button",
247
- "aria-label": s,
248
+ "aria-label": i,
248
249
  onClick: () => n.dismiss(t.id, "close")
249
250
  }
250
251
  })
251
252
  ]
252
253
  });
253
254
  }
254
- function E(i) {
255
- let { position: o = "bottom-end", limit: c = 3, duration: h = 5e3, label: g = "Notifications", closeLabel: _ = "Close", overflowLabel: v = (e) => `+${e} more`, hotkey: y = "F6", store: x = b, props: S, ...E } = i, D = m(x.subscribe, x.getSnapshot, x.getServerSnapshot), O = s(), k = n(!O), A = u(null), j = u(null), M = u({
255
+ function O(e, o) {
256
+ let { position: c = "bottom-end", limit: u = 3, duration: _ = 5e3, label: v = "Notifications", closeLabel: y = "Close", overflowLabel: b = (e) => `+${e} more`, hotkey: x = "F6", store: C = S, props: w, ...O } = e, k = g(C.subscribe, C.getSnapshot, C.getServerSnapshot), A = l(), j = i(!A), M = f(null), N = d((e) => {
257
+ M.current = e, n(o, e);
258
+ }, [o]), P = f(null), F = f({
256
259
  hovered: !1,
257
260
  focused: !1,
258
261
  hidden: !1
259
- }), N = l(() => {
260
- let { hovered: e, focused: t, hidden: n } = M.current;
261
- e || t || n ? x.pause() : x.resume();
262
- }, [x]);
263
- r(() => x.setLimit(c), [x, c]), r(() => x.setDefaultDuration(h), [x, h]), r(() => {
264
- let t = A.current;
265
- !O || !e() || !t || !t.isConnected || t.matches(":popover-open") || t.showPopover();
266
- }), r(() => {
267
- let e = t();
262
+ }), I = d(() => {
263
+ let { hovered: e, focused: t, hidden: n } = F.current;
264
+ e || t || n ? C.pause() : C.resume();
265
+ }, [C]);
266
+ a(() => C.setLimit(u), [C, u]), a(() => C.setDefaultDuration(_), [C, _]), a(() => {
267
+ let e = M.current;
268
+ !A || !t() || !e || !e.isConnected || e.matches(":popover-open") || e.showPopover();
269
+ }), a(() => {
270
+ let e = r();
268
271
  if (!e) return;
269
- let n = new AbortController();
272
+ let t = new AbortController();
270
273
  return e.addEventListener("visibilitychange", () => {
271
- M.current.hidden = e.hidden, N();
272
- }, { signal: n.signal }), () => n.abort();
273
- }, [N]), r(() => {
274
- let e = t();
275
- if (!y || !e) return;
276
- let n = new AbortController();
274
+ F.current.hidden = e.hidden, I();
275
+ }, { signal: t.signal }), () => t.abort();
276
+ }, [I]), a(() => {
277
+ let e = r();
278
+ if (!x || !e) return;
279
+ let t = new AbortController();
277
280
  return e.addEventListener("keydown", (t) => {
278
- !w(t, y) || !A.current || (t.preventDefault(), j.current = e.activeElement, A.current.focus());
279
- }, { signal: n.signal }), () => n.abort();
280
- }, [y]);
281
- let P = (e) => !!e && !!A.current?.contains(e), F = () => {
282
- M.current.hovered = !0, N();
283
- }, I = (e) => {
284
- P(e.relatedTarget) || (M.current.hovered = !1, N());
285
- }, L = (e) => {
286
- M.current.focused = !0, N(), P(e.relatedTarget) || (j.current = e.relatedTarget);
287
- }, R = (e) => {
288
- P(e.relatedTarget) || (M.current.focused = !1, N());
281
+ !E(t, x) || !M.current || (t.preventDefault(), P.current = e.activeElement, M.current.focus());
282
+ }, { signal: t.signal }), () => t.abort();
283
+ }, [x]);
284
+ let L = (e) => !!e && !!M.current?.contains(e), R = () => {
285
+ F.current.hovered = !0, I();
289
286
  }, z = (e) => {
287
+ L(e.relatedTarget) || (F.current.hovered = !1, I());
288
+ }, B = (e) => {
289
+ F.current.focused = !0, I(), L(e.relatedTarget) || (P.current = e.relatedTarget);
290
+ }, V = (e) => {
291
+ L(e.relatedTarget) || (F.current.focused = !1, I());
292
+ }, H = (e) => {
290
293
  if (e.key !== "Escape") return;
291
294
  let t = (e.target.closest?.("[data-toast-id]"))?.getAttribute("data-toast-id");
292
- t && x.dismiss(t, "close"), x.getSnapshot().toasts.some((e) => e.open) ? A.current?.focus() : j.current?.focus();
293
- }, B = o.startsWith("top"), V = D.toasts.filter((e) => e.visible), H = B ? [...V].reverse() : V, U = D.overflow > 0 && /* @__PURE__ */ d(a, {
295
+ t && C.dismiss(t, "close"), C.getSnapshot().toasts.some((e) => e.open) ? M.current?.focus() : P.current?.focus();
296
+ }, U = c.startsWith("top"), W = k.toasts.filter((e) => e.visible), G = U ? [...W].reverse() : W, K = k.overflow > 0 && /* @__PURE__ */ p(s, {
294
297
  component: "toaster.overflow",
295
- children: v(D.overflow)
296
- }), W = /* @__PURE__ */ f(a, {
298
+ children: b(k.overflow)
299
+ }), q = /* @__PURE__ */ m(s, {
297
300
  tag: "section",
298
- ref: A,
301
+ ref: N,
299
302
  component: "toaster",
300
- ...E,
301
- variant: [E.variant, { [C[o]]: !0 }],
303
+ ...O,
304
+ variant: [O.variant, { [T[c]]: !0 }],
302
305
  props: {
303
- ...O ? { popover: "manual" } : {},
306
+ ...A ? { popover: "manual" } : {},
304
307
  "aria-live": "polite",
305
308
  "aria-atomic": "false",
306
309
  "aria-relevant": "additions text",
307
- "aria-label": g,
310
+ "aria-label": v,
308
311
  tabIndex: -1,
309
- ...S,
310
- onPointerOver: F,
311
- onPointerOut: I,
312
- onFocus: L,
313
- onBlur: R,
314
- onKeyDown: z
312
+ ...w,
313
+ onPointerOver: R,
314
+ onPointerOut: z,
315
+ onFocus: B,
316
+ onBlur: V,
317
+ onKeyDown: H
315
318
  },
316
319
  children: [
317
- !B && U,
318
- H.map((e) => /* @__PURE__ */ d(T, {
320
+ !U && K,
321
+ G.map((e) => /* @__PURE__ */ p(D, {
319
322
  toast: e,
320
- store: x,
321
- fromTop: B,
322
- closeLabel: _
323
+ store: C,
324
+ fromTop: U,
325
+ closeLabel: y
323
326
  }, e.id)),
324
- B && U
327
+ U && K
325
328
  ]
326
329
  });
327
- return O ? W : k ? p(W, k) : null;
330
+ return A ? q : j ? h(q, j) : null;
328
331
  }
329
- var D = E;
330
- D.displayName = "Toaster";
332
+ var k = e(O, "Toaster");
331
333
  //#endregion
332
- export { y as createToastStore, D as default, b as defaultToastStore, S as toast };
334
+ export { x as createToastStore, k as default, S as defaultToastStore, w as toast };
@@ -1 +1 @@
1
- "use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../behavior.cjs"),t=require("../identity.cjs"),n=require("./overlay.cjs"),r=require("./presence.cjs");let i=require("react"),a=require("react/jsx-runtime");function o(o){let{content:s,children:c,open:l,defaultOpen:u=!1,onOpenChange:d,openDelay:f=300,closeDelay:p=150,side:m=`bottom`,align:h=`center`,offset:g=1,flip:_=!0,props:v,...y}=o,b=t.t(`tooltip`),x=y.id??b,[S,C]=e.i({value:l,defaultValue:u,onChange:d}),[w,T]=(0,i.useState)(null),E=(0,i.useRef)(null),D=(0,i.useRef)(void 0),O=(0,i.useRef)(!1),k=(0,i.useRef)(!1),A=(0,i.useRef)(!1),j=(0,i.useRef)(!1),M=(0,i.useCallback)(()=>{clearTimeout(D.current),D.current=void 0},[]),N=(0,i.useCallback)((e,t)=>{if(M(),e<=0){t();return}D.current=setTimeout(()=>{D.current=void 0,t()},e)},[M]),P=(0,i.useCallback)((e,t)=>{N(p,()=>{O.current||k.current||A.current||C(!1,{reason:e,event:t})})},[p,N,C]);e.r({enabled:S,outsidePointer:!1,inside:[E],onDismiss:(e,t)=>{M(),j.current=!0,C(!1,{reason:e,event:t})}}),(0,i.useEffect)(()=>M,[M]);let F=S&&s!=null,I=e.a(e=>{O.current=!0,!j.current&&N(f,()=>C(!0,{reason:`hover`,event:e}))}),L=e.a(e=>{O.current=!1,j.current=!1,P(`pointer-leave`,e)}),R=e.a(e=>{A.current=!0,M(),C(!0,{reason:`focus`,event:e})}),z=e.a(e=>{A.current=!1,j.current=!1,P(`blur`,e)}),B=e.a(()=>{k.current=!0,M()}),V=e.a(e=>{k.current=!1,P(`pointer-leave`,e)}),H=(0,i.useMemo)(()=>({ref:T,props:{"aria-describedby":F?x:void 0,onPointerEnter:I,onPointerLeave:L,onFocus:R,onBlur:z}}),[z,I,R,L,F,x]);return(0,a.jsxs)(a.Fragment,{children:[c(H),(0,a.jsx)(r.default,{present:F,children:e=>(0,a.jsx)(n.default,{ref:E,contentRef:e.ref,anchor:w,side:m,align:h,offset:g,flip:_,matchWidth:!1,component:`tooltip`,...y,variant:[y.variant,{closed:!e.present}],id:x,props:{role:`tooltip`,...e.props,...v,onPointerEnter:B,onPointerLeave:V},children:s})})]})}o.displayName=`Tooltip`,exports.default=o;
1
+ "use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../react-shared.cjs"),t=require("../platform.cjs"),n=require("../behavior.cjs"),r=require("../identity.cjs"),i=require("./overlay.cjs"),a=require("./presence.cjs");let o=require("react"),s=require("react/jsx-runtime");function c(e,c){let{content:l,children:u,open:d,defaultOpen:f=!1,onOpenChange:p,openDelay:m=300,closeDelay:h=150,side:g=`bottom`,align:_=`center`,offset:v=1,flip:y=!0,props:b,...x}=e,S=r.t(`tooltip`),C=x.id??S,[w,T]=n.i({value:d,defaultValue:f,onChange:p}),[E,D]=(0,o.useState)(null),O=(0,o.useRef)(null),k=(0,o.useCallback)(e=>{O.current=e,t.l(c,e)},[c]),A=(0,o.useRef)(void 0),j=(0,o.useRef)(!1),M=(0,o.useRef)(!1),N=(0,o.useRef)(!1),P=(0,o.useRef)(!1),F=(0,o.useCallback)(()=>{clearTimeout(A.current),A.current=void 0},[]),I=(0,o.useCallback)((e,t)=>{if(F(),e<=0){t();return}A.current=setTimeout(()=>{A.current=void 0,t()},e)},[F]),L=(0,o.useCallback)((e,t)=>{I(h,()=>{j.current||M.current||N.current||T(!1,{reason:e,event:t})})},[h,I,T]);n.r({enabled:w,outsidePointer:!1,inside:[O],onDismiss:(e,t)=>{F(),P.current=!0,T(!1,{reason:e,event:t})}}),(0,o.useEffect)(()=>F,[F]);let R=w&&l!=null,z=n.a(e=>{j.current=!0,!P.current&&I(m,()=>T(!0,{reason:`hover`,event:e}))}),B=n.a(e=>{j.current=!1,P.current=!1,L(`pointer-leave`,e)}),V=n.a(e=>{N.current=!0,F(),T(!0,{reason:`focus`,event:e})}),H=n.a(e=>{N.current=!1,P.current=!1,L(`blur`,e)}),U=n.a(()=>{M.current=!0,F()}),W=n.a(e=>{M.current=!1,L(`pointer-leave`,e)}),G=(0,o.useMemo)(()=>({ref:D,props:{"aria-describedby":R?C:void 0,onPointerEnter:z,onPointerLeave:B,onFocus:V,onBlur:H}}),[H,z,V,B,R,C]);return(0,s.jsxs)(s.Fragment,{children:[u(G),(0,s.jsx)(a.default,{present:R,children:e=>(0,s.jsx)(i.default,{ref:k,contentRef:e.ref,anchor:E,side:g,align:_,offset:v,flip:y,matchWidth:!1,component:`tooltip`,...x,variant:[x.variant,{closed:!e.present}],id:C,props:{role:`tooltip`,...e.props,...b,onPointerEnter:U,onPointerLeave:W},children:l})})]})}var l=e.f(c,`Tooltip`);exports.default=l;
@@ -61,38 +61,5 @@ interface Props<TKey extends keyof ComponentsAndVariants> extends TooltipBoxProp
61
61
  /** Whether a side with no room may be swapped for its opposite. Default `true`. */
62
62
  flip?: boolean;
63
63
  }
64
- /**
65
- * The APG tooltip: a description that appears on hover *and* on focus and stays until the user is done
66
- * with it.
67
- *
68
- * ```tsx
69
- * <Tooltip content="Deletes the row for good">{(trigger) => <Button {...trigger}>Delete</Button>}</Tooltip>
70
- * ```
71
- *
72
- * The trigger is a render prop rather than a cloned child: cloning would have to guess where a child
73
- * wants its DOM attributes (Box takes a `props` bag, a `<button>` takes them on top), and guessing wrong
74
- * on `aria-describedby` costs the thing the pattern is for. The component owns `role="tooltip"`, the
75
- * `aria-describedby`, and WCAG 1.4.13's three obligations — dismissible with Escape without moving focus,
76
- * hoverable, and never closed on a timer. Focus never enters it: a focusable tooltip is a mislabelled dialog.
77
- *
78
- * @pattern https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/
79
- * @a11y `role="tooltip"` on the bubble and `aria-describedby` on the trigger, so the description is read
80
- * as part of the control rather than as text that happens to be nearby.
81
- * @a11y WCAG 1.4.13, all three parts: Escape dismisses it without moving focus, the pointer can travel
82
- * onto the bubble and read it, and nothing hides it on a timer.
83
- * @a11y The bubble is never in the tab order — a focusable tooltip is a dialog with the wrong role — and
84
- * it renders nothing at all while `content` is empty.
85
- * @keyboard Tab — Shows it as soon as the trigger has focus, ignoring `openDelay`: a keyboard user asked
86
- * for it by arriving.
87
- * @keyboard Escape — Hides it, leaving focus on the trigger. It stays hidden until the pointer or focus
88
- * leaves and comes back.
89
- * @keyboard Tab, again — Reaches the next control, and the tooltip closes behind it.
90
- * @keyboard (Pointer) Resting on the trigger — Shows it after `openDelay`, 300 ms by default: sweeping
91
- * across a toolbar should not light every control up.
92
- * @keyboard (Pointer) Leaving the trigger — Hides it after `closeDelay`, 150 ms — unless the pointer
93
- * lands on the tooltip itself.
94
- * @keyboard (Pointer) Moving onto the tooltip — Keeps it open for as long as the pointer is there, so a
95
- * long description can be read or selected.
96
- */
97
- declare function Tooltip<TKey extends keyof ComponentsAndVariants = 'tooltip'>(props: Props<TKey>): import("react").JSX.Element;
64
+ declare const Tooltip: <TKey extends keyof ComponentsAndVariants = "tooltip">(props: Props<TKey>) => React.ReactNode;
98
65
  export default Tooltip;