@blocknote/shadcn 0.41.1 → 0.42.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,18 +1,18 @@
1
- import { jsx as o, jsxs as v, Fragment as O } from "react/jsx-runtime";
1
+ import { jsx as o, jsxs as v, Fragment as U } from "react/jsx-runtime";
2
2
  import { assertEmpty as m, mergeCSSClasses as H } from "@blocknote/core";
3
- import { elementOverflow as P, mergeRefs as _, useFocusWithin as K, useDictionary as Q, useBlockNoteContext as W, FormattingToolbarController as Z, getFormattingToolbarItems as J, FormattingToolbar as X, ComponentsContext as Y, BlockNoteViewRaw as ee } from "@blocknote/react";
4
- import * as R from "react";
5
- import { createContext as te, useContext as ne, forwardRef as p, useMemo as F, useRef as L, useEffect as E, useState as oe } from "react";
3
+ import { elementOverflow as _, mergeRefs as R, useFocusWithin as K, useDictionary as Q, useBlockNoteContext as W, FormattingToolbarController as Z, getFormattingToolbarItems as J, FormattingToolbar as X, ComponentsContext as Y, BlockNoteViewRaw as ee } from "@blocknote/react";
4
+ import * as F from "react";
5
+ import { createContext as te, useContext as ne, forwardRef as p, useMemo as L, useRef as E, useEffect as V, useState as oe } from "react";
6
6
  import { FormProvider as ae, useForm as re } from "react-hook-form";
7
- import * as z from "@radix-ui/react-avatar";
7
+ import * as D from "@radix-ui/react-avatar";
8
8
  import { clsx as se } from "clsx";
9
9
  import { twMerge as ie } from "tailwind-merge";
10
- import { Slot as V } from "@radix-ui/react-slot";
11
- import { cva as D } from "class-variance-authority";
10
+ import { Slot as A } from "@radix-ui/react-slot";
11
+ import { cva as I } from "class-variance-authority";
12
12
  import * as w from "@radix-ui/react-dropdown-menu";
13
- import { ChevronRightIcon as de, CheckIcon as A, ChevronDownIcon as j, ChevronUpIcon as le, ChevronRight as ce } from "lucide-react";
13
+ import { ChevronRightIcon as de, CheckIcon as j, ChevronDownIcon as q, ChevronUpIcon as le, ChevronRight as ce } from "lucide-react";
14
14
  import * as ue from "@radix-ui/react-label";
15
- import * as I from "@radix-ui/react-popover";
15
+ import * as B from "@radix-ui/react-popover";
16
16
  import * as x from "@radix-ui/react-select";
17
17
  import * as T from "@radix-ui/react-tabs";
18
18
  import * as me from "@radix-ui/react-toggle";
@@ -25,7 +25,7 @@ function pe({
25
25
  ...t
26
26
  }) {
27
27
  return /* @__PURE__ */ o(
28
- z.Root,
28
+ D.Root,
29
29
  {
30
30
  "data-slot": "avatar",
31
31
  className: i(
@@ -41,7 +41,7 @@ function ge({
41
41
  ...t
42
42
  }) {
43
43
  return /* @__PURE__ */ o(
44
- z.Image,
44
+ D.Image,
45
45
  {
46
46
  "data-slot": "avatar-image",
47
47
  className: i("aspect-square size-full", e),
@@ -54,7 +54,7 @@ function ve({
54
54
  ...t
55
55
  }) {
56
56
  return /* @__PURE__ */ o(
57
- z.Fallback,
57
+ D.Fallback,
58
58
  {
59
59
  "data-slot": "avatar-fallback",
60
60
  className: i(
@@ -65,7 +65,7 @@ function ve({
65
65
  }
66
66
  );
67
67
  }
68
- const fe = D(
68
+ const fe = I(
69
69
  "inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
70
70
  {
71
71
  variants: {
@@ -88,7 +88,7 @@ function be({
88
88
  ...a
89
89
  }) {
90
90
  return /* @__PURE__ */ o(
91
- n ? V : "span",
91
+ n ? A : "span",
92
92
  {
93
93
  "data-slot": "badge",
94
94
  className: i(fe({ variant: t }), e),
@@ -96,7 +96,7 @@ function be({
96
96
  }
97
97
  );
98
98
  }
99
- const he = D(
99
+ const he = I(
100
100
  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
101
101
  {
102
102
  variants: {
@@ -129,7 +129,7 @@ function xe({
129
129
  ...r
130
130
  }) {
131
131
  return /* @__PURE__ */ o(
132
- a ? V : "button",
132
+ a ? A : "button",
133
133
  {
134
134
  "data-slot": "button",
135
135
  className: i(he({ variant: t, size: n, className: e })),
@@ -231,7 +231,7 @@ function ke({
231
231
  checked: n,
232
232
  ...a,
233
233
  children: [
234
- /* @__PURE__ */ o("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ o(w.ItemIndicator, { children: /* @__PURE__ */ o(A, { className: "size-4" }) }) }),
234
+ /* @__PURE__ */ o("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ o(w.ItemIndicator, { children: /* @__PURE__ */ o(j, { className: "size-4" }) }) }),
235
235
  t
236
236
  ]
237
237
  }
@@ -329,10 +329,10 @@ function Pe({
329
329
  );
330
330
  }
331
331
  const _e = ae;
332
- R.createContext(
332
+ F.createContext(
333
333
  {}
334
334
  );
335
- R.createContext(
335
+ F.createContext(
336
336
  {}
337
337
  );
338
338
  function Re({ className: e, type: t, ...n }) {
@@ -354,12 +354,12 @@ function Re({ className: e, type: t, ...n }) {
354
354
  function Fe({
355
355
  ...e
356
356
  }) {
357
- return /* @__PURE__ */ o(I.Root, { "data-slot": "popover", ...e });
357
+ return /* @__PURE__ */ o(B.Root, { "data-slot": "popover", ...e });
358
358
  }
359
359
  function Le({
360
360
  ...e
361
361
  }) {
362
- return /* @__PURE__ */ o(I.Trigger, { "data-slot": "popover-trigger", ...e });
362
+ return /* @__PURE__ */ o(B.Trigger, { "data-slot": "popover-trigger", ...e });
363
363
  }
364
364
  function Ee({
365
365
  className: e,
@@ -368,7 +368,7 @@ function Ee({
368
368
  ...a
369
369
  }) {
370
370
  return /* @__PURE__ */ o(
371
- I.Content,
371
+ B.Content,
372
372
  {
373
373
  "data-slot": "popover-content",
374
374
  align: t,
@@ -409,7 +409,7 @@ function je({
409
409
  ...a,
410
410
  children: [
411
411
  n,
412
- /* @__PURE__ */ o(x.Icon, { asChild: !0, children: /* @__PURE__ */ o(j, { className: "size-4 opacity-50" }) })
412
+ /* @__PURE__ */ o(x.Icon, { asChild: !0, children: /* @__PURE__ */ o(q, { className: "size-4 opacity-50" }) })
413
413
  ]
414
414
  }
415
415
  );
@@ -443,7 +443,7 @@ function qe({
443
443
  children: t
444
444
  }
445
445
  ),
446
- /* @__PURE__ */ o(Ue, {})
446
+ /* @__PURE__ */ o(Oe, {})
447
447
  ]
448
448
  }
449
449
  );
@@ -463,7 +463,7 @@ function $e({
463
463
  ),
464
464
  ...n,
465
465
  children: [
466
- /* @__PURE__ */ o("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ o(x.ItemIndicator, { children: /* @__PURE__ */ o(A, { className: "size-4" }) }) }),
466
+ /* @__PURE__ */ o("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ o(x.ItemIndicator, { children: /* @__PURE__ */ o(j, { className: "size-4" }) }) }),
467
467
  /* @__PURE__ */ o(x.ItemText, { children: t })
468
468
  ]
469
469
  }
@@ -486,7 +486,7 @@ function Ge({
486
486
  }
487
487
  );
488
488
  }
489
- function Ue({
489
+ function Oe({
490
490
  className: e,
491
491
  ...t
492
492
  }) {
@@ -499,11 +499,11 @@ function Ue({
499
499
  e
500
500
  ),
501
501
  ...t,
502
- children: /* @__PURE__ */ o(j, { className: "size-4" })
502
+ children: /* @__PURE__ */ o(q, { className: "size-4" })
503
503
  }
504
504
  );
505
505
  }
506
- function Oe({ className: e, ...t }) {
506
+ function Ue({ className: e, ...t }) {
507
507
  return /* @__PURE__ */ o(
508
508
  "div",
509
509
  {
@@ -571,7 +571,7 @@ function We({
571
571
  }
572
572
  );
573
573
  }
574
- const Ze = D(
574
+ const Ze = I(
575
575
  "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",
576
576
  {
577
577
  variants: {
@@ -606,7 +606,7 @@ function Je({
606
606
  }
607
607
  );
608
608
  }
609
- function q({
609
+ function $({
610
610
  delayDuration: e = 0,
611
611
  ...t
612
612
  }) {
@@ -622,7 +622,7 @@ function q({
622
622
  function Xe({
623
623
  ...e
624
624
  }) {
625
- return /* @__PURE__ */ o(q, { children: /* @__PURE__ */ o(N.Root, { "data-slot": "tooltip", ...e }) });
625
+ return /* @__PURE__ */ o($, { children: /* @__PURE__ */ o(N.Root, { "data-slot": "tooltip", ...e }) });
626
626
  }
627
627
  function Ye({
628
628
  ...e
@@ -702,7 +702,7 @@ const tt = {
702
702
  SelectValue: Ae
703
703
  },
704
704
  Skeleton: {
705
- Skeleton: Oe
705
+ Skeleton: Ue
706
706
  },
707
707
  Tabs: {
708
708
  Tabs: He,
@@ -716,12 +716,12 @@ const tt = {
716
716
  Tooltip: {
717
717
  Tooltip: Xe,
718
718
  TooltipContent: et,
719
- TooltipProvider: q,
719
+ TooltipProvider: $,
720
720
  TooltipTrigger: Ye
721
721
  }
722
- }, $ = te(void 0);
722
+ }, G = te(void 0);
723
723
  function f() {
724
- return ne($);
724
+ return ne(G);
725
725
  }
726
726
  const nt = (e) => {
727
727
  const { children: t, ...n } = e;
@@ -744,12 +744,12 @@ const nt = (e) => {
744
744
  onChange: h,
745
745
  onSubmit: C,
746
746
  autoComplete: S,
747
- rightSection: G,
747
+ rightSection: y,
748
748
  // TODO: add rightSection
749
- ...U
749
+ ...O
750
750
  } = e;
751
- m(U);
752
- const B = f();
751
+ m(O);
752
+ const P = f();
753
753
  return /* @__PURE__ */ v(
754
754
  "div",
755
755
  {
@@ -761,9 +761,9 @@ const nt = (e) => {
761
761
  children: [
762
762
  d,
763
763
  /* @__PURE__ */ v("div", { className: "flex-1", children: [
764
- r && /* @__PURE__ */ o(B.Label.Label, { htmlFor: r, children: r }),
764
+ r && /* @__PURE__ */ o(P.Label.Label, { htmlFor: r, children: r }),
765
765
  /* @__PURE__ */ o(
766
- B.Input.Input,
766
+ P.Input.Input,
767
767
  {
768
768
  className: i(n, "h-auto border-none p-0"),
769
769
  id: r,
@@ -779,7 +779,7 @@ const nt = (e) => {
779
779
  }
780
780
  )
781
781
  ] }),
782
- G
782
+ y
783
783
  ]
784
784
  }
785
785
  );
@@ -826,7 +826,7 @@ const nt = (e) => {
826
826
  }, st = (e) => {
827
827
  const { children: t, sub: n, ...a } = e;
828
828
  m(a);
829
- const r = f(), s = F(
829
+ const r = f(), s = L(
830
830
  () => at(
831
831
  r.DropdownMenu.DropdownMenuTrigger
832
832
  ),
@@ -856,7 +856,7 @@ const nt = (e) => {
856
856
  const { className: n, children: a, icon: r, checked: s, subTrigger: d, onClick: c, ...u } = e;
857
857
  m(u);
858
858
  const l = f();
859
- return d ? /* @__PURE__ */ v(O, { children: [
859
+ return d ? /* @__PURE__ */ v(U, { children: [
860
860
  r,
861
861
  a
862
862
  ] }) : s !== void 0 ? /* @__PURE__ */ v(
@@ -1025,7 +1025,7 @@ const nt = (e) => {
1025
1025
  sideOffset: 8,
1026
1026
  className: i(
1027
1027
  n,
1028
- "flex flex-col gap-2",
1028
+ "z-[10000] flex flex-col gap-2",
1029
1029
  a === "panel-popover" ? "w-fit max-w-none border-none p-0 shadow-none" : ""
1030
1030
  ),
1031
1031
  ref: t,
@@ -1128,11 +1128,11 @@ const nt = (e) => {
1128
1128
  }), Tt = p((e, t) => {
1129
1129
  const n = f(), { className: a, item: r, isSelected: s, onClick: d, id: c, ...u } = e;
1130
1130
  m(u);
1131
- const l = L(null);
1132
- return E(() => {
1131
+ const l = E(null);
1132
+ return V(() => {
1133
1133
  if (!l.current || !s)
1134
1134
  return;
1135
- const g = P(
1135
+ const g = _(
1136
1136
  l.current,
1137
1137
  document.querySelector(".bn-suggestion-menu, #ai-suggestion-menu")
1138
1138
  // TODO
@@ -1149,7 +1149,7 @@ const nt = (e) => {
1149
1149
  a
1150
1150
  ),
1151
1151
  "data-highlighted": !0,
1152
- ref: _([t, l]),
1152
+ ref: R([t, l]),
1153
1153
  id: c,
1154
1154
  onMouseDown: (g) => g.preventDefault(),
1155
1155
  onClick: d,
@@ -1271,7 +1271,7 @@ const nt = (e) => {
1271
1271
  children: a
1272
1272
  }
1273
1273
  );
1274
- }), y = p(
1274
+ }), k = p(
1275
1275
  (e, t) => {
1276
1276
  const {
1277
1277
  className: n,
@@ -1298,7 +1298,7 @@ const nt = (e) => {
1298
1298
  }
1299
1299
  ) });
1300
1300
  }
1301
- ), k = p(
1301
+ ), M = p(
1302
1302
  (e, t) => {
1303
1303
  const {
1304
1304
  className: n,
@@ -1370,7 +1370,7 @@ const nt = (e) => {
1370
1370
  )
1371
1371
  ] });
1372
1372
  }
1373
- ), M = p((e, t) => {
1373
+ ), z = p((e, t) => {
1374
1374
  const { className: n, items: a, isDisabled: r, ...s } = e;
1375
1375
  m(s);
1376
1376
  const d = f(), c = (l) => /* @__PURE__ */ v("div", { className: "flex items-center gap-1", children: [
@@ -1506,22 +1506,24 @@ const nt = (e) => {
1506
1506
  timeString: s,
1507
1507
  actions: d,
1508
1508
  edited: c,
1509
- children: u,
1510
- ...l
1509
+ emojiPickerOpen: u,
1510
+ // Unused
1511
+ children: l,
1512
+ ...g
1511
1513
  } = e;
1512
- m(l);
1513
- const [g, b] = oe(!1), { focused: h, ref: C } = K(), S = d && (a === !0 || a === void 0 || a === "hover" && g || h);
1514
+ m(g);
1515
+ const [b, h] = oe(!1), { focused: C, ref: S } = K(), y = d && (a === !0 || a === void 0 || a === "hover" && b || C);
1514
1516
  return /* @__PURE__ */ v(
1515
1517
  "div",
1516
1518
  {
1517
1519
  ref: t,
1518
1520
  className: i(n, "relative flex flex-col gap-2"),
1519
- onMouseEnter: () => b(!0),
1520
- onMouseLeave: () => b(!1),
1521
+ onMouseEnter: () => h(!0),
1522
+ onMouseLeave: () => h(!1),
1521
1523
  children: [
1522
- S ? /* @__PURE__ */ o("div", { className: "absolute right-0 top-0 z-10", ref: C, children: d }) : null,
1524
+ y ? /* @__PURE__ */ o("div", { className: "absolute right-0 top-0 z-10", ref: S, children: d }) : null,
1523
1525
  /* @__PURE__ */ o(Pt, { ...e }),
1524
- u
1526
+ l
1525
1527
  ]
1526
1528
  }
1527
1529
  );
@@ -1647,11 +1649,11 @@ const nt = (e) => {
1647
1649
  }), jt = p((e, t) => {
1648
1650
  const { className: n, isSelected: a, onClick: r, item: s, id: d, ...c } = e;
1649
1651
  m(c);
1650
- const u = L(null);
1651
- return E(() => {
1652
+ const u = E(null);
1653
+ return V(() => {
1652
1654
  if (!u.current || !a)
1653
1655
  return;
1654
- const l = P(
1656
+ const l = _(
1655
1657
  u.current,
1656
1658
  document.querySelector(".bn-grid-suggestion-menu")
1657
1659
  );
@@ -1666,7 +1668,7 @@ const nt = (e) => {
1666
1668
  "text-lg!",
1667
1669
  n
1668
1670
  ),
1669
- ref: _([t, u]),
1671
+ ref: R([t, u]),
1670
1672
  id: d,
1671
1673
  role: "option",
1672
1674
  onClick: r,
@@ -1693,9 +1695,9 @@ const nt = (e) => {
1693
1695
  );
1694
1696
  }), $t = {
1695
1697
  FormattingToolbar: {
1696
- Root: y,
1697
- Button: k,
1698
- Select: M
1698
+ Root: k,
1699
+ Button: M,
1700
+ Select: z
1699
1701
  },
1700
1702
  FilePanel: {
1701
1703
  Root: mt,
@@ -1705,9 +1707,9 @@ const nt = (e) => {
1705
1707
  TextInput: gt
1706
1708
  },
1707
1709
  LinkToolbar: {
1708
- Root: y,
1709
- Button: k,
1710
- Select: M
1710
+ Root: k,
1711
+ Button: M,
1712
+ Select: z
1711
1713
  },
1712
1714
  SideMenu: {
1713
1715
  Root: ht,
@@ -1743,9 +1745,9 @@ const nt = (e) => {
1743
1745
  Group: Et
1744
1746
  },
1745
1747
  Toolbar: {
1746
- Root: y,
1747
- Button: k,
1748
- Select: M
1748
+ Root: k,
1749
+ Button: M,
1750
+ Select: z
1749
1751
  },
1750
1752
  Form: {
1751
1753
  Root: nt,
@@ -1767,11 +1769,11 @@ const nt = (e) => {
1767
1769
  }
1768
1770
  }
1769
1771
  }, Gt = (e) => {
1770
- const { className: t, shadCNComponents: n, ...a } = e, r = F(() => ({
1772
+ const { className: t, shadCNComponents: n, ...a } = e, r = L(() => ({
1771
1773
  ...tt,
1772
1774
  ...n
1773
1775
  }), [n]);
1774
- return /* @__PURE__ */ o($.Provider, { value: r, children: /* @__PURE__ */ o(Y.Provider, { value: $t, children: /* @__PURE__ */ o(
1776
+ return /* @__PURE__ */ o(G.Provider, { value: r, children: /* @__PURE__ */ o(Y.Provider, { value: $t, children: /* @__PURE__ */ o(
1775
1777
  ee,
1776
1778
  {
1777
1779
  className: H("bn-shadcn", t || ""),
@@ -1781,7 +1783,7 @@ const nt = (e) => {
1781
1783
  };
1782
1784
  export {
1783
1785
  Gt as BlockNoteView,
1784
- $ as ShadCNComponentsContext,
1786
+ G as ShadCNComponentsContext,
1785
1787
  tt as ShadCNDefaultComponents,
1786
1788
  $t as components,
1787
1789
  f as useShadCNComponentsContext