pixel-react-excel-sheet 1.0.11 → 1.0.13
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/.yarn/install-state.gz +0 -0
- package/lib/1fb4472b34e4fe07.css +1 -0
- package/lib/components/Accordion/Accordion.d.ts +1 -1
- package/lib/components/Accordion/types.d.ts +12 -0
- package/lib/components/AddVariables/AddVariables.d.ts +5 -0
- package/lib/components/AddVariables/index.d.ts +1 -0
- package/lib/components/AddVariables/types.d.ts +35 -0
- package/lib/components/AppHeader/types.d.ts +2 -0
- package/lib/components/AttachImage/AttachImage.d.ts +1 -6
- package/lib/components/AttachImage/types.d.ts +8 -0
- package/lib/components/Avatar/types.d.ts +9 -1
- package/lib/components/Charts/BarChart/BarChart.d.ts +1 -0
- package/lib/components/Charts/DashboardDonutChart/types.d.ts +6 -0
- package/lib/components/Checkbox/types.d.ts +4 -0
- package/lib/components/Comment/Comments.d.ts +4 -0
- package/lib/components/Comment/comment/Comment.d.ts +11 -0
- package/lib/components/Comment/comment/useNode.d.ts +7 -0
- package/lib/components/Comment/index.d.ts +1 -0
- package/lib/components/Comment/type.d.ts +25 -0
- package/lib/components/CreateVariable/CreateVariableSlider.d.ts +5 -0
- package/lib/components/CreateVariable/index.d.ts +1 -0
- package/lib/components/CreateVariable/types.d.ts +56 -0
- package/lib/components/Drawer/Types.d.ts +13 -0
- package/lib/components/Editor/constants.d.ts +1 -1
- package/lib/components/Editor/types.d.ts +10 -2
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/actions.d.ts +8 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.d.ts +2 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/types.d.ts +13 -6
- package/lib/components/FileDropzone/RadioFilePreview.d.ts +4 -0
- package/lib/components/FileDropzone/types.d.ts +61 -0
- package/lib/components/IconButton/IconButton.d.ts +1 -2
- package/lib/components/IconButton/types.d.ts +1 -0
- package/lib/components/Input/Input.d.ts +1 -1
- package/lib/components/MenuOption/types.d.ts +3 -2
- package/lib/components/MiniModal/types.d.ts +7 -0
- package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/lib/components/PhoneInput/PhoneInput.d.ts +6 -0
- package/lib/components/PhoneInput/index.d.ts +1 -0
- package/lib/components/PhoneInput/types.d.ts +10 -0
- package/lib/components/PopUpModal/types.d.ts +1 -0
- package/lib/components/Search/Search.d.ts +1 -1
- package/lib/components/Search/types.d.ts +4 -0
- package/lib/components/Select/components/types.d.ts +1 -0
- package/lib/components/Select/types.d.ts +2 -0
- package/lib/components/Table/Types.d.ts +1 -1
- package/lib/components/TableTree/Components/TableBody.d.ts +4 -0
- package/lib/components/TableTree/Components/TableCell.d.ts +4 -0
- package/lib/components/TableTree/Components/TableHead.d.ts +4 -0
- package/lib/components/TableTree/Components/TableRow.d.ts +4 -0
- package/lib/components/TableTree/Utils/getAllChildIds.d.ts +1 -0
- package/lib/components/TableTree/types.d.ts +38 -5
- package/lib/components/TableWithAccordion/TableWithAccordion.d.ts +5 -0
- package/lib/components/TableWithAccordion/data.d.ts +8 -0
- package/lib/components/TableWithAccordion/index.d.ts +1 -0
- package/lib/components/TableWithAccordion/types.d.ts +67 -0
- package/lib/components/Tabs/types.d.ts +1 -0
- package/lib/index.d.ts +395 -39
- package/lib/index.esm.js +3859 -1017
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +3866 -1016
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/FormatString/FormatString.d.ts +1 -0
- package/lib/utils/checkDuplicates/checkDuplicates.d.ts +1 -0
- package/package.json +2 -1
- package/src/StyleGuide/ColorPalette/colorPaletteList.ts +15 -0
- package/src/assets/Themes/BaseTheme.scss +16 -0
- package/src/assets/Themes/DarkTheme.scss +71 -42
- package/src/assets/icons/add_file.svg +4 -17
- package/src/assets/icons/add_variable.svg +11 -0
- package/src/assets/icons/authorization.svg +4 -0
- package/src/assets/icons/authorization_icon.svg +1 -0
- package/src/assets/icons/backward.svg +10 -0
- package/src/assets/icons/capture_icon.svg +3 -0
- package/src/assets/icons/depends_on_script.svg +7 -0
- package/src/assets/icons/download_file_icon.svg +2 -9
- package/src/assets/icons/email_group.svg +3 -0
- package/src/assets/icons/executions_icon.svg +3 -0
- package/src/assets/icons/forward.svg +3 -0
- package/src/assets/icons/labels.svg +8 -0
- package/src/assets/icons/machine_disable_icon.svg +18 -0
- package/src/assets/icons/machine_enable_icon.svg +10 -0
- package/src/assets/icons/parameters.svg +3 -0
- package/src/assets/icons/pre_post_condition.svg +8 -0
- package/src/assets/icons/program_element.svg +8 -0
- package/src/assets/icons/project_status_icon.svg +10 -0
- package/src/assets/icons/refresh_icon.svg +4 -0
- package/src/assets/icons/rotate_icon.svg +10 -0
- package/src/assets/icons/suites_icon.svg +3 -0
- package/src/assets/icons/swipe_icon.svg +9 -0
- package/src/assets/icons/tap_icon.svg +4 -0
- package/src/assets/icons/test_data.svg +5 -0
- package/src/assets/icons/test_data_set.svg +7 -0
- package/src/assets/icons/variable_set.svg +5 -0
- package/src/assets/icons/window_maximize.svg +1 -2
- package/src/assets/icons/window_restore.svg +4 -0
- package/src/assets/styles/_colors.scss +0 -1
- package/src/components/Accordion/Accordion.stories.tsx +4 -0
- package/src/components/Accordion/Accordion.tsx +7 -1
- package/src/components/Accordion/types.ts +12 -0
- package/src/components/AddVariables/AddVariables.scss +14 -0
- package/src/components/AddVariables/AddVariables.stories.tsx +44 -0
- package/src/components/AddVariables/AddVariables.tsx +113 -0
- package/src/components/AddVariables/index.ts +1 -0
- package/src/components/AddVariables/types.ts +36 -0
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.scss +1 -1
- package/src/components/AppHeader/AppHeader.scss +40 -1
- package/src/components/AppHeader/AppHeader.stories.tsx +133 -5
- package/src/components/AppHeader/AppHeader.tsx +111 -112
- package/src/components/AppHeader/types.ts +10 -9
- package/src/components/AttachImage/AttachImage.stories.tsx +2 -0
- package/src/components/AttachImage/AttachImage.tsx +5 -9
- package/src/components/AttachImage/types.ts +25 -18
- package/src/components/Avatar/Avatar.scss +4 -0
- package/src/components/Avatar/Avatar.stories.tsx +38 -18
- package/src/components/Avatar/Avatar.tsx +19 -3
- package/src/components/Avatar/types.ts +9 -1
- package/src/components/Charts/BarChart/BarChart.scss +4 -1
- package/src/components/Charts/BarChart/BarChart.tsx +23 -9
- package/src/components/Charts/DashboardDonutChart/DashboardDonutChart.scss +10 -3
- package/src/components/Charts/DashboardDonutChart/DashboardDonutChart.stories.tsx +2 -1
- package/src/components/Charts/DashboardDonutChart/DashboardDonutChart.tsx +54 -25
- package/src/components/Charts/DashboardDonutChart/types.ts +7 -1
- package/src/components/Charts/DonutChart/DonutChart.tsx +8 -3
- package/src/components/Charts/LineChart/LineChart.scss +13 -9
- package/src/components/Charts/LineChart/LineChart.tsx +6 -2
- package/src/components/Charts/RadialChart/RadialChart.scss +4 -0
- package/src/components/Charts/RadialChart/RadialChart.tsx +51 -45
- package/src/components/Checkbox/Checkbox.scss +57 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +91 -15
- package/src/components/Checkbox/Checkbox.tsx +4 -1
- package/src/components/Checkbox/types.ts +4 -0
- package/src/components/Comment/Comments.scss +166 -0
- package/src/components/Comment/Comments.stories.tsx +212 -0
- package/src/components/Comment/Comments.tsx +51 -0
- package/src/components/Comment/comment/Comment.tsx +206 -0
- package/src/components/Comment/comment/useNode.ts +51 -0
- package/src/components/Comment/index.ts +1 -0
- package/src/components/Comment/type.ts +36 -0
- package/src/components/CreateVariable/CreateVariableSlider.scss +18 -0
- package/src/components/CreateVariable/CreateVariableSlider.stories.tsx +66 -0
- package/src/components/CreateVariable/CreateVariableSlider.tsx +95 -0
- package/src/components/CreateVariable/index.ts +1 -0
- package/src/components/CreateVariable/types.ts +58 -0
- package/src/components/DatePicker/DatePicker.scss +11 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +19 -0
- package/src/components/DatePicker/DatePicker.tsx +73 -22
- package/src/components/Drawer/Drawer.scss +3 -2
- package/src/components/Drawer/Drawer.stories.tsx +0 -1
- package/src/components/Drawer/Drawer.tsx +4 -1
- package/src/components/Drawer/Types.ts +13 -0
- package/src/components/Editor/Editor.stories.tsx +2 -2
- package/src/components/Editor/Editor.tsx +4 -2
- package/src/components/Editor/VariableDropdown.scss +8 -2
- package/src/components/Editor/VariableDropdown.tsx +15 -7
- package/src/components/Editor/constants.ts +1 -1
- package/src/components/Editor/types.ts +12 -2
- package/src/components/Excel/ExcelFile/ExcelFile.scss +0 -1
- package/src/components/Excel/ExcelFile/ExcelFile.tsx +41 -25
- package/src/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.tsx +12 -0
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Cell.tsx +2 -34
- package/src/components/Excel/ExcelFile/ExcelFileComponents/FloatingRect.tsx +26 -1
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.scss +24 -22
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.tsx +1 -3
- package/src/components/Excel/ExcelFile/ExcelFileComponents/actions.ts +13 -0
- package/src/components/Excel/ExcelFile/ExcelFileComponents/reducer.ts +53 -26
- package/src/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.ts +81 -14
- package/src/components/Excel/ExcelFile/ExcelFileComponents/types.ts +17 -6
- package/src/components/Excel/ExcelFile.stories.tsx +4 -4
- package/src/components/Excel/ExcelToolBar/ExcelToolBar.tsx +36 -19
- package/src/components/Excel/dataConversion.ts +43 -20
- package/src/components/FieldSet/FieldSet.scss +2 -1
- package/src/components/FieldSet/FieldSet.stories.tsx +2 -1
- package/src/components/FileDropzone/Dropzone.tsx +76 -28
- package/src/components/FileDropzone/FileDropzone.scss +30 -3
- package/src/components/FileDropzone/FileDropzone.stories.tsx +125 -4
- package/src/components/FileDropzone/FileDropzone.tsx +46 -13
- package/src/components/FileDropzone/RadioFilePreview.tsx +76 -0
- package/src/components/FileDropzone/types.ts +73 -0
- package/src/components/Icon/iconList.ts +47 -2
- package/src/components/IconButton/IconButton.scss +11 -11
- package/src/components/IconButton/IconButton.stories.tsx +1 -0
- package/src/components/IconButton/IconButton.tsx +6 -8
- package/src/components/IconButton/types.ts +2 -1
- package/src/components/IconRadioGroup/IconRadioGroup.scss +2 -1
- package/src/components/Input/Input.scss +137 -125
- package/src/components/Input/Input.tsx +110 -93
- package/src/components/InputWithDropdown/InputWithDropdown.scss +9 -2
- package/src/components/InputWithDropdown/types.ts +3 -3
- package/src/components/LabelEditTextField/LabelEditTextField.tsx +1 -1
- package/src/components/MenuOption/MenuOption.stories.tsx +4 -3
- package/src/components/MenuOption/MenuOption.tsx +1 -1
- package/src/components/MenuOption/types.ts +4 -2
- package/src/components/MiniModal/MiniModal.scss +0 -4
- package/src/components/MiniModal/MiniModal.stories.tsx +3 -2
- package/src/components/MiniModal/MiniModal.tsx +28 -10
- package/src/components/MiniModal/types.ts +7 -0
- package/src/components/Modal/Modal.stories.tsx +2 -1
- package/src/components/ModulesChip/ModuleChip.scss +21 -8
- package/src/components/ModulesChip/ModuleChip.stories.tsx +2 -2
- package/src/components/ModulesChip/ModuleChip.tsx +6 -9
- package/src/components/MultiSelect/Dropdown.tsx +12 -5
- package/src/components/MultiSelect/MultiSelect.scss +29 -0
- package/src/components/MultiSelect/MultiSelect.stories.tsx +31 -14
- package/src/components/MultiSelect/MultiSelect.tsx +32 -21
- package/src/components/PhoneInput/PhoneInput.d.ts +3 -0
- package/src/components/PhoneInput/PhoneInput.stories.tsx +95 -0
- package/src/components/PhoneInput/PhoneInput.tsx +90 -0
- package/src/components/PhoneInput/index.ts +1 -0
- package/src/components/PhoneInput/phoneInput.scss +3 -0
- package/src/components/PhoneInput/types.ts +10 -0
- package/src/components/PopUpModal/PopUpModal.stories.tsx +14 -13
- package/src/components/PopUpModal/PopUpModal.tsx +2 -1
- package/src/components/PopUpModal/types.ts +14 -13
- package/src/components/Search/Search.stories.tsx +28 -9
- package/src/components/Search/Search.tsx +32 -29
- package/src/components/Search/types.ts +4 -0
- package/src/components/Select/Select.scss +20 -0
- package/src/components/Select/Select.stories.tsx +50 -1
- package/src/components/Select/Select.tsx +34 -7
- package/src/components/Select/components/Dropdown.scss +9 -0
- package/src/components/Select/components/Dropdown.tsx +20 -6
- package/src/components/Select/components/types.ts +1 -0
- package/src/components/Select/types.ts +12 -2
- package/src/components/Table/Table.scss +6 -5
- package/src/components/Table/Types.ts +1 -1
- package/src/components/TableTree/Components/TableBody.tsx +35 -0
- package/src/components/TableTree/Components/TableCell.tsx +59 -0
- package/src/components/TableTree/Components/TableHead.tsx +39 -0
- package/src/components/TableTree/Components/TableRow.tsx +37 -0
- package/src/components/TableTree/TableTree.scss +8 -5
- package/src/components/TableTree/TableTree.tsx +16 -46
- package/src/components/TableTree/Utils/getAllChildIds.ts +12 -0
- package/src/components/TableTree/Utils/renderSpaces.ts +0 -0
- package/src/components/TableTree/types.ts +43 -5
- package/src/components/TableWithAccordion/TableWithAccordion.scss +54 -0
- package/src/components/TableWithAccordion/TableWithAccordion.stories.tsx +94 -0
- package/src/components/TableWithAccordion/TableWithAccordion.tsx +174 -0
- package/src/components/TableWithAccordion/data.ts +37 -0
- package/src/components/TableWithAccordion/index.ts +1 -0
- package/src/components/TableWithAccordion/types.ts +70 -0
- package/src/components/Tabs/Tabs.scss +58 -5
- package/src/components/Tabs/Tabs.stories.tsx +31 -12
- package/src/components/Tabs/Tabs.tsx +27 -18
- package/src/components/Tabs/types.ts +1 -1
- package/src/components/TextArea/Textarea.stories.tsx +1 -1
- package/src/hooks/useFileDropzone.tsx +2 -1
- package/src/index.ts +18 -1
- package/src/utils/FormatString/FormatString.stories.tsx +58 -0
- package/src/utils/FormatString/FormatString.tsx +41 -0
- package/src/utils/checkDuplicates/CheckDuplicates.stories.tsx +40 -0
- package/src/utils/checkDuplicates/checkDuplicates.ts +13 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
1
2
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
3
|
import Checkbox from './Checkbox';
|
|
3
|
-
import { useState } from 'react';
|
|
4
4
|
|
|
5
5
|
const meta: Meta<typeof Checkbox> = {
|
|
6
6
|
component: Checkbox,
|
|
@@ -10,38 +10,114 @@ const meta: Meta<typeof Checkbox> = {
|
|
|
10
10
|
layout: 'centered',
|
|
11
11
|
},
|
|
12
12
|
};
|
|
13
|
+
|
|
13
14
|
export default meta;
|
|
14
15
|
|
|
15
16
|
type Story = StoryObj<typeof meta>;
|
|
16
17
|
|
|
18
|
+
const useCheckboxState = (initialState = false) => {
|
|
19
|
+
const [checked, setChecked] = useState(initialState);
|
|
20
|
+
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
21
|
+
setChecked(event.target.checked);
|
|
22
|
+
};
|
|
23
|
+
return { checked, handleChange };
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// Story: Default Checkbox
|
|
17
27
|
export const Default: Story = {
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
render: () => {
|
|
29
|
+
const { checked, handleChange } = useCheckboxState();
|
|
30
|
+
return <Checkbox label="Default Checkbox" checked={checked} onChange={handleChange} />;
|
|
20
31
|
},
|
|
21
32
|
};
|
|
22
33
|
|
|
34
|
+
// Story: Partial Checkbox
|
|
23
35
|
export const Partial: Story = {
|
|
36
|
+
render: () => {
|
|
37
|
+
const { checked, handleChange } = useCheckboxState();
|
|
38
|
+
const [partial, setPartial] = useState(true);
|
|
39
|
+
|
|
40
|
+
const handlePartialChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
41
|
+
setPartial(!event.target.checked);
|
|
42
|
+
handleChange(event);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<Checkbox
|
|
47
|
+
label="Partially Selected Checkbox"
|
|
48
|
+
partial={partial}
|
|
49
|
+
checked={checked}
|
|
50
|
+
onChange={handlePartialChange}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// Story: Disabled Checkbox
|
|
57
|
+
export const Disabled: Story = {
|
|
24
58
|
args: {
|
|
25
|
-
label: '
|
|
26
|
-
|
|
59
|
+
label: 'Disabled Checkbox',
|
|
60
|
+
disabled: true,
|
|
27
61
|
},
|
|
28
62
|
};
|
|
29
63
|
|
|
30
|
-
|
|
64
|
+
// Story: Checkbox Variants
|
|
65
|
+
export const Variants: Story = {
|
|
31
66
|
render: () => {
|
|
32
|
-
const [
|
|
67
|
+
const variants = ['passed', 'failed', 'warning', 'skipped', 'flaky'] as const;
|
|
68
|
+
const initialStates = variants.reduce((acc, variant) => ({ ...acc, [variant]: false }), {});
|
|
69
|
+
const [checkedStates, setCheckedStates] = useState(initialStates);
|
|
33
70
|
|
|
34
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
35
|
-
|
|
71
|
+
const handleChange = (variant: string) => (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
72
|
+
setCheckedStates({ ...checkedStates, [variant]: event.target.checked });
|
|
36
73
|
};
|
|
37
74
|
|
|
38
75
|
return (
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
76
|
+
<div style={{ display: 'flex', gap: '16px' }}>
|
|
77
|
+
{variants.map((variant) => (
|
|
78
|
+
<Checkbox
|
|
79
|
+
key={variant}
|
|
80
|
+
label={variant.charAt(0).toUpperCase() + variant.slice(1)}
|
|
81
|
+
variant={variant}
|
|
82
|
+
checked={checkedStates[variant]}
|
|
83
|
+
onChange={handleChange(variant)}
|
|
84
|
+
/>
|
|
85
|
+
))}
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// Story: Controlled Checkbox
|
|
92
|
+
export const Controlled: Story = {
|
|
93
|
+
render: () => {
|
|
94
|
+
const { checked, handleChange } = useCheckboxState();
|
|
95
|
+
return <Checkbox label="Controlled Checkbox" checked={checked} onChange={handleChange} />;
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
// Story: All Features Showcase
|
|
100
|
+
export const AllFeatures: Story = {
|
|
101
|
+
render: () => {
|
|
102
|
+
const { checked: defaultChecked, handleChange: handleDefaultChange } = useCheckboxState();
|
|
103
|
+
const { checked: partialChecked, handleChange: handlePartialChange } = useCheckboxState(true);
|
|
104
|
+
const variants = ['passed', 'failed', 'warning', 'skipped', 'flaky'] as const;
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
|
|
108
|
+
<Checkbox label="Default Checkbox" checked={defaultChecked} onChange={handleDefaultChange} />
|
|
109
|
+
<Checkbox
|
|
110
|
+
label="Partially Selected"
|
|
111
|
+
partial={partialChecked}
|
|
112
|
+
onChange={handlePartialChange}
|
|
113
|
+
/>
|
|
114
|
+
<Checkbox label="Disabled Checkbox" disabled />
|
|
115
|
+
<div style={{ display: 'flex', gap: '16px' }}>
|
|
116
|
+
{variants.map((variant) => (
|
|
117
|
+
<Checkbox key={variant} label={variant} variant={variant} />
|
|
118
|
+
))}
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
45
121
|
);
|
|
46
122
|
},
|
|
47
123
|
};
|
|
@@ -14,6 +14,7 @@ const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
14
14
|
checked: initialChecked = false,
|
|
15
15
|
partial = false,
|
|
16
16
|
onChange,
|
|
17
|
+
variant
|
|
17
18
|
}) => {
|
|
18
19
|
const [checked, setChecked] = useState(initialChecked);
|
|
19
20
|
|
|
@@ -34,8 +35,10 @@ const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
34
35
|
/>
|
|
35
36
|
<span
|
|
36
37
|
className={classNames('ff-checkbox-custom', {
|
|
37
|
-
'ff-checkbox-checked': checked,
|
|
38
|
+
'ff-checkbox-checked': checked ,
|
|
38
39
|
'ff-storybook-checkbox--partial': partial && !checked,
|
|
40
|
+
[`ff-checkbox--${variant}`]: variant,
|
|
41
|
+
[`ff-checkbox-checked--${variant}`]: checked && variant,
|
|
39
42
|
})}
|
|
40
43
|
>
|
|
41
44
|
{checked && (
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
@use '../../assets/styles/fonts';
|
|
2
|
+
.ff-comments-container {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
|
|
6
|
+
.comment-wrapper-one {
|
|
7
|
+
position: relative;
|
|
8
|
+
padding-left: 20px;
|
|
9
|
+
}
|
|
10
|
+
.comment-wrapper {
|
|
11
|
+
position: relative;
|
|
12
|
+
margin-bottom: 10px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.commentContainer {
|
|
16
|
+
margin-bottom: 10px;
|
|
17
|
+
width: 75vw;
|
|
18
|
+
max-width: fit-content;
|
|
19
|
+
border-radius: 5px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.commentContainer__avatar {
|
|
23
|
+
background-color: var(--ff-comment-input-border-color);
|
|
24
|
+
color: var(--ff-comment-avatar-text-color);
|
|
25
|
+
font-weight: bold;
|
|
26
|
+
border-radius: 4px;
|
|
27
|
+
width: 30px;
|
|
28
|
+
height: 30px;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
margin-right: 10px;
|
|
33
|
+
position: absolute;
|
|
34
|
+
top: -5px;
|
|
35
|
+
left: -40px;
|
|
36
|
+
z-index: 1;
|
|
37
|
+
@extend .fontSm;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.comment-actions {
|
|
41
|
+
display: flex;
|
|
42
|
+
}
|
|
43
|
+
.first-comment {
|
|
44
|
+
min-width: 632px;
|
|
45
|
+
min-height: 74px;
|
|
46
|
+
border-radius: 8px;
|
|
47
|
+
border: 1px solid var(--ff-comment-border-color);
|
|
48
|
+
@extend .fontSm;
|
|
49
|
+
}
|
|
50
|
+
.first-comment-heading {
|
|
51
|
+
margin: 5px;
|
|
52
|
+
}
|
|
53
|
+
.input-wrapper {
|
|
54
|
+
position: relative;
|
|
55
|
+
display: flex;
|
|
56
|
+
padding-top: 6px;
|
|
57
|
+
padding-bottom: 10px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.inputContainer__input {
|
|
61
|
+
padding: 5px;
|
|
62
|
+
border: 1px solid var(--ff-comment-border-color);
|
|
63
|
+
border-radius: 4px;
|
|
64
|
+
resize: none;
|
|
65
|
+
margin: 0 10px;
|
|
66
|
+
outline: none;
|
|
67
|
+
&:focus,
|
|
68
|
+
&:focus-visible {
|
|
69
|
+
outline: 1px solid var(--ff-comment-input-border-color);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
.inputEditContainer__input {
|
|
73
|
+
padding: 5px;
|
|
74
|
+
border: 1px solid var(--ff-comment-border-color);
|
|
75
|
+
border-radius: 4px;
|
|
76
|
+
width: 100%;
|
|
77
|
+
outline: none;
|
|
78
|
+
&:focus,
|
|
79
|
+
&:focus-visible {
|
|
80
|
+
outline: 1px solid var(--ff-comment-input-border-color);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.reply {
|
|
85
|
+
margin-right: 5px;
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
}
|
|
88
|
+
.reply-comment {
|
|
89
|
+
right: 2%;
|
|
90
|
+
bottom: 15%;
|
|
91
|
+
position: absolute;
|
|
92
|
+
background: var(--ff-comment-avatar-text-color);
|
|
93
|
+
height: 20px;
|
|
94
|
+
width: 20px;
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
justify-content: center;
|
|
98
|
+
border-radius: 50%;
|
|
99
|
+
}
|
|
100
|
+
.child-comments {
|
|
101
|
+
position: relative;
|
|
102
|
+
margin-left: 15px;
|
|
103
|
+
margin-top: 10px;
|
|
104
|
+
padding-left: 20px;
|
|
105
|
+
border-left: 1px solid var(--ff-comment-border-color);
|
|
106
|
+
border-bottom-left-radius: 15px;
|
|
107
|
+
padding-top: 10px;
|
|
108
|
+
&::before {
|
|
109
|
+
content: '';
|
|
110
|
+
position: absolute;
|
|
111
|
+
top: 0;
|
|
112
|
+
left: -2px;
|
|
113
|
+
width: 2px;
|
|
114
|
+
height: 15px;
|
|
115
|
+
background-color: var(--ff-comment-border-color);
|
|
116
|
+
border-radius: 15px 0 0 15px;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
.reply-text {
|
|
120
|
+
display: flex;
|
|
121
|
+
}
|
|
122
|
+
.ff-message-container {
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: column;
|
|
125
|
+
gap: 10px;
|
|
126
|
+
}
|
|
127
|
+
.ff-message {
|
|
128
|
+
display: flex;
|
|
129
|
+
gap: 10px;
|
|
130
|
+
align-items: center;
|
|
131
|
+
}
|
|
132
|
+
.ff-message-name {
|
|
133
|
+
@extend .fontSm;
|
|
134
|
+
}
|
|
135
|
+
.ff-message-time {
|
|
136
|
+
@extend .fontXs;
|
|
137
|
+
}
|
|
138
|
+
.editable-text {
|
|
139
|
+
word-wrap: break-word;
|
|
140
|
+
color: var(--ff-comment-text-color);
|
|
141
|
+
&:focus,
|
|
142
|
+
&:focus-visible {
|
|
143
|
+
outline: 1px solid var(--ff-comment-input-border-color);
|
|
144
|
+
}
|
|
145
|
+
@extend .fontSm;
|
|
146
|
+
}
|
|
147
|
+
.adding-text,
|
|
148
|
+
.editable-text {
|
|
149
|
+
width: 95%;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.first_input {
|
|
153
|
+
width: 100%;
|
|
154
|
+
&:focus {
|
|
155
|
+
outline: none;
|
|
156
|
+
border-color: var(--ff-comment-input-border-color);
|
|
157
|
+
}
|
|
158
|
+
&::-webkit-scrollbar {
|
|
159
|
+
width: 3px;
|
|
160
|
+
}
|
|
161
|
+
&::-webkit-scrollbar-thumb {
|
|
162
|
+
background-color: var(--ff-comment-text-color);
|
|
163
|
+
border-radius: 4px;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import Comments from './Comments';
|
|
3
|
+
import '../../assets/styles/_colors.scss';
|
|
4
|
+
import './Comments.scss';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Comments> = {
|
|
8
|
+
title: 'Components/Comments',
|
|
9
|
+
component: Comments,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
},
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type Story = StoryObj<typeof Comments>;
|
|
17
|
+
export const basicCommentWithOutData: Story = {
|
|
18
|
+
render: () => {
|
|
19
|
+
const handleCommentsDataChange = (inputValue: string) => {
|
|
20
|
+
//DEMO: we are getting that value from LabelEditTextField
|
|
21
|
+
console.info('Confirmed input value:', inputValue);
|
|
22
|
+
};
|
|
23
|
+
return (
|
|
24
|
+
<Comments
|
|
25
|
+
onCommentsDataChange={handleCommentsDataChange}
|
|
26
|
+
commentsData={{
|
|
27
|
+
comments: [],
|
|
28
|
+
}}
|
|
29
|
+
handleAddComment={() => {}}
|
|
30
|
+
handleEditComment={() => {}}
|
|
31
|
+
handleDeleteComment={() => {}}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const basicCommentWithData: Story = {
|
|
38
|
+
render: () => {
|
|
39
|
+
const handleCommentsDataChange = (inputValue: string) => {
|
|
40
|
+
//DEMO: we are getting that value from LabelEditTextField
|
|
41
|
+
console.info('Confirmed input value:', inputValue);
|
|
42
|
+
};
|
|
43
|
+
return (
|
|
44
|
+
<Comments
|
|
45
|
+
onCommentsDataChange={handleCommentsDataChange}
|
|
46
|
+
commentsData={{
|
|
47
|
+
createdBy: 'USR29890',
|
|
48
|
+
modifiedBy: 'USR29890',
|
|
49
|
+
createdByUname: 'Asha',
|
|
50
|
+
modifiedByUname: 'Asha',
|
|
51
|
+
createdOn: '13 Nov 2024 06:05 PM',
|
|
52
|
+
modifiedOn: '13 Nov 2024 06:05 PM',
|
|
53
|
+
id: 1,
|
|
54
|
+
name: 'Asha',
|
|
55
|
+
emailId: [],
|
|
56
|
+
description: 'Comment 1',
|
|
57
|
+
commentParentId: '',
|
|
58
|
+
comments: [
|
|
59
|
+
{
|
|
60
|
+
createdBy: 'USR29890',
|
|
61
|
+
modifiedBy: 'USR29890',
|
|
62
|
+
createdByUname: 'Asha',
|
|
63
|
+
modifiedByUname: 'Asha',
|
|
64
|
+
createdOn: '13 Nov 2024 06:08 PM',
|
|
65
|
+
modifiedOn: '13 Nov 2024 06:08 PM',
|
|
66
|
+
id: 2,
|
|
67
|
+
name: 'Asha',
|
|
68
|
+
emailId: [],
|
|
69
|
+
description: 'Reply 1',
|
|
70
|
+
commentParentId: 'b995a9a0-a88e-4950-bb7e-1e2e820eca59',
|
|
71
|
+
comments: [
|
|
72
|
+
{
|
|
73
|
+
createdBy: 'USR29890',
|
|
74
|
+
modifiedBy: 'USR29890',
|
|
75
|
+
createdByUname: 'Asha',
|
|
76
|
+
modifiedByUname: 'Asha',
|
|
77
|
+
createdOn: '13 Nov 2024 06:08 PM',
|
|
78
|
+
modifiedOn: '13 Nov 2024 06:08 PM',
|
|
79
|
+
id: 3,
|
|
80
|
+
name: 'Asha',
|
|
81
|
+
emailId: [],
|
|
82
|
+
description: 'Sub Reply 1.1',
|
|
83
|
+
commentParentId: '5142f486-bde3-4fca-9a1c-541cdad7422c',
|
|
84
|
+
comments: [],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
createdBy: 'USR29890',
|
|
88
|
+
modifiedBy: 'USR29890',
|
|
89
|
+
createdByUname: 'Asha',
|
|
90
|
+
modifiedByUname: 'Asha',
|
|
91
|
+
createdOn: '13 Nov 2024 06:09 PM',
|
|
92
|
+
modifiedOn: '13 Nov 2024 06:09 PM',
|
|
93
|
+
id: 4,
|
|
94
|
+
name: 'Asha',
|
|
95
|
+
emailId: [],
|
|
96
|
+
description: 'Sub Reply 1.2',
|
|
97
|
+
commentParentId: '5142f486-bde3-4fca-9a1c-541cdad7422c',
|
|
98
|
+
comments: [],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
createdBy: 'USR29890',
|
|
102
|
+
modifiedBy: 'USR29890',
|
|
103
|
+
createdByUname: 'Asha',
|
|
104
|
+
modifiedByUname: 'Asha',
|
|
105
|
+
createdOn: '13 Nov 2024 06:12 PM',
|
|
106
|
+
modifiedOn: '13 Nov 2024 06:12 PM',
|
|
107
|
+
id: 5,
|
|
108
|
+
name: 'Asha',
|
|
109
|
+
emailId: [],
|
|
110
|
+
description: 'Reply 1.3',
|
|
111
|
+
commentParentId: '5142f486-bde3-4fca-9a1c-541cdad7422c',
|
|
112
|
+
comments: [],
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
createdBy: 'USR29890',
|
|
118
|
+
modifiedBy: 'USR29890',
|
|
119
|
+
createdByUname: 'Asha',
|
|
120
|
+
modifiedByUname: 'Asha',
|
|
121
|
+
createdOn: '13 Nov 2024 06:09 PM',
|
|
122
|
+
modifiedOn: '13 Nov 2024 06:09 PM',
|
|
123
|
+
id: 6,
|
|
124
|
+
name: 'Asha',
|
|
125
|
+
emailId: [],
|
|
126
|
+
description: 'Reply 2',
|
|
127
|
+
commentParentId: 'b995a9a0-a88e-4950-bb7e-1e2e820eca59',
|
|
128
|
+
comments: [
|
|
129
|
+
{
|
|
130
|
+
createdBy: 'USR29890',
|
|
131
|
+
modifiedBy: 'USR29890',
|
|
132
|
+
createdByUname: 'Asha',
|
|
133
|
+
modifiedByUname: 'Asha',
|
|
134
|
+
createdOn: '13 Nov 2024 06:10 PM',
|
|
135
|
+
modifiedOn: '13 Nov 2024 06:10 PM',
|
|
136
|
+
id: 7,
|
|
137
|
+
name: 'Asha',
|
|
138
|
+
emailId: [],
|
|
139
|
+
description: 'Reply 2.1',
|
|
140
|
+
commentParentId: '90fddbe9-f661-4dad-9a10-79160b5b8c5e',
|
|
141
|
+
comments: [],
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
createdBy: 'USR29890',
|
|
145
|
+
modifiedBy: 'USR29890',
|
|
146
|
+
createdByUname: 'Asha',
|
|
147
|
+
modifiedByUname: 'Asha',
|
|
148
|
+
createdOn: '13 Nov 2024 06:10 PM',
|
|
149
|
+
modifiedOn: '13 Nov 2024 06:10 PM',
|
|
150
|
+
id: 8,
|
|
151
|
+
name: 'Asha',
|
|
152
|
+
emailId: [],
|
|
153
|
+
description: 'Reply 2.2',
|
|
154
|
+
commentParentId: '90fddbe9-f661-4dad-9a10-79160b5b8c5e',
|
|
155
|
+
comments: [],
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
createdBy: 'USR29890',
|
|
161
|
+
modifiedBy: 'USR29890',
|
|
162
|
+
createdByUname: 'Asha',
|
|
163
|
+
modifiedByUname: 'Asha',
|
|
164
|
+
createdOn: '13 Nov 2024 06:11 PM',
|
|
165
|
+
modifiedOn: '13 Nov 2024 06:11 PM',
|
|
166
|
+
id: 9,
|
|
167
|
+
name: 'Asha',
|
|
168
|
+
emailId: [],
|
|
169
|
+
description: 'Reply 3',
|
|
170
|
+
commentParentId: 'b995a9a0-a88e-4950-bb7e-1e2e820eca59',
|
|
171
|
+
comments: [
|
|
172
|
+
{
|
|
173
|
+
createdBy: 'USR29890',
|
|
174
|
+
modifiedBy: 'USR29890',
|
|
175
|
+
createdByUname: 'Asha',
|
|
176
|
+
modifiedByUname: 'Asha',
|
|
177
|
+
createdOn: '13 Nov 2024 06:11 PM',
|
|
178
|
+
modifiedOn: '13 Nov 2024 06:11 PM',
|
|
179
|
+
id: 10,
|
|
180
|
+
name: 'Asha',
|
|
181
|
+
emailId: [],
|
|
182
|
+
description: 'Reply 3.1',
|
|
183
|
+
commentParentId: '12c3d310-33a3-458a-9b76-e295f067fd44',
|
|
184
|
+
comments: [],
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
createdBy: 'USR29890',
|
|
188
|
+
modifiedBy: 'USR29890',
|
|
189
|
+
createdByUname: 'Asha',
|
|
190
|
+
modifiedByUname: 'Asha',
|
|
191
|
+
createdOn: '13 Nov 2024 06:11 PM',
|
|
192
|
+
modifiedOn: '13 Nov 2024 06:11 PM',
|
|
193
|
+
id: 11,
|
|
194
|
+
name: 'Asha',
|
|
195
|
+
emailId: [],
|
|
196
|
+
description: 'Reply 3.2',
|
|
197
|
+
commentParentId: '12c3d310-33a3-458a-9b76-e295f067fd44',
|
|
198
|
+
comments: [],
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
}}
|
|
204
|
+
handleAddComment={() => {}}
|
|
205
|
+
handleEditComment={() => {}}
|
|
206
|
+
handleDeleteComment={() => {}}
|
|
207
|
+
/>
|
|
208
|
+
);
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
export default meta;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import Comment from './comment/Comment';
|
|
3
|
+
import useNode from './comment/useNode';
|
|
4
|
+
import './Comments.scss';
|
|
5
|
+
import { CommentType, HandleNodeFunction, CommentsProps } from './type';
|
|
6
|
+
|
|
7
|
+
const initialComments: CommentType = {
|
|
8
|
+
comments: [],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const Comments = ({
|
|
12
|
+
commentsData,
|
|
13
|
+
|
|
14
|
+
onCommentsDataChange,
|
|
15
|
+
}: CommentsProps) => {
|
|
16
|
+
const [commentData, setCommentsData] = useState(
|
|
17
|
+
commentsData ?? initialComments
|
|
18
|
+
);
|
|
19
|
+
const { insertNode, editNode, deleteNode } = useNode();
|
|
20
|
+
|
|
21
|
+
const handleInsertNode: HandleNodeFunction = (commentId, item) => {
|
|
22
|
+
const updatedTree = insertNode(commentData, commentId, item);
|
|
23
|
+
setCommentsData({ ...updatedTree });
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const handleEditNode: HandleNodeFunction = (commentId, value) => {
|
|
27
|
+
const updatedTree = editNode(commentData, commentId, value);
|
|
28
|
+
setCommentsData({ ...updatedTree });
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const handleDeleteNode = (commentId: number) => {
|
|
32
|
+
const updatedTree = deleteNode(commentData, commentId);
|
|
33
|
+
setCommentsData({ ...updatedTree });
|
|
34
|
+
};
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
onCommentsDataChange(commentData);
|
|
37
|
+
}, [commentData, onCommentsDataChange]);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div className="ff-comments-container">
|
|
41
|
+
<Comment
|
|
42
|
+
handleInsertNode={handleInsertNode}
|
|
43
|
+
handleEditNode={handleEditNode}
|
|
44
|
+
handleDeleteNode={handleDeleteNode}
|
|
45
|
+
comment={commentData}
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default Comments;
|