@heliux-org/design-system-core 0.0.121 → 0.0.122
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/Table.js +1 -1
- package/dist/Table.js.map +1 -1
- package/dist/components/Comments/Comments.js +13 -10
- package/dist/components/Comments/Comments.js.map +1 -1
- package/dist/components/NewTable/components/newComponents/pagination/Pagination.js +1 -1
- package/dist/components/NewTable/components/newComponents/pagination/Pagination.js.map +1 -1
- package/dist/components/NewTable/components/useLeafyGreenTable/useLeafyGreenTable.js +2 -2
- package/dist/components/NewTable/components/useLeafyGreenTable/useLeafyGreenTable.js.map +1 -1
- package/dist/esm/components/Comments/Comments.d.ts +10 -3
- package/dist/esm/components/Comments/Comments.d.ts.map +1 -1
- package/dist/esm/components/NewTable/components/newComponents/pagination/Pagination.d.ts +1 -1
- package/dist/esm/components/NewTable/components/newComponents/pagination/Pagination.d.ts.map +1 -1
- package/dist/esm/components/NewTable/components/useLeafyGreenTable/useLeafyGreenTable.d.ts +1 -1
- package/dist/esm/components/NewTable/components/useLeafyGreenTable/useLeafyGreenTable.d.ts.map +1 -1
- package/dist/esm/src/components/Comments/Comments.js +1 -1
- package/dist/esm/src/components/Comments/Comments.js.map +1 -1
- package/dist/esm/src/components/Comments/comments.scss.js +1 -1
- package/dist/esm/src/components/NewTable/components/newComponents/pagination/Pagination.js +1 -1
- package/dist/esm/src/components/NewTable/components/newComponents/pagination/Pagination.js.map +1 -1
- package/dist/esm/src/components/NewTable/components/useLeafyGreenTable/useLeafyGreenTable.js +1 -1
- package/dist/esm/src/components/NewTable/components/useLeafyGreenTable/useLeafyGreenTable.js.map +1 -1
- package/dist/main.css +1 -1
- package/dist/main.css.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/mocked_classnames_esm/components/Comments/Comments.d.ts +10 -3
- package/dist/mocked_classnames_esm/components/Comments/Comments.d.ts.map +1 -1
- package/dist/mocked_classnames_esm/components/NewTable/components/newComponents/pagination/Pagination.d.ts +1 -1
- package/dist/mocked_classnames_esm/components/NewTable/components/newComponents/pagination/Pagination.d.ts.map +1 -1
- package/dist/mocked_classnames_esm/components/NewTable/components/useLeafyGreenTable/useLeafyGreenTable.d.ts +1 -1
- package/dist/mocked_classnames_esm/components/NewTable/components/useLeafyGreenTable/useLeafyGreenTable.d.ts.map +1 -1
- package/dist/mocked_classnames_esm/src/components/Comments/Comments.js +1 -1
- package/dist/mocked_classnames_esm/src/components/Comments/Comments.js.map +1 -1
- package/dist/mocked_classnames_esm/src/components/Comments/comments.scss.js +1 -1
- package/dist/mocked_classnames_esm/src/components/NewTable/components/newComponents/pagination/Pagination.js +1 -1
- package/dist/mocked_classnames_esm/src/components/NewTable/components/newComponents/pagination/Pagination.js.map +1 -1
- package/dist/mocked_classnames_esm/src/components/NewTable/components/useLeafyGreenTable/useLeafyGreenTable.js +1 -1
- package/dist/mocked_classnames_esm/src/components/NewTable/components/useLeafyGreenTable/useLeafyGreenTable.js.map +1 -1
- package/dist/types/components/Comments/Comments.d.ts +10 -3
- package/dist/types/components/Comments/Comments.d.ts.map +1 -1
- package/dist/types/components/NewTable/components/newComponents/pagination/Pagination.d.ts +1 -1
- package/dist/types/components/NewTable/components/newComponents/pagination/Pagination.d.ts.map +1 -1
- package/dist/types/components/NewTable/components/useLeafyGreenTable/useLeafyGreenTable.d.ts +1 -1
- package/dist/types/components/NewTable/components/useLeafyGreenTable/useLeafyGreenTable.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/Comments/Comments.tsx +60 -23
- package/src/components/Comments/comments.scss +9 -0
- package/src/components/NewTable/__stories__/NewTable.stories.tsx +0 -8
- package/src/components/NewTable/components/newComponents/pagination/Pagination.tsx +1 -1
- package/src/components/NewTable/components/useLeafyGreenTable/useLeafyGreenTable.tsx +0 -2
@@ -3,11 +3,14 @@ import React, { useCallback, useState } from 'react';
|
|
3
3
|
import './comments.scss';
|
4
4
|
import Avatar from '../Avatar/Avatar';
|
5
5
|
import TextAreaField from '../TextAreaField/TextAreaField';
|
6
|
-
import { ButtonType } from '../Button';
|
7
6
|
import Flex from '../Flex/Flex';
|
8
7
|
import { AvatarType } from '../Avatar';
|
9
8
|
import Button from '../Button/Button';
|
10
9
|
import { FlexAlign, FlexDirection, FlexGap } from '../Flex';
|
10
|
+
import Info from '../Icon/Icons/components/Info';
|
11
|
+
import Text from '../Text/Text';
|
12
|
+
import Icon from '../Icon/Icon';
|
13
|
+
import Attach from '../Icon/Icons/components/Attach';
|
11
14
|
|
12
15
|
export interface CommentProps {
|
13
16
|
text: string;
|
@@ -25,6 +28,9 @@ export interface User {
|
|
25
28
|
export interface CommentFormProps {
|
26
29
|
currentUser: User;
|
27
30
|
onCommentSubmitted: (text: string) => Promise<boolean>;
|
31
|
+
isLabel?: boolean;
|
32
|
+
label?: { status: "external" | "internal" };
|
33
|
+
onClickAttachment?: () => void;
|
28
34
|
}
|
29
35
|
|
30
36
|
export interface CommentsProps extends CommentFormProps {
|
@@ -32,20 +38,20 @@ export interface CommentsProps extends CommentFormProps {
|
|
32
38
|
}
|
33
39
|
|
34
40
|
|
35
|
-
export function Comments({ comments, currentUser, onCommentSubmitted }: CommentsProps) {
|
41
|
+
export function Comments({ comments, currentUser, onCommentSubmitted, isLabel = false, label, onClickAttachment }: CommentsProps) {
|
36
42
|
return (
|
37
43
|
<div className={'comments'}>
|
38
|
-
<CommentForm onCommentSubmitted={onCommentSubmitted} currentUser={currentUser} />
|
39
44
|
{comments.length > 0 && (
|
40
|
-
<Flex direction={FlexDirection.COLUMN} gap={FlexGap.MEDIUM} align={FlexAlign.STRETCH}>
|
41
|
-
{comments.map((comment, i) => <Comment {...comment} key={i} />)}
|
45
|
+
<Flex direction={FlexDirection.COLUMN} style={{ marginBottom: "var(--spacing-large)" }} gap={FlexGap.MEDIUM} align={FlexAlign.STRETCH}>
|
46
|
+
{comments.map((comment, i) => <Comment {...comment} currentUser={currentUser} key={i} />)}
|
42
47
|
</Flex>
|
43
48
|
)}
|
49
|
+
<CommentForm onCommentSubmitted={onCommentSubmitted} currentUser={currentUser} isLabel={isLabel} label={label} onClickAttachment={onClickAttachment} />
|
44
50
|
</div>
|
45
51
|
);
|
46
52
|
}
|
47
53
|
|
48
|
-
export function CommentForm({ onCommentSubmitted, currentUser }: CommentFormProps) {
|
54
|
+
export function CommentForm({ onCommentSubmitted, currentUser, isLabel = false, label, onClickAttachment }: CommentFormProps) {
|
49
55
|
const [isWaiting, setIsWaiting] = useState<boolean>(false);
|
50
56
|
const [text, setText] = useState<string>('');
|
51
57
|
|
@@ -60,12 +66,40 @@ export function CommentForm({ onCommentSubmitted, currentUser }: CommentFormProp
|
|
60
66
|
}, [onCommentSubmitted]);
|
61
67
|
return (
|
62
68
|
<div className={'comments-top'}>
|
63
|
-
<
|
69
|
+
<Flex gap={Flex.gaps.SMALL}>
|
70
|
+
{isLabel && label.status === "internal" && (
|
71
|
+
<>
|
72
|
+
<Icon
|
73
|
+
iconType={Icon.type.SVG}
|
74
|
+
style={{ color: "#757575" }}
|
75
|
+
icon={Info}
|
76
|
+
iconSize={20}
|
77
|
+
clickable={false}
|
78
|
+
/>
|
79
|
+
<Text type={Text.types.TEXT1} color={Text.colors.SECONDARY}>
|
80
|
+
This is an internal conversation
|
81
|
+
</Text>
|
82
|
+
</>
|
83
|
+
)}
|
84
|
+
{isLabel && label.status === "external" && (
|
85
|
+
<>
|
86
|
+
<Icon
|
87
|
+
iconType={Icon.type.SVG}
|
88
|
+
style={{ color: "#FF0020" }}
|
89
|
+
icon={Info}
|
90
|
+
iconSize={20}
|
91
|
+
clickable={false}
|
92
|
+
/>
|
93
|
+
<Text type={Text.types.TEXT1} style={{ color: "#BB0018" }}>
|
94
|
+
This is an external conversation
|
95
|
+
</Text>
|
96
|
+
</>
|
97
|
+
)}
|
98
|
+
</Flex>
|
64
99
|
<TextAreaField
|
65
100
|
disabled={isWaiting}
|
66
|
-
title={`${currentUser.name} | Add a comment`}
|
67
101
|
onChange={setText}
|
68
|
-
placeholder={'
|
102
|
+
placeholder={'What’s on your mind...'}
|
69
103
|
rows={2}
|
70
104
|
value={text}
|
71
105
|
/>
|
@@ -73,35 +107,38 @@ export function CommentForm({ onCommentSubmitted, currentUser }: CommentFormProp
|
|
73
107
|
<Button
|
74
108
|
disabled={!text || isWaiting}
|
75
109
|
onClick={() => onSubmit(text)}
|
76
|
-
size={
|
77
|
-
|
110
|
+
size={Button.sizes.SMALL}
|
111
|
+
style={{ width: "100%" }}
|
78
112
|
>
|
79
|
-
|
113
|
+
Send
|
80
114
|
</Button>
|
81
115
|
</div>
|
116
|
+
<Button
|
117
|
+
onClick={onClickAttachment}
|
118
|
+
size={Button.sizes.SMALL}
|
119
|
+
kind={Button.kinds.TERTIARY}
|
120
|
+
style={{ marginTop: "var(--spacing-small)" }}
|
121
|
+
>
|
122
|
+
<Icon iconType={Icon.type.SVG} style={{ color: "#375D81", transform: "rotate(30deg)" }} icon={Attach} iconSize={17} clickable={false} />
|
123
|
+
<Text type={Text.types.TEXT2} style={{ color: "#375D81", marginTop: "2px" }}>Attachment</Text>
|
124
|
+
</Button>
|
82
125
|
</div>
|
83
126
|
);
|
84
127
|
}
|
85
128
|
|
86
|
-
export function Comment({ author, commentedAt, label, text }: CommentProps) {
|
129
|
+
export function Comment({ author, commentedAt, label, text, currentUser }: { currentUser: User } & CommentProps) {
|
87
130
|
return (
|
88
131
|
<Flex direction={FlexDirection.COLUMN} align={FlexAlign.STRETCH} className={'comment'}>
|
89
132
|
<Flex direction={FlexDirection.ROW} gap={FlexGap.SMALL} className={'comment-data'}>
|
90
133
|
{!!label && (
|
91
|
-
<
|
92
|
-
{label}
|
93
|
-
</div>
|
134
|
+
<Text className={'comment-label'} type={Text.types.TEXT2}>{label}</Text>
|
94
135
|
)}
|
95
136
|
<div className={'comment-user'}>
|
96
137
|
{author && <UserCard user={author} />}
|
97
138
|
</div>
|
98
|
-
<
|
99
|
-
{commentedAt.toLocaleDateString()}
|
100
|
-
</div>
|
139
|
+
<Text className={'comment-date'} color={Text.colors.SECONDARY} type={Text.types.TEXT2}>{commentedAt.toLocaleString()}</Text>
|
101
140
|
</Flex>
|
102
|
-
<
|
103
|
-
{text}
|
104
|
-
</div>
|
141
|
+
<Text className={`comment-text ${currentUser.id === author.id && "comment-currentUser"}`} type={Text.types.TEXT1}>{text}</Text>
|
105
142
|
</Flex>
|
106
143
|
);
|
107
144
|
}
|
@@ -116,7 +153,7 @@ export function UserCard({ user }: { user: User }) {
|
|
116
153
|
text={toInitials(user.name)}
|
117
154
|
/>
|
118
155
|
<div className={'comment-user-name'}>
|
119
|
-
{user.name}
|
156
|
+
<Text type={Text.types.TEXT2} weight={Text.weights.BOLD}>{user.name}</Text>
|
120
157
|
</div>
|
121
158
|
</Flex>
|
122
159
|
);
|
@@ -15,6 +15,10 @@
|
|
15
15
|
@include vibe-text(text1, normal);
|
16
16
|
}
|
17
17
|
|
18
|
+
&-currentUser {
|
19
|
+
background-color: var(--surface-level-200);
|
20
|
+
}
|
21
|
+
|
18
22
|
&-label {
|
19
23
|
@include vibe-text(text1, normal);
|
20
24
|
}
|
@@ -22,5 +26,10 @@
|
|
22
26
|
&-date {
|
23
27
|
@include vibe-text(text1, normal);
|
24
28
|
}
|
29
|
+
&-text {
|
30
|
+
padding: 10px;
|
31
|
+
border-radius: 6px 0px 6px 6px;
|
32
|
+
margin-left: var(--spacing-xl);
|
33
|
+
}
|
25
34
|
}
|
26
35
|
}
|
@@ -1947,8 +1947,6 @@ export const WithPagination: StoryFn<StoryTableProps> = ({ ...rest }) => {
|
|
1947
1947
|
[]
|
1948
1948
|
);
|
1949
1949
|
|
1950
|
-
const itemsPerPageOptions = [30, 100, 150];
|
1951
|
-
|
1952
1950
|
const table = useLeafyGreenTable<TableStoryDataType>({
|
1953
1951
|
containerRef: tableContainerRef,
|
1954
1952
|
data,
|
@@ -1958,11 +1956,6 @@ export const WithPagination: StoryFn<StoryTableProps> = ({ ...rest }) => {
|
|
1958
1956
|
selectCurrentPageOnly: false,
|
1959
1957
|
onUnselectAll: () => {
|
1960
1958
|
console.log('All rows have been unselected');
|
1961
|
-
},
|
1962
|
-
initialState: {
|
1963
|
-
pagination: {
|
1964
|
-
pageSize: itemsPerPageOptions[0],
|
1965
|
-
}
|
1966
1959
|
}
|
1967
1960
|
});
|
1968
1961
|
|
@@ -1978,7 +1971,6 @@ export const WithPagination: StoryFn<StoryTableProps> = ({ ...rest }) => {
|
|
1978
1971
|
table={table}
|
1979
1972
|
withPagination={true}
|
1980
1973
|
paginationProps={{
|
1981
|
-
itemsPerPageOptions: itemsPerPageOptions,
|
1982
1974
|
numTotalItems: data.length,
|
1983
1975
|
}}
|
1984
1976
|
>
|
@@ -21,8 +21,8 @@ const DEFAULT_ITEMS_PER_PAGE_OPTIONS = [10, 25, 50];
|
|
21
21
|
function Pagination<T extends number>({
|
22
22
|
id: idProp,
|
23
23
|
className,
|
24
|
-
itemsPerPageOptions = DEFAULT_ITEMS_PER_PAGE_OPTIONS as Array<T>,
|
25
24
|
itemsPerPage = DEFAULT_ITEMS_PER_PAGE_OPTIONS[0] as T,
|
25
|
+
itemsPerPageOptions = DEFAULT_ITEMS_PER_PAGE_OPTIONS as Array<T>,
|
26
26
|
onItemsPerPageOptionChange,
|
27
27
|
currentPage = 1,
|
28
28
|
onCurrentPageOptionChange,
|
@@ -32,7 +32,6 @@ const useLeafyGreenTable = <T extends LGRowData, V extends unknown = unknown>({
|
|
32
32
|
hoverIcon,
|
33
33
|
selectCurrentPageOnly = false,
|
34
34
|
onUnselectAll,
|
35
|
-
initialState,
|
36
35
|
...rest
|
37
36
|
}: LeafyGreenTableOptions<T, V>): LeafyGreenTable<T> => {
|
38
37
|
const [rowSelection, setRowSelection] = useState<{ [key: string]: boolean }>({});
|
@@ -171,7 +170,6 @@ const useLeafyGreenTable = <T extends LGRowData, V extends unknown = unknown>({
|
|
171
170
|
getSubRows: (row) => row.subRows,
|
172
171
|
getSortedRowModel: getSortedRowModel(),
|
173
172
|
getPaginationRowModel: withPagination ? getPaginationRowModel() : undefined,
|
174
|
-
initialState: initialState ? initialState : undefined,
|
175
173
|
state: { rowSelection },
|
176
174
|
onRowSelectionChange: setRowSelection,
|
177
175
|
columnResizeMode,
|