@blocknote/shadcn 0.30.0 → 0.31.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 (51) 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 +550 -498
  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 +5 -4
  8. package/src/BlockNoteView.tsx +2 -2
  9. package/src/badge/Badge.tsx +8 -7
  10. package/src/comments/Card.tsx +9 -6
  11. package/src/comments/Comment.tsx +10 -5
  12. package/src/comments/Editor.tsx +3 -2
  13. package/src/components/ui/avatar.tsx +3 -3
  14. package/src/components/ui/badge.tsx +1 -1
  15. package/src/components/ui/button.tsx +2 -2
  16. package/src/components/ui/card.tsx +2 -2
  17. package/src/components/ui/dropdown-menu.tsx +14 -11
  18. package/src/components/ui/form.tsx +6 -5
  19. package/src/components/ui/input.tsx +2 -2
  20. package/src/components/ui/label.tsx +1 -1
  21. package/src/components/ui/popover.tsx +1 -1
  22. package/src/components/ui/select.tsx +19 -13
  23. package/src/components/ui/skeleton.tsx +1 -1
  24. package/src/components/ui/tabs.tsx +3 -3
  25. package/src/components/ui/toggle.tsx +1 -1
  26. package/src/components/ui/tooltip.tsx +1 -1
  27. package/src/form/TextInput.tsx +34 -31
  28. package/src/menu/Button.tsx +2 -1
  29. package/src/menu/Menu.tsx +18 -11
  30. package/src/panel/Panel.tsx +2 -1
  31. package/src/panel/PanelButton.tsx +2 -1
  32. package/src/panel/PanelTab.tsx +3 -2
  33. package/src/popover/popover.tsx +5 -4
  34. package/src/sideMenu/SideMenuButton.tsx +2 -1
  35. package/src/style.css +5 -0
  36. package/src/suggestionMenu/SuggestionMenu.tsx +3 -2
  37. package/src/suggestionMenu/SuggestionMenuEmptyItem.tsx +3 -2
  38. package/src/suggestionMenu/SuggestionMenuItem.tsx +32 -6
  39. package/src/suggestionMenu/SuggestionMenuLabel.tsx +2 -1
  40. package/src/suggestionMenu/SuggestionMenuLoader.tsx +14 -3
  41. package/src/suggestionMenu/gridSuggestionMenu/GridSuggestionMenu.tsx +2 -1
  42. package/src/suggestionMenu/gridSuggestionMenu/GridSuggestionMenuEmptyItem.tsx +2 -1
  43. package/src/suggestionMenu/gridSuggestionMenu/GridSuggestionMenuItem.tsx +3 -2
  44. package/src/suggestionMenu/gridSuggestionMenu/GridSuggestionMenuLoader.tsx +2 -1
  45. package/src/tableHandle/ExtendButton.tsx +3 -2
  46. package/src/tableHandle/TableHandle.tsx +2 -1
  47. package/src/tailwindStyles.css +25 -25
  48. package/src/toolbar/Toolbar.tsx +19 -15
  49. package/types/src/form/TextInput.d.ts +5 -1
  50. package/types/src/suggestionMenu/SuggestionMenuItem.d.ts +1 -1
  51. package/types/src/suggestionMenu/SuggestionMenuLoader.d.ts +0 -1
@@ -5,7 +5,7 @@ import * as React from "react";
5
5
  import { cn } from "../../lib/utils.js";
6
6
 
7
7
  const labelVariants = cva(
8
- "bn-text-sm bn-font-medium bn-leading-none peer-disabled:bn-cursor-not-allowed peer-disabled:bn-opacity-70"
8
+ "bn-text-sm bn-font-medium bn-leading-none peer-disabled:bn-cursor-not-allowed peer-disabled:bn-opacity-70",
9
9
  );
10
10
 
11
11
  const Label = React.forwardRef<
@@ -18,7 +18,7 @@ const PopoverContent = React.forwardRef<
18
18
  sideOffset={sideOffset}
19
19
  className={cn(
20
20
  "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",
21
- className
21
+ className,
22
22
  )}
23
23
  {...props}
24
24
  />
@@ -18,9 +18,10 @@ const SelectTrigger = React.forwardRef<
18
18
  ref={ref}
19
19
  className={cn(
20
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
- className
21
+ className,
22
22
  )}
23
- {...props}>
23
+ {...props}
24
+ >
24
25
  {children}
25
26
  <SelectPrimitive.Icon asChild>
26
27
  <ChevronDown className="bn-h-4 bn-w-4 bn-opacity-50" />
@@ -37,9 +38,10 @@ const SelectScrollUpButton = React.forwardRef<
37
38
  ref={ref}
38
39
  className={cn(
39
40
  "bn-flex bn-cursor-default bn-items-center bn-justify-center bn-py-1",
40
- className
41
+ className,
41
42
  )}
42
- {...props}>
43
+ {...props}
44
+ >
43
45
  <ChevronUp className="bn-h-4 bn-w-4" />
44
46
  </SelectPrimitive.ScrollUpButton>
45
47
  ));
@@ -53,9 +55,10 @@ const SelectScrollDownButton = React.forwardRef<
53
55
  ref={ref}
54
56
  className={cn(
55
57
  "bn-flex bn-cursor-default bn-items-center bn-justify-center bn-py-1",
56
- className
58
+ className,
57
59
  )}
58
- {...props}>
60
+ {...props}
61
+ >
59
62
  <ChevronDown className="bn-h-4 bn-w-4" />
60
63
  </SelectPrimitive.ScrollDownButton>
61
64
  ));
@@ -73,17 +76,19 @@ const SelectContent = React.forwardRef<
73
76
  "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
77
  position === "popper" &&
75
78
  "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
- className
79
+ className,
77
80
  )}
78
81
  position={position}
79
- {...props}>
82
+ {...props}
83
+ >
80
84
  <SelectScrollUpButton />
81
85
  <SelectPrimitive.Viewport
82
86
  className={cn(
83
87
  "bn-p-1",
84
88
  position === "popper" &&
85
- "bn-h-[var(--radix-select-trigger-height)] bn-w-full bn-min-w-[var(--radix-select-trigger-width)]"
86
- )}>
89
+ "bn-h-[var(--radix-select-trigger-height)] bn-w-full bn-min-w-[var(--radix-select-trigger-width)]",
90
+ )}
91
+ >
87
92
  {children}
88
93
  </SelectPrimitive.Viewport>
89
94
  <SelectScrollDownButton />
@@ -100,7 +105,7 @@ const SelectLabel = React.forwardRef<
100
105
  ref={ref}
101
106
  className={cn(
102
107
  "bn-py-1.5 bn-pl-8 bn-pr-2 bn-text-sm bn-font-semibold",
103
- className
108
+ className,
104
109
  )}
105
110
  {...props}
106
111
  />
@@ -115,9 +120,10 @@ const SelectItem = React.forwardRef<
115
120
  ref={ref}
116
121
  className={cn(
117
122
  "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",
118
- className
123
+ className,
119
124
  )}
120
- {...props}>
125
+ {...props}
126
+ >
121
127
  <span className="bn-absolute bn-left-2 bn-flex bn-h-3.5 bn-w-3.5 bn-items-center bn-justify-center">
122
128
  <SelectPrimitive.ItemIndicator>
123
129
  <Check className="bn-h-4 bn-w-4" />
@@ -6,7 +6,7 @@ function Skeleton({
6
6
  }: React.HTMLAttributes<HTMLDivElement>) {
7
7
  return (
8
8
  <div
9
- className={cn("animate-pulse rounded-md bg-primary/10", className)}
9
+ className={cn("bg-primary/10 animate-pulse rounded-md", className)}
10
10
  {...props}
11
11
  />
12
12
  );
@@ -13,7 +13,7 @@ const TabsList = React.forwardRef<
13
13
  ref={ref}
14
14
  className={cn(
15
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
- className
16
+ className,
17
17
  )}
18
18
  {...props}
19
19
  />
@@ -28,7 +28,7 @@ const TabsTrigger = React.forwardRef<
28
28
  ref={ref}
29
29
  className={cn(
30
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
- className
31
+ className,
32
32
  )}
33
33
  {...props}
34
34
  />
@@ -43,7 +43,7 @@ const TabsContent = React.forwardRef<
43
43
  ref={ref}
44
44
  className={cn(
45
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
- className
46
+ className,
47
47
  )}
48
48
  {...props}
49
49
  />
@@ -23,7 +23,7 @@ const toggleVariants = cva(
23
23
  variant: "default",
24
24
  size: "default",
25
25
  },
26
- }
26
+ },
27
27
  );
28
28
 
29
29
  const Toggle = React.forwardRef<
@@ -18,7 +18,7 @@ const TooltipContent = React.forwardRef<
18
18
  sideOffset={sideOffset}
19
19
  className={cn(
20
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
21
+ className,
22
22
  )}
23
23
  {...props}
24
24
  />
@@ -3,6 +3,7 @@ import { ComponentProps } from "@blocknote/react";
3
3
  import { forwardRef } from "react";
4
4
 
5
5
  import { useShadCNComponentsContext } from "../ShadCNComponentsContext.js";
6
+ import { cn } from "../lib/utils.js";
6
7
 
7
8
  export const TextInput = forwardRef<
8
9
  HTMLInputElement,
@@ -12,13 +13,17 @@ export const TextInput = forwardRef<
12
13
  className,
13
14
  name,
14
15
  label,
16
+ variant,
15
17
  icon, // TODO: implement
16
18
  value,
17
19
  autoFocus,
18
20
  placeholder,
21
+ disabled,
19
22
  onKeyDown,
20
23
  onChange,
21
24
  onSubmit,
25
+ autoComplete,
26
+ rightSection, // TODO: add rightSection
22
27
  ...rest
23
28
  } = props;
24
29
 
@@ -26,38 +31,36 @@ export const TextInput = forwardRef<
26
31
 
27
32
  const ShadCNComponents = useShadCNComponentsContext()!;
28
33
 
29
- if (!label) {
30
- return (
31
- <ShadCNComponents.Input.Input
32
- aria-label={name}
33
- name={name}
34
- autoFocus={autoFocus}
35
- placeholder={placeholder}
36
- value={value}
37
- onKeyDown={onKeyDown}
38
- onChange={onChange}
39
- onSubmit={onSubmit}
40
- ref={ref}
41
- />
42
- );
43
- }
44
-
45
34
  return (
46
- <div>
47
- <ShadCNComponents.Label.Label htmlFor={label}>
48
- {label}
49
- </ShadCNComponents.Label.Label>
50
- <ShadCNComponents.Input.Input
51
- className={className}
52
- id={label}
53
- name={name}
54
- autoFocus={autoFocus}
55
- placeholder={placeholder}
56
- value={value}
57
- onKeyDown={onKeyDown}
58
- onChange={onChange}
59
- onSubmit={onSubmit}
60
- />
35
+ <div
36
+ className={cn(
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",
40
+ )}
41
+ >
42
+ {icon}
43
+ <div className="bn-flex-1">
44
+ {label && (
45
+ <ShadCNComponents.Label.Label htmlFor={label}>
46
+ {label}
47
+ </ShadCNComponents.Label.Label>
48
+ )}
49
+ <ShadCNComponents.Input.Input
50
+ className={cn(className, "bn-border-none bn-p-0 bn-h-auto")}
51
+ id={label}
52
+ name={name}
53
+ autoFocus={autoFocus}
54
+ placeholder={placeholder}
55
+ disabled={disabled}
56
+ value={value}
57
+ onKeyDown={onKeyDown}
58
+ onChange={onChange}
59
+ onSubmit={onSubmit}
60
+ ref={ref}
61
+ />
62
+ </div>
63
+ {rightSection}
61
64
  </div>
62
65
  );
63
66
  });
@@ -37,7 +37,8 @@ export const MenuButton = forwardRef<
37
37
  onDragStart={onDragStart}
38
38
  onDragEnd={onDragEnd}
39
39
  draggable={draggable}
40
- {...rest}>
40
+ {...rest}
41
+ >
41
42
  {icon}
42
43
  {children}
43
44
  </ShadCNComponents.Button.Button>
package/src/menu/Menu.tsx CHANGED
@@ -31,7 +31,7 @@ const MenuTriggerWithPointerUp = (Comp: typeof ShadCNDropdownMenuTrigger) =>
31
31
  ref={ref}
32
32
  />
33
33
  );
34
- }
34
+ },
35
35
  );
36
36
 
37
37
  export const Menu = (props: ComponentProps["Generic"]["Menu"]["Root"]) => {
@@ -50,7 +50,8 @@ export const Menu = (props: ComponentProps["Generic"]["Menu"]["Root"]) => {
50
50
  if (sub) {
51
51
  return (
52
52
  <ShadCNComponents.DropdownMenu.DropdownMenuSub
53
- onOpenChange={onOpenChange}>
53
+ onOpenChange={onOpenChange}
54
+ >
54
55
  {children}
55
56
  </ShadCNComponents.DropdownMenu.DropdownMenuSub>
56
57
  );
@@ -58,7 +59,8 @@ export const Menu = (props: ComponentProps["Generic"]["Menu"]["Root"]) => {
58
59
  return (
59
60
  <ShadCNComponents.DropdownMenu.DropdownMenu
60
61
  modal={false}
61
- onOpenChange={onOpenChange}>
62
+ onOpenChange={onOpenChange}
63
+ >
62
64
  {children}
63
65
  </ShadCNComponents.DropdownMenu.DropdownMenu>
64
66
  );
@@ -66,7 +68,7 @@ export const Menu = (props: ComponentProps["Generic"]["Menu"]["Root"]) => {
66
68
  };
67
69
 
68
70
  export const MenuTrigger = (
69
- props: ComponentProps["Generic"]["Menu"]["Trigger"]
71
+ props: ComponentProps["Generic"]["Menu"]["Trigger"],
70
72
  ) => {
71
73
  const { children, sub, ...rest } = props;
72
74
 
@@ -77,9 +79,9 @@ export const MenuTrigger = (
77
79
  const DropdownMenuTrigger = useMemo(
78
80
  () =>
79
81
  MenuTriggerWithPointerUp(
80
- ShadCNComponents.DropdownMenu.DropdownMenuTrigger
82
+ ShadCNComponents.DropdownMenu.DropdownMenuTrigger,
81
83
  ),
82
- [ShadCNComponents.DropdownMenu.DropdownMenuTrigger]
84
+ [ShadCNComponents.DropdownMenu.DropdownMenuTrigger],
83
85
  );
84
86
 
85
87
  if (sub) {
@@ -111,7 +113,8 @@ export const MenuDropdown = forwardRef<
111
113
  return (
112
114
  <ShadCNComponents.DropdownMenu.DropdownMenuSubContent
113
115
  className={className}
114
- ref={ref}>
116
+ ref={ref}
117
+ >
115
118
  {children}
116
119
  </ShadCNComponents.DropdownMenu.DropdownMenuSubContent>
117
120
  );
@@ -119,7 +122,8 @@ export const MenuDropdown = forwardRef<
119
122
  return (
120
123
  <ShadCNComponents.DropdownMenu.DropdownMenuContent
121
124
  className={className}
122
- ref={ref}>
125
+ ref={ref}
126
+ >
123
127
  {children}
124
128
  </ShadCNComponents.DropdownMenu.DropdownMenuContent>
125
129
  );
@@ -153,7 +157,8 @@ export const MenuItem = forwardRef<
153
157
  ref={ref}
154
158
  checked={checked}
155
159
  onClick={onClick}
156
- {...rest}>
160
+ {...rest}
161
+ >
157
162
  {icon}
158
163
  {children}
159
164
  </ShadCNComponents.DropdownMenu.DropdownMenuCheckboxItem>
@@ -165,7 +170,8 @@ export const MenuItem = forwardRef<
165
170
  className={className}
166
171
  ref={ref}
167
172
  onClick={onClick}
168
- {...rest}>
173
+ {...rest}
174
+ >
169
175
  {icon}
170
176
  {children}
171
177
  {subTrigger && <ChevronRight className="bn-ml-auto bn-h-4 bn-w-4" />}
@@ -204,7 +210,8 @@ export const MenuLabel = forwardRef<
204
210
  return (
205
211
  <ShadCNComponents.DropdownMenu.DropdownMenuLabel
206
212
  className={className}
207
- ref={ref}>
213
+ ref={ref}
214
+ >
208
215
  {children}
209
216
  </ShadCNComponents.DropdownMenu.DropdownMenuLabel>
210
217
  );
@@ -29,7 +29,8 @@ export const Panel = forwardRef<
29
29
  ref={ref}
30
30
  value={openTab}
31
31
  defaultValue={defaultOpenTab}
32
- onValueChange={setOpenTab}>
32
+ onValueChange={setOpenTab}
33
+ >
33
34
  {/*{loading && <LoadingOverlay visible={loading} />}*/}
34
35
 
35
36
  <ShadCNComponents.Tabs.TabsList>
@@ -20,7 +20,8 @@ export const PanelButton = forwardRef<
20
20
  className={className}
21
21
  aria-label={label}
22
22
  ref={ref}
23
- onClick={onClick}>
23
+ onClick={onClick}
24
+ >
24
25
  {children}
25
26
  </ShadCNComponents.Button.Button>
26
27
  );
@@ -16,9 +16,10 @@ 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
+ "bn-flex bn-flex-col bn-gap-2 bn-items-start bn-justify-center",
20
20
  )}
21
- ref={ref}>
21
+ ref={ref}
22
+ >
22
23
  {children}
23
24
  </div>
24
25
  );
@@ -6,7 +6,7 @@ import { cn } from "../lib/utils.js";
6
6
  import { useShadCNComponentsContext } from "../ShadCNComponentsContext.js";
7
7
 
8
8
  export const Popover = (
9
- props: ComponentProps["Generic"]["Popover"]["Root"]
9
+ props: ComponentProps["Generic"]["Popover"]["Root"],
10
10
  ) => {
11
11
  const {
12
12
  children,
@@ -39,7 +39,7 @@ export const PopoverTrigger = forwardRef(
39
39
  {children}
40
40
  </ShadCNComponents.Popover.PopoverTrigger>
41
41
  );
42
- }
42
+ },
43
43
  );
44
44
 
45
45
  export const PopoverContent = forwardRef<
@@ -60,9 +60,10 @@ export const PopoverContent = forwardRef<
60
60
  "bn-flex bn-flex-col bn-gap-2",
61
61
  variant === "panel-popover"
62
62
  ? "bn-p-0 bn-border-none bn-shadow-none bn-max-w-none bn-w-fit"
63
- : ""
63
+ : "",
64
64
  )}
65
- ref={ref}>
65
+ ref={ref}
66
+ >
66
67
  {children}
67
68
  </ShadCNComponents.Popover.PopoverContent>
68
69
  );
@@ -37,7 +37,8 @@ export const SideMenuButton = forwardRef<
37
37
  onDragStart={onDragStart}
38
38
  onDragEnd={onDragEnd}
39
39
  draggable={draggable}
40
- {...rest}>
40
+ {...rest}
41
+ >
41
42
  {icon}
42
43
  {children}
43
44
  </ShadCNComponents.Button.Button>
package/src/style.css CHANGED
@@ -189,3 +189,8 @@
189
189
  font-size: 14px;
190
190
  font-style: italic;
191
191
  }
192
+
193
+ .bn-shadcn .bn-combobox-error {
194
+ color: var(--bn-colors-highlights-red-background);
195
+ font-weight: bold;
196
+ }
@@ -19,9 +19,10 @@ export const SuggestionMenu = forwardRef<
19
19
  // Styles from ShadCN DropdownMenuContent component
20
20
  className={cn(
21
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
- className
22
+ className,
23
23
  )}
24
- ref={ref}>
24
+ ref={ref}
25
+ >
25
26
  {children}
26
27
  </div>
27
28
  );
@@ -17,9 +17,10 @@ export const SuggestionMenuEmptyItem = forwardRef<
17
17
  // Styles from ShadCN DropdownMenuItem component
18
18
  className={cn(
19
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
- className
20
+ className,
21
21
  )}
22
- ref={ref}>
22
+ ref={ref}
23
+ >
23
24
  <div>{children}</div>
24
25
  </div>
25
26
  );
@@ -24,7 +24,7 @@ export const SuggestionMenuItem = forwardRef<
24
24
 
25
25
  const overflow = elementOverflow(
26
26
  itemRef.current,
27
- document.querySelector(".bn-suggestion-menu")!
27
+ document.querySelector(".bn-suggestion-menu, #ai-suggestion-menu")!, // TODO
28
28
  );
29
29
  if (overflow === "top") {
30
30
  itemRef.current.scrollIntoView(true);
@@ -38,21 +38,47 @@ export const SuggestionMenuItem = forwardRef<
38
38
  // Styles from ShadCN DropdownMenuItem component
39
39
  className={cn(
40
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
- className
41
+ props.item.size === "small" ? "bn-gap-3 bn-py-1" : "",
42
+ className,
42
43
  )}
43
44
  ref={mergeRefs([ref, itemRef])}
44
45
  id={id}
46
+ onMouseDown={(event) => event.preventDefault()}
45
47
  onClick={onClick}
46
48
  role="option"
47
- aria-selected={isSelected || undefined}>
49
+ aria-selected={isSelected || undefined}
50
+ >
48
51
  {item.icon && (
49
- <div className="bn-p-3" data-position="left">
52
+ <div
53
+ className={cn(
54
+ "bn-p-3",
55
+ props.item.size === "small" ? "bn-p-0" : "",
56
+ className,
57
+ )}
58
+ data-position="left"
59
+ >
50
60
  {item.icon}
51
61
  </div>
52
62
  )}
53
63
  <div className="bn-flex-1">
54
- <div className="bn-text-base">{item.title}</div>
55
- <div className="bn-text-xs">{item.subtext}</div>
64
+ <div
65
+ className={cn(
66
+ "bn-text-base",
67
+ props.item.size === "small" ? "bn-text-sm" : "",
68
+ className,
69
+ )}
70
+ >
71
+ {item.title}
72
+ </div>
73
+ <div
74
+ className={cn(
75
+ "bn-text-xs",
76
+ props.item.size === "small" ? "bn-hidden" : "",
77
+ className,
78
+ )}
79
+ >
80
+ {item.subtext}
81
+ </div>
56
82
  </div>
57
83
  {item.badge && (
58
84
  <div data-position="right" className="bn-text-xs">
@@ -16,7 +16,8 @@ export const SuggestionMenuLabel = forwardRef<
16
16
  <div
17
17
  // Styles from ShadCN DropdownMenuLabel component
18
18
  className={cn("bn-px-2 bn-py-1.5 bn-text-sm bn-font-semibold", className)}
19
- ref={ref}>
19
+ ref={ref}
20
+ >
20
21
  {children}
21
22
  </div>
22
23
  );
@@ -2,17 +2,28 @@ 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 SuggestionMenuLoader = forwardRef<
6
8
  HTMLDivElement,
7
9
  ComponentProps["SuggestionMenu"]["Loader"]
8
10
  >((props, ref) => {
9
- const { className, children, ...rest } = props;
11
+ const { className, ...rest } = props;
10
12
 
11
13
  assertEmpty(rest);
12
14
 
13
15
  return (
14
- <div className={className} ref={ref}>
15
- {children}
16
+ <div className={cn(className, "bn-animate-spin")} ref={ref}>
17
+ {/* Taken from Google Material Icons */}
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
+ <svg
20
+ xmlns="http://www.w3.org/2000/svg"
21
+ height="1em"
22
+ viewBox="0 -960 960 960"
23
+ width="1em"
24
+ fill="#e8eaed">
25
+ <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
+ </svg>
16
27
  </div>
17
28
  );
18
29
  });
@@ -16,7 +16,8 @@ export const GridSuggestionMenu = forwardRef<
16
16
  style={{ gridTemplateColumns: `repeat(${columns}, 1fr)` } as any}
17
17
  ref={ref}
18
18
  id={id}
19
- role="grid">
19
+ role="grid"
20
+ >
20
21
  {children}
21
22
  </div>
22
23
  );
@@ -14,7 +14,8 @@ export const GridSuggestionMenuEmptyItem = forwardRef<
14
14
  <div
15
15
  className={className}
16
16
  style={{ gridColumn: `1 / ${columns + 1}` }}
17
- ref={ref}>
17
+ ref={ref}
18
+ >
18
19
  {children}
19
20
  </div>
20
21
  );
@@ -19,7 +19,7 @@ export const GridSuggestionMenuItem = forwardRef<
19
19
 
20
20
  const overflow = elementOverflow(
21
21
  itemRef.current,
22
- document.querySelector(".bn-grid-suggestion-menu")!
22
+ document.querySelector(".bn-grid-suggestion-menu")!,
23
23
  );
24
24
 
25
25
  if (overflow === "top") {
@@ -36,7 +36,8 @@ export const GridSuggestionMenuItem = forwardRef<
36
36
  id={id}
37
37
  role="option"
38
38
  onClick={onClick}
39
- aria-selected={isSelected || undefined}>
39
+ aria-selected={isSelected || undefined}
40
+ >
40
41
  {item.icon}
41
42
  </div>
42
43
  );
@@ -19,7 +19,8 @@ export const GridSuggestionMenuLoader = forwardRef<
19
19
  <div
20
20
  className={className}
21
21
  style={{ gridColumn: `1 / ${columns + 1}` }}
22
- ref={ref}>
22
+ ref={ref}
23
+ >
23
24
  {children}
24
25
  </div>
25
26
  );
@@ -28,12 +28,13 @@ export const ExtendButton = forwardRef<
28
28
  : "bn-mt-1",
29
29
  className?.includes("bn-extend-button-editing")
30
30
  ? "bn-bg-accent bn-text-accent-foreground"
31
- : ""
31
+ : "",
32
32
  )}
33
33
  ref={ref}
34
34
  onClick={onClick}
35
35
  onMouseDown={onMouseDown}
36
- {...rest}>
36
+ {...rest}
37
+ >
37
38
  {children}
38
39
  </ShadCNComponents.Button.Button>
39
40
  );
@@ -36,7 +36,8 @@ export const TableHandle = forwardRef<
36
36
  onDragStart={onDragStart}
37
37
  onDragEnd={onDragEnd}
38
38
  style={style}
39
- {...rest}>
39
+ {...rest}
40
+ >
40
41
  {children}
41
42
  </ShadCNComponents.Button.Button>
42
43
  );