@blocknote/ariakit 0.25.2 → 0.26.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-ariakit.cjs +1 -1
- package/dist/blocknote-ariakit.cjs.map +1 -1
- package/dist/blocknote-ariakit.js +268 -228
- package/dist/blocknote-ariakit.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +4 -4
- package/src/comments/Card.tsx +40 -3
- package/src/comments/Comment.tsx +9 -3
- package/src/comments/Editor.tsx +3 -2
- package/src/components.ts +4 -1
- package/src/style.css +35 -13
- package/types/src/comments/Card.d.ts +9 -0
- package/types/src/comments/Comment.d.ts +1 -0
- package/types/src/comments/Editor.d.ts +1 -0
package/src/comments/Card.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Group as AriakitGroup } from "@ariakit/react";
|
|
1
|
+
import { Button as AriakitButton, Group as AriakitGroup } from "@ariakit/react";
|
|
2
2
|
|
|
3
3
|
import { assertEmpty, mergeCSSClasses } from "@blocknote/core";
|
|
4
4
|
import { ComponentProps } from "@blocknote/react";
|
|
@@ -8,14 +8,31 @@ export const Card = forwardRef<
|
|
|
8
8
|
HTMLDivElement,
|
|
9
9
|
ComponentProps["Comments"]["Card"]
|
|
10
10
|
>((props, ref) => {
|
|
11
|
-
const {
|
|
11
|
+
const {
|
|
12
|
+
className,
|
|
13
|
+
children,
|
|
14
|
+
selected,
|
|
15
|
+
headerText,
|
|
16
|
+
onFocus,
|
|
17
|
+
onBlur,
|
|
18
|
+
tabIndex,
|
|
19
|
+
...rest
|
|
20
|
+
} = props;
|
|
12
21
|
|
|
13
22
|
assertEmpty(rest, false);
|
|
14
23
|
|
|
15
24
|
return (
|
|
16
25
|
<AriakitGroup
|
|
17
|
-
className={mergeCSSClasses(
|
|
26
|
+
className={mergeCSSClasses(
|
|
27
|
+
className,
|
|
28
|
+
"bn-ak-hovercard",
|
|
29
|
+
selected && "selected"
|
|
30
|
+
)}
|
|
31
|
+
onFocus={onFocus}
|
|
32
|
+
onBlur={onBlur}
|
|
33
|
+
tabIndex={tabIndex}
|
|
18
34
|
ref={ref}>
|
|
35
|
+
{headerText && <div className={"bn-header-text"}>{headerText}</div>}
|
|
19
36
|
{children}
|
|
20
37
|
</AriakitGroup>
|
|
21
38
|
);
|
|
@@ -37,3 +54,23 @@ export const CardSection = forwardRef<
|
|
|
37
54
|
</AriakitGroup>
|
|
38
55
|
);
|
|
39
56
|
});
|
|
57
|
+
|
|
58
|
+
export const ExpandSectionsPrompt = forwardRef<
|
|
59
|
+
HTMLButtonElement,
|
|
60
|
+
ComponentProps["Comments"]["ExpandSectionsPrompt"]
|
|
61
|
+
>((props, ref) => {
|
|
62
|
+
const { className, children, ...rest } = props;
|
|
63
|
+
|
|
64
|
+
assertEmpty(rest, false);
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<AriakitButton
|
|
68
|
+
className={mergeCSSClasses(
|
|
69
|
+
className,
|
|
70
|
+
"bn-ak-button bn-ak-secondary bn-ak-expand-sections-prompt"
|
|
71
|
+
)}
|
|
72
|
+
ref={ref}>
|
|
73
|
+
{children}
|
|
74
|
+
</AriakitButton>
|
|
75
|
+
);
|
|
76
|
+
});
|
package/src/comments/Comment.tsx
CHANGED
|
@@ -6,9 +6,12 @@ import { forwardRef, useState } from "react";
|
|
|
6
6
|
|
|
7
7
|
const AuthorInfo = forwardRef<
|
|
8
8
|
HTMLDivElement,
|
|
9
|
-
Pick<
|
|
9
|
+
Pick<
|
|
10
|
+
ComponentProps["Comments"]["Comment"],
|
|
11
|
+
"authorInfo" | "timeString" | "edited"
|
|
12
|
+
>
|
|
10
13
|
>((props, _ref) => {
|
|
11
|
-
const { authorInfo, timeString, ...rest } = props;
|
|
14
|
+
const { authorInfo, timeString, edited, ...rest } = props;
|
|
12
15
|
|
|
13
16
|
assertEmpty(rest, false);
|
|
14
17
|
|
|
@@ -30,7 +33,9 @@ const AuthorInfo = forwardRef<
|
|
|
30
33
|
/>
|
|
31
34
|
<div className={"bn-ak-username"}>
|
|
32
35
|
{authorInfo.username}
|
|
33
|
-
<span>
|
|
36
|
+
<span>
|
|
37
|
+
{timeString} {edited && "(edited)"}
|
|
38
|
+
</span>
|
|
34
39
|
</div>
|
|
35
40
|
</AriakitGroup>
|
|
36
41
|
);
|
|
@@ -47,6 +52,7 @@ export const Comment = forwardRef<
|
|
|
47
52
|
timeString,
|
|
48
53
|
actions,
|
|
49
54
|
children,
|
|
55
|
+
edited,
|
|
50
56
|
...rest
|
|
51
57
|
} = props;
|
|
52
58
|
|
package/src/comments/Editor.tsx
CHANGED
|
@@ -12,13 +12,14 @@ export const Editor = forwardRef<
|
|
|
12
12
|
HTMLDivElement,
|
|
13
13
|
ComponentProps["Comments"]["Editor"]
|
|
14
14
|
>((props, ref) => {
|
|
15
|
-
const { className, onFocus, onBlur, editor, editable, ...rest } =
|
|
15
|
+
const { className, onFocus, onBlur, autoFocus, editor, editable, ...rest } =
|
|
16
|
+
props;
|
|
16
17
|
|
|
17
18
|
assertEmpty(rest, false);
|
|
18
19
|
|
|
19
20
|
return (
|
|
20
21
|
<BlockNoteView
|
|
21
|
-
autoFocus={
|
|
22
|
+
autoFocus={autoFocus}
|
|
22
23
|
className={className}
|
|
23
24
|
editor={props.editor}
|
|
24
25
|
sideMenu={false}
|
package/src/components.ts
CHANGED
|
@@ -33,7 +33,7 @@ import { TableHandle } from "./tableHandle/TableHandle.js";
|
|
|
33
33
|
import { Toolbar } from "./toolbar/Toolbar.js";
|
|
34
34
|
import { ToolbarButton } from "./toolbar/ToolbarButton.js";
|
|
35
35
|
import { ToolbarSelect } from "./toolbar/ToolbarSelect.js";
|
|
36
|
-
import { Card, CardSection } from "./comments/Card.js";
|
|
36
|
+
import { Card, CardSection, ExpandSectionsPrompt } from "./comments/Card.js";
|
|
37
37
|
import { Comment } from "./comments/Comment.js";
|
|
38
38
|
import { Editor } from "./comments/Editor.js";
|
|
39
39
|
import { Badge, BadgeGroup } from "./badge/Badge.js";
|
|
@@ -60,6 +60,7 @@ export const components: Components = {
|
|
|
60
60
|
LinkToolbar: {
|
|
61
61
|
Root: Toolbar,
|
|
62
62
|
Button: ToolbarButton,
|
|
63
|
+
Select: ToolbarSelect,
|
|
63
64
|
},
|
|
64
65
|
SideMenu: {
|
|
65
66
|
Root: SideMenu,
|
|
@@ -81,6 +82,7 @@ export const components: Components = {
|
|
|
81
82
|
Editor: Editor,
|
|
82
83
|
Card: Card,
|
|
83
84
|
CardSection: CardSection,
|
|
85
|
+
ExpandSectionsPrompt: ExpandSectionsPrompt,
|
|
84
86
|
},
|
|
85
87
|
Generic: {
|
|
86
88
|
Badge: {
|
|
@@ -90,6 +92,7 @@ export const components: Components = {
|
|
|
90
92
|
Toolbar: {
|
|
91
93
|
Root: Toolbar,
|
|
92
94
|
Button: ToolbarButton,
|
|
95
|
+
Select: ToolbarSelect,
|
|
93
96
|
},
|
|
94
97
|
Form: {
|
|
95
98
|
Root: Form,
|
package/src/style.css
CHANGED
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
--highlight: rgb(255 255 255/20%);
|
|
91
91
|
--shadow: rgb(0 0 0/10%);
|
|
92
92
|
box-shadow: inset 0 0 0 1px var(--border), inset 0 2px 0 var(--highlight),
|
|
93
|
-
|
|
93
|
+
inset 0 -1px 0 var(--shadow), 0 1px 1px var(--shadow);
|
|
94
94
|
font-size: 0.7rem;
|
|
95
95
|
border-radius: 4px;
|
|
96
96
|
padding-inline: 4px;
|
|
@@ -221,14 +221,14 @@
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
.bn-ariakit .bn-thread-comments {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
224
|
+
display: flex;
|
|
225
|
+
flex-direction: column;
|
|
226
|
+
gap: 16px;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
.bn-ak-avatar {
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
height: 24px;
|
|
231
|
+
width: 24px;
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
.bn-ak-username {
|
|
@@ -244,9 +244,9 @@
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
.bn-ak-author-info {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
align-items: center;
|
|
248
|
+
display: flex;
|
|
249
|
+
gap: 16px
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
.bn-ariakit .bn-comment-editor .bn-editor {
|
|
@@ -271,9 +271,9 @@
|
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
.bn-ak-badge-group {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
274
|
+
align-items: center;
|
|
275
|
+
display: flex;
|
|
276
|
+
gap: 4px;
|
|
277
277
|
flex-wrap: wrap;
|
|
278
278
|
width: 100%;
|
|
279
279
|
}
|
|
@@ -309,11 +309,33 @@
|
|
|
309
309
|
}
|
|
310
310
|
|
|
311
311
|
.bn-ak-skeleton {
|
|
312
|
-
|
|
312
|
+
background-color: rgb(255 255 255/25%);
|
|
313
313
|
}
|
|
314
314
|
|
|
315
315
|
.bn-ak-username.bn-ak-skeleton {
|
|
316
316
|
border-radius: 8px;
|
|
317
317
|
height: 16px;
|
|
318
318
|
width: 100px;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.bn-ak-expand-sections-prompt {
|
|
322
|
+
padding: 0;
|
|
323
|
+
width: fit-content;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.bn-ak-expand-sections-prompt:hover {
|
|
327
|
+
background-color: transparent;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.bn-ariakit .bn-thread .bn-header-text,
|
|
331
|
+
.bn-ariakit .bn-thread .bn-resolved-text {
|
|
332
|
+
font-size: 0.8rem;
|
|
333
|
+
font-style: italic;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.bn-ariakit .bn-thread.selected .bn-header-text,
|
|
337
|
+
.bn-ariakit .bn-thread.selected .bn-resolved-text,
|
|
338
|
+
.bn-ariakit .bn-thread.selected .bn-ak-author-info,
|
|
339
|
+
.bn-ariakit .bn-thread.selected .bn-ak-expand-sections-prompt {
|
|
340
|
+
color: var(--bn-colors-selected-text);
|
|
319
341
|
}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const Card: import("react").ForwardRefExoticComponent<{
|
|
3
3
|
className?: string | undefined;
|
|
4
|
+
headerText?: string | undefined;
|
|
5
|
+
selected?: boolean | undefined;
|
|
6
|
+
onFocus?: ((event: import("react").FocusEvent<Element, Element>) => void) | undefined;
|
|
7
|
+
onBlur?: ((event: import("react").FocusEvent<Element, Element>) => void) | undefined;
|
|
8
|
+
tabIndex?: number | undefined;
|
|
4
9
|
children?: import("react").ReactNode;
|
|
5
10
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
11
|
export declare const CardSection: import("react").ForwardRefExoticComponent<{
|
|
7
12
|
className?: string | undefined;
|
|
8
13
|
children?: import("react").ReactNode;
|
|
9
14
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
15
|
+
export declare const ExpandSectionsPrompt: import("react").ForwardRefExoticComponent<{
|
|
16
|
+
className?: string | undefined;
|
|
17
|
+
children?: import("react").ReactNode;
|
|
18
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -4,6 +4,7 @@ export declare const Comment: import("react").ForwardRefExoticComponent<{
|
|
|
4
4
|
children?: import("react").ReactNode;
|
|
5
5
|
authorInfo: "loading" | import("@blocknote/core/types/src/comments").User;
|
|
6
6
|
timeString: string;
|
|
7
|
+
edited: boolean;
|
|
7
8
|
actions?: import("react").ReactNode;
|
|
8
9
|
showActions?: boolean | "hover" | undefined;
|
|
9
10
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const Editor: import("react").ForwardRefExoticComponent<{
|
|
3
3
|
className?: string | undefined;
|
|
4
|
+
autoFocus?: boolean | undefined;
|
|
4
5
|
editable: boolean;
|
|
5
6
|
editor: import("@blocknote/core").BlockNoteEditor<any, any, any>;
|
|
6
7
|
onFocus?: (() => void) | undefined;
|