@edux-design/comments 0.1.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/CHANGELOG.md +17 -0
- package/README.md +61 -0
- package/dist/index.d.mts +52 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +579 -0
- package/dist/index.mjs +556 -0
- package/package.json +51 -0
- package/src/demos/Comment.stories.jsx +472 -0
- package/src/demos/CommentComposer.stories.jsx +62 -0
- package/src/elements/Comment.jsx +234 -0
- package/src/elements/Comment.test.jsx +137 -0
- package/src/elements/CommentComposer.jsx +184 -0
- package/src/elements/CommentComposer.test.jsx +125 -0
- package/src/elements/CommentMention.jsx +217 -0
- package/src/elements/CommentMention.test.jsx +138 -0
- package/src/elements/CommentMentionExtension.jsx +56 -0
- package/src/index.js +3 -0
- package/tsconfig.json +10 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# @edux-design/comments
|
|
2
|
+
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- new packages
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @edux-design/avatars@0.1.3
|
|
10
|
+
- @edux-design/forms@0.0.15
|
|
11
|
+
- @edux-design/mentions@0.1.1
|
|
12
|
+
|
|
13
|
+
## 0.1.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- Initial comments package scaffold
|
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# @edux-design/comments
|
|
2
|
+
|
|
3
|
+
Structured comment block for discussion threads, with avatar, metadata, actions, and nested replies.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i @edux-design/comments @edux-design/avatars
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
import { Comment } from "@edux-design/comments";
|
|
15
|
+
import { CommentComposer } from "@edux-design/comments";
|
|
16
|
+
|
|
17
|
+
export function Example() {
|
|
18
|
+
return (
|
|
19
|
+
<Comment
|
|
20
|
+
author="Alex Johnson"
|
|
21
|
+
timestamp="2h ago"
|
|
22
|
+
body="Left a few notes on the introduction. Let me know if you want me to draft the edits."
|
|
23
|
+
avatarProps={{ name: "Alex Johnson" }}
|
|
24
|
+
onResolve={() => {
|
|
25
|
+
// mark resolved in your app state
|
|
26
|
+
}}
|
|
27
|
+
replies={
|
|
28
|
+
<Comment
|
|
29
|
+
author="Taylor"
|
|
30
|
+
timestamp="1h ago"
|
|
31
|
+
body="Happy to take the edits."
|
|
32
|
+
avatarProps={{ name: "Taylor" }}
|
|
33
|
+
variant="resolved"
|
|
34
|
+
/>
|
|
35
|
+
}
|
|
36
|
+
>
|
|
37
|
+
<Comment.Actions>
|
|
38
|
+
<Comment.Reply />
|
|
39
|
+
<Comment.Edit />
|
|
40
|
+
<Comment.Resolve />
|
|
41
|
+
</Comment.Actions>
|
|
42
|
+
</Comment>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```jsx
|
|
48
|
+
export function ComposerExample() {
|
|
49
|
+
const [value, setValue] = React.useState("");
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<CommentComposer
|
|
53
|
+
value={value}
|
|
54
|
+
onChange={(event) => setValue(event.target.value)}
|
|
55
|
+
onSubmit={() => setValue("")}
|
|
56
|
+
onCancel={() => setValue("")}
|
|
57
|
+
avatarProps={{ name: "Alex Johnson" }}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {React.HTMLAttributes<HTMLDivElement> & {
|
|
6
|
+
* author?: React.ReactNode,
|
|
7
|
+
* timestamp?: React.ReactNode,
|
|
8
|
+
* avatar?: React.ReactNode,
|
|
9
|
+
* avatarName?: string,
|
|
10
|
+
* avatarProps?: import("@edux-design/avatars").AvatarProps,
|
|
11
|
+
* body?: React.ReactNode,
|
|
12
|
+
* replies?: React.ReactNode,
|
|
13
|
+
* variant?: "default" | "resolved",
|
|
14
|
+
* resolved?: boolean,
|
|
15
|
+
* onResolve?: (event: React.MouseEvent<HTMLButtonElement>) => void,
|
|
16
|
+
* editable?: boolean,
|
|
17
|
+
* children?: React.ReactNode,
|
|
18
|
+
* }} CommentProps
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Flexible comment surface with optional avatar, metadata, actions, and replies.
|
|
22
|
+
*/
|
|
23
|
+
declare const Comment: react.ForwardRefExoticComponent<react.RefAttributes<any>>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @typedef {React.FormHTMLAttributes<HTMLFormElement> & {
|
|
27
|
+
* value?: string,
|
|
28
|
+
* onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void,
|
|
29
|
+
* onSubmit?: (event: React.FormEvent<HTMLFormElement>) => void,
|
|
30
|
+
* onCancel?: (event: React.MouseEvent<HTMLButtonElement>) => void,
|
|
31
|
+
* placeholder?: string,
|
|
32
|
+
* rows?: number,
|
|
33
|
+
* disabled?: boolean,
|
|
34
|
+
* isSubmitting?: boolean,
|
|
35
|
+
* submitLabel?: string,
|
|
36
|
+
* cancelLabel?: string,
|
|
37
|
+
* avatar?: React.ReactNode,
|
|
38
|
+
* avatarProps?: import("@edux-design/avatars").AvatarProps,
|
|
39
|
+
* actions?: React.ReactNode,
|
|
40
|
+
* children?: React.ReactNode,
|
|
41
|
+
* }} CommentComposerProps
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* Comment composer with avatar, textarea, and action buttons.
|
|
45
|
+
*/
|
|
46
|
+
declare const CommentComposer: react.ForwardRefExoticComponent<react.RefAttributes<any>>;
|
|
47
|
+
|
|
48
|
+
declare function CommentMention({ peopleList, }: {
|
|
49
|
+
peopleList?: any[];
|
|
50
|
+
}): react_jsx_runtime.JSX.Element;
|
|
51
|
+
|
|
52
|
+
export { Comment, CommentComposer, CommentMention };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {React.HTMLAttributes<HTMLDivElement> & {
|
|
6
|
+
* author?: React.ReactNode,
|
|
7
|
+
* timestamp?: React.ReactNode,
|
|
8
|
+
* avatar?: React.ReactNode,
|
|
9
|
+
* avatarName?: string,
|
|
10
|
+
* avatarProps?: import("@edux-design/avatars").AvatarProps,
|
|
11
|
+
* body?: React.ReactNode,
|
|
12
|
+
* replies?: React.ReactNode,
|
|
13
|
+
* variant?: "default" | "resolved",
|
|
14
|
+
* resolved?: boolean,
|
|
15
|
+
* onResolve?: (event: React.MouseEvent<HTMLButtonElement>) => void,
|
|
16
|
+
* editable?: boolean,
|
|
17
|
+
* children?: React.ReactNode,
|
|
18
|
+
* }} CommentProps
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Flexible comment surface with optional avatar, metadata, actions, and replies.
|
|
22
|
+
*/
|
|
23
|
+
declare const Comment: react.ForwardRefExoticComponent<react.RefAttributes<any>>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @typedef {React.FormHTMLAttributes<HTMLFormElement> & {
|
|
27
|
+
* value?: string,
|
|
28
|
+
* onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void,
|
|
29
|
+
* onSubmit?: (event: React.FormEvent<HTMLFormElement>) => void,
|
|
30
|
+
* onCancel?: (event: React.MouseEvent<HTMLButtonElement>) => void,
|
|
31
|
+
* placeholder?: string,
|
|
32
|
+
* rows?: number,
|
|
33
|
+
* disabled?: boolean,
|
|
34
|
+
* isSubmitting?: boolean,
|
|
35
|
+
* submitLabel?: string,
|
|
36
|
+
* cancelLabel?: string,
|
|
37
|
+
* avatar?: React.ReactNode,
|
|
38
|
+
* avatarProps?: import("@edux-design/avatars").AvatarProps,
|
|
39
|
+
* actions?: React.ReactNode,
|
|
40
|
+
* children?: React.ReactNode,
|
|
41
|
+
* }} CommentComposerProps
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* Comment composer with avatar, textarea, and action buttons.
|
|
45
|
+
*/
|
|
46
|
+
declare const CommentComposer: react.ForwardRefExoticComponent<react.RefAttributes<any>>;
|
|
47
|
+
|
|
48
|
+
declare function CommentMention({ peopleList, }: {
|
|
49
|
+
peopleList?: any[];
|
|
50
|
+
}): react_jsx_runtime.JSX.Element;
|
|
51
|
+
|
|
52
|
+
export { Comment, CommentComposer, CommentMention };
|