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
|
@@ -4,6 +4,8 @@ import './FileDropzone.scss';
|
|
|
4
4
|
import { DroppableProps } from './types';
|
|
5
5
|
import Button from '../Button';
|
|
6
6
|
import Typography from '../Typography';
|
|
7
|
+
import RadioGroup from '../RadioGroup';
|
|
8
|
+
import RadioFilePreview from './RadioFilePreview';
|
|
7
9
|
|
|
8
10
|
const Dropzone: FC<DroppableProps> = ({
|
|
9
11
|
icon,
|
|
@@ -14,42 +16,88 @@ const Dropzone: FC<DroppableProps> = ({
|
|
|
14
16
|
getInputProps,
|
|
15
17
|
isDragActive = false,
|
|
16
18
|
height = 188,
|
|
19
|
+
isWebServiceFileDropZone = false,
|
|
20
|
+
selectedRadioOption,
|
|
21
|
+
radioOptions,
|
|
22
|
+
handleOptionChange,
|
|
23
|
+
selectedFile,
|
|
24
|
+
setSelectedFile,
|
|
25
|
+
handleRemoveFile,
|
|
26
|
+
isDisable,
|
|
17
27
|
}) => {
|
|
28
|
+
const isWebServiceFile = selectedFile?.name && isWebServiceFileDropZone;
|
|
18
29
|
return (
|
|
19
30
|
<div
|
|
20
31
|
{...getRootProps()}
|
|
21
32
|
className={classNames('ff-file-dropzone', {
|
|
22
33
|
'ff-file-dropzone--active': isDragActive,
|
|
34
|
+
'ff-file-dropzone--webservice-file': isWebServiceFile,
|
|
35
|
+
'ff-file-dropzone--webservice-container': isWebServiceFileDropZone,
|
|
23
36
|
})}
|
|
24
|
-
style={{height: height}}
|
|
37
|
+
style={{ height: height }}
|
|
25
38
|
>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
39
|
+
{isWebServiceFile ? (
|
|
40
|
+
<RadioFilePreview
|
|
41
|
+
selectedFile={selectedFile.name}
|
|
42
|
+
onFileRemoveClick={handleRemoveFile}
|
|
43
|
+
onFileReplaceClick={setSelectedFile}
|
|
44
|
+
setSelectedFile={setSelectedFile}
|
|
45
|
+
/>
|
|
46
|
+
) : (
|
|
47
|
+
<>
|
|
48
|
+
<div className="ff-file-dropzone-content__icon">{icon}</div>
|
|
49
|
+
<div className="ff-file-dropzone-content__labels">
|
|
50
|
+
<Typography
|
|
51
|
+
as="p"
|
|
52
|
+
fontWeight="semi-bold"
|
|
53
|
+
lineHeight="18px"
|
|
54
|
+
textAlign="center"
|
|
55
|
+
color={'var(--text-color)'}
|
|
56
|
+
>
|
|
57
|
+
{primaryLabel}
|
|
58
|
+
</Typography>
|
|
59
|
+
<Typography
|
|
60
|
+
as="p"
|
|
61
|
+
lineHeight="18px"
|
|
62
|
+
textAlign="center"
|
|
63
|
+
color={'var(--text-color)'}
|
|
64
|
+
>
|
|
65
|
+
{secondaryLabel}
|
|
66
|
+
</Typography>
|
|
67
|
+
{isWebServiceFileDropZone ? (
|
|
68
|
+
<div className="ff-radio-group-wrapper">
|
|
69
|
+
<Typography fontWeight="semi-bold">
|
|
70
|
+
{' '}
|
|
71
|
+
Choose file from{' '}
|
|
72
|
+
</Typography>
|
|
73
|
+
<RadioGroup
|
|
74
|
+
name="radio_btn_file_dropzone"
|
|
75
|
+
options={
|
|
76
|
+
radioOptions ?? [
|
|
77
|
+
{ label: 'Default Label', value: 'default_value' },
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
selectedValue={selectedRadioOption?.value}
|
|
81
|
+
onChange={handleOptionChange}
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
84
|
+
) : (
|
|
85
|
+
<Button
|
|
86
|
+
variant="primary"
|
|
87
|
+
label={buttonLabel}
|
|
88
|
+
className='choose-file-btn'
|
|
89
|
+
disabled={isDisable}
|
|
90
|
+
>
|
|
91
|
+
<input
|
|
92
|
+
{...(isDisable
|
|
93
|
+
? { style: { cursor: 'not-allowed' }, disabled: true }
|
|
94
|
+
: getInputProps())}
|
|
95
|
+
/>
|
|
96
|
+
</Button>
|
|
97
|
+
)}
|
|
98
|
+
</div>
|
|
99
|
+
</>
|
|
100
|
+
)}
|
|
53
101
|
</div>
|
|
54
102
|
);
|
|
55
103
|
};
|
|
@@ -30,11 +30,22 @@
|
|
|
30
30
|
gap: 8px;
|
|
31
31
|
transition: background-color 0.2s ease;
|
|
32
32
|
|
|
33
|
+
.ff-radio-group-wrapper {
|
|
34
|
+
position: relative;
|
|
35
|
+
bottom: 8px;
|
|
36
|
+
}
|
|
37
|
+
|
|
33
38
|
&:hover,
|
|
34
39
|
&--active {
|
|
35
40
|
background-color: var(--file-dropzone-selected-color);
|
|
36
41
|
}
|
|
37
|
-
|
|
42
|
+
&--webservice-file {
|
|
43
|
+
@include center;
|
|
44
|
+
}
|
|
45
|
+
&--webservice-container {
|
|
46
|
+
@include center;
|
|
47
|
+
padding: 16px 0 40px 0;
|
|
48
|
+
}
|
|
38
49
|
&-content {
|
|
39
50
|
&__icon {
|
|
40
51
|
height: 80px;
|
|
@@ -60,17 +71,18 @@
|
|
|
60
71
|
}
|
|
61
72
|
}
|
|
62
73
|
}
|
|
74
|
+
&__webservice-file {
|
|
75
|
+
padding: 4px;
|
|
76
|
+
}
|
|
63
77
|
}
|
|
64
78
|
}
|
|
65
79
|
|
|
66
80
|
.ff-file-details-wrapper {
|
|
67
81
|
@include column-flex-gap(10px);
|
|
68
|
-
width: 640px;
|
|
69
82
|
max-height: 300px;
|
|
70
83
|
overflow-y: auto;
|
|
71
84
|
scroll-behavior: smooth;
|
|
72
85
|
padding: 2px;
|
|
73
|
-
|
|
74
86
|
::-webkit-scrollbar {
|
|
75
87
|
width: 2px;
|
|
76
88
|
}
|
|
@@ -134,3 +146,18 @@
|
|
|
134
146
|
}
|
|
135
147
|
}
|
|
136
148
|
}
|
|
149
|
+
.ff-webservice-file-wrapper {
|
|
150
|
+
display: flex;
|
|
151
|
+
gap: 8px;
|
|
152
|
+
.ff-webservice-file-name {
|
|
153
|
+
position: relative;
|
|
154
|
+
bottom: 2px;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
.ff-input-ref {
|
|
158
|
+
display: none;
|
|
159
|
+
}
|
|
160
|
+
.ff-disable-file-dropzone-wrapper {
|
|
161
|
+
opacity: 0.5;
|
|
162
|
+
cursor: not-allowed;
|
|
163
|
+
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import { StoryObj, Meta } from '@storybook/react';
|
|
3
3
|
import FileDropzone from './FileDropzone';
|
|
4
4
|
import Toaster from '../Toast';
|
|
5
5
|
import { useState } from 'react';
|
|
6
|
+
import { RadioOption } from './types';
|
|
7
|
+
import Drawer from '../Drawer/Drawer';
|
|
8
|
+
import Typography from '../Typography';
|
|
9
|
+
import './FileDropzone.scss';
|
|
6
10
|
|
|
7
11
|
const meta: Meta<typeof FileDropzone> = {
|
|
8
12
|
title: 'Components/FileDropzone',
|
|
@@ -59,13 +63,13 @@ export const Controlled: Story = {
|
|
|
59
63
|
}, 2000);
|
|
60
64
|
};
|
|
61
65
|
|
|
62
|
-
const getAcceptedFiles = (files) => {
|
|
66
|
+
const getAcceptedFiles = (files) => {
|
|
63
67
|
setAcceptedFiles(files);
|
|
64
|
-
}
|
|
68
|
+
};
|
|
65
69
|
|
|
66
70
|
const getRejectedFiles = (files) => {
|
|
67
71
|
setRejectedFiles(files);
|
|
68
|
-
}
|
|
72
|
+
};
|
|
69
73
|
|
|
70
74
|
return (
|
|
71
75
|
<>
|
|
@@ -81,6 +85,103 @@ export const Controlled: Story = {
|
|
|
81
85
|
onMaxFilesError={showMaxFilesError}
|
|
82
86
|
getAcceptedFiles={getAcceptedFiles}
|
|
83
87
|
getRejectedFiles={getRejectedFiles}
|
|
88
|
+
isApiResponseError
|
|
89
|
+
/>
|
|
90
|
+
{showToaster && (
|
|
91
|
+
<Toaster
|
|
92
|
+
isOpen={showToaster}
|
|
93
|
+
variant="danger"
|
|
94
|
+
toastTitle="Error"
|
|
95
|
+
toastMessage={'Max 5 files can be uploaded'}
|
|
96
|
+
/>
|
|
97
|
+
)}
|
|
98
|
+
</>
|
|
99
|
+
);
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const WithRadioButton: Story = {
|
|
104
|
+
render: () => {
|
|
105
|
+
const [showToaster, setShowToaster] = useState<boolean>(false);
|
|
106
|
+
const [showModal, setShowModal] = useState(false);
|
|
107
|
+
|
|
108
|
+
const [selectedRadioOption, setSelectedRadioOption] =
|
|
109
|
+
useState<RadioOption>();
|
|
110
|
+
const [selectedFile, setSelectedFile] = useState<File | null>(null);
|
|
111
|
+
|
|
112
|
+
const fileInputRef = useRef<HTMLInputElement | null>(null);
|
|
113
|
+
|
|
114
|
+
const drawerArgs = {
|
|
115
|
+
primaryButtonProps: {
|
|
116
|
+
label: 'Create',
|
|
117
|
+
variant: 'primary',
|
|
118
|
+
disabled: false,
|
|
119
|
+
onClick: () => {},
|
|
120
|
+
},
|
|
121
|
+
secondaryButtonProps: {
|
|
122
|
+
label: 'Cancel',
|
|
123
|
+
variant: 'secondary',
|
|
124
|
+
disabled: false,
|
|
125
|
+
onClick: () => {},
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
if (selectedRadioOption?.value === 'Local File' && fileInputRef.current) {
|
|
131
|
+
fileInputRef.current.click();
|
|
132
|
+
}
|
|
133
|
+
}, [selectedRadioOption]);
|
|
134
|
+
|
|
135
|
+
const radioOptions: RadioOption[] = [
|
|
136
|
+
{ value: 'Test Data', label: 'Test Data' },
|
|
137
|
+
{ value: 'Local File', label: 'Local File' },
|
|
138
|
+
];
|
|
139
|
+
const handleOptionChange = (option: RadioOption) => {
|
|
140
|
+
setSelectedRadioOption(option);
|
|
141
|
+
if (option.value === 'Test Data') {
|
|
142
|
+
setShowModal(true);
|
|
143
|
+
} else {
|
|
144
|
+
setShowModal(false);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
148
|
+
const file = event.target.files?.[0];
|
|
149
|
+
if (file) {
|
|
150
|
+
setSelectedFile(file);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const handleRemoveFile = () => {
|
|
155
|
+
setSelectedFile(null);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const showMaxFilesError = () => {
|
|
159
|
+
setShowToaster(true);
|
|
160
|
+
setTimeout(() => {
|
|
161
|
+
setShowToaster(false);
|
|
162
|
+
}, 2000);
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
return (
|
|
166
|
+
<>
|
|
167
|
+
<FileDropzone
|
|
168
|
+
{...defaultArgs}
|
|
169
|
+
accept={[
|
|
170
|
+
'image/png',
|
|
171
|
+
'image/jpeg',
|
|
172
|
+
'application/x-zip-compressed',
|
|
173
|
+
'application/zip',
|
|
174
|
+
]}
|
|
175
|
+
validateMIMEType={true}
|
|
176
|
+
onMaxFilesError={showMaxFilesError}
|
|
177
|
+
isWebServiceFileDropZone
|
|
178
|
+
selectedRadioOption={selectedRadioOption}
|
|
179
|
+
radioOptions={radioOptions}
|
|
180
|
+
handleOptionChange={handleOptionChange}
|
|
181
|
+
setSelectedFile={setSelectedFile}
|
|
182
|
+
selectedFile={selectedFile}
|
|
183
|
+
handleFileChange={handleFileChange}
|
|
184
|
+
handleRemoveFile={handleRemoveFile}
|
|
84
185
|
/>
|
|
85
186
|
{showToaster && (
|
|
86
187
|
<Toaster
|
|
@@ -90,6 +191,26 @@ export const Controlled: Story = {
|
|
|
90
191
|
toastMessage={'Max 5 files can be uploaded'}
|
|
91
192
|
/>
|
|
92
193
|
)}
|
|
194
|
+
{selectedRadioOption?.value === 'Local File' ? (
|
|
195
|
+
<input
|
|
196
|
+
ref={fileInputRef}
|
|
197
|
+
type="file"
|
|
198
|
+
className='ff-input-ref'
|
|
199
|
+
onChange={handleFileChange}
|
|
200
|
+
accept="image/png, image/jpeg, application/x-zip-compressed, application/zip"
|
|
201
|
+
/>
|
|
202
|
+
) : (
|
|
203
|
+
<Drawer
|
|
204
|
+
{...drawerArgs}
|
|
205
|
+
isOpen={showModal}
|
|
206
|
+
onClose={() => setShowModal(false)}
|
|
207
|
+
isFooterRequired={true}
|
|
208
|
+
_isExpanded={false}
|
|
209
|
+
size="small"
|
|
210
|
+
>
|
|
211
|
+
<Typography>Upload TestData Files Here</Typography>
|
|
212
|
+
</Drawer>
|
|
213
|
+
)}
|
|
93
214
|
</>
|
|
94
215
|
);
|
|
95
216
|
},
|
|
@@ -3,9 +3,10 @@ import { FileDropzoneProps } from './types';
|
|
|
3
3
|
import './FileDropzone.scss';
|
|
4
4
|
import Icon from '../Icon';
|
|
5
5
|
import { checkEmpty } from '../../utils/checkEmpty/checkEmpty';
|
|
6
|
-
import { useMemo } from 'react';
|
|
6
|
+
import { useEffect, useMemo } from 'react';
|
|
7
7
|
import Dropzone from './Dropzone';
|
|
8
8
|
import FilePreview from './FilePreview';
|
|
9
|
+
import classNames from 'classnames';
|
|
9
10
|
|
|
10
11
|
const FileDropzone: React.FC<FileDropzoneProps> = ({
|
|
11
12
|
icon = (
|
|
@@ -27,6 +28,16 @@ const FileDropzone: React.FC<FileDropzoneProps> = ({
|
|
|
27
28
|
height = 188,
|
|
28
29
|
getAcceptedFiles = () => {},
|
|
29
30
|
getRejectedFiles = () => {},
|
|
31
|
+
isWebServiceFileDropZone = false,
|
|
32
|
+
selectedRadioOption,
|
|
33
|
+
radioOptions,
|
|
34
|
+
handleOptionChange,
|
|
35
|
+
selectedFile,
|
|
36
|
+
setSelectedFile,
|
|
37
|
+
handleFileChange,
|
|
38
|
+
handleRemoveFile,
|
|
39
|
+
isApiResponseError = false,
|
|
40
|
+
isDisable = false,
|
|
30
41
|
}) => {
|
|
31
42
|
const {
|
|
32
43
|
getRootProps,
|
|
@@ -46,6 +57,7 @@ const FileDropzone: React.FC<FileDropzoneProps> = ({
|
|
|
46
57
|
invalidFileMessage,
|
|
47
58
|
fileExistMessage,
|
|
48
59
|
validateMIMEType,
|
|
60
|
+
isApiResponseError,
|
|
49
61
|
// onDrop: (accepted, rejected, event) => {}, //onDrop function to handle dropped or selected files explicitly.
|
|
50
62
|
});
|
|
51
63
|
|
|
@@ -65,6 +77,12 @@ const FileDropzone: React.FC<FileDropzoneProps> = ({
|
|
|
65
77
|
[acceptedFiles, handleRemoveClick, handleReplaceClick]
|
|
66
78
|
);
|
|
67
79
|
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (!checkEmpty(acceptedFiles) && setSelectedFile) {
|
|
82
|
+
setSelectedFile(acceptedFiles[0] || null);
|
|
83
|
+
}
|
|
84
|
+
}, [acceptedFiles, setSelectedFile]);
|
|
85
|
+
|
|
68
86
|
const rejectedFilesList = useMemo(
|
|
69
87
|
() =>
|
|
70
88
|
rejectedFiles.map((rejectedFile) => (
|
|
@@ -80,7 +98,9 @@ const FileDropzone: React.FC<FileDropzoneProps> = ({
|
|
|
80
98
|
);
|
|
81
99
|
|
|
82
100
|
return (
|
|
83
|
-
<div className=
|
|
101
|
+
<div className={classNames('ff-file-dropzone-wrapper',
|
|
102
|
+
{'ff-disable-file-dropzone-wrapper': isDisable,}
|
|
103
|
+
)} style={{ width: `${width}px` }}>
|
|
84
104
|
<Dropzone
|
|
85
105
|
icon={icon}
|
|
86
106
|
primaryLabel={primaryLabel}
|
|
@@ -90,20 +110,33 @@ const FileDropzone: React.FC<FileDropzoneProps> = ({
|
|
|
90
110
|
getInputProps={getInputProps}
|
|
91
111
|
isDragActive={isDragActive}
|
|
92
112
|
height={`${height}px`}
|
|
113
|
+
isWebServiceFileDropZone={isWebServiceFileDropZone}
|
|
114
|
+
selectedRadioOption={selectedRadioOption}
|
|
115
|
+
radioOptions={
|
|
116
|
+
radioOptions ?? [{ label: 'Default Label', value: 'default_value' }]
|
|
117
|
+
}
|
|
118
|
+
handleOptionChange={handleOptionChange}
|
|
119
|
+
selectedFile={selectedFile}
|
|
120
|
+
handleFileChange={handleFileChange}
|
|
121
|
+
handleRemoveFile={handleRemoveFile}
|
|
122
|
+
setSelectedFile={setSelectedFile}
|
|
123
|
+
isDisable={isDisable}
|
|
93
124
|
/>
|
|
94
125
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
126
|
+
{isWebServiceFileDropZone ? null : (
|
|
127
|
+
<div
|
|
128
|
+
className={'ff-file-details-wrapper'}
|
|
129
|
+
style={{ width: `${width}px` }}
|
|
130
|
+
>
|
|
131
|
+
{!checkEmpty(acceptedFiles) && (
|
|
132
|
+
<div className="ff-file-details">{acceptedFilesList}</div>
|
|
133
|
+
)}
|
|
102
134
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
135
|
+
{!checkEmpty(rejectedFiles) && (
|
|
136
|
+
<div className="ff-file-details">{rejectedFilesList}</div>
|
|
137
|
+
)}
|
|
138
|
+
</div>
|
|
139
|
+
)}
|
|
107
140
|
</div>
|
|
108
141
|
);
|
|
109
142
|
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import './FileDropzone.scss';
|
|
2
|
+
import Icon from '../Icon';
|
|
3
|
+
import Tooltip from '../Tooltip';
|
|
4
|
+
import { RadioFilePreviewProps } from './types';
|
|
5
|
+
import Typography from '../Typography';
|
|
6
|
+
import { useRef } from 'react';
|
|
7
|
+
|
|
8
|
+
const RadioFilePreview: React.FC<RadioFilePreviewProps> = ({
|
|
9
|
+
selectedFile,
|
|
10
|
+
onFileRemoveClick,
|
|
11
|
+
onFileReplaceClick
|
|
12
|
+
}) => {
|
|
13
|
+
const fileInputRef = useRef<HTMLInputElement | null>(null);
|
|
14
|
+
|
|
15
|
+
const handleReplaceClick = () => {
|
|
16
|
+
if (fileInputRef.current) {
|
|
17
|
+
fileInputRef.current.click();
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
22
|
+
const file = event.target.files?.[0];
|
|
23
|
+
if (file) {
|
|
24
|
+
onFileReplaceClick?.(file);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return (
|
|
28
|
+
<div className="ff-webservice-file-wrapper">
|
|
29
|
+
<div className="ff-file-info">
|
|
30
|
+
<>
|
|
31
|
+
<Tooltip title={selectedFile}>
|
|
32
|
+
<Typography
|
|
33
|
+
lineHeight="18px"
|
|
34
|
+
fontWeight="semi-bold"
|
|
35
|
+
color={'var(--text-color)'}
|
|
36
|
+
className="ff-webservice-file-name"
|
|
37
|
+
>
|
|
38
|
+
{selectedFile}
|
|
39
|
+
</Typography>
|
|
40
|
+
</Tooltip>
|
|
41
|
+
</>
|
|
42
|
+
</div>
|
|
43
|
+
<>
|
|
44
|
+
<Tooltip title="Remove">
|
|
45
|
+
<Icon
|
|
46
|
+
name="close"
|
|
47
|
+
height={12}
|
|
48
|
+
width={12}
|
|
49
|
+
hoverEffect
|
|
50
|
+
onClick={onFileRemoveClick}
|
|
51
|
+
/>
|
|
52
|
+
</Tooltip>
|
|
53
|
+
</>
|
|
54
|
+
<>
|
|
55
|
+
<Tooltip title="Replace">
|
|
56
|
+
<Icon
|
|
57
|
+
name="replace_file"
|
|
58
|
+
color={'var(--icons-default-color)'}
|
|
59
|
+
height={16}
|
|
60
|
+
width={16}
|
|
61
|
+
hoverEffect
|
|
62
|
+
onClick={handleReplaceClick}
|
|
63
|
+
/>
|
|
64
|
+
</Tooltip>
|
|
65
|
+
<input
|
|
66
|
+
type="file"
|
|
67
|
+
ref={fileInputRef}
|
|
68
|
+
className='ff-input-ref'
|
|
69
|
+
onChange={handleFileChange}
|
|
70
|
+
/>
|
|
71
|
+
</>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default RadioFilePreview;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
export interface RadioOption {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
2
6
|
|
|
3
7
|
export interface FileDropzoneProps {
|
|
4
8
|
/**
|
|
@@ -65,6 +69,57 @@ export interface FileDropzoneProps {
|
|
|
65
69
|
* Returns the rejected files in the state
|
|
66
70
|
**/
|
|
67
71
|
getRejectedFiles?: (files: FileRejection[]) => void;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* If its used in WebService has some other functionality so need to pass boolean value.
|
|
75
|
+
**/
|
|
76
|
+
isWebServiceFileDropZone?: boolean;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Its the selected radio option as a string.
|
|
80
|
+
**/
|
|
81
|
+
selectedRadioOption?: RadioOption;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Its the array of radio options in pattern of : { label: string; value: string; }.
|
|
85
|
+
**/
|
|
86
|
+
radioOptions?: RadioOption[];
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Its the function which updates the selected radio option.
|
|
90
|
+
**/
|
|
91
|
+
handleOptionChange?: (option: RadioOption)=> void;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Its the File Name of File Selected from Local File.
|
|
95
|
+
**/
|
|
96
|
+
setSelectedFile?: (file: File | null) => void;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Its the File Name of File Selected from Local File.
|
|
100
|
+
**/
|
|
101
|
+
selectedFile?: File | null;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Its the function which updates the Selected file from Local Directory.
|
|
105
|
+
**/
|
|
106
|
+
handleFileChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Its the function which makes the selected File empty state.
|
|
110
|
+
**/
|
|
111
|
+
handleRemoveFile?: () => void;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* When The Api for the response fails need to show error message.
|
|
115
|
+
**/
|
|
116
|
+
isApiResponseError?: boolean;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* If isDisable is true not able to access the FileDropzone
|
|
120
|
+
**/
|
|
121
|
+
isDisable?: boolean;
|
|
122
|
+
|
|
68
123
|
}
|
|
69
124
|
export interface FileState {
|
|
70
125
|
accepted: File[];
|
|
@@ -95,6 +150,7 @@ export interface DropzoneOptions {
|
|
|
95
150
|
invalidFileMessage?: string;
|
|
96
151
|
fileExistMessage?: string;
|
|
97
152
|
validateMIMEType?: boolean;
|
|
153
|
+
isApiResponseError?:boolean;
|
|
98
154
|
}
|
|
99
155
|
|
|
100
156
|
export interface DropzoneState {
|
|
@@ -116,6 +172,15 @@ export interface DroppableProps {
|
|
|
116
172
|
getInputProps: () => any;
|
|
117
173
|
isDragActive: boolean;
|
|
118
174
|
height: number | string;
|
|
175
|
+
isWebServiceFileDropZone?: boolean;
|
|
176
|
+
selectedRadioOption?: Option,
|
|
177
|
+
radioOptions?: RadioOption[],
|
|
178
|
+
handleOptionChange?: (option: RadioOption)=> void,
|
|
179
|
+
selectedFile?: File | null,
|
|
180
|
+
setSelectedFile?: (file: File | null) => void;
|
|
181
|
+
handleFileChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
182
|
+
handleRemoveFile?: () => void;
|
|
183
|
+
isDisable?: boolean;
|
|
119
184
|
}
|
|
120
185
|
|
|
121
186
|
export interface FilePreviewProps {
|
|
@@ -124,3 +189,11 @@ export interface FilePreviewProps {
|
|
|
124
189
|
onRemoveClick: (file: File) => void;
|
|
125
190
|
onReplaceClick: (file: File) => void;
|
|
126
191
|
}
|
|
192
|
+
|
|
193
|
+
export interface RadioFilePreviewProps {
|
|
194
|
+
selectedFile: string;
|
|
195
|
+
error?: string;
|
|
196
|
+
onFileRemoveClick?: () => void;
|
|
197
|
+
onFileReplaceClick?: (file: File | null) => void;
|
|
198
|
+
setSelectedFile?: (file: File | null) => void;
|
|
199
|
+
}
|