pixel-react 1.1.7 → 1.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/lib/components/AttachmentButton/AttachmentButton.d.ts +5 -0
  3. package/lib/components/AttachmentButton/AttachmentButton.stories.d.ts +9 -0
  4. package/lib/components/AttachmentButton/index.d.ts +1 -0
  5. package/lib/components/AttachmentButton/types.d.ts +8 -0
  6. package/lib/components/ExcelFile/ChangeExcelStyles.d.ts +14 -0
  7. package/lib/components/ExcelFile/ColorBarSelector/ColorBarSelector.d.ts +8 -0
  8. package/lib/components/ExcelFile/ContextMenu/ContextMenu.d.ts +4 -0
  9. package/lib/components/ExcelFile/ExcelFile/Excel/ActiveCell.d.ts +7 -0
  10. package/lib/components/ExcelFile/ExcelFile/Excel/Cell.d.ts +4 -0
  11. package/lib/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.d.ts +5 -0
  12. package/lib/components/ExcelFile/ExcelFile/Excel/Copied.d.ts +3 -0
  13. package/lib/components/ExcelFile/ExcelFile/Excel/CornerIndicator.d.ts +5 -0
  14. package/lib/components/ExcelFile/ExcelFile/Excel/DataEditor.d.ts +5 -0
  15. package/lib/components/ExcelFile/ExcelFile/Excel/DataViewer.d.ts +8 -0
  16. package/lib/components/ExcelFile/ExcelFile/Excel/FloatingRect.d.ts +10 -0
  17. package/lib/components/ExcelFile/ExcelFile/Excel/HeaderRow.d.ts +3 -0
  18. package/lib/components/ExcelFile/ExcelFile/Excel/Row.d.ts +3 -0
  19. package/lib/components/ExcelFile/ExcelFile/Excel/RowIndicator.d.ts +5 -0
  20. package/lib/components/ExcelFile/ExcelFile/Excel/Selected.d.ts +3 -0
  21. package/lib/components/ExcelFile/ExcelFile/Excel/Spreadsheet.d.ts +81 -0
  22. package/lib/components/ExcelFile/ExcelFile/Excel/Table.d.ts +3 -0
  23. package/lib/components/ExcelFile/ExcelFile/Excel/actions.d.ts +130 -0
  24. package/lib/components/ExcelFile/ExcelFile/Excel/areModelsEqual.d.ts +1 -0
  25. package/lib/components/ExcelFile/ExcelFile/Excel/context.d.ts +8 -0
  26. package/lib/components/ExcelFile/ExcelFile/Excel/engine/engine.d.ts +22 -0
  27. package/lib/components/ExcelFile/ExcelFile/Excel/engine/formula.d.ts +17 -0
  28. package/lib/components/ExcelFile/ExcelFile/Excel/engine/index.d.ts +2 -0
  29. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-graph.d.ts +21 -0
  30. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-hash.d.ts +3 -0
  31. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-set.d.ts +24 -0
  32. package/lib/components/ExcelFile/ExcelFile/Excel/index.d.ts +13 -0
  33. package/lib/components/ExcelFile/ExcelFile/Excel/matrix.d.ts +67 -0
  34. package/lib/components/ExcelFile/ExcelFile/Excel/point-range.d.ts +22 -0
  35. package/lib/components/ExcelFile/ExcelFile/Excel/point.d.ts +11 -0
  36. package/lib/components/ExcelFile/ExcelFile/Excel/reducer.d.ts +27 -0
  37. package/lib/components/ExcelFile/ExcelFile/Excel/selection.d.ts +95 -0
  38. package/lib/components/ExcelFile/ExcelFile/Excel/types.d.ts +215 -0
  39. package/lib/components/ExcelFile/ExcelFile/Excel/use-dispatch.d.ts +3 -0
  40. package/lib/components/ExcelFile/ExcelFile/Excel/use-selector.d.ts +3 -0
  41. package/lib/components/ExcelFile/ExcelFile/Excel/util.d.ts +45 -0
  42. package/lib/components/ExcelFile/ExcelFile/ExcelFile.d.ts +3 -0
  43. package/lib/components/ExcelFile/ExcelFile.stories.d.ts +6 -0
  44. package/lib/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.d.ts +15 -0
  45. package/lib/components/ExcelFile/ExcelToolBar/ExcelToolBar.d.ts +3 -0
  46. package/lib/components/ExcelFile/ImportExcelStyles.d.ts +24 -0
  47. package/lib/components/ExcelFile/Types.d.ts +176 -0
  48. package/lib/components/ExcelFile/index.d.ts +1 -0
  49. package/lib/components/IconRadioGroup/IconRadioGroup.d.ts +5 -0
  50. package/lib/components/IconRadioGroup/IconRadioGroup.stories.d.ts +7 -0
  51. package/lib/components/IconRadioGroup/index.d.ts +1 -0
  52. package/lib/components/IconRadioGroup/type.d.ts +41 -0
  53. package/lib/components/RadioButton/radioButtonTypes.d.ts +15 -0
  54. package/lib/components/RadioGroup/RadioGroup.stories.d.ts +2 -1
  55. package/lib/components/RadioGroup/radioGroupTypes.d.ts +15 -0
  56. package/lib/components/Select/Select.d.ts +1 -1
  57. package/lib/components/Select/types.d.ts +4 -0
  58. package/lib/components/Table/Table.d.ts +1 -1
  59. package/lib/components/Table/Types.d.ts +8 -0
  60. package/lib/components/TableTree/TableTree.d.ts +1 -0
  61. package/lib/index.d.ts +71 -3
  62. package/lib/index.esm.js +408 -151
  63. package/lib/index.esm.js.map +1 -1
  64. package/lib/index.js +409 -150
  65. package/lib/index.js.map +1 -1
  66. package/lib/tsconfig.tsbuildinfo +1 -1
  67. package/package.json +4 -2
  68. package/src/assets/Themes/BaseTheme.scss +11 -0
  69. package/src/assets/Themes/DarkTheme.scss +10 -0
  70. package/src/assets/icons/add_file.svg +14 -0
  71. package/src/assets/icons/all_borders.svg +3 -0
  72. package/src/assets/icons/bold.svg +3 -0
  73. package/src/assets/icons/border_bottom.svg +3 -0
  74. package/src/assets/icons/border_left.svg +3 -0
  75. package/src/assets/icons/border_right.svg +3 -0
  76. package/src/assets/icons/border_top.svg +3 -0
  77. package/src/assets/icons/clone_icon.svg +3 -0
  78. package/src/assets/icons/double_underline.svg +5 -0
  79. package/src/assets/icons/fill_color.svg +7 -0
  80. package/src/assets/icons/formate_painter.svg +5 -0
  81. package/src/assets/icons/full_access_icon.svg +4 -0
  82. package/src/assets/icons/history_icon.svg +19 -0
  83. package/src/assets/icons/italic.svg +3 -0
  84. package/src/assets/icons/jira.svg +3 -0
  85. package/src/assets/icons/linked_defects.svg +11 -0
  86. package/src/assets/icons/move_icon.svg +5 -0
  87. package/src/assets/icons/nlp_help_icon.svg +3 -0
  88. package/src/assets/icons/no_access_icon.svg +4 -0
  89. package/src/assets/icons/no_border.svg +3 -0
  90. package/src/assets/icons/notification_icon.svg +3 -0
  91. package/src/assets/icons/strike_through.svg +3 -0
  92. package/src/assets/icons/text_align_center.svg +3 -0
  93. package/src/assets/icons/text_align_left.svg +3 -0
  94. package/src/assets/icons/text_align_right.svg +3 -0
  95. package/src/assets/icons/text_color.svg +3 -0
  96. package/src/assets/icons/underline.svg +4 -0
  97. package/src/assets/icons/update_icon.svg +3 -0
  98. package/src/assets/icons/view_access_icon.svg +4 -0
  99. package/src/components/AppHeader/AppHeader.scss +65 -4
  100. package/src/components/AppHeader/AppHeader.stories.tsx +1 -0
  101. package/src/components/AppHeader/AppHeader.tsx +7 -5
  102. package/src/components/AttachmentButton/AttachmentButton.scss +9 -0
  103. package/src/components/AttachmentButton/AttachmentButton.stories.tsx +76 -0
  104. package/src/components/AttachmentButton/AttachmentButton.tsx +113 -0
  105. package/src/components/AttachmentButton/index.ts +1 -0
  106. package/src/components/AttachmentButton/types.ts +8 -0
  107. package/src/components/Drawer/Drawer.scss +0 -1
  108. package/src/components/ExcelFile/ChangeExcelStyles.tsx +78 -0
  109. package/src/components/ExcelFile/ColorBarselector/ColorBarSelector.scss +13 -0
  110. package/src/components/ExcelFile/ColorBarselector/ColorBarSelector.tsx +43 -0
  111. package/src/components/ExcelFile/ContextMenu/ContextMenu.scss +102 -0
  112. package/src/components/ExcelFile/ContextMenu/ContextMenu.tsx +104 -0
  113. package/src/components/ExcelFile/ExcelFile/Excel/ActiveCell.tsx +131 -0
  114. package/src/components/ExcelFile/ExcelFile/Excel/Cell.tsx +201 -0
  115. package/src/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.tsx +123 -0
  116. package/src/components/ExcelFile/ExcelFile/Excel/Copied.tsx +25 -0
  117. package/src/components/ExcelFile/ExcelFile/Excel/CornerIndicator.tsx +49 -0
  118. package/src/components/ExcelFile/ExcelFile/Excel/DataEditor.tsx +37 -0
  119. package/src/components/ExcelFile/ExcelFile/Excel/DataViewer.tsx +46 -0
  120. package/src/components/ExcelFile/ExcelFile/Excel/FloatingRect.tsx +31 -0
  121. package/src/components/ExcelFile/ExcelFile/Excel/HeaderRow.tsx +5 -0
  122. package/src/components/ExcelFile/ExcelFile/Excel/Row.tsx +5 -0
  123. package/src/components/ExcelFile/ExcelFile/Excel/RowIndicator.tsx +102 -0
  124. package/src/components/ExcelFile/ExcelFile/Excel/Selected.tsx +32 -0
  125. package/src/components/ExcelFile/ExcelFile/Excel/Spreadsheet.css +144 -0
  126. package/src/components/ExcelFile/ExcelFile/Excel/Spreadsheet.tsx +494 -0
  127. package/src/components/ExcelFile/ExcelFile/Excel/Table.tsx +19 -0
  128. package/src/components/ExcelFile/ExcelFile/Excel/actions.ts +302 -0
  129. package/src/components/ExcelFile/ExcelFile/Excel/areModelsEqual.ts +18 -0
  130. package/src/components/ExcelFile/ExcelFile/Excel/context.ts +12 -0
  131. package/src/components/ExcelFile/ExcelFile/Excel/engine/engine.ts +200 -0
  132. package/src/components/ExcelFile/ExcelFile/Excel/engine/formula.ts +137 -0
  133. package/src/components/ExcelFile/ExcelFile/Excel/engine/index.ts +2 -0
  134. package/src/components/ExcelFile/ExcelFile/Excel/engine/point-graph.ts +154 -0
  135. package/src/components/ExcelFile/ExcelFile/Excel/engine/point-hash.ts +10 -0
  136. package/src/components/ExcelFile/ExcelFile/Excel/engine/point-set.ts +69 -0
  137. package/src/components/ExcelFile/ExcelFile/Excel/index.ts +48 -0
  138. package/src/components/ExcelFile/ExcelFile/Excel/matrix.ts +388 -0
  139. package/src/components/ExcelFile/ExcelFile/Excel/point-range.ts +82 -0
  140. package/src/components/ExcelFile/ExcelFile/Excel/point.ts +15 -0
  141. package/src/components/ExcelFile/ExcelFile/Excel/reducer.ts +682 -0
  142. package/src/components/ExcelFile/ExcelFile/Excel/selection.ts +257 -0
  143. package/src/components/ExcelFile/ExcelFile/Excel/types.ts +269 -0
  144. package/src/components/ExcelFile/ExcelFile/Excel/typings/fast-formula-parser.d.ts +58 -0
  145. package/src/components/ExcelFile/ExcelFile/Excel/use-dispatch.ts +8 -0
  146. package/src/components/ExcelFile/ExcelFile/Excel/use-selector.ts +9 -0
  147. package/src/components/ExcelFile/ExcelFile/Excel/util.ts +173 -0
  148. package/src/components/ExcelFile/ExcelFile/ExcelFile.scss +27 -0
  149. package/src/components/ExcelFile/ExcelFile/ExcelFile.tsx +520 -0
  150. package/src/components/ExcelFile/ExcelFile.stories.tsx +132 -0
  151. package/src/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.scss +16 -0
  152. package/src/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.tsx +79 -0
  153. package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.scss +22 -0
  154. package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.tsx +271 -0
  155. package/src/components/ExcelFile/ImportExcelStyles.tsx +86 -0
  156. package/src/components/ExcelFile/Types.ts +241 -0
  157. package/src/components/ExcelFile/index.ts +1 -0
  158. package/src/components/Icon/Icons.scss +2 -3
  159. package/src/components/Icon/iconList.ts +59 -1
  160. package/src/components/IconRadioGroup/IconRadioGroup.scss +60 -0
  161. package/src/components/IconRadioGroup/IconRadioGroup.stories.tsx +108 -0
  162. package/src/components/IconRadioGroup/IconRadioGroup.tsx +72 -0
  163. package/src/components/IconRadioGroup/index.ts +1 -0
  164. package/src/components/IconRadioGroup/type.ts +50 -0
  165. package/src/components/Modal/modal.scss +1 -1
  166. package/src/components/MultiSelect/MultiSelect.scss +2 -2
  167. package/src/components/RadioButton/RadioButton.scss +74 -68
  168. package/src/components/RadioButton/RadioButton.tsx +22 -15
  169. package/src/components/RadioButton/radioButtonTypes.tsx +18 -0
  170. package/src/components/RadioGroup/RadioGroup.stories.tsx +42 -1
  171. package/src/components/RadioGroup/RadioGroup.tsx +3 -0
  172. package/src/components/RadioGroup/radioGroupTypes.tsx +18 -0
  173. package/src/components/Select/Select.scss +1 -2
  174. package/src/components/Select/Select.tsx +3 -2
  175. package/src/components/Select/types.ts +5 -0
  176. package/src/components/SequentialConnectingBranch/components/Branches/Branches.scss +5 -5
  177. package/src/components/SequentialConnectingBranch/components/Branches/Branches.tsx +1 -1
  178. package/src/components/Table/Table.scss +1 -0
  179. package/src/components/Table/Table.tsx +28 -13
  180. package/src/components/Table/Types.ts +8 -0
  181. package/src/components/TableTree/TableTree.scss +18 -2
  182. package/src/components/TableTree/TableTree.stories.tsx +9 -51
  183. package/src/components/TableTree/TableTree.tsx +15 -2
  184. package/src/index.ts +4 -0
@@ -146,6 +146,7 @@ export const Controlled: Story = {
146
146
  <div>
147
147
  <AppHeader
148
148
  logoIconName="fireflink_icon"
149
+ leftContent={headerRightSideContent}
149
150
  rightContent={headerRightSideContent}
150
151
  appHeaderMenuItems={headerMenuItems}
151
152
  appHeaderHiddenMenuItems={headerHiddenMenuItems}
@@ -22,12 +22,14 @@ const AppHeader: React.FC<AppHeaderProps> = ({
22
22
  return (
23
23
  <>
24
24
  <div className="ff-app-header">
25
- <div className="ff-app-header-logo-icon">
26
- <Icon color="" name={logoIconName} height={24} width={21} />
25
+ <div className='ff-app-header-left-container'>
26
+ <div className="ff-app-header-logo-icon">
27
+ <Icon color="" name={logoIconName} height={24} width={21} />
28
+ </div>
29
+ {leftContent && (
30
+ <div className="ff-app-header-left-content">{leftContent}</div>
31
+ )}
27
32
  </div>
28
- {leftContent && (
29
- <div className="ff-app-header-left-content">{leftContent}</div>
30
- )}
31
33
  <div className="ff-app-header-nav-bar">
32
34
  {checkEmpty(projectsList) && (
33
35
  <div>{/* <AllProjectsDropdown /> */}</div>
@@ -0,0 +1,9 @@
1
+ .ff-input-field {
2
+ display: none;
3
+ }
4
+ .ff-attachment-files {
5
+ padding: 9px;
6
+ display: flex;
7
+ align-items: center;
8
+ gap: 4px;
9
+ }
@@ -0,0 +1,76 @@
1
+ import { useState } from 'react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import AttachmentButton from './AttachmentButton';
4
+
5
+ const meta: Meta<typeof AttachmentButton> = {
6
+ title: 'Components/AttachmentButton',
7
+ component: AttachmentButton,
8
+ argTypes: {
9
+ onFilesChange: { action: 'files changed' },
10
+ disabled: { control: 'boolean' },
11
+ maxFileSizeMB: { control: 'number' },
12
+ maxFiles: { control: 'number' },
13
+ },
14
+ };
15
+
16
+ type Story = StoryObj<typeof AttachmentButton>;
17
+
18
+ const defaultArgs = {
19
+ disabled: false,
20
+ maxFileSizeMB: 5,
21
+ maxFiles: 10,
22
+ };
23
+
24
+ export const Default: Story = {
25
+ args: {
26
+ ...defaultArgs,
27
+ label: 'Upload Files',
28
+ },
29
+ render: (args) => {
30
+ const [selectedFiles, setSelectedFiles] = useState<File[]>([]);
31
+
32
+ const handleFilesChange = (files: File[]) => {
33
+ setSelectedFiles(files);
34
+ args.onFilesChange(files);
35
+ };
36
+
37
+ return (
38
+ <AttachmentButton
39
+ {...args}
40
+ selectedFiles={selectedFiles}
41
+ onFilesChange={handleFilesChange}
42
+ />
43
+ );
44
+ },
45
+ };
46
+
47
+ export const SmallFileLimit: Story = {
48
+ args: {
49
+ ...defaultArgs,
50
+ label: 'Upload Files (2 MB Max)',
51
+ maxFileSizeMB: 2,
52
+ maxFiles: 5,
53
+ },
54
+ render: Default.render,
55
+ };
56
+
57
+ export const LargeFileLimit: Story = {
58
+ args: {
59
+ ...defaultArgs,
60
+ label: 'Upload Large Files (20 MB Max)',
61
+ maxFileSizeMB: 20,
62
+ maxFiles: 5,
63
+ },
64
+ render: Default.render,
65
+ };
66
+
67
+ export const DisabledUploader: Story = {
68
+ args: {
69
+ ...defaultArgs,
70
+ label: 'Disabled Uploader',
71
+ disabled: true,
72
+ },
73
+ render: Default.render,
74
+ };
75
+
76
+ export default meta;
@@ -0,0 +1,113 @@
1
+ import React, { useRef, useState } from 'react';
2
+ import Typography from '../Typography';
3
+ import Button from '../Button';
4
+ import Toaster from '../Toast';
5
+ import Icon from '../Icon';
6
+ import { AttachmentUploaderProps } from './types';
7
+ import './AttachmentButton.scss';
8
+
9
+ const AttachmentButton: React.FC<AttachmentUploaderProps> = ({
10
+ label,
11
+ selectedFiles,
12
+ onFilesChange,
13
+ disabled = false,
14
+ maxFileSizeMB = 5, // Default to 5 MB if not provided
15
+ maxFiles = 10, // Default to 10 files if not provided
16
+ }) => {
17
+ const fileInputRef = useRef<HTMLInputElement | null>(null);
18
+ const [fileError, setFileError] = useState<string>('');
19
+ const maxFileSizeBytes = maxFileSizeMB * 1024 * 1024;
20
+
21
+ const handleAttachmentClick = () => {
22
+ fileInputRef.current?.click();
23
+ };
24
+
25
+ const handleFileChange = () => {
26
+ setFileError('');
27
+ if (fileInputRef.current?.files) {
28
+ const files = Array.from(fileInputRef.current.files);
29
+ const duplicateFiles = files.filter((file) =>
30
+ selectedFiles.some((selectedFile) => selectedFile.name === file.name)
31
+ );
32
+ if (duplicateFiles.length > 0) {
33
+ setFileError('This file is already selected.');
34
+ fileInputRef.current.value = '';
35
+ return;
36
+ }
37
+ if (selectedFiles.length + files.length > maxFiles) {
38
+ setFileError(`You can only select up to ${maxFiles} files.`);
39
+ fileInputRef.current.value = '';
40
+ return;
41
+ }
42
+ const oversizedFiles = files.filter(
43
+ (file) => file.size > maxFileSizeBytes
44
+ );
45
+ if (oversizedFiles.length > 0) {
46
+ setFileError(`Each file must be less than ${maxFileSizeMB} MB.`);
47
+ fileInputRef.current.value = '';
48
+ return;
49
+ }
50
+ onFilesChange([...selectedFiles, ...files]);
51
+ fileInputRef.current.value = '';
52
+ }
53
+ };
54
+
55
+ const handleDeleteFile = (index: number) => {
56
+ const updatedFiles = [...selectedFiles];
57
+ updatedFiles.splice(index, 1);
58
+ onFilesChange(updatedFiles);
59
+ };
60
+
61
+ return (
62
+ <div>
63
+ <Typography fontWeight="semi-bold">{label}</Typography>
64
+ {selectedFiles.length === 0 && (
65
+ <Button
66
+ variant="primary"
67
+ label="Select Files"
68
+ size="medium"
69
+ onClick={handleAttachmentClick}
70
+ disabled={disabled}
71
+ />
72
+ )}
73
+ <input
74
+ type="file"
75
+ ref={fileInputRef}
76
+ className="ff-input-field"
77
+ onChange={handleFileChange}
78
+ multiple
79
+ accept="*"
80
+ />
81
+ {fileError && (
82
+ <Toaster
83
+ isOpen={!!fileError}
84
+ variant="info"
85
+ toastTitle="Error"
86
+ toastMessage={fileError}
87
+ zIndex={10000000}
88
+ />
89
+ )}
90
+ {selectedFiles.map((file, index) => (
91
+ <div key={file.name} className="ff-attachment-files">
92
+ <Typography color="var(--brand-color)">{file.name}</Typography>
93
+ <Icon
94
+ name="delete"
95
+ color="var(--ff-delete-button-attachment)"
96
+ onClick={() => handleDeleteFile(index)}
97
+ />
98
+ {index === selectedFiles.length - 1 &&
99
+ selectedFiles.length < maxFiles && (
100
+ <Icon
101
+ name="add_file"
102
+ height={24}
103
+ width={24}
104
+ onClick={handleAttachmentClick}
105
+ />
106
+ )}
107
+ </div>
108
+ ))}
109
+ </div>
110
+ );
111
+ };
112
+
113
+ export default AttachmentButton;
@@ -0,0 +1 @@
1
+ export { default } from './AttachmentButton';
@@ -0,0 +1,8 @@
1
+ export interface AttachmentUploaderProps {
2
+ label: string;
3
+ selectedFiles: File[];
4
+ onFilesChange: (files: File[]) => void;
5
+ disabled?: boolean;
6
+ maxFileSizeMB?: number;
7
+ maxFiles?: number;
8
+ }
@@ -11,7 +11,6 @@
11
11
  .ff-drawer {
12
12
  position: fixed;
13
13
  right: 0;
14
- top: 80px;
15
14
  bottom: 0;
16
15
  min-width: 450px;
17
16
  background-color: var(--primary-button-text-color);
@@ -0,0 +1,78 @@
1
+ import { CellBase } from "./ExcelFile/Excel";
2
+
3
+ interface ChangeExcelStylesOptions {
4
+ sheetName: string;
5
+ styleType: string;
6
+ value: string;
7
+ selectedCell: { row: number; column: number }[];
8
+ }
9
+
10
+ export default function ChangeExcelStyles(
11
+ setWorksheetsData: React.Dispatch<React.SetStateAction<{ [key: string]: Matrix<CellBase>; }>>,
12
+ options: ChangeExcelStylesOptions
13
+ ) {
14
+ const { sheetName, styleType, value, selectedCell } = options;
15
+
16
+ setWorksheetsData((prev) => {
17
+ if (!prev[sheetName]) {
18
+ return prev;
19
+ }
20
+
21
+ const sheetData = prev[sheetName]!;
22
+ const selectedCells = new Set(
23
+ selectedCell.map(({ row, column }) => `${row}-${column}`)
24
+ );
25
+
26
+ const updatedSheetData: Matrix<CellBase> = sheetData.map((row, rowIndex) =>
27
+ row.map((cell, columnIndex) => {
28
+ const isSelected = selectedCells.has(`${rowIndex}-${columnIndex}`);
29
+ if (isSelected&&cell!==undefined) {
30
+ let newStyle = { ...cell.style };
31
+
32
+ switch (styleType) {
33
+ // case 'border':
34
+ // newStyle = handleBorderChange(newStyle, value);
35
+ // break;
36
+ // case 'alignment':
37
+ // newStyle = handleAlignmentChange(newStyle, value);
38
+ // break;
39
+ // case 'bold':
40
+ // newStyle = handleBoldChange(newStyle);
41
+ // break;
42
+ // case 'italic':
43
+ // newStyle = handleItalicChange(newStyle);
44
+ // break;
45
+ case 'color':
46
+ newStyle = handleColorChange(newStyle, value);
47
+ break;
48
+ case 'backgroundColor':
49
+ newStyle = handleBackgroundColorChange(newStyle, value);
50
+ break;
51
+ default:
52
+ break;
53
+ }
54
+
55
+ const newValue = cell.value ?? "";
56
+
57
+ return { ...cell, style: newStyle, value: newValue };
58
+ }
59
+ return cell;
60
+ })
61
+ );
62
+
63
+
64
+
65
+ return { ...prev, [sheetName]: updatedSheetData };
66
+ });
67
+ }
68
+
69
+ function handleColorChange(style: CellStyle, value: string): CellStyle {
70
+ return { ...style, color: `#${value}` };
71
+ }
72
+
73
+ function handleBackgroundColorChange(
74
+ style: CellStyle,
75
+ value: string
76
+ ): CellStyle {
77
+ return { ...style, backgroundColor: `#${value}` };
78
+ }
@@ -0,0 +1,13 @@
1
+ @use '../../../assets/styles/colors';
2
+
3
+ .color-bar {
4
+ background-color: var(--error_light);
5
+ width: 100%;
6
+ height: 4px;
7
+ .colorPicker {
8
+ width: 100%;
9
+ height: 0;
10
+ padding: 0;
11
+ visibility: hidden;
12
+ }
13
+ }
@@ -0,0 +1,43 @@
1
+ import React, { useRef, useState } from 'react';
2
+ import './ColorBarSelector.scss';
3
+
4
+ interface ColorBarSelectorProps {
5
+ getColorValue: (color: string) => void;
6
+ disabled: boolean;
7
+ }
8
+ const ColorBarSelector: React.FC<ColorBarSelectorProps> = ({
9
+ getColorValue,
10
+ disabled,
11
+ }) => {
12
+ const colorInputRef = useRef<HTMLInputElement | null>(null);
13
+ const [color, setColor] = useState<string>('var(--error-light)');
14
+
15
+ const handleColorClick = () => {
16
+ if (colorInputRef.current) {
17
+ colorInputRef.current.click();
18
+ }
19
+ };
20
+
21
+ return (
22
+ <div
23
+ className="color-bar"
24
+ style={{
25
+ backgroundColor: `${color}`,
26
+ }}
27
+ onClick={handleColorClick}
28
+ >
29
+ <input
30
+ type="color"
31
+ disabled={disabled}
32
+ className="colorPicker"
33
+ ref={colorInputRef}
34
+ onChange={(e) => {
35
+ setColor(e.target.value);
36
+ getColorValue(e.target.value.replace('#', ''));
37
+ }}
38
+ />
39
+ </div>
40
+ );
41
+ };
42
+
43
+ export default ColorBarSelector;
@@ -0,0 +1,102 @@
1
+ @import '../../../assets/styles/colors';
2
+ @import '../../../assets/styles/fonts';
3
+
4
+ .context-menu {
5
+ position: absolute;
6
+ z-index: 1;
7
+ outline: none;
8
+ background-color: var(--brand-color);
9
+ // box-shadow: 0px 0px 6px $shadow;
10
+ border-radius: 5px;
11
+ opacity: 1;
12
+ padding: 16px 0;
13
+ .menu-options {
14
+ overflow: auto;
15
+ min-height: 20px;
16
+ max-height: 175px;
17
+ min-width: 250px;
18
+ opacity: 1;
19
+ .options {
20
+ cursor: pointer;
21
+ display: flex;
22
+ align-items: center;
23
+ padding: 0 8px;
24
+ line-height: 35px;
25
+ gap: 16px;
26
+ .sheet-context-menu {
27
+ display: flex;
28
+ align-items: center;
29
+ justify-content: center;
30
+ }
31
+ &:hover {
32
+ // background-color: $primary;
33
+ .options-label {
34
+ background: var(--option-card-bg-color);
35
+ }
36
+ }
37
+ }
38
+ }
39
+ }
40
+
41
+ .ff-icon-label {
42
+ display: flex;
43
+ align-items: center;
44
+ gap: 4px;
45
+ .ff-menuicon-container {
46
+ display: flex;
47
+ justify-content: center;
48
+ align-items: center;
49
+ cursor: pointer;
50
+ &:hover {
51
+ background-color: var(--brand-color);
52
+ }
53
+ }
54
+
55
+ .ff-menuicon-container-clicked {
56
+ display: flex;
57
+ justify-content: center;
58
+ align-items: center;
59
+ background-color: var(--brand-color);
60
+ cursor: pointer;
61
+ &:hover {
62
+ background-color: var(--brand-color);
63
+ }
64
+ }
65
+ }
66
+
67
+ .ff-option-card {
68
+ position: absolute;
69
+ border: 1px solid var(--option-card-border-color);
70
+ background: var(--option-card-bg-color);
71
+ border-radius: 4px;
72
+ margin: 2px;
73
+ min-height: 32px;
74
+ min-width: 111px;
75
+ z-index: 100000;
76
+ white-space: nowrap;
77
+
78
+ .ff-options {
79
+ @extend .fontSm;
80
+ cursor: pointer;
81
+ border-radius: 4px;
82
+ display: flex;
83
+ align-items: center;
84
+ padding: 8px;
85
+ line-height: 16px;
86
+ gap: 8px;
87
+ &:hover {
88
+ background-color: var(--hover-color);
89
+ }
90
+ label {
91
+ cursor: pointer;
92
+ }
93
+ }
94
+
95
+ .ff-disable-option {
96
+ opacity: 0.5;
97
+ cursor: no-drop;
98
+ label {
99
+ cursor: no-drop;
100
+ }
101
+ }
102
+ }
@@ -0,0 +1,104 @@
1
+ import React from 'react';
2
+ import './ContextMenu.scss';
3
+ import Icon from '../../Icon';
4
+ // import { colors } from '../../../colors/colorConstants';
5
+
6
+ const ContextMenu: React.FC<ContextMenuProps> = ({
7
+ customContext,
8
+ contextAction,
9
+ contextData,
10
+ setContextData,
11
+ }) => {
12
+ const contextOptions: ContextOption[] = [
13
+ {
14
+ name: 'cell',
15
+ value: customContext || [],
16
+ },
17
+ {
18
+ name: 'row',
19
+ value: [
20
+ { name: 'Add Row', title: 'Add Row', action: contextAction.addRow },
21
+ {
22
+ name: 'Delete Row',
23
+ title: 'Delete Row',
24
+ action: contextAction.deleteRow,
25
+ },
26
+ ],
27
+ },
28
+ {
29
+ name: 'column',
30
+ value: [
31
+ {
32
+ name: 'Add Column',
33
+ title: 'Add Column',
34
+ action: contextAction.addColumn,
35
+ },
36
+ {
37
+ name: 'Delete Column',
38
+ title: 'Delete Column',
39
+ action: contextAction.deleteColumn,
40
+ },
41
+ ],
42
+ },
43
+ {
44
+ name: 'sheet_options',
45
+ value: [
46
+ {
47
+ name: 'Add Sheet',
48
+ title: (
49
+ <span className="sheet-context-menu">
50
+ <Icon name="plus_icon" /> Add
51
+ Sheet
52
+ </span>
53
+ ),
54
+ action: contextAction.addSheet,
55
+ },
56
+ {
57
+ name: 'Delete Sheet',
58
+ title: (
59
+ <span className="sheet-context-menu">
60
+ <Icon name="delete" /> Delete Sheet
61
+ </span>
62
+ ),
63
+ action: contextAction.deleteSheet,
64
+ },
65
+ ],
66
+ },
67
+ ];
68
+
69
+ return (
70
+ contextData.visible &&
71
+ contextOptions.some(
72
+ (contextType) =>
73
+ contextType.name === contextData.type && contextType.value.length > 0
74
+ ) && (
75
+ <div
76
+ className="context-menu"
77
+ style={{ top: contextData.y, left: contextData.x }}
78
+ >
79
+ <div className="menu-options">
80
+ {contextOptions
81
+ .filter((contextType) => contextType.name === contextData.type)
82
+ .map((contextType) =>
83
+ contextType.value.length > 0
84
+ ? contextType.value.map((item) => (
85
+ <div
86
+ className="options"
87
+ key={item.name}
88
+ onClick={() => {
89
+ item.action();
90
+ setContextData((prev) => ({ ...prev, visible: false }));
91
+ }}
92
+ >
93
+ <label className="options-label">{item.title}</label>
94
+ </div>
95
+ ))
96
+ : null
97
+ )}
98
+ </div>
99
+ </div>
100
+ )
101
+ );
102
+ };
103
+
104
+ export default ContextMenu;