@blocknote/mantine 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.
- package/dist/blocknote-mantine.cjs +1 -1
- package/dist/blocknote-mantine.cjs.map +1 -1
- package/dist/blocknote-mantine.js +120 -113
- package/dist/blocknote-mantine.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +5 -4
- package/src/BlockNoteTheme.ts +2 -2
- package/src/BlockNoteView.tsx +8 -7
- package/src/badge/Badge.tsx +4 -2
- package/src/comments/Card.tsx +2 -1
- package/src/comments/Comment.tsx +2 -1
- package/src/comments/Editor.tsx +3 -2
- package/src/form/TextInput.tsx +12 -2
- package/src/mantineStyles.css +26 -21
- package/src/menu/Button.tsx +4 -2
- package/src/menu/Menu.tsx +15 -8
- package/src/panel/Panel.tsx +4 -2
- package/src/panel/PanelButton.tsx +2 -1
- package/src/popover/Popover.tsx +2 -2
- package/src/sideMenu/SideMenu.tsx +2 -1
- package/src/sideMenu/SideMenuButton.tsx +4 -2
- package/src/style.css +68 -10
- package/src/suggestionMenu/SuggestionMenu.tsx +2 -1
- package/src/suggestionMenu/SuggestionMenuItem.tsx +8 -4
- package/src/suggestionMenu/SuggestionMenuLoader.tsx +4 -6
- package/src/suggestionMenu/gridSuggestionMenu/GridSuggestionMenu.tsx +2 -1
- package/src/suggestionMenu/gridSuggestionMenu/GridSuggestionMenuEmptyItem.tsx +2 -1
- package/src/suggestionMenu/gridSuggestionMenu/GridSuggestionMenuItem.tsx +3 -2
- package/src/tableHandle/ExtendButton.tsx +2 -1
- package/src/tableHandle/TableHandle.tsx +2 -1
- package/src/toolbar/Toolbar.tsx +4 -4
- package/src/toolbar/ToolbarButton.tsx +8 -6
- package/src/toolbar/ToolbarSelect.tsx +6 -3
- package/types/src/form/TextInput.d.ts +5 -1
- package/types/src/suggestionMenu/SuggestionMenuItem.d.ts +1 -1
- package/types/src/suggestionMenu/SuggestionMenuLoader.d.ts +0 -1
|
@@ -27,7 +27,7 @@ export const SuggestionMenuItem = forwardRef<
|
|
|
27
27
|
|
|
28
28
|
const overflow = elementOverflow(
|
|
29
29
|
itemRef.current,
|
|
30
|
-
document.querySelector(".bn-suggestion-menu")
|
|
30
|
+
document.querySelector(".bn-suggestion-menu, #ai-suggestion-menu")!, // TODO
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
if (overflow === "top") {
|
|
@@ -44,12 +44,15 @@ export const SuggestionMenuItem = forwardRef<
|
|
|
44
44
|
ref={mergeRefs(ref, itemRef)}
|
|
45
45
|
id={id}
|
|
46
46
|
role="option"
|
|
47
|
+
onMouseDown={(event) => event.preventDefault()}
|
|
47
48
|
onClick={onClick}
|
|
48
|
-
aria-selected={isSelected || undefined}
|
|
49
|
+
aria-selected={isSelected || undefined}
|
|
50
|
+
>
|
|
49
51
|
{item.icon && (
|
|
50
52
|
<MantineGroup
|
|
51
53
|
className="bn-mt-suggestion-menu-item-section"
|
|
52
|
-
data-position="left"
|
|
54
|
+
data-position="left"
|
|
55
|
+
>
|
|
53
56
|
{item.icon}
|
|
54
57
|
</MantineGroup>
|
|
55
58
|
)}
|
|
@@ -64,7 +67,8 @@ export const SuggestionMenuItem = forwardRef<
|
|
|
64
67
|
{item.badge && (
|
|
65
68
|
<MantineGroup
|
|
66
69
|
data-position="right"
|
|
67
|
-
className="bn-mt-suggestion-menu-item-section"
|
|
70
|
+
className="bn-mt-suggestion-menu-item-section"
|
|
71
|
+
>
|
|
68
72
|
<MantineBadge size={"xs"}>{item.badge}</MantineBadge>
|
|
69
73
|
</MantineGroup>
|
|
70
74
|
)}
|
|
@@ -8,13 +8,11 @@ export const SuggestionMenuLoader = forwardRef<
|
|
|
8
8
|
HTMLDivElement,
|
|
9
9
|
ComponentProps["SuggestionMenu"]["Loader"]
|
|
10
10
|
>((props, ref) => {
|
|
11
|
-
const {
|
|
12
|
-
className,
|
|
13
|
-
children, // unused, using "dots" instead
|
|
14
|
-
...rest
|
|
15
|
-
} = props;
|
|
11
|
+
const { className, ...rest } = props;
|
|
16
12
|
|
|
17
13
|
assertEmpty(rest);
|
|
18
14
|
|
|
19
|
-
return
|
|
15
|
+
return (
|
|
16
|
+
<MantineLoader className={className} type="dots" size={16} ref={ref} />
|
|
17
|
+
);
|
|
20
18
|
});
|
|
@@ -16,7 +16,8 @@ export const GridSuggestionMenuEmptyItem = forwardRef<
|
|
|
16
16
|
<MantineGroup
|
|
17
17
|
className={className}
|
|
18
18
|
style={{ gridColumn: `1 / ${columns + 1}` }}
|
|
19
|
-
ref={ref}
|
|
19
|
+
ref={ref}
|
|
20
|
+
>
|
|
20
21
|
<MantineGroup className="bn-mt-suggestion-menu-item-title">
|
|
21
22
|
{children}
|
|
22
23
|
</MantineGroup>
|
|
@@ -21,7 +21,7 @@ export const GridSuggestionMenuItem = forwardRef<
|
|
|
21
21
|
|
|
22
22
|
const overflow = elementOverflow(
|
|
23
23
|
itemRef.current,
|
|
24
|
-
document.querySelector(".bn-grid-suggestion-menu")
|
|
24
|
+
document.querySelector(".bn-grid-suggestion-menu")!,
|
|
25
25
|
);
|
|
26
26
|
|
|
27
27
|
if (overflow === "top") {
|
|
@@ -38,7 +38,8 @@ export const GridSuggestionMenuItem = forwardRef<
|
|
|
38
38
|
id={id}
|
|
39
39
|
role="option"
|
|
40
40
|
onClick={onClick}
|
|
41
|
-
aria-selected={isSelected || undefined}
|
|
41
|
+
aria-selected={isSelected || undefined}
|
|
42
|
+
>
|
|
42
43
|
{item.icon}
|
|
43
44
|
</div>
|
|
44
45
|
);
|
package/src/toolbar/Toolbar.tsx
CHANGED
|
@@ -5,8 +5,7 @@ import { ComponentProps } from "@blocknote/react";
|
|
|
5
5
|
import { mergeRefs, useFocusTrap, useFocusWithin } from "@mantine/hooks";
|
|
6
6
|
import { forwardRef } from "react";
|
|
7
7
|
|
|
8
|
-
type ToolbarProps = ComponentProps["
|
|
9
|
-
ComponentProps["LinkToolbar"]["Root"];
|
|
8
|
+
type ToolbarProps = ComponentProps["Generic"]["Toolbar"]["Root"];
|
|
10
9
|
|
|
11
10
|
export const Toolbar = forwardRef<HTMLDivElement, ToolbarProps>(
|
|
12
11
|
(props, ref) => {
|
|
@@ -36,9 +35,10 @@ export const Toolbar = forwardRef<HTMLDivElement, ToolbarProps>(
|
|
|
36
35
|
// TODO: aria-label
|
|
37
36
|
onMouseEnter={onMouseEnter}
|
|
38
37
|
onMouseLeave={onMouseLeave}
|
|
39
|
-
gap={variant === "action-toolbar" ? 2 : undefined}
|
|
38
|
+
gap={variant === "action-toolbar" ? 2 : undefined}
|
|
39
|
+
>
|
|
40
40
|
{children}
|
|
41
41
|
</Flex>
|
|
42
42
|
);
|
|
43
|
-
}
|
|
43
|
+
},
|
|
44
44
|
);
|
|
@@ -26,8 +26,7 @@ export const TooltipContent = (props: {
|
|
|
26
26
|
</MantineStack>
|
|
27
27
|
);
|
|
28
28
|
|
|
29
|
-
type ToolbarButtonProps = ComponentProps["
|
|
30
|
-
ComponentProps["LinkToolbar"]["Button"];
|
|
29
|
+
type ToolbarButtonProps = ComponentProps["Generic"]["Toolbar"]["Button"];
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
32
|
* Helper for basic buttons that show in the formatting toolbar.
|
|
@@ -83,7 +82,8 @@ export const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>(
|
|
|
83
82
|
size={variant === "compact" ? "compact-xs" : "xs"}
|
|
84
83
|
disabled={isDisabled || false}
|
|
85
84
|
ref={ref}
|
|
86
|
-
{...rest}
|
|
85
|
+
{...rest}
|
|
86
|
+
>
|
|
87
87
|
{children}
|
|
88
88
|
</MantineButton>
|
|
89
89
|
) : (
|
|
@@ -118,7 +118,8 @@ export const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>(
|
|
|
118
118
|
size={variant === "compact" ? 20 : 30}
|
|
119
119
|
disabled={isDisabled || false}
|
|
120
120
|
ref={ref}
|
|
121
|
-
{...rest}
|
|
121
|
+
{...rest}
|
|
122
|
+
>
|
|
122
123
|
{icon}
|
|
123
124
|
</MantineActionIcon>
|
|
124
125
|
);
|
|
@@ -136,9 +137,10 @@ export const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>(
|
|
|
136
137
|
mainTooltip={mainTooltip}
|
|
137
138
|
secondaryTooltip={secondaryTooltip}
|
|
138
139
|
/>
|
|
139
|
-
}
|
|
140
|
+
}
|
|
141
|
+
>
|
|
140
142
|
{button}
|
|
141
143
|
</MantineTooltip>
|
|
142
144
|
);
|
|
143
|
-
}
|
|
145
|
+
},
|
|
144
146
|
);
|
|
@@ -31,7 +31,8 @@ export const ToolbarSelect = forwardRef<
|
|
|
31
31
|
exitDuration: 0,
|
|
32
32
|
}}
|
|
33
33
|
disabled={isDisabled}
|
|
34
|
-
middlewares={{ flip: true, shift: true, inline: false, size: true }}
|
|
34
|
+
middlewares={{ flip: true, shift: true, inline: false, size: true }}
|
|
35
|
+
>
|
|
35
36
|
<MantineMenu.Target>
|
|
36
37
|
<MantineButton
|
|
37
38
|
// Needed as Safari doesn't focus button elements on mouse down
|
|
@@ -45,7 +46,8 @@ export const ToolbarSelect = forwardRef<
|
|
|
45
46
|
rightSection={<HiChevronDown />}
|
|
46
47
|
size={"xs"}
|
|
47
48
|
variant={"subtle"}
|
|
48
|
-
disabled={isDisabled}
|
|
49
|
+
disabled={isDisabled}
|
|
50
|
+
>
|
|
49
51
|
{selectedItem.text}
|
|
50
52
|
</MantineButton>
|
|
51
53
|
</MantineMenu.Target>
|
|
@@ -63,7 +65,8 @@ export const ToolbarSelect = forwardRef<
|
|
|
63
65
|
<div className={"bn-tick-space"} />
|
|
64
66
|
)
|
|
65
67
|
}
|
|
66
|
-
disabled={item.isDisabled}
|
|
68
|
+
disabled={item.isDisabled}
|
|
69
|
+
>
|
|
67
70
|
{item.text}
|
|
68
71
|
</MantineMenu.Item>
|
|
69
72
|
))}
|
|
@@ -2,11 +2,15 @@ export declare const TextInput: import("react").ForwardRefExoticComponent<{
|
|
|
2
2
|
className?: string;
|
|
3
3
|
name: string;
|
|
4
4
|
label?: string;
|
|
5
|
+
variant?: "default" | "large";
|
|
5
6
|
icon: import("react").ReactNode;
|
|
7
|
+
rightSection?: import("react").ReactNode;
|
|
6
8
|
autoFocus?: boolean;
|
|
7
|
-
placeholder
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
disabled?: boolean;
|
|
8
11
|
value: string;
|
|
9
12
|
onKeyDown: (event: import("react").KeyboardEvent<HTMLInputElement>) => void;
|
|
10
13
|
onChange: (event: import("react").ChangeEvent<HTMLInputElement>) => void;
|
|
11
14
|
onSubmit?: () => void;
|
|
15
|
+
autoComplete?: import("react").HTMLInputAutoCompleteAttribute;
|
|
12
16
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -3,5 +3,5 @@ export declare const SuggestionMenuItem: import("react").ForwardRefExoticCompone
|
|
|
3
3
|
id: string;
|
|
4
4
|
isSelected: boolean;
|
|
5
5
|
onClick: () => void;
|
|
6
|
-
item: import("@blocknote/react").DefaultReactSuggestionItem
|
|
6
|
+
item: Omit<import("@blocknote/react").DefaultReactSuggestionItem, "onItemClick">;
|
|
7
7
|
} & import("react").RefAttributes<HTMLDivElement>>;
|