@blocknote/mantine 0.13.4 → 0.14.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.js +624 -611
- package/dist/blocknote-mantine.js.map +1 -1
- package/dist/blocknote-mantine.umd.cjs +10 -10
- package/dist/blocknote-mantine.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +7 -4
- package/src/form/TextInput.tsx +2 -2
- package/src/index.tsx +5 -1
- package/src/menu/Menu.tsx +28 -18
- package/src/panel/Panel.tsx +16 -12
- package/src/panel/PanelButton.tsx +3 -3
- package/src/panel/PanelFileInput.tsx +2 -2
- package/src/panel/PanelTextInput.tsx +2 -2
- package/src/popover/Popover.tsx +10 -6
- package/src/sideMenu/SideMenu.tsx +9 -4
- package/src/sideMenu/SideMenuButton.tsx +8 -5
- package/src/style.css +1 -0
- package/src/suggestionMenu/SuggestionMenu.tsx +3 -3
- package/src/suggestionMenu/SuggestionMenuEmptyItem.tsx +5 -5
- package/src/suggestionMenu/SuggestionMenuItem.tsx +19 -14
- package/src/suggestionMenu/SuggestionMenuLabel.tsx +3 -3
- package/src/suggestionMenu/SuggestionMenuLoader.tsx +2 -2
- package/src/tableHandle/TableHandle.tsx +4 -2
- package/src/toolbar/Toolbar.tsx +3 -3
- package/src/toolbar/ToolbarButton.tsx +17 -11
- package/src/toolbar/ToolbarSelect.tsx +16 -12
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
ActionIcon as MantineActionIcon,
|
|
3
|
+
Button as MantineButton,
|
|
4
|
+
Stack as MantineStack,
|
|
5
|
+
Text as MantineText,
|
|
6
|
+
Tooltip as MantineTooltip,
|
|
7
|
+
} from "@mantine/core";
|
|
2
8
|
|
|
3
9
|
import { assertEmpty, isSafari } from "@blocknote/core";
|
|
4
10
|
import { ComponentProps } from "@blocknote/react";
|
|
@@ -8,12 +14,12 @@ export const TooltipContent = (props: {
|
|
|
8
14
|
mainTooltip: string;
|
|
9
15
|
secondaryTooltip?: string;
|
|
10
16
|
}) => (
|
|
11
|
-
<
|
|
12
|
-
<
|
|
17
|
+
<MantineStack gap={0} className={"bn-tooltip"}>
|
|
18
|
+
<MantineText size={"sm"}>{props.mainTooltip}</MantineText>
|
|
13
19
|
{props.secondaryTooltip && (
|
|
14
|
-
<
|
|
20
|
+
<MantineText size={"xs"}>{props.secondaryTooltip}</MantineText>
|
|
15
21
|
)}
|
|
16
|
-
</
|
|
22
|
+
</MantineStack>
|
|
17
23
|
);
|
|
18
24
|
|
|
19
25
|
type ToolbarButtonProps = ComponentProps["FormattingToolbar"]["Button"] &
|
|
@@ -42,7 +48,7 @@ export const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>(
|
|
|
42
48
|
assertEmpty(rest, false);
|
|
43
49
|
|
|
44
50
|
return (
|
|
45
|
-
<
|
|
51
|
+
<MantineTooltip
|
|
46
52
|
withinPortal={false}
|
|
47
53
|
label={
|
|
48
54
|
<TooltipContent
|
|
@@ -52,7 +58,7 @@ export const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>(
|
|
|
52
58
|
}>
|
|
53
59
|
{/*Creates an ActionIcon instead of a Button if only an icon is provided as content.*/}
|
|
54
60
|
{children ? (
|
|
55
|
-
<
|
|
61
|
+
<MantineButton
|
|
56
62
|
aria-label={label}
|
|
57
63
|
className={className}
|
|
58
64
|
// Needed as Safari doesn't focus button elements on mouse down
|
|
@@ -74,9 +80,9 @@ export const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>(
|
|
|
74
80
|
ref={ref}
|
|
75
81
|
{...rest}>
|
|
76
82
|
{children}
|
|
77
|
-
</
|
|
83
|
+
</MantineButton>
|
|
78
84
|
) : (
|
|
79
|
-
<
|
|
85
|
+
<MantineActionIcon
|
|
80
86
|
className={className}
|
|
81
87
|
aria-label={label}
|
|
82
88
|
// Needed as Safari doesn't focus button elements on mouse down
|
|
@@ -98,9 +104,9 @@ export const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>(
|
|
|
98
104
|
ref={ref}
|
|
99
105
|
{...rest}>
|
|
100
106
|
{icon}
|
|
101
|
-
</
|
|
107
|
+
</MantineActionIcon>
|
|
102
108
|
)}
|
|
103
|
-
</
|
|
109
|
+
</MantineTooltip>
|
|
104
110
|
);
|
|
105
111
|
}
|
|
106
112
|
);
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
Button as MantineButton,
|
|
3
|
+
CheckIcon as MantineCheckIcon,
|
|
4
|
+
Menu as MantineMenu,
|
|
5
|
+
} from "@mantine/core";
|
|
2
6
|
|
|
3
7
|
import { assertEmpty, isSafari } from "@blocknote/core";
|
|
4
8
|
import { ComponentProps } from "@blocknote/react";
|
|
@@ -21,15 +25,15 @@ export const ToolbarSelect = forwardRef<
|
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
return (
|
|
24
|
-
<
|
|
28
|
+
<MantineMenu
|
|
25
29
|
withinPortal={false}
|
|
26
30
|
transitionProps={{
|
|
27
31
|
exitDuration: 0,
|
|
28
32
|
}}
|
|
29
33
|
disabled={isDisabled}
|
|
30
34
|
middlewares={{ flip: true, shift: true, inline: false, size: true }}>
|
|
31
|
-
<
|
|
32
|
-
<
|
|
35
|
+
<MantineMenu.Target>
|
|
36
|
+
<MantineButton
|
|
33
37
|
// Needed as Safari doesn't focus button elements on mouse down
|
|
34
38
|
// unlike other browsers.
|
|
35
39
|
onMouseDown={(e) => {
|
|
@@ -43,17 +47,17 @@ export const ToolbarSelect = forwardRef<
|
|
|
43
47
|
variant={"subtle"}
|
|
44
48
|
disabled={isDisabled}>
|
|
45
49
|
{selectedItem.text}
|
|
46
|
-
</
|
|
47
|
-
</
|
|
48
|
-
<
|
|
50
|
+
</MantineButton>
|
|
51
|
+
</MantineMenu.Target>
|
|
52
|
+
<MantineMenu.Dropdown className={className} ref={ref}>
|
|
49
53
|
{items.map((item) => (
|
|
50
|
-
<
|
|
54
|
+
<MantineMenu.Item
|
|
51
55
|
key={item.text}
|
|
52
56
|
onClick={item.onClick}
|
|
53
57
|
leftSection={item.icon}
|
|
54
58
|
rightSection={
|
|
55
59
|
item.isSelected ? (
|
|
56
|
-
<
|
|
60
|
+
<MantineCheckIcon size={10} className={"bn-tick-icon"} />
|
|
57
61
|
) : (
|
|
58
62
|
// Ensures space for tick even if item isn't currently selected.
|
|
59
63
|
<div className={"bn-tick-space"} />
|
|
@@ -61,9 +65,9 @@ export const ToolbarSelect = forwardRef<
|
|
|
61
65
|
}
|
|
62
66
|
disabled={item.isDisabled}>
|
|
63
67
|
{item.text}
|
|
64
|
-
</
|
|
68
|
+
</MantineMenu.Item>
|
|
65
69
|
))}
|
|
66
|
-
</
|
|
67
|
-
</
|
|
70
|
+
</MantineMenu.Dropdown>
|
|
71
|
+
</MantineMenu>
|
|
68
72
|
);
|
|
69
73
|
});
|