@blocknote/shadcn 0.36.1 → 0.38.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.
Files changed (66) hide show
  1. package/dist/blocknote-shadcn.cjs +1 -1
  2. package/dist/blocknote-shadcn.cjs.map +1 -1
  3. package/dist/blocknote-shadcn.js +1237 -1187
  4. package/dist/blocknote-shadcn.js.map +1 -1
  5. package/dist/style.css +1 -1
  6. package/dist/webpack-stats.json +1 -1
  7. package/package.json +17 -19
  8. package/src/BlockNoteView.tsx +2 -0
  9. package/src/badge/Badge.tsx +3 -6
  10. package/src/comments/Card.tsx +7 -9
  11. package/src/comments/Comment.tsx +10 -27
  12. package/src/components/ui/avatar.tsx +44 -39
  13. package/src/components/ui/badge.tsx +22 -12
  14. package/src/components/ui/button.tsx +33 -32
  15. package/src/components/ui/card.tsx +78 -72
  16. package/src/components/ui/dropdown-menu.tsx +230 -176
  17. package/src/components/ui/form.tsx +40 -51
  18. package/src/components/ui/input.tsx +16 -20
  19. package/src/components/ui/label.tsx +19 -19
  20. package/src/components/ui/popover.tsx +40 -23
  21. package/src/components/ui/select.tsx +153 -133
  22. package/src/components/ui/skeleton.tsx +3 -5
  23. package/src/components/ui/tabs.tsx +59 -46
  24. package/src/components/ui/toggle.tsx +23 -21
  25. package/src/components/ui/tooltip.tsx +50 -21
  26. package/src/components.ts +0 -1
  27. package/src/form/TextInput.tsx +4 -4
  28. package/src/index.tsx +1 -2
  29. package/src/lib/utils.ts +2 -8
  30. package/src/menu/Button.tsx +1 -1
  31. package/src/menu/Menu.tsx +2 -2
  32. package/src/panel/Panel.tsx +2 -2
  33. package/src/panel/PanelTab.tsx +1 -1
  34. package/src/panel/PanelTextInput.tsx +1 -1
  35. package/src/popover/popover.tsx +2 -2
  36. package/src/sideMenu/SideMenuButton.tsx +1 -1
  37. package/src/style.css +6 -127
  38. package/src/suggestionMenu/SuggestionMenu.tsx +1 -1
  39. package/src/suggestionMenu/SuggestionMenuEmptyItem.tsx +3 -1
  40. package/src/suggestionMenu/SuggestionMenuItem.tsx +13 -10
  41. package/src/suggestionMenu/SuggestionMenuLabel.tsx +4 -1
  42. package/src/suggestionMenu/SuggestionMenuLoader.tsx +3 -2
  43. package/src/suggestionMenu/gridSuggestionMenu/GridSuggestionMenu.tsx +8 -1
  44. package/src/suggestionMenu/gridSuggestionMenu/GridSuggestionMenuItem.tsx +10 -1
  45. package/src/tableHandle/ExtendButton.tsx +6 -6
  46. package/src/tableHandle/TableHandle.tsx +1 -1
  47. package/src/toolbar/Toolbar.tsx +7 -9
  48. package/types/src/BlockNoteView.d.ts +1 -0
  49. package/types/src/ShadCNComponentsContext.d.ts +116 -132
  50. package/types/src/components/ui/avatar.d.ts +3 -3
  51. package/types/src/components/ui/badge.d.ts +5 -5
  52. package/types/src/components/ui/button.d.ts +4 -5
  53. package/types/src/components/ui/card.d.ts +8 -7
  54. package/types/src/components/ui/dropdown-menu.d.ts +21 -23
  55. package/types/src/components/ui/form.d.ts +10 -9
  56. package/types/src/components/ui/input.d.ts +1 -3
  57. package/types/src/components/ui/label.d.ts +2 -3
  58. package/types/src/components/ui/popover.d.ts +6 -5
  59. package/types/src/components/ui/select.d.ts +13 -11
  60. package/types/src/components/ui/skeleton.d.ts +1 -1
  61. package/types/src/components/ui/tabs.d.ts +6 -6
  62. package/types/src/components/ui/toggle.d.ts +3 -6
  63. package/types/src/components/ui/tooltip.d.ts +6 -6
  64. package/types/src/components.d.ts +0 -1
  65. package/types/src/index.d.ts +1 -1
  66. package/src/tailwindStyles.css +0 -421
@@ -1,28 +1,57 @@
1
- import * as TooltipPrimitive from "@radix-ui/react-tooltip";
2
1
  import * as React from "react";
2
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
3
3
 
4
- import { cn } from "../../lib/utils.js";
4
+ import { cn } from "../../lib/utils";
5
5
 
6
- const TooltipProvider = TooltipPrimitive.Provider;
6
+ function TooltipProvider({
7
+ delayDuration = 0,
8
+ ...props
9
+ }: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
10
+ return (
11
+ <TooltipPrimitive.Provider
12
+ data-slot="tooltip-provider"
13
+ delayDuration={delayDuration}
14
+ {...props}
15
+ />
16
+ );
17
+ }
7
18
 
8
- const Tooltip = TooltipPrimitive.Root;
19
+ function Tooltip({
20
+ ...props
21
+ }: React.ComponentProps<typeof TooltipPrimitive.Root>) {
22
+ return (
23
+ <TooltipProvider>
24
+ <TooltipPrimitive.Root data-slot="tooltip" {...props} />
25
+ </TooltipProvider>
26
+ );
27
+ }
9
28
 
10
- const TooltipTrigger = TooltipPrimitive.Trigger;
29
+ function TooltipTrigger({
30
+ ...props
31
+ }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
32
+ return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
33
+ }
11
34
 
12
- const TooltipContent = React.forwardRef<
13
- React.ElementRef<typeof TooltipPrimitive.Content>,
14
- React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
15
- >(({ className, sideOffset = 4, ...props }, ref) => (
16
- <TooltipPrimitive.Content
17
- ref={ref}
18
- sideOffset={sideOffset}
19
- className={cn(
20
- "bn-z-50 bn-overflow-hidden bn-rounded-md bn-border bn-bg-popover bn-px-3 bn-py-1.5 bn-text-sm bn-text-popover-foreground bn-shadow-md bn-animate-in bn-fade-in-0 bn-zoom-in-95 data-[state=closed]:bn-animate-out data-[state=closed]:bn-fade-out-0 data-[state=closed]:bn-zoom-out-95 data-[side=bottom]:bn-slide-in-from-top-2 data-[side=left]:bn-slide-in-from-right-2 data-[side=right]:bn-slide-in-from-left-2 data-[side=top]:bn-slide-in-from-bottom-2",
21
- className,
22
- )}
23
- {...props}
24
- />
25
- ));
26
- TooltipContent.displayName = TooltipPrimitive.Content.displayName;
35
+ function TooltipContent({
36
+ className,
37
+ sideOffset = 0,
38
+ children,
39
+ ...props
40
+ }: React.ComponentProps<typeof TooltipPrimitive.Content>) {
41
+ return (
42
+ <TooltipPrimitive.Content
43
+ data-slot="tooltip-content"
44
+ sideOffset={sideOffset}
45
+ className={cn(
46
+ "bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-tooltip-content-transform-origin) z-50 w-fit text-balance rounded-md px-3 py-1.5 text-xs",
47
+ className,
48
+ )}
49
+ {...props}
50
+ >
51
+ {children}
52
+ <TooltipPrimitive.Arrow className="bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
53
+ </TooltipPrimitive.Content>
54
+ );
55
+ }
27
56
 
28
- export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
57
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
package/src/components.ts CHANGED
@@ -34,7 +34,6 @@ import { Badge, BadgeGroup } from "./badge/Badge.js";
34
34
 
35
35
  import { PanelButton } from "./panel/PanelButton.js";
36
36
  import { PanelFileInput } from "./panel/PanelFileInput.js";
37
- import "./style.css";
38
37
  import { GridSuggestionMenuItem } from "./suggestionMenu/gridSuggestionMenu/GridSuggestionMenuItem.js";
39
38
  import { GridSuggestionMenuLoader } from "./suggestionMenu/gridSuggestionMenu/GridSuggestionMenuLoader.js";
40
39
 
@@ -35,19 +35,19 @@ export const TextInput = forwardRef<
35
35
  <div
36
36
  className={cn(
37
37
  className,
38
- "bn-flex bn-h-10 bn-w-full bn-rounded-md bn-border bn-border-input bn-bg-background bn-px-3 bn-py-2 bn-text-sm bn-ring-offset-background file:bn-border-0 file:bn-bg-transparent file:bn-text-sm file:bn-font-medium placeholder:bn-text-muted-foreground focus-visible:bn-outline-none focus-visible:bn-ring-2 focus-visible:bn-ring-ring focus-visible:bn-ring-offset-2 disabled:bn-cursor-not-allowed disabled:bn-opacity-50",
39
- "bn-items-center bn-gap-2 bn-text-foreground",
38
+ "border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
39
+ "text-foreground items-center gap-2",
40
40
  )}
41
41
  >
42
42
  {icon}
43
- <div className="bn-flex-1">
43
+ <div className="flex-1">
44
44
  {label && (
45
45
  <ShadCNComponents.Label.Label htmlFor={label}>
46
46
  {label}
47
47
  </ShadCNComponents.Label.Label>
48
48
  )}
49
49
  <ShadCNComponents.Input.Input
50
- className={cn(className, "bn-border-none bn-p-0 bn-h-auto")}
50
+ className={cn(className, "h-auto border-none p-0")}
51
51
  id={label}
52
52
  name={name}
53
53
  autoFocus={autoFocus}
package/src/index.tsx CHANGED
@@ -1,4 +1,3 @@
1
- import "./style.css";
2
-
3
1
  export { BlockNoteView } from "./BlockNoteView.js";
4
2
  export { components } from "./components.js";
3
+ export * from "./ShadCNComponentsContext.jsx";
package/src/lib/utils.ts CHANGED
@@ -1,11 +1,5 @@
1
- import { type ClassValue, clsx } from "clsx";
2
- import { extendTailwindMerge } from "tailwind-merge";
3
-
4
- // Ensures that `bn-` prefixed Tailwind classes are recognized as Tailwind
5
- // classes, so they can be merged correctly.
6
- const twMerge = extendTailwindMerge({
7
- prefix: "bn-",
8
- });
1
+ import { clsx, type ClassValue } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
9
3
 
10
4
  export function cn(...inputs: ClassValue[]) {
11
5
  return twMerge(clsx(inputs));
@@ -30,7 +30,7 @@ export const MenuButton = forwardRef<
30
30
  return (
31
31
  <ShadCNComponents.Button.Button
32
32
  variant={"ghost"}
33
- className={cn(className, "bn-text-gray-400")}
33
+ className={cn(className, "text-gray-400")}
34
34
  ref={ref}
35
35
  aria-label={label}
36
36
  onClick={onClick}
package/src/menu/Menu.tsx CHANGED
@@ -153,7 +153,7 @@ export const MenuItem = forwardRef<
153
153
  if (checked !== undefined) {
154
154
  return (
155
155
  <ShadCNComponents.DropdownMenu.DropdownMenuCheckboxItem
156
- className={cn(className, "bn-gap-1", checked ? "" : "bn-px-2")}
156
+ className={cn(className, "gap-1", checked ? "" : "px-2")}
157
157
  ref={ref}
158
158
  checked={checked}
159
159
  onClick={onClick}
@@ -174,7 +174,7 @@ export const MenuItem = forwardRef<
174
174
  >
175
175
  {icon}
176
176
  {children}
177
- {subTrigger && <ChevronRight className="bn-ml-auto bn-h-4 bn-w-4" />}
177
+ {subTrigger && <ChevronRight className="ml-auto h-4 w-4" />}
178
178
  </ShadCNComponents.DropdownMenu.DropdownMenuItem>
179
179
  );
180
180
  });
@@ -25,7 +25,7 @@ export const Panel = forwardRef<
25
25
 
26
26
  return (
27
27
  <ShadCNComponents.Tabs.Tabs
28
- className={cn(className, "bn-bg-popover bn-p-2 bn-rounded-lg")}
28
+ className={cn(className, "bg-popover rounded-lg p-2")}
29
29
  ref={ref}
30
30
  value={openTab}
31
31
  defaultValue={defaultOpenTab}
@@ -44,7 +44,7 @@ export const Panel = forwardRef<
44
44
  {tabs.map((tab) => (
45
45
  <ShadCNComponents.Tabs.TabsContent value={tab.name} key={tab.name}>
46
46
  <ShadCNComponents.Card.Card>
47
- <ShadCNComponents.Card.CardContent className={"bn-p-4"}>
47
+ <ShadCNComponents.Card.CardContent className={"p-4"}>
48
48
  {tab.tabPanel}
49
49
  </ShadCNComponents.Card.CardContent>
50
50
  </ShadCNComponents.Card.Card>
@@ -16,7 +16,7 @@ export const PanelTab = forwardRef<
16
16
  <div
17
17
  className={cn(
18
18
  className,
19
- "bn-flex bn-flex-col bn-gap-2 bn-items-start bn-justify-center",
19
+ "flex flex-col items-start justify-center gap-2",
20
20
  )}
21
21
  ref={ref}
22
22
  >
@@ -18,7 +18,7 @@ export const PanelTextInput = forwardRef<
18
18
  return (
19
19
  <ShadCNComponents.Input.Input
20
20
  data-test={"embed-input"}
21
- className={cn(className, "bn-w-80")}
21
+ className={cn(className, "w-80")}
22
22
  ref={ref}
23
23
  value={value}
24
24
  placeholder={placeholder}
@@ -57,9 +57,9 @@ export const PopoverContent = forwardRef<
57
57
  sideOffset={8}
58
58
  className={cn(
59
59
  className,
60
- "bn-flex bn-flex-col bn-gap-2",
60
+ "flex flex-col gap-2",
61
61
  variant === "panel-popover"
62
- ? "bn-p-0 bn-border-none bn-shadow-none bn-max-w-none bn-w-fit"
62
+ ? "w-fit max-w-none border-none p-0 shadow-none"
63
63
  : "",
64
64
  )}
65
65
  ref={ref}
@@ -30,7 +30,7 @@ export const SideMenuButton = forwardRef<
30
30
  return (
31
31
  <ShadCNComponents.Button.Button
32
32
  variant={"ghost"}
33
- className={cn(className, "bn-text-gray-400")}
33
+ className={cn(className, "text-gray-400")}
34
34
  ref={ref}
35
35
  aria-label={label}
36
36
  onClick={onClick}
package/src/style.css CHANGED
@@ -1,77 +1,12 @@
1
- @import "./tailwindStyles.css";
2
- @import url("@blocknote/react/style.css");
1
+ @import "@blocknote/react/style.css";
3
2
 
4
- @tailwind components;
5
- @tailwind utilities;
6
-
7
- .bn-shadcn {
8
- --background: 0 0% 100%;
9
- --foreground: 222.2 84% 4.9%;
10
-
11
- --card: 0 0% 100%;
12
- --card-foreground: 222.2 84% 4.9%;
13
-
14
- --popover: 0 0% 100%;
15
- --popover-foreground: 222.2 84% 4.9%;
16
-
17
- --primary: 222.2 47.4% 11.2%;
18
- --primary-foreground: 210 40% 98%;
19
-
20
- --secondary: 210 40% 96.1%;
21
- --secondary-foreground: 222.2 47.4% 11.2%;
22
-
23
- --muted: 210 40% 96.1%;
24
- --muted-foreground: 215.4 16.3% 46.9%;
25
-
26
- --accent: 210 40% 96.1%;
27
- --accent-foreground: 222.2 47.4% 11.2%;
28
-
29
- --destructive: 0 84.2% 60.2%;
30
- --destructive-foreground: 210 40% 98%;
31
-
32
- --border: 214.3 31.8% 91.4%;
33
- --input: 214.3 31.8% 91.4%;
34
- --ring: 222.2 84% 4.9%;
35
-
36
- --radius: 0.5rem;
37
- }
38
-
39
- .bn-shadcn.dark {
40
- --background: 222.2 84% 4.9%;
41
- --foreground: 210 40% 98%;
42
-
43
- --card: 222.2 84% 4.9%;
44
- --card-foreground: 210 40% 98%;
45
-
46
- --popover: 222.2 84% 4.9%;
47
- --popover-foreground: 210 40% 98%;
48
-
49
- --primary: 210 40% 98%;
50
- --primary-foreground: 222.2 47.4% 11.2%;
51
-
52
- --secondary: 217.2 32.6% 17.5%;
53
- --secondary-foreground: 210 40% 98%;
54
-
55
- --muted: 217.2 32.6% 17.5%;
56
- --muted-foreground: 215 20.2% 65.1%;
57
-
58
- --accent: 217.2 32.6% 17.5%;
59
- --accent-foreground: 210 40% 98%;
60
-
61
- --destructive: 0 62.8% 30.6%;
62
- --destructive-foreground: 210 40% 98%;
63
-
64
- --border: 217.2 32.6% 17.5%;
65
- --input: 217.2 32.6% 17.5%;
66
- --ring: 212.7 26.8% 83.9%;
67
- }
68
-
69
- .bn-shadcn * {
70
- @apply bn-border-border;
3
+ .bn-shadcn svg:not([class*="size-"]) {
4
+ width: revert;
5
+ height: revert;
71
6
  }
72
7
 
73
- .bn-shadcn .bn-editor {
74
- @apply bn-bg-background bn-text-foreground;
8
+ .bn-shadcn svg {
9
+ pointer-events: all;
75
10
  }
76
11
 
77
12
  .bn-shadcn .bn-editor a {
@@ -106,62 +41,6 @@
106
41
  overflow: auto;
107
42
  }
108
43
 
109
- .bn-shadcn .bn-suggestion-menu {
110
- height: fit-content;
111
- max-height: inherit;
112
- }
113
-
114
- .bn-shadcn .bn-suggestion-menu-item[aria-selected="true"],
115
- .bn-shadcn .bn-suggestion-menu-item:hover {
116
- background-color: hsl(var(--accent));
117
- }
118
-
119
- .bn-shadcn .bn-grid-suggestion-menu {
120
- background: var(--bn-colors-menu-background);
121
- border-radius: var(--bn-border-radius-large);
122
- box-shadow: var(--bn-shadow-medium);
123
- display: grid;
124
- gap: 7px;
125
- height: fit-content;
126
- justify-items: center;
127
- max-height: inherit;
128
- overflow-y: auto;
129
- padding: 20px;
130
- }
131
-
132
- .bn-shadcn .bn-grid-suggestion-menu-item {
133
- align-items: center;
134
- border-radius: var(--bn-border-radius-large);
135
- cursor: pointer;
136
- display: flex;
137
- font-size: 24px;
138
- height: 32px;
139
- justify-content: center;
140
- margin: 2px;
141
- padding: 4px;
142
- width: 32px;
143
- }
144
-
145
- .bn-shadcn .bn-grid-suggestion-menu-item[aria-selected="true"],
146
- .bn-shadcn .bn-grid-suggestion-menu-item:hover {
147
- background-color: var(--bn-colors-hovered-background);
148
- }
149
-
150
- .bn-shadcn .bn-grid-suggestion-menu-empty-item,
151
- .bn-shadcn .bn-grid-suggestion-menu-loader {
152
- align-items: center;
153
- color: var(--bn-colors-menu-text);
154
- display: flex;
155
- font-size: 14px;
156
- font-weight: 500;
157
- height: 32px;
158
- justify-content: center;
159
- }
160
-
161
- .bn-shadcn .bn-grid-suggestion-menu-loader span {
162
- background-color: hsl(var(--accent));
163
- }
164
-
165
44
  .bn-shadcn .bn-extend-button-add-remove-columns {
166
45
  cursor: col-resize;
167
46
  }
@@ -18,7 +18,7 @@ export const SuggestionMenu = forwardRef<
18
18
  role="listbox"
19
19
  // Styles from ShadCN DropdownMenuContent component
20
20
  className={cn(
21
- "bn-z-50 bn-min-w-[8rem] bn-overflow-auto bn-rounded-md bn-border bn-bg-popover bn-p-1 bn-text-popover-foreground bn-shadow-md data-[state=open]:bn-animate-in data-[state=closed]:bn-animate-out data-[state=closed]:bn-fade-out-0 data-[state=open]:bn-fade-in-0 data-[state=closed]:bn-zoom-out-95 data-[state=open]:bn-zoom-in-95 data-[side=bottom]:bn-slide-in-from-top-2 data-[side=left]:bn-slide-in-from-right-2 data-[side=right]:bn-slide-in-from-left-2 data-[side=top]:bn-slide-in-from-bottom-2",
21
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",
22
22
  className,
23
23
  )}
24
24
  ref={ref}
@@ -16,7 +16,9 @@ export const SuggestionMenuEmptyItem = forwardRef<
16
16
  <div
17
17
  // Styles from ShadCN DropdownMenuItem component
18
18
  className={cn(
19
- "bn-relative bn-flex bn-cursor-default bn-select-none bn-items-center bn-rounded-sm bn-px-2 bn-py-1.5 bn-text-sm bn-outline-none bn-transition-colors focus:bn-bg-accent focus:bn-text-accent-foreground data-[disabled]:bn-pointer-events-none data-[disabled]:bn-opacity-50",
19
+ "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
20
+ "hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive",
21
+ "aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive",
20
22
  className,
21
23
  )}
22
24
  ref={ref}
@@ -37,10 +37,13 @@ export const SuggestionMenuItem = forwardRef<
37
37
  <div
38
38
  // Styles from ShadCN DropdownMenuItem component
39
39
  className={cn(
40
- "bn-relative bn-flex bn-cursor-pointer bn-select-none bn-items-center bn-rounded-sm bn-px-2 bn-py-1.5 bn-text-sm bn-outline-none bn-transition-colors focus:bn-bg-accent focus:bn-text-accent-foreground data-[disabled]:bn-pointer-events-none data-[disabled]:bn-opacity-50",
41
- props.item.size === "small" ? "bn-gap-3 bn-py-1" : "",
40
+ "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
41
+ "hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive",
42
+ "aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive",
43
+ props.item.size === "small" ? "gap-3 py-1" : "",
42
44
  className,
43
45
  )}
46
+ data-highlighted
44
47
  ref={mergeRefs([ref, itemRef])}
45
48
  id={id}
46
49
  onMouseDown={(event) => event.preventDefault()}
@@ -51,8 +54,8 @@ export const SuggestionMenuItem = forwardRef<
51
54
  {item.icon && (
52
55
  <div
53
56
  className={cn(
54
- "bn-p-3",
55
- props.item.size === "small" ? "bn-p-0" : "",
57
+ "p-3",
58
+ props.item.size === "small" ? "p-0" : "",
56
59
  className,
57
60
  )}
58
61
  data-position="left"
@@ -60,11 +63,11 @@ export const SuggestionMenuItem = forwardRef<
60
63
  {item.icon}
61
64
  </div>
62
65
  )}
63
- <div className="bn-flex-1">
66
+ <div className="flex-1">
64
67
  <div
65
68
  className={cn(
66
- "bn-text-base",
67
- props.item.size === "small" ? "bn-text-sm" : "",
69
+ "text-base",
70
+ props.item.size === "small" ? "text-sm" : "",
68
71
  className,
69
72
  )}
70
73
  >
@@ -72,8 +75,8 @@ export const SuggestionMenuItem = forwardRef<
72
75
  </div>
73
76
  <div
74
77
  className={cn(
75
- "bn-text-xs",
76
- props.item.size === "small" ? "bn-hidden" : "",
78
+ "text-xs",
79
+ props.item.size === "small" ? "hidden" : "",
77
80
  className,
78
81
  )}
79
82
  >
@@ -81,7 +84,7 @@ export const SuggestionMenuItem = forwardRef<
81
84
  </div>
82
85
  </div>
83
86
  {item.badge && (
84
- <div data-position="right" className="bn-text-xs">
87
+ <div data-position="right" className="text-xs">
85
88
  <ShadCNComponents.Badge.Badge variant={"secondary"}>
86
89
  {item.badge}
87
90
  </ShadCNComponents.Badge.Badge>
@@ -15,7 +15,10 @@ export const SuggestionMenuLabel = forwardRef<
15
15
  return (
16
16
  <div
17
17
  // Styles from ShadCN DropdownMenuLabel component
18
- className={cn("bn-px-2 bn-py-1.5 bn-text-sm bn-font-semibold", className)}
18
+ className={cn(
19
+ "px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
20
+ className,
21
+ )}
19
22
  ref={ref}
20
23
  >
21
24
  {children}
@@ -13,7 +13,7 @@ export const SuggestionMenuLoader = forwardRef<
13
13
  assertEmpty(rest);
14
14
 
15
15
  return (
16
- <div className={cn(className, "bn-animate-spin")} ref={ref}>
16
+ <div className={cn(className, "animate-spin")} ref={ref}>
17
17
  {/* Taken from Google Material Icons */}
18
18
  {/* https://fonts.google.com/icons?selected=Material+Symbols+Rounded:progress_activity:FILL@0;wght@400;GRAD@0;opsz@24&icon.query=load&icon.size=24&icon.color=%23e8eaed&icon.set=Material+Symbols&icon.style=Rounded&icon.platform=web */}
19
19
  <svg
@@ -21,7 +21,8 @@ export const SuggestionMenuLoader = forwardRef<
21
21
  height="1em"
22
22
  viewBox="0 -960 960 960"
23
23
  width="1em"
24
- fill="#e8eaed">
24
+ fill="#e8eaed"
25
+ >
25
26
  <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" />
26
27
  </svg>
27
28
  </div>
@@ -2,6 +2,8 @@ import { assertEmpty } from "@blocknote/core";
2
2
  import { ComponentProps } from "@blocknote/react";
3
3
  import { forwardRef } from "react";
4
4
 
5
+ import { cn } from "../../lib/utils.js";
6
+
5
7
  export const GridSuggestionMenu = forwardRef<
6
8
  HTMLDivElement,
7
9
  ComponentProps["GridSuggestionMenu"]["Root"]
@@ -12,7 +14,12 @@ export const GridSuggestionMenu = forwardRef<
12
14
 
13
15
  return (
14
16
  <div
15
- className={className}
17
+ // Styles from ShadCN DropdownMenuContent component
18
+ className={cn(
19
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",
20
+ "grid",
21
+ className,
22
+ )}
16
23
  style={{ gridTemplateColumns: `repeat(${columns}, 1fr)` } as any}
17
24
  ref={ref}
18
25
  id={id}
@@ -2,6 +2,8 @@ import { assertEmpty } from "@blocknote/core";
2
2
  import { ComponentProps, elementOverflow, mergeRefs } from "@blocknote/react";
3
3
  import { forwardRef, useEffect, useRef } from "react";
4
4
 
5
+ import { cn } from "../../lib/utils.js";
6
+
5
7
  export const GridSuggestionMenuItem = forwardRef<
6
8
  HTMLDivElement,
7
9
  ComponentProps["GridSuggestionMenu"]["Item"]
@@ -31,7 +33,14 @@ export const GridSuggestionMenuItem = forwardRef<
31
33
 
32
34
  return (
33
35
  <div
34
- className={className}
36
+ // Styles from ShadCN DropdownMenuItem component
37
+ className={cn(
38
+ "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
39
+ "hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive",
40
+ "aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive",
41
+ "text-lg!",
42
+ className,
43
+ )}
35
44
  ref={mergeRefs([ref, itemRef])}
36
45
  id={id}
37
46
  role="option"
@@ -22,12 +22,12 @@ export const ExtendButton = forwardRef<
22
22
  variant={"ghost"}
23
23
  className={cn(
24
24
  className,
25
- "bn-p-0 bn-h-full bn-w-full bn-text-gray-400",
26
- className?.includes("bn-extend-button-add-remove-columns")
27
- ? "bn-ml-1"
28
- : "bn-mt-1",
29
- className?.includes("bn-extend-button-editing")
30
- ? "bn-bg-accent bn-text-accent-foreground"
25
+ "h-full w-full p-0 text-gray-400",
26
+ className?.includes("extend-button-add-remove-columns")
27
+ ? "ml-1"
28
+ : "mt-1",
29
+ className?.includes("extend-button-editing")
30
+ ? "bg-accent text-accent-foreground"
31
31
  : "",
32
32
  )}
33
33
  ref={ref}
@@ -29,7 +29,7 @@ export const TableHandle = forwardRef<
29
29
  return (
30
30
  <ShadCNComponents.Button.Button
31
31
  variant={"ghost"}
32
- className={cn(className, "bn-p-0 bn-h-fit bn-w-fit bn-text-gray-400")}
32
+ className={cn(className, "h-fit w-fit p-0 text-gray-400")}
33
33
  ref={ref}
34
34
  aria-label={label}
35
35
  draggable={draggable}
@@ -27,8 +27,8 @@ export const Toolbar = forwardRef<HTMLDivElement, ToolbarProps>(
27
27
  <div
28
28
  className={cn(
29
29
  className,
30
- "bn-flex bn-gap-1 bn-p-1 bn-bg-popover bn-text-popover-foreground bn-border bn-rounded-lg bn-shadow-md bn-h-fit",
31
- variant === "action-toolbar" ? "bn-w-fit" : "",
30
+ "bg-popover text-popover-foreground flex h-fit gap-1 rounded-lg border p-1 shadow-md",
31
+ variant === "action-toolbar" ? "w-fit" : "",
32
32
  )}
33
33
  ref={ref}
34
34
  onMouseEnter={onMouseEnter}
@@ -70,7 +70,7 @@ export const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>(
70
70
  <ShadCNComponents.Button.Button
71
71
  className={cn(
72
72
  className,
73
- variant === "compact" ? "bn-h-6 bn-min-w-6 bn-p-0" : "",
73
+ variant === "compact" ? "h-6 min-w-6 p-0" : "",
74
74
  )}
75
75
  variant="ghost"
76
76
  size={variant === "compact" ? "sm" : "default"}
@@ -88,7 +88,7 @@ export const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>(
88
88
  className={cn(
89
89
  className,
90
90
  "data-[state=open]:bg-accent data-[state=closed]:text-accent-foreground",
91
- variant === "compact" ? "bn-h-6 bn-min-w-6 bn-p-0" : "",
91
+ variant === "compact" ? "h-6 min-w-6 p-0" : "",
92
92
  )}
93
93
  size={variant === "compact" ? "sm" : "default"}
94
94
  aria-label={label}
@@ -111,9 +111,7 @@ export const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>(
111
111
  {trigger}
112
112
  </ShadCNComponents.Tooltip.TooltipTrigger>
113
113
  <ShadCNComponents.Tooltip.TooltipContent
114
- className={
115
- "bn-flex bn-flex-col bn-items-center bn-whitespace-pre-wrap"
116
- }
114
+ className={"flex flex-col items-center whitespace-pre-wrap"}
117
115
  >
118
116
  <span>{mainTooltip}</span>
119
117
  {secondaryTooltip && <span>{secondaryTooltip}</span>}
@@ -135,7 +133,7 @@ export const ToolbarSelect = forwardRef<
135
133
 
136
134
  // TODO?
137
135
  const SelectItemContent = (props: any) => (
138
- <div className={"bn-flex bn-gap-1 bn-items-center"}>
136
+ <div className={"flex items-center gap-1"}>
139
137
  {props.icon}
140
138
  {props.text}
141
139
  </div>
@@ -155,7 +153,7 @@ export const ToolbarSelect = forwardRef<
155
153
  }
156
154
  disabled={isDisabled}
157
155
  >
158
- <ShadCNComponents.Select.SelectTrigger className={"bn-border-none"}>
156
+ <ShadCNComponents.Select.SelectTrigger className={"border-none"}>
159
157
  <ShadCNComponents.Select.SelectValue />
160
158
  </ShadCNComponents.Select.SelectTrigger>
161
159
  <ShadCNComponents.Select.SelectContent className={className} ref={ref}>
@@ -1,6 +1,7 @@
1
1
  import { BlockSchema, InlineContentSchema, StyleSchema } from "@blocknote/core";
2
2
  import { BlockNoteViewRaw } from "@blocknote/react";
3
3
  import { ShadCNComponents } from "./ShadCNComponentsContext.js";
4
+ import "./style.css";
4
5
  export declare const BlockNoteView: <BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema>(props: React.ComponentProps<typeof BlockNoteViewRaw<BSchema, ISchema, SSchema>> & {
5
6
  /**
6
7
  * (optional)Provide your own shadcn component overrides