@fileverse-dev/fortune-react 1.0.37 → 1.0.39

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 (55) hide show
  1. package/es/assets/paint-roller.png +0 -0
  2. package/es/components/FormatSearch/index.js +5 -9
  3. package/es/components/SVGDefines.js +1 -60
  4. package/es/components/SheetOverlay/index.css +0 -2
  5. package/es/components/SheetOverlay/index.js +2 -2
  6. package/es/components/SheetTab/index.css +0 -2
  7. package/es/components/SheetTab/index.js +2 -22
  8. package/es/components/Toolbar/Combo.js +4 -18
  9. package/es/components/Toolbar/index.css +0 -6
  10. package/es/components/Toolbar/index.d.ts +1 -1
  11. package/es/components/Toolbar/index.js +5 -334
  12. package/es/components/Workbook/index.css +4 -0
  13. package/es/components/Workbook/index.d.ts +23 -23
  14. package/es/components/Workbook/index.js +1 -25
  15. package/es/constants.d.ts +0 -26
  16. package/es/constants.js +3 -44
  17. package/lib/assets/paint-roller.png +0 -0
  18. package/lib/components/FormatSearch/index.js +5 -9
  19. package/lib/components/SVGDefines.js +1 -60
  20. package/lib/components/SheetOverlay/index.css +0 -2
  21. package/lib/components/SheetOverlay/index.js +2 -2
  22. package/lib/components/SheetTab/index.css +0 -2
  23. package/lib/components/SheetTab/index.js +2 -22
  24. package/lib/components/Toolbar/Combo.js +4 -18
  25. package/lib/components/Toolbar/index.css +0 -6
  26. package/lib/components/Toolbar/index.d.ts +1 -1
  27. package/lib/components/Toolbar/index.js +4 -333
  28. package/lib/components/Workbook/index.css +4 -0
  29. package/lib/components/Workbook/index.d.ts +23 -23
  30. package/lib/components/Workbook/index.js +0 -24
  31. package/lib/constants.d.ts +0 -26
  32. package/lib/constants.js +3 -45
  33. package/package.json +2 -2
  34. package/es/components/CryptoDenominationSelector/index.css +0 -67
  35. package/es/components/CryptoDenominationSelector/index.d.ts +0 -8
  36. package/es/components/CryptoDenominationSelector/index.js +0 -272
  37. package/es/hooks/useCryptoCells.d.ts +0 -11
  38. package/es/hooks/useCryptoCells.js +0 -210
  39. package/es/utils/convertCellsToCrypto.d.ts +0 -8
  40. package/es/utils/convertCellsToCrypto.js +0 -215
  41. package/es/utils/cryptoApi.d.ts +0 -2
  42. package/es/utils/cryptoApi.js +0 -154
  43. package/es/utils/updateCellsDecimalFormat.d.ts +0 -6
  44. package/es/utils/updateCellsDecimalFormat.js +0 -80
  45. package/lib/components/CryptoDenominationSelector/index.css +0 -67
  46. package/lib/components/CryptoDenominationSelector/index.d.ts +0 -8
  47. package/lib/components/CryptoDenominationSelector/index.js +0 -281
  48. package/lib/hooks/useCryptoCells.d.ts +0 -11
  49. package/lib/hooks/useCryptoCells.js +0 -216
  50. package/lib/utils/convertCellsToCrypto.d.ts +0 -8
  51. package/lib/utils/convertCellsToCrypto.js +0 -222
  52. package/lib/utils/cryptoApi.d.ts +0 -2
  53. package/lib/utils/cryptoApi.js +0 -161
  54. package/lib/utils/updateCellsDecimalFormat.d.ts +0 -6
  55. package/lib/utils/updateCellsDecimalFormat.js +0 -86
Binary file
@@ -45,7 +45,7 @@ export var FormatSearch = function FormatSearch(_a) {
45
45
  var index = getSheetIndex(ctx, ctx.currentSheetId);
46
46
  if (_.isNil(index)) return;
47
47
  var selectedFormat = toolbarFormat[selectedFormatIndex].value;
48
- var formatString = "".concat(selectedFormat, " #,##0.").concat("0".repeat(decimalPlace));
48
+ var formatString = "".concat(selectedFormat, "#,##0.").concat("0".repeat(decimalPlace));
49
49
  _.forEach(ctx.luckysheet_select_save, function (selection) {
50
50
  var _a, _b, _c, _d;
51
51
  for (var r = selection.row[0]; r <= selection.row[1]; r += 1) {
@@ -98,19 +98,15 @@ export var FormatSearch = function FormatSearch(_a) {
98
98
  }
99
99
  }, /*#__PURE__*/React.createElement(SelectTrigger, {
100
100
  className: "w-full"
101
- }, /*#__PURE__*/React.createElement(SelectValue, {
102
- className: "flex items-center gap-2"
103
- }, /*#__PURE__*/React.createElement("span", null, (_b = toolbarFormat[selectedFormatIndex]) === null || _b === void 0 ? void 0 : _b.name), /*#__PURE__*/React.createElement("span", {
104
- className: "text-body-sm color-text-secondary ml-1"
105
- }, "(", (_c = toolbarFormat[selectedFormatIndex]) === null || _c === void 0 ? void 0 : _c.value, ")"))), /*#__PURE__*/React.createElement(SelectContent, null, toolbarFormat.map(function (v, index) {
101
+ }, /*#__PURE__*/React.createElement(SelectValue, null, (_b = toolbarFormat[selectedFormatIndex]) === null || _b === void 0 ? void 0 : _b.name, " ", (_c = toolbarFormat[selectedFormatIndex]) === null || _c === void 0 ? void 0 : _c.value)), /*#__PURE__*/React.createElement(SelectContent, null, toolbarFormat.map(function (v, index) {
106
102
  return /*#__PURE__*/React.createElement(SelectItem, {
107
103
  key: v.name,
108
104
  value: String(index)
109
105
  }, /*#__PURE__*/React.createElement("div", {
110
- className: "flex justify-between w-full items-center gap-2"
106
+ className: "flex justify-between w-full"
111
107
  }, /*#__PURE__*/React.createElement("span", null, v.name), /*#__PURE__*/React.createElement("span", {
112
- className: "text-body-sm color-text-secondary"
113
- }, "(", v.value, ")")));
108
+ className: "text-body-sm text-icon-secondary"
109
+ }, v.value)));
114
110
  }))))), /*#__PURE__*/React.createElement(Divider, {
115
111
  className: "w-full border-t-[1px] my-4"
116
112
  }), /*#__PURE__*/React.createElement("div", {
@@ -1897,65 +1897,6 @@ var SVGDefines = function SVGDefines(_a) {
1897
1897
  }), /*#__PURE__*/React.createElement("path", {
1898
1898
  d: "M8.00147 1.3335C8.31859 1.33426 8.59155 1.55835 8.65382 1.86931C8.95517 3.3758 9.86768 4.83997 11.0835 5.81267L11.2677 5.96501C12.171 6.73236 12.8015 7.61685 13.1121 8.58741L12.4767 8.79053L11.842 8.99431C11.6214 8.30509 11.1562 7.61973 10.4045 6.98129L10.2508 6.85434C9.31898 6.10886 8.53727 5.12515 8.00017 4.03337C7.83296 4.35237 7.44178 4.48213 7.11671 4.32243C6.78643 4.15985 6.6502 3.76015 6.81267 3.42986C7.05681 2.9339 7.23662 2.40833 7.34717 1.86671L7.3615 1.80941C7.44507 1.52891 7.70415 1.33298 8.00147 1.3335Z",
1899
1899
  fill: "#363B3F"
1900
- }))), /*#__PURE__*/React.createElement("symbol", {
1901
- id: "solana",
1902
- width: "16",
1903
- height: "16",
1904
- viewBox: "0 0 16 16",
1905
- fill: "none"
1906
- }, /*#__PURE__*/React.createElement("g", {
1907
- "clip-path": "url(#clip0_568_119011)"
1908
- }, /*#__PURE__*/React.createElement("path", {
1909
- d: "M2.59975 11.6853C2.69631 11.5775 2.82907 11.5146 2.96988 11.5146H15.7393C15.9726 11.5146 16.0893 11.8291 15.9244 12.0132L13.4019 14.8294C13.3053 14.9372 13.1725 15.0001 13.0317 15.0001H0.262315C0.0289729 15.0001 -0.0876979 14.6856 0.0772505 14.5015L2.59975 11.6853Z",
1910
- fill: "url(#paint0_linear_568_119011)"
1911
- }), /*#__PURE__*/React.createElement("path", {
1912
- d: "M2.59975 1.17068C2.70033 1.06288 2.8331 1 2.96988 1H15.7393C15.9726 1 16.0893 1.3144 15.9244 1.49856L13.4019 4.31473C13.3053 4.42252 13.1725 4.4854 13.0317 4.4854H0.262315C0.0289729 4.4854 -0.0876979 4.171 0.0772505 3.98685L2.59975 1.17068Z",
1913
- fill: "url(#paint1_linear_568_119011)"
1914
- }), /*#__PURE__*/React.createElement("path", {
1915
- d: "M13.4019 6.39431C13.3053 6.28651 13.1725 6.22363 13.0317 6.22363H0.262315C0.0289729 6.22363 -0.0876979 6.53804 0.0772505 6.72219L2.59975 9.53836C2.69631 9.64615 2.82907 9.70903 2.96988 9.70903H15.7393C15.9726 9.70903 16.0893 9.39463 15.9244 9.21048L13.4019 6.39431Z",
1916
- fill: "url(#paint2_linear_568_119011)"
1917
- })), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
1918
- id: "paint0_linear_568_119011",
1919
- x1: "14.5195",
1920
- y1: "-0.682254",
1921
- x2: "4.0567",
1922
- y2: "17.2684",
1923
- gradientUnits: "userSpaceOnUse"
1924
- }, /*#__PURE__*/React.createElement("stop", {
1925
- "stop-color": "#00FFA3"
1926
- }), /*#__PURE__*/React.createElement("stop", {
1927
- offset: "1",
1928
- "stop-color": "#DC1FFF"
1929
- })), /*#__PURE__*/React.createElement("linearGradient", {
1930
- id: "paint1_linear_568_119011",
1931
- x1: "10.6552",
1932
- y1: "-2.93462",
1933
- x2: "0.192482",
1934
- y2: "15.016",
1935
- gradientUnits: "userSpaceOnUse"
1936
- }, /*#__PURE__*/React.createElement("stop", {
1937
- "stop-color": "#00FFA3"
1938
- }), /*#__PURE__*/React.createElement("stop", {
1939
- offset: "1",
1940
- "stop-color": "#DC1FFF"
1941
- })), /*#__PURE__*/React.createElement("linearGradient", {
1942
- id: "paint2_linear_568_119011",
1943
- x1: "12.575",
1944
- y1: "-1.81561",
1945
- x2: "2.11229",
1946
- y2: "16.135",
1947
- gradientUnits: "userSpaceOnUse"
1948
- }, /*#__PURE__*/React.createElement("stop", {
1949
- "stop-color": "#00FFA3"
1950
- }), /*#__PURE__*/React.createElement("stop", {
1951
- offset: "1",
1952
- "stop-color": "#DC1FFF"
1953
- })), /*#__PURE__*/React.createElement("clipPath", {
1954
- id: "clip0_568_119011"
1955
- }, /*#__PURE__*/React.createElement("rect", {
1956
- width: "16",
1957
- height: "16",
1958
- fill: "white"
1959
- }))))));
1900
+ })))));
1960
1901
  };
1961
1902
  export default SVGDefines;
@@ -10,7 +10,6 @@
10
10
  position: relative;
11
11
  overflow: hidden;
12
12
  outline-style: none;
13
- cursor: default;
14
13
  }
15
14
 
16
15
  .fortune-row-body {
@@ -377,7 +376,6 @@
377
376
 
378
377
  .luckysheet-cell-flow-clip {
379
378
  border-collapse: collapse;
380
- cursor: default;
381
379
  width: 5000000px;
382
380
  touch-action: manipulation;
383
381
  overflow: hidden;
@@ -243,14 +243,14 @@ var SheetOverlay = function SheetOverlay() {
243
243
  axis: "y"
244
244
  }), /*#__PURE__*/React.createElement("div", {
245
245
  ref: refs.cellArea,
246
- className: "fortune-cell-area",
246
+ className: "fortune-cell-area ".concat(context.luckysheetPaintModelOn ? "cursor-paint" : ""),
247
247
  onMouseDown: cellAreaMouseDown,
248
248
  onDoubleClick: cellAreaDoubleClick,
249
249
  onContextMenu: cellAreaContextMenu,
250
250
  style: {
251
251
  width: context.cellmainWidth,
252
252
  height: context.cellmainHeight,
253
- cursor: context.luckysheet_cell_selected_extend ? "crosshair" : "default"
253
+ cursor: context.luckysheet_cell_selected_extend ? "crosshair" : ""
254
254
  }
255
255
  }, /*#__PURE__*/React.createElement("div", {
256
256
  id: "fortune-formula-functionrange"
@@ -7,7 +7,6 @@
7
7
  padding: 0 30px 0 44px;
8
8
  margin: 0;
9
9
  -webkit-touch-callout: none;
10
- cursor: default;
11
10
  transition: 0.3s ease all;
12
11
  display: flex;
13
12
  align-items: center;
@@ -188,7 +187,6 @@
188
187
  border-top-color: #fff;
189
188
  color: #222;
190
189
  /* box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); */
191
- cursor: default;
192
190
  /* top: -2px; */
193
191
  /* border-bottom: none; */
194
192
  /* padding-right: 20px; */
@@ -57,27 +57,7 @@ var SheetTab = function SheetTab() {
57
57
  var _a;
58
58
  (_a = settings.onSheetCountChange) === null || _a === void 0 ? void 0 : _a.call(settings, context.luckysheetfile.length);
59
59
  }, [context.luckysheetfile.length]);
60
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
61
- className: "w-full",
62
- id: "denomination-warning",
63
- style: {
64
- position: "relative",
65
- display: "none",
66
- backgroundColor: "#F8F9FA",
67
- borderBottom: "1px solid #E8EBEC",
68
- color: "#77818A",
69
- fontFamily: "Helvetica Neue",
70
- fontSize: "var(--font-size-2xsm, 12px)",
71
- fontStyle: "normal",
72
- fontWeight: "400"
73
- }
74
- }, /*#__PURE__*/React.createElement("div", {
75
- className: "max-w-7xl mx-auto px-4 py-1"
76
- }, /*#__PURE__*/React.createElement("p", {
77
- className: "text-sm text-center"
78
- }, /*#__PURE__*/React.createElement("span", {
79
- className: "font-medium"
80
- }, "Disclaimer:"), " Prices aren't updated in real time, so they might be slightly different from the source when you check. Updates can be delayed by up to 20 minutes."))), /*#__PURE__*/React.createElement("div", {
60
+ return /*#__PURE__*/React.createElement("div", {
81
61
  className: "luckysheet-sheet-area luckysheet-noselected-text",
82
62
  onContextMenu: function onContextMenu(e) {
83
63
  return e.preventDefault();
@@ -158,6 +138,6 @@ var SheetTab = function SheetTab() {
158
138
  height: 12
159
139
  })))), /*#__PURE__*/React.createElement("div", {
160
140
  className: "fortune-sheet-area-right"
161
- }, /*#__PURE__*/React.createElement(ZoomControl, null))));
141
+ }, /*#__PURE__*/React.createElement(ZoomControl, null)));
162
142
  };
163
143
  export default SheetTab;
@@ -18,11 +18,8 @@ var Combo = function Combo(_a) {
18
18
  open = _c[0],
19
19
  setOpen = _c[1];
20
20
  var buttonRef = useRef(null);
21
- var handleOpenChange = function handleOpenChange(newOpen) {
22
- setOpen(newOpen);
23
- };
24
21
  var isLucideIcon = useMemo(function () {
25
- return (iconId === null || iconId === void 0 ? void 0 : iconId.startsWith("align-")) || ["text-overflow", "text-wrap", "text-clip", "font-color", "background", "border-all", "merge-all", "format", "conditionFormat", "filter", "comment", "image", "formula-sum", "dune", "template", "font-color", "background", "currency"].includes(iconId);
22
+ return (iconId === null || iconId === void 0 ? void 0 : iconId.startsWith("align-")) || ["text-overflow", "text-wrap", "text-clip", "font-color", "background", "border-all", "merge-all", "format", "conditionFormat", "filter", "comment", "image", "formula-sum", "dune", "template", "font-color", "background"].includes(iconId);
26
23
  }, [iconId]);
27
24
  var trigger = !isLucideIcon ? (/*#__PURE__*/React.createElement(Tooltip, {
28
25
  text: tooltip,
@@ -78,8 +75,7 @@ var Combo = function Combo(_a) {
78
75
  return setOpen(!open);
79
76
  },
80
77
  className: cn("fortune-toolbar-combo-button", {
81
- "custom-color-button": iconId === "font-color" && fillColor,
82
- "min-w-fit rounded-l-none": iconId === "currency"
78
+ "custom-color-button": iconId === "font-color" && fillColor
83
79
  }),
84
80
  style: {
85
81
  color: iconId === "font-color" ? fillColor : undefined
@@ -90,8 +86,7 @@ var Combo = function Combo(_a) {
90
86
  className: "fortune-toolbar-item"
91
87
  }, /*#__PURE__*/React.createElement(Popover, {
92
88
  open: open,
93
- onOpenChange: handleOpenChange,
94
- modal: true
89
+ onOpenChange: setOpen
95
90
  }, /*#__PURE__*/React.createElement(PopoverTrigger, {
96
91
  asChild: true
97
92
  }, /*#__PURE__*/React.createElement("div", {
@@ -101,16 +96,7 @@ var Combo = function Combo(_a) {
101
96
  side: "bottom",
102
97
  sideOffset: 4,
103
98
  alignOffset: -16,
104
- className: "fortune-toolbar-combo-popup border-none",
105
- onMouseDown: function onMouseDown(e) {
106
- return e.stopPropagation();
107
- },
108
- onMouseUp: function onMouseUp(e) {
109
- return e.stopPropagation();
110
- },
111
- onClick: function onClick(e) {
112
- return e.stopPropagation();
113
- }
99
+ className: "fortune-toolbar-combo-popup border-none"
114
100
  }, children === null || children === void 0 ? void 0 : children(setOpen))));
115
101
  };
116
102
  export default Combo;
@@ -403,9 +403,3 @@
403
403
  .custom-color-button > svg > path:first-child {
404
404
  display: none !important;
405
405
  }
406
-
407
- #search-input-container [cmdk-input-wrapper] {
408
- border: 1px solid hsl(var(--color-border-default));
409
- border-radius: 8px;
410
- margin: 8px 8px 0px 8px;
411
- }
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import "./index.css";
3
- export declare const getLucideIcon: (title: string) => "Ethereum" | "DollarSign" | "" | "ChevronDown" | "Undo" | "Redo" | "Bold" | "Italic" | "Strikethrough" | "Underline" | "AlignLeft" | "AlignCenter" | "AlignRight" | "ArrowUpFromLine" | "AlignVerticalMiddle" | "ArrowDownToLine" | "TextOverflow" | "WrapText" | "TextClip" | "Baseline" | "PaintBucket" | "Border" | "MergeHorizontal" | "Percent" | "DecimalsArrowLeft" | "DecimalsArrowRight" | "PaintbrushVertical" | "Filter" | "Link" | "MessageSquarePlus" | "Image" | "Sigma" | "ShieldCheck" | "Search" | "DuneChart" | "Ellipsis";
3
+ export declare const getLucideIcon: (title: string) => "" | "Undo" | "Redo" | "PaintRoller" | "Bold" | "Italic" | "Strikethrough" | "Underline" | "AlignLeft" | "AlignCenter" | "AlignRight" | "ArrowUpFromLine" | "AlignVerticalMiddle" | "ArrowDownToLine" | "TextOverflow" | "WrapText" | "TextClip" | "Baseline" | "PaintBucket" | "Border" | "MergeHorizontal" | "DollarSign" | "Percent" | "DecimalsArrowLeft" | "DecimalsArrowRight" | "PaintbrushVertical" | "Filter" | "Link" | "MessageSquarePlus" | "Image" | "Sigma" | "ShieldCheck" | "Search" | "DuneChart" | "Ellipsis";
4
4
  declare const Toolbar: React.FC<{
5
5
  setMoreItems: React.Dispatch<React.SetStateAction<React.ReactNode>>;
6
6
  moreItemsOpen: boolean;
@@ -1,131 +1,7 @@
1
- var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) {
3
- return value instanceof P ? value : new P(function (resolve) {
4
- resolve(value);
5
- });
6
- }
7
- return new (P || (P = Promise))(function (resolve, reject) {
8
- function fulfilled(value) {
9
- try {
10
- step(generator.next(value));
11
- } catch (e) {
12
- reject(e);
13
- }
14
- }
15
- function rejected(value) {
16
- try {
17
- step(generator["throw"](value));
18
- } catch (e) {
19
- reject(e);
20
- }
21
- }
22
- function step(result) {
23
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
24
- }
25
- step((generator = generator.apply(thisArg, _arguments || [])).next());
26
- });
27
- };
28
- var __generator = this && this.__generator || function (thisArg, body) {
29
- var _ = {
30
- label: 0,
31
- sent: function sent() {
32
- if (t[0] & 1) throw t[1];
33
- return t[1];
34
- },
35
- trys: [],
36
- ops: []
37
- },
38
- f,
39
- y,
40
- t,
41
- g;
42
- return g = {
43
- next: verb(0),
44
- "throw": verb(1),
45
- "return": verb(2)
46
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
47
- return this;
48
- }), g;
49
- function verb(n) {
50
- return function (v) {
51
- return step([n, v]);
52
- };
53
- }
54
- function step(op) {
55
- if (f) throw new TypeError("Generator is already executing.");
56
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
57
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
58
- if (y = 0, t) op = [op[0] & 2, t.value];
59
- switch (op[0]) {
60
- case 0:
61
- case 1:
62
- t = op;
63
- break;
64
- case 4:
65
- _.label++;
66
- return {
67
- value: op[1],
68
- done: false
69
- };
70
- case 5:
71
- _.label++;
72
- y = op[1];
73
- op = [0];
74
- continue;
75
- case 7:
76
- op = _.ops.pop();
77
- _.trys.pop();
78
- continue;
79
- default:
80
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
81
- _ = 0;
82
- continue;
83
- }
84
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
85
- _.label = op[1];
86
- break;
87
- }
88
- if (op[0] === 6 && _.label < t[1]) {
89
- _.label = t[1];
90
- t = op;
91
- break;
92
- }
93
- if (t && _.label < t[2]) {
94
- _.label = t[2];
95
- _.ops.push(op);
96
- break;
97
- }
98
- if (t[2]) _.ops.pop();
99
- _.trys.pop();
100
- continue;
101
- }
102
- op = body.call(thisArg, _);
103
- } catch (e) {
104
- op = [6, e];
105
- y = 0;
106
- } finally {
107
- f = t = 0;
108
- }
109
- if (op[0] & 5) throw op[1];
110
- return {
111
- value: op[0] ? op[1] : void 0,
112
- done: true
113
- };
114
- }
115
- };
116
- var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
117
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
118
- if (ar || !(i in from)) {
119
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
120
- ar[i] = from[i];
121
- }
122
- }
123
- return to.concat(ar || Array.prototype.slice.call(from));
124
- };
125
1
  import React, { useContext, useCallback, useRef, useEffect, useState } from "react";
126
2
  import { toolbarItemClickHandler, handleTextBackground, handleTextColor, handleTextSize, normalizedCellAttr, getFlowdata, newComment, editComment, deleteComment, showHideComment, showHideAllComments, autoSelectionFormula, handleSum, locale, handleMerge, handleBorder, toolbarItemSelectedFunc, handleFreeze, insertImage, showImgChooser, updateFormat, handleSort, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, createFilter, clearFilter, applyLocation, insertDuneChart } from "@fileverse-dev/fortune-core";
127
3
  import _ from "lodash";
128
- import { IconButton, LucideIcon, Tooltip, Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from "@fileverse/ui";
4
+ import { IconButton, LucideIcon, Tooltip } from "@fileverse/ui";
129
5
  import WorkbookContext from "../../context";
130
6
  import "./index.css";
131
7
  import Button from "./Button";
@@ -143,16 +19,14 @@ import { CustomColor } from "./CustomColor";
143
19
  import { FormatSearch } from "../FormatSearch";
144
20
  import DuneChartsInputModal from "../DuneChartsInputModal/DuneChartsInputModal";
145
21
  import MoreItemsContaier from "./MoreItemsContainer";
146
- import CryptoDenominationSelector from "../CryptoDenominationSelector";
147
- import { getGroupedCurrencyOptions, CRYPTO_OPTIONS } from "../../constants";
148
- import { convertCellsToCrypto, getFiatSymbol } from "../../utils/convertCellsToCrypto";
149
- import { updateCellsDecimalFormat } from "../../utils/updateCellsDecimalFormat";
150
22
  export var getLucideIcon = function getLucideIcon(title) {
151
23
  switch (title) {
152
24
  case "undo":
153
25
  return "Undo";
154
26
  case "redo":
155
27
  return "Redo";
28
+ case "format-painter":
29
+ return "PaintRoller";
156
30
  case "bold":
157
31
  return "Bold";
158
32
  case "italic":
@@ -191,8 +65,6 @@ export var getLucideIcon = function getLucideIcon(title) {
191
65
  return "DollarSign";
192
66
  case "currency-format":
193
67
  return "DollarSign";
194
- case "currency":
195
- return "ChevronDown";
196
68
  case "percentage-format":
197
69
  return "Percent";
198
70
  case "number-decrease":
@@ -217,8 +89,6 @@ export var getLucideIcon = function getLucideIcon(title) {
217
89
  return "Search";
218
90
  case "dune":
219
91
  return "DuneChart";
220
- case "crypto":
221
- return "Ethereum";
222
92
  case "Ellipsis":
223
93
  return "Ellipsis";
224
94
  default:
@@ -284,15 +154,6 @@ var Toolbar = function Toolbar(_a) {
284
154
  var defaultFormat = defaultFmt(currency);
285
155
  var customColor = useState("#000000")[0];
286
156
  var customStyle = useState("1")[0];
287
- var _m = useState(""),
288
- searchTerm = _m[0],
289
- setSearchTerm = _m[1];
290
- var _o = useState(2),
291
- decimals = _o[0],
292
- setDecimals = _o[1];
293
- var _p = useState("USD"),
294
- selectedFiat = _p[0],
295
- setSelectedFiat = _p[1];
296
157
  var showSubMenu = useCallback(function (e, className) {
297
158
  var target = e.target;
298
159
  var menuItem = target.className === "fortune-toolbar-menu-line" ? target.parentElement : target;
@@ -1385,183 +1246,6 @@ var Toolbar = function Toolbar(_a) {
1385
1246
  }));
1386
1247
  });
1387
1248
  }
1388
- if (name === "currency") {
1389
- var currentFmt_1 = defaultFormat[0].text;
1390
- var currentIcon = "currency";
1391
- if (cell) {
1392
- var curr_3 = normalizedCellAttr(cell, "ct");
1393
- if (curr_3 === null || curr_3 === void 0 ? void 0 : curr_3.fa) {
1394
- var allOptions = __spreadArray(__spreadArray([], CRYPTO_OPTIONS, true), locale(context).currencyDetail.map(function (c) {
1395
- return {
1396
- label: c.name,
1397
- value: c.value,
1398
- icon: undefined,
1399
- type: "fiat"
1400
- };
1401
- }), true);
1402
- var found = allOptions.find(function (o) {
1403
- return curr_3.fa.includes(o.value);
1404
- });
1405
- if (found) {
1406
- currentFmt_1 = found.label;
1407
- }
1408
- }
1409
- }
1410
- var groupedOptions_1 = getGroupedCurrencyOptions(locale(context).currencyDetail);
1411
- var filterOptions_1 = function filterOptions_1(options) {
1412
- if (!searchTerm.trim()) return options;
1413
- var query = searchTerm.trim().toLowerCase();
1414
- return options.filter(function (opt) {
1415
- return query.split(/\s+/).every(function (word) {
1416
- return opt.label.toLowerCase().includes(word) || opt.value.toLowerCase().includes(word);
1417
- });
1418
- });
1419
- };
1420
- var dedupeByValue_1 = function dedupeByValue_1(options) {
1421
- var seen = new Set();
1422
- return options.filter(function (opt) {
1423
- if (seen.has(opt.value)) return false;
1424
- seen.add(opt.value);
1425
- return true;
1426
- });
1427
- };
1428
- var handleCurrencyDecimalsChange_1 = function handleCurrencyDecimalsChange_1(newDecimals) {
1429
- setDecimals(newDecimals);
1430
- var isCrypto = false;
1431
- if (cell && cell.ct && typeof cell.ct.fa === "string") {
1432
- var _a = cell.ct.fa.match(/"([A-Z]+)"/) || [],
1433
- matchedDenom = _a[1];
1434
- if (matchedDenom) isCrypto = true;
1435
- }
1436
- updateCellsDecimalFormat({
1437
- context: context,
1438
- setContext: setContext,
1439
- decimals: newDecimals,
1440
- denomination: isCrypto ? undefined : selectedFiat
1441
- });
1442
- };
1443
- return /*#__PURE__*/React.createElement(Combo, {
1444
- iconId: currentIcon,
1445
- text: currentFmt_1,
1446
- key: name,
1447
- tooltip: tooltip,
1448
- showArrow: true
1449
- }, function () {
1450
- return /*#__PURE__*/React.createElement("div", {
1451
- style: {
1452
- minWidth: "20rem"
1453
- }
1454
- }, /*#__PURE__*/React.createElement(Command, {
1455
- className: "border color-border-default rounded-lg"
1456
- }, /*#__PURE__*/React.createElement("div", {
1457
- id: "search-input-container"
1458
- }, /*#__PURE__*/React.createElement(CommandInput, {
1459
- placeholder: "Search by name or code",
1460
- value: searchTerm,
1461
- onValueChange: setSearchTerm
1462
- })), /*#__PURE__*/React.createElement("div", {
1463
- className: "px-4 py-2 border-b color-border-default flex items-center justify-between gap-2 text-body-sm color-text-default",
1464
- onClick: function onClick(e) {
1465
- return e.stopPropagation();
1466
- }
1467
- }, /*#__PURE__*/React.createElement("span", null, "Decimal places:"), /*#__PURE__*/React.createElement("span", {
1468
- className: "cds-row flex items-center"
1469
- }, /*#__PURE__*/React.createElement(IconButton, {
1470
- icon: "Minus",
1471
- variant: "ghost",
1472
- size: "sm",
1473
- className: "!bg-transparent",
1474
- disabled: decimals === 1,
1475
- onClick: function onClick() {
1476
- return handleCurrencyDecimalsChange_1(Math.max(1, decimals - 1));
1477
- }
1478
- }), /*#__PURE__*/React.createElement("input", {
1479
- type: "number",
1480
- min: 1,
1481
- max: 18,
1482
- value: decimals,
1483
- onChange: function onChange(e) {
1484
- return handleCurrencyDecimalsChange_1(Math.max(1, Math.min(18, Number(e.target.value))));
1485
- }
1486
- }), /*#__PURE__*/React.createElement(IconButton, {
1487
- icon: "Plus",
1488
- variant: "ghost",
1489
- size: "sm",
1490
- className: "!bg-transparent",
1491
- disabled: decimals === 18,
1492
- onClick: function onClick() {
1493
- return handleCurrencyDecimalsChange_1(Math.min(18, decimals + 1));
1494
- }
1495
- }))), /*#__PURE__*/React.createElement(CommandList, null, /*#__PURE__*/React.createElement(CommandEmpty, {
1496
- className: "text-center text-body-sm color-text-secondary flex items-center justify-center",
1497
- style: {
1498
- minHeight: "5rem"
1499
- }
1500
- }, "No results found."), groupedOptions_1.map(function (group) {
1501
- var filtered = dedupeByValue_1(filterOptions_1(group.options));
1502
- return /*#__PURE__*/React.createElement(CommandGroup, {
1503
- key: group.group,
1504
- heading: group.group
1505
- }, filtered.map(function (opt) {
1506
- return /*#__PURE__*/React.createElement(CommandItem, {
1507
- key: opt.value,
1508
- value: "".concat(opt.label, " ").concat(opt.value),
1509
- onSelect: function onSelect() {
1510
- return __awaiter(void 0, void 0, void 0, function () {
1511
- return __generator(this, function (_a) {
1512
- switch (_a.label) {
1513
- case 0:
1514
- if (!(opt.type === "crypto")) return [3, 2];
1515
- return [4, convertCellsToCrypto({
1516
- context: context,
1517
- setContext: setContext,
1518
- denomination: opt.value,
1519
- decimals: decimals,
1520
- baseCurrency: "USD"
1521
- })];
1522
- case 1:
1523
- _a.sent();
1524
- return [3, 3];
1525
- case 2:
1526
- setSelectedFiat(opt.value);
1527
- setContext(function (ctx) {
1528
- var d = getFlowdata(ctx);
1529
- if (d == null) return;
1530
- var formatString = "".concat(getFiatSymbol(opt.value), " #,##0.").concat("0".repeat(decimals));
1531
- updateFormat(ctx, refs.cellInput.current, d, "ct", formatString);
1532
- });
1533
- _a.label = 3;
1534
- case 3:
1535
- return [2];
1536
- }
1537
- });
1538
- });
1539
- }
1540
- }, /*#__PURE__*/React.createElement("div", {
1541
- className: "fortune-toolbar-menu-line flex items-center justify-between w-full"
1542
- }, /*#__PURE__*/React.createElement("div", {
1543
- className: "flex items-center gap-2"
1544
- }, currentFmt_1 === opt.label ? (/*#__PURE__*/React.createElement(LucideIcon, {
1545
- name: "Check",
1546
- className: "w-4 h-4"
1547
- })) : (/*#__PURE__*/React.createElement("span", {
1548
- className: "w-4 h-4"
1549
- })), /*#__PURE__*/React.createElement("span", null, opt.label)), opt.type === "crypto" ? (/*#__PURE__*/React.createElement("span", {
1550
- className: "color-text-secondary"
1551
- }, /*#__PURE__*/React.createElement(LucideIcon, {
1552
- name: opt.icon,
1553
- className: "cds-icon"
1554
- }), opt.value === "SOL" && (/*#__PURE__*/React.createElement(SVGIcon, {
1555
- name: "solana",
1556
- width: 16,
1557
- height: 16
1558
- })))) : (/*#__PURE__*/React.createElement("span", {
1559
- className: "color-text-secondary"
1560
- }, opt.value))));
1561
- }));
1562
- }))));
1563
- });
1564
- }
1565
1249
  return /*#__PURE__*/React.createElement(Tooltip, {
1566
1250
  text: tooltip,
1567
1251
  placement: "bottom"
@@ -1614,7 +1298,7 @@ var Toolbar = function Toolbar(_a) {
1614
1298
  onClose: onMoreToolbarItemsClose
1615
1299
  }, moreToolbarItems))), /*#__PURE__*/React.createElement("div", {
1616
1300
  className: "fortune-toolbar-right"
1617
- }, settings.customToolbarItems.length > 0 && (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
1301
+ }, settings.customToolbarItems.length > 0 && (/*#__PURE__*/React.createElement(Button, {
1618
1302
  iconId: "dune",
1619
1303
  tooltip: "Insert Dune Chart",
1620
1304
  key: "dune-charts",
@@ -1626,20 +1310,7 @@ var Toolbar = function Toolbar(_a) {
1626
1310
  backgroundColor: "#F4603E2E",
1627
1311
  borderRadius: "8px"
1628
1312
  }
1629
- }), /*#__PURE__*/React.createElement("span", {
1630
- style: {
1631
- display: "inline-block",
1632
- position: "relative"
1633
- }
1634
- }, /*#__PURE__*/React.createElement(CryptoDenominationSelector, null, /*#__PURE__*/React.createElement(Button, {
1635
- iconId: "crypto",
1636
- tooltip: "Crypto denominations",
1637
- key: "crypto-denominations",
1638
- style: {
1639
- backgroundColor: "#e8ebec",
1640
- borderRadius: "8px"
1641
- }
1642
- }))))), settings.customToolbarItems.filter(function (n) {
1313
+ })), settings.customToolbarItems.filter(function (n) {
1643
1314
  return n.key !== "import-export";
1644
1315
  }).map(function (n) {
1645
1316
  return /*#__PURE__*/React.createElement(CustomButton, {
@@ -42,3 +42,7 @@ html::-webkit-scrollbar-button {
42
42
  justify-content: flex-end;
43
43
  align-items: center;
44
44
  }
45
+
46
+ .cursor-paint {
47
+ cursor: url("../../assets/paint-roller.png") 16 16, auto;
48
+ }