@blocknote/shadcn 0.14.0 → 0.14.2
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.
- package/dist/blocknote-shadcn.js +812 -778
- package/dist/blocknote-shadcn.js.map +1 -1
- package/dist/blocknote-shadcn.umd.cjs +14 -9
- package/dist/blocknote-shadcn.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +7 -7
- package/src/components/ui/badge.tsx +5 -5
- package/src/components/ui/button.tsx +12 -11
- package/src/components/ui/card.tsx +6 -6
- package/src/components/ui/dropdown-menu.tsx +20 -17
- package/src/components/ui/form.tsx +4 -4
- package/src/components/ui/input.tsx +3 -2
- package/src/components/ui/label.tsx +1 -1
- package/src/components/ui/popover.tsx +1 -1
- package/src/components/ui/select.tsx +18 -15
- package/src/components/ui/tabs.tsx +3 -3
- package/src/components/ui/toggle.tsx +6 -6
- package/src/components/ui/tooltip.tsx +1 -1
- package/src/index.tsx +12 -4
- package/src/lib/utils.ts +9 -3
- package/src/menu/Menu.tsx +2 -2
- package/src/panel/Panel.tsx +2 -2
- package/src/panel/PanelTab.tsx +1 -1
- package/src/panel/PanelTextInput.tsx +1 -1
- package/src/popover/popover.tsx +2 -2
- package/src/sideMenu/SideMenuButton.tsx +1 -1
- package/src/style.css +15 -15
- package/src/suggestionMenu/SuggestionMenu.tsx +1 -1
- package/src/suggestionMenu/SuggestionMenuEmptyItem.tsx +1 -1
- package/src/suggestionMenu/SuggestionMenuItem.tsx +25 -9
- package/src/suggestionMenu/SuggestionMenuLabel.tsx +1 -1
- package/src/tableHandle/TableHandle.tsx +1 -1
- package/src/toolbar/Toolbar.tsx +4 -4
- package/types/src/components/ui/input.d.ts +2 -1
|
@@ -17,13 +17,13 @@ const SelectTrigger = React.forwardRef<
|
|
|
17
17
|
<SelectPrimitive.Trigger
|
|
18
18
|
ref={ref}
|
|
19
19
|
className={cn(
|
|
20
|
-
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
20
|
+
"bn-flex bn-h-10 bn-w-full bn-items-center bn-justify-between bn-rounded-md bn-border bn-border-input bn-bg-background bn-px-3 bn-py-2 bn-text-sm bn-ring-offset-background placeholder:bn-text-muted-foreground focus:bn-outline-none focus:bn-ring-2 focus:bn-ring-ring focus:bn-ring-offset-2 disabled:bn-cursor-not-allowed disabled:bn-opacity-50 [&>span]:bn-line-clamp-1",
|
|
21
21
|
className
|
|
22
22
|
)}
|
|
23
23
|
{...props}>
|
|
24
24
|
{children}
|
|
25
25
|
<SelectPrimitive.Icon asChild>
|
|
26
|
-
<ChevronDown className="h-4 w-4 opacity-50" />
|
|
26
|
+
<ChevronDown className="bn-h-4 bn-w-4 bn-opacity-50" />
|
|
27
27
|
</SelectPrimitive.Icon>
|
|
28
28
|
</SelectPrimitive.Trigger>
|
|
29
29
|
));
|
|
@@ -36,11 +36,11 @@ const SelectScrollUpButton = React.forwardRef<
|
|
|
36
36
|
<SelectPrimitive.ScrollUpButton
|
|
37
37
|
ref={ref}
|
|
38
38
|
className={cn(
|
|
39
|
-
"flex cursor-default items-center justify-center py-1",
|
|
39
|
+
"bn-flex bn-cursor-default bn-items-center bn-justify-center bn-py-1",
|
|
40
40
|
className
|
|
41
41
|
)}
|
|
42
42
|
{...props}>
|
|
43
|
-
<ChevronUp className="h-4 w-4" />
|
|
43
|
+
<ChevronUp className="bn-h-4 bn-w-4" />
|
|
44
44
|
</SelectPrimitive.ScrollUpButton>
|
|
45
45
|
));
|
|
46
46
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
@@ -52,11 +52,11 @@ const SelectScrollDownButton = React.forwardRef<
|
|
|
52
52
|
<SelectPrimitive.ScrollDownButton
|
|
53
53
|
ref={ref}
|
|
54
54
|
className={cn(
|
|
55
|
-
"flex cursor-default items-center justify-center py-1",
|
|
55
|
+
"bn-flex bn-cursor-default bn-items-center bn-justify-center bn-py-1",
|
|
56
56
|
className
|
|
57
57
|
)}
|
|
58
58
|
{...props}>
|
|
59
|
-
<ChevronDown className="h-4 w-4" />
|
|
59
|
+
<ChevronDown className="bn-h-4 bn-w-4" />
|
|
60
60
|
</SelectPrimitive.ScrollDownButton>
|
|
61
61
|
));
|
|
62
62
|
SelectScrollDownButton.displayName =
|
|
@@ -70,9 +70,9 @@ const SelectContent = React.forwardRef<
|
|
|
70
70
|
<SelectPrimitive.Content
|
|
71
71
|
ref={ref}
|
|
72
72
|
className={cn(
|
|
73
|
-
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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",
|
|
73
|
+
"bn-relative bn-z-50 bn-max-h-96 bn-min-w-[8rem] bn-overflow-hidden bn-rounded-md bn-border bn-bg-popover 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",
|
|
74
74
|
position === "popper" &&
|
|
75
|
-
"data-[side=bottom]:translate-y-1 data-[side=left]
|
|
75
|
+
"data-[side=bottom]:bn-translate-y-1 data-[side=left]:bn--translate-x-1 data-[side=right]:bn-translate-x-1 data-[side=top]:bn--translate-y-1",
|
|
76
76
|
className
|
|
77
77
|
)}
|
|
78
78
|
position={position}
|
|
@@ -80,9 +80,9 @@ const SelectContent = React.forwardRef<
|
|
|
80
80
|
<SelectScrollUpButton />
|
|
81
81
|
<SelectPrimitive.Viewport
|
|
82
82
|
className={cn(
|
|
83
|
-
"p-1",
|
|
83
|
+
"bn-p-1",
|
|
84
84
|
position === "popper" &&
|
|
85
|
-
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
85
|
+
"bn-h-[var(--radix-select-trigger-height)] bn-w-full bn-min-w-[var(--radix-select-trigger-width)]"
|
|
86
86
|
)}>
|
|
87
87
|
{children}
|
|
88
88
|
</SelectPrimitive.Viewport>
|
|
@@ -98,7 +98,10 @@ const SelectLabel = React.forwardRef<
|
|
|
98
98
|
>(({ className, ...props }, ref) => (
|
|
99
99
|
<SelectPrimitive.Label
|
|
100
100
|
ref={ref}
|
|
101
|
-
className={cn(
|
|
101
|
+
className={cn(
|
|
102
|
+
"bn-py-1.5 bn-pl-8 bn-pr-2 bn-text-sm bn-font-semibold",
|
|
103
|
+
className
|
|
104
|
+
)}
|
|
102
105
|
{...props}
|
|
103
106
|
/>
|
|
104
107
|
));
|
|
@@ -111,13 +114,13 @@ const SelectItem = React.forwardRef<
|
|
|
111
114
|
<SelectPrimitive.Item
|
|
112
115
|
ref={ref}
|
|
113
116
|
className={cn(
|
|
114
|
-
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
117
|
+
"bn-relative bn-flex bn-w-full bn-cursor-default bn-select-none bn-items-center bn-rounded-sm bn-py-1.5 bn-pl-8 bn-pr-2 bn-text-sm bn-outline-none focus:bn-bg-accent focus:bn-text-accent-foreground data-[disabled]:bn-pointer-events-none data-[disabled]:bn-opacity-50",
|
|
115
118
|
className
|
|
116
119
|
)}
|
|
117
120
|
{...props}>
|
|
118
|
-
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
121
|
+
<span className="bn-absolute bn-left-2 bn-flex bn-h-3.5 bn-w-3.5 bn-items-center bn-justify-center">
|
|
119
122
|
<SelectPrimitive.ItemIndicator>
|
|
120
|
-
<Check className="h-4 w-4" />
|
|
123
|
+
<Check className="bn-h-4 bn-w-4" />
|
|
121
124
|
</SelectPrimitive.ItemIndicator>
|
|
122
125
|
</span>
|
|
123
126
|
|
|
@@ -132,7 +135,7 @@ const SelectSeparator = React.forwardRef<
|
|
|
132
135
|
>(({ className, ...props }, ref) => (
|
|
133
136
|
<SelectPrimitive.Separator
|
|
134
137
|
ref={ref}
|
|
135
|
-
className={cn("
|
|
138
|
+
className={cn("bn--mx-1 bn-my-1 bn-h-px bn-bg-muted", className)}
|
|
136
139
|
{...props}
|
|
137
140
|
/>
|
|
138
141
|
));
|
|
@@ -12,7 +12,7 @@ const TabsList = React.forwardRef<
|
|
|
12
12
|
<TabsPrimitive.List
|
|
13
13
|
ref={ref}
|
|
14
14
|
className={cn(
|
|
15
|
-
"inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
|
|
15
|
+
"bn-inline-flex bn-h-10 bn-items-center bn-justify-center bn-rounded-md bn-bg-muted bn-p-1 bn-text-muted-foreground",
|
|
16
16
|
className
|
|
17
17
|
)}
|
|
18
18
|
{...props}
|
|
@@ -27,7 +27,7 @@ const TabsTrigger = React.forwardRef<
|
|
|
27
27
|
<TabsPrimitive.Trigger
|
|
28
28
|
ref={ref}
|
|
29
29
|
className={cn(
|
|
30
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
|
|
30
|
+
"bn-inline-flex bn-items-center bn-justify-center bn-whitespace-nowrap bn-rounded-sm bn-px-3 bn-py-1.5 bn-text-sm bn-font-medium bn-ring-offset-background bn-transition-all focus-visible:bn-outline-none focus-visible:bn-ring-2 focus-visible:bn-ring-ring focus-visible:bn-ring-offset-2 disabled:bn-pointer-events-none disabled:bn-opacity-50 data-[state=active]:bn-bg-background data-[state=active]:bn-text-foreground data-[state=active]:bn-shadow-sm",
|
|
31
31
|
className
|
|
32
32
|
)}
|
|
33
33
|
{...props}
|
|
@@ -42,7 +42,7 @@ const TabsContent = React.forwardRef<
|
|
|
42
42
|
<TabsPrimitive.Content
|
|
43
43
|
ref={ref}
|
|
44
44
|
className={cn(
|
|
45
|
-
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
45
|
+
"bn-mt-2 bn-ring-offset-background focus-visible:bn-outline-none focus-visible:bn-ring-2 focus-visible:bn-ring-ring focus-visible:bn-ring-offset-2",
|
|
46
46
|
className
|
|
47
47
|
)}
|
|
48
48
|
{...props}
|
|
@@ -5,18 +5,18 @@ import { cva, type VariantProps } from "class-variance-authority";
|
|
|
5
5
|
import { cn } from "../../lib/utils";
|
|
6
6
|
|
|
7
7
|
const toggleVariants = cva(
|
|
8
|
-
"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
|
|
8
|
+
"bn-inline-flex bn-items-center bn-justify-center bn-rounded-md bn-text-sm bn-font-medium bn-ring-offset-background bn-transition-colors hover:bn-bg-muted hover: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-pointer-events-none disabled:bn-opacity-50 data-[state=on]:bn-bg-accent data-[state=on]:bn-text-accent-foreground",
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
|
12
|
-
default: "bg-transparent",
|
|
12
|
+
default: "bn-bg-transparent",
|
|
13
13
|
outline:
|
|
14
|
-
"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",
|
|
14
|
+
"bn-border bn-border-input bn-bg-transparent hover:bn-bg-accent hover:bn-text-accent-foreground",
|
|
15
15
|
},
|
|
16
16
|
size: {
|
|
17
|
-
default: "h-10 px-3",
|
|
18
|
-
sm: "h-9 px-2.5",
|
|
19
|
-
lg: "h-11 px-5",
|
|
17
|
+
default: "bn-h-10 bn-px-3",
|
|
18
|
+
sm: "bn-h-9 bn-px-2.5",
|
|
19
|
+
lg: "bn-h-11 bn-px-5",
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
22
|
defaultVariants: {
|
|
@@ -17,7 +17,7 @@ const TooltipContent = React.forwardRef<
|
|
|
17
17
|
ref={ref}
|
|
18
18
|
sideOffset={sideOffset}
|
|
19
19
|
className={cn(
|
|
20
|
-
"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md 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",
|
|
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
21
|
className
|
|
22
22
|
)}
|
|
23
23
|
{...props}
|
package/src/index.tsx
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
BlockSchema,
|
|
3
|
+
InlineContentSchema,
|
|
4
|
+
mergeCSSClasses,
|
|
5
|
+
StyleSchema,
|
|
6
|
+
} from "@blocknote/core";
|
|
2
7
|
import {
|
|
3
8
|
BlockNoteViewRaw,
|
|
4
9
|
Components,
|
|
@@ -103,19 +108,22 @@ export const BlockNoteView = <
|
|
|
103
108
|
shadCNComponents?: Partial<ShadCNComponents>;
|
|
104
109
|
}
|
|
105
110
|
) => {
|
|
106
|
-
const { shadCNComponents, ...rest } = props;
|
|
111
|
+
const { className, shadCNComponents, ...rest } = props;
|
|
107
112
|
|
|
108
113
|
const componentsValue = useMemo(() => {
|
|
109
114
|
return {
|
|
110
|
-
...shadCNComponents,
|
|
111
115
|
...ShadCNDefaultComponents,
|
|
116
|
+
...shadCNComponents,
|
|
112
117
|
};
|
|
113
118
|
}, [shadCNComponents]);
|
|
114
119
|
|
|
115
120
|
return (
|
|
116
121
|
<ShadCNComponentsContext.Provider value={componentsValue}>
|
|
117
122
|
<ComponentsContext.Provider value={components}>
|
|
118
|
-
<BlockNoteViewRaw
|
|
123
|
+
<BlockNoteViewRaw
|
|
124
|
+
className={mergeCSSClasses("bn-shadcn", className || "")}
|
|
125
|
+
{...rest}
|
|
126
|
+
/>
|
|
119
127
|
</ComponentsContext.Provider>
|
|
120
128
|
</ShadCNComponentsContext.Provider>
|
|
121
129
|
);
|
package/src/lib/utils.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { type ClassValue, clsx } from "clsx"
|
|
2
|
-
import {
|
|
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
|
+
});
|
|
3
9
|
|
|
4
10
|
export function cn(...inputs: ClassValue[]) {
|
|
5
|
-
return twMerge(clsx(inputs))
|
|
11
|
+
return twMerge(clsx(inputs));
|
|
6
12
|
}
|
package/src/menu/Menu.tsx
CHANGED
|
@@ -147,7 +147,7 @@ export const MenuItem = forwardRef<
|
|
|
147
147
|
if (checked !== undefined) {
|
|
148
148
|
return (
|
|
149
149
|
<ShadCNComponents.DropdownMenu.DropdownMenuCheckboxItem
|
|
150
|
-
className={cn(className, "gap-1")}
|
|
150
|
+
className={cn(className, "bn-gap-1")}
|
|
151
151
|
ref={ref}
|
|
152
152
|
checked={checked}
|
|
153
153
|
onClick={onClick}
|
|
@@ -166,7 +166,7 @@ export const MenuItem = forwardRef<
|
|
|
166
166
|
{...rest}>
|
|
167
167
|
{icon}
|
|
168
168
|
{children}
|
|
169
|
-
{subTrigger && <ChevronRight className="ml-auto h-4 w-4" />}
|
|
169
|
+
{subTrigger && <ChevronRight className="bn-ml-auto bn-h-4 bn-w-4" />}
|
|
170
170
|
</ShadCNComponents.DropdownMenu.DropdownMenuItem>
|
|
171
171
|
);
|
|
172
172
|
});
|
package/src/panel/Panel.tsx
CHANGED
|
@@ -25,7 +25,7 @@ export const Panel = forwardRef<
|
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
27
|
<ShadCNComponents.Tabs.Tabs
|
|
28
|
-
className={cn(className, "bg-popover p-2 rounded-lg")}
|
|
28
|
+
className={cn(className, "bn-bg-popover bn-p-2 bn-rounded-lg")}
|
|
29
29
|
ref={ref}
|
|
30
30
|
value={openTab}
|
|
31
31
|
defaultValue={defaultOpenTab}
|
|
@@ -43,7 +43,7 @@ export const Panel = forwardRef<
|
|
|
43
43
|
{tabs.map((tab) => (
|
|
44
44
|
<ShadCNComponents.Tabs.TabsContent value={tab.name} key={tab.name}>
|
|
45
45
|
<ShadCNComponents.Card.Card>
|
|
46
|
-
<ShadCNComponents.Card.CardContent className={"p-4"}>
|
|
46
|
+
<ShadCNComponents.Card.CardContent className={"bn-p-4"}>
|
|
47
47
|
{tab.tabPanel}
|
|
48
48
|
</ShadCNComponents.Card.CardContent>
|
|
49
49
|
</ShadCNComponents.Card.Card>
|
package/src/panel/PanelTab.tsx
CHANGED
package/src/popover/popover.tsx
CHANGED
|
@@ -57,9 +57,9 @@ export const PopoverContent = forwardRef<
|
|
|
57
57
|
sideOffset={8}
|
|
58
58
|
className={cn(
|
|
59
59
|
className,
|
|
60
|
-
"flex flex-col gap-2",
|
|
60
|
+
"bn-flex bn-flex-col bn-gap-2",
|
|
61
61
|
variant === "panel-popover"
|
|
62
|
-
? "p-0 border-none shadow-none max-w-none w-fit"
|
|
62
|
+
? "bn-p-0 bn-border-none bn-shadow-none bn-max-w-none bn-w-fit"
|
|
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, "text-gray-400")}
|
|
33
|
+
className={cn(className, "bn-text-gray-400")}
|
|
34
34
|
ref={ref}
|
|
35
35
|
aria-label={label}
|
|
36
36
|
onClick={onClick}
|
package/src/style.css
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
@tailwind components;
|
|
5
5
|
@tailwind utilities;
|
|
6
6
|
|
|
7
|
-
.bn-
|
|
7
|
+
.bn-shadcn {
|
|
8
8
|
--background: 0 0% 100%;
|
|
9
9
|
--foreground: 222.2 84% 4.9%;
|
|
10
10
|
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
--radius: 0.5rem;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
.bn-
|
|
39
|
+
.bn-shadcn.dark {
|
|
40
40
|
--background: 222.2 84% 4.9%;
|
|
41
41
|
--foreground: 210 40% 98%;
|
|
42
42
|
|
|
@@ -66,45 +66,45 @@
|
|
|
66
66
|
--ring: 212.7 26.8% 83.9%;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
.bn-
|
|
70
|
-
@apply border-border;
|
|
69
|
+
.bn-shadcn * {
|
|
70
|
+
@apply bn-border-border;
|
|
71
71
|
}
|
|
72
|
-
.bn-editor {
|
|
73
|
-
@apply bg-background text-foreground;
|
|
72
|
+
.bn-shadcn .bn-editor {
|
|
73
|
+
@apply bn-bg-background bn-text-foreground;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
[data-radix-popper-content-wrapper] {
|
|
76
|
+
.bn-shadcn [data-radix-popper-content-wrapper] {
|
|
77
77
|
z-index: 99999 !important;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
.bn-editor:focus-visible {
|
|
80
|
+
.bn-shadcn .bn-editor:focus-visible {
|
|
81
81
|
outline: none;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
.bn-side-menu {
|
|
84
|
+
.bn-shadcn .bn-side-menu {
|
|
85
85
|
align-items: center;
|
|
86
86
|
display: flex;
|
|
87
87
|
justify-content: center;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
.bn-side-menu .bn-button {
|
|
90
|
+
.bn-shadcn .bn-side-menu .bn-button {
|
|
91
91
|
padding: 0;
|
|
92
92
|
height: 24px;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
.bn-select {
|
|
95
|
+
.bn-shadcn .bn-select {
|
|
96
96
|
max-height: var(--radix-select-content-available-height);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
.bn-menu-dropdown {
|
|
99
|
+
.bn-shadcn .bn-menu-dropdown {
|
|
100
100
|
max-height: var(--radix-dropdown-menu-content-available-height);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
.bn-color-picker-dropdown {
|
|
103
|
+
.bn-shadcn .bn-color-picker-dropdown {
|
|
104
104
|
overflow: auto;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
.bn-suggestion-menu-item[aria-selected="true"],
|
|
108
|
-
.bn-suggestion-menu-item:hover {
|
|
107
|
+
.bn-shadcn .bn-suggestion-menu-item[aria-selected="true"],
|
|
108
|
+
.bn-shadcn .bn-suggestion-menu-item:hover {
|
|
109
109
|
background-color: hsl(var(--accent));
|
|
110
110
|
}
|
|
@@ -18,7 +18,7 @@ export const SuggestionMenu = forwardRef<
|
|
|
18
18
|
role="listbox"
|
|
19
19
|
// Styles from ShadCN DropdownMenuContent component
|
|
20
20
|
className={cn(
|
|
21
|
-
"z-50 min-w-[8rem] overflow-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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",
|
|
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",
|
|
22
22
|
className
|
|
23
23
|
)}
|
|
24
24
|
ref={ref}>
|
|
@@ -16,7 +16,7 @@ export const SuggestionMenuEmptyItem = forwardRef<
|
|
|
16
16
|
<div
|
|
17
17
|
// Styles from ShadCN DropdownMenuItem component
|
|
18
18
|
className={cn(
|
|
19
|
-
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
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",
|
|
20
20
|
className
|
|
21
21
|
)}
|
|
22
22
|
ref={ref}>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assertEmpty } from "@blocknote/core";
|
|
2
|
-
import { ComponentProps } from "@blocknote/react";
|
|
3
|
-
import { forwardRef } from "react";
|
|
2
|
+
import { ComponentProps, elementOverflow, mergeRefs } from "@blocknote/react";
|
|
3
|
+
import { forwardRef, useEffect, useRef } from "react";
|
|
4
4
|
|
|
5
5
|
import { cn } from "../lib/utils";
|
|
6
6
|
import { useShadCNComponentsContext } from "../ShadCNComponentsContext";
|
|
@@ -15,29 +15,45 @@ export const SuggestionMenuItem = forwardRef<
|
|
|
15
15
|
|
|
16
16
|
assertEmpty(rest);
|
|
17
17
|
|
|
18
|
+
const itemRef = useRef<HTMLDivElement>(null);
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!itemRef.current || !isSelected) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const overflow = elementOverflow(itemRef.current);
|
|
26
|
+
|
|
27
|
+
if (overflow === "top") {
|
|
28
|
+
itemRef.current.scrollIntoView(true);
|
|
29
|
+
} else if (overflow === "bottom") {
|
|
30
|
+
itemRef.current.scrollIntoView(false);
|
|
31
|
+
}
|
|
32
|
+
}, [isSelected]);
|
|
33
|
+
|
|
18
34
|
return (
|
|
19
35
|
<div
|
|
20
36
|
// Styles from ShadCN DropdownMenuItem component
|
|
21
37
|
className={cn(
|
|
22
|
-
"relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
38
|
+
"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",
|
|
23
39
|
className
|
|
24
40
|
)}
|
|
25
|
-
ref={ref}
|
|
41
|
+
ref={mergeRefs([ref, itemRef])}
|
|
26
42
|
id={id}
|
|
27
43
|
onClick={onClick}
|
|
28
44
|
role="option"
|
|
29
45
|
aria-selected={isSelected || undefined}>
|
|
30
46
|
{item.icon && (
|
|
31
|
-
<div className="p-3" data-position="left">
|
|
47
|
+
<div className="bn-p-3" data-position="left">
|
|
32
48
|
{item.icon}
|
|
33
49
|
</div>
|
|
34
50
|
)}
|
|
35
|
-
<div className="flex-1">
|
|
36
|
-
<div className="text-base">{item.title}</div>
|
|
37
|
-
<div className="text-xs">{item.subtext}</div>
|
|
51
|
+
<div className="bn-flex-1">
|
|
52
|
+
<div className="bn-text-base">{item.title}</div>
|
|
53
|
+
<div className="bn-text-xs">{item.subtext}</div>
|
|
38
54
|
</div>
|
|
39
55
|
{item.badge && (
|
|
40
|
-
<div data-position="right" className="text-xs">
|
|
56
|
+
<div data-position="right" className="bn-text-xs">
|
|
41
57
|
<ShadCNComponents.Badge.Badge variant={"secondary"}>
|
|
42
58
|
{item.badge}
|
|
43
59
|
</ShadCNComponents.Badge.Badge>
|
|
@@ -15,7 +15,7 @@ export const SuggestionMenuLabel = forwardRef<
|
|
|
15
15
|
return (
|
|
16
16
|
<div
|
|
17
17
|
// Styles from ShadCN DropdownMenuLabel component
|
|
18
|
-
className={cn("px-2 py-1.5 text-sm font-semibold", className)}
|
|
18
|
+
className={cn("bn-px-2 bn-py-1.5 bn-text-sm bn-font-semibold", className)}
|
|
19
19
|
ref={ref}>
|
|
20
20
|
{children}
|
|
21
21
|
</div>
|
|
@@ -29,7 +29,7 @@ export const TableHandle = forwardRef<
|
|
|
29
29
|
return (
|
|
30
30
|
<ShadCNComponents.Button.Button
|
|
31
31
|
variant={"ghost"}
|
|
32
|
-
className={cn(className, "p-0 h-fit w-fit text-gray-400")}
|
|
32
|
+
className={cn(className, "bn-p-0 bn-h-fit bn-w-fit bn-text-gray-400")}
|
|
33
33
|
ref={ref}
|
|
34
34
|
aria-label={label}
|
|
35
35
|
draggable={draggable}
|
package/src/toolbar/Toolbar.tsx
CHANGED
|
@@ -21,7 +21,7 @@ export const Toolbar = forwardRef<HTMLDivElement, ToolbarProps>(
|
|
|
21
21
|
<div
|
|
22
22
|
className={cn(
|
|
23
23
|
className,
|
|
24
|
-
"flex gap-1 p-1 bg-popover text-popover-foreground border rounded-lg shadow-md"
|
|
24
|
+
"bn-flex bn-gap-1 bn-p-1 bn-bg-popover bn-text-popover-foreground bn-border bn-rounded-lg bn-shadow-md"
|
|
25
25
|
)}
|
|
26
26
|
ref={ref}
|
|
27
27
|
onMouseEnter={onMouseEnter}
|
|
@@ -95,7 +95,7 @@ export const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>(
|
|
|
95
95
|
{trigger}
|
|
96
96
|
</ShadCNComponents.Tooltip.TooltipTrigger>
|
|
97
97
|
<ShadCNComponents.Tooltip.TooltipContent
|
|
98
|
-
className={"flex flex-col items-center"}>
|
|
98
|
+
className={"bn-flex bn-flex-col bn-items-center"}>
|
|
99
99
|
<span>{mainTooltip}</span>
|
|
100
100
|
{secondaryTooltip && <span>{secondaryTooltip}</span>}
|
|
101
101
|
</ShadCNComponents.Tooltip.TooltipContent>
|
|
@@ -116,7 +116,7 @@ export const ToolbarSelect = forwardRef<
|
|
|
116
116
|
|
|
117
117
|
// TODO?
|
|
118
118
|
const SelectItemContent = (props: any) => (
|
|
119
|
-
<div className={"flex gap-1 items-center"}>
|
|
119
|
+
<div className={"bn-flex bn-gap-1 bn-items-center"}>
|
|
120
120
|
{props.icon}
|
|
121
121
|
{props.text}
|
|
122
122
|
</div>
|
|
@@ -135,7 +135,7 @@ export const ToolbarSelect = forwardRef<
|
|
|
135
135
|
items.find((item) => item.text === value)!.onClick?.()
|
|
136
136
|
}
|
|
137
137
|
disabled={isDisabled}>
|
|
138
|
-
<ShadCNComponents.Select.SelectTrigger className={"border-none"}>
|
|
138
|
+
<ShadCNComponents.Select.SelectTrigger className={"bn-border-none"}>
|
|
139
139
|
<ShadCNComponents.Select.SelectValue />
|
|
140
140
|
</ShadCNComponents.Select.SelectTrigger>
|
|
141
141
|
<ShadCNComponents.Select.SelectContent className={className} ref={ref}>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
export
|
|
2
|
+
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
+
}
|
|
3
4
|
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
4
5
|
export { Input };
|