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