pixel-react 1.2.1 → 1.2.3

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.
Files changed (176) hide show
  1. package/lib/components/AppHeader/types.d.ts +11 -2
  2. package/lib/components/Avatar/Avatar.d.ts +5 -0
  3. package/lib/components/Avatar/Avatar.stories.d.ts +10 -0
  4. package/lib/components/Avatar/index.d.ts +1 -0
  5. package/lib/components/Avatar/types.d.ts +26 -0
  6. package/lib/components/ExcelFile/ExcelFile/Excel/ActiveCell.d.ts +2 -2
  7. package/lib/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.d.ts +2 -2
  8. package/lib/components/ExcelFile/ExcelFile/Excel/Copied.d.ts +1 -1
  9. package/lib/components/ExcelFile/ExcelFile/Excel/CornerIndicator.d.ts +2 -2
  10. package/lib/components/ExcelFile/ExcelFile/Excel/DataEditor.d.ts +2 -2
  11. package/lib/components/ExcelFile/ExcelFile/Excel/DataViewer.d.ts +2 -2
  12. package/lib/components/ExcelFile/ExcelFile/Excel/FloatingRect.d.ts +2 -2
  13. package/lib/components/ExcelFile/ExcelFile/Excel/HeaderRow.d.ts +1 -1
  14. package/lib/components/ExcelFile/ExcelFile/Excel/Row.d.ts +1 -1
  15. package/lib/components/ExcelFile/ExcelFile/Excel/RowIndicator.d.ts +2 -2
  16. package/lib/components/ExcelFile/ExcelFile/Excel/Selected.d.ts +1 -1
  17. package/lib/components/ExcelFile/ExcelFile/Excel/Spreadsheet.d.ts +6 -7
  18. package/lib/components/ExcelFile/ExcelFile/Excel/Table.d.ts +1 -1
  19. package/lib/components/ExcelFile/ExcelFile/Excel/actions.d.ts +49 -5
  20. package/lib/components/ExcelFile/ExcelFile/Excel/context.d.ts +3 -3
  21. package/lib/components/ExcelFile/ExcelFile/Excel/engine/engine.d.ts +5 -5
  22. package/lib/components/ExcelFile/ExcelFile/Excel/engine/formula.d.ts +6 -6
  23. package/lib/components/ExcelFile/ExcelFile/Excel/engine/index.d.ts +2 -2
  24. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-graph.d.ts +2 -2
  25. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-hash.d.ts +1 -1
  26. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-set.d.ts +1 -1
  27. package/lib/components/ExcelFile/ExcelFile/Excel/index.d.ts +11 -11
  28. package/lib/components/ExcelFile/ExcelFile/Excel/matrix.d.ts +1 -1
  29. package/lib/components/ExcelFile/ExcelFile/Excel/point-range.d.ts +1 -1
  30. package/lib/components/ExcelFile/ExcelFile/Excel/reducer.d.ts +5 -5
  31. package/lib/components/ExcelFile/ExcelFile/Excel/selection.d.ts +3 -3
  32. package/lib/components/ExcelFile/ExcelFile/Excel/types.d.ts +11 -48
  33. package/lib/components/ExcelFile/ExcelFile/Excel/use-dispatch.d.ts +1 -1
  34. package/lib/components/ExcelFile/ExcelFile/Excel/use-selector.d.ts +1 -1
  35. package/lib/components/ExcelFile/ExcelFile/Excel/util.d.ts +11 -12
  36. package/lib/components/ExcelFile/ExcelFile/ExcelFile.d.ts +16 -0
  37. package/lib/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.d.ts +0 -3
  38. package/lib/components/ExcelFile/ExcelToolBar/ExcelToolBar.d.ts +12 -0
  39. package/lib/components/ExcelFile/Types.d.ts +2 -49
  40. package/lib/components/Form/Form.d.ts +1 -15
  41. package/lib/components/Form/Form.stories.d.ts +6 -5
  42. package/lib/components/Form/Forms.d.ts +8 -0
  43. package/lib/components/Form/index.d.ts +1 -1
  44. package/lib/components/Icon/types.d.ts +1 -1
  45. package/lib/components/MenuOption/types.d.ts +7 -7
  46. package/lib/components/MiniModal/MiniModal.stories.d.ts +1 -0
  47. package/lib/components/MiniModal/types.d.ts +6 -6
  48. package/lib/components/ModulesChip/ModuleChip.d.ts +4 -0
  49. package/lib/components/ModulesChip/ModuleChip.stories.d.ts +6 -0
  50. package/lib/components/ModulesChip/index.d.ts +1 -0
  51. package/lib/components/ModulesChip/types.d.ts +14 -0
  52. package/lib/components/MultiSelect/MultiSelectTypes.d.ts +1 -0
  53. package/lib/components/Toastify/Toastify.d.ts +8 -0
  54. package/lib/components/Toastify/Toastify.stories.d.ts +6 -0
  55. package/lib/components/Toastify/index.d.ts +1 -0
  56. package/lib/components/Toastify/types.d.ts +7 -0
  57. package/lib/components/Tooltip/types.d.ts +6 -0
  58. package/lib/components/Typography/types.d.ts +1 -0
  59. package/lib/index.d.ts +84 -31
  60. package/lib/index.esm.js +26720 -881
  61. package/lib/index.esm.js.map +1 -1
  62. package/lib/index.js +26718 -875
  63. package/lib/index.js.map +1 -1
  64. package/lib/tsconfig.tsbuildinfo +1 -1
  65. package/package.json +1 -1
  66. package/src/StyleGuide/ColorPalette/colorPaletteList.ts +10 -0
  67. package/src/assets/Themes/BaseTheme.scss +2 -0
  68. package/src/assets/Themes/DarkTheme.scss +2 -0
  69. package/src/assets/icons/add_testcase.svg +3 -0
  70. package/src/assets/icons/add_variable_icon.svg +3 -4
  71. package/src/assets/icons/attachment_icon.svg +3 -0
  72. package/src/assets/icons/authorization_icon.svg +3 -0
  73. package/src/assets/icons/automation_testcase.svg +4 -0
  74. package/src/assets/icons/back_icon.svg +3 -0
  75. package/src/assets/icons/client_profile.svg +4 -0
  76. package/src/assets/icons/fireflink_finder_logo.svg +7 -0
  77. package/src/assets/icons/fireflink_platform.svg +4 -0
  78. package/src/assets/icons/license_expired.svg +20 -0
  79. package/src/assets/icons/manual_testcase.svg +3 -0
  80. package/src/assets/icons/variable_icon.svg +4 -0
  81. package/src/components/AllProjectsDropdown/AllProjectsDropdown.scss +2 -2
  82. package/src/components/AllProjectsDropdown/AllProjectsDropdown.tsx +1 -1
  83. package/src/components/AppHeader/AppHeader.stories.tsx +24 -3
  84. package/src/components/AppHeader/AppHeader.tsx +29 -11
  85. package/src/components/AppHeader/types.ts +11 -3
  86. package/src/components/Avatar/Avatar.scss +24 -0
  87. package/src/components/Avatar/Avatar.stories.tsx +56 -0
  88. package/src/components/Avatar/Avatar.tsx +25 -0
  89. package/src/components/Avatar/index.ts +1 -0
  90. package/src/components/Avatar/types.ts +27 -0
  91. package/src/components/Button/types.ts +1 -1
  92. package/src/components/ExcelFile/ColorBarselector/ColorBarSelector.scss +0 -2
  93. package/src/components/ExcelFile/ContextMenu/ContextMenu.scss +1 -4
  94. package/src/components/ExcelFile/ContextMenu/ContextMenu.tsx +0 -1
  95. package/src/components/ExcelFile/ExcelFile/Excel/ActiveCell.tsx +13 -13
  96. package/src/components/ExcelFile/ExcelFile/Excel/Cell.tsx +13 -12
  97. package/src/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.tsx +40 -32
  98. package/src/components/ExcelFile/ExcelFile/Excel/Copied.tsx +4 -4
  99. package/src/components/ExcelFile/ExcelFile/Excel/CornerIndicator.tsx +10 -10
  100. package/src/components/ExcelFile/ExcelFile/Excel/DataEditor.tsx +5 -5
  101. package/src/components/ExcelFile/ExcelFile/Excel/DataViewer.tsx +10 -10
  102. package/src/components/ExcelFile/ExcelFile/Excel/FloatingRect.tsx +6 -6
  103. package/src/components/ExcelFile/ExcelFile/Excel/HeaderRow.tsx +1 -1
  104. package/src/components/ExcelFile/ExcelFile/Excel/Row.tsx +1 -1
  105. package/src/components/ExcelFile/ExcelFile/Excel/RowIndicator.tsx +34 -27
  106. package/src/components/ExcelFile/ExcelFile/Excel/Selected.tsx +5 -5
  107. package/src/components/ExcelFile/ExcelFile/Excel/{Spreadsheet.css → Spreadsheet.scss} +21 -37
  108. package/src/components/ExcelFile/ExcelFile/Excel/Spreadsheet.tsx +87 -78
  109. package/src/components/ExcelFile/ExcelFile/Excel/Table.tsx +2 -2
  110. package/src/components/ExcelFile/ExcelFile/Excel/actions.ts +121 -31
  111. package/src/components/ExcelFile/ExcelFile/Excel/areModelsEqual.ts +1 -1
  112. package/src/components/ExcelFile/ExcelFile/Excel/context.ts +4 -4
  113. package/src/components/ExcelFile/ExcelFile/Excel/engine/engine.ts +7 -7
  114. package/src/components/ExcelFile/ExcelFile/Excel/engine/formula.ts +11 -11
  115. package/src/components/ExcelFile/ExcelFile/Excel/engine/index.ts +2 -2
  116. package/src/components/ExcelFile/ExcelFile/Excel/engine/point-graph.ts +3 -3
  117. package/src/components/ExcelFile/ExcelFile/Excel/engine/point-hash.ts +2 -2
  118. package/src/components/ExcelFile/ExcelFile/Excel/engine/point-set.ts +2 -2
  119. package/src/components/ExcelFile/ExcelFile/Excel/index.ts +12 -11
  120. package/src/components/ExcelFile/ExcelFile/Excel/matrix.ts +18 -24
  121. package/src/components/ExcelFile/ExcelFile/Excel/point-range.ts +1 -1
  122. package/src/components/ExcelFile/ExcelFile/Excel/reducer.ts +311 -41
  123. package/src/components/ExcelFile/ExcelFile/Excel/selection.ts +5 -5
  124. package/src/components/ExcelFile/ExcelFile/Excel/types.ts +14 -66
  125. package/src/components/ExcelFile/ExcelFile/Excel/typings/fast-formula-parser.d.ts +8 -8
  126. package/src/components/ExcelFile/ExcelFile/Excel/use-dispatch.ts +2 -2
  127. package/src/components/ExcelFile/ExcelFile/Excel/use-selector.ts +3 -3
  128. package/src/components/ExcelFile/ExcelFile/Excel/util.ts +21 -22
  129. package/src/components/ExcelFile/ExcelFile/ExcelFile.scss +0 -3
  130. package/src/components/ExcelFile/ExcelFile/ExcelFile.tsx +45 -403
  131. package/src/components/ExcelFile/ExcelFile.stories.tsx +10 -29
  132. package/src/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.tsx +1 -12
  133. package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.scss +0 -3
  134. package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.tsx +147 -127
  135. package/src/components/ExcelFile/Types.ts +3 -70
  136. package/src/components/ExcelFile/index.ts +1 -1
  137. package/src/components/Form/Form.d.ts +3 -0
  138. package/src/components/Form/Form.scss +48 -4
  139. package/src/components/Form/Form.stories.tsx +244 -137
  140. package/src/components/Form/Form.ts +2 -0
  141. package/src/components/Form/Forms.tsx +25 -0
  142. package/src/components/Form/index.ts +1 -1
  143. package/src/components/Icon/iconList.ts +23 -0
  144. package/src/components/Icon/types.ts +1 -1
  145. package/src/components/IconButton/IconButton.scss +1 -1
  146. package/src/components/MenuOption/types.ts +7 -6
  147. package/src/components/MiniModal/MiniModal.scss +5 -0
  148. package/src/components/MiniModal/MiniModal.stories.tsx +95 -0
  149. package/src/components/MiniModal/MiniModal.tsx +11 -6
  150. package/src/components/MiniModal/types.ts +6 -6
  151. package/src/components/ModulesChip/ModuleChip.scss +20 -0
  152. package/src/components/ModulesChip/ModuleChip.stories.tsx +41 -0
  153. package/src/components/ModulesChip/ModuleChip.tsx +31 -0
  154. package/src/components/ModulesChip/index.ts +1 -0
  155. package/src/components/ModulesChip/types.ts +14 -0
  156. package/src/components/MultiSelect/Dropdown.tsx +6 -1
  157. package/src/components/MultiSelect/MultiSelect.scss +17 -10
  158. package/src/components/MultiSelect/MultiSelect.stories.tsx +16 -4
  159. package/src/components/MultiSelect/MultiSelect.tsx +11 -4
  160. package/src/components/MultiSelect/MultiSelectTypes.ts +4 -3
  161. package/src/components/Select/Select.scss +4 -0
  162. package/src/components/Select/Select.tsx +2 -2
  163. package/src/components/Toastify/Toastify.stories.tsx +52 -0
  164. package/src/components/Toastify/Toastify.tsx +66 -0
  165. package/src/components/Toastify/index.ts +1 -0
  166. package/src/components/Toastify/types.ts +8 -0
  167. package/src/components/Tooltip/Tooltip.tsx +2 -1
  168. package/src/components/Tooltip/types.ts +6 -0
  169. package/src/components/Typography/Typography.scss +12 -4
  170. package/src/components/Typography/Typography.stories.tsx +2 -0
  171. package/src/components/Typography/Typography.tsx +2 -0
  172. package/src/components/Typography/types.ts +1 -0
  173. package/src/index.ts +9 -1
  174. package/src/components/ExcelFile/ChangeExcelStyles.tsx +0 -78
  175. package/src/components/ExcelFile/ImportExcelStyles.tsx +0 -86
  176. package/src/components/Form/Form.tsx +0 -57
@@ -1,9 +1,9 @@
1
- import * as React from "react";
2
- import classNames from "classnames";
3
- import * as Actions from "./actions";
4
- import * as Types from "./types";
5
- import useDispatch from "./use-dispatch";
6
- import useSelector from "./use-selector";
1
+ import * as React from 'react';
2
+ import classNames from 'classnames';
3
+ import * as Actions from './actions';
4
+ import * as Types from './types';
5
+ import useDispatch from './use-dispatch';
6
+ import useSelector from './use-selector';
7
7
 
8
8
  const RowIndicator: Types.RowIndicatorComponent = ({
9
9
  row,
@@ -12,7 +12,7 @@ const RowIndicator: Types.RowIndicatorComponent = ({
12
12
  onSelect,
13
13
  }) => {
14
14
  const [height, setHeight] = React.useState(0);
15
-
15
+
16
16
  // Function to handle the start of the resize (mouse down)
17
17
  const onMouseDown = (e: React.MouseEvent) => {
18
18
  const startY = e.clientY;
@@ -22,25 +22,32 @@ const RowIndicator: Types.RowIndicatorComponent = ({
22
22
  const newHeight = height + (moveEvent.clientY - startY);
23
23
  setHeight(newHeight);
24
24
  // Fetch the floating rectangle element from the DOM
25
- // const selectedAllRow = document.querySelector(".Spreadsheet__floating-rect--selected");
26
- // const selectedSingleRow = document.querySelector(".Spreadsheet__active-cell");
25
+ const selectedAllRow = document.querySelector(
26
+ '.Spreadsheet__floating-rect--selected'
27
+ );
28
+ const selectedSingleRow = document.querySelector(
29
+ '.Spreadsheet__active-cell'
30
+ );
27
31
 
28
- // // If the element exists, update its height
29
- // if (selectedAllRow instanceof HTMLElement&&selectedSingleRow instanceof HTMLElement) {
30
- // selectedAllRow.style.height = `${newHeight}px`; // Set the height
31
- // selectedSingleRow.style.height = `${newHeight}px`; // Set the height
32
- // }
32
+ // If the element exists, update its height
33
+ if (
34
+ selectedAllRow instanceof HTMLElement &&
35
+ selectedSingleRow instanceof HTMLElement
36
+ ) {
37
+ selectedAllRow.style.height = `${newHeight}px`;
38
+ selectedSingleRow.style.height = `${newHeight}px`;
39
+ }
33
40
  };
34
41
 
35
42
  // Function to stop the resizing (mouse up)
36
43
  const onMouseUp = () => {
37
- document.removeEventListener("mousemove", onMouseMove);
38
- document.removeEventListener("mouseup", onMouseUp);
44
+ document.removeEventListener('mousemove', onMouseMove);
45
+ document.removeEventListener('mouseup', onMouseUp);
39
46
  };
40
47
 
41
48
  // Add event listeners for mouse move and mouse up
42
- document.addEventListener("mousemove", onMouseMove);
43
- document.addEventListener("mouseup", onMouseUp);
49
+ document.addEventListener('mousemove', onMouseMove);
50
+ document.addEventListener('mouseup', onMouseUp);
44
51
  };
45
52
 
46
53
  const handleClick = React.useCallback(
@@ -52,9 +59,9 @@ const RowIndicator: Types.RowIndicatorComponent = ({
52
59
 
53
60
  return (
54
61
  <th
55
- style={{ height: `${height}px`,minWidth:'60px', position: "relative" }}
56
- className={classNames("Spreadsheet__header", {
57
- "Spreadsheet__header--selected": selected,
62
+ style={{ height: `${height}px`, minWidth: '60px', position: 'relative' }}
63
+ className={classNames('Spreadsheet__header', {
64
+ 'Spreadsheet__header--selected': selected,
58
65
  })}
59
66
  onClick={handleClick}
60
67
  tabIndex={0}
@@ -63,13 +70,13 @@ const RowIndicator: Types.RowIndicatorComponent = ({
63
70
  <div
64
71
  onMouseDown={onMouseDown}
65
72
  style={{
66
- zIndex: "inherit",
67
- height: "2px",
68
- position: "absolute",
73
+ zIndex: 'inherit',
74
+ height: '2px',
75
+ position: 'absolute',
69
76
  right: 0,
70
77
  bottom: 0,
71
- width: "100%",
72
- cursor: "ns-resize",
78
+ width: '100%',
79
+ cursor: 'ns-resize',
73
80
  }}
74
81
  />
75
82
  </th>
@@ -80,7 +87,7 @@ export default RowIndicator;
80
87
 
81
88
  export const enhance = (
82
89
  RowIndicatorComponent: Types.RowIndicatorComponent
83
- ): React.FC<Omit<Types.RowIndicatorProps, "selected" | "onSelect">> => {
90
+ ): React.FC<Omit<Types.RowIndicatorProps, 'selected' | 'onSelect'>> => {
84
91
  return function RowIndicatorWrapper(props) {
85
92
  const dispatch = useDispatch();
86
93
  const selected = useSelector((state) =>
@@ -1,10 +1,10 @@
1
- import * as React from "react";
2
- import { getSelectedDimensions } from "./util";
3
- import FloatingRect from "./FloatingRect";
4
- import useSelector from "./use-selector";
1
+ import * as React from 'react';
2
+ import { getSelectedDimensions } from './util';
3
+ import FloatingRect from './FloatingRect';
4
+ import useSelector from './use-selector';
5
5
 
6
6
  const Selected: React.FC = () => {
7
- const selected = useSelector((state) => state.selected);
7
+ const selected = useSelector((state) => state.selected);
8
8
  const dimensions = useSelector(
9
9
  (state) =>
10
10
  selected &&
@@ -1,12 +1,12 @@
1
1
  .Spreadsheet {
2
- --background-color: white;
3
- --text-color: black;
4
- --readonly-text-color: rgba(0, 0, 0, 0.4);
5
- --outline-color: #4285f4;
6
- --outline-background-color: rgba(160, 195, 255, 0.2);
7
- --border-color: hsl(2deg, 0%, 91%);
8
- --header-background-color: rgba(0, 0, 0, 0.04);
9
- --elevation: 0 2px 5px rgba(0, 0, 0, 0.4);
2
+ --background-color: var(--drawer-footer-bg);
3
+ --text-color: var(--text-color);
4
+ --readonly-text-color: var(--toggle-strip-active);
5
+ --outline-color: var(--toggle-strip-active);
6
+ --outline-background-color: var(--overlay-bg);
7
+ --border-color: var(--toggle-strip-color);
8
+ --header-background-color: var(--pop-up-background-blur);
9
+ --elevation: var(--brand-color);
10
10
 
11
11
  position: relative;
12
12
  overflow: visible;
@@ -15,14 +15,6 @@
15
15
  display: inline-block;
16
16
  }
17
17
 
18
- .Spreadsheet--dark-mode {
19
- --background-color: black;
20
- --text-color: white;
21
- --readonly-text-color: rgba(255, 255, 255, 0.4);
22
- --header-background-color: rgba(255, 255, 255, 0.04);
23
- --border-color: hsl(2deg, 0%, 19%);
24
- }
25
-
26
18
  .Spreadsheet__active-cell {
27
19
  position: absolute;
28
20
  border: 2px solid var(--outline-color);
@@ -39,32 +31,26 @@
39
31
  table-layout: fixed;
40
32
  }
41
33
 
42
- .Spreadsheet__cell,
43
- .Spreadsheet__active-cell {
44
- cursor: cell;
45
- }
46
-
47
34
  .Spreadsheet__cell {
48
35
  outline: none;
49
36
  position: relative;
50
-
51
37
  }
52
38
 
53
- /* .Spreadsheet__active-cell .Selection_dot{
54
- background-color:red;
55
- height:7px;
56
- width:7px;
57
- border-radius:50%;
58
- position:absolute;
59
- right:-3px;
39
+ .Spreadsheet__active-cell .Selection_dot {
40
+ background-color: var(--elevation);
41
+ height: 7px;
42
+ width: 7px;
43
+ border-radius: 50%;
44
+ position: absolute;
45
+ right: -3px;
60
46
  z-index: 10;
61
- bottom:-3px;
47
+ bottom: -3px;
62
48
  cursor: crosshair;
63
- } */
49
+ }
64
50
 
65
- /* .Spreadsheet__cell--readonly {
51
+ .Spreadsheet__cell--readonly {
66
52
  color: var(--readonly-text-color);
67
- } */
53
+ }
68
54
 
69
55
  .Spreadsheet__cell,
70
56
  .Spreadsheet__header {
@@ -75,19 +61,17 @@
75
61
  text-align: left;
76
62
  box-sizing: border-box;
77
63
  user-select: none;
78
-
79
64
  }
80
65
 
81
66
  .Spreadsheet__header {
82
67
  background: var(--header-background-color);
83
68
  color: var(--readonly-text-color);
84
69
  text-align: center;
85
- font: inherit;
86
70
  }
87
71
 
88
72
  .Spreadsheet__header--selected {
89
- background: #5f6268;
90
- color: #fff;
73
+ background: var(--brand-color);
74
+ color: var(--tooltip-text-color);
91
75
  }
92
76
 
93
77
  .Spreadsheet__header,
@@ -1,13 +1,13 @@
1
- import * as React from "react";
2
- import classNames from "classnames";
3
- import * as Types from "./types";
4
- import * as Actions from "./actions";
5
- import * as Matrix from "./matrix";
6
- import * as Point from "./point";
7
- import { Selection } from "./selection";
8
- import reducer, { INITIAL_STATE, hasKeyDownHandler } from "./reducer";
9
- import context from "./context";
10
- import { Model, createFormulaParser } from "./engine";
1
+ import * as React from 'react';
2
+ import classNames from 'classnames';
3
+ import * as Types from './types';
4
+ import * as Actions from './actions';
5
+ import * as Matrix from './matrix';
6
+ import * as Point from './point';
7
+ import { Selection } from './selection';
8
+ import reducer, { INITIAL_STATE, hasKeyDownHandler } from './reducer';
9
+ import context from './context';
10
+ import { Model, createFormulaParser } from './engine';
11
11
  import {
12
12
  range,
13
13
  readTextFromClipboard,
@@ -16,27 +16,28 @@ import {
16
16
  getCSV,
17
17
  shouldHandleClipboardEvent,
18
18
  isFocusedWithin,
19
- } from "./util";
19
+ } from './util';
20
20
 
21
- import DefaultTable from "./Table";
22
- import DefaultRow from "./Row";
23
- import DefaultHeaderRow from "./HeaderRow";
21
+ import DefaultTable from './Table';
22
+ import DefaultRow from './Row';
23
+ import DefaultHeaderRow from './HeaderRow';
24
24
  import DefaultCornerIndicator, {
25
25
  enhance as enhanceCornerIndicator,
26
- } from "./CornerIndicator";
26
+ } from './CornerIndicator';
27
27
  import DefaultColumnIndicator, {
28
28
  enhance as enhanceColumnIndicator,
29
- } from "./ColumnIndicator";
29
+ } from './ColumnIndicator';
30
30
  import DefaultRowIndicator, {
31
31
  enhance as enhanceRowIndicator,
32
- } from "./RowIndicator";
33
- import { Cell as DefaultCell, enhance as enhanceCell } from "./Cell";
34
- import DefaultDataViewer from "./DataViewer";
35
- import DefaultDataEditor from "./DataEditor";
36
- import ActiveCell from "./ActiveCell";
37
- import Selected from "./Selected";
38
- import Copied from "./Copied";
39
- import "./Spreadsheet.css";
32
+ } from './RowIndicator';
33
+ import { Cell as DefaultCell, enhance as enhanceCell } from './Cell';
34
+ import DefaultDataViewer from './DataViewer';
35
+ import DefaultDataEditor from './DataEditor';
36
+ import ActiveCell from './ActiveCell';
37
+ import Selected from './Selected';
38
+ import Copied from './Copied';
39
+ import './Spreadsheet.scss';
40
+ import ExcelToolBar from '../../ExcelToolBar/ExcelToolBar';
40
41
 
41
42
  /** The Spreadsheet component props */
42
43
  export type Props<CellType extends Types.CellBase> = {
@@ -48,7 +49,6 @@ export type Props<CellType extends Types.CellBase> = {
48
49
  * Use dark colors that complement dark mode
49
50
  * @defaultValue `false`
50
51
  */
51
- darkMode?: boolean;
52
52
  /**
53
53
  * Function used to create the formula parser (instance of
54
54
  * "fast-formula-parser") used by the Spreadsheet by getting the spreadsheet's
@@ -119,7 +119,6 @@ const Spreadsheet = <CellType extends Types.CellBase>(
119
119
  ): React.ReactElement => {
120
120
  const {
121
121
  className,
122
- darkMode,
123
122
  columnLabels,
124
123
  rowLabels,
125
124
  // hideColumnIndicators,
@@ -185,8 +184,13 @@ const Spreadsheet = <CellType extends Types.CellBase>(
185
184
  const setData = useAction(Actions.setData);
186
185
  const setCreateFormulaParser = useAction(Actions.setCreateFormulaParser);
187
186
  const setSelection = useAction(Actions.setSelection);
187
+ const onBold = useAction(Actions.bold);
188
+ const onItalic = useAction(Actions.italic);
189
+ const onUnderline = useAction(Actions.underline);
190
+ const setColor = useAction(Actions.color);
191
+ const setBackgroundColor = useAction(Actions.backgroundStyle);
192
+ const setFormatePainter = useAction(Actions.formatePainter);
188
193
 
189
- // Track active
190
194
  const prevActiveRef = React.useRef<Point.Point | null>(state.active);
191
195
  React.useEffect(() => {
192
196
  if (state.active !== prevActiveRef.current) {
@@ -214,7 +218,6 @@ const Spreadsheet = <CellType extends Types.CellBase>(
214
218
  prevEvaluatedDataRef.current = state.model.evaluatedData;
215
219
  }, [state?.model?.evaluatedData, onEvaluatedDataChange]);
216
220
 
217
- // Listen to selection changes
218
221
  const prevSelectedRef = React.useRef<Selection>(state.selected);
219
222
  React.useEffect(() => {
220
223
  if (!state.selected.equals(prevSelectedRef.current)) {
@@ -243,7 +246,7 @@ const Spreadsheet = <CellType extends Types.CellBase>(
243
246
  }, [props.selected, setSelection]);
244
247
 
245
248
  // Update data when props.data changes
246
- const prevDataPropRef = React.useRef<Matrix.Matrix<CellType> | undefined>(
249
+ let prevDataPropRef = React.useRef<Matrix.Matrix<CellType> | undefined>(
247
250
  props.data
248
251
  );
249
252
  React.useEffect(() => {
@@ -338,14 +341,14 @@ const Spreadsheet = <CellType extends Types.CellBase>(
338
341
 
339
342
  const handleMouseUp = React.useCallback(() => {
340
343
  onDragEnd();
341
- document.removeEventListener("mouseup", handleMouseUp);
344
+ document.removeEventListener('mouseup', handleMouseUp);
342
345
  }, [onDragEnd]);
343
346
 
344
347
  const handleMouseMove = React.useCallback(
345
348
  (event: React.MouseEvent) => {
346
349
  if (!state.dragging && event.buttons === 1) {
347
350
  onDragStart();
348
- document.addEventListener("mouseup", handleMouseUp);
351
+ document.addEventListener('mouseup', handleMouseUp);
349
352
  }
350
353
  },
351
354
  [state, onDragStart, handleMouseUp]
@@ -374,14 +377,14 @@ const Spreadsheet = <CellType extends Types.CellBase>(
374
377
  );
375
378
 
376
379
  React.useEffect(() => {
377
- document.addEventListener("cut", handleCut);
378
- document.addEventListener("copy", handleCopy);
379
- document.addEventListener("paste", handlePaste);
380
+ document.addEventListener('cut', handleCut);
381
+ document.addEventListener('copy', handleCopy);
382
+ document.addEventListener('paste', handlePaste);
380
383
 
381
384
  return () => {
382
- document.removeEventListener("cut", handleCut);
383
- document.removeEventListener("copy", handleCopy);
384
- document.removeEventListener("paste", handlePaste);
385
+ document.removeEventListener('cut', handleCut);
386
+ document.removeEventListener('copy', handleCopy);
387
+ document.removeEventListener('paste', handlePaste);
385
388
  };
386
389
  }, [handleCut, handleCopy, handlePaste]);
387
390
 
@@ -390,35 +393,33 @@ const Spreadsheet = <CellType extends Types.CellBase>(
390
393
  <Table columns={size.columns}>
391
394
  <HeaderRow>
392
395
  {<CornerIndicator />}
393
- {
394
- range(size.columns).map((columnNumber) =>
395
- columnLabels ? (
396
- <ColumnIndicator
397
- key={columnNumber}
398
- column={columnNumber}
399
- label={
400
- columnNumber in columnLabels
401
- ? columnLabels[columnNumber]
402
- : null
403
- }
404
- />
405
- ) : (
406
- <ColumnIndicator key={columnNumber} column={columnNumber} />
407
- )
408
- )}
396
+ {range(size.columns).map((columnNumber) =>
397
+ columnLabels ? (
398
+ <ColumnIndicator
399
+ key={columnNumber}
400
+ column={columnNumber}
401
+ label={
402
+ columnNumber in columnLabels
403
+ ? columnLabels[columnNumber]
404
+ : null
405
+ }
406
+ />
407
+ ) : (
408
+ <ColumnIndicator key={columnNumber} column={columnNumber} />
409
+ )
410
+ )}
409
411
  </HeaderRow>
410
412
  {range(size.rows).map((rowNumber) => (
411
413
  <Row key={rowNumber} row={rowNumber}>
412
- {
413
- (rowLabels ? (
414
- <RowIndicator
415
- key={rowNumber}
416
- row={rowNumber}
417
- label={rowNumber in rowLabels ? rowLabels[rowNumber] : null}
418
- />
419
- ) : (
420
- <RowIndicator key={rowNumber} row={rowNumber} />
421
- ))}
414
+ {rowLabels ? (
415
+ <RowIndicator
416
+ key={rowNumber}
417
+ row={rowNumber}
418
+ label={rowNumber in rowLabels ? rowLabels[rowNumber] : null}
419
+ />
420
+ ) : (
421
+ <RowIndicator key={rowNumber} row={rowNumber} />
422
+ )}
422
423
  {range(size.columns).map((columnNumber) => (
423
424
  <Cell
424
425
  key={columnNumber}
@@ -460,24 +461,32 @@ const Spreadsheet = <CellType extends Types.CellBase>(
460
461
 
461
462
  const rootNode = React.useMemo(
462
463
  () => (
463
- <div
464
- ref={rootRef}
465
- className={classNames("Spreadsheet", className, {
466
- "Spreadsheet--dark-mode": darkMode,
467
- })}
468
- onKeyPress={onKeyPress}
469
- onKeyDown={handleKeyDown}
470
- onMouseMove={handleMouseMove}
471
- >
472
- {tableNode}
473
- {activeCellNode}
474
- <Selected />
475
- <Copied />
476
- </div>
464
+ <>
465
+ <ExcelToolBar
466
+ data={props.data}
467
+ onBold={onBold}
468
+ onItalic={onItalic}
469
+ onUnderline={onUnderline}
470
+ setColor={setColor}
471
+ setBackgroundColor={setBackgroundColor}
472
+ setFormatePainter={setFormatePainter}
473
+ />
474
+ <div
475
+ ref={rootRef}
476
+ className={classNames('Spreadsheet', className)}
477
+ onKeyPress={onKeyPress}
478
+ onKeyDown={handleKeyDown}
479
+ onMouseMove={handleMouseMove}
480
+ >
481
+ {tableNode}
482
+ {activeCellNode}
483
+ <Selected />
484
+ <Copied />
485
+ </div>
486
+ </>
477
487
  ),
478
488
  [
479
489
  className,
480
- darkMode,
481
490
  onKeyPress,
482
491
  handleKeyDown,
483
492
  handleMouseMove,
@@ -1,5 +1,5 @@
1
- import * as Types from "./types";
2
- import { range } from "./util";
1
+ import * as Types from './types';
2
+ import { range } from './util';
3
3
 
4
4
  const Table: Types.TableComponent = ({
5
5
  children,