@blocknote/mantine 0.35.0 → 0.36.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,10 +1,10 @@
1
1
  import { jsx as s, jsxs as v } from "react/jsx-runtime";
2
- import { assertEmpty as d, isSafari as B, mergeCSSClasses as z, COLORS_DEFAULT as ae, COLORS_DARK_MODE_DEFAULT as le } from "@blocknote/core";
3
- import { mergeRefs as W, useDictionary as ce, FormattingToolbarController as ue, getFormattingToolbarItems as de, FormattingToolbar as me, elementOverflow as q, useBlockNoteContext as fe, usePrefersColorScheme as ge, ComponentsContext as he, BlockNoteViewRaw as be } from "@blocknote/react";
4
- import { Button as N, ActionIcon as j, Tooltip as Z, Stack as $, Text as w, Group as b, Chip as pe, Divider as ve, Card as J, Skeleton as V, Avatar as Se, TextInput as Q, Menu as S, CheckIcon as X, Tabs as M, LoadingOverlay as ye, FileInput as xe, PopoverDropdown as Ce, PopoverTarget as we, Popover as Te, Badge as Ne, Loader as Y, Flex as ke, MantineProvider as Pe } from "@mantine/core";
5
- import T, { forwardRef as m, useState as A, useRef as P, useEffect as _, useContext as Me, createContext as Fe, useCallback as E } from "react";
6
- import { useHover as Oe, useFocusWithin as ee, mergeRefs as R, useFocusTrap as Re } from "@mantine/hooks";
7
- const te = (e, n, t = !1) => {
2
+ import { assertEmpty as d, isSafari as B, mergeCSSClasses as z, COLORS_DEFAULT as le, COLORS_DARK_MODE_DEFAULT as ce } from "@blocknote/core";
3
+ import { mergeRefs as W, useDictionary as ue, useBlockNoteContext as q, FormattingToolbarController as de, getFormattingToolbarItems as me, FormattingToolbar as fe, elementOverflow as Z, usePrefersColorScheme as ge, ComponentsContext as he, BlockNoteViewRaw as be } from "@blocknote/react";
4
+ import { Button as N, ActionIcon as j, Tooltip as J, Stack as $, Text as w, Group as b, Chip as pe, Divider as ve, Card as Q, Skeleton as V, Avatar as Se, TextInput as X, Menu as S, CheckIcon as Y, Tabs as M, LoadingOverlay as ye, FileInput as xe, PopoverDropdown as Ce, PopoverTarget as we, Popover as Te, Badge as Ne, Loader as ee, Flex as Pe, MantineProvider as ke } from "@mantine/core";
5
+ import T, { forwardRef as m, useState as A, useRef as k, useEffect as _, useContext as Me, createContext as Fe, useCallback as E } from "react";
6
+ import { useHover as Oe, useFocusWithin as te, mergeRefs as R, useFocusTrap as Re } from "@mantine/hooks";
7
+ const ne = (e, n, t = !1) => {
8
8
  const o = [];
9
9
  function r(i, l = "--bn") {
10
10
  for (const a in i) {
@@ -13,7 +13,7 @@ const te = (e, n, t = !1) => {
13
13
  }
14
14
  }
15
15
  return r(e), o;
16
- }, G = (e, n) => te(e, n), De = {
16
+ }, G = (e, n) => ne(e, n), De = {
17
17
  colors: {
18
18
  editor: {
19
19
  text: void 0,
@@ -83,7 +83,7 @@ const te = (e, n, t = !1) => {
83
83
  },
84
84
  borderRadius: void 0,
85
85
  fontFamily: void 0
86
- }, Ie = (e) => te(De, e, !0), ne = (e) => /* @__PURE__ */ v($, { gap: 0, className: "bn-tooltip", children: [
86
+ }, Ie = (e) => ne(De, e, !0), oe = (e) => /* @__PURE__ */ v($, { gap: 0, className: "bn-tooltip", children: [
87
87
  /* @__PURE__ */ s(w, { size: "sm", lineClamp: 5, children: e.mainTooltip }),
88
88
  e.secondaryTooltip && /* @__PURE__ */ s(w, { size: "xs", lineClamp: 5, children: e.secondaryTooltip })
89
89
  ] }), D = m(
@@ -102,7 +102,7 @@ const te = (e, n, t = !1) => {
102
102
  ...p
103
103
  } = e;
104
104
  d(p, !1);
105
- const [C, y] = A(!1), k = o ? /* @__PURE__ */ s(
105
+ const [C, y] = A(!1), P = o ? /* @__PURE__ */ s(
106
106
  N,
107
107
  {
108
108
  "aria-label": g,
@@ -146,20 +146,20 @@ const te = (e, n, t = !1) => {
146
146
  }
147
147
  );
148
148
  return r ? /* @__PURE__ */ s(
149
- Z,
149
+ J,
150
150
  {
151
151
  disabled: C,
152
152
  withinPortal: !1,
153
153
  label: /* @__PURE__ */ s(
154
- ne,
154
+ oe,
155
155
  {
156
156
  mainTooltip: r,
157
157
  secondaryTooltip: i
158
158
  }
159
159
  ),
160
- children: k
160
+ children: P
161
161
  }
162
- ) : k;
162
+ ) : P;
163
163
  }
164
164
  ), Le = m((e, n) => {
165
165
  const {
@@ -196,12 +196,12 @@ const te = (e, n, t = !1) => {
196
196
  }
197
197
  );
198
198
  return !l || h ? C : /* @__PURE__ */ s(
199
- Z,
199
+ J,
200
200
  {
201
201
  refProp: "rootRef",
202
202
  withinPortal: !1,
203
203
  label: /* @__PURE__ */ s(
204
- ne,
204
+ oe,
205
205
  {
206
206
  mainTooltip: l,
207
207
  secondaryTooltip: a
@@ -225,7 +225,7 @@ const te = (e, n, t = !1) => {
225
225
  ...c
226
226
  } = e;
227
227
  d(c, !1);
228
- const g = P(null);
228
+ const g = k(null);
229
229
  return _(() => {
230
230
  var h;
231
231
  i && ((h = g.current) == null || h.scrollIntoView({
@@ -233,7 +233,7 @@ const te = (e, n, t = !1) => {
233
233
  block: "center"
234
234
  }));
235
235
  }, [i]), /* @__PURE__ */ v(
236
- J,
236
+ Q,
237
237
  {
238
238
  className: z(t, i ? "selected" : ""),
239
239
  onFocus: l,
@@ -248,7 +248,7 @@ const te = (e, n, t = !1) => {
248
248
  );
249
249
  }), ze = m((e, n) => {
250
250
  const { className: t, children: o, ...r } = e;
251
- return d(r, !1), /* @__PURE__ */ s(J.Section, { className: t, ref: n, children: o });
251
+ return d(r, !1), /* @__PURE__ */ s(Q.Section, { className: t, ref: n, children: o });
252
252
  }), je = m((e, n) => {
253
253
  const { className: t, children: o, ...r } = e;
254
254
  return d(r, !1), /* @__PURE__ */ s(
@@ -260,7 +260,7 @@ const te = (e, n, t = !1) => {
260
260
  }
261
261
  );
262
262
  }), $e = m((e, n) => {
263
- const { authorInfo: t, timeString: o, edited: r, ...i } = e, l = ce();
263
+ const { authorInfo: t, timeString: o, edited: r, ...i } = e, l = ue();
264
264
  return d(i, !1), t === "loading" ? /* @__PURE__ */ v(b, { children: [
265
265
  /* @__PURE__ */ s(V, { height: 24, width: 24 }),
266
266
  /* @__PURE__ */ s("div", { children: /* @__PURE__ */ s(V, { height: 12, width: 100 }) })
@@ -294,7 +294,7 @@ const te = (e, n, t = !1) => {
294
294
  actions: a,
295
295
  children: u,
296
296
  ...c
297
- } = e, { hovered: g, ref: h } = Oe(), { focused: p, ref: C } = ee(), y = W([n, h]);
297
+ } = e, { hovered: g, ref: h } = Oe(), { focused: p, ref: C } = te(), y = W([n, h]);
298
298
  return d(c, !1), /* @__PURE__ */ v(b, { pos: "relative", ref: y, className: t, children: [
299
299
  a && (o === !0 || o === void 0 || o === "hover" && g || p) ? /* @__PURE__ */ s(
300
300
  b,
@@ -314,7 +314,9 @@ const te = (e, n, t = !1) => {
314
314
  ] });
315
315
  }), _e = m((e, n) => {
316
316
  const { className: t, autoFocus: o, onFocus: r, onBlur: i, editor: l, editable: a, ...u } = e;
317
- return d(u, !1), /* @__PURE__ */ s(
317
+ d(u, !1);
318
+ const c = q();
319
+ return /* @__PURE__ */ s(
318
320
  Ot,
319
321
  {
320
322
  autoFocus: o,
@@ -326,11 +328,12 @@ const te = (e, n, t = !1) => {
326
328
  filePanel: !1,
327
329
  formattingToolbar: !1,
328
330
  editable: a,
331
+ theme: c == null ? void 0 : c.colorSchemePreference,
329
332
  ref: n,
330
333
  onFocus: r,
331
334
  onBlur: i,
332
335
  children: /* @__PURE__ */ s(
333
- ue,
336
+ de,
334
337
  {
335
338
  formattingToolbar: Ve
336
339
  }
@@ -338,10 +341,10 @@ const te = (e, n, t = !1) => {
338
341
  }
339
342
  );
340
343
  }), Ve = () => {
341
- const e = de([]).filter(
344
+ const e = me([]).filter(
342
345
  (n) => n.key !== "nestBlockButton" && n.key !== "unnestBlockButton"
343
346
  );
344
- return /* @__PURE__ */ s(me, { blockTypeSelectItems: [], children: e });
347
+ return /* @__PURE__ */ s(fe, { blockTypeSelectItems: [], children: e });
345
348
  }, Ge = m((e, n) => {
346
349
  const {
347
350
  className: t,
@@ -357,11 +360,11 @@ const te = (e, n, t = !1) => {
357
360
  onChange: p,
358
361
  onSubmit: C,
359
362
  autoComplete: y,
360
- rightSection: k,
363
+ rightSection: P,
361
364
  ...x
362
365
  } = e;
363
366
  return d(x), /* @__PURE__ */ s(
364
- Q,
367
+ X,
365
368
  {
366
369
  size: "xs",
367
370
  className: z(
@@ -375,7 +378,7 @@ const te = (e, n, t = !1) => {
375
378
  value: a,
376
379
  autoFocus: u,
377
380
  "data-autofocus": u ? "true" : void 0,
378
- rightSection: k,
381
+ rightSection: P,
379
382
  placeholder: c,
380
383
  disabled: g,
381
384
  onKeyDown: h,
@@ -385,13 +388,13 @@ const te = (e, n, t = !1) => {
385
388
  }
386
389
  );
387
390
  });
388
- var oe = {
391
+ var re = {
389
392
  color: void 0,
390
393
  size: void 0,
391
394
  className: void 0,
392
395
  style: void 0,
393
396
  attr: void 0
394
- }, H = T.createContext && /* @__PURE__ */ T.createContext(oe), He = ["attr", "size", "title"];
397
+ }, H = T.createContext && /* @__PURE__ */ T.createContext(re), He = ["attr", "size", "title"];
395
398
  function Ke(e, n) {
396
399
  if (e == null) return {};
397
400
  var t = Ue(e, n), o, r;
@@ -460,15 +463,15 @@ function Ze(e, n) {
460
463
  }
461
464
  return (n === "string" ? String : Number)(e);
462
465
  }
463
- function re(e) {
466
+ function se(e) {
464
467
  return e && e.map((n, t) => /* @__PURE__ */ T.createElement(n.tag, O({
465
468
  key: t
466
- }, n.attr), re(n.child)));
469
+ }, n.attr), se(n.child)));
467
470
  }
468
- function se(e) {
471
+ function ie(e) {
469
472
  return (n) => /* @__PURE__ */ T.createElement(Je, F({
470
473
  attr: O({}, e.attr)
471
- }, n), re(e.child));
474
+ }, n), se(e.child));
472
475
  }
473
476
  function Je(e) {
474
477
  var n = (t) => {
@@ -491,15 +494,15 @@ function Je(e) {
491
494
  xmlns: "http://www.w3.org/2000/svg"
492
495
  }), i && /* @__PURE__ */ T.createElement("title", null, i), e.children);
493
496
  };
494
- return H !== void 0 ? /* @__PURE__ */ T.createElement(H.Consumer, null, (t) => n(t)) : n(oe);
497
+ return H !== void 0 ? /* @__PURE__ */ T.createElement(H.Consumer, null, (t) => n(t)) : n(re);
495
498
  }
496
499
  function Qe(e) {
497
- return se({ attr: { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z", clipRule: "evenodd" }, child: [] }] })(e);
500
+ return ie({ attr: { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z", clipRule: "evenodd" }, child: [] }] })(e);
498
501
  }
499
502
  function Xe(e) {
500
- return se({ attr: { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", clipRule: "evenodd" }, child: [] }] })(e);
503
+ return ie({ attr: { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", clipRule: "evenodd" }, child: [] }] })(e);
501
504
  }
502
- const ie = Fe(void 0), Ye = m((e, n) => {
505
+ const ae = Fe(void 0), Ye = m((e, n) => {
503
506
  const {
504
507
  children: t,
505
508
  onOpenChange: o,
@@ -509,7 +512,7 @@ const ie = Fe(void 0), Ye = m((e, n) => {
509
512
  ...l
510
513
  } = e;
511
514
  d(l);
512
- const [a, u] = A(!1), c = P(null), g = P(
515
+ const [a, u] = A(!1), c = k(null), g = k(
513
516
  void 0
514
517
  ), h = E(() => {
515
518
  g.current && clearTimeout(g.current), g.current = setTimeout(() => {
@@ -519,7 +522,7 @@ const ie = Fe(void 0), Ye = m((e, n) => {
519
522
  g.current && clearTimeout(g.current), u(!0);
520
523
  }, []);
521
524
  return /* @__PURE__ */ s(
522
- ie.Provider,
525
+ ae.Provider,
523
526
  {
524
527
  value: {
525
528
  onMenuMouseOver: p,
@@ -583,7 +586,7 @@ const ie = Fe(void 0), Ye = m((e, n) => {
583
586
  className: t,
584
587
  ref: n,
585
588
  leftSection: r,
586
- rightSection: i ? /* @__PURE__ */ s(X, { size: 10 }) : i === !1 ? /* @__PURE__ */ s("div", { className: "bn-tick-space" }) : null,
589
+ rightSection: i ? /* @__PURE__ */ s(Y, { size: 10 }) : i === !1 ? /* @__PURE__ */ s("div", { className: "bn-tick-space" }) : null,
587
590
  onClick: a,
588
591
  ...u,
589
592
  children: o
@@ -606,7 +609,7 @@ const ie = Fe(void 0), Ye = m((e, n) => {
606
609
  ...i
607
610
  } = e;
608
611
  d(i);
609
- const l = Me(ie);
612
+ const l = Me(ae);
610
613
  return /* @__PURE__ */ s(
611
614
  S.Dropdown,
612
615
  {
@@ -729,7 +732,7 @@ const ie = Fe(void 0), Ye = m((e, n) => {
729
732
  }), dt = m((e, n) => {
730
733
  const { className: t, value: o, placeholder: r, onKeyDown: i, onChange: l, ...a } = e;
731
734
  return d(a), /* @__PURE__ */ s(
732
- Q,
735
+ X,
733
736
  {
734
737
  size: "xs",
735
738
  "data-test": "embed-input",
@@ -828,11 +831,11 @@ const ie = Fe(void 0), Ye = m((e, n) => {
828
831
  }), St = m((e, n) => {
829
832
  const { className: t, isSelected: o, onClick: r, item: i, id: l, ...a } = e;
830
833
  d(a);
831
- const u = P(null);
834
+ const u = k(null);
832
835
  return _(() => {
833
836
  if (!u.current || !o)
834
837
  return;
835
- const c = q(
838
+ const c = Z(
836
839
  u.current,
837
840
  document.querySelector(".bn-suggestion-menu, #ai-suggestion-menu")
838
841
  // TODO
@@ -878,7 +881,7 @@ const ie = Fe(void 0), Ye = m((e, n) => {
878
881
  return d(r), /* @__PURE__ */ s(b, { className: t, ref: n, children: o });
879
882
  }), xt = m((e, n) => {
880
883
  const { className: t, ...o } = e;
881
- return d(o), /* @__PURE__ */ s(Y, { className: t, type: "dots", size: 16, ref: n });
884
+ return d(o), /* @__PURE__ */ s(ee, { className: t, type: "dots", size: 16, ref: n });
882
885
  }), Ct = m((e, n) => {
883
886
  const { className: t, children: o, id: r, columns: i, ...l } = e;
884
887
  return d(l), /* @__PURE__ */ s(
@@ -906,11 +909,11 @@ const ie = Fe(void 0), Ye = m((e, n) => {
906
909
  }), Tt = m((e, n) => {
907
910
  const { className: t, isSelected: o, onClick: r, item: i, id: l, ...a } = e;
908
911
  d(a);
909
- const u = P(null);
912
+ const u = k(null);
910
913
  return _(() => {
911
914
  if (!u.current || !o)
912
915
  return;
913
- const c = q(
916
+ const c = Z(
914
917
  u.current,
915
918
  document.querySelector(".bn-grid-suggestion-menu")
916
919
  );
@@ -936,7 +939,7 @@ const ie = Fe(void 0), Ye = m((e, n) => {
936
939
  ...i
937
940
  } = e;
938
941
  return d(i), /* @__PURE__ */ s(
939
- Y,
942
+ ee,
940
943
  {
941
944
  className: t,
942
945
  style: { gridColumn: `1 / ${r + 1}` },
@@ -944,7 +947,7 @@ const ie = Fe(void 0), Ye = m((e, n) => {
944
947
  ref: n
945
948
  }
946
949
  );
947
- }), kt = m((e, n) => {
950
+ }), Pt = m((e, n) => {
948
951
  const { children: t, className: o, onMouseDown: r, onClick: i, ...l } = e;
949
952
  return d(l, !1), /* @__PURE__ */ s(
950
953
  N,
@@ -957,7 +960,7 @@ const ie = Fe(void 0), Ye = m((e, n) => {
957
960
  children: t
958
961
  }
959
962
  );
960
- }), Pt = m((e, n) => {
963
+ }), kt = m((e, n) => {
961
964
  const {
962
965
  className: t,
963
966
  children: o,
@@ -993,9 +996,9 @@ const ie = Fe(void 0), Ye = m((e, n) => {
993
996
  ...a
994
997
  } = e;
995
998
  d(a);
996
- const { ref: u, focused: c } = ee(), g = Re(c), h = R(n, u, g);
999
+ const { ref: u, focused: c } = te(), g = Re(c), h = R(n, u, g);
997
1000
  return /* @__PURE__ */ s(
998
- ke,
1001
+ Pe,
999
1002
  {
1000
1003
  className: t,
1001
1004
  ref: h,
@@ -1040,7 +1043,7 @@ const ie = Fe(void 0), Ye = m((e, n) => {
1040
1043
  {
1041
1044
  onClick: a.onClick,
1042
1045
  leftSection: a.icon,
1043
- rightSection: a.isSelected ? /* @__PURE__ */ s(X, { size: 10, className: "bn-tick-icon" }) : (
1046
+ rightSection: a.isSelected ? /* @__PURE__ */ s(Y, { size: 10, className: "bn-tick-icon" }) : (
1044
1047
  // Ensures space for tick even if item isn't currently selected.
1045
1048
  /* @__PURE__ */ s("div", { className: "bn-tick-space" })
1046
1049
  ),
@@ -1088,8 +1091,8 @@ const ie = Fe(void 0), Ye = m((e, n) => {
1088
1091
  Loader: xt
1089
1092
  },
1090
1093
  TableHandle: {
1091
- Root: Pt,
1092
- ExtendButton: kt
1094
+ Root: kt,
1095
+ ExtendButton: Pt
1093
1096
  },
1094
1097
  Generic: {
1095
1098
  Badge: {
@@ -1131,7 +1134,7 @@ const ie = Fe(void 0), Ye = m((e, n) => {
1131
1134
  // Removes button press effect
1132
1135
  activeClassName: ""
1133
1136
  }, Ot = (e) => {
1134
- const { className: n, theme: t, ...o } = e, r = fe(), i = ge(), l = (r == null ? void 0 : r.colorSchemePreference) || i, a = E(
1137
+ const { className: n, theme: t, ...o } = e, r = q(), i = ge(), l = (r == null ? void 0 : r.colorSchemePreference) || i, a = E(
1135
1138
  (c) => {
1136
1139
  if (c && (Ie(c), typeof t == "object")) {
1137
1140
  if ("light" in t && "dark" in t) {
@@ -1148,7 +1151,7 @@ const ie = Fe(void 0), Ye = m((e, n) => {
1148
1151
  [l, t]
1149
1152
  ), u = typeof t == "string" ? t : l !== "no-preference" ? l : "light";
1150
1153
  return /* @__PURE__ */ s(he.Provider, { value: Mt, children: /* @__PURE__ */ s(
1151
- Pe,
1154
+ ke,
1152
1155
  {
1153
1156
  theme: Ft,
1154
1157
  cssVariablesSelector: ".bn-mantine",
@@ -1206,7 +1209,7 @@ const ie = Fe(void 0), Ye = m((e, n) => {
1206
1209
  shadow: f[2],
1207
1210
  border: f[1],
1208
1211
  sideMenu: f[2],
1209
- highlights: ae
1212
+ highlights: le
1210
1213
  },
1211
1214
  borderRadius: 6,
1212
1215
  fontFamily: '"Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Open Sans", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif'
@@ -1239,7 +1242,7 @@ const ie = Fe(void 0), Ye = m((e, n) => {
1239
1242
  shadow: f[8],
1240
1243
  border: f[7],
1241
1244
  sideMenu: f[4],
1242
- highlights: le
1245
+ highlights: ce
1243
1246
  },
1244
1247
  borderRadius: U.borderRadius,
1245
1248
  fontFamily: U.fontFamily