@fileverse-dev/fortune-react 1.2.68 → 1.2.69

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 (33) hide show
  1. package/es/components/ConditionFormat/ConditionRules.d.ts +3 -1
  2. package/es/components/ConditionFormat/ConditionRules.js +423 -80
  3. package/es/components/ConditionFormat/formating.css +103 -0
  4. package/es/components/ConditionFormat/index.css +62 -5
  5. package/es/components/ConditionFormat/index.js +2 -6
  6. package/es/components/ContextMenu/index.js +10 -41
  7. package/es/components/DataVerification/RangeDialog.js +0 -15
  8. package/es/components/SheetOverlay/helper.d.ts +1 -0
  9. package/es/components/SheetOverlay/helper.js +1 -1
  10. package/es/components/Toolbar/conditionalFormatPortal.d.ts +6 -0
  11. package/es/components/Toolbar/conditionalFormatPortal.js +13 -0
  12. package/es/components/Toolbar/index.d.ts +1 -1
  13. package/es/components/Toolbar/index.js +49 -28
  14. package/es/components/Workbook/api.d.ts +4 -0
  15. package/es/components/Workbook/api.js +4 -0
  16. package/es/components/Workbook/index.d.ts +4 -0
  17. package/lib/components/ConditionFormat/ConditionRules.d.ts +3 -1
  18. package/lib/components/ConditionFormat/ConditionRules.js +421 -78
  19. package/lib/components/ConditionFormat/formating.css +103 -0
  20. package/lib/components/ConditionFormat/index.css +62 -5
  21. package/lib/components/ConditionFormat/index.js +1 -5
  22. package/lib/components/ContextMenu/index.js +10 -41
  23. package/lib/components/DataVerification/RangeDialog.js +0 -15
  24. package/lib/components/SheetOverlay/helper.d.ts +1 -0
  25. package/lib/components/SheetOverlay/helper.js +1 -0
  26. package/lib/components/Toolbar/conditionalFormatPortal.d.ts +6 -0
  27. package/lib/components/Toolbar/conditionalFormatPortal.js +20 -0
  28. package/lib/components/Toolbar/index.d.ts +1 -1
  29. package/lib/components/Toolbar/index.js +49 -28
  30. package/lib/components/Workbook/api.d.ts +4 -0
  31. package/lib/components/Workbook/api.js +4 -0
  32. package/lib/components/Workbook/index.d.ts +4 -0
  33. package/package.json +2 -2
@@ -1,6 +1,8 @@
1
1
  import React from "react";
2
2
  import "./index.css";
3
+ import "./formating.css";
3
4
  declare const ConditionRules: React.FC<{
4
- type: string;
5
+ type?: string;
6
+ context?: any;
5
7
  }>;
6
8
  export default ConditionRules;
@@ -1,30 +1,90 @@
1
- import React, { useCallback, useContext, useEffect, useState } from "react";
1
+ import React, { useRef, useCallback, useContext, useEffect, useState } from "react";
2
2
  import "./index.css";
3
- import { locale, setConditionRules } from "@fileverse-dev/fortune-core";
3
+ import { cn, Button, IconButton, LucideIcon, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, TextField } from "@fileverse/ui";
4
+ import { locale, setConditionRules, getSheetIndex } from "@fileverse-dev/fortune-core";
4
5
  import produce from "immer";
5
- import { Button, Checkbox, Divider, IconButton, LucideIcon, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, TextField } from "@fileverse/ui";
6
+ import { numberToColumn } from "../SheetOverlay/helper";
6
7
  import WorkbookContext from "../../context";
7
8
  import { useDialog } from "../../hooks/useDialog";
8
9
  import { getDisplayedRangeTxt } from "../DataVerification/getDisplayedRangeTxt";
9
10
  import { injectDatepickerStyles } from "../../utils/datepickerStyles";
11
+ import "./formating.css";
10
12
  injectDatepickerStyles();
11
13
  var ConditionRules = function ConditionRules(_a) {
12
- var type = _a.type;
13
- var _b = useContext(WorkbookContext),
14
- context = _b.context,
15
- setContext = _b.setContext;
14
+ var rulesType = _a.type,
15
+ context = _a.context;
16
+ console.log("rulesType", rulesType);
17
+ var _b = useState("greaterThan"),
18
+ type = _b[0],
19
+ setType = _b[1];
20
+ var _c = useState(false),
21
+ create = _c[0],
22
+ setCreate = _c[1];
23
+ var buttonClickCreateRef = useRef(false);
24
+ var textColorInputRef = useRef(null);
25
+ var cellColorInputRef = useRef(null);
26
+ var _d = useState([]),
27
+ matchedConditionFormatKey = _d[0],
28
+ setMatchedConditionFormatKey = _d[1];
29
+ var _e = useState(null),
30
+ allConditionFormats = _e[0],
31
+ setAllConditionFormats = _e[1];
32
+ var setContext = useContext(WorkbookContext).setContext;
16
33
  var hideDialog = useDialog().hideDialog;
17
- var _c = locale(context),
18
- conditionformat = _c.conditionformat,
19
- button = _c.button,
20
- protection = _c.protection,
21
- generalDialog = _c.generalDialog;
22
- var _d = useState({
34
+ var _f = locale(context),
35
+ conditionformat = _f.conditionformat,
36
+ button = _f.button,
37
+ protection = _f.protection,
38
+ generalDialog = _f.generalDialog;
39
+ var _g = useState({
23
40
  textColor: "#FFFFFF",
24
41
  cellColor: "#D82E2A"
25
42
  }),
26
- colorRules = _d[0],
27
- setColorRules = _d[1];
43
+ colorRules = _g[0],
44
+ setColorRules = _g[1];
45
+ var _h = useState(false),
46
+ bold = _h[0],
47
+ setBold = _h[1];
48
+ var _j = useState(false),
49
+ italic = _j[0],
50
+ setItalic = _j[1];
51
+ var _k = useState(false),
52
+ underline = _k[0],
53
+ setUnderline = _k[1];
54
+ var _l = useState(false),
55
+ strikethrough = _l[0],
56
+ setStrikethrough = _l[1];
57
+ useEffect(function () {
58
+ var _a, _b;
59
+ var index = getSheetIndex(context, context === null || context === void 0 ? void 0 : context.currentSheetId) || 0;
60
+ var allCondition = context.luckysheetfile[index].luckysheet_conditionformat_save;
61
+ setAllConditionFormats(allCondition);
62
+ var selectionColumn = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0].column;
63
+ var selectionRow = (_b = context.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0].row;
64
+ var matchedCondition = [];
65
+ if (allCondition) {
66
+ Object.keys(allCondition).forEach(function (key) {
67
+ var _a;
68
+ var conditionFormat = allCondition[key];
69
+ var range = (_a = conditionFormat.cellrange) === null || _a === void 0 ? void 0 : _a[0];
70
+ if (!range || !selectionColumn || !selectionRow) return;
71
+ var rangeColumns = range.column;
72
+ var rangeRows = range.row;
73
+ var isColumnOverlap = !(selectionColumn[1] < rangeColumns[0] || selectionColumn[0] > rangeColumns[1]);
74
+ var isRowOverlap = !(selectionRow[1] < rangeRows[0] || selectionRow[0] > rangeRows[1]);
75
+ if (isColumnOverlap && isRowOverlap) {
76
+ matchedCondition.push(key);
77
+ }
78
+ });
79
+ setMatchedConditionFormatKey(matchedCondition);
80
+ }
81
+ if (buttonClickCreateRef.current) return;
82
+ if (matchedCondition.length === 0) {
83
+ setCreate(true);
84
+ } else if (matchedCondition.length > 0) {
85
+ setCreate(false);
86
+ }
87
+ }, [context]);
28
88
  var dataSelectRange = useCallback(function (selectType) {
29
89
  hideDialog();
30
90
  setContext(function (ctx) {
@@ -38,15 +98,26 @@ var ConditionRules = function ConditionRules(_a) {
38
98
  }, [colorRules.cellColor, colorRules.textColor, hideDialog, setContext]);
39
99
  var close = useCallback(function (closeType) {
40
100
  if (closeType === "confirm") {
101
+ buttonClickCreateRef.current = false;
102
+ setCreate(false);
41
103
  setContext(function (ctx) {
42
104
  ctx.conditionRules.textColor.color = colorRules.textColor;
43
105
  ctx.conditionRules.cellColor.color = colorRules.cellColor;
106
+ ctx.conditionRules.font = {
107
+ bold: bold,
108
+ italic: italic,
109
+ underline: underline,
110
+ strikethrough: strikethrough
111
+ };
44
112
  setConditionRules(ctx, protection, generalDialog, conditionformat, ctx.conditionRules);
45
113
  });
114
+ } else {
115
+ buttonClickCreateRef.current = true;
116
+ setCreate(false);
46
117
  }
47
118
  setContext(function (ctx) {
48
119
  ctx.conditionRules = {
49
- rulesType: "",
120
+ rulesType: "greaterThan",
50
121
  rulesValue: "",
51
122
  textColor: {
52
123
  check: true,
@@ -56,6 +127,12 @@ var ConditionRules = function ConditionRules(_a) {
56
127
  check: true,
57
128
  color: "#000000"
58
129
  },
130
+ font: {
131
+ bold: false,
132
+ italic: false,
133
+ underline: false,
134
+ strikethrough: false
135
+ },
59
136
  betweenValue: {
60
137
  value1: "",
61
138
  value2: ""
@@ -66,7 +143,7 @@ var ConditionRules = function ConditionRules(_a) {
66
143
  };
67
144
  });
68
145
  hideDialog();
69
- }, [colorRules, conditionformat, generalDialog, hideDialog, protection, setContext]);
146
+ }, [colorRules, conditionformat, generalDialog, hideDialog, protection, setContext, bold, italic, underline, strikethrough]);
70
147
  useEffect(function () {
71
148
  setContext(function (ctx) {
72
149
  ctx.conditionRules.rulesType = type;
@@ -91,6 +168,12 @@ var ConditionRules = function ConditionRules(_a) {
91
168
  check: true,
92
169
  color: "#000000"
93
170
  },
171
+ font: {
172
+ bold: false,
173
+ italic: false,
174
+ underline: false,
175
+ strikethrough: false
176
+ },
94
177
  betweenValue: {
95
178
  value1: "",
96
179
  value2: ""
@@ -103,17 +186,185 @@ var ConditionRules = function ConditionRules(_a) {
103
186
  ctx.rangeDialog.type = "";
104
187
  ctx.rangeDialog.rangeTxt = "";
105
188
  });
106
- }, []);
107
- var titleType = type === "top10_percent" ? "top10" : type === "last10_percent" ? "last10" : type;
189
+ }, [type]);
190
+ var conditionList = [{
191
+ text: "greaterThan",
192
+ value: ">",
193
+ label: "Greater Than"
194
+ }, {
195
+ text: "greaterThanOrEqual",
196
+ value: ">=",
197
+ label: "Greater Than or Equal"
198
+ }, {
199
+ text: "lessThan",
200
+ value: "<",
201
+ label: "Less Than"
202
+ }, {
203
+ text: "lessThanOrEqual",
204
+ value: "<=",
205
+ label: "Less Than or Equal"
206
+ }, {
207
+ text: "between",
208
+ value: "[]",
209
+ label: "Between"
210
+ }, {
211
+ text: "equal",
212
+ value: "=",
213
+ label: "Equal"
214
+ }, {
215
+ text: "textContains",
216
+ value: "()",
217
+ label: "Text Contains"
218
+ }, {
219
+ text: "occurrenceDate",
220
+ value: conditionformat.yesterday,
221
+ label: "Occurrence Date"
222
+ }, {
223
+ text: "duplicateValue",
224
+ value: "##",
225
+ label: "Duplicate Value"
226
+ }, {
227
+ text: "top10",
228
+ value: conditionformat.top10
229
+ }, {
230
+ text: "top10_percent",
231
+ value: conditionformat.top10_percent,
232
+ label: "Top 10 Percent"
233
+ }, {
234
+ text: "last10",
235
+ value: conditionformat.last10,
236
+ label: "Last 10"
237
+ }, {
238
+ text: "last10_percent",
239
+ value: conditionformat.last10_percent,
240
+ label: "Last 10 Percent"
241
+ }, {
242
+ text: "aboveAverage",
243
+ value: conditionformat.above,
244
+ label: "Above Average"
245
+ }, {
246
+ text: "belowAverage",
247
+ value: conditionformat.below,
248
+ label: "Below Average"
249
+ }];
108
250
  return /*#__PURE__*/React.createElement("div", {
109
251
  className: "condition-rules"
110
- }, !["aboveAverage", "belowAverage"].includes(type) && (/*#__PURE__*/React.createElement("div", {
252
+ }, !create ? (/*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
253
+ style: {
254
+ marginBottom: "16px"
255
+ }
256
+ }, matchedConditionFormatKey.map(function (key) {
257
+ var _a, _b;
258
+ return /*#__PURE__*/React.createElement("div", {
259
+ className: "group flex items-center border-b border-gray-200 condition-list-parent",
260
+ key: key
261
+ }, /*#__PURE__*/React.createElement("div", {
262
+ className: "condition-list-pill",
263
+ style: {
264
+ backgroundColor: allConditionFormats[key].format.cellColor || ""
265
+ }
266
+ }, /*#__PURE__*/React.createElement("span", {
267
+ className: "condition-list-text",
268
+ style: {
269
+ color: allConditionFormats[key].format.textColor || ""
270
+ }
271
+ }, "123")), /*#__PURE__*/React.createElement("div", {
272
+ className: "flex flex-col",
273
+ style: {
274
+ width: "200px",
275
+ padding: "8px 0px"
276
+ }
277
+ }, /*#__PURE__*/React.createElement("h3", {
278
+ className: "condition-list-type"
279
+ }, conditionformat[allConditionFormats[key].conditionName], " ", (_a = allConditionFormats[key].conditionValue) === null || _a === void 0 ? void 0 : _a[0]), /*#__PURE__*/React.createElement("p", {
280
+ className: "condition-list-range"
281
+ }, (_b = allConditionFormats[key].cellrange) === null || _b === void 0 ? void 0 : _b.map(function (range) {
282
+ var startCol = numberToColumn(range.column[0] + 1);
283
+ var endCol = numberToColumn(range.column[1] + 1);
284
+ var startRow = range.row[0] + 1;
285
+ var endRow = range.row[1] + 1;
286
+ return "".concat(startCol).concat(startRow, ":").concat(endCol).concat(endRow);
287
+ }).join(", "))), /*#__PURE__*/React.createElement("div", {
288
+ className: "opacity-0 group-hover:opacity-100 transition-opacity"
289
+ }, /*#__PURE__*/React.createElement(IconButton, {
290
+ elevation: 1,
291
+ icon: "Trash2",
292
+ size: "md",
293
+ variant: "secondary",
294
+ style: {
295
+ border: "0px",
296
+ boxShadow: "none",
297
+ color: "hsl(var(--color-icon-secondary))"
298
+ },
299
+ onClick: function onClick() {
300
+ setContext(function (ctx) {
301
+ var index = getSheetIndex(ctx, ctx.currentSheetId);
302
+ var ruleArr = ctx.luckysheetfile[index].luckysheet_conditionformat_save || [];
303
+ console.log(matchedConditionFormatKey, ruleArr, allConditionFormats);
304
+ ruleArr.splice(Number(key), 1);
305
+ ctx.luckysheetfile[index].luckysheet_conditionformat_save = ruleArr;
306
+ return ctx;
307
+ });
308
+ }
309
+ })));
310
+ })), /*#__PURE__*/React.createElement(Button, {
311
+ size: "md",
312
+ variant: "secondary",
313
+ onClick: function onClick() {
314
+ setCreate(true);
315
+ buttonClickCreateRef.current = true;
316
+ }
317
+ }, "Create New Condition Format"))) : (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
111
318
  className: "flex flex-col"
112
319
  }, /*#__PURE__*/React.createElement("div", {
113
320
  className: "condition-rules-value text-heading-xsm"
114
- }, conditionformat["conditionformat_".concat(titleType, "_title")]), (type === "greaterThan" || type === "greaterThanOrEqual" || type === "lessThan" || type === "lessThanOrEqual" || type === "equal" || type === "textContains") && (/*#__PURE__*/React.createElement("div", {
321
+ }, conditionformat.applyRange, " range"), /*#__PURE__*/React.createElement(TextField, {
322
+ rightIcon: /*#__PURE__*/React.createElement(LucideIcon, {
323
+ name: "Grid2x2",
324
+ size: "sm",
325
+ onClick: function onClick() {
326
+ dataSelectRange("conditionRules".concat(type));
327
+ }
328
+ }),
329
+ "aria-hidden": "true",
330
+ readOnly: true,
331
+ placeholder: conditionformat.selectRange,
332
+ value: getDisplayedRangeTxt(context),
333
+ onClick: function onClick() {
334
+ dataSelectRange("conditionRules".concat(type));
335
+ }
336
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
337
+ className: "condition-rules-value text-heading-xsm"
338
+ }, "Format cells if"), /*#__PURE__*/React.createElement(Select, {
339
+ value: type,
340
+ onValueChange: function onValueChange(value) {
341
+ setType(value);
342
+ }
343
+ }, /*#__PURE__*/React.createElement(SelectTrigger, null, /*#__PURE__*/React.createElement(SelectValue, null, /*#__PURE__*/React.createElement("div", {
344
+ className: "flex items-center gap-2"
345
+ }, /*#__PURE__*/React.createElement("span", null, conditionformat[type])))), /*#__PURE__*/React.createElement(SelectContent, {
346
+ position: "popper",
347
+ side: "bottom",
348
+ align: "start",
349
+ sideOffset: 4,
350
+ className: "z-[100]",
351
+ "data-dropdown-content": "true"
352
+ }, conditionList.map(function (option) {
353
+ return /*#__PURE__*/React.createElement(SelectItem, {
354
+ key: option.value,
355
+ value: option.text
356
+ }, /*#__PURE__*/React.createElement("div", {
357
+ className: "flex items-center gap-2"
358
+ }, /*#__PURE__*/React.createElement("span", null, conditionformat[option.text])));
359
+ })))), !["aboveAverage", "belowAverage"].includes(type) && (/*#__PURE__*/React.createElement("div", {
360
+ className: "flex flex-col"
361
+ }, (type === "greaterThan" || type === "greaterThanOrEqual" || type === "lessThan" || type === "lessThanOrEqual" || type === "equal" || type === "textContains") && (/*#__PURE__*/React.createElement("div", {
115
362
  className: "w-full"
116
363
  }, /*#__PURE__*/React.createElement(TextField, {
364
+ placeholder: "Value",
365
+ onKeyDown: function onKeyDown(e) {
366
+ e.stopPropagation();
367
+ },
117
368
  value: context.conditionRules.rulesValue,
118
369
  onChange: function onChange(e) {
119
370
  var value = e.target.value;
@@ -126,6 +377,9 @@ var ConditionRules = function ConditionRules(_a) {
126
377
  }, /*#__PURE__*/React.createElement("div", {
127
378
  className: "w-full"
128
379
  }, /*#__PURE__*/React.createElement(TextField, {
380
+ onKeyDown: function onKeyDown(e) {
381
+ e.stopPropagation();
382
+ },
129
383
  placeholder: "From",
130
384
  value: context.conditionRules.betweenValue.value1,
131
385
  onChange: function onChange(e) {
@@ -137,6 +391,9 @@ var ConditionRules = function ConditionRules(_a) {
137
391
  })), /*#__PURE__*/React.createElement("div", {
138
392
  className: "w-full"
139
393
  }, /*#__PURE__*/React.createElement(TextField, {
394
+ onKeyDown: function onKeyDown(e) {
395
+ e.stopPropagation();
396
+ },
140
397
  placeholder: "To",
141
398
  value: context.conditionRules.betweenValue.value2,
142
399
  onChange: function onChange(e) {
@@ -188,6 +445,10 @@ var ConditionRules = function ConditionRules(_a) {
188
445
  });
189
446
  }
190
447
  }), /*#__PURE__*/React.createElement(TextField, {
448
+ placeholder: "Value",
449
+ onKeyDown: function onKeyDown(e) {
450
+ e.stopPropagation();
451
+ },
191
452
  className: "condition-rules-project-input pr-0",
192
453
  type: "number",
193
454
  min: 1,
@@ -217,48 +478,124 @@ var ConditionRules = function ConditionRules(_a) {
217
478
  }
218
479
  })))))), /*#__PURE__*/React.createElement("div", {
219
480
  className: "flex flex-col"
220
- }, /*#__PURE__*/React.createElement("div", {
221
- className: "condition-rules-value text-heading-xsm"
222
- }, conditionformat.applyRange), /*#__PURE__*/React.createElement(TextField, {
223
- rightIcon: /*#__PURE__*/React.createElement(LucideIcon, {
224
- name: "Grid2x2",
225
- size: "sm",
226
- onClick: function onClick() {
227
- dataSelectRange("conditionRules".concat(type));
228
- }
229
- }),
230
- "aria-hidden": "true",
231
- readOnly: true,
232
- placeholder: conditionformat.selectRange,
233
- value: getDisplayedRangeTxt(context),
234
- onClick: function onClick() {
235
- dataSelectRange("conditionRules".concat(type));
236
- }
237
- })), /*#__PURE__*/React.createElement("div", {
238
- className: "flex flex-col"
239
481
  }, /*#__PURE__*/React.createElement("div", {
240
482
  className: "condition-rules-set-title text-heading-xsm"
241
- }, "".concat(conditionformat.setAs, "\uFF1A")), /*#__PURE__*/React.createElement("div", {
242
- className: "condition-rules-setbox"
483
+ }, "Formatting styles"), /*#__PURE__*/React.createElement("div", {
484
+ className: "toolbar-container"
243
485
  }, /*#__PURE__*/React.createElement("div", {
244
- className: "condition-rules-set"
486
+ className: "toolbar-header"
487
+ }, /*#__PURE__*/React.createElement("h2", {
488
+ className: "toolbar-title"
489
+ }, "Formatting styles preview")), /*#__PURE__*/React.createElement("div", {
490
+ className: "toolbar-content"
491
+ }, /*#__PURE__*/React.createElement(Button, {
492
+ variant: "ghost",
493
+ onClick: function onClick() {
494
+ return setBold(!bold);
495
+ },
496
+ className: cn("fortune-toolbar-combo-button !min-w-fit !px-0", {}),
497
+ style: {
498
+ width: 30,
499
+ height: 30,
500
+ backgroundColor: bold ? "hsl(var(--color-bg-default-selected))" : ""
501
+ }
502
+ }, /*#__PURE__*/React.createElement(LucideIcon, {
503
+ name: "Bold",
504
+ style: {
505
+ width: "16px",
506
+ height: "16px"
507
+ }
508
+ })), /*#__PURE__*/React.createElement(Button, {
509
+ variant: "ghost",
510
+ onClick: function onClick() {
511
+ return setItalic(!italic);
512
+ },
513
+ className: cn("fortune-toolbar-combo-button !min-w-fit !px-0", {}),
514
+ style: {
515
+ width: 30,
516
+ height: 30,
517
+ backgroundColor: italic ? "hsl(var(--color-bg-default-selected))" : ""
518
+ }
519
+ }, /*#__PURE__*/React.createElement(LucideIcon, {
520
+ name: "Italic",
521
+ style: {
522
+ width: "16px",
523
+ height: "16px"
524
+ }
525
+ })), /*#__PURE__*/React.createElement(Button, {
526
+ variant: "ghost",
527
+ onClick: function onClick() {
528
+ return setUnderline(!underline);
529
+ },
530
+ className: cn("fortune-toolbar-combo-button !min-w-fit !px-0", {}),
531
+ style: {
532
+ width: 30,
533
+ height: 30,
534
+ backgroundColor: underline ? "hsl(var(--color-bg-default-selected))" : ""
535
+ }
536
+ }, /*#__PURE__*/React.createElement(LucideIcon, {
537
+ name: "Underline",
538
+ style: {
539
+ width: "16px",
540
+ height: "16px"
541
+ }
542
+ })), /*#__PURE__*/React.createElement(Button, {
543
+ variant: "ghost",
544
+ onClick: function onClick() {
545
+ return setStrikethrough(!strikethrough);
546
+ },
547
+ className: cn("fortune-toolbar-combo-button !min-w-fit !px-0", {}),
548
+ style: {
549
+ width: 30,
550
+ height: 30
551
+ }
552
+ }, /*#__PURE__*/React.createElement(LucideIcon, {
553
+ name: "Strikethrough",
554
+ style: {
555
+ width: "16px",
556
+ height: "16px"
557
+ }
558
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
559
+ onClick: function onClick() {
560
+ var _a;
561
+ (_a = textColorInputRef.current) === null || _a === void 0 ? void 0 : _a.click();
562
+ },
563
+ variant: "ghost",
564
+ className: cn("fortune-toolbar-combo-button !min-w-fit !px-0", {}),
565
+ style: {
566
+ width: 30,
567
+ height: 30
568
+ }
245
569
  }, /*#__PURE__*/React.createElement("div", {
246
- className: "condition-rules-color"
247
- }, /*#__PURE__*/React.createElement("span", {
248
- id: "checkTextColor"
249
- }, /*#__PURE__*/React.createElement(Checkbox, {
250
- className: "border-2",
251
- checked: context.conditionRules.textColor.check,
252
- onCheckedChange: function onCheckedChange(e) {
253
- var checked = e.target.checked;
254
- setContext(function (ctx) {
255
- ctx.conditionRules.textColor.check = checked;
256
- });
570
+ style: {
571
+ display: "flex",
572
+ flexDirection: "column",
573
+ alignItems: "center"
257
574
  }
258
- })), /*#__PURE__*/React.createElement("label", {
259
- htmlFor: "checkTextColor",
260
- className: "condition-rules-label"
261
- }, conditionformat.textColor), /*#__PURE__*/React.createElement("input", {
575
+ }, /*#__PURE__*/React.createElement("svg", {
576
+ style: {
577
+ width: "19px",
578
+ height: "19px"
579
+ },
580
+ xmlns: "http://www.w3.org/2000/svg",
581
+ width: "24",
582
+ height: "24",
583
+ viewBox: "0 0 24 24",
584
+ fill: "none",
585
+ stroke: "currentColor",
586
+ strokeWidth: "2",
587
+ strokeLinecap: "round",
588
+ strokeLinejoin: "round",
589
+ className: "lucide lucide-spell-check2-icon lucide-spell-check-2"
590
+ }, /*#__PURE__*/React.createElement("path", {
591
+ d: "m5 18 6-12 6 12"
592
+ }), /*#__PURE__*/React.createElement("path", {
593
+ d: "M7 14h8"
594
+ })), /*#__PURE__*/React.createElement("input", {
595
+ ref: textColorInputRef,
596
+ style: {
597
+ marginBottom: "4px"
598
+ },
262
599
  type: "color",
263
600
  className: "condition-rules-select-color",
264
601
  value: colorRules.textColor,
@@ -268,25 +605,30 @@ var ConditionRules = function ConditionRules(_a) {
268
605
  draft.textColor = value;
269
606
  }));
270
607
  }
271
- }))), /*#__PURE__*/React.createElement("div", {
272
- className: "condition-rules-set"
608
+ })))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
609
+ variant: "ghost",
610
+ onClick: function onClick() {
611
+ var _a;
612
+ (_a = cellColorInputRef.current) === null || _a === void 0 ? void 0 : _a.click();
613
+ },
614
+ className: cn("fortune-toolbar-combo-button !min-w-fit !px-0", {}),
615
+ style: {
616
+ width: 30,
617
+ height: 30
618
+ }
273
619
  }, /*#__PURE__*/React.createElement("div", {
274
- className: "condition-rules-color"
275
- }, /*#__PURE__*/React.createElement("span", {
276
- id: "checkCellColor"
277
- }, /*#__PURE__*/React.createElement(Checkbox, {
278
- className: "border-2",
279
- checked: context.conditionRules.cellColor.check,
280
- onCheckedChange: function onCheckedChange(e) {
281
- var checked = e.target.checked;
282
- setContext(function (ctx) {
283
- ctx.conditionRules.cellColor.check = checked;
284
- });
620
+ style: {
621
+ display: "flex",
622
+ flexDirection: "column"
623
+ }
624
+ }, /*#__PURE__*/React.createElement(LucideIcon, {
625
+ name: "PaintBucket",
626
+ style: {
627
+ width: "16px",
628
+ height: "16px"
285
629
  }
286
- })), /*#__PURE__*/React.createElement("label", {
287
- htmlFor: "checkCellColor",
288
- className: "condition-rules-label"
289
- }, conditionformat.cellColor), /*#__PURE__*/React.createElement("input", {
630
+ }), /*#__PURE__*/React.createElement("input", {
631
+ ref: cellColorInputRef,
290
632
  type: "color",
291
633
  className: "condition-rules-select-color",
292
634
  value: colorRules.cellColor,
@@ -296,10 +638,11 @@ var ConditionRules = function ConditionRules(_a) {
296
638
  draft.cellColor = value;
297
639
  }));
298
640
  }
299
- }))))), /*#__PURE__*/React.createElement(Divider, {
300
- className: "w-full border-t-[1px]"
301
- }), /*#__PURE__*/React.createElement("div", {
302
- className: "flex gap-2 justify-end"
641
+ }))))))), /*#__PURE__*/React.createElement("div", {
642
+ className: "flex gap-2 justify-end",
643
+ style: {
644
+ marginTop: "8px"
645
+ }
303
646
  }, /*#__PURE__*/React.createElement(Button, {
304
647
  variant: "secondary",
305
648
  style: {
@@ -318,6 +661,6 @@ var ConditionRules = function ConditionRules(_a) {
318
661
  close("confirm");
319
662
  },
320
663
  tabIndex: 0
321
- }, button.apply)));
664
+ }, "Create rule")))));
322
665
  };
323
666
  export default ConditionRules;