@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,30 +1,31 @@
1
+ import * as React from "react";
1
2
  import { Slot } from "@radix-ui/react-slot";
2
3
  import { cva, type VariantProps } from "class-variance-authority";
3
- import * as React from "react";
4
4
 
5
- import { cn } from "../../lib/utils.js";
5
+ import { cn } from "../../lib/utils";
6
6
 
7
7
  const buttonVariants = cva(
8
- "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",
8
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
9
9
  {
10
10
  variants: {
11
11
  variant: {
12
12
  default:
13
- "bn-bg-primary bn-text-primary-foreground hover:bn-bg-primary/90",
13
+ "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
14
14
  destructive:
15
- "bn-bg-destructive bn-text-destructive-foreground hover:bn-bg-destructive/90",
15
+ "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
16
16
  outline:
17
- "bn-border bn-border-input bn-bg-background hover:bn-bg-accent hover:bn-text-accent-foreground",
17
+ "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
18
18
  secondary:
19
- "bn-bg-secondary bn-text-secondary-foreground hover:bn-bg-secondary/80",
20
- ghost: "hover:bn-bg-accent hover:bn-text-accent-foreground",
21
- link: "bn-text-primary bn-underline-offset-4 hover:bn-underline",
19
+ "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
20
+ ghost:
21
+ "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
22
+ link: "text-primary underline-offset-4 hover:underline",
22
23
  },
23
24
  size: {
24
- default: "bn-h-10 bn-px-4 bn-py-2",
25
- sm: "bn-h-9 bn-rounded-md bn-px-3",
26
- lg: "bn-h-11 bn-rounded-md bn-px-8",
27
- icon: "bn-h-10 bn-w-10",
25
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
26
+ sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
27
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
28
+ icon: "size-9",
28
29
  },
29
30
  },
30
31
  defaultVariants: {
@@ -34,25 +35,25 @@ const buttonVariants = cva(
34
35
  },
35
36
  );
36
37
 
37
- export interface ButtonProps
38
- extends React.ButtonHTMLAttributes<HTMLButtonElement>,
39
- VariantProps<typeof buttonVariants> {
40
- asChild?: boolean;
41
- }
38
+ function Button({
39
+ className,
40
+ variant,
41
+ size,
42
+ asChild = false,
43
+ ...props
44
+ }: React.ComponentProps<"button"> &
45
+ VariantProps<typeof buttonVariants> & {
46
+ asChild?: boolean;
47
+ }) {
48
+ const Comp = asChild ? Slot : "button";
42
49
 
43
- const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
44
- ({ className, variant, size, asChild = false, ...props }, ref) => {
45
- const Comp = asChild ? Slot : "button";
46
- return (
47
- <Comp
48
- className={cn(buttonVariants({ variant, size, className }))}
49
- ref={ref}
50
- type="button"
51
- {...props}
52
- />
53
- );
54
- },
55
- );
56
- Button.displayName = "Button";
50
+ return (
51
+ <Comp
52
+ data-slot="button"
53
+ className={cn(buttonVariants({ variant, size, className }))}
54
+ {...props}
55
+ />
56
+ );
57
+ }
57
58
 
58
59
  export { Button, buttonVariants };
@@ -1,86 +1,92 @@
1
1
  import * as React from "react";
2
2
 
3
- import { cn } from "../../lib/utils.js";
3
+ import { cn } from "../../lib/utils";
4
4
 
5
- const Card = React.forwardRef<
6
- HTMLDivElement,
7
- React.HTMLAttributes<HTMLDivElement>
8
- >(({ className, ...props }, ref) => (
9
- <div
10
- ref={ref}
11
- className={cn(
12
- "bn-rounded-lg bn-border bn-bg-card bn-text-card-foreground bn-shadow-sm",
13
- className,
14
- )}
15
- {...props}
16
- />
17
- ));
18
- Card.displayName = "Card";
5
+ function Card({ className, ...props }: React.ComponentProps<"div">) {
6
+ return (
7
+ <div
8
+ data-slot="card"
9
+ className={cn(
10
+ "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
11
+ className,
12
+ )}
13
+ {...props}
14
+ />
15
+ );
16
+ }
19
17
 
20
- const CardHeader = React.forwardRef<
21
- HTMLDivElement,
22
- React.HTMLAttributes<HTMLDivElement>
23
- >(({ className, ...props }, ref) => (
24
- <div
25
- ref={ref}
26
- className={cn("bn-flex bn-flex-col bn-space-y-1.5 bn-p-6", className)}
27
- {...props}
28
- />
29
- ));
30
- CardHeader.displayName = "CardHeader";
18
+ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
19
+ return (
20
+ <div
21
+ data-slot="card-header"
22
+ className={cn(
23
+ "@container/card-header has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6 grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6",
24
+ className,
25
+ )}
26
+ {...props}
27
+ />
28
+ );
29
+ }
31
30
 
32
- const CardTitle = React.forwardRef<
33
- HTMLParagraphElement,
34
- React.HTMLAttributes<HTMLHeadingElement>
35
- >(({ className, ...props }, ref) => (
36
- <h3
37
- ref={ref}
38
- className={cn(
39
- "bn-text-2xl bn-font-semibold bn-leading-none bn-tracking-tight",
40
- className,
41
- )}
42
- {...props}
43
- />
44
- ));
45
- CardTitle.displayName = "CardTitle";
31
+ function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
32
+ return (
33
+ <div
34
+ data-slot="card-title"
35
+ className={cn("font-semibold leading-none", className)}
36
+ {...props}
37
+ />
38
+ );
39
+ }
46
40
 
47
- const CardDescription = React.forwardRef<
48
- HTMLParagraphElement,
49
- React.HTMLAttributes<HTMLParagraphElement>
50
- >(({ className, ...props }, ref) => (
51
- <p
52
- ref={ref}
53
- className={cn("bn-text-sm bn-text-muted-foreground", className)}
54
- {...props}
55
- />
56
- ));
57
- CardDescription.displayName = "CardDescription";
41
+ function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
42
+ return (
43
+ <div
44
+ data-slot="card-description"
45
+ className={cn("text-muted-foreground text-sm", className)}
46
+ {...props}
47
+ />
48
+ );
49
+ }
58
50
 
59
- const CardContent = React.forwardRef<
60
- HTMLDivElement,
61
- React.HTMLAttributes<HTMLDivElement>
62
- >(({ className, ...props }, ref) => (
63
- <div ref={ref} className={cn("bn-p-6 bn-pt-0", className)} {...props} />
64
- ));
65
- CardContent.displayName = "CardContent";
51
+ function CardAction({ className, ...props }: React.ComponentProps<"div">) {
52
+ return (
53
+ <div
54
+ data-slot="card-action"
55
+ className={cn(
56
+ "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
57
+ className,
58
+ )}
59
+ {...props}
60
+ />
61
+ );
62
+ }
66
63
 
67
- const CardFooter = React.forwardRef<
68
- HTMLDivElement,
69
- React.HTMLAttributes<HTMLDivElement>
70
- >(({ className, ...props }, ref) => (
71
- <div
72
- ref={ref}
73
- className={cn("bn-flex bn-items-center bn-p-6 bn-pt-0", className)}
74
- {...props}
75
- />
76
- ));
77
- CardFooter.displayName = "CardFooter";
64
+ function CardContent({ className, ...props }: React.ComponentProps<"div">) {
65
+ return (
66
+ <div
67
+ data-slot="card-content"
68
+ className={cn("px-6", className)}
69
+ {...props}
70
+ />
71
+ );
72
+ }
73
+
74
+ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
75
+ return (
76
+ <div
77
+ data-slot="card-footer"
78
+ className={cn("[.border-t]:pt-6 flex items-center px-6", className)}
79
+ {...props}
80
+ />
81
+ );
82
+ }
78
83
 
79
84
  export {
80
85
  Card,
81
- CardContent,
82
- CardDescription,
83
- CardFooter,
84
86
  CardHeader,
87
+ CardFooter,
85
88
  CardTitle,
89
+ CardAction,
90
+ CardDescription,
91
+ CardContent,
86
92
  };