@blocknote/ariakit 0.24.1 → 0.25.0

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,136 +1,168 @@
1
- import { jsx as r, jsxs as g, Fragment as B } from "react/jsx-runtime";
2
- import { assertEmpty as i, mergeCSSClasses as b, isSafari as L } from "@blocknote/core";
3
- import { elementOverflow as P, mergeRefs as C, ComponentsContext as F, BlockNoteViewRaw as E } from "@blocknote/react";
4
- import { FormProvider as T, FormLabel as G, FormInput as S, MenuProvider as V, Menu as $, MenuButton as w, MenuItem as M, MenuButtonArrow as O, CheckboxCheck as I, MenuGroupLabel as A, MenuSeparator as H, TabProvider as j, TabList as q, Tab as K, TabPanel as z, Button as N, PopoverDisclosure as J, Popover as Q, PopoverProvider as U, Group as y, Toolbar as W, TooltipProvider as X, TooltipAnchor as Y, ToolbarItem as x, Tooltip as Z, SelectProvider as _, Select as ee, SelectArrow as ne, SelectPopover as te, SelectItem as se, SelectItemCheck as ae } from "@ariakit/react";
5
- import { forwardRef as d, useRef as R, useEffect as D } from "react";
6
- const re = (n) => {
7
- const { children: t, ...s } = n;
8
- return i(s), /* @__PURE__ */ r(T, { children: t });
9
- }, oe = d((n, t) => {
1
+ import { jsx as r, jsxs as h, Fragment as G } from "react/jsx-runtime";
2
+ import { assertEmpty as i, mergeCSSClasses as b, isSafari as A } from "@blocknote/core";
3
+ import { elementOverflow as P, mergeRefs as B, useFocusWithin as $, FormattingToolbarController as V, getFormattingToolbarItems as O, FormattingToolbar as H, ComponentsContext as j, BlockNoteViewRaw as q } from "@blocknote/react";
4
+ import { FormProvider as T, FormLabel as K, FormInput as M, MenuProvider as z, Menu as U, MenuButton as w, MenuItem as C, MenuButtonArrow as W, CheckboxCheck as y, MenuGroupLabel as _, MenuSeparator as J, Button as f, TabProvider as Q, TabList as X, Tab as Y, TabPanel as Z, PopoverDisclosure as ee, Popover as ne, PopoverProvider as te, Group as N, Toolbar as ae, TooltipProvider as x, TooltipAnchor as F, ToolbarItem as R, Tooltip as D, SelectProvider as se, Select as re, SelectArrow as oe, SelectPopover as le, SelectItem as ce, SelectItemCheck as ie } from "@ariakit/react";
5
+ import { forwardRef as u, useRef as E, useEffect as L, useState as ue } from "react";
6
+ const de = (n) => {
7
+ const { children: t, ...a } = n;
8
+ return i(a), /* @__PURE__ */ r(T, { children: t });
9
+ }, me = u((n, t) => {
10
10
  const {
11
- className: s,
11
+ className: a,
12
12
  name: e,
13
- label: a,
13
+ label: s,
14
14
  icon: o,
15
15
  value: l,
16
16
  autoFocus: m,
17
17
  placeholder: c,
18
- onKeyDown: u,
19
- onChange: p,
20
- onSubmit: h,
21
- ...v
18
+ onKeyDown: d,
19
+ onChange: g,
20
+ onSubmit: p,
21
+ ...k
22
22
  } = n;
23
- return i(v), /* @__PURE__ */ g(B, { children: [
24
- n.label && /* @__PURE__ */ r(G, { name: e, children: a }),
25
- /* @__PURE__ */ g("div", { className: "bn-ak-input-wrapper", children: [
23
+ return i(k), /* @__PURE__ */ h(G, { children: [
24
+ n.label && /* @__PURE__ */ r(K, { name: e, children: s }),
25
+ /* @__PURE__ */ h("div", { className: "bn-ak-input-wrapper", children: [
26
26
  o,
27
27
  /* @__PURE__ */ r(
28
- S,
28
+ M,
29
29
  {
30
- className: b("bn-ak-input", s || ""),
30
+ className: b("bn-ak-input", a || ""),
31
31
  ref: t,
32
32
  name: e,
33
33
  value: l,
34
34
  autoFocus: m,
35
35
  placeholder: c,
36
- onKeyDown: u,
37
- onChange: p,
38
- onSubmit: h
36
+ onKeyDown: d,
37
+ onChange: g,
38
+ onSubmit: p
39
39
  }
40
40
  )
41
41
  ] })
42
42
  ] });
43
- }), le = (n) => {
43
+ }), be = (n) => {
44
44
  const {
45
45
  children: t,
46
- onOpenChange: s,
46
+ onOpenChange: a,
47
47
  position: e,
48
- sub: a,
48
+ sub: s,
49
49
  // unused
50
50
  ...o
51
51
  } = n;
52
52
  return i(o), /* @__PURE__ */ r(
53
- V,
53
+ z,
54
54
  {
55
55
  placement: e,
56
- setOpen: s,
56
+ setOpen: a,
57
57
  virtualFocus: !0,
58
58
  children: t
59
59
  }
60
60
  );
61
- }, ce = d((n, t) => {
61
+ }, he = u((n, t) => {
62
62
  const {
63
- className: s,
63
+ className: a,
64
64
  children: e,
65
- sub: a,
65
+ sub: s,
66
66
  // unused
67
67
  ...o
68
68
  } = n;
69
69
  return i(o), /* @__PURE__ */ r(
70
- $,
70
+ U,
71
71
  {
72
72
  unmountOnHide: !0,
73
- className: b("bn-ak-menu", s || ""),
73
+ className: b("bn-ak-menu", a || ""),
74
74
  ref: t,
75
75
  children: e
76
76
  }
77
77
  );
78
- }), ie = d((n, t) => {
79
- const { className: s, children: e, icon: a, checked: o, subTrigger: l, onClick: m, ...c } = n;
80
- return i(c), l ? /* @__PURE__ */ g(
78
+ }), ge = u((n, t) => {
79
+ const { className: a, children: e, icon: s, checked: o, subTrigger: l, onClick: m, ...c } = n;
80
+ return i(c), l ? /* @__PURE__ */ h(
81
81
  w,
82
82
  {
83
- render: /* @__PURE__ */ r(M, {}),
84
- className: b("bn-ak-menu-item", s || ""),
83
+ render: /* @__PURE__ */ r(C, {}),
84
+ className: b("bn-ak-menu-item", a || ""),
85
85
  ref: t,
86
86
  onClick: m,
87
87
  children: [
88
- a,
88
+ s,
89
89
  e,
90
- /* @__PURE__ */ r(O, {}),
91
- o !== void 0 && /* @__PURE__ */ r(I, { checked: o })
90
+ /* @__PURE__ */ r(W, {}),
91
+ o !== void 0 && /* @__PURE__ */ r(y, { checked: o })
92
92
  ]
93
93
  }
94
- ) : /* @__PURE__ */ g(
95
- M,
94
+ ) : /* @__PURE__ */ h(
95
+ C,
96
96
  {
97
- className: b("bn-ak-menu-item", s || ""),
97
+ className: b("bn-ak-menu-item", a || ""),
98
98
  ref: t,
99
99
  onClick: m,
100
100
  children: [
101
- a,
101
+ s,
102
102
  e,
103
- o !== void 0 && /* @__PURE__ */ r(I, { checked: o })
103
+ o !== void 0 && /* @__PURE__ */ r(y, { checked: o })
104
104
  ]
105
105
  }
106
106
  );
107
- }), ue = d((n, t) => {
108
- const { className: s, children: e, ...a } = n;
109
- return i(a), /* @__PURE__ */ r(
110
- A,
107
+ }), pe = u((n, t) => {
108
+ const { className: a, children: e, ...s } = n;
109
+ return i(s), /* @__PURE__ */ r(
110
+ _,
111
111
  {
112
- className: b("bn-ak-group-label", s || ""),
112
+ className: b("bn-ak-group-label", a || ""),
113
113
  ref: t,
114
114
  children: e
115
115
  }
116
116
  );
117
- }), de = (n) => {
118
- const { children: t, sub: s, ...e } = n;
119
- return i(e), s ? t : /* @__PURE__ */ r(w, { render: t });
120
- }, me = d((n, t) => {
121
- const { className: s, ...e } = n;
117
+ }), Ne = (n) => {
118
+ const { children: t, sub: a, ...e } = n;
119
+ return i(e), a ? t : /* @__PURE__ */ r(w, { render: t });
120
+ }, ke = u((n, t) => {
121
+ const { className: a, ...e } = n;
122
122
  return i(e), /* @__PURE__ */ r(
123
- H,
123
+ J,
124
124
  {
125
- className: b("bn-ak-separator", s || ""),
125
+ className: b("bn-ak-separator", a || ""),
126
126
  ref: t
127
127
  }
128
128
  );
129
- }), be = d((n, t) => {
129
+ }), fe = u((n, t) => {
130
130
  const {
131
- className: s,
131
+ className: a,
132
+ children: e,
133
+ icon: s,
134
+ onClick: o,
135
+ label: l,
136
+ onDragEnd: m,
137
+ onDragStart: c,
138
+ draggable: d,
139
+ ...g
140
+ } = n;
141
+ return i(g, !1), /* @__PURE__ */ h(
142
+ f,
143
+ {
144
+ onDragEnd: m,
145
+ onDragStart: c,
146
+ draggable: d,
147
+ "aria-label": l,
148
+ className: b(
149
+ "bn-ak-button bn-ak-secondary",
150
+ a || ""
151
+ ),
152
+ ref: t,
153
+ onClick: o,
154
+ ...g,
155
+ children: [
156
+ s,
157
+ e
158
+ ]
159
+ }
160
+ );
161
+ }), ve = u((n, t) => {
162
+ const {
163
+ className: a,
132
164
  tabs: e,
133
- defaultOpenTab: a,
165
+ defaultOpenTab: s,
134
166
  openTab: o,
135
167
  setOpenTab: l,
136
168
  loading: m,
@@ -140,228 +172,232 @@ const re = (n) => {
140
172
  return i(c), /* @__PURE__ */ r(
141
173
  "div",
142
174
  {
143
- className: b("bn-ak-wrapper", s || ""),
175
+ className: b("bn-ak-wrapper", a || ""),
144
176
  ref: t,
145
- children: /* @__PURE__ */ g(
146
- j,
177
+ children: /* @__PURE__ */ h(
178
+ Q,
147
179
  {
148
- defaultSelectedId: a,
180
+ defaultSelectedId: s,
149
181
  selectedId: o,
150
- setActiveId: (u) => {
151
- u && l(u);
182
+ setActiveId: (d) => {
183
+ d && l(d);
152
184
  },
153
185
  children: [
154
- /* @__PURE__ */ r(q, { className: "bn-ak-tab-list", children: e.map((u) => /* @__PURE__ */ r(K, { className: "bn-ak-tab", id: u.name, children: u.name }, u.name)) }),
155
- /* @__PURE__ */ r("div", { className: "bn-ak-panels", children: e.map((u) => /* @__PURE__ */ r(z, { tabId: u.name, children: u.tabPanel }, u.name)) })
186
+ /* @__PURE__ */ r(X, { className: "bn-ak-tab-list", children: e.map((d) => /* @__PURE__ */ r(Y, { className: "bn-ak-tab", id: d.name, children: d.name }, d.name)) }),
187
+ /* @__PURE__ */ r("div", { className: "bn-ak-panels", children: e.map((d) => /* @__PURE__ */ r(Z, { tabId: d.name, children: d.tabPanel }, d.name)) })
156
188
  ]
157
189
  }
158
190
  )
159
191
  }
160
192
  );
161
- }), ge = d((n, t) => {
162
- const { className: s, children: e, onClick: a, label: o, ...l } = n;
193
+ }), Se = u((n, t) => {
194
+ const { className: a, children: e, onClick: s, label: o, ...l } = n;
163
195
  return i(l), /* @__PURE__ */ r(
164
- N,
196
+ f,
165
197
  {
166
- className: b("bn-ak-button", s || ""),
167
- onClick: a,
198
+ className: b("bn-ak-button", a || ""),
199
+ onClick: s,
168
200
  "aria-label": o,
169
201
  ref: t,
170
202
  children: e
171
203
  }
172
204
  );
173
- }), pe = d((n, t) => {
174
- const { className: s, accept: e, value: a, placeholder: o, onChange: l, ...m } = n;
205
+ }), Te = u((n, t) => {
206
+ const { className: a, accept: e, value: s, placeholder: o, onChange: l, ...m } = n;
175
207
  return i(m), /* @__PURE__ */ r(T, { children: /* @__PURE__ */ r(
176
- S,
208
+ M,
177
209
  {
178
- className: s,
210
+ className: a,
179
211
  ref: t,
180
212
  name: "panel-input",
181
213
  type: "file",
182
214
  accept: e,
183
- value: a ? a.name : void 0,
215
+ value: s ? s.name : void 0,
184
216
  onChange: async (c) => l == null ? void 0 : l(c.target.files[0]),
185
217
  placeholder: o
186
218
  }
187
219
  ) });
188
- }), he = d((n, t) => {
189
- const { className: s, children: e, ...a } = n;
190
- return i(a), /* @__PURE__ */ r("div", { className: s, ref: t, children: e });
191
- }), Ne = d((n, t) => {
192
- const { className: s, value: e, placeholder: a, onKeyDown: o, onChange: l, ...m } = n;
220
+ }), Me = u((n, t) => {
221
+ const { className: a, children: e, ...s } = n;
222
+ return i(s), /* @__PURE__ */ r("div", { className: a, ref: t, children: e });
223
+ }), Ie = u((n, t) => {
224
+ const { className: a, value: e, placeholder: s, onKeyDown: o, onChange: l, ...m } = n;
193
225
  return i(m), /* @__PURE__ */ r(T, { children: /* @__PURE__ */ r(
194
- S,
226
+ M,
195
227
  {
196
- className: b("bn-ak-input", s || ""),
228
+ className: b("bn-ak-input", a || ""),
197
229
  name: "panel-input",
198
230
  value: e,
199
- placeholder: a,
231
+ placeholder: s,
200
232
  onChange: l,
201
233
  onKeyDown: o,
202
234
  "data-test": "embed-input",
203
235
  ref: t
204
236
  }
205
237
  ) });
206
- }), ve = d((n, t) => {
207
- const { children: s, ...e } = n;
208
- return i(e), /* @__PURE__ */ r(J, { render: s, ref: t });
209
- }), ke = d((n, t) => {
210
- const { className: s, children: e, variant: a, ...o } = n;
238
+ }), Ce = u((n, t) => {
239
+ const { children: a, ...e } = n;
240
+ return i(e), /* @__PURE__ */ r(ee, { render: a, ref: t });
241
+ }), ye = u((n, t) => {
242
+ const { className: a, children: e, variant: s, ...o } = n;
211
243
  return i(o), /* @__PURE__ */ r(
212
- Q,
244
+ ne,
213
245
  {
214
- className: b("bn-ak-popover", s || ""),
246
+ className: b(
247
+ "bn-ak-popover",
248
+ a || "",
249
+ s === "panel-popover" ? "bn-ak-panel-popover" : ""
250
+ ),
215
251
  ref: t,
216
252
  children: e
217
253
  }
218
254
  );
219
- }), fe = (n) => {
220
- const { children: t, opened: s, position: e, ...a } = n;
221
- return i(a), /* @__PURE__ */ r(U, { open: s, placement: e, children: t });
222
- }, Te = d((n, t) => {
223
- const { className: s, children: e, ...a } = n;
224
- return i(a, !1), /* @__PURE__ */ r(y, { className: s, ref: t, ...a, children: e });
225
- }), Se = d((n, t) => {
255
+ }), Pe = (n) => {
256
+ const { children: t, opened: a, position: e, ...s } = n;
257
+ return i(s), /* @__PURE__ */ r(te, { open: a, placement: e, children: t });
258
+ }, Be = u((n, t) => {
259
+ const { className: a, children: e, ...s } = n;
260
+ return i(s, !1), /* @__PURE__ */ r(N, { className: a, ref: t, ...s, children: e });
261
+ }), we = u((n, t) => {
226
262
  const {
227
- className: s,
263
+ className: a,
228
264
  children: e,
229
- icon: a,
265
+ icon: s,
230
266
  onClick: o,
231
267
  label: l,
232
268
  onDragEnd: m,
233
269
  onDragStart: c,
234
- draggable: u,
235
- ...p
270
+ draggable: d,
271
+ ...g
236
272
  } = n;
237
- return i(p, !1), /* @__PURE__ */ g(
238
- N,
273
+ return i(g, !1), /* @__PURE__ */ h(
274
+ f,
239
275
  {
240
276
  onDragEnd: m,
241
277
  onDragStart: c,
242
- draggable: u,
278
+ draggable: d,
243
279
  "aria-label": l,
244
280
  className: b(
245
281
  "bn-ak-button bn-ak-secondary",
246
- s || ""
282
+ a || ""
247
283
  ),
248
284
  ref: t,
249
285
  onClick: o,
250
- ...p,
286
+ ...g,
251
287
  children: [
252
- a,
288
+ s,
253
289
  e
254
290
  ]
255
291
  }
256
292
  );
257
- }), Me = d((n, t) => {
258
- const { className: s, children: e, id: a, columns: o, ...l } = n;
293
+ }), xe = u((n, t) => {
294
+ const { className: a, children: e, id: s, columns: o, ...l } = n;
259
295
  return i(l), /* @__PURE__ */ r(
260
296
  "div",
261
297
  {
262
- className: s,
298
+ className: a,
263
299
  style: { gridTemplateColumns: `repeat(${o}, 1fr)` },
264
300
  ref: t,
265
- id: a,
301
+ id: s,
266
302
  role: "grid",
267
303
  children: e
268
304
  }
269
305
  );
270
- }), Ie = d((n, t) => {
271
- const { className: s, children: e, columns: a, ...o } = n;
306
+ }), Fe = u((n, t) => {
307
+ const { className: a, children: e, columns: s, ...o } = n;
272
308
  return i(o), /* @__PURE__ */ r(
273
309
  "div",
274
310
  {
275
- className: b("bn-ak-menu-item", s || ""),
276
- style: { gridColumn: `1 / ${a + 1}` },
311
+ className: b("bn-ak-menu-item", a || ""),
312
+ style: { gridColumn: `1 / ${s + 1}` },
277
313
  ref: t,
278
314
  children: /* @__PURE__ */ r("div", { className: "bn-ak-suggestion-menu-item-label", children: e })
279
315
  }
280
316
  );
281
- }), Pe = d((n, t) => {
282
- const { className: s, isSelected: e, onClick: a, item: o, id: l, ...m } = n;
317
+ }), Re = u((n, t) => {
318
+ const { className: a, isSelected: e, onClick: s, item: o, id: l, ...m } = n;
283
319
  i(m);
284
- const c = R(null);
285
- return D(() => {
320
+ const c = E(null);
321
+ return L(() => {
286
322
  if (!c.current || !e)
287
323
  return;
288
- const u = P(
324
+ const d = P(
289
325
  c.current,
290
326
  document.querySelector(".bn-grid-suggestion-menu")
291
327
  );
292
- u === "top" ? c.current.scrollIntoView(!0) : u === "bottom" && c.current.scrollIntoView(!1);
328
+ d === "top" ? c.current.scrollIntoView(!0) : d === "bottom" && c.current.scrollIntoView(!1);
293
329
  }, [e]), /* @__PURE__ */ r(
294
330
  "div",
295
331
  {
296
- className: s,
297
- ref: C([t, c]),
332
+ className: a,
333
+ ref: B([t, c]),
298
334
  id: l,
299
335
  role: "option",
300
- onClick: a,
336
+ onClick: s,
301
337
  "aria-selected": e || void 0,
302
338
  children: o.icon
303
339
  }
304
340
  );
305
- }), Ce = d((n, t) => {
341
+ }), De = u((n, t) => {
306
342
  const {
307
- className: s,
343
+ className: a,
308
344
  children: e,
309
345
  // unused, using "dots" instead
310
- columns: a,
346
+ columns: s,
311
347
  ...o
312
348
  } = n;
313
349
  return i(o), /* @__PURE__ */ r(
314
350
  "div",
315
351
  {
316
- className: s,
317
- style: { gridColumn: `1 / ${a + 1}` },
352
+ className: a,
353
+ style: { gridColumn: `1 / ${s + 1}` },
318
354
  ref: t,
319
355
  children: e
320
356
  }
321
357
  );
322
- }), we = d((n, t) => {
323
- const { className: s, children: e, id: a, ...o } = n;
358
+ }), Ee = u((n, t) => {
359
+ const { className: a, children: e, id: s, ...o } = n;
324
360
  return i(o), /* @__PURE__ */ r(
325
- y,
361
+ N,
326
362
  {
327
- className: b("bn-ak-menu", s || ""),
328
- id: a,
363
+ className: b("bn-ak-menu", a || ""),
364
+ id: s,
329
365
  role: "listbox",
330
366
  ref: t,
331
367
  children: e
332
368
  }
333
369
  );
334
- }), ye = d((n, t) => {
335
- const { className: s, children: e, ...a } = n;
336
- return i(a), /* @__PURE__ */ r(
370
+ }), Le = u((n, t) => {
371
+ const { className: a, children: e, ...s } = n;
372
+ return i(s), /* @__PURE__ */ r(
337
373
  "div",
338
374
  {
339
- className: b("bn-ak-menu-item", s || ""),
375
+ className: b("bn-ak-menu-item", a || ""),
340
376
  ref: t,
341
377
  children: /* @__PURE__ */ r("div", { className: "bn-ak-suggestion-menu-item-label", children: e })
342
378
  }
343
379
  );
344
- }), xe = d((n, t) => {
345
- const { className: s, item: e, isSelected: a, onClick: o, id: l, ...m } = n;
380
+ }), Ge = u((n, t) => {
381
+ const { className: a, item: e, isSelected: s, onClick: o, id: l, ...m } = n;
346
382
  i(m);
347
- const c = R(null);
348
- return D(() => {
349
- if (!c.current || !a)
383
+ const c = E(null);
384
+ return L(() => {
385
+ if (!c.current || !s)
350
386
  return;
351
- const u = P(
387
+ const d = P(
352
388
  c.current,
353
389
  document.querySelector(".bn-suggestion-menu")
354
390
  );
355
- u === "top" ? c.current.scrollIntoView(!0) : u === "bottom" && c.current.scrollIntoView(!1);
356
- }, [a]), /* @__PURE__ */ g(
391
+ d === "top" ? c.current.scrollIntoView(!0) : d === "bottom" && c.current.scrollIntoView(!1);
392
+ }, [s]), /* @__PURE__ */ h(
357
393
  "div",
358
394
  {
359
- className: b("bn-ak-menu-item", s || ""),
360
- ref: C([t, c]),
395
+ className: b("bn-ak-menu-item", a || ""),
396
+ ref: B([t, c]),
361
397
  id: l,
362
398
  onClick: o,
363
399
  role: "option",
364
- "aria-selected": a || void 0,
400
+ "aria-selected": s || void 0,
365
401
  children: [
366
402
  e.icon && /* @__PURE__ */ r(
367
403
  "div",
@@ -371,7 +407,7 @@ const re = (n) => {
371
407
  children: e.icon
372
408
  }
373
409
  ),
374
- /* @__PURE__ */ g("div", { className: "bn-ak-suggestion-menu-item-body", children: [
410
+ /* @__PURE__ */ h("div", { className: "bn-ak-suggestion-menu-item-body", children: [
375
411
  /* @__PURE__ */ r("div", { className: "bn-ak-suggestion-menu-item-title", children: e.title }),
376
412
  /* @__PURE__ */ r("div", { className: "bn-ak-suggestion-menu-item-subtitle", children: e.subtext })
377
413
  ] }),
@@ -386,114 +422,120 @@ const re = (n) => {
386
422
  ]
387
423
  }
388
424
  );
389
- }), Re = d((n, t) => {
390
- const { className: s, children: e, ...a } = n;
391
- return i(a), /* @__PURE__ */ r(
425
+ }), Ae = u((n, t) => {
426
+ const { className: a, children: e, ...s } = n;
427
+ return i(s), /* @__PURE__ */ r(
392
428
  "div",
393
429
  {
394
- className: b("bn-ak-group-label", s || ""),
430
+ className: b("bn-ak-group-label", a || ""),
395
431
  ref: t,
396
432
  children: e
397
433
  }
398
434
  );
399
- }), De = d((n, t) => {
400
- const { className: s, children: e, ...a } = n;
401
- return i(a), /* @__PURE__ */ r("div", { className: s, ref: t, children: e });
402
- }), Be = d((n, t) => {
403
- const { children: s, className: e, onMouseDown: a, onClick: o, ...l } = n;
435
+ }), $e = u((n, t) => {
436
+ const { className: a, children: e, ...s } = n;
437
+ return i(s), /* @__PURE__ */ r("div", { className: a, ref: t, children: e });
438
+ }), Ve = u((n, t) => {
439
+ const { children: a, className: e, onMouseDown: s, onClick: o, ...l } = n;
404
440
  return i(l, !1), /* @__PURE__ */ r(
405
- N,
441
+ f,
406
442
  {
407
443
  className: b(
408
444
  "bn-ak-button bn-ak-secondary",
409
445
  e || ""
410
446
  ),
411
447
  ref: t,
412
- onMouseDown: a,
448
+ onMouseDown: s,
413
449
  onClick: o,
414
450
  ...l,
415
- children: s
451
+ children: a
416
452
  }
417
453
  );
418
- }), Le = d((n, t) => {
454
+ }), Oe = u((n, t) => {
419
455
  const {
420
- className: s,
456
+ className: a,
421
457
  children: e,
422
- draggable: a,
458
+ draggable: s,
423
459
  onDragStart: o,
424
460
  onDragEnd: l,
425
461
  style: m,
426
462
  label: c,
427
- ...u
463
+ ...d
428
464
  } = n;
429
- return i(u, !1), /* @__PURE__ */ r(
430
- N,
465
+ return i(d, !1), /* @__PURE__ */ r(
466
+ f,
431
467
  {
432
468
  className: b(
433
469
  "bn-ak-button bn-ak-secondary",
434
- s || ""
470
+ a || ""
435
471
  ),
436
472
  ref: t,
437
473
  "aria-label": c,
438
- draggable: a,
474
+ draggable: s,
439
475
  onDragStart: o,
440
476
  onDragEnd: l,
441
477
  style: m,
442
- ...u,
478
+ ...d,
443
479
  children: e
444
480
  }
445
481
  );
446
- }), k = d(
482
+ }), v = u(
447
483
  (n, t) => {
448
- const { className: s, children: e, onMouseEnter: a, onMouseLeave: o, ...l } = n;
449
- return i(l), /* @__PURE__ */ r(
450
- W,
484
+ const {
485
+ className: a,
486
+ children: e,
487
+ onMouseEnter: s,
488
+ onMouseLeave: o,
489
+ variant: l,
490
+ ...m
491
+ } = n;
492
+ return i(m), /* @__PURE__ */ r(
493
+ ae,
451
494
  {
452
- className: b("bn-ak-toolbar", s || ""),
495
+ className: b("bn-ak-toolbar", a || ""),
453
496
  ref: t,
454
- onMouseEnter: a,
497
+ onMouseEnter: s,
455
498
  onMouseLeave: o,
456
499
  children: e
457
500
  }
458
501
  );
459
502
  }
460
- ), f = d(
503
+ ), S = u(
461
504
  (n, t) => {
462
505
  const {
463
- className: s,
506
+ className: a,
464
507
  children: e,
465
- mainTooltip: a,
508
+ mainTooltip: s,
466
509
  secondaryTooltip: o,
467
510
  icon: l,
468
511
  isSelected: m,
469
512
  isDisabled: c,
470
- onClick: u,
471
- label: p,
472
- ...h
513
+ onClick: d,
514
+ label: g,
515
+ variant: p,
516
+ ...k
473
517
  } = n;
474
- return i(h, !1), /* @__PURE__ */ g(X, { children: [
518
+ return i(k, !1), /* @__PURE__ */ h(x, { children: [
475
519
  /* @__PURE__ */ r(
476
- Y,
520
+ F,
477
521
  {
478
- className: "link",
479
- render: /* @__PURE__ */ g(
480
- x,
522
+ render: /* @__PURE__ */ h(
523
+ R,
481
524
  {
482
- "aria-label": p,
525
+ "aria-label": g,
483
526
  className: b(
484
527
  "bn-ak-button bn-ak-secondary",
485
- s || ""
528
+ a || ""
486
529
  ),
487
- onMouseDown: (v) => {
488
- L() && v.currentTarget.focus();
530
+ onMouseDown: (I) => {
531
+ A() && I.currentTarget.focus();
489
532
  },
490
- onClick: u,
533
+ onClick: d,
491
534
  "aria-pressed": m,
492
535
  "data-selected": m ? "true" : void 0,
493
- "data-test": n.mainTooltip.slice(0, 1).toLowerCase() + n.mainTooltip.replace(/\s+/g, "").slice(1),
494
536
  disabled: c || !1,
495
537
  ref: t,
496
- ...h,
538
+ ...k,
497
539
  children: [
498
540
  l,
499
541
  e
@@ -502,51 +544,51 @@ const re = (n) => {
502
544
  )
503
545
  }
504
546
  ),
505
- /* @__PURE__ */ g(Z, { className: "bn-ak-tooltip", children: [
506
- /* @__PURE__ */ r("span", { children: a }),
547
+ /* @__PURE__ */ h(D, { className: "bn-ak-tooltip", portal: !1, children: [
548
+ /* @__PURE__ */ r("span", { children: s }),
507
549
  o && /* @__PURE__ */ r("span", { children: o })
508
550
  ] })
509
551
  ] });
510
552
  }
511
- ), Fe = d((n, t) => {
512
- const { className: s, items: e, isDisabled: a, ...o } = n;
553
+ ), He = u((n, t) => {
554
+ const { className: a, items: e, isDisabled: s, ...o } = n;
513
555
  i(o);
514
556
  const l = n.items.filter((c) => c.isSelected)[0], m = (c) => {
515
- var u, p;
516
- (p = (u = e.find((h) => h.text === c)).onClick) == null || p.call(u);
557
+ var d, g;
558
+ (g = (d = e.find((p) => p.text === c)).onClick) == null || g.call(d);
517
559
  };
518
- return /* @__PURE__ */ g(_, { value: l.text, setValue: m, children: [
519
- /* @__PURE__ */ g(
520
- ee,
560
+ return /* @__PURE__ */ h(se, { value: l.text, setValue: m, children: [
561
+ /* @__PURE__ */ h(
562
+ re,
521
563
  {
522
564
  className: "bn-ak-button bn-ak-secondary",
523
- disabled: a,
565
+ disabled: s,
524
566
  "aria-label": "Text alignment",
525
- render: /* @__PURE__ */ r(x, {}),
567
+ render: /* @__PURE__ */ r(R, {}),
526
568
  children: [
527
569
  l.icon,
528
570
  " ",
529
571
  l.text,
530
572
  " ",
531
- /* @__PURE__ */ r(ne, {})
573
+ /* @__PURE__ */ r(oe, {})
532
574
  ]
533
575
  }
534
576
  ),
535
577
  /* @__PURE__ */ r(
536
- te,
578
+ le,
537
579
  {
538
- className: b("bn-ak-popover", s || ""),
580
+ className: b("bn-ak-popover", a || ""),
539
581
  ref: t,
540
582
  gutter: 4,
541
- children: e.map((c) => /* @__PURE__ */ g(
542
- se,
583
+ children: e.map((c) => /* @__PURE__ */ h(
584
+ ce,
543
585
  {
544
586
  className: "bn-ak-select-item",
545
587
  value: c.text,
546
588
  children: [
547
589
  c.icon,
548
590
  c.text,
549
- c.text === l.text && /* @__PURE__ */ r(ae, {})
591
+ c.text === l.text && /* @__PURE__ */ r(ie, {})
550
592
  ]
551
593
  },
552
594
  c.text
@@ -554,79 +596,245 @@ const re = (n) => {
554
596
  }
555
597
  )
556
598
  ] });
557
- }), Ee = {
599
+ }), je = u((n, t) => {
600
+ const { className: a, children: e, ...s } = n;
601
+ return i(s, !1), /* @__PURE__ */ r(
602
+ N,
603
+ {
604
+ className: b(a, "bn-ak-hovercard"),
605
+ ref: t,
606
+ children: e
607
+ }
608
+ );
609
+ }), qe = u((n, t) => {
610
+ const { className: a, children: e, ...s } = n;
611
+ return i(s, !1), /* @__PURE__ */ r(
612
+ N,
613
+ {
614
+ className: b(a, "bn-ak-card-section"),
615
+ ref: t,
616
+ children: e
617
+ }
618
+ );
619
+ }), Ke = u((n, t) => {
620
+ const { authorInfo: a, timeString: e, ...s } = n;
621
+ return i(s, !1), a === "loading" ? /* @__PURE__ */ h(N, { className: "bn-ak-author-info", children: [
622
+ /* @__PURE__ */ r("div", { className: "bn-ak-avatar bn-ak-skeleton" }),
623
+ /* @__PURE__ */ r("div", { className: "bn-ak-username bn-ak-skeleton" })
624
+ ] }) : /* @__PURE__ */ h(N, { className: "bn-ak-author-info", children: [
625
+ /* @__PURE__ */ r(
626
+ "img",
627
+ {
628
+ src: a.avatarUrl,
629
+ alt: a.username,
630
+ className: "bn-ak-avatar"
631
+ }
632
+ ),
633
+ /* @__PURE__ */ h("div", { className: "bn-ak-username", children: [
634
+ a.username,
635
+ /* @__PURE__ */ r("span", { children: e })
636
+ ] })
637
+ ] });
638
+ }), ze = u((n, t) => {
639
+ const {
640
+ className: a,
641
+ showActions: e,
642
+ authorInfo: s,
643
+ timeString: o,
644
+ actions: l,
645
+ children: m,
646
+ ...c
647
+ } = n;
648
+ i(c, !1);
649
+ const [d, g] = ue(!1), { focused: p, ref: k } = $();
650
+ return /* @__PURE__ */ h(
651
+ N,
652
+ {
653
+ ref: t,
654
+ className: a,
655
+ onMouseEnter: () => g(!0),
656
+ onMouseLeave: () => g(!1),
657
+ children: [
658
+ l && (e === !0 || e === void 0 || e === "hover" && d || p) ? /* @__PURE__ */ r(
659
+ N,
660
+ {
661
+ ref: k,
662
+ style: {
663
+ position: "absolute",
664
+ right: 0,
665
+ top: 0,
666
+ zIndex: 10
667
+ },
668
+ children: l
669
+ }
670
+ ) : null,
671
+ /* @__PURE__ */ r(Ke, { ...n }),
672
+ m
673
+ ]
674
+ }
675
+ );
676
+ }), Ue = u((n, t) => {
677
+ const { className: a, onFocus: e, onBlur: s, editor: o, editable: l, ...m } = n;
678
+ return i(m, !1), /* @__PURE__ */ r(
679
+ Xe,
680
+ {
681
+ autoFocus: !0,
682
+ className: a,
683
+ editor: n.editor,
684
+ sideMenu: !1,
685
+ slashMenu: !1,
686
+ tableHandles: !1,
687
+ filePanel: !1,
688
+ formattingToolbar: !1,
689
+ editable: l,
690
+ ref: t,
691
+ onFocus: e,
692
+ onBlur: s,
693
+ children: /* @__PURE__ */ r(
694
+ V,
695
+ {
696
+ formattingToolbar: We
697
+ }
698
+ )
699
+ }
700
+ );
701
+ }), We = () => {
702
+ const n = O([]).filter(
703
+ (t) => t.key !== "nestBlockButton" && t.key !== "unnestBlockButton"
704
+ );
705
+ return /* @__PURE__ */ r(H, { blockTypeSelectItems: [], children: n });
706
+ }, _e = u((n, t) => {
707
+ const {
708
+ className: a,
709
+ text: e,
710
+ icon: s,
711
+ isSelected: o,
712
+ mainTooltip: l,
713
+ secondaryTooltip: m,
714
+ onClick: c,
715
+ onMouseEnter: d,
716
+ ...g
717
+ } = n;
718
+ i(g, !1);
719
+ const p = /* @__PURE__ */ h(
720
+ f,
721
+ {
722
+ className: b(
723
+ a,
724
+ "bn-ak-badge bn-ak-button",
725
+ o && "bn-ak-primary"
726
+ ),
727
+ "aria-selected": o === !0,
728
+ onClick: (k) => c == null ? void 0 : c(k),
729
+ onMouseEnter: d,
730
+ ref: t,
731
+ children: [
732
+ /* @__PURE__ */ r("span", { children: s }),
733
+ /* @__PURE__ */ r("span", { children: e })
734
+ ]
735
+ }
736
+ );
737
+ return l ? /* @__PURE__ */ h(x, { children: [
738
+ /* @__PURE__ */ r(F, { render: p }),
739
+ /* @__PURE__ */ h(D, { className: "bn-ak-tooltip", portal: !1, children: [
740
+ /* @__PURE__ */ r("span", { children: l }),
741
+ m && /* @__PURE__ */ r("span", { children: m })
742
+ ] })
743
+ ] }) : p;
744
+ }), Je = u((n, t) => {
745
+ const { className: a, children: e, ...s } = n;
746
+ return i(s), /* @__PURE__ */ r(
747
+ N,
748
+ {
749
+ className: b(a, "bn-ak-badge-group"),
750
+ ref: t,
751
+ children: e
752
+ }
753
+ );
754
+ }), Qe = {
558
755
  FormattingToolbar: {
559
- Root: k,
560
- Button: f,
561
- Select: Fe
756
+ Root: v,
757
+ Button: S,
758
+ Select: He
562
759
  },
563
760
  FilePanel: {
564
- Root: be,
565
- Button: ge,
566
- FileInput: pe,
567
- TabPanel: he,
568
- TextInput: Ne
761
+ Root: ve,
762
+ Button: Se,
763
+ FileInput: Te,
764
+ TabPanel: Me,
765
+ TextInput: Ie
569
766
  },
570
767
  GridSuggestionMenu: {
571
- Root: Me,
572
- Item: Pe,
573
- EmptyItem: Ie,
574
- Loader: Ce
768
+ Root: xe,
769
+ Item: Re,
770
+ EmptyItem: Fe,
771
+ Loader: De
575
772
  },
576
773
  LinkToolbar: {
577
- Root: k,
578
- Button: f
774
+ Root: v,
775
+ Button: S
579
776
  },
580
777
  SideMenu: {
581
- Root: Te,
582
- Button: Se
778
+ Root: Be,
779
+ Button: we
583
780
  },
584
781
  SuggestionMenu: {
585
- Root: we,
586
- Item: xe,
587
- EmptyItem: ye,
588
- Label: Re,
589
- Loader: De
782
+ Root: Ee,
783
+ Item: Ge,
784
+ EmptyItem: Le,
785
+ Label: Ae,
786
+ Loader: $e
590
787
  },
591
788
  TableHandle: {
592
- Root: Le,
593
- ExtendButton: Be
789
+ Root: Oe,
790
+ ExtendButton: Ve
791
+ },
792
+ Comments: {
793
+ Comment: ze,
794
+ Editor: Ue,
795
+ Card: je,
796
+ CardSection: qe
594
797
  },
595
798
  Generic: {
799
+ Badge: {
800
+ Root: _e,
801
+ Group: Je
802
+ },
596
803
  Toolbar: {
597
- Root: k,
598
- Button: f
804
+ Root: v,
805
+ Button: S
599
806
  },
600
807
  Form: {
601
- Root: re,
602
- TextInput: oe
808
+ Root: de,
809
+ TextInput: me
603
810
  },
604
811
  Menu: {
605
- Root: le,
606
- Trigger: de,
607
- Dropdown: ce,
608
- Divider: me,
609
- Label: ue,
610
- Item: ie
812
+ Root: be,
813
+ Trigger: Ne,
814
+ Dropdown: he,
815
+ Divider: ke,
816
+ Label: pe,
817
+ Item: ge,
818
+ Button: fe
611
819
  },
612
820
  Popover: {
613
- Root: fe,
614
- Trigger: ve,
615
- Content: ke
821
+ Root: Pe,
822
+ Trigger: Ce,
823
+ Content: ye
616
824
  }
617
825
  }
618
- }, He = (n) => {
619
- const { className: t, ...s } = n;
620
- return /* @__PURE__ */ r(F.Provider, { value: Ee, children: /* @__PURE__ */ r(
621
- E,
826
+ }, Xe = (n) => {
827
+ const { className: t, ...a } = n;
828
+ return /* @__PURE__ */ r(j.Provider, { value: Qe, children: /* @__PURE__ */ r(
829
+ q,
622
830
  {
623
831
  className: b("bn-ariakit", t || ""),
624
- ...s
832
+ ...a
625
833
  }
626
834
  ) });
627
835
  };
628
836
  export {
629
- He as BlockNoteView,
630
- Ee as components
837
+ Xe as BlockNoteView,
838
+ Qe as components
631
839
  };
632
840
  //# sourceMappingURL=blocknote-ariakit.js.map