pixel-react 1.4.3 → 1.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/lib/components/AddResourceButton/type.d.ts +1 -1
  3. package/lib/components/Drawer/Types.d.ts +4 -0
  4. package/lib/components/Excel/ExcelContextMenu/ExcelContextMenu.d.ts +13 -0
  5. package/lib/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.d.ts +0 -13
  6. package/lib/components/Excel/ExcelFile/ExcelFileComponents/actions.d.ts +29 -1
  7. package/lib/components/Excel/ExcelFile/ExcelFileComponents/engine/engine.d.ts +3 -9
  8. package/lib/components/Excel/ExcelFile/ExcelFileComponents/engine/formula.d.ts +2 -10
  9. package/lib/components/Excel/ExcelFile/ExcelFileComponents/engine/point-graph.d.ts +0 -1
  10. package/lib/components/Excel/ExcelFile/ExcelFileComponents/types.d.ts +27 -2
  11. package/lib/components/Form/Forms.d.ts +4 -2
  12. package/lib/components/InputWithDropdown/InputWithDropdown.d.ts +1 -1
  13. package/lib/components/MenuOption/MenuOption.d.ts +1 -1
  14. package/lib/components/MenuOption/types.d.ts +49 -15
  15. package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
  16. package/lib/components/MultiSelect/MultiSelectTypes.d.ts +4 -5
  17. package/lib/components/MultiSelect/dropdownTypes.d.ts +2 -0
  18. package/lib/components/RadioButton/RadioButton.d.ts +1 -0
  19. package/lib/components/RadioButton/radioButtonTypes.d.ts +3 -1
  20. package/lib/components/Select/components/types.d.ts +4 -2
  21. package/lib/components/Table/Table.d.ts +1 -1
  22. package/lib/components/ToggleSwitch/ToggleSwitch.d.ts +10 -0
  23. package/lib/components/ToggleSwitch/index.d.ts +1 -0
  24. package/lib/index.d.ts +109 -23
  25. package/lib/index.esm.js +5711 -635
  26. package/lib/index.esm.js.map +1 -1
  27. package/lib/index.js +5707 -629
  28. package/lib/index.js.map +1 -1
  29. package/lib/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +11 -11
  31. package/src/StyleGuide/ColorPalette/colorPaletteList.ts +10 -0
  32. package/src/assets/Themes/BaseTheme.scss +17 -23
  33. package/src/assets/Themes/DarkTheme.scss +25 -38
  34. package/src/assets/icons/apk_file_type.svg +4 -0
  35. package/src/assets/icons/compressed_file_type.svg +4 -0
  36. package/src/assets/icons/csv_file_type.svg +4 -0
  37. package/src/assets/icons/excel_corner_menu.svg +3 -0
  38. package/src/assets/icons/formula_icon.svg +3 -0
  39. package/src/assets/icons/gif_file_type.svg +4 -0
  40. package/src/assets/icons/html_file_type.svg +4 -0
  41. package/src/assets/icons/ipk_file_type.svg +4 -0
  42. package/src/assets/icons/jpg_file_type.svg +4 -0
  43. package/src/assets/icons/json_file_type.svg +4 -0
  44. package/src/assets/icons/pdf_file_type.svg +4 -0
  45. package/src/assets/icons/png_file_type.svg +4 -0
  46. package/src/assets/icons/quick_run_setting_icon.svg +5 -0
  47. package/src/assets/icons/run_automation_scripts_icon.svg +33 -0
  48. package/src/assets/icons/run_manual_testcase_icon.svg +4 -0
  49. package/src/assets/icons/search.svg +2 -2
  50. package/src/assets/icons/txt_file_type.svg +4 -0
  51. package/src/assets/icons/xls_file_type.svg +4 -0
  52. package/src/assets/icons/xlsx_file_type.svg +4 -0
  53. package/src/assets/icons/xml_file_type.svg +4 -0
  54. package/src/components/AddResourceButton/AddButton.tsx +7 -7
  55. package/src/components/AddResourceButton/type.ts +1 -1
  56. package/src/components/AttachmentButton/AttachmentButton.scss +1 -1
  57. package/src/components/AttachmentButton/AttachmentButton.stories.tsx +1 -0
  58. package/src/components/Button/Button.scss +22 -20
  59. package/src/components/Button/Button.tsx +8 -1
  60. package/src/components/Charts/DashboardDonutChart/DashboardDonutChart.tsx +2 -2
  61. package/src/components/Drawer/Drawer.scss +4 -3
  62. package/src/components/Drawer/Drawer.tsx +14 -18
  63. package/src/components/Drawer/Types.ts +4 -0
  64. package/src/components/Editor/Editor.tsx +9 -11
  65. package/src/components/Excel/ExcelContextMenu/ExcelContextMenu.scss +39 -0
  66. package/src/components/Excel/ExcelContextMenu/ExcelContextMenu.tsx +51 -0
  67. package/src/components/Excel/ExcelFile/ExcelFile.tsx +7 -8
  68. package/src/components/Excel/ExcelFile/ExcelFileComponents/Cell.tsx +35 -0
  69. package/src/components/Excel/ExcelFile/ExcelFileComponents/ColumnIndicator.tsx +44 -7
  70. package/src/components/Excel/ExcelFile/ExcelFileComponents/CornerIndicator.tsx +8 -1
  71. package/src/components/Excel/ExcelFile/ExcelFileComponents/RowIndicator.tsx +45 -6
  72. package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.scss +37 -2
  73. package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.tsx +69 -24
  74. package/src/components/Excel/ExcelFile/ExcelFileComponents/actions.ts +59 -0
  75. package/src/components/Excel/ExcelFile/ExcelFileComponents/engine/engine.ts +18 -65
  76. package/src/components/Excel/ExcelFile/ExcelFileComponents/engine/formula.ts +5 -110
  77. package/src/components/Excel/ExcelFile/ExcelFileComponents/engine/point-graph.ts +0 -2
  78. package/src/components/Excel/ExcelFile/ExcelFileComponents/reducer.ts +105 -1
  79. package/src/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.ts +670 -673
  80. package/src/components/Excel/ExcelFile/ExcelFileComponents/types.ts +38 -2
  81. package/src/components/Excel/ExcelToolBar/ExcelToolBar.tsx +0 -4
  82. package/src/components/FileDropzone/FileDropzone.scss +4 -2
  83. package/src/components/FileDropzone/FileDropzone.tsx +1 -1
  84. package/src/components/FileDropzone/FilePreview.tsx +3 -1
  85. package/src/components/Form/Form.scss +2 -0
  86. package/src/components/Form/Form.stories.tsx +195 -6
  87. package/src/components/Form/Forms.tsx +15 -8
  88. package/src/components/Icon/iconList.ts +46 -0
  89. package/src/components/IconRadioGroup/IconRadioGroup.scss +3 -0
  90. package/src/components/IconRadioGroup/IconRadioGroup.tsx +20 -17
  91. package/src/components/Input/Input.scss +14 -15
  92. package/src/components/Input/Input.stories.tsx +2 -1
  93. package/src/components/InputWithDropdown/InputWithDropdown.scss +12 -13
  94. package/src/components/InputWithDropdown/InputWithDropdown.stories.tsx +3 -2
  95. package/src/components/InputWithDropdown/InputWithDropdown.tsx +22 -19
  96. package/src/components/MenuOption/MenuOption.scss +11 -10
  97. package/src/components/MenuOption/MenuOption.stories.tsx +51 -232
  98. package/src/components/MenuOption/MenuOption.tsx +131 -52
  99. package/src/components/MenuOption/types.ts +55 -14
  100. package/src/components/MiniModal/MiniModal.stories.tsx +2 -3
  101. package/src/components/MultiSelect/Dropdown.tsx +11 -12
  102. package/src/components/MultiSelect/MultiSelect.scss +1 -0
  103. package/src/components/MultiSelect/MultiSelect.stories.tsx +45 -10
  104. package/src/components/MultiSelect/MultiSelect.tsx +29 -13
  105. package/src/components/MultiSelect/MultiSelectTypes.ts +7 -5
  106. package/src/components/MultiSelect/dropdownTypes.ts +2 -0
  107. package/src/components/RadioButton/RadioButton.scss +3 -1
  108. package/src/components/RadioButton/RadioButton.tsx +3 -1
  109. package/src/components/RadioButton/radioButtonTypes.tsx +5 -1
  110. package/src/components/Search/Search.scss +25 -6
  111. package/src/components/Search/Search.tsx +45 -24
  112. package/src/components/Select/Select.scss +12 -12
  113. package/src/components/Select/Select.stories.tsx +2 -0
  114. package/src/components/Select/Select.tsx +11 -5
  115. package/src/components/Select/components/Dropdown.scss +2 -0
  116. package/src/components/Select/components/Dropdown.tsx +19 -4
  117. package/src/components/Select/components/types.ts +4 -2
  118. package/src/components/StatusButton/StatusButton.tsx +26 -20
  119. package/src/components/Table/Table.scss +1 -3
  120. package/src/components/Table/Table.stories.tsx +1 -0
  121. package/src/components/Table/Table.tsx +7 -3
  122. package/src/components/ToggleSwitch/ToggleSwitch.scss +59 -0
  123. package/src/components/ToggleSwitch/ToggleSwitch.stories.tsx +52 -0
  124. package/src/components/ToggleSwitch/ToggleSwitch.tsx +30 -0
  125. package/src/components/ToggleSwitch/index.ts +1 -0
  126. package/src/hooks/useFileDropzone.tsx +1 -0
  127. package/src/index.ts +4 -2
  128. package/src/components/Excel/ContextMenu/ContextMenu.scss +0 -99
  129. package/src/components/Excel/ContextMenu/ContextMenu.tsx +0 -103
@@ -0,0 +1,4 @@
1
+ <svg width="16" height="17" viewBox="0 0 16 17" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M15.4273 4.75176L10.7936 0.117383C10.7467 0.0705078 10.6833 0.0439453 10.617 0.0439453H5.36828C4.14672 0.0439453 3.15297 1.03801 3.15297 2.25957V6.64426H1.20859C0.832969 6.64426 0.527344 6.94988 0.527344 7.32551V11.2418C0.527344 11.6174 0.832969 11.923 1.20859 11.923H3.15297V13.8283C3.15297 15.0499 4.14672 16.0439 5.36828 16.0439H13.2852C14.5067 16.0439 15.5005 15.0499 15.5005 13.8283V4.92863C15.5005 4.86238 15.4742 4.79863 15.4273 4.75176ZM15.0008 13.8283C15.0008 14.7746 14.2311 15.5443 13.2852 15.5443H5.36828C4.42234 15.5443 3.65266 14.7746 3.65266 13.8283V11.923H11.8836C12.2592 11.923 12.5648 11.6174 12.5648 11.2418V7.32551C12.5648 6.94988 12.2592 6.64426 11.8836 6.64426H3.65266V2.25957C3.65266 1.31332 4.42234 0.543633 5.36828 0.543633H10.367V4.42801C10.367 4.84176 10.7033 5.17832 11.1164 5.17832H15.0008V13.8283Z" fill="currentColor"/>
3
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M3.59742 9.91949L4.35242 11.0945H5.15742L4.04242 9.35949L5.13742 7.60449H4.34742L3.66742 8.77449L2.91242 7.60449H2.10742L3.22242 9.33449L2.12242 11.0945H2.91242L3.59742 9.91949ZM9.49516 11.0945V7.60449H8.70516L7.59516 10.1995L6.48516 7.60449H5.69016V11.0945H6.39016V8.82449L7.33016 11.0945H7.86016L8.79516 8.82449V11.0945H9.49516ZM12.0372 10.5395H10.8872V7.60449H10.1872V11.0945H12.0372V10.5395Z" fill="white"/>
4
+ </svg>
@@ -102,13 +102,13 @@ const AddButton = ({
102
102
  {directionalArrow.map(
103
103
  ({ direction, menuOptions }: DirectionalArrow, index: number) => (
104
104
  <ArrowsButton
105
- key={index}
106
- direction={direction}
107
- onArrowClick={() => handleArrowClick(direction)}
108
- menuOptions={menuOptions}
109
- isActive={activeArrow === direction}
110
- variant={variant}
111
- />
105
+ key={index}
106
+ direction={direction as 'top' | 'right' | 'down'}
107
+ onArrowClick={() => handleArrowClick(direction)}
108
+ menuOptions={menuOptions}
109
+ isActive={activeArrow === direction}
110
+ variant={variant}
111
+ />
112
112
  )
113
113
  )}
114
114
  </div>,
@@ -53,7 +53,7 @@ export interface AddResourceButtonProps {
53
53
  * @property {boolean} isActive - Specifies if the button is in an active state (highlighted when selected).
54
54
  */
55
55
  export interface DirectionalArrowButtonProps {
56
- direction: string | 'top' | 'right' | 'down';
56
+ direction: 'top' | 'right' | 'down';
57
57
  menuOptions: {
58
58
  label: string;
59
59
  value: string | string[];
@@ -2,8 +2,8 @@
2
2
  display: none;
3
3
  }
4
4
  .ff-attachment-files {
5
- padding: 9px;
6
5
  display: flex;
7
6
  align-items: center;
8
7
  gap: 4px;
8
+ line-height: 15px;
9
9
  }
@@ -1,6 +1,7 @@
1
1
  import { useState } from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
3
  import AttachmentButton from './AttachmentButton';
4
+ import React from 'react';
4
5
 
5
6
  const meta: Meta<typeof AttachmentButton> = {
6
7
  title: 'Components/AttachmentButton',
@@ -3,7 +3,7 @@
3
3
 
4
4
  .ff-button {
5
5
  width: auto;
6
- background-color: $primary-button-text-color;
6
+ background-color: var(--primary-button-text-color);
7
7
  border-radius: 4px;
8
8
  padding: 4px 8px;
9
9
  text-align: center;
@@ -37,18 +37,20 @@
37
37
  border-radius: 4px;
38
38
  padding: 0.6px;
39
39
 
40
- background: $primary-button-border;
41
- mask: linear-gradient($primary-button-text-color 0 0) content-box,
42
- linear-gradient($primary-button-text-color 0 0);
40
+ background: var(--primary-button-border);
41
+ mask:
42
+ linear-gradient(var(--primary-button-text-color) 0 0) content-box,
43
+ linear-gradient(var(--primary-button-text-color) 0 0);
43
44
  mask-composite: exclude;
44
- -webkit-mask: linear-gradient($primary-button-text-color 0 0) content-box,
45
- linear-gradient($primary-button-text-color 0 0);
45
+ -webkit-mask:
46
+ linear-gradient(var(--primary-button-text-color) 0 0) content-box,
47
+ linear-gradient(var(--primary-button-text-color) 0 0);
46
48
  -webkit-mask-composite: destination-out;
47
49
  z-index: -1;
48
50
  }
49
51
 
50
52
  &:hover {
51
- background: $primary-button-hover;
53
+ background: var(--primary-button-hover);
52
54
  }
53
55
 
54
56
  &:disabled {
@@ -69,27 +71,27 @@
69
71
  }
70
72
 
71
73
  &--primary {
72
- background: $primary-button-color;
74
+ background: var(--primary-button-color);
73
75
 
74
76
  &:before {
75
- background: $primary-button-border;
77
+ background: var(--primary-button-border);
76
78
  }
77
79
 
78
80
  &:hover {
79
- background: $primary-button-hover;
81
+ background: var(--primary-button-hover);
80
82
  }
81
83
  }
82
84
 
83
85
  &--delete {
84
- background: $delete-button-color;
85
- color: $primary-button-text-color;
86
+ background: var(--delete-button-color);
87
+ color: var(--primary-button-text-color);
86
88
 
87
89
  &:before {
88
- background: $delete-button-border;
90
+ background: var(--delete-button-border);
89
91
  }
90
92
 
91
93
  &:hover {
92
- background: $delete-button-hover;
94
+ background: var(--delete-button-hover);
93
95
  }
94
96
  }
95
97
  &--warning {
@@ -99,20 +101,20 @@
99
101
 
100
102
  &--secondary {
101
103
  &:before {
102
- background: $primary-button-border;
104
+ background: var(--primary-button-border);
103
105
  }
104
106
 
105
107
  &:hover {
106
- background: $secondary-button-hover;
108
+ background: var(--secondary-button-hover);
107
109
  }
108
110
  }
109
111
 
110
112
  &--tertiary {
111
113
  border: none;
112
- background: $tertiary-button-color;
114
+ background: var(--tertiary-button-color);
113
115
 
114
116
  &:hover {
115
- background: $tertiary-button-hover;
117
+ background: var(--tertiary-button-hover);
116
118
  }
117
119
 
118
120
  &:disabled {
@@ -140,12 +142,12 @@
140
142
  }
141
143
 
142
144
  &-primary--text {
143
- color: $primary-button-text-color;
145
+ color: var(--primary-button-text-color);
144
146
  }
145
147
 
146
148
  &-secondary--text,
147
149
  &-tertiary--text {
148
- background: $secondary-button-color-text;
150
+ background: var(--secondary-button-color-text);
149
151
  -webkit-background-clip: text;
150
152
  background-clip: text;
151
153
  color: transparent;
@@ -4,6 +4,7 @@ import '../../assets/styles/_colors.scss';
4
4
  import Icon from '../Icon';
5
5
  import { ButtonProps } from './types';
6
6
  import classNames from 'classnames';
7
+ import Typography from '../Typography';
7
8
 
8
9
  const Button = forwardRef<HTMLButtonElement, ButtonProps>(
9
10
  (
@@ -56,7 +57,13 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
56
57
  {...props}
57
58
  >
58
59
  {iconPosition === 'left' && renderIcon()}
59
- <div className={classNames(`ff-button-${variant}--text`)}>{label}</div>
60
+ <Typography
61
+ fontSize={10}
62
+ fontWeight="semi-bold"
63
+ className={classNames(`ff-button-${variant}--text`)}
64
+ >
65
+ {label}
66
+ </Typography>
60
67
  {iconPosition === 'right' && renderIcon()}
61
68
  {children}
62
69
  </button>
@@ -141,7 +141,7 @@ const DashboardDonutChart: React.FC<DashboardDonutChartProps> = ({
141
141
  {legendData.map((item, index) => (
142
142
  <div className="ff-legend-item" key={index}>
143
143
  <Typography
144
- fontSize={22}
144
+ fontSize={20}
145
145
  fontWeight="semi-bold"
146
146
  className="ff-legend-value"
147
147
  color={
@@ -152,7 +152,7 @@ const DashboardDonutChart: React.FC<DashboardDonutChartProps> = ({
152
152
  >
153
153
  {item.value} {showUnit && unit?.toUpperCase()}
154
154
  </Typography>
155
- <Typography fontSize={12} className="ff-legend-key">
155
+ <Typography fontSize={10} className="ff-legend-key">
156
156
  {item.key}
157
157
  </Typography>
158
158
  </div>
@@ -6,6 +6,7 @@
6
6
  inset: 0;
7
7
  background-color: var(--drawer-title-color);
8
8
  opacity: 0.5;
9
+ z-index: 999;
9
10
  }
10
11
 
11
12
  .child-drawer-overlay {
@@ -17,7 +18,7 @@
17
18
  position: fixed;
18
19
  right: 0;
19
20
  bottom: 0;
20
- top: 80px;
21
+ top: 87px;
21
22
  min-width: 450px;
22
23
  background-color: var(--primary-button-text-color);
23
24
  z-index: 999;
@@ -87,8 +88,6 @@
87
88
 
88
89
  .ff-expand-collapse-button {
89
90
  cursor: pointer;
90
- height: 24px;
91
- width: 24px;
92
91
  background-color: var(--button-bg-color);
93
92
  outline: none;
94
93
  border: none;
@@ -122,6 +121,8 @@
122
121
  justify-content: space-between;
123
122
  border-top: 1px solid var(--drawer-footer-border);
124
123
  z-index: 1000;
124
+ background-color: var(--base-bg-color);
125
+ transform: translateY(3px);
125
126
 
126
127
  .button-container {
127
128
  display: flex;
@@ -35,8 +35,9 @@ const Drawer: FC<DrawerProps> = ({
35
35
  rightTertiaryButtonProps = {},
36
36
  zIndex = 999,
37
37
  secondLayerZIndex = false,
38
+ top,
38
39
  }: DrawerProps) => {
39
- const [isExpanded, setIsExpanded] = useState(_isExpanded);
40
+ const [isExpanded, setIsExpanded] = useState(false);
40
41
 
41
42
  const handleEsc = useEscapeKey('Escape');
42
43
 
@@ -84,7 +85,7 @@ const Drawer: FC<DrawerProps> = ({
84
85
  className={classNames('ff-drawer', `ff-drawer--${drawerSize}`, {
85
86
  'ff-drawer--open': isOpen,
86
87
  })}
87
- style={{ zIndex }}
88
+ style={{ zIndex, top }}
88
89
  >
89
90
  {showHeader && (
90
91
  <div
@@ -112,27 +113,22 @@ const Drawer: FC<DrawerProps> = ({
112
113
  onClick={toggleExpand}
113
114
  >
114
115
  <Icon
115
- name={isExpanded ? 'logo' : 'logo'}
116
+ name={isExpanded ? 'maximize_icon' : 'minimize_script'}
116
117
  height={16}
117
118
  width={16}
118
119
  />
119
120
  </button>
120
121
  )}
121
- {isBackButtonVisible && (
122
- <button
123
- className="ff-expand-collapse-button"
124
- onClick={onClose}
125
- >
126
- {backButtonIcon || (
127
- <Icon
128
- name="error"
129
- height={16}
130
- width={16}
131
- hoverEffect={false}
132
- />
133
- )}
134
- </button>
135
- )}
122
+ {isBackButtonVisible &&
123
+ (backButtonIcon || (
124
+ <Icon
125
+ name="back_icon"
126
+ height={16}
127
+ width={16}
128
+ hoverEffect
129
+ onClick={onClose}
130
+ />
131
+ ))}
136
132
  {title && <div className="ff-drawer-title">{title}</div>}
137
133
  </div>
138
134
  {_isCloseModalButtonVisible && (
@@ -137,4 +137,8 @@ export interface DrawerProps {
137
137
  * Custom z-index for the secondary drawer
138
138
  */
139
139
  secondLayerZIndex?: boolean;
140
+ /**
141
+ * Custom top for the drawer
142
+ */
143
+ top?: string;
140
144
  }
@@ -41,16 +41,6 @@ const Editor: React.FC<EditorProps> = ({
41
41
  const [dropdownPosition, setDropdownPosition] =
42
42
  useState<dropdownPositionType>({ top: 0, left: 0 });
43
43
 
44
- const editorOptions = {
45
- lineNumbers: 'on',
46
- wordWrap: 'on',
47
- autoClosingBrackets: 'always',
48
- scrollBeyondLastLine: false,
49
- readOnly,
50
- fontFamily: 'font-poppins',
51
- theme,
52
- };
53
-
54
44
  const handleEditorDidMount: OnMount = (editor: any) => {
55
45
  editorRef.current = editor;
56
46
 
@@ -187,7 +177,15 @@ const Editor: React.FC<EditorProps> = ({
187
177
  width="100%"
188
178
  language={contentType}
189
179
  value={value}
190
- options={editorOptions}
180
+ options={{
181
+ lineNumbers: 'on',
182
+ wordWrap: 'on',
183
+ autoClosingBrackets: 'always',
184
+ scrollBeyondLastLine: false,
185
+ readOnly,
186
+ fontFamily: 'font-poppins',
187
+ theme,
188
+ }}
191
189
  onMount={handleEditorDidMount}
192
190
  onChange={(newValue, event) => handleChange(newValue, event)}
193
191
  />
@@ -0,0 +1,39 @@
1
+ @use '../../../assets/styles/fonts';
2
+
3
+
4
+ .ff-option-card {
5
+ position: absolute;
6
+ border: 1px solid var(--option-card-border-color);
7
+ background: var(--option-card-bg-color);
8
+ border-radius: 4px;
9
+ margin: 2px;
10
+ min-height: 32px;
11
+ min-width: 111px;
12
+ white-space: nowrap;
13
+ z-index: 100;
14
+
15
+ .ff-options {
16
+ @extend .fontSm;
17
+ cursor: pointer;
18
+ border-radius: 4px;
19
+ display: flex;
20
+ align-items: center;
21
+ padding: 8px;
22
+ line-height: 16px;
23
+ gap: 8px;
24
+ &:hover {
25
+ background-color: var(--hover-color);
26
+ }
27
+ label {
28
+ cursor: pointer;
29
+ }
30
+ }
31
+
32
+ .ff-disable-option {
33
+ opacity: 0.5;
34
+ cursor: no-drop;
35
+ label {
36
+ cursor: no-drop;
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,51 @@
1
+ import Icon from '../../Icon';
2
+ import './ExcelContextMenu.scss';
3
+ import Typography from '../../Typography';
4
+ import * as Matrix from '../ExcelFile/ExcelFileComponents/matrix';
5
+ import {
6
+ CellBase,
7
+ ContextMenuState,
8
+ } from '../ExcelFile/ExcelFileComponents/types';
9
+
10
+ type ExcelContextMenuProps = {
11
+ data: Matrix.Matrix<CellBase>;
12
+ contextMenu: ContextMenuState;
13
+ addRowTop: (data: Matrix.Matrix<CellBase>) => void;
14
+ addColumnLeft: (data: Matrix.Matrix<CellBase>) => void;
15
+ deleteRow: (data: Matrix.Matrix<CellBase>) => void;
16
+ deleteColumn: (data: Matrix.Matrix<CellBase>) => void;
17
+ };
18
+
19
+ const ExcelContextMenu: React.FC<ExcelContextMenuProps> = ({ contextMenu }) => {
20
+ return (
21
+ <div
22
+ className="ff-option-card"
23
+ style={{ left: contextMenu.position.x, top: contextMenu.position.y }}
24
+ >
25
+ {contextMenu.options.map((option) => (
26
+ <div
27
+ className={'ff-options'}
28
+ onClick={() => {
29
+ option.action();
30
+ }}
31
+ >
32
+ {option.iconName && (
33
+ <Icon
34
+ name={option.iconName}
35
+ height={16}
36
+ width={16}
37
+ color={
38
+ option.label.includes('Delete')
39
+ ? 'var(--label-edit-error-text)'
40
+ : 'var(--brand-color)'
41
+ }
42
+ />
43
+ )}
44
+ <Typography as="label">{option.label}</Typography>
45
+ </div>
46
+ ))}
47
+ </div>
48
+ );
49
+ };
50
+
51
+ export default ExcelContextMenu;
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useRef, useEffect } from 'react';
2
- import { CellBase } from './ExcelFileComponents/index';
2
+ import Spreadsheet, { CellBase } from './ExcelFileComponents/index';
3
3
  import * as Matrix from './ExcelFileComponents/matrix';
4
4
  import './ExcelFile.scss';
5
5
  import { Col, Row } from '../../GridLayout/GridLayout';
@@ -71,7 +71,6 @@ const ExcelFile: React.FC<ExcelFileProps> = ({
71
71
  pageRef.current = sheetNames[0] ? sheetNames[0] : '';
72
72
  setSelectedSheet({ name: sheetNames[0] ? sheetNames[0] : '', index: 0 });
73
73
  }
74
- onSave()
75
74
  const newWorksheetsData: { [key: string]: Matrix.Matrix<CellBase> } = {};
76
75
  payload.sheets.forEach((sheet) => {
77
76
  const sheetName = sheet.sheetName;
@@ -110,10 +109,10 @@ const ExcelFile: React.FC<ExcelFileProps> = ({
110
109
  }
111
110
  }, []);
112
111
 
113
- // const onEvaluateChange = (data: Matrix.Matrix<CellBase>) => {
114
- // setWorksheetsData((prev) => ({ ...prev, [pageRef.current]: data }));
115
- // onSave()
116
- // };
112
+ const onEvaluateChange = (data: Matrix.Matrix<CellBase>) => {
113
+ setWorksheetsData((prev) => ({ ...prev, [pageRef.current]: data }));
114
+ onSave()
115
+ };
117
116
 
118
117
  const [editingSheet, setEditingSheet] = useState<number | null>(null);
119
118
 
@@ -245,10 +244,10 @@ const ExcelFile: React.FC<ExcelFileProps> = ({
245
244
  {sheetNames.length > 0 && (
246
245
  <div className="excel-book">
247
246
  <div ref={sheetRef} className="excel-sheet">
248
- {/* <Spreadsheet
247
+ <Spreadsheet
249
248
  data={selectedSheetData}
250
249
  onEvaluatedDataChange={onEvaluateChange}
251
- /> */}
250
+ />
252
251
  </div>
253
252
  <Row className="sheet-bar">
254
253
  <Col size={0} className="add-sheet-icon">
@@ -22,6 +22,7 @@ export const Cell: React.FC<Types.CellComponentProps> = ({
22
22
  activate,
23
23
  setCellDimensions,
24
24
  setCellData,
25
+ setContextMenu,
25
26
  }): React.ReactElement => {
26
27
  const [isDotDragging, setIsDotDragging] = React.useState(false);
27
28
  const [first, setFirst] = React.useState(true);
@@ -34,6 +35,23 @@ export const Cell: React.FC<Types.CellComponentProps> = ({
34
35
  [row, column]
35
36
  );
36
37
 
38
+ let options = [
39
+ {
40
+ label: 'Get data from Header',
41
+ value: 'Get data from Header',
42
+ iconName: 'success',
43
+ disable: false,
44
+ action: () => {},
45
+ },
46
+ {
47
+ label: 'Get Cell Value',
48
+ value: 'Get Cell Value',
49
+ iconName: 'success',
50
+ disable: false,
51
+ action: () => {},
52
+ },
53
+ ];
54
+
37
55
  const handleMouseDown = React.useCallback(
38
56
  (event: React.MouseEvent<HTMLTableCellElement>) => {
39
57
  if (mode === 'view') {
@@ -84,6 +102,22 @@ export const Cell: React.FC<Types.CellComponentProps> = ({
84
102
  [setCellDimensions, select, dragging, point, isDotDragging]
85
103
  );
86
104
 
105
+ const contextClick = React.useCallback(
106
+ (event: React.MouseEvent) => {
107
+ event.preventDefault();
108
+ select(point);
109
+ setContextMenu({
110
+ open: true,
111
+ position: {
112
+ x: event.clientX,
113
+ y: event.clientY - 50,
114
+ },
115
+ options: options,
116
+ });
117
+ },
118
+ [setContextMenu]
119
+ );
120
+
87
121
  React.useEffect(() => {
88
122
  const root = rootRef.current;
89
123
  if (selected && root) {
@@ -108,6 +142,7 @@ export const Cell: React.FC<Types.CellComponentProps> = ({
108
142
  })}
109
143
  onMouseEnter={handleMouseOver}
110
144
  onMouseDown={handleMouseDown}
145
+ onContextMenu={contextClick}
111
146
  tabIndex={0}
112
147
  >
113
148
  <DataViewer
@@ -11,15 +11,37 @@ const ColumnIndicator: Types.ColumnIndicatorComponent = ({
11
11
  label,
12
12
  selected,
13
13
  onSelect,
14
+ setContextMenu,
15
+ deleteColumn,
16
+ addColumnLeft,
17
+ data,
14
18
  }) => {
15
19
  const dispatch = useDispatch();
16
20
  const [width, setWidth] = React.useState(100);
21
+ let options = [
22
+ {
23
+ label: 'Add Column',
24
+ value: 'Add Column',
25
+ iconName: 'plus_icon',
26
+ action: () => {
27
+ addColumnLeft(data);
28
+ },
29
+ disable: false,
30
+ },
31
+ {
32
+ label: 'Delete Column',
33
+ value: 'Delete Column',
34
+ iconName: 'delete',
35
+ action: () => {
36
+ deleteColumn(data);
37
+ },
38
+ disable: false,
39
+ },
40
+ ];
17
41
 
18
- // Function to handle the start of the resize (mouse down)
19
42
  const onMouseDown = (e: React.MouseEvent) => {
20
43
  const startX = e.clientX;
21
44
 
22
- // Function to handle mouse movement (resize)
23
45
  const onMouseMove = (moveEvent: MouseEvent) => {
24
46
  const newWidth = width + (moveEvent.clientX - startX);
25
47
  setWidth(newWidth);
@@ -31,7 +53,6 @@ const ColumnIndicator: Types.ColumnIndicatorComponent = ({
31
53
  'ff-spreadsheet-active-cell'
32
54
  );
33
55
 
34
- // If the element exists, update its height
35
56
  if (
36
57
  selectedAllRow instanceof HTMLElement &&
37
58
  selectedSingleRow instanceof HTMLElement
@@ -41,13 +62,11 @@ const ColumnIndicator: Types.ColumnIndicatorComponent = ({
41
62
  }
42
63
  };
43
64
 
44
- // Function to stop the resizing (mouse up)
45
65
  const onMouseUp = () => {
46
66
  document.removeEventListener('mousemove', onMouseMove);
47
67
  document.removeEventListener('mouseup', onMouseUp);
48
68
  };
49
69
 
50
- // Add event listeners for mouse move and mouse up
51
70
  document.addEventListener('mousemove', onMouseMove);
52
71
  document.addEventListener('mouseup', onMouseUp);
53
72
  };
@@ -57,7 +76,6 @@ const ColumnIndicator: Types.ColumnIndicatorComponent = ({
57
76
  [dispatch]
58
77
  );
59
78
 
60
- // Handle column header click
61
79
  const handleClick = React.useCallback(
62
80
  (event: React.MouseEvent) => {
63
81
  onSelect(column, event.shiftKey);
@@ -65,13 +83,32 @@ const ColumnIndicator: Types.ColumnIndicatorComponent = ({
65
83
  [onSelect, column]
66
84
  );
67
85
 
86
+ const contextClick = React.useCallback(
87
+ (event: React.MouseEvent) => {
88
+ event.preventDefault();
89
+
90
+ onSelect(column, event.shiftKey);
91
+
92
+ setContextMenu({
93
+ open: true,
94
+ position: {
95
+ x: event.clientX,
96
+ y: event.clientY - 50,
97
+ },
98
+ options: options,
99
+ });
100
+ },
101
+ [onSelect, column, setContextMenu]
102
+ );
103
+
68
104
  return (
69
105
  <th
70
- style={{ minWidth: `${width}px`, position: 'relative' }} // Use dynamic width
106
+ style={{ minWidth: `${width}px`, position: 'relative' }}
71
107
  className={classNames('ff-spreadsheet-header', {
72
108
  'ff-spreadsheet-header--selected': selected,
73
109
  })}
74
110
  onClick={handleClick}
111
+ onContextMenu={contextClick}
75
112
  tabIndex={0}
76
113
  >
77
114
  {label !== undefined ? label : columnIndexToLabel(column)}
@@ -5,6 +5,7 @@ import { EntireWorksheetSelection } from './selection';
5
5
  import * as Types from './types';
6
6
  import useDispatch from './use-dispatch';
7
7
  import useSelector from './use-selector';
8
+ import Icon from '../../../Icon';
8
9
 
9
10
  const CornerIndicator: Types.CornerIndicatorComponent = ({
10
11
  selected,
@@ -20,7 +21,13 @@ const CornerIndicator: Types.CornerIndicatorComponent = ({
20
21
  })}
21
22
  onClick={handleClick}
22
23
  tabIndex={0}
23
- />
24
+ >
25
+ <Icon
26
+ variant={selected ? 'dark' : 'light'}
27
+ className="corner_indicator"
28
+ name="excel_corner_menu"
29
+ />
30
+ </th>
24
31
  );
25
32
  };
26
33