@blocknote/ariakit 0.44.1 → 0.45.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,7 +1,7 @@
1
1
  import { jsx as r, jsxs as h, Fragment as A } from "react/jsx-runtime";
2
2
  import { assertEmpty as u, mergeCSSClasses as b, isSafari as V } from "@blocknote/core";
3
3
  import { elementOverflow as B, mergeRefs as D, useFocusWithin as H, useDictionary as j, useBlockNoteContext as K, FormattingToolbarController as Q, getFormattingToolbarItems as z, FormattingToolbar as U, ComponentsContext as W, BlockNoteViewRaw as Z } from "@blocknote/react";
4
- import { FormProvider as C, FormLabel as _, FormInput as w, MenuButton as F, MenuButtonArrow as J, CheckboxCheck as x, MenuItem as P, MenuGroupLabel as X, MenuSeparator as Y, Menu as ee, MenuProvider as ne, Button as f, TabProvider as te, TabList as ae, Tab as se, TabPanel as re, Popover as oe, PopoverDisclosure as le, PopoverProvider as ce, Group as k, Toolbar as ie, TooltipProvider as R, TooltipAnchor as E, ToolbarItem as L, Tooltip as q, SelectProvider as ue, Select as de, SelectArrow as me, SelectPopover as be, SelectItem as he, SelectItemCheck as ge } from "@ariakit/react";
4
+ import { FormProvider as C, FormLabel as _, FormInput as w, MenuButton as F, MenuButtonArrow as J, CheckboxCheck as y, MenuItem as P, MenuGroupLabel as X, MenuSeparator as Y, Menu as ee, MenuProvider as ne, Button as f, TabProvider as te, TabList as ae, Tab as se, TabPanel as re, Popover as oe, PopoverDisclosure as le, PopoverProvider as ce, Group as k, Toolbar as ie, TooltipProvider as R, TooltipAnchor as E, ToolbarItem as L, Tooltip as q, SelectProvider as ue, Select as de, SelectArrow as me, SelectPopover as be, SelectItem as he, SelectItemCheck as ge } from "@ariakit/react";
5
5
  import { forwardRef as d, useRef as G, useEffect as O, useState as pe } from "react";
6
6
  const Ne = (n) => {
7
7
  const { children: t, ...a } = n;
@@ -12,22 +12,22 @@ const Ne = (n) => {
12
12
  name: e,
13
13
  label: s,
14
14
  variant: o,
15
- icon: l,
15
+ icon: c,
16
16
  value: m,
17
- autoFocus: c,
17
+ autoFocus: l,
18
18
  placeholder: i,
19
19
  disabled: g,
20
20
  onKeyDown: p,
21
21
  onChange: N,
22
22
  onSubmit: v,
23
23
  autoComplete: T,
24
- rightSection: y,
24
+ rightSection: x,
25
25
  ...$
26
26
  } = n;
27
27
  return u($), /* @__PURE__ */ h(A, { children: [
28
28
  n.label && /* @__PURE__ */ r(_, { name: e, children: s }),
29
29
  /* @__PURE__ */ h("div", { className: "bn-ak-input-wrapper", children: [
30
- l,
30
+ c,
31
31
  /* @__PURE__ */ r(
32
32
  w,
33
33
  {
@@ -39,7 +39,7 @@ const Ne = (n) => {
39
39
  ref: t,
40
40
  name: e,
41
41
  value: m,
42
- autoFocus: c,
42
+ autoFocus: l,
43
43
  placeholder: i,
44
44
  disabled: g,
45
45
  onKeyDown: p,
@@ -48,7 +48,7 @@ const Ne = (n) => {
48
48
  autoComplete: T
49
49
  }
50
50
  ),
51
- y
51
+ x
52
52
  ] })
53
53
  ] });
54
54
  }), fe = (n) => {
@@ -87,8 +87,8 @@ const Ne = (n) => {
87
87
  }
88
88
  );
89
89
  }), Te = d((n, t) => {
90
- const { className: a, children: e, icon: s, checked: o, subTrigger: l, onClick: m, ...c } = n;
91
- return u(c), l ? /* @__PURE__ */ h(
90
+ const { className: a, children: e, icon: s, checked: o, subTrigger: c, onClick: m, ...l } = n;
91
+ return u(l), c ? /* @__PURE__ */ h(
92
92
  F,
93
93
  {
94
94
  render: /* @__PURE__ */ r(P, {}),
@@ -99,7 +99,7 @@ const Ne = (n) => {
99
99
  s,
100
100
  e,
101
101
  /* @__PURE__ */ r(J, {}),
102
- o !== void 0 && /* @__PURE__ */ r(x, { checked: o })
102
+ o !== void 0 && /* @__PURE__ */ r(y, { checked: o })
103
103
  ]
104
104
  }
105
105
  ) : /* @__PURE__ */ h(
@@ -111,7 +111,7 @@ const Ne = (n) => {
111
111
  children: [
112
112
  s,
113
113
  e,
114
- o !== void 0 && /* @__PURE__ */ r(x, { checked: o })
114
+ o !== void 0 && /* @__PURE__ */ r(y, { checked: o })
115
115
  ]
116
116
  }
117
117
  );
@@ -143,9 +143,9 @@ const Ne = (n) => {
143
143
  children: e,
144
144
  icon: s,
145
145
  onClick: o,
146
- label: l,
146
+ label: c,
147
147
  onDragEnd: m,
148
- onDragStart: c,
148
+ onDragStart: l,
149
149
  draggable: i,
150
150
  ...g
151
151
  } = n;
@@ -153,9 +153,9 @@ const Ne = (n) => {
153
153
  f,
154
154
  {
155
155
  onDragEnd: m,
156
- onDragStart: c,
156
+ onDragStart: l,
157
157
  draggable: i,
158
- "aria-label": l,
158
+ "aria-label": c,
159
159
  className: b(
160
160
  "bn-ak-button bn-ak-secondary",
161
161
  a || ""
@@ -175,12 +175,12 @@ const Ne = (n) => {
175
175
  tabs: e,
176
176
  defaultOpenTab: s,
177
177
  openTab: o,
178
- setOpenTab: l,
178
+ setOpenTab: c,
179
179
  loading: m,
180
180
  // TODO: implement loading
181
- ...c
181
+ ...l
182
182
  } = n;
183
- return u(c), /* @__PURE__ */ r(
183
+ return u(l), /* @__PURE__ */ r(
184
184
  "div",
185
185
  {
186
186
  className: b("bn-ak-wrapper", a || ""),
@@ -191,7 +191,7 @@ const Ne = (n) => {
191
191
  defaultSelectedId: s,
192
192
  selectedId: o,
193
193
  setActiveId: (i) => {
194
- i && l(i);
194
+ i && c(i);
195
195
  },
196
196
  children: [
197
197
  /* @__PURE__ */ r(ae, { className: "bn-ak-tab-list", children: e.map((i) => /* @__PURE__ */ r(se, { className: "bn-ak-tab", id: i.name, children: i.name }, i.name)) }),
@@ -201,9 +201,9 @@ const Ne = (n) => {
201
201
  )
202
202
  }
203
203
  );
204
- }), ye = d((n, t) => {
205
- const { className: a, children: e, onClick: s, label: o, ...l } = n;
206
- return u(l), /* @__PURE__ */ r(
204
+ }), xe = d((n, t) => {
205
+ const { className: a, children: e, onClick: s, label: o, ...c } = n;
206
+ return u(c), /* @__PURE__ */ r(
207
207
  f,
208
208
  {
209
209
  className: b("bn-ak-button", a || ""),
@@ -213,8 +213,8 @@ const Ne = (n) => {
213
213
  children: e
214
214
  }
215
215
  );
216
- }), xe = d((n, t) => {
217
- const { className: a, accept: e, value: s, placeholder: o, onChange: l, ...m } = n;
216
+ }), ye = d((n, t) => {
217
+ const { className: a, accept: e, value: s, placeholder: o, onChange: c, ...m } = n;
218
218
  return u(m), /* @__PURE__ */ r(C, { children: /* @__PURE__ */ r(
219
219
  w,
220
220
  {
@@ -224,7 +224,7 @@ const Ne = (n) => {
224
224
  type: "file",
225
225
  accept: e,
226
226
  value: s ? s.name : void 0,
227
- onChange: async (c) => l == null ? void 0 : l(c.target.files[0]),
227
+ onChange: async (l) => c == null ? void 0 : c(l.target.files[0]),
228
228
  placeholder: o
229
229
  }
230
230
  ) });
@@ -232,7 +232,7 @@ const Ne = (n) => {
232
232
  const { className: a, children: e, ...s } = n;
233
233
  return u(s), /* @__PURE__ */ r("div", { className: a, ref: t, children: e });
234
234
  }), Be = d((n, t) => {
235
- const { className: a, value: e, placeholder: s, onKeyDown: o, onChange: l, ...m } = n;
235
+ const { className: a, value: e, placeholder: s, onKeyDown: o, onChange: c, ...m } = n;
236
236
  return u(m), /* @__PURE__ */ r(C, { children: /* @__PURE__ */ r(
237
237
  w,
238
238
  {
@@ -240,7 +240,7 @@ const Ne = (n) => {
240
240
  name: "panel-input",
241
241
  value: e,
242
242
  placeholder: s,
243
- onChange: l,
243
+ onChange: c,
244
244
  onKeyDown: o,
245
245
  "data-test": "embed-input",
246
246
  ref: t
@@ -283,9 +283,9 @@ const Ne = (n) => {
283
283
  children: e,
284
284
  icon: s,
285
285
  onClick: o,
286
- label: l,
286
+ label: c,
287
287
  onDragEnd: m,
288
- onDragStart: c,
288
+ onDragStart: l,
289
289
  draggable: i,
290
290
  ...g
291
291
  } = n;
@@ -293,9 +293,9 @@ const Ne = (n) => {
293
293
  f,
294
294
  {
295
295
  onDragEnd: m,
296
- onDragStart: c,
296
+ onDragStart: l,
297
297
  draggable: i,
298
- "aria-label": l,
298
+ "aria-label": c,
299
299
  className: b(
300
300
  "bn-ak-button bn-ak-secondary",
301
301
  a || ""
@@ -310,8 +310,8 @@ const Ne = (n) => {
310
310
  }
311
311
  );
312
312
  }), qe = d((n, t) => {
313
- const { className: a, children: e, id: s, columns: o, ...l } = n;
314
- return u(l), /* @__PURE__ */ r(
313
+ const { className: a, children: e, id: s, columns: o, ...c } = n;
314
+ return u(c), /* @__PURE__ */ r(
315
315
  "div",
316
316
  {
317
317
  className: a,
@@ -334,23 +334,23 @@ const Ne = (n) => {
334
334
  }
335
335
  );
336
336
  }), Oe = d((n, t) => {
337
- const { className: a, isSelected: e, onClick: s, item: o, id: l, ...m } = n;
337
+ const { className: a, isSelected: e, onClick: s, item: o, id: c, ...m } = n;
338
338
  u(m);
339
- const c = G(null);
339
+ const l = G(null);
340
340
  return O(() => {
341
- if (!c.current || !e)
341
+ if (!l.current || !e)
342
342
  return;
343
343
  const i = B(
344
- c.current,
345
- document.querySelector(".bn-grid-suggestion-menu")
344
+ l.current,
345
+ l.current.closest(".bn-grid-suggestion-menu")
346
346
  );
347
- i === "top" ? c.current.scrollIntoView(!0) : i === "bottom" && c.current.scrollIntoView(!1);
347
+ i === "top" ? l.current.scrollIntoView(!0) : i === "bottom" && l.current.scrollIntoView(!1);
348
348
  }, [e]), /* @__PURE__ */ r(
349
349
  "div",
350
350
  {
351
351
  className: a,
352
- ref: D([t, c]),
353
- id: l,
352
+ ref: D([t, l]),
353
+ id: c,
354
354
  role: "option",
355
355
  onClick: s,
356
356
  "aria-selected": e || void 0,
@@ -397,24 +397,23 @@ const Ne = (n) => {
397
397
  }
398
398
  );
399
399
  }), He = d((n, t) => {
400
- const { className: a, item: e, isSelected: s, onClick: o, id: l, ...m } = n;
400
+ const { className: a, item: e, isSelected: s, onClick: o, id: c, ...m } = n;
401
401
  u(m);
402
- const c = G(null);
402
+ const l = G(null);
403
403
  return O(() => {
404
- if (!c.current || !s)
404
+ if (!l.current || !s)
405
405
  return;
406
406
  const i = B(
407
- c.current,
408
- document.querySelector(".bn-suggestion-menu, #ai-suggestion-menu")
409
- // TODO
407
+ l.current,
408
+ l.current.closest(".bn-suggestion-menu, #ai-suggestion-menu")
410
409
  );
411
- i === "top" ? c.current.scrollIntoView(!0) : i === "bottom" && c.current.scrollIntoView(!1);
410
+ i === "top" ? l.current.scrollIntoView(!0) : i === "bottom" && l.current.scrollIntoView(!1);
412
411
  }, [s]), /* @__PURE__ */ h(
413
412
  "div",
414
413
  {
415
414
  className: b("bn-ak-menu-item", a || ""),
416
- ref: D([t, c]),
417
- id: l,
415
+ ref: D([t, l]),
416
+ id: c,
418
417
  onMouseDown: (i) => i.preventDefault(),
419
418
  onClick: o,
420
419
  role: "option",
@@ -467,8 +466,8 @@ const Ne = (n) => {
467
466
  }
468
467
  ) });
469
468
  }), Qe = d((n, t) => {
470
- const { children: a, className: e, onMouseDown: s, onClick: o, ...l } = n;
471
- return u(l, !1), /* @__PURE__ */ r(
469
+ const { children: a, className: e, onMouseDown: s, onClick: o, ...c } = n;
470
+ return u(c, !1), /* @__PURE__ */ r(
472
471
  f,
473
472
  {
474
473
  className: b(
@@ -478,7 +477,7 @@ const Ne = (n) => {
478
477
  ref: t,
479
478
  onMouseDown: s,
480
479
  onClick: o,
481
- ...l,
480
+ ...c,
482
481
  children: a
483
482
  }
484
483
  );
@@ -488,9 +487,9 @@ const Ne = (n) => {
488
487
  children: e,
489
488
  draggable: s,
490
489
  onDragStart: o,
491
- onDragEnd: l,
490
+ onDragEnd: c,
492
491
  style: m,
493
- label: c,
492
+ label: l,
494
493
  ...i
495
494
  } = n;
496
495
  return u(i, !1), /* @__PURE__ */ r(
@@ -501,10 +500,10 @@ const Ne = (n) => {
501
500
  a || ""
502
501
  ),
503
502
  ref: t,
504
- "aria-label": c,
503
+ "aria-label": l,
505
504
  draggable: s,
506
505
  onDragStart: o,
507
- onDragEnd: l,
506
+ onDragEnd: c,
508
507
  style: m,
509
508
  ...i,
510
509
  children: e
@@ -517,7 +516,7 @@ const Ne = (n) => {
517
516
  children: e,
518
517
  onMouseEnter: s,
519
518
  onMouseLeave: o,
520
- variant: l,
519
+ variant: c,
521
520
  ...m
522
521
  } = n;
523
522
  return u(m), /* @__PURE__ */ r(
@@ -538,9 +537,9 @@ const Ne = (n) => {
538
537
  children: e,
539
538
  mainTooltip: s,
540
539
  secondaryTooltip: o,
541
- icon: l,
540
+ icon: c,
542
541
  isSelected: m,
543
- isDisabled: c,
542
+ isDisabled: l,
544
543
  onClick: i,
545
544
  label: g,
546
545
  variant: p,
@@ -564,11 +563,11 @@ const Ne = (n) => {
564
563
  onClick: i,
565
564
  "aria-pressed": m,
566
565
  "data-selected": m ? "true" : void 0,
567
- disabled: c || !1,
566
+ disabled: l || !1,
568
567
  ref: t,
569
568
  ...N,
570
569
  children: [
571
- l,
570
+ c,
572
571
  e
573
572
  ]
574
573
  }
@@ -584,11 +583,11 @@ const Ne = (n) => {
584
583
  ), I = d((n, t) => {
585
584
  const { className: a, items: e, isDisabled: s, ...o } = n;
586
585
  u(o);
587
- const l = n.items.filter((c) => c.isSelected)[0], m = (c) => {
586
+ const c = n.items.filter((l) => l.isSelected)[0], m = (l) => {
588
587
  var i, g;
589
- (g = (i = e.find((p) => p.text === c)).onClick) == null || g.call(i);
588
+ (g = (i = e.find((p) => p.text === l)).onClick) == null || g.call(i);
590
589
  };
591
- return /* @__PURE__ */ h(ue, { value: l.text, setValue: m, children: [
590
+ return /* @__PURE__ */ h(ue, { value: c.text, setValue: m, children: [
592
591
  /* @__PURE__ */ h(
593
592
  de,
594
593
  {
@@ -597,9 +596,9 @@ const Ne = (n) => {
597
596
  "aria-label": "Text alignment",
598
597
  render: /* @__PURE__ */ r(L, {}),
599
598
  children: [
600
- l.icon,
599
+ c.icon,
601
600
  " ",
602
- l.text,
601
+ c.text,
603
602
  " ",
604
603
  /* @__PURE__ */ r(me, {})
605
604
  ]
@@ -611,18 +610,18 @@ const Ne = (n) => {
611
610
  className: b("bn-ak-popover", a || ""),
612
611
  ref: t,
613
612
  gutter: 4,
614
- children: e.map((c) => /* @__PURE__ */ h(
613
+ children: e.map((l) => /* @__PURE__ */ h(
615
614
  he,
616
615
  {
617
616
  className: "bn-ak-select-item",
618
- value: c.text,
617
+ value: l.text,
619
618
  children: [
620
- c.icon,
621
- c.text,
622
- c.text === l.text && /* @__PURE__ */ r(ge, {})
619
+ l.icon,
620
+ l.text,
621
+ l.text === c.text && /* @__PURE__ */ r(ge, {})
623
622
  ]
624
623
  },
625
- c.text
624
+ l.text
626
625
  ))
627
626
  }
628
627
  )
@@ -633,9 +632,9 @@ const Ne = (n) => {
633
632
  children: e,
634
633
  selected: s,
635
634
  headerText: o,
636
- onFocus: l,
635
+ onFocus: c,
637
636
  onBlur: m,
638
- tabIndex: c,
637
+ tabIndex: l,
639
638
  ...i
640
639
  } = n;
641
640
  return u(i, !1), /* @__PURE__ */ h(
@@ -646,9 +645,9 @@ const Ne = (n) => {
646
645
  "bn-ak-hovercard",
647
646
  s && "selected"
648
647
  ),
649
- onFocus: l,
648
+ onFocus: c,
650
649
  onBlur: m,
651
- tabIndex: c,
650
+ tabIndex: l,
652
651
  ref: t,
653
652
  children: [
654
653
  o && /* @__PURE__ */ r("div", { className: "bn-header-text", children: o }),
@@ -680,7 +679,7 @@ const Ne = (n) => {
680
679
  }
681
680
  );
682
681
  }), _e = d((n, t) => {
683
- const { authorInfo: a, timeString: e, edited: s, ...o } = n, l = j();
682
+ const { authorInfo: a, timeString: e, edited: s, ...o } = n, c = j();
684
683
  return u(o, !1), a === "loading" ? /* @__PURE__ */ h(k, { className: "bn-ak-author-info", children: [
685
684
  /* @__PURE__ */ r("div", { className: "bn-ak-avatar bn-ak-skeleton" }),
686
685
  /* @__PURE__ */ r("div", { className: "bn-ak-username bn-ak-skeleton" })
@@ -698,7 +697,7 @@ const Ne = (n) => {
698
697
  /* @__PURE__ */ h("span", { children: [
699
698
  e,
700
699
  " ",
701
- s && `(${l.comments.edited})`
700
+ s && `(${c.comments.edited})`
702
701
  ] })
703
702
  ] })
704
703
  ] });
@@ -708,9 +707,9 @@ const Ne = (n) => {
708
707
  showActions: e,
709
708
  authorInfo: s,
710
709
  timeString: o,
711
- actions: l,
710
+ actions: c,
712
711
  children: m,
713
- edited: c,
712
+ edited: l,
714
713
  emojiPickerOpen: i,
715
714
  // Unused
716
715
  ...g
@@ -725,7 +724,7 @@ const Ne = (n) => {
725
724
  onMouseEnter: () => N(!0),
726
725
  onMouseLeave: () => N(!1),
727
726
  children: [
728
- l && (e === !0 || e === void 0 || e === "hover" && p || v) ? /* @__PURE__ */ r(
727
+ c && (e === !0 || e === void 0 || e === "hover" && p || v) ? /* @__PURE__ */ r(
729
728
  k,
730
729
  {
731
730
  ref: T,
@@ -735,7 +734,7 @@ const Ne = (n) => {
735
734
  top: 0,
736
735
  zIndex: 10
737
736
  },
738
- children: l
737
+ children: c
739
738
  }
740
739
  ) : null,
741
740
  /* @__PURE__ */ r(_e, { ...n }),
@@ -744,8 +743,8 @@ const Ne = (n) => {
744
743
  }
745
744
  );
746
745
  }), Xe = d((n, t) => {
747
- const { className: a, onFocus: e, onBlur: s, autoFocus: o, editor: l, editable: m, ...c } = n;
748
- u(c, !1);
746
+ const { className: a, onFocus: e, onBlur: s, autoFocus: o, editor: c, editable: m, ...l } = n;
747
+ u(l, !1);
749
748
  const i = K();
750
749
  return /* @__PURE__ */ r(
751
750
  an,
@@ -782,9 +781,9 @@ const Ne = (n) => {
782
781
  text: e,
783
782
  icon: s,
784
783
  isSelected: o,
785
- mainTooltip: l,
784
+ mainTooltip: c,
786
785
  secondaryTooltip: m,
787
- onClick: c,
786
+ onClick: l,
788
787
  onMouseEnter: i,
789
788
  ...g
790
789
  } = n;
@@ -798,7 +797,7 @@ const Ne = (n) => {
798
797
  o && "bn-ak-primary"
799
798
  ),
800
799
  "aria-selected": o === !0,
801
- onClick: (N) => c == null ? void 0 : c(N),
800
+ onClick: (N) => l == null ? void 0 : l(N),
802
801
  onMouseEnter: i,
803
802
  ref: t,
804
803
  children: [
@@ -807,10 +806,10 @@ const Ne = (n) => {
807
806
  ]
808
807
  }
809
808
  );
810
- return l ? /* @__PURE__ */ h(R, { children: [
809
+ return c ? /* @__PURE__ */ h(R, { children: [
811
810
  /* @__PURE__ */ r(E, { render: p }),
812
811
  /* @__PURE__ */ h(q, { className: "bn-ak-tooltip", portal: !1, children: [
813
- /* @__PURE__ */ r("span", { children: l }),
812
+ /* @__PURE__ */ r("span", { children: c }),
814
813
  m && /* @__PURE__ */ r("span", { children: m })
815
814
  ] })
816
815
  ] }) : p;
@@ -832,8 +831,8 @@ const Ne = (n) => {
832
831
  },
833
832
  FilePanel: {
834
833
  Root: we,
835
- Button: ye,
836
- FileInput: xe,
834
+ Button: xe,
835
+ FileInput: ye,
837
836
  TabPanel: Pe,
838
837
  TextInput: Be
839
838
  },