@blocknote/mantine 0.13.5 → 0.14.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-mantine.js +548 -513
- package/dist/blocknote-mantine.js.map +1 -1
- package/dist/blocknote-mantine.umd.cjs +15 -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 +9 -6
- 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 +3 -1
- package/src/suggestionMenu/SuggestionMenu.tsx +3 -3
- package/src/suggestionMenu/SuggestionMenuEmptyItem.tsx +5 -5
- package/src/suggestionMenu/SuggestionMenuItem.tsx +39 -17
- 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
package/dist/webpack-stats.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"builtAt":
|
|
1
|
+
{"builtAt":1718240408085,"assets":[{"name":"blocknote-mantine.umd.cjs","size":30368},{"name":"blocknote-mantine.umd.cjs.map","size":354058}],"chunks":[{"id":"ec22802","entry":true,"initial":true,"files":["blocknote-mantine.umd.cjs"],"names":["index"]}],"modules":[{"name":"../../node_modules/react/jsx-runtime.js?commonjs-module","size":31,"chunks":["ec22802"]},{"name":"../../node_modules/react/cjs/react-jsx-runtime.production.min.js?commonjs-exports","size":40,"chunks":["ec22802"]},{"name":"../../node_modules/react/cjs/react-jsx-runtime.production.min.js","size":1200,"chunks":["ec22802"]},{"name":"../../node_modules/react/cjs/react-jsx-runtime.development.js?commonjs-exports","size":37,"chunks":["ec22802"]},{"name":"../../node_modules/react/cjs/react-jsx-runtime.development.js","size":44073,"chunks":["ec22802"]},{"name":"../../node_modules/react/jsx-runtime.js","size":225,"chunks":["ec22802"]},{"name":"./src/BlockNoteTheme.ts","size":2185,"chunks":["ec22802"]},{"name":"./src/form/TextInput.tsx","size":582,"chunks":["ec22802"]},{"name":"../../node_modules/react-icons/lib/iconContext.mjs","size":251,"chunks":["ec22802"]},{"name":"../../node_modules/react-icons/lib/iconBase.mjs","size":4014,"chunks":["ec22802"]},{"name":"../../node_modules/react-icons/hi/index.mjs","size":744,"chunks":["ec22802"]},{"name":"./src/menu/Menu.tsx","size":4155,"chunks":["ec22802"]},{"name":"./src/panel/Panel.tsx","size":1057,"chunks":["ec22802"]},{"name":"./src/panel/PanelButton.tsx","size":352,"chunks":["ec22802"]},{"name":"./src/panel/PanelFileInput.tsx","size":374,"chunks":["ec22802"]},{"name":"./src/panel/PanelTab.tsx","size":216,"chunks":["ec22802"]},{"name":"./src/panel/PanelTextInput.tsx","size":399,"chunks":["ec22802"]},{"name":"./src/popover/Popover.tsx","size":759,"chunks":["ec22802"]},{"name":"./src/sideMenu/SideMenu.tsx","size":316,"chunks":["ec22802"]},{"name":"./src/sideMenu/SideMenuButton.tsx","size":787,"chunks":["ec22802"]},{"name":"./src/suggestionMenu/SuggestionMenu.tsx","size":314,"chunks":["ec22802"]},{"name":"./src/suggestionMenu/SuggestionMenuEmptyItem.tsx","size":352,"chunks":["ec22802"]},{"name":"./src/suggestionMenu/SuggestionMenuItem.tsx","size":1806,"chunks":["ec22802"]},{"name":"./src/suggestionMenu/SuggestionMenuLabel.tsx","size":234,"chunks":["ec22802"]},{"name":"./src/suggestionMenu/SuggestionMenuLoader.tsx","size":290,"chunks":["ec22802"]},{"name":"./src/tableHandle/TableHandle.tsx","size":459,"chunks":["ec22802"]},{"name":"./src/toolbar/Toolbar.tsx","size":569,"chunks":["ec22802"]},{"name":"./src/toolbar/ToolbarButton.tsx","size":2278,"chunks":["ec22802"]},{"name":"./src/toolbar/ToolbarSelect.tsx","size":1841,"chunks":["ec22802"]},{"name":"./src/style.css","size":17,"chunks":["ec22802"]},{"name":"./src/defaultThemes.ts","size":3405,"chunks":["ec22802"]},{"name":"./src/index.tsx","size":2464,"chunks":["ec22802"]}]}
|
package/package.json
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
"name": "@blocknote/mantine",
|
|
3
3
|
"homepage": "https://github.com/TypeCellOS/BlockNote",
|
|
4
4
|
"private": false,
|
|
5
|
+
"sideEffects": [
|
|
6
|
+
"*.css"
|
|
7
|
+
],
|
|
5
8
|
"license": "MPL-2.0",
|
|
6
|
-
"version": "0.
|
|
9
|
+
"version": "0.14.1",
|
|
7
10
|
"files": [
|
|
8
11
|
"dist",
|
|
9
12
|
"types",
|
|
@@ -48,10 +51,10 @@
|
|
|
48
51
|
"clean": "rimraf dist && rimraf types"
|
|
49
52
|
},
|
|
50
53
|
"dependencies": {
|
|
51
|
-
"@blocknote/core": "^0.
|
|
52
|
-
"@blocknote/react": "^0.
|
|
53
|
-
"@mantine/core": "^7.
|
|
54
|
-
"@mantine/hooks": "^7.
|
|
54
|
+
"@blocknote/core": "^0.14.1",
|
|
55
|
+
"@blocknote/react": "^0.14.1",
|
|
56
|
+
"@mantine/core": "^7.10.1",
|
|
57
|
+
"@mantine/hooks": "^7.10.1",
|
|
55
58
|
"@mantine/utils": "^6.0.21",
|
|
56
59
|
"react": "^18",
|
|
57
60
|
"react-dom": "^18",
|
|
@@ -84,5 +87,5 @@
|
|
|
84
87
|
"access": "public",
|
|
85
88
|
"registry": "https://registry.npmjs.org/"
|
|
86
89
|
},
|
|
87
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "de69d1d3902499577ceb870499a03170c66380b1"
|
|
88
91
|
}
|
package/src/form/TextInput.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { TextInput as MantineTextInput } from "@mantine/core";
|
|
2
2
|
|
|
3
3
|
import { assertEmpty } from "@blocknote/core";
|
|
4
4
|
import { ComponentProps } from "@blocknote/react";
|
|
@@ -25,7 +25,7 @@ export const TextInput = forwardRef<
|
|
|
25
25
|
assertEmpty(rest);
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
|
-
<
|
|
28
|
+
<MantineTextInput
|
|
29
29
|
size={"xs"}
|
|
30
30
|
className={className}
|
|
31
31
|
ref={ref}
|
package/src/index.tsx
CHANGED
|
@@ -160,7 +160,11 @@ export const BlockNoteView = <
|
|
|
160
160
|
{/* as proposed here: https://github.com/orgs/mantinedev/discussions/5685 */}
|
|
161
161
|
<MantineProvider
|
|
162
162
|
theme={mantineTheme}
|
|
163
|
-
cssVariablesSelector=".bn-container"
|
|
163
|
+
cssVariablesSelector=".bn-container"
|
|
164
|
+
// This gets the element to set `data-mantine-color-scheme` on. Since we
|
|
165
|
+
// don't need this attribute (we use our own theming API), we return
|
|
166
|
+
// undefined here.
|
|
167
|
+
getRootElement={() => undefined}>
|
|
164
168
|
<BlockNoteViewRaw
|
|
165
169
|
theme={typeof theme === "object" ? undefined : theme}
|
|
166
170
|
{...rest}
|
package/src/menu/Menu.tsx
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
CheckIcon as MantineCheckIcon,
|
|
3
|
+
Menu as MantineMenu,
|
|
4
|
+
} from "@mantine/core";
|
|
5
|
+
import { mergeRefs } from "@mantine/hooks";
|
|
2
6
|
|
|
3
7
|
import { assertEmpty } from "@blocknote/core";
|
|
4
8
|
import { ComponentProps } from "@blocknote/react";
|
|
@@ -81,6 +85,8 @@ const SubMenu = forwardRef<
|
|
|
81
85
|
|
|
82
86
|
const [opened, setOpened] = useState(false);
|
|
83
87
|
|
|
88
|
+
const itemRef = useRef<HTMLButtonElement | null>(null);
|
|
89
|
+
|
|
84
90
|
const menuCloseTimer = useRef<ReturnType<typeof setTimeout> | undefined>();
|
|
85
91
|
|
|
86
92
|
const mouseLeave = useCallback(() => {
|
|
@@ -105,13 +111,17 @@ const SubMenu = forwardRef<
|
|
|
105
111
|
onMenuMouseOver: mouseOver,
|
|
106
112
|
onMenuMouseLeave: mouseLeave,
|
|
107
113
|
}}>
|
|
108
|
-
<
|
|
114
|
+
<MantineMenu.Item
|
|
109
115
|
className="bn-menu-item bn-mt-sub-menu-item"
|
|
110
|
-
ref={ref}
|
|
116
|
+
ref={mergeRefs(ref, itemRef)}
|
|
111
117
|
onMouseOver={mouseOver}
|
|
112
118
|
onMouseLeave={mouseLeave}>
|
|
113
|
-
<
|
|
114
|
-
|
|
119
|
+
<MantineMenu
|
|
120
|
+
portalProps={{
|
|
121
|
+
target: itemRef.current
|
|
122
|
+
? itemRef.current.parentElement!
|
|
123
|
+
: undefined,
|
|
124
|
+
}}
|
|
115
125
|
middlewares={{ flip: true, shift: true, inline: false, size: true }}
|
|
116
126
|
trigger={"hover"}
|
|
117
127
|
opened={opened}
|
|
@@ -119,8 +129,8 @@ const SubMenu = forwardRef<
|
|
|
119
129
|
onOpen={() => onOpenChange?.(true)}
|
|
120
130
|
position={position}>
|
|
121
131
|
{children}
|
|
122
|
-
</
|
|
123
|
-
</
|
|
132
|
+
</MantineMenu>
|
|
133
|
+
</MantineMenu.Item>
|
|
124
134
|
</SubMenuContext.Provider>
|
|
125
135
|
);
|
|
126
136
|
});
|
|
@@ -135,14 +145,14 @@ export const Menu = (props: ComponentProps["Generic"]["Menu"]["Root"]) => {
|
|
|
135
145
|
}
|
|
136
146
|
|
|
137
147
|
return (
|
|
138
|
-
<
|
|
148
|
+
<MantineMenu
|
|
139
149
|
withinPortal={false}
|
|
140
150
|
middlewares={{ flip: true, shift: true, inline: false, size: true }}
|
|
141
151
|
onClose={() => onOpenChange?.(false)}
|
|
142
152
|
onOpen={() => onOpenChange?.(true)}
|
|
143
153
|
position={position}>
|
|
144
154
|
{children}
|
|
145
|
-
</
|
|
155
|
+
</MantineMenu>
|
|
146
156
|
);
|
|
147
157
|
};
|
|
148
158
|
|
|
@@ -167,13 +177,13 @@ export const MenuItem = forwardRef<
|
|
|
167
177
|
}
|
|
168
178
|
|
|
169
179
|
return (
|
|
170
|
-
<
|
|
180
|
+
<MantineMenu.Item
|
|
171
181
|
className={className}
|
|
172
182
|
ref={ref}
|
|
173
183
|
leftSection={icon}
|
|
174
184
|
rightSection={
|
|
175
185
|
checked ? (
|
|
176
|
-
<
|
|
186
|
+
<MantineCheckIcon size={10} />
|
|
177
187
|
) : checked === false ? (
|
|
178
188
|
<div className={"bn-tick-space"} />
|
|
179
189
|
) : null
|
|
@@ -181,7 +191,7 @@ export const MenuItem = forwardRef<
|
|
|
181
191
|
onClick={onClick}
|
|
182
192
|
{...rest}>
|
|
183
193
|
{children}
|
|
184
|
-
</
|
|
194
|
+
</MantineMenu.Item>
|
|
185
195
|
);
|
|
186
196
|
});
|
|
187
197
|
|
|
@@ -196,7 +206,7 @@ export const MenuTrigger = (
|
|
|
196
206
|
|
|
197
207
|
assertEmpty(rest);
|
|
198
208
|
|
|
199
|
-
return <
|
|
209
|
+
return <MantineMenu.Target>{children}</MantineMenu.Target>;
|
|
200
210
|
};
|
|
201
211
|
|
|
202
212
|
export const MenuDropdown = forwardRef<
|
|
@@ -215,13 +225,13 @@ export const MenuDropdown = forwardRef<
|
|
|
215
225
|
const ctx = useContext(SubMenuContext);
|
|
216
226
|
|
|
217
227
|
return (
|
|
218
|
-
<
|
|
228
|
+
<MantineMenu.Dropdown
|
|
219
229
|
className={className}
|
|
220
230
|
ref={ref}
|
|
221
231
|
onMouseOver={ctx?.onMenuMouseOver}
|
|
222
232
|
onMouseLeave={ctx?.onMenuMouseLeave}>
|
|
223
233
|
{children}
|
|
224
|
-
</
|
|
234
|
+
</MantineMenu.Dropdown>
|
|
225
235
|
);
|
|
226
236
|
});
|
|
227
237
|
|
|
@@ -233,7 +243,7 @@ export const MenuDivider = forwardRef<
|
|
|
233
243
|
|
|
234
244
|
assertEmpty(rest);
|
|
235
245
|
|
|
236
|
-
return <
|
|
246
|
+
return <MantineMenu.Divider className={className} ref={ref} />;
|
|
237
247
|
});
|
|
238
248
|
|
|
239
249
|
export const MenuLabel = forwardRef<
|
|
@@ -245,8 +255,8 @@ export const MenuLabel = forwardRef<
|
|
|
245
255
|
assertEmpty(rest);
|
|
246
256
|
|
|
247
257
|
return (
|
|
248
|
-
<
|
|
258
|
+
<MantineMenu.Label className={className} ref={ref}>
|
|
249
259
|
{children}
|
|
250
|
-
</
|
|
260
|
+
</MantineMenu.Label>
|
|
251
261
|
);
|
|
252
262
|
});
|
package/src/panel/Panel.tsx
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
Group as MantineGroup,
|
|
3
|
+
LoadingOverlay as MantineLoadingOverlay,
|
|
4
|
+
Tabs as MantineTabs,
|
|
5
|
+
} from "@mantine/core";
|
|
2
6
|
|
|
3
7
|
import { assertEmpty } from "@blocknote/core";
|
|
4
8
|
import { ComponentProps } from "@blocknote/react";
|
|
@@ -21,30 +25,30 @@ export const Panel = forwardRef<
|
|
|
21
25
|
assertEmpty(rest);
|
|
22
26
|
|
|
23
27
|
return (
|
|
24
|
-
<
|
|
25
|
-
<
|
|
28
|
+
<MantineGroup className={className} ref={ref}>
|
|
29
|
+
<MantineTabs
|
|
26
30
|
value={openTab}
|
|
27
31
|
defaultValue={defaultOpenTab}
|
|
28
32
|
onChange={setOpenTab as any}>
|
|
29
|
-
{loading && <
|
|
33
|
+
{loading && <MantineLoadingOverlay visible={loading} />}
|
|
30
34
|
|
|
31
|
-
<
|
|
35
|
+
<MantineTabs.List>
|
|
32
36
|
{tabs.map((tab) => (
|
|
33
|
-
<
|
|
37
|
+
<MantineTabs.Tab
|
|
34
38
|
data-test={`${tab.name.toLowerCase()}-tab`}
|
|
35
39
|
value={tab.name}
|
|
36
40
|
key={tab.name}>
|
|
37
41
|
{tab.name}
|
|
38
|
-
</
|
|
42
|
+
</MantineTabs.Tab>
|
|
39
43
|
))}
|
|
40
|
-
</
|
|
44
|
+
</MantineTabs.List>
|
|
41
45
|
|
|
42
46
|
{tabs.map((tab) => (
|
|
43
|
-
<
|
|
47
|
+
<MantineTabs.Panel value={tab.name} key={tab.name}>
|
|
44
48
|
{tab.tabPanel}
|
|
45
|
-
</
|
|
49
|
+
</MantineTabs.Panel>
|
|
46
50
|
))}
|
|
47
|
-
</
|
|
48
|
-
</
|
|
51
|
+
</MantineTabs>
|
|
52
|
+
</MantineGroup>
|
|
49
53
|
);
|
|
50
54
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Button as MantineButton } from "@mantine/core";
|
|
2
2
|
|
|
3
3
|
import { assertEmpty } from "@blocknote/core";
|
|
4
4
|
import { ComponentProps } from "@blocknote/react";
|
|
@@ -13,7 +13,7 @@ export const PanelButton = forwardRef<
|
|
|
13
13
|
assertEmpty(rest);
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
|
-
<
|
|
16
|
+
<MantineButton
|
|
17
17
|
size={"xs"}
|
|
18
18
|
aria-label={label}
|
|
19
19
|
className={className}
|
|
@@ -21,6 +21,6 @@ export const PanelButton = forwardRef<
|
|
|
21
21
|
onClick={onClick}
|
|
22
22
|
{...rest}>
|
|
23
23
|
{children}
|
|
24
|
-
</
|
|
24
|
+
</MantineButton>
|
|
25
25
|
);
|
|
26
26
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FileInput as MantineFileInput } from "@mantine/core";
|
|
2
2
|
|
|
3
3
|
import { assertEmpty } from "@blocknote/core";
|
|
4
4
|
import { ComponentProps } from "@blocknote/react";
|
|
@@ -13,7 +13,7 @@ export const PanelFileInput = forwardRef<
|
|
|
13
13
|
assertEmpty(rest);
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
|
-
<
|
|
16
|
+
<MantineFileInput
|
|
17
17
|
size={"xs"}
|
|
18
18
|
className={className}
|
|
19
19
|
ref={ref}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { TextInput as MantineTextInput } from "@mantine/core";
|
|
2
2
|
|
|
3
3
|
import { assertEmpty } from "@blocknote/core";
|
|
4
4
|
import { ComponentProps } from "@blocknote/react";
|
|
@@ -13,7 +13,7 @@ export const PanelTextInput = forwardRef<
|
|
|
13
13
|
assertEmpty(rest);
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
|
-
<
|
|
16
|
+
<MantineTextInput
|
|
17
17
|
size={"xs"}
|
|
18
18
|
data-test={"embed-input"}
|
|
19
19
|
className={className}
|
package/src/popover/Popover.tsx
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
Popover as MantinePopover,
|
|
3
|
+
PopoverDropdown as MantinePopoverDropdown,
|
|
4
|
+
PopoverTarget as MantinePopoverTarget,
|
|
5
|
+
} from "@mantine/core";
|
|
2
6
|
|
|
3
7
|
import { assertEmpty } from "@blocknote/core";
|
|
4
8
|
import { ComponentProps } from "@blocknote/react";
|
|
@@ -12,13 +16,13 @@ export const Popover = (
|
|
|
12
16
|
assertEmpty(rest);
|
|
13
17
|
|
|
14
18
|
return (
|
|
15
|
-
<
|
|
19
|
+
<MantinePopover
|
|
16
20
|
withinPortal={false}
|
|
17
21
|
zIndex={10000}
|
|
18
22
|
opened={opened}
|
|
19
23
|
position={position}>
|
|
20
24
|
{children}
|
|
21
|
-
</
|
|
25
|
+
</MantinePopover>
|
|
22
26
|
);
|
|
23
27
|
};
|
|
24
28
|
|
|
@@ -29,7 +33,7 @@ export const PopoverTrigger = (
|
|
|
29
33
|
|
|
30
34
|
assertEmpty(rest);
|
|
31
35
|
|
|
32
|
-
return <
|
|
36
|
+
return <MantinePopoverTarget>{children}</MantinePopoverTarget>;
|
|
33
37
|
};
|
|
34
38
|
|
|
35
39
|
export const PopoverContent = forwardRef<
|
|
@@ -46,8 +50,8 @@ export const PopoverContent = forwardRef<
|
|
|
46
50
|
assertEmpty(rest);
|
|
47
51
|
|
|
48
52
|
return (
|
|
49
|
-
<
|
|
53
|
+
<MantinePopoverDropdown className={className} ref={ref}>
|
|
50
54
|
{children}
|
|
51
|
-
</
|
|
55
|
+
</MantinePopoverDropdown>
|
|
52
56
|
);
|
|
53
57
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Group as MantineGroup } from "@mantine/core";
|
|
2
2
|
|
|
3
3
|
import { assertEmpty } from "@blocknote/core";
|
|
4
4
|
import { ComponentProps } from "@blocknote/react";
|
|
@@ -10,11 +10,16 @@ export const SideMenu = forwardRef<
|
|
|
10
10
|
>((props, ref) => {
|
|
11
11
|
const { className, children, ...rest } = props;
|
|
12
12
|
|
|
13
|
-
assertEmpty(rest);
|
|
13
|
+
assertEmpty(rest, false);
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
|
-
<
|
|
16
|
+
<MantineGroup
|
|
17
|
+
align={"center"}
|
|
18
|
+
gap={0}
|
|
19
|
+
className={className}
|
|
20
|
+
ref={ref}
|
|
21
|
+
{...rest}>
|
|
17
22
|
{children}
|
|
18
|
-
</
|
|
23
|
+
</MantineGroup>
|
|
19
24
|
);
|
|
20
25
|
});
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
ActionIcon as MantineActionIcon,
|
|
3
|
+
Button as MantineButton,
|
|
4
|
+
} from "@mantine/core";
|
|
2
5
|
|
|
3
6
|
import { assertEmpty } from "@blocknote/core";
|
|
4
7
|
import { ComponentProps } from "@blocknote/react";
|
|
@@ -26,7 +29,7 @@ export const SideMenuButton = forwardRef<
|
|
|
26
29
|
|
|
27
30
|
if (icon) {
|
|
28
31
|
return (
|
|
29
|
-
<
|
|
32
|
+
<MantineActionIcon
|
|
30
33
|
size={24}
|
|
31
34
|
className={className}
|
|
32
35
|
ref={ref}
|
|
@@ -37,12 +40,12 @@ export const SideMenuButton = forwardRef<
|
|
|
37
40
|
aria-label={label}
|
|
38
41
|
{...rest}>
|
|
39
42
|
{icon}
|
|
40
|
-
</
|
|
43
|
+
</MantineActionIcon>
|
|
41
44
|
);
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
return (
|
|
45
|
-
<
|
|
48
|
+
<MantineButton
|
|
46
49
|
className={className}
|
|
47
50
|
ref={ref}
|
|
48
51
|
onClick={onClick}
|
|
@@ -52,6 +55,6 @@ export const SideMenuButton = forwardRef<
|
|
|
52
55
|
aria-label={label}
|
|
53
56
|
{...rest}>
|
|
54
57
|
{children}
|
|
55
|
-
</
|
|
58
|
+
</MantineButton>
|
|
56
59
|
);
|
|
57
60
|
});
|
package/src/style.css
CHANGED
|
@@ -322,7 +322,6 @@
|
|
|
322
322
|
|
|
323
323
|
.bn-mt-suggestion-menu-item-body {
|
|
324
324
|
align-items: stretch;
|
|
325
|
-
color: var(--bn-colors-menu-text);
|
|
326
325
|
display: flex;
|
|
327
326
|
flex: 1;
|
|
328
327
|
flex-direction: column;
|
|
@@ -331,6 +330,7 @@
|
|
|
331
330
|
}
|
|
332
331
|
|
|
333
332
|
.bn-mt-suggestion-menu-item-title {
|
|
333
|
+
color: var(--bn-colors-menu-text);
|
|
334
334
|
line-height: 20px;
|
|
335
335
|
font-weight: 500;
|
|
336
336
|
font-size: 14px;
|
|
@@ -339,6 +339,7 @@
|
|
|
339
339
|
}
|
|
340
340
|
|
|
341
341
|
.bn-mt-suggestion-menu-item-subtitle {
|
|
342
|
+
color: var(--bn-colors-menu-text);
|
|
342
343
|
line-height: 16px;
|
|
343
344
|
font-size: 10px;
|
|
344
345
|
margin: 0;
|
|
@@ -445,6 +446,7 @@
|
|
|
445
446
|
color: var(--bn-colors-side-menu);
|
|
446
447
|
cursor: pointer;
|
|
447
448
|
display: flex;
|
|
449
|
+
height: fit-content;
|
|
448
450
|
justify-content: center;
|
|
449
451
|
overflow: visible;
|
|
450
452
|
padding: 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Stack as MantineStack } from "@mantine/core";
|
|
2
2
|
|
|
3
3
|
import { assertEmpty } from "@blocknote/core";
|
|
4
4
|
import { ComponentProps } from "@blocknote/react";
|
|
@@ -13,13 +13,13 @@ export const SuggestionMenu = forwardRef<
|
|
|
13
13
|
assertEmpty(rest);
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
|
-
<
|
|
16
|
+
<MantineStack
|
|
17
17
|
gap={0}
|
|
18
18
|
className={className}
|
|
19
19
|
ref={ref}
|
|
20
20
|
id={id}
|
|
21
21
|
role="listbox">
|
|
22
22
|
{children}
|
|
23
|
-
</
|
|
23
|
+
</MantineStack>
|
|
24
24
|
);
|
|
25
25
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Group as MantineGroup } from "@mantine/core";
|
|
2
2
|
|
|
3
3
|
import { assertEmpty } from "@blocknote/core";
|
|
4
4
|
import { ComponentProps } from "@blocknote/react";
|
|
@@ -13,10 +13,10 @@ export const SuggestionMenuEmptyItem = forwardRef<
|
|
|
13
13
|
assertEmpty(rest);
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
|
-
<
|
|
17
|
-
<
|
|
16
|
+
<MantineGroup className={className} ref={ref}>
|
|
17
|
+
<MantineGroup className="bn-mt-suggestion-menu-item-title">
|
|
18
18
|
{children}
|
|
19
|
-
</
|
|
20
|
-
</
|
|
19
|
+
</MantineGroup>
|
|
20
|
+
</MantineGroup>
|
|
21
21
|
);
|
|
22
22
|
});
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
Badge as MantineBadge,
|
|
3
|
+
Group as MantineGroup,
|
|
4
|
+
Stack as MantineStack,
|
|
5
|
+
Text as MantineText,
|
|
6
|
+
} from "@mantine/core";
|
|
7
|
+
import { mergeRefs } from "@mantine/hooks";
|
|
2
8
|
|
|
3
9
|
import { assertEmpty } from "@blocknote/core";
|
|
4
|
-
import { ComponentProps } from "@blocknote/react";
|
|
5
|
-
import { forwardRef } from "react";
|
|
10
|
+
import { ComponentProps, elementOverflow } from "@blocknote/react";
|
|
11
|
+
import { forwardRef, useEffect, useRef } from "react";
|
|
6
12
|
|
|
7
13
|
export const SuggestionMenuItem = forwardRef<
|
|
8
14
|
HTMLDivElement,
|
|
@@ -12,37 +18,53 @@ export const SuggestionMenuItem = forwardRef<
|
|
|
12
18
|
|
|
13
19
|
assertEmpty(rest);
|
|
14
20
|
|
|
21
|
+
const itemRef = useRef<HTMLDivElement>(null);
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!itemRef.current || !isSelected) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const overflow = elementOverflow(itemRef.current);
|
|
29
|
+
|
|
30
|
+
if (overflow === "top") {
|
|
31
|
+
itemRef.current.scrollIntoView(true);
|
|
32
|
+
} else if (overflow === "bottom") {
|
|
33
|
+
itemRef.current.scrollIntoView(false);
|
|
34
|
+
}
|
|
35
|
+
}, [isSelected]);
|
|
36
|
+
|
|
15
37
|
return (
|
|
16
|
-
<
|
|
38
|
+
<MantineGroup
|
|
17
39
|
gap={0}
|
|
18
40
|
className={className}
|
|
19
|
-
ref={ref}
|
|
41
|
+
ref={mergeRefs(ref, itemRef)}
|
|
20
42
|
id={id}
|
|
21
43
|
role="option"
|
|
22
44
|
onClick={onClick}
|
|
23
45
|
aria-selected={isSelected || undefined}>
|
|
24
46
|
{item.icon && (
|
|
25
|
-
<
|
|
47
|
+
<MantineGroup
|
|
26
48
|
className="bn-mt-suggestion-menu-item-section"
|
|
27
49
|
data-position="left">
|
|
28
50
|
{item.icon}
|
|
29
|
-
</
|
|
51
|
+
</MantineGroup>
|
|
30
52
|
)}
|
|
31
|
-
<
|
|
32
|
-
<
|
|
53
|
+
<MantineStack gap={0} className="bn-mt-suggestion-menu-item-body">
|
|
54
|
+
<MantineText className="bn-mt-suggestion-menu-item-title">
|
|
33
55
|
{item.title}
|
|
34
|
-
</
|
|
35
|
-
<
|
|
56
|
+
</MantineText>
|
|
57
|
+
<MantineText className="bn-mt-suggestion-menu-item-subtitle">
|
|
36
58
|
{item.subtext}
|
|
37
|
-
</
|
|
38
|
-
</
|
|
59
|
+
</MantineText>
|
|
60
|
+
</MantineStack>
|
|
39
61
|
{item.badge && (
|
|
40
|
-
<
|
|
62
|
+
<MantineGroup
|
|
41
63
|
data-position="right"
|
|
42
64
|
className="bn-mt-suggestion-menu-item-section">
|
|
43
|
-
<
|
|
44
|
-
</
|
|
65
|
+
<MantineBadge size={"xs"}>{item.badge}</MantineBadge>
|
|
66
|
+
</MantineGroup>
|
|
45
67
|
)}
|
|
46
|
-
</
|
|
68
|
+
</MantineGroup>
|
|
47
69
|
);
|
|
48
70
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Group as MantineGroup } from "@mantine/core";
|
|
2
2
|
|
|
3
3
|
import { assertEmpty } from "@blocknote/core";
|
|
4
4
|
import { ComponentProps } from "@blocknote/react";
|
|
@@ -13,8 +13,8 @@ export const SuggestionMenuLabel = forwardRef<
|
|
|
13
13
|
assertEmpty(rest);
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
|
-
<
|
|
16
|
+
<MantineGroup className={className} ref={ref}>
|
|
17
17
|
{children}
|
|
18
|
-
</
|
|
18
|
+
</MantineGroup>
|
|
19
19
|
);
|
|
20
20
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Loader as MantineLoader } from "@mantine/core";
|
|
2
2
|
|
|
3
3
|
import { assertEmpty } from "@blocknote/core";
|
|
4
4
|
import { ComponentProps } from "@blocknote/react";
|
|
@@ -16,5 +16,5 @@ export const SuggestionMenuLoader = forwardRef<
|
|
|
16
16
|
|
|
17
17
|
assertEmpty(rest);
|
|
18
18
|
|
|
19
|
-
return <
|
|
19
|
+
return <MantineLoader className={className} type="dots" ref={ref} />;
|
|
20
20
|
});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Button as MantineButton } from "@mantine/core";
|
|
2
|
+
|
|
1
3
|
import { assertEmpty } from "@blocknote/core";
|
|
2
4
|
import { ComponentProps } from "@blocknote/react";
|
|
3
5
|
import { forwardRef } from "react";
|
|
@@ -22,7 +24,7 @@ export const TableHandle = forwardRef<
|
|
|
22
24
|
assertEmpty(rest, false);
|
|
23
25
|
|
|
24
26
|
return (
|
|
25
|
-
<
|
|
27
|
+
<MantineButton
|
|
26
28
|
className={className}
|
|
27
29
|
ref={ref}
|
|
28
30
|
aria-label={label}
|
|
@@ -32,6 +34,6 @@ export const TableHandle = forwardRef<
|
|
|
32
34
|
style={style}
|
|
33
35
|
{...rest}>
|
|
34
36
|
{children}
|
|
35
|
-
</
|
|
37
|
+
</MantineButton>
|
|
36
38
|
);
|
|
37
39
|
});
|