@blocknote/mantine 0.23.6 → 0.24.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,9 +1,9 @@
1
1
  import { jsx as i, jsxs as S } from "react/jsx-runtime";
2
- import { assertEmpty as d, isSafari as M, COLORS_DEFAULT as q, COLORS_DARK_MODE_DEFAULT as Z, mergeCSSClasses as J } from "@blocknote/core";
2
+ import { assertEmpty as d, isSafari as O, mergeCSSClasses as q, COLORS_DEFAULT as Z, COLORS_DARK_MODE_DEFAULT as J } from "@blocknote/core";
3
3
  import { elementOverflow as z, useBlockNoteContext as Q, usePrefersColorScheme as X, ComponentsContext as Y, BlockNoteViewRaw as ee } from "@blocknote/react";
4
- import { TextInput as B, Menu as b, CheckIcon as _, Group as p, Tabs as w, LoadingOverlay as te, Button as x, FileInput as ne, Popover as oe, PopoverTarget as re, PopoverDropdown as se, ActionIcon as $, Loader as V, Stack as O, Text as N, Badge as ie, Tooltip as ae, MantineProvider as le } from "@mantine/core";
5
- import y, { forwardRef as g, createContext as ce, useState as ue, useRef as C, useCallback as F, useContext as de, useEffect as A } from "react";
6
- import { mergeRefs as T, useFocusWithin as me, useFocusTrap as ge } from "@mantine/hooks";
4
+ import { TextInput as B, Menu as b, CheckIcon as _, Group as p, Tabs as w, LoadingOverlay as te, Button as x, FileInput as ne, Popover as oe, PopoverTarget as re, PopoverDropdown as se, ActionIcon as $, Loader as V, Stack as R, Text as N, Badge as ie, Tooltip as ae, MantineProvider as le } from "@mantine/core";
5
+ import y, { forwardRef as g, createContext as ce, useState as ue, useRef as C, useCallback as D, useContext as de, useEffect as A } from "react";
6
+ import { mergeRefs as P, useFocusWithin as me, useFocusTrap as ge } from "@mantine/hooks";
7
7
  const G = (e, n, t = !1) => {
8
8
  const o = [];
9
9
  function r(s, l = "--bn") {
@@ -13,7 +13,7 @@ const G = (e, n, t = !1) => {
13
13
  }
14
14
  }
15
15
  return r(e), o;
16
- }, D = (e, n) => G(e, n), fe = {
16
+ }, I = (e, n) => G(e, n), fe = {
17
17
  colors: {
18
18
  editor: {
19
19
  text: void 0,
@@ -122,7 +122,7 @@ var H = {
122
122
  className: void 0,
123
123
  style: void 0,
124
124
  attr: void 0
125
- }, R = y.createContext && /* @__PURE__ */ y.createContext(H), ve = ["attr", "size", "title"];
125
+ }, L = y.createContext && /* @__PURE__ */ y.createContext(H), ve = ["attr", "size", "title"];
126
126
  function he(e, n) {
127
127
  if (e == null) return {};
128
128
  var t = ye(e, n), o, r;
@@ -153,7 +153,7 @@ function k() {
153
153
  return e;
154
154
  }, k.apply(this, arguments);
155
155
  }
156
- function I(e, n) {
156
+ function E(e, n) {
157
157
  var t = Object.keys(e);
158
158
  if (Object.getOwnPropertySymbols) {
159
159
  var o = Object.getOwnPropertySymbols(e);
@@ -163,12 +163,12 @@ function I(e, n) {
163
163
  }
164
164
  return t;
165
165
  }
166
- function P(e) {
166
+ function T(e) {
167
167
  for (var n = 1; n < arguments.length; n++) {
168
168
  var t = arguments[n] != null ? arguments[n] : {};
169
- n % 2 ? I(Object(t), !0).forEach(function(o) {
169
+ n % 2 ? E(Object(t), !0).forEach(function(o) {
170
170
  Se(e, o, t[o]);
171
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : I(Object(t)).forEach(function(o) {
171
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : E(Object(t)).forEach(function(o) {
172
172
  Object.defineProperty(e, o, Object.getOwnPropertyDescriptor(t, o));
173
173
  });
174
174
  }
@@ -192,13 +192,13 @@ function we(e, n) {
192
192
  return (n === "string" ? String : Number)(e);
193
193
  }
194
194
  function K(e) {
195
- return e && e.map((n, t) => /* @__PURE__ */ y.createElement(n.tag, P({
195
+ return e && e.map((n, t) => /* @__PURE__ */ y.createElement(n.tag, T({
196
196
  key: t
197
197
  }, n.attr), K(n.child)));
198
198
  }
199
199
  function U(e) {
200
200
  return (n) => /* @__PURE__ */ y.createElement(Ne, k({
201
- attr: P({}, e.attr)
201
+ attr: T({}, e.attr)
202
202
  }, n), K(e.child));
203
203
  }
204
204
  function Ne(e) {
@@ -214,7 +214,7 @@ function Ne(e) {
214
214
  strokeWidth: "0"
215
215
  }, t.attr, o, l, {
216
216
  className: c,
217
- style: P(P({
217
+ style: T(T({
218
218
  color: e.color || t.color
219
219
  }, t.style), e.style),
220
220
  height: a,
@@ -222,7 +222,7 @@ function Ne(e) {
222
222
  xmlns: "http://www.w3.org/2000/svg"
223
223
  }), s && /* @__PURE__ */ y.createElement("title", null, s), e.children);
224
224
  };
225
- return R !== void 0 ? /* @__PURE__ */ y.createElement(R.Consumer, null, (t) => n(t)) : n(H);
225
+ return L !== void 0 ? /* @__PURE__ */ y.createElement(L.Consumer, null, (t) => n(t)) : n(H);
226
226
  }
227
227
  function Ce(e) {
228
228
  return U({ tag: "svg", 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);
@@ -230,7 +230,7 @@ function Ce(e) {
230
230
  function ke(e) {
231
231
  return U({ tag: "svg", 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);
232
232
  }
233
- const W = ce(void 0), Pe = g((e, n) => {
233
+ const W = ce(void 0), Te = g((e, n) => {
234
234
  const {
235
235
  children: t,
236
236
  onOpenChange: o,
@@ -240,11 +240,11 @@ const W = ce(void 0), Pe = g((e, n) => {
240
240
  ...l
241
241
  } = e;
242
242
  d(l);
243
- const [a, c] = ue(!1), u = C(null), f = C(), v = F(() => {
243
+ const [a, c] = ue(!1), u = C(null), f = C(), v = D(() => {
244
244
  f.current && clearTimeout(f.current), f.current = setTimeout(() => {
245
245
  c(!1);
246
246
  }, 250);
247
- }, []), h = F(() => {
247
+ }, []), h = D(() => {
248
248
  f.current && clearTimeout(f.current), c(!0);
249
249
  }, []);
250
250
  return /* @__PURE__ */ i(
@@ -258,7 +258,7 @@ const W = ce(void 0), Pe = g((e, n) => {
258
258
  b.Item,
259
259
  {
260
260
  className: "bn-menu-item bn-mt-sub-menu-item",
261
- ref: T(n, u),
261
+ ref: P(n, u),
262
262
  onMouseOver: h,
263
263
  onMouseLeave: v,
264
264
  children: /* @__PURE__ */ i(
@@ -280,9 +280,9 @@ const W = ce(void 0), Pe = g((e, n) => {
280
280
  )
281
281
  }
282
282
  );
283
- }), Te = (e) => {
283
+ }), Pe = (e) => {
284
284
  const { children: n, onOpenChange: t, position: o, sub: r, ...s } = e;
285
- return d(s), r ? /* @__PURE__ */ i(Pe, { ...e }) : /* @__PURE__ */ i(
285
+ return d(s), r ? /* @__PURE__ */ i(Te, { ...e }) : /* @__PURE__ */ i(
286
286
  b,
287
287
  {
288
288
  withinPortal: !1,
@@ -540,7 +540,7 @@ const W = ce(void 0), Pe = g((e, n) => {
540
540
  "div",
541
541
  {
542
542
  className: t,
543
- ref: T(n, c),
543
+ ref: P(n, c),
544
544
  id: l,
545
545
  role: "option",
546
546
  onClick: r,
@@ -568,7 +568,7 @@ const W = ce(void 0), Pe = g((e, n) => {
568
568
  }), We = g((e, n) => {
569
569
  const { className: t, children: o, id: r, ...s } = e;
570
570
  return d(s), /* @__PURE__ */ i(
571
- O,
571
+ R,
572
572
  {
573
573
  gap: 0,
574
574
  className: t,
@@ -598,7 +598,7 @@ const W = ce(void 0), Pe = g((e, n) => {
598
598
  {
599
599
  gap: 0,
600
600
  className: t,
601
- ref: T(n, c),
601
+ ref: P(n, c),
602
602
  id: l,
603
603
  role: "option",
604
604
  onClick: r,
@@ -612,7 +612,7 @@ const W = ce(void 0), Pe = g((e, n) => {
612
612
  children: s.icon
613
613
  }
614
614
  ),
615
- /* @__PURE__ */ S(O, { gap: 0, className: "bn-mt-suggestion-menu-item-body", children: [
615
+ /* @__PURE__ */ S(R, { gap: 0, className: "bn-mt-suggestion-menu-item-body", children: [
616
616
  /* @__PURE__ */ i(N, { className: "bn-mt-suggestion-menu-item-title", children: s.title }),
617
617
  /* @__PURE__ */ i(N, { className: "bn-mt-suggestion-menu-item-subtitle", children: s.subtext })
618
618
  ] }),
@@ -676,11 +676,11 @@ const W = ce(void 0), Pe = g((e, n) => {
676
676
  children: o
677
677
  }
678
678
  );
679
- }), L = g(
679
+ }), M = g(
680
680
  (e, n) => {
681
681
  const { className: t, children: o, onMouseEnter: r, onMouseLeave: s, ...l } = e;
682
682
  d(l);
683
- const { ref: a, focused: c } = me(), u = ge(c), f = T(n, a, u);
683
+ const { ref: a, focused: c } = me(), u = ge(c), f = P(n, a, u);
684
684
  return /* @__PURE__ */ i(
685
685
  p,
686
686
  {
@@ -693,10 +693,10 @@ const W = ce(void 0), Pe = g((e, n) => {
693
693
  }
694
694
  );
695
695
  }
696
- ), et = (e) => /* @__PURE__ */ S(O, { gap: 0, className: "bn-tooltip", children: [
696
+ ), et = (e) => /* @__PURE__ */ S(R, { gap: 0, className: "bn-tooltip", children: [
697
697
  /* @__PURE__ */ i(N, { size: "sm", children: e.mainTooltip }),
698
698
  e.secondaryTooltip && /* @__PURE__ */ i(N, { size: "xs", children: e.secondaryTooltip })
699
- ] }), E = g(
699
+ ] }), F = g(
700
700
  (e, n) => {
701
701
  const {
702
702
  className: t,
@@ -727,7 +727,7 @@ const W = ce(void 0), Pe = g((e, n) => {
727
727
  "aria-label": f,
728
728
  className: t,
729
729
  onMouseDown: (h) => {
730
- M() && h.currentTarget.focus();
730
+ O() && h.currentTarget.focus();
731
731
  },
732
732
  onClick: u,
733
733
  "aria-pressed": a,
@@ -745,7 +745,7 @@ const W = ce(void 0), Pe = g((e, n) => {
745
745
  className: t,
746
746
  "aria-label": f,
747
747
  onMouseDown: (h) => {
748
- M() && h.currentTarget.focus();
748
+ O() && h.currentTarget.focus();
749
749
  },
750
750
  onClick: u,
751
751
  "aria-pressed": a,
@@ -779,7 +779,7 @@ const W = ce(void 0), Pe = g((e, n) => {
779
779
  x,
780
780
  {
781
781
  onMouseDown: (a) => {
782
- M() && a.currentTarget.focus();
782
+ O() && a.currentTarget.focus();
783
783
  },
784
784
  leftSection: l.icon,
785
785
  rightSection: /* @__PURE__ */ i(Ce, {}),
@@ -806,87 +806,10 @@ const W = ce(void 0), Pe = g((e, n) => {
806
806
  ]
807
807
  }
808
808
  ) : null;
809
- }), m = [
810
- "#FFFFFF",
811
- "#EFEFEF",
812
- "#CFCFCF",
813
- "#AFAFAF",
814
- "#7F7F7F",
815
- "#3F3F3F",
816
- "#1F1F1F",
817
- "#161616",
818
- "#0F0F0F",
819
- "#000000"
820
- ], j = {
821
- colors: {
822
- editor: {
823
- text: m[5],
824
- background: m[0]
825
- },
826
- menu: {
827
- text: m[5],
828
- background: m[0]
829
- },
830
- tooltip: {
831
- text: m[5],
832
- background: m[1]
833
- },
834
- hovered: {
835
- text: m[5],
836
- background: m[1]
837
- },
838
- selected: {
839
- text: m[0],
840
- background: m[5]
841
- },
842
- disabled: {
843
- text: m[3],
844
- background: m[1]
845
- },
846
- shadow: m[2],
847
- border: m[1],
848
- sideMenu: m[2],
849
- highlights: q
850
- },
851
- borderRadius: 6,
852
- fontFamily: '"Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Open Sans", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif'
853
- }, ut = {
854
- colors: {
855
- editor: {
856
- text: m[2],
857
- background: m[6]
858
- },
859
- menu: {
860
- text: m[2],
861
- background: m[6]
862
- },
863
- tooltip: {
864
- text: m[2],
865
- background: m[7]
866
- },
867
- hovered: {
868
- text: m[2],
869
- background: m[7]
870
- },
871
- selected: {
872
- text: m[2],
873
- background: m[8]
874
- },
875
- disabled: {
876
- text: m[5],
877
- background: m[7]
878
- },
879
- shadow: m[8],
880
- border: m[7],
881
- sideMenu: m[4],
882
- highlights: Z
883
- },
884
- borderRadius: j.borderRadius,
885
- fontFamily: j.fontFamily
886
- }, nt = {
809
+ }), nt = {
887
810
  FormattingToolbar: {
888
- Root: L,
889
- Button: E,
811
+ Root: M,
812
+ Button: F,
890
813
  Select: tt
891
814
  },
892
815
  FilePanel: {
@@ -903,8 +826,8 @@ const W = ce(void 0), Pe = g((e, n) => {
903
826
  Loader: Ue
904
827
  },
905
828
  LinkToolbar: {
906
- Root: L,
907
- Button: E
829
+ Root: M,
830
+ Button: F
908
831
  },
909
832
  SideMenu: {
910
833
  Root: Ve,
@@ -922,12 +845,16 @@ const W = ce(void 0), Pe = g((e, n) => {
922
845
  ExtendButton: Xe
923
846
  },
924
847
  Generic: {
848
+ Toolbar: {
849
+ Root: M,
850
+ Button: F
851
+ },
925
852
  Form: {
926
853
  Root: (e) => /* @__PURE__ */ i("div", { children: e.children }),
927
854
  TextInput: pe
928
855
  },
929
856
  Menu: {
930
- Root: Te,
857
+ Root: Pe,
931
858
  Trigger: Fe,
932
859
  Dropdown: Oe,
933
860
  Divider: De,
@@ -943,18 +870,18 @@ const W = ce(void 0), Pe = g((e, n) => {
943
870
  }, ot = {
944
871
  // Removes button press effect
945
872
  activeClassName: ""
946
- }, dt = (e) => {
947
- const { className: n, theme: t, ...o } = e, r = Q(), s = X(), l = (r == null ? void 0 : r.colorSchemePreference) || s, a = F(
873
+ }, ut = (e) => {
874
+ const { className: n, theme: t, ...o } = e, r = Q(), s = X(), l = (r == null ? void 0 : r.colorSchemePreference) || s, a = D(
948
875
  (c) => {
949
876
  if (c && (be(c), typeof t == "object")) {
950
877
  if ("light" in t && "dark" in t) {
951
- D(
878
+ I(
952
879
  t[l === "dark" ? "dark" : "light"],
953
880
  c
954
881
  );
955
882
  return;
956
883
  }
957
- D(t, c);
884
+ I(t, c);
958
885
  return;
959
886
  }
960
887
  },
@@ -970,7 +897,7 @@ const W = ce(void 0), Pe = g((e, n) => {
970
897
  children: /* @__PURE__ */ i(
971
898
  ee,
972
899
  {
973
- className: J("bn-mantine", n || ""),
900
+ className: q("bn-mantine", n || ""),
974
901
  theme: typeof t == "object" ? void 0 : t,
975
902
  ...o,
976
903
  ref: a
@@ -978,12 +905,89 @@ const W = ce(void 0), Pe = g((e, n) => {
978
905
  )
979
906
  }
980
907
  ) });
908
+ }, m = [
909
+ "#FFFFFF",
910
+ "#EFEFEF",
911
+ "#CFCFCF",
912
+ "#AFAFAF",
913
+ "#7F7F7F",
914
+ "#3F3F3F",
915
+ "#1F1F1F",
916
+ "#161616",
917
+ "#0F0F0F",
918
+ "#000000"
919
+ ], j = {
920
+ colors: {
921
+ editor: {
922
+ text: m[5],
923
+ background: m[0]
924
+ },
925
+ menu: {
926
+ text: m[5],
927
+ background: m[0]
928
+ },
929
+ tooltip: {
930
+ text: m[5],
931
+ background: m[1]
932
+ },
933
+ hovered: {
934
+ text: m[5],
935
+ background: m[1]
936
+ },
937
+ selected: {
938
+ text: m[0],
939
+ background: m[5]
940
+ },
941
+ disabled: {
942
+ text: m[3],
943
+ background: m[1]
944
+ },
945
+ shadow: m[2],
946
+ border: m[1],
947
+ sideMenu: m[2],
948
+ highlights: Z
949
+ },
950
+ borderRadius: 6,
951
+ fontFamily: '"Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Open Sans", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif'
952
+ }, dt = {
953
+ colors: {
954
+ editor: {
955
+ text: m[2],
956
+ background: m[6]
957
+ },
958
+ menu: {
959
+ text: m[2],
960
+ background: m[6]
961
+ },
962
+ tooltip: {
963
+ text: m[2],
964
+ background: m[7]
965
+ },
966
+ hovered: {
967
+ text: m[2],
968
+ background: m[7]
969
+ },
970
+ selected: {
971
+ text: m[2],
972
+ background: m[8]
973
+ },
974
+ disabled: {
975
+ text: m[5],
976
+ background: m[7]
977
+ },
978
+ shadow: m[8],
979
+ border: m[7],
980
+ sideMenu: m[4],
981
+ highlights: J
982
+ },
983
+ borderRadius: j.borderRadius,
984
+ fontFamily: j.fontFamily
981
985
  };
982
986
  export {
983
- dt as BlockNoteView,
984
- D as applyBlockNoteCSSVariablesFromTheme,
987
+ ut as BlockNoteView,
988
+ I as applyBlockNoteCSSVariablesFromTheme,
985
989
  nt as components,
986
- ut as darkDefaultTheme,
990
+ dt as darkDefaultTheme,
987
991
  m as defaultColorScheme,
988
992
  j as lightDefaultTheme,
989
993
  be as removeBlockNoteCSSVariables