@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.
@@ -1,4 +1,4 @@
1
- import * as Mantine from "@mantine/core";
1
+ import { Group as MantineGroup } from "@mantine/core";
2
2
 
3
3
  import { assertEmpty } from "@blocknote/core";
4
4
  import { ComponentProps } from "@blocknote/react";
@@ -22,7 +22,7 @@ export const Toolbar = forwardRef<HTMLDivElement, ToolbarProps>(
22
22
  const combinedRef = mergeRefs(ref, focusRef, trapRef);
23
23
 
24
24
  return (
25
- <Mantine.Group
25
+ <MantineGroup
26
26
  className={className}
27
27
  ref={combinedRef}
28
28
  role="toolbar"
@@ -30,7 +30,7 @@ export const Toolbar = forwardRef<HTMLDivElement, ToolbarProps>(
30
30
  onMouseEnter={onMouseEnter}
31
31
  onMouseLeave={onMouseLeave}>
32
32
  {children}
33
- </Mantine.Group>
33
+ </MantineGroup>
34
34
  );
35
35
  }
36
36
  );
@@ -1,4 +1,10 @@
1
- import * as Mantine from "@mantine/core";
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
- <Mantine.Stack gap={0} className={"bn-tooltip"}>
12
- <Mantine.Text size={"sm"}>{props.mainTooltip}</Mantine.Text>
17
+ <MantineStack gap={0} className={"bn-tooltip"}>
18
+ <MantineText size={"sm"}>{props.mainTooltip}</MantineText>
13
19
  {props.secondaryTooltip && (
14
- <Mantine.Text size={"xs"}>{props.secondaryTooltip}</Mantine.Text>
20
+ <MantineText size={"xs"}>{props.secondaryTooltip}</MantineText>
15
21
  )}
16
- </Mantine.Stack>
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
- <Mantine.Tooltip
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
- <Mantine.Button
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
- </Mantine.Button>
83
+ </MantineButton>
78
84
  ) : (
79
- <Mantine.ActionIcon
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
- </Mantine.ActionIcon>
107
+ </MantineActionIcon>
102
108
  )}
103
- </Mantine.Tooltip>
109
+ </MantineTooltip>
104
110
  );
105
111
  }
106
112
  );
@@ -1,4 +1,8 @@
1
- import * as Mantine from "@mantine/core";
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
- <Mantine.Menu
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
- <Mantine.Menu.Target>
32
- <Mantine.Button
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
- </Mantine.Button>
47
- </Mantine.Menu.Target>
48
- <Mantine.Menu.Dropdown className={className} ref={ref}>
50
+ </MantineButton>
51
+ </MantineMenu.Target>
52
+ <MantineMenu.Dropdown className={className} ref={ref}>
49
53
  {items.map((item) => (
50
- <Mantine.Menu.Item
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
- <Mantine.CheckIcon size={10} className={"bn-tick-icon"} />
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
- </Mantine.Menu.Item>
68
+ </MantineMenu.Item>
65
69
  ))}
66
- </Mantine.Menu.Dropdown>
67
- </Mantine.Menu>
70
+ </MantineMenu.Dropdown>
71
+ </MantineMenu>
68
72
  );
69
73
  });