@blocknote/ariakit 0.47.3 → 0.48.1

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