@blocknote/shadcn 0.24.2 → 0.25.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.
- package/dist/blocknote-shadcn.cjs +2 -0
- package/dist/blocknote-shadcn.cjs.map +1 -0
- package/dist/blocknote-shadcn.js +914 -594
- package/dist/blocknote-shadcn.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +7 -6
- package/src/ShadCNComponentsContext.tsx +14 -0
- package/src/badge/Badge.tsx +85 -0
- package/src/comments/Card.tsx +48 -0
- package/src/comments/Comment.tsx +110 -0
- package/src/comments/Editor.tsx +49 -0
- package/src/components/ui/avatar.tsx +48 -0
- package/src/components/ui/skeleton.tsx +15 -0
- package/src/components.ts +16 -0
- package/src/menu/Button.tsx +45 -0
- package/src/menu/Menu.tsx +4 -2
- package/src/style.css +10 -0
- package/src/toolbar/Toolbar.tsx +22 -5
- package/types/src/ShadCNComponentsContext.d.ts +25 -0
- package/types/src/badge/Badge.d.ts +15 -0
- package/types/src/comments/Card.d.ts +9 -0
- package/types/src/comments/Comment.d.ts +9 -0
- package/types/src/comments/Editor.d.ts +8 -0
- package/types/src/components/ui/avatar.d.ts +6 -0
- package/types/src/components/ui/button.d.ts +1 -1
- package/types/src/components/ui/skeleton.d.ts +3 -0
- package/types/src/menu/Button.d.ts +15 -0
- package/types/src/toolbar/Toolbar.d.ts +3 -1
- package/dist/blocknote-shadcn.umd.cjs +0 -2
- package/dist/blocknote-shadcn.umd.cjs.map +0 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { cn } from "../../lib/utils";
|
|
2
|
+
|
|
3
|
+
function Skeleton({
|
|
4
|
+
className,
|
|
5
|
+
...props
|
|
6
|
+
}: React.HTMLAttributes<HTMLDivElement>) {
|
|
7
|
+
return (
|
|
8
|
+
<div
|
|
9
|
+
className={cn("animate-pulse rounded-md bg-primary/10", className)}
|
|
10
|
+
{...props}
|
|
11
|
+
/>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { Skeleton };
|
package/src/components.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
MenuLabel,
|
|
11
11
|
MenuTrigger,
|
|
12
12
|
} from "./menu/Menu.js";
|
|
13
|
+
import { MenuButton } from "./menu/Button.js";
|
|
13
14
|
import { Panel } from "./panel/Panel.js";
|
|
14
15
|
import { PanelTab } from "./panel/PanelTab.js";
|
|
15
16
|
import { PanelTextInput } from "./panel/PanelTextInput.js";
|
|
@@ -26,6 +27,10 @@ import { SuggestionMenuLoader } from "./suggestionMenu/SuggestionMenuLoader.js";
|
|
|
26
27
|
import { ExtendButton } from "./tableHandle/ExtendButton.js";
|
|
27
28
|
import { TableHandle } from "./tableHandle/TableHandle.js";
|
|
28
29
|
import { Toolbar, ToolbarButton, ToolbarSelect } from "./toolbar/Toolbar.js";
|
|
30
|
+
import { Card, CardSection } from "./comments/Card.js";
|
|
31
|
+
import { Comment } from "./comments/Comment.js";
|
|
32
|
+
import { Editor } from "./comments/Editor.js";
|
|
33
|
+
import { Badge, BadgeGroup } from "./badge/Badge.js";
|
|
29
34
|
|
|
30
35
|
import { PanelButton } from "./panel/PanelButton.js";
|
|
31
36
|
import { PanelFileInput } from "./panel/PanelFileInput.js";
|
|
@@ -71,7 +76,17 @@ export const components: Components = {
|
|
|
71
76
|
Root: TableHandle,
|
|
72
77
|
ExtendButton: ExtendButton,
|
|
73
78
|
},
|
|
79
|
+
Comments: {
|
|
80
|
+
Comment: Comment,
|
|
81
|
+
Editor: Editor,
|
|
82
|
+
Card: Card,
|
|
83
|
+
CardSection: CardSection,
|
|
84
|
+
},
|
|
74
85
|
Generic: {
|
|
86
|
+
Badge: {
|
|
87
|
+
Root: Badge,
|
|
88
|
+
Group: BadgeGroup,
|
|
89
|
+
},
|
|
75
90
|
Toolbar: {
|
|
76
91
|
Root: Toolbar,
|
|
77
92
|
Button: ToolbarButton,
|
|
@@ -87,6 +102,7 @@ export const components: Components = {
|
|
|
87
102
|
Divider: MenuDivider,
|
|
88
103
|
Label: MenuLabel,
|
|
89
104
|
Item: MenuItem,
|
|
105
|
+
Button: MenuButton,
|
|
90
106
|
},
|
|
91
107
|
Popover: {
|
|
92
108
|
Root: Popover,
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { assertEmpty } from "@blocknote/core";
|
|
2
|
+
import { ComponentProps } from "@blocknote/react";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../lib/utils.js";
|
|
6
|
+
import { useShadCNComponentsContext } from "../ShadCNComponentsContext.js";
|
|
7
|
+
|
|
8
|
+
export const MenuButton = forwardRef<
|
|
9
|
+
HTMLButtonElement,
|
|
10
|
+
ComponentProps["Generic"]["Menu"]["Button"]
|
|
11
|
+
>((props, ref) => {
|
|
12
|
+
const {
|
|
13
|
+
className,
|
|
14
|
+
children,
|
|
15
|
+
icon,
|
|
16
|
+
onClick,
|
|
17
|
+
onDragEnd,
|
|
18
|
+
onDragStart,
|
|
19
|
+
draggable,
|
|
20
|
+
label,
|
|
21
|
+
...rest
|
|
22
|
+
} = props;
|
|
23
|
+
|
|
24
|
+
// false, because rest props can be added by ariakit when button is used as a trigger
|
|
25
|
+
// assertEmpty in this case is only used at typescript level, not runtime level
|
|
26
|
+
assertEmpty(rest, false);
|
|
27
|
+
|
|
28
|
+
const ShadCNComponents = useShadCNComponentsContext()!;
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<ShadCNComponents.Button.Button
|
|
32
|
+
variant={"ghost"}
|
|
33
|
+
className={cn(className, "bn-text-gray-400")}
|
|
34
|
+
ref={ref}
|
|
35
|
+
aria-label={label}
|
|
36
|
+
onClick={onClick}
|
|
37
|
+
onDragStart={onDragStart}
|
|
38
|
+
onDragEnd={onDragEnd}
|
|
39
|
+
draggable={draggable}
|
|
40
|
+
{...rest}>
|
|
41
|
+
{icon}
|
|
42
|
+
{children}
|
|
43
|
+
</ShadCNComponents.Button.Button>
|
|
44
|
+
);
|
|
45
|
+
});
|
package/src/menu/Menu.tsx
CHANGED
|
@@ -56,7 +56,9 @@ export const Menu = (props: ComponentProps["Generic"]["Menu"]["Root"]) => {
|
|
|
56
56
|
);
|
|
57
57
|
} else {
|
|
58
58
|
return (
|
|
59
|
-
<ShadCNComponents.DropdownMenu.DropdownMenu
|
|
59
|
+
<ShadCNComponents.DropdownMenu.DropdownMenu
|
|
60
|
+
modal={false}
|
|
61
|
+
onOpenChange={onOpenChange}>
|
|
60
62
|
{children}
|
|
61
63
|
</ShadCNComponents.DropdownMenu.DropdownMenu>
|
|
62
64
|
);
|
|
@@ -147,7 +149,7 @@ export const MenuItem = forwardRef<
|
|
|
147
149
|
if (checked !== undefined) {
|
|
148
150
|
return (
|
|
149
151
|
<ShadCNComponents.DropdownMenu.DropdownMenuCheckboxItem
|
|
150
|
-
className={cn(className, "bn-gap-1")}
|
|
152
|
+
className={cn(className, "bn-gap-1", checked ? "" : "bn-px-2")}
|
|
151
153
|
ref={ref}
|
|
152
154
|
checked={checked}
|
|
153
155
|
onClick={onClick}
|
package/src/style.css
CHANGED
package/src/toolbar/Toolbar.tsx
CHANGED
|
@@ -10,7 +10,14 @@ type ToolbarProps = ComponentProps["FormattingToolbar"]["Root"] &
|
|
|
10
10
|
|
|
11
11
|
export const Toolbar = forwardRef<HTMLDivElement, ToolbarProps>(
|
|
12
12
|
(props, ref) => {
|
|
13
|
-
const {
|
|
13
|
+
const {
|
|
14
|
+
className,
|
|
15
|
+
children,
|
|
16
|
+
onMouseEnter,
|
|
17
|
+
onMouseLeave,
|
|
18
|
+
variant,
|
|
19
|
+
...rest
|
|
20
|
+
} = props;
|
|
14
21
|
|
|
15
22
|
assertEmpty(rest);
|
|
16
23
|
|
|
@@ -21,7 +28,8 @@ export const Toolbar = forwardRef<HTMLDivElement, ToolbarProps>(
|
|
|
21
28
|
<div
|
|
22
29
|
className={cn(
|
|
23
30
|
className,
|
|
24
|
-
"bn-flex bn-gap-1 bn-p-1 bn-bg-popover bn-text-popover-foreground bn-border bn-rounded-lg bn-shadow-md"
|
|
31
|
+
"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",
|
|
32
|
+
variant === "action-toolbar" ? "bn-w-fit" : ""
|
|
25
33
|
)}
|
|
26
34
|
ref={ref}
|
|
27
35
|
onMouseEnter={onMouseEnter}
|
|
@@ -48,6 +56,7 @@ export const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>(
|
|
|
48
56
|
isDisabled,
|
|
49
57
|
onClick,
|
|
50
58
|
label,
|
|
59
|
+
variant,
|
|
51
60
|
...rest
|
|
52
61
|
} = props;
|
|
53
62
|
|
|
@@ -60,8 +69,12 @@ export const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>(
|
|
|
60
69
|
const trigger =
|
|
61
70
|
isSelected === undefined ? (
|
|
62
71
|
<ShadCNComponents.Button.Button
|
|
63
|
-
className={
|
|
72
|
+
className={cn(
|
|
73
|
+
className,
|
|
74
|
+
variant === "compact" ? "bn-h-6 bn-min-w-6 bn-p-0" : ""
|
|
75
|
+
)}
|
|
64
76
|
variant="ghost"
|
|
77
|
+
size={variant === "compact" ? "sm" : "default"}
|
|
65
78
|
disabled={isDisabled}
|
|
66
79
|
onClick={onClick}
|
|
67
80
|
ref={ref}
|
|
@@ -74,8 +87,10 @@ export const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>(
|
|
|
74
87
|
<ShadCNComponents.Toggle.Toggle
|
|
75
88
|
className={cn(
|
|
76
89
|
className,
|
|
77
|
-
"data-[state=open]:bg-accent data-[state=closed]:text-accent-foreground"
|
|
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" : ""
|
|
78
92
|
)}
|
|
93
|
+
size={variant === "compact" ? "sm" : "default"}
|
|
79
94
|
aria-label={label}
|
|
80
95
|
onClick={onClick}
|
|
81
96
|
pressed={isSelected}
|
|
@@ -95,7 +110,9 @@ export const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>(
|
|
|
95
110
|
{trigger}
|
|
96
111
|
</ShadCNComponents.Tooltip.TooltipTrigger>
|
|
97
112
|
<ShadCNComponents.Tooltip.TooltipContent
|
|
98
|
-
className={
|
|
113
|
+
className={
|
|
114
|
+
"bn-flex bn-flex-col bn-items-center bn-whitespace-pre-wrap"
|
|
115
|
+
}>
|
|
99
116
|
<span>{mainTooltip}</span>
|
|
100
117
|
{secondaryTooltip && <span>{secondaryTooltip}</span>}
|
|
101
118
|
</ShadCNComponents.Tooltip.TooltipContent>
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Badge as ShadCNBadge } from "./components/ui/badge.js";
|
|
3
|
+
import { Skeleton as ShadCNSkeleton } from "./components/ui/skeleton.js";
|
|
3
4
|
export declare const ShadCNDefaultComponents: {
|
|
5
|
+
Avatar: {
|
|
6
|
+
Avatar: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-avatar").AvatarProps & import("react").RefAttributes<HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
7
|
+
AvatarFallback: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-avatar").AvatarFallbackProps & import("react").RefAttributes<HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
8
|
+
AvatarImage: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-avatar").AvatarImageProps & import("react").RefAttributes<HTMLImageElement>, "ref"> & import("react").RefAttributes<HTMLImageElement>>;
|
|
9
|
+
};
|
|
4
10
|
Badge: {
|
|
5
11
|
Badge: typeof ShadCNBadge;
|
|
6
12
|
};
|
|
@@ -50,6 +56,9 @@ export declare const ShadCNDefaultComponents: {
|
|
|
50
56
|
SelectTrigger: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-select").SelectTriggerProps & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
51
57
|
SelectValue: import("react").ForwardRefExoticComponent<import("@radix-ui/react-select").SelectValueProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
52
58
|
};
|
|
59
|
+
Skeleton: {
|
|
60
|
+
Skeleton: typeof ShadCNSkeleton;
|
|
61
|
+
};
|
|
53
62
|
Tabs: {
|
|
54
63
|
Tabs: import("react").ForwardRefExoticComponent<import("@radix-ui/react-tabs").TabsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
55
64
|
TabsContent: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-tabs").TabsContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -71,6 +80,11 @@ export declare const ShadCNDefaultComponents: {
|
|
|
71
80
|
};
|
|
72
81
|
export type ShadCNComponents = typeof ShadCNDefaultComponents;
|
|
73
82
|
export declare const ShadCNComponentsContext: import("react").Context<{
|
|
83
|
+
Avatar: {
|
|
84
|
+
Avatar: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-avatar").AvatarProps & import("react").RefAttributes<HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
85
|
+
AvatarFallback: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-avatar").AvatarFallbackProps & import("react").RefAttributes<HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
86
|
+
AvatarImage: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-avatar").AvatarImageProps & import("react").RefAttributes<HTMLImageElement>, "ref"> & import("react").RefAttributes<HTMLImageElement>>;
|
|
87
|
+
};
|
|
74
88
|
Badge: {
|
|
75
89
|
Badge: typeof ShadCNBadge;
|
|
76
90
|
};
|
|
@@ -120,6 +134,9 @@ export declare const ShadCNComponentsContext: import("react").Context<{
|
|
|
120
134
|
SelectTrigger: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-select").SelectTriggerProps & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
121
135
|
SelectValue: import("react").ForwardRefExoticComponent<import("@radix-ui/react-select").SelectValueProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
122
136
|
};
|
|
137
|
+
Skeleton: {
|
|
138
|
+
Skeleton: typeof ShadCNSkeleton;
|
|
139
|
+
};
|
|
123
140
|
Tabs: {
|
|
124
141
|
Tabs: import("react").ForwardRefExoticComponent<import("@radix-ui/react-tabs").TabsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
125
142
|
TabsContent: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-tabs").TabsContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -140,6 +157,11 @@ export declare const ShadCNComponentsContext: import("react").Context<{
|
|
|
140
157
|
};
|
|
141
158
|
} | undefined>;
|
|
142
159
|
export declare function useShadCNComponentsContext(): {
|
|
160
|
+
Avatar: {
|
|
161
|
+
Avatar: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-avatar").AvatarProps & import("react").RefAttributes<HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
162
|
+
AvatarFallback: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-avatar").AvatarFallbackProps & import("react").RefAttributes<HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
163
|
+
AvatarImage: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-avatar").AvatarImageProps & import("react").RefAttributes<HTMLImageElement>, "ref"> & import("react").RefAttributes<HTMLImageElement>>;
|
|
164
|
+
};
|
|
143
165
|
Badge: {
|
|
144
166
|
Badge: typeof ShadCNBadge;
|
|
145
167
|
};
|
|
@@ -189,6 +211,9 @@ export declare function useShadCNComponentsContext(): {
|
|
|
189
211
|
SelectTrigger: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-select").SelectTriggerProps & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
190
212
|
SelectValue: import("react").ForwardRefExoticComponent<import("@radix-ui/react-select").SelectValueProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
191
213
|
};
|
|
214
|
+
Skeleton: {
|
|
215
|
+
Skeleton: typeof ShadCNSkeleton;
|
|
216
|
+
};
|
|
192
217
|
Tabs: {
|
|
193
218
|
Tabs: import("react").ForwardRefExoticComponent<import("@radix-ui/react-tabs").TabsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
194
219
|
TabsContent: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-tabs").TabsContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Badge: import("react").ForwardRefExoticComponent<{
|
|
3
|
+
className?: string | undefined;
|
|
4
|
+
text: string;
|
|
5
|
+
icon?: import("react").ReactNode;
|
|
6
|
+
isSelected?: boolean | undefined;
|
|
7
|
+
mainTooltip?: string | undefined;
|
|
8
|
+
secondaryTooltip?: string | undefined;
|
|
9
|
+
onClick?: ((event: import("react").MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
10
|
+
onMouseEnter?: (() => void) | undefined;
|
|
11
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
export declare const BadgeGroup: import("react").ForwardRefExoticComponent<{
|
|
13
|
+
className?: string | undefined;
|
|
14
|
+
children: import("react").ReactNode;
|
|
15
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Card: import("react").ForwardRefExoticComponent<{
|
|
3
|
+
className?: string | undefined;
|
|
4
|
+
children?: import("react").ReactNode;
|
|
5
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export declare const CardSection: import("react").ForwardRefExoticComponent<{
|
|
7
|
+
className?: string | undefined;
|
|
8
|
+
children?: import("react").ReactNode;
|
|
9
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Comment: import("react").ForwardRefExoticComponent<{
|
|
3
|
+
className?: string | undefined;
|
|
4
|
+
children?: import("react").ReactNode;
|
|
5
|
+
authorInfo: "loading" | import("@blocknote/core/types/src/comments/index.js").User;
|
|
6
|
+
timeString: string;
|
|
7
|
+
actions?: import("react").ReactNode;
|
|
8
|
+
showActions?: boolean | "hover" | undefined;
|
|
9
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Editor: import("react").ForwardRefExoticComponent<{
|
|
3
|
+
className?: string | undefined;
|
|
4
|
+
editable: boolean;
|
|
5
|
+
editor: import("@blocknote/core").BlockNoteEditor<any, any, any>;
|
|
6
|
+
onFocus?: (() => void) | undefined;
|
|
7
|
+
onBlur?: (() => void) | undefined;
|
|
8
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
3
|
+
declare const Avatar: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
4
|
+
declare const AvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
|
|
5
|
+
declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
6
|
+
export { Avatar, AvatarImage, AvatarFallback };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type VariantProps } from "class-variance-authority";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "
|
|
4
|
+
variant?: "link" | "default" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
|
|
5
5
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/dist/types.js").ClassProp) | undefined) => string;
|
|
7
7
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const MenuButton: import("react").ForwardRefExoticComponent<({
|
|
3
|
+
className?: string | undefined;
|
|
4
|
+
onClick?: ((e: import("react").MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
5
|
+
icon?: import("react").ReactNode;
|
|
6
|
+
onDragStart?: ((e: import("react").DragEvent<Element>) => void) | undefined;
|
|
7
|
+
onDragEnd?: ((e: import("react").DragEvent<Element>) => void) | undefined;
|
|
8
|
+
draggable?: boolean | undefined;
|
|
9
|
+
} & ({
|
|
10
|
+
children: import("react").ReactNode;
|
|
11
|
+
label?: string | undefined;
|
|
12
|
+
} | {
|
|
13
|
+
children?: undefined;
|
|
14
|
+
label: string;
|
|
15
|
+
})) & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -4,15 +4,17 @@ export declare const Toolbar: import("react").ForwardRefExoticComponent<{
|
|
|
4
4
|
children?: import("react").ReactNode;
|
|
5
5
|
onMouseEnter?: (() => void) | undefined;
|
|
6
6
|
onMouseLeave?: (() => void) | undefined;
|
|
7
|
+
variant?: "default" | "action-toolbar" | undefined;
|
|
7
8
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
9
|
export declare const ToolbarButton: import("react").ForwardRefExoticComponent<({
|
|
9
10
|
className?: string | undefined;
|
|
10
|
-
mainTooltip
|
|
11
|
+
mainTooltip?: string | undefined;
|
|
11
12
|
secondaryTooltip?: string | undefined;
|
|
12
13
|
icon?: import("react").ReactNode;
|
|
13
14
|
onClick?: ((e: import("react").MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
14
15
|
isSelected?: boolean | undefined;
|
|
15
16
|
isDisabled?: boolean | undefined;
|
|
17
|
+
variant?: "default" | "compact" | undefined;
|
|
16
18
|
} & ({
|
|
17
19
|
children: import("react").ReactNode;
|
|
18
20
|
label?: string | undefined;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(function(m,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react/jsx-runtime"),require("@blocknote/core"),require("@blocknote/react"),require("react"),require("react-hook-form"),require("class-variance-authority"),require("clsx"),require("tailwind-merge"),require("@radix-ui/react-slot"),require("@radix-ui/react-dropdown-menu"),require("lucide-react"),require("@radix-ui/react-label"),require("@radix-ui/react-popover"),require("@radix-ui/react-select"),require("@radix-ui/react-tabs"),require("@radix-ui/react-toggle"),require("@radix-ui/react-tooltip")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@blocknote/core","@blocknote/react","react","react-hook-form","class-variance-authority","clsx","tailwind-merge","@radix-ui/react-slot","@radix-ui/react-dropdown-menu","lucide-react","@radix-ui/react-label","@radix-ui/react-popover","@radix-ui/react-select","@radix-ui/react-tabs","@radix-ui/react-toggle","@radix-ui/react-tooltip"],o):(m=typeof globalThis<"u"?globalThis:m||self,o(m["blocknote-shadcn"]={},m.jsxRuntime,m.core,m.react,m.React,m.reactHookForm,m.classVarianceAuthority,m.clsx,m.tailwindMerge,m.reactSlot,m.DropdownMenuPrimitive,m.lucideReact,m.LabelPrimitive,m.PopoverPrimitive,m.SelectPrimitive,m.TabsPrimitive,m.TogglePrimitive,m.TooltipPrimitive))})(this,function(m,o,p,T,c,k,I,be,le,z,ce,N,pe,fe,ue,me,ge,he){"use strict";function C(n){if(n&&typeof n=="object"&&"default"in n)return n;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(t,e,r.get?r:{enumerable:!0,get:()=>n[e]})}}return t.default=n,Object.freeze(t)}const l=C(c),v=C(ce),j=C(pe),P=C(fe),w=C(ue),S=C(me),V=C(ge),M=C(he),ve=le.extendTailwindMerge({prefix:"bn-"});function i(...n){return ve(be.clsx(n))}const we=I.cva("bn-inline-flex bn-items-center bn-rounded-full bn-border bn-px-2.5 bn-py-0.5 bn-text-xs bn-font-semibold bn-transition-colors focus:bn-outline-none focus:bn-ring-2 focus:bn-ring-ring focus:bn-ring-offset-2",{variants:{variant:{default:"bn-border-transparent bn-bg-primary bn-text-primary-foreground hover:bn-bg-primary/80",secondary:"bn-border-transparent bn-bg-secondary bn-text-secondary-foreground hover:bn-bg-secondary/80",destructive:"bn-border-transparent bn-bg-destructive bn-text-destructive-foreground hover:bn-bg-destructive/80",outline:"bn-text-foreground"}},defaultVariants:{variant:"default"}});function xe({className:n,variant:t,...e}){return o.jsx("div",{className:i(we({variant:t}),n),...e})}const ye=I.cva("bn-inline-flex bn-items-center bn-justify-center bn-whitespace-nowrap bn-rounded-md bn-text-sm bn-font-medium bn-ring-offset-background bn-transition-colors 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",{variants:{variant:{default:"bn-bg-primary bn-text-primary-foreground hover:bn-bg-primary/90",destructive:"bn-bg-destructive bn-text-destructive-foreground hover:bn-bg-destructive/90",outline:"bn-border bn-border-input bn-bg-background hover:bn-bg-accent hover:bn-text-accent-foreground",secondary:"bn-bg-secondary bn-text-secondary-foreground hover:bn-bg-secondary/80",ghost:"hover:bn-bg-accent hover:bn-text-accent-foreground",link:"bn-text-primary bn-underline-offset-4 hover:bn-underline"},size:{default:"bn-h-10 bn-px-4 bn-py-2",sm:"bn-h-9 bn-rounded-md bn-px-3",lg:"bn-h-11 bn-rounded-md bn-px-8",icon:"bn-h-10 bn-w-10"}},defaultVariants:{variant:"default",size:"default"}}),q=l.forwardRef(({className:n,variant:t,size:e,asChild:r=!1,...a},s)=>{const d=r?z.Slot:"button";return o.jsx(d,{className:i(ye({variant:t,size:e,className:n})),ref:s,type:"button",...a})});q.displayName="Button";const _=l.forwardRef(({className:n,...t},e)=>o.jsx("div",{ref:e,className:i("bn-rounded-lg bn-border bn-bg-card bn-text-card-foreground bn-shadow-sm",n),...t}));_.displayName="Card";const Ne=l.forwardRef(({className:n,...t},e)=>o.jsx("div",{ref:e,className:i("bn-flex bn-flex-col bn-space-y-1.5 bn-p-6",n),...t}));Ne.displayName="CardHeader";const Ce=l.forwardRef(({className:n,...t},e)=>o.jsx("h3",{ref:e,className:i("bn-text-2xl bn-font-semibold bn-leading-none bn-tracking-tight",n),...t}));Ce.displayName="CardTitle";const Se=l.forwardRef(({className:n,...t},e)=>o.jsx("p",{ref:e,className:i("bn-text-sm bn-text-muted-foreground",n),...t}));Se.displayName="CardDescription";const $=l.forwardRef(({className:n,...t},e)=>o.jsx("div",{ref:e,className:i("bn-p-6 bn-pt-0",n),...t}));$.displayName="CardContent";const Te=l.forwardRef(({className:n,...t},e)=>o.jsx("div",{ref:e,className:i("bn-flex bn-items-center bn-p-6 bn-pt-0",n),...t}));Te.displayName="CardFooter";const Me=v.Root,De=v.Trigger,Ie=v.Sub,O=l.forwardRef(({className:n,inset:t,children:e,...r},a)=>o.jsxs(v.SubTrigger,{ref:a,className:i("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 focus:bn-bg-accent data-[state=open]:bn-bg-accent",t&&"bn-pl-8",n),...r,children:[e,o.jsx(N.ChevronRight,{className:"bn-ml-auto bn-h-4 bn-w-4"})]}));O.displayName=v.SubTrigger.displayName;const G=l.forwardRef(({className:n,...t},e)=>o.jsx(v.SubContent,{ref:e,className:i("bn-z-50 bn-min-w-[8rem] bn-overflow-hidden bn-rounded-md bn-border bn-bg-popover bn-p-1 bn-text-popover-foreground bn-shadow-lg 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",n),...t}));G.displayName=v.SubContent.displayName;const U=l.forwardRef(({className:n,sideOffset:t=4,...e},r)=>o.jsx(v.Content,{ref:r,sideOffset:t,className:i("bn-z-50 bn-min-w-[8rem] bn-overflow-hidden 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",n),...e}));U.displayName=v.Content.displayName;const H=l.forwardRef(({className:n,inset:t,...e},r)=>o.jsx(v.Item,{ref:r,className:i("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",t&&"bn-pl-8",n),...e}));H.displayName=v.Item.displayName;const K=l.forwardRef(({className:n,children:t,checked:e,...r},a)=>o.jsxs(v.CheckboxItem,{ref:a,className:i("bn-relative bn-flex 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 bn-transition-colors focus:bn-bg-accent focus:bn-text-accent-foreground data-[disabled]:bn-pointer-events-none data-[disabled]:bn-opacity-50",n),checked:e,...r,children:[o.jsx("span",{className:"bn-absolute bn-left-2 bn-flex bn-h-3.5 bn-w-3.5 bn-items-center bn-justify-center",children:o.jsx(v.ItemIndicator,{children:o.jsx(N.Check,{className:"bn-h-4 bn-w-4"})})}),t]}));K.displayName=v.CheckboxItem.displayName;const Pe=l.forwardRef(({className:n,children:t,...e},r)=>o.jsxs(v.RadioItem,{ref:r,className:i("bn-relative bn-flex 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 bn-transition-colors focus:bn-bg-accent focus:bn-text-accent-foreground data-[disabled]:bn-pointer-events-none data-[disabled]:bn-opacity-50",n),...e,children:[o.jsx("span",{className:"bn-absolute bn-left-2 bn-flex bn-h-3.5 bn-w-3.5 bn-items-center bn-justify-center",children:o.jsx(v.ItemIndicator,{children:o.jsx(N.Circle,{className:"bn-h-2 bn-w-2 bn-fill-current"})})}),t]}));Pe.displayName=v.RadioItem.displayName;const W=l.forwardRef(({className:n,inset:t,...e},r)=>o.jsx(v.Label,{ref:r,className:i("bn-px-2 bn-py-1.5 bn-text-sm bn-font-semibold",t&&"bn-pl-8",n),...e}));W.displayName=v.Label.displayName;const J=l.forwardRef(({className:n,...t},e)=>o.jsx(v.Separator,{ref:e,className:i("bn--mx-1 bn-my-1 bn-h-px bn-bg-muted",n),...t}));J.displayName=v.Separator.displayName;const Ee=I.cva("bn-text-sm bn-font-medium bn-leading-none peer-disabled:bn-cursor-not-allowed peer-disabled:bn-opacity-70"),F=l.forwardRef(({className:n,...t},e)=>o.jsx(j.Root,{ref:e,className:i(Ee(),n),...t}));F.displayName=j.Root.displayName;const ke=k.FormProvider,Fe=l.createContext({}),E=()=>{const n=l.useContext(Fe),t=l.useContext(Q),{getFieldState:e,formState:r}=k.useFormContext(),a=e(n.name,r);if(!n)throw new Error("useFormField should be used within <FormField>");const{id:s}=t;return{id:s,name:n.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...a}},Q=l.createContext({}),Be=l.forwardRef(({className:n,...t},e)=>{const r=l.useId();return o.jsx(Q.Provider,{value:{id:r},children:o.jsx("div",{ref:e,className:i("bn-space-y-2",n),...t})})});Be.displayName="FormItem";const Le=l.forwardRef(({className:n,...t},e)=>{const{error:r,formItemId:a}=E();return o.jsx(F,{ref:e,className:i(r&&"bn-text-destructive",n),htmlFor:a,...t})});Le.displayName="FormLabel";const ze=l.forwardRef(({...n},t)=>{const{error:e,formItemId:r,formDescriptionId:a,formMessageId:s}=E();return o.jsx(z.Slot,{ref:t,id:r,"aria-describedby":e?`${a} ${s}`:`${a}`,"aria-invalid":!!e,...n})});ze.displayName="FormControl";const je=l.forwardRef(({className:n,...t},e)=>{const{formDescriptionId:r}=E();return o.jsx("p",{ref:e,id:r,className:i("bn-text-sm bn-text-muted-foreground",n),...t})});je.displayName="FormDescription";const Ve=l.forwardRef(({className:n,children:t,...e},r)=>{const{error:a,formMessageId:s}=E(),d=a?String(a==null?void 0:a.message):t;return d?o.jsx("p",{ref:r,id:s,className:i("bn-text-sm bn-font-medium bn-text-destructive",n),...e,children:d}):null});Ve.displayName="FormMessage";const X=l.forwardRef(({className:n,type:t,...e},r)=>o.jsx("input",{type:t,className:i("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",n),ref:r,...e}));X.displayName="Input";const qe=P.Root,_e=P.Trigger,Y=l.forwardRef(({className:n,align:t="center",sideOffset:e=4,...r},a)=>o.jsx(P.Content,{ref:a,align:t,sideOffset:e,className:i("bn-z-50 bn-w-72 bn-rounded-md bn-border bn-bg-popover bn-p-4 bn-text-popover-foreground bn-shadow-md bn-outline-none 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",n),...r}));Y.displayName=P.Content.displayName;const $e=w.Root,Oe=w.Value,Z=l.forwardRef(({className:n,children:t,...e},r)=>o.jsxs(w.Trigger,{ref:r,className:i("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",n),...e,children:[t,o.jsx(w.Icon,{asChild:!0,children:o.jsx(N.ChevronDown,{className:"bn-h-4 bn-w-4 bn-opacity-50"})})]}));Z.displayName=w.Trigger.displayName;const A=l.forwardRef(({className:n,...t},e)=>o.jsx(w.ScrollUpButton,{ref:e,className:i("bn-flex bn-cursor-default bn-items-center bn-justify-center bn-py-1",n),...t,children:o.jsx(N.ChevronUp,{className:"bn-h-4 bn-w-4"})}));A.displayName=w.ScrollUpButton.displayName;const R=l.forwardRef(({className:n,...t},e)=>o.jsx(w.ScrollDownButton,{ref:e,className:i("bn-flex bn-cursor-default bn-items-center bn-justify-center bn-py-1",n),...t,children:o.jsx(N.ChevronDown,{className:"bn-h-4 bn-w-4"})}));R.displayName=w.ScrollDownButton.displayName;const ee=l.forwardRef(({className:n,children:t,position:e="popper",...r},a)=>o.jsxs(w.Content,{ref:a,className:i("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",e==="popper"&&"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",n),position:e,...r,children:[o.jsx(A,{}),o.jsx(w.Viewport,{className:i("bn-p-1",e==="popper"&&"bn-h-[var(--radix-select-trigger-height)] bn-w-full bn-min-w-[var(--radix-select-trigger-width)]"),children:t}),o.jsx(R,{})]}));ee.displayName=w.Content.displayName;const Ge=l.forwardRef(({className:n,...t},e)=>o.jsx(w.Label,{ref:e,className:i("bn-py-1.5 bn-pl-8 bn-pr-2 bn-text-sm bn-font-semibold",n),...t}));Ge.displayName=w.Label.displayName;const ne=l.forwardRef(({className:n,children:t,...e},r)=>o.jsxs(w.Item,{ref:r,className:i("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",n),...e,children:[o.jsx("span",{className:"bn-absolute bn-left-2 bn-flex bn-h-3.5 bn-w-3.5 bn-items-center bn-justify-center",children:o.jsx(w.ItemIndicator,{children:o.jsx(N.Check,{className:"bn-h-4 bn-w-4"})})}),o.jsx(w.ItemText,{children:t})]}));ne.displayName=w.Item.displayName;const Ue=l.forwardRef(({className:n,...t},e)=>o.jsx(w.Separator,{ref:e,className:i("bn--mx-1 bn-my-1 bn-h-px bn-bg-muted",n),...t}));Ue.displayName=w.Separator.displayName;const He=S.Root,te=l.forwardRef(({className:n,...t},e)=>o.jsx(S.List,{ref:e,className:i("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",n),...t}));te.displayName=S.List.displayName;const oe=l.forwardRef(({className:n,...t},e)=>o.jsx(S.Trigger,{ref:e,className:i("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",n),...t}));oe.displayName=S.Trigger.displayName;const re=l.forwardRef(({className:n,...t},e)=>o.jsx(S.Content,{ref:e,className:i("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",n),...t}));re.displayName=S.Content.displayName;const Ke=I.cva("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",{variants:{variant:{default:"bn-bg-transparent",outline:"bn-border bn-border-input bn-bg-transparent hover:bn-bg-accent hover:bn-text-accent-foreground"},size:{default:"bn-h-10 bn-px-3",sm:"bn-h-9 bn-px-2.5",lg:"bn-h-11 bn-px-5"}},defaultVariants:{variant:"default",size:"default"}}),ae=l.forwardRef(({className:n,variant:t,size:e,...r},a)=>o.jsx(V.Root,{ref:a,className:i(Ke({variant:t,size:e,className:n})),...r}));ae.displayName=V.Root.displayName;const We=M.Provider,Je=M.Root,Qe=M.Trigger,se=l.forwardRef(({className:n,sideOffset:t=4,...e},r)=>o.jsx(M.Content,{ref:r,sideOffset:t,className:i("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",n),...e}));se.displayName=M.Content.displayName;const Xe={Badge:{Badge:xe},Button:{Button:q},Card:{Card:_,CardContent:$},DropdownMenu:{DropdownMenu:Me,DropdownMenuCheckboxItem:K,DropdownMenuContent:U,DropdownMenuItem:H,DropdownMenuLabel:W,DropdownMenuSeparator:J,DropdownMenuSub:Ie,DropdownMenuSubContent:G,DropdownMenuSubTrigger:O,DropdownMenuTrigger:De},Form:{Form:ke},Input:{Input:X},Label:{Label:F},Popover:{Popover:qe,PopoverContent:Y,PopoverTrigger:_e},Select:{Select:$e,SelectContent:ee,SelectItem:ne,SelectTrigger:Z,SelectValue:Oe},Tabs:{Tabs:He,TabsContent:re,TabsList:te,TabsTrigger:oe},Toggle:{Toggle:ae},Tooltip:{Tooltip:Je,TooltipContent:se,TooltipProvider:We,TooltipTrigger:Qe}},de=c.createContext(void 0);function h(){return c.useContext(de)}const Ye=n=>{const{children:t,...e}=n;p.assertEmpty(e);const r=h(),a=k.useForm();return o.jsx(r.Form.Form,{...a,children:t})},Ze=c.forwardRef((n,t)=>{const{className:e,name:r,label:a,icon:s,value:d,autoFocus:u,placeholder:f,onKeyDown:b,onChange:g,onSubmit:x,...y}=n;p.assertEmpty(y);const D=h();return a?o.jsxs("div",{children:[o.jsx(D.Label.Label,{htmlFor:a,children:a}),o.jsx(D.Input.Input,{className:e,id:a,name:r,autoFocus:u,placeholder:f,value:d,onKeyDown:b,onChange:g,onSubmit:x})]}):o.jsx(D.Input.Input,{"aria-label":r,name:r,autoFocus:u,placeholder:f,value:d,onKeyDown:b,onChange:g,onSubmit:x,ref:t})}),Ae=n=>c.forwardRef((t,e)=>o.jsx(n,{onPointerDown:r=>{r.nativeEvent.fakeEvent||(r.ctrlKey=!0)},onPointerUp:r=>{const a=new PointerEvent("pointerdown",r.nativeEvent);a.fakeEvent=!0,r.target.dispatchEvent(a)},...t,ref:e})),Re=n=>{const{children:t,onOpenChange:e,position:r,sub:a,...s}=n;p.assertEmpty(s);const d=h();return a?o.jsx(d.DropdownMenu.DropdownMenuSub,{onOpenChange:e,children:t}):o.jsx(d.DropdownMenu.DropdownMenu,{onOpenChange:e,children:t})},en=n=>{const{children:t,sub:e,...r}=n;p.assertEmpty(r);const a=h(),s=c.useMemo(()=>Ae(a.DropdownMenu.DropdownMenuTrigger),[a.DropdownMenu.DropdownMenuTrigger]);return e?o.jsx(a.DropdownMenu.DropdownMenuSubTrigger,{children:t}):o.jsx(s,{asChild:!0,...r,children:t})},nn=c.forwardRef((n,t)=>{const{className:e,children:r,sub:a,...s}=n;p.assertEmpty(s);const d=h();return a?o.jsx(d.DropdownMenu.DropdownMenuSubContent,{className:e,ref:t,children:r}):o.jsx(d.DropdownMenu.DropdownMenuContent,{className:e,ref:t,children:r})}),tn=c.forwardRef((n,t)=>{const{className:e,children:r,icon:a,checked:s,subTrigger:d,onClick:u,...f}=n;p.assertEmpty(f);const b=h();return d?o.jsxs(o.Fragment,{children:[a,r]}):s!==void 0?o.jsxs(b.DropdownMenu.DropdownMenuCheckboxItem,{className:i(e,"bn-gap-1"),ref:t,checked:s,onClick:u,...f,children:[a,r]}):o.jsxs(b.DropdownMenu.DropdownMenuItem,{className:e,ref:t,onClick:u,...f,children:[a,r,d&&o.jsx(N.ChevronRight,{className:"bn-ml-auto bn-h-4 bn-w-4"})]})}),on=c.forwardRef((n,t)=>{const{className:e,...r}=n;p.assertEmpty(r);const a=h();return o.jsx(a.DropdownMenu.DropdownMenuSeparator,{className:e,ref:t})}),rn=c.forwardRef((n,t)=>{const{className:e,children:r,...a}=n;p.assertEmpty(a);const s=h();return o.jsx(s.DropdownMenu.DropdownMenuLabel,{className:e,ref:t,children:r})}),an=c.forwardRef((n,t)=>{const{className:e,tabs:r,defaultOpenTab:a,openTab:s,setOpenTab:d,loading:u,...f}=n;p.assertEmpty(f);const b=h();return o.jsxs(b.Tabs.Tabs,{className:i(e,"bn-bg-popover bn-p-2 bn-rounded-lg"),ref:t,value:s,defaultValue:a,onValueChange:d,children:[o.jsx(b.Tabs.TabsList,{children:r.map(g=>o.jsx(b.Tabs.TabsTrigger,{value:g.name,children:g.name},g.name))}),r.map(g=>o.jsx(b.Tabs.TabsContent,{value:g.name,children:o.jsx(b.Card.Card,{children:o.jsx(b.Card.CardContent,{className:"bn-p-4",children:g.tabPanel})})},g.name))]})}),sn=c.forwardRef((n,t)=>{const{className:e,children:r,...a}=n;return p.assertEmpty(a),o.jsx("div",{className:i(e,"bn-flex bn-flex-col bn-gap-2 bn-items-start bn-justify-center"),ref:t,children:r})}),dn=c.forwardRef((n,t)=>{const{className:e,value:r,placeholder:a,onKeyDown:s,onChange:d,...u}=n;p.assertEmpty(u);const f=h();return o.jsx(f.Input.Input,{"data-test":"embed-input",className:i(e,"bn-w-80"),ref:t,value:r,placeholder:a,onKeyDown:s,onChange:d})}),bn=n=>{const{children:t,opened:e,position:r,...a}=n;p.assertEmpty(a);const s=h();return o.jsx(s.Popover.Popover,{open:e,children:t})},ln=c.forwardRef((n,t)=>{const{children:e,...r}=n;p.assertEmpty(r);const a=h();return o.jsx(a.Popover.PopoverTrigger,{ref:t,asChild:!0,children:e})}),cn=c.forwardRef((n,t)=>{const{className:e,variant:r,children:a,...s}=n;p.assertEmpty(s);const d=h();return o.jsx(d.Popover.PopoverContent,{sideOffset:8,className:i(e,"bn-flex bn-flex-col bn-gap-2",r==="panel-popover"?"bn-p-0 bn-border-none bn-shadow-none bn-max-w-none bn-w-fit":""),ref:t,children:a})}),pn=c.forwardRef((n,t)=>{const{className:e,children:r,...a}=n;return p.assertEmpty(a,!1),o.jsx("div",{className:e,ref:t,...a,children:r})}),fn=c.forwardRef((n,t)=>{const{className:e,children:r,icon:a,onClick:s,onDragEnd:d,onDragStart:u,draggable:f,label:b,...g}=n;p.assertEmpty(g,!1);const x=h();return o.jsxs(x.Button.Button,{variant:"ghost",className:i(e,"bn-text-gray-400"),ref:t,"aria-label":b,onClick:s,onDragStart:u,onDragEnd:d,draggable:f,...g,children:[a,r]})}),un=c.forwardRef((n,t)=>{const{className:e,children:r,id:a,columns:s,...d}=n;return p.assertEmpty(d),o.jsx("div",{className:e,style:{gridTemplateColumns:`repeat(${s}, 1fr)`},ref:t,id:a,role:"grid",children:r})}),mn=c.forwardRef((n,t)=>{const{className:e,children:r,columns:a,...s}=n;return p.assertEmpty(s),o.jsx("div",{className:e,style:{gridColumn:`1 / ${a+1}`},ref:t,children:r})}),gn=c.forwardRef((n,t)=>{const{className:e,children:r,id:a,...s}=n;return p.assertEmpty(s),o.jsx("div",{id:a,role:"listbox",className:i("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",e),ref:t,children:r})}),hn=c.forwardRef((n,t)=>{const{className:e,children:r,...a}=n;return p.assertEmpty(a),o.jsx("div",{className:i("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",e),ref:t,children:o.jsx("div",{children:r})})}),vn=c.forwardRef((n,t)=>{const e=h(),{className:r,item:a,isSelected:s,onClick:d,id:u,...f}=n;p.assertEmpty(f);const b=c.useRef(null);return c.useEffect(()=>{if(!b.current||!s)return;const g=T.elementOverflow(b.current,document.querySelector(".bn-suggestion-menu"));g==="top"?b.current.scrollIntoView(!0):g==="bottom"&&b.current.scrollIntoView(!1)},[s]),o.jsxs("div",{className:i("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",r),ref:T.mergeRefs([t,b]),id:u,onClick:d,role:"option","aria-selected":s||void 0,children:[a.icon&&o.jsx("div",{className:"bn-p-3","data-position":"left",children:a.icon}),o.jsxs("div",{className:"bn-flex-1",children:[o.jsx("div",{className:"bn-text-base",children:a.title}),o.jsx("div",{className:"bn-text-xs",children:a.subtext})]}),a.badge&&o.jsx("div",{"data-position":"right",className:"bn-text-xs",children:o.jsx(e.Badge.Badge,{variant:"secondary",children:a.badge})})]})}),wn=c.forwardRef((n,t)=>{const{className:e,children:r,...a}=n;return p.assertEmpty(a),o.jsx("div",{className:i("bn-px-2 bn-py-1.5 bn-text-sm bn-font-semibold",e),ref:t,children:r})}),xn=c.forwardRef((n,t)=>{const{className:e,children:r,...a}=n;return p.assertEmpty(a),o.jsx("div",{className:e,ref:t,children:r})}),yn=c.forwardRef((n,t)=>{const{className:e,children:r,onMouseDown:a,onClick:s,...d}=n;p.assertEmpty(d,!1);const u=h();return o.jsx(u.Button.Button,{variant:"ghost",className:i(e,"bn-p-0 bn-h-full bn-w-full bn-text-gray-400",e!=null&&e.includes("bn-extend-button-add-remove-columns")?"bn-ml-1":"bn-mt-1",e!=null&&e.includes("bn-extend-button-editing")?"bn-bg-accent bn-text-accent-foreground":""),ref:t,onClick:s,onMouseDown:a,...d,children:r})}),Nn=c.forwardRef((n,t)=>{const{className:e,children:r,draggable:a,onDragStart:s,onDragEnd:d,style:u,label:f,...b}=n;p.assertEmpty(b,!1);const g=h();return o.jsx(g.Button.Button,{variant:"ghost",className:i(e,"bn-p-0 bn-h-fit bn-w-fit bn-text-gray-400"),ref:t,"aria-label":f,draggable:a,onDragStart:s,onDragEnd:d,style:u,...b,children:r})}),B=c.forwardRef((n,t)=>{const{className:e,children:r,onMouseEnter:a,onMouseLeave:s,...d}=n;p.assertEmpty(d);const u=h();return o.jsx(u.Tooltip.TooltipProvider,{delayDuration:0,children:o.jsx("div",{className:i(e,"bn-flex bn-gap-1 bn-p-1 bn-bg-popover bn-text-popover-foreground bn-border bn-rounded-lg bn-shadow-md"),ref:t,onMouseEnter:a,onMouseLeave:s,children:r})})}),L=c.forwardRef((n,t)=>{const{className:e,children:r,mainTooltip:a,secondaryTooltip:s,icon:d,isSelected:u,isDisabled:f,onClick:b,label:g,...x}=n;p.assertEmpty(x,!1);const y=h(),D=u===void 0?o.jsxs(y.Button.Button,{className:e,variant:"ghost",disabled:f,onClick:b,ref:t,"aria-label":g,...x,children:[d,r]}):o.jsxs(y.Toggle.Toggle,{className:i(e,"data-[state=open]:bg-accent data-[state=closed]:text-accent-foreground"),"aria-label":g,onClick:b,pressed:u,disabled:f,"data-state":u?"on":"off","data-disabled":f,ref:t,...x,children:[d,r]});return o.jsxs(y.Tooltip.Tooltip,{children:[o.jsx(y.Tooltip.TooltipTrigger,{asChild:!0,children:D}),o.jsxs(y.Tooltip.TooltipContent,{className:"bn-flex bn-flex-col bn-items-center",children:[o.jsx("span",{children:a}),s&&o.jsx("span",{children:s})]})]})}),Cn=c.forwardRef((n,t)=>{const{className:e,items:r,isDisabled:a,...s}=n;p.assertEmpty(s);const d=h(),u=b=>o.jsxs("div",{className:"bn-flex bn-gap-1 bn-items-center",children:[b.icon,b.text]}),f=r.filter(b=>b.isSelected)[0];return f?o.jsxs(d.Select.Select,{value:f.text,onValueChange:b=>{var g,x;return(x=(g=r.find(y=>y.text===b)).onClick)==null?void 0:x.call(g)},disabled:a,children:[o.jsx(d.Select.SelectTrigger,{className:"bn-border-none",children:o.jsx(d.Select.SelectValue,{})}),o.jsx(d.Select.SelectContent,{className:e,ref:t,children:r.map(b=>o.jsx(d.Select.SelectItem,{disabled:b.isDisabled,value:b.text,children:o.jsx(u,{...b})},b.text))})]}):null}),Sn=c.forwardRef((n,t)=>{const{className:e,children:r,onClick:a,label:s,...d}=n;p.assertEmpty(d);const u=h();return o.jsx(u.Button.Button,{type:"submit",className:e,"aria-label":s,ref:t,onClick:a,children:r})}),Tn=c.forwardRef((n,t)=>{const{className:e,accept:r,value:a,placeholder:s,onChange:d,...u}=n;p.assertEmpty(u);const f=h();return o.jsx(f.Input.Input,{type:"file",className:e,ref:t,accept:r,value:a?a.name:void 0,onChange:async b=>d==null?void 0:d(b.target.files[0]),placeholder:s})}),Mn=c.forwardRef((n,t)=>{const{className:e,isSelected:r,onClick:a,item:s,id:d,...u}=n;p.assertEmpty(u);const f=c.useRef(null);return c.useEffect(()=>{if(!f.current||!r)return;const b=T.elementOverflow(f.current,document.querySelector(".bn-grid-suggestion-menu"));b==="top"?f.current.scrollIntoView(!0):b==="bottom"&&f.current.scrollIntoView(!1)},[r]),o.jsx("div",{className:e,ref:T.mergeRefs([t,f]),id:d,role:"option",onClick:a,"aria-selected":r||void 0,children:s.icon})}),Dn=c.forwardRef((n,t)=>{const{className:e,children:r,columns:a,...s}=n;return p.assertEmpty(s),o.jsx("div",{className:e,style:{gridColumn:`1 / ${a+1}`},ref:t,children:r})}),ie={FormattingToolbar:{Root:B,Button:L,Select:Cn},FilePanel:{Root:an,Button:Sn,FileInput:Tn,TabPanel:sn,TextInput:dn},LinkToolbar:{Root:B,Button:L},SideMenu:{Root:pn,Button:fn},SuggestionMenu:{Root:gn,Item:vn,EmptyItem:hn,Label:wn,Loader:xn},GridSuggestionMenu:{Root:un,Item:Mn,EmptyItem:mn,Loader:Dn},TableHandle:{Root:Nn,ExtendButton:yn},Generic:{Toolbar:{Root:B,Button:L},Form:{Root:Ye,TextInput:Ze},Menu:{Root:Re,Trigger:en,Dropdown:nn,Divider:on,Label:rn,Item:tn},Popover:{Root:bn,Trigger:ln,Content:cn}}},In=n=>{const{className:t,shadCNComponents:e,...r}=n,a=c.useMemo(()=>({...Xe,...e}),[e]);return o.jsx(de.Provider,{value:a,children:o.jsx(T.ComponentsContext.Provider,{value:ie,children:o.jsx(T.BlockNoteViewRaw,{className:p.mergeCSSClasses("bn-shadcn",t||""),...r})})})};m.BlockNoteView=In,m.components=ie,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
-
//# sourceMappingURL=blocknote-shadcn.umd.cjs.map
|