@fileverse-dev/fortune-react 1.2.97 → 1.2.98-play

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 (29) hide show
  1. package/es/components/ConditionFormat/ConditionRules.js +20 -9
  2. package/es/components/DataVerification/RangeDialog.js +19 -8
  3. package/es/components/Dialog/index.css +37 -0
  4. package/es/components/Dialog/index.js +24 -10
  5. package/es/components/ErrorState/index.js +6 -3
  6. package/es/components/LinkEidtCard/index.js +21 -12
  7. package/es/components/Sheet/use-smooth-scroll.js +145 -0
  8. package/es/components/SheetOverlay/FormulaHint/index.js +48 -33
  9. package/es/components/SheetTab/SheetItem.js +29 -16
  10. package/es/components/SheetTab/index.js +35 -20
  11. package/es/components/Toolbar/Button.js +10 -3
  12. package/es/components/Toolbar/Combo.js +10 -2
  13. package/es/components/Toolbar/CustomButton.js +12 -3
  14. package/es/components/Toolbar/Select.js +7 -1
  15. package/lib/components/ConditionFormat/ConditionRules.js +20 -9
  16. package/lib/components/DataVerification/RangeDialog.js +19 -8
  17. package/lib/components/Dialog/index.css +37 -0
  18. package/lib/components/Dialog/index.js +24 -10
  19. package/lib/components/ErrorState/index.js +6 -3
  20. package/lib/components/LinkEidtCard/index.js +21 -12
  21. package/lib/components/Sheet/use-smooth-scroll.js +145 -0
  22. package/lib/components/SheetOverlay/FormulaHint/index.js +48 -33
  23. package/lib/components/SheetTab/SheetItem.js +29 -16
  24. package/lib/components/SheetTab/index.js +35 -20
  25. package/lib/components/Toolbar/Button.js +10 -3
  26. package/lib/components/Toolbar/Combo.js +10 -2
  27. package/lib/components/Toolbar/CustomButton.js +12 -3
  28. package/lib/components/Toolbar/Select.js +7 -1
  29. package/package.json +2 -2
@@ -15,7 +15,7 @@ import WorkbookContext from "../../../context";
15
15
  import "./index.css";
16
16
  import { DraggableDiv } from "./dragable-div";
17
17
  var FormulaHint = function FormulaHint(props) {
18
- var _a;
18
+ var _a, _b, _c;
19
19
  var showFormulaHint = props.showFormulaHint,
20
20
  handleShowFormulaHint = props.handleShowFormulaHint,
21
21
  commaCount = props.commaCount,
@@ -25,19 +25,19 @@ var FormulaHint = function FormulaHint(props) {
25
25
  var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
26
26
  var formulaMore = locale(context).formulaMore;
27
27
  var fn = functionName ? context.formulaCache.functionlistMap[functionName] : context.formulaCache.functionlistMap[(context === null || context === void 0 ? void 0 : context.functionHint) || ""];
28
- var _b = useState(localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY)),
29
- API_KEY = _b[0],
30
- setAPI_KEY = _b[1];
31
- var _c = useState(!API_KEY),
32
- showAPInput = _c[0],
33
- setShowAPInput = _c[1];
34
- var _d = useState(!!localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY)),
35
- isKeyAdded = _d[0],
36
- setApiKeyAdded = _d[1];
28
+ var _d = useState(localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY)),
29
+ API_KEY = _d[0],
30
+ setAPI_KEY = _d[1];
31
+ var _e = useState(!API_KEY),
32
+ showAPInput = _e[0],
33
+ setShowAPInput = _e[1];
34
+ var _f = useState(!!localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY)),
35
+ isKeyAdded = _f[0],
36
+ setApiKeyAdded = _f[1];
37
37
  var formulaExpand = localStorage.getItem("formula-expand") === "true";
38
- var _e = useState(formulaExpand),
39
- showFunctionBody = _e[0],
40
- setShouldShowFunctionBody = _e[1];
38
+ var _g = useState(formulaExpand),
39
+ showFunctionBody = _g[0],
40
+ setShouldShowFunctionBody = _g[1];
41
41
  useEffect(function () {
42
42
  if (fn) {
43
43
  setApiKeyAdded(!!localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY));
@@ -49,12 +49,12 @@ var FormulaHint = function FormulaHint(props) {
49
49
  ETHERSCAN_API_KEY: "Etherscan API key"
50
50
  };
51
51
  var hintRef = useRef(null);
52
- var _f = useState(0),
53
- top = _f[0],
54
- setTop = _f[1];
55
- var _g = useState(false),
56
- showDelayedHint = _g[0],
57
- setShowDelayedHint = _g[1];
52
+ var _h = useState(0),
53
+ top = _h[0],
54
+ setTop = _h[1];
55
+ var _j = useState(false),
56
+ showDelayedHint = _j[0],
57
+ setShowDelayedHint = _j[1];
58
58
  var calcuatePopUpPlacement = function calcuatePopUpPlacement() {
59
59
  var _a, _b, _c, _d, _e, _f;
60
60
  if (!((_a = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.top) === null || _a === void 0 ? void 0 : _a.toString()) || !((_b = firstSelection.height_move) === null || _b === void 0 ? void 0 : _b.toString()) || !hintRef.current) return;
@@ -94,6 +94,7 @@ var FormulaHint = function FormulaHint(props) {
94
94
  }
95
95
  }, [top]);
96
96
  if (!fn) return null;
97
+ var fnNameClass = fn.n ? String(fn.n).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-") : "";
97
98
  return /*#__PURE__*/React.createElement(DraggableDiv, {
98
99
  initialTop: top,
99
100
  dragHasMoved: dragHasMoved,
@@ -110,7 +111,7 @@ var FormulaHint = function FormulaHint(props) {
110
111
  }
111
112
  }, /*#__PURE__*/React.createElement("button", {
112
113
  type: "button",
113
- className: "flex items-center justify-center w-4 h-4 rounded-full",
114
+ className: "fortune-formula-hint__icon fortune-formula-hint__action flex items-center justify-center w-4 h-4 rounded-full",
114
115
  style: {
115
116
  backgroundColor: "black",
116
117
  zIndex: 2000,
@@ -121,7 +122,8 @@ var FormulaHint = function FormulaHint(props) {
121
122
  color: "white"
122
123
  },
123
124
  onClick: handleShowFormulaHint,
124
- "aria-label": "Close formula hint"
125
+ "aria-label": "Close formula hint",
126
+ "data-testid": "formula-hint-icon-close"
125
127
  }, /*#__PURE__*/React.createElement("svg", {
126
128
  xmlns: "http://www.w3.org/2000/svg",
127
129
  width: "20",
@@ -140,7 +142,9 @@ var FormulaHint = function FormulaHint(props) {
140
142
  })))), /*#__PURE__*/React.createElement("div", __assign({}, props, {
141
143
  ref: hintRef,
142
144
  id: "luckysheet-formula-help-c",
143
- className: "luckysheet-formula-help-c",
145
+ className: "fortune-formula-hint fortune-formula-hint--".concat(fnNameClass || "unknown", " luckysheet-formula-help-c"),
146
+ "data-function-name": (_b = fn.n) !== null && _b !== void 0 ? _b : undefined,
147
+ "data-testid": "formula-hint-".concat((_c = fn.n) !== null && _c !== void 0 ? _c : "unknown"),
144
148
  style: {
145
149
  top: "0px",
146
150
  left: "0px",
@@ -151,14 +155,16 @@ var FormulaHint = function FormulaHint(props) {
151
155
  padding: "0px"
152
156
  }
153
157
  }), /*#__PURE__*/React.createElement("div", {
154
- className: "luckysheet-formula-help-close",
155
- title: "\u5173\u95ED"
158
+ className: "fortune-formula-hint__icon fortune-formula-help-close",
159
+ title: "\u5173\u95ED",
160
+ "data-testid": "formula-hint-icon-close-legacy"
156
161
  }, /*#__PURE__*/React.createElement("i", {
157
162
  className: "fa fa-times",
158
163
  "aria-hidden": "true"
159
164
  })), /*#__PURE__*/React.createElement("div", {
160
- className: "luckysheet-formula-help-collapse",
161
- title: "\u6536\u8D77"
165
+ className: "fortune-formula-hint__icon fortune-formula-help-collapse",
166
+ title: "\u6536\u8D77",
167
+ "data-testid": "formula-hint-icon-collapse"
162
168
  }, /*#__PURE__*/React.createElement("i", {
163
169
  className: "fa fa-angle-up",
164
170
  "aria-hidden": "true"
@@ -173,8 +179,9 @@ var FormulaHint = function FormulaHint(props) {
173
179
  }
174
180
  dragHasMoved.current = false;
175
181
  },
176
- className: "flex !cursor-grab active:cursor-grabbing items-start justify-between",
182
+ className: "fortune-formula-hint__heading flex !cursor-grab active:cursor-grabbing items-start justify-between",
177
183
  id: "luckysheet-formula-help-title",
184
+ "data-testid": "formula-hint-heading",
178
185
  style: {
179
186
  backgroundColor: "".concat(fn.BRAND_COLOR ? fn.BRAND_COLOR : "#F8F9FA"),
180
187
  padding: "10px",
@@ -183,7 +190,8 @@ var FormulaHint = function FormulaHint(props) {
183
190
  userSelect: "none"
184
191
  }
185
192
  }, /*#__PURE__*/React.createElement("div", {
186
- className: " flex-grow color-text-default"
193
+ className: "fortune-formula-hint__para flex-grow color-text-default",
194
+ "data-testid": "formula-hint-para"
187
195
  }, /*#__PURE__*/React.createElement("code", {
188
196
  style: {
189
197
  fontWeight: "bold"
@@ -285,12 +293,14 @@ var FormulaHint = function FormulaHint(props) {
285
293
  },
286
294
  onClick: function onClick() {
287
295
  return setShowAPInput(!showAPInput);
288
- }
296
+ },
297
+ "data-testid": "formula-hint-info-api"
289
298
  }, /*#__PURE__*/React.createElement("h3", {
290
299
  style: {
291
300
  margin: "0 0 8px 0"
292
301
  },
293
- className: "text-heading-xsm color-text-default"
302
+ className: "fortune-formula-hint__heading-sm text-heading-xsm color-text-default",
303
+ "data-testid": "formula-hint-info-heading"
294
304
  }, isKeyAdded ? "API key provided" : "API key is required"), /*#__PURE__*/React.createElement(LucideIcon, {
295
305
  name: showAPInput ? "ChevronUp" : "ChevronDown",
296
306
  width: 24,
@@ -298,11 +308,15 @@ var FormulaHint = function FormulaHint(props) {
298
308
  style: {
299
309
  cursor: "pointer"
300
310
  }
301
- })), showAPInput && (/*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", {
311
+ })), showAPInput && (/*#__PURE__*/React.createElement("div", {
312
+ className: "fortune-formula-hint__info-content",
313
+ "data-testid": "formula-hint-info-content"
314
+ }, /*#__PURE__*/React.createElement("p", {
302
315
  style: {
303
316
  margin: "0 0 16px 0"
304
317
  },
305
- className: "text-body-sm color-text-default"
318
+ className: "fortune-formula-hint__para fortune-formula-hint__para--api text-body-sm color-text-default",
319
+ "data-testid": "formula-hint-para-api"
306
320
  }, "This function requires an API key. Please paste it below and\n press 'Ok'."), /*#__PURE__*/React.createElement("div", {
307
321
  className: "w-full"
308
322
  }, /*#__PURE__*/React.createElement(TextField, {
@@ -323,7 +337,8 @@ var FormulaHint = function FormulaHint(props) {
323
337
  setShowAPInput(false);
324
338
  },
325
339
  disabled: !API_KEY,
326
- className: "min-w-[80px]"
340
+ className: "fortune-formula-hint__cta min-w-[80px]",
341
+ "data-testid": "formula-hint-cta-ok"
327
342
  }, "Ok"))))))), /*#__PURE__*/React.createElement("div", {
328
343
  style: {
329
344
  backgroundColor: "white",
@@ -4,22 +4,28 @@ import React, { useContext, useState, useEffect, useRef, useCallback } from "rea
4
4
  import WorkbookContext from "../../context";
5
5
  import { useAlert } from "../../hooks/useAlert";
6
6
  import SVGIcon from "../SVGIcon";
7
+ var toCssId = function toCssId(s) {
8
+ return String(s).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
9
+ };
7
10
  var SheetItem = function SheetItem(_a) {
11
+ var _b, _c, _d, _e;
8
12
  var sheet = _a.sheet,
9
13
  isDropPlaceholder = _a.isDropPlaceholder;
10
- var _b = useContext(WorkbookContext),
11
- context = _b.context,
12
- setContext = _b.setContext,
13
- refs = _b.refs;
14
- var _c = useState(false),
15
- editing = _c[0],
16
- setEditing = _c[1];
14
+ var _f = useContext(WorkbookContext),
15
+ context = _f.context,
16
+ setContext = _f.setContext,
17
+ refs = _f.refs;
18
+ var _g = useState(false),
19
+ editing = _g[0],
20
+ setEditing = _g[1];
17
21
  var containerRef = useRef(null);
18
22
  var editable = useRef(null);
19
- var _d = useState(false),
20
- dragOver = _d[0],
21
- setDragOver = _d[1];
23
+ var _h = useState(false),
24
+ dragOver = _h[0],
25
+ setDragOver = _h[1];
22
26
  var showAlert = useAlert().showAlert;
27
+ var sheetIdClass = sheet.id != null ? toCssId(String(sheet.id)) : "placeholder";
28
+ var sheetNameClass = sheet.name ? toCssId(sheet.name) : "";
23
29
  useEffect(function () {
24
30
  setContext(function (draftCtx) {
25
31
  var _a, _b, _c, _d;
@@ -127,7 +133,10 @@ var SheetItem = function SheetItem(_a) {
127
133
  draggable: context.allowEdit && !editing,
128
134
  key: sheet.id,
129
135
  ref: containerRef,
130
- className: isDropPlaceholder ? "fortune-sheettab-placeholder" : "luckysheet-sheets-item".concat(context.currentSheetId === sheet.id ? " luckysheet-sheets-item-active" : ""),
136
+ className: isDropPlaceholder ? "fortune-sheettab-item fortune-sheettab-placeholder" : "fortune-sheettab-item fortune-sheettab-item--".concat(sheetIdClass).concat(sheetNameClass ? " fortune-sheettab-item--name-".concat(sheetNameClass) : "", " luckysheet-sheets-item").concat(context.currentSheetId === sheet.id ? " luckysheet-sheets-item-active" : ""),
137
+ "data-sheet-id": sheet.id != null ? String(sheet.id) : undefined,
138
+ "data-sheet-name": sheet.name || undefined,
139
+ "data-testid": "sheettab-item-".concat((_b = sheet.id) !== null && _b !== void 0 ? _b : "placeholder"),
131
140
  onClick: function onClick() {
132
141
  if (isDropPlaceholder) return;
133
142
  setContext(function (draftCtx) {
@@ -171,13 +180,14 @@ var SheetItem = function SheetItem(_a) {
171
180
  display: sheet.hide === 1 ? "none" : ""
172
181
  }
173
182
  }, editing === false && (/*#__PURE__*/React.createElement("p", {
174
- className: "luckysheet-sheets-item-name",
183
+ className: "fortune-sheettab-item__para luckysheet-sheets-item-name",
175
184
  onDoubleClick: function onDoubleClick() {
176
185
  if (context.isFlvReadOnly) return;
177
186
  setEditing(true);
178
- }
187
+ },
188
+ "data-testid": "sheettab-item-para-".concat((_c = sheet.id) !== null && _c !== void 0 ? _c : "placeholder")
179
189
  }, sheet.name)), editing && (/*#__PURE__*/React.createElement("span", {
180
- className: "luckysheet-sheets-item-name",
190
+ className: "fortune-sheettab-item__para luckysheet-sheets-item-name",
181
191
  spellCheck: "false",
182
192
  suppressContentEditableWarning: true,
183
193
  contentEditable: isDropPlaceholder ? false : editing,
@@ -190,13 +200,16 @@ var SheetItem = function SheetItem(_a) {
190
200
  ref: editable,
191
201
  style: dragOver ? {
192
202
  pointerEvents: "none"
193
- } : {}
203
+ } : {},
204
+ "data-testid": "sheettab-item-para-editable-".concat((_d = sheet.id) !== null && _d !== void 0 ? _d : "placeholder")
194
205
  }, sheet.name)), /*#__PURE__*/React.createElement("span", {
195
- className: "luckysheet-sheets-item-function",
206
+ className: "fortune-sheettab-item__icon fortune-sheettab-item__action fortune-sheettab-item__icon--menu luckysheet-sheets-item-function",
196
207
  style: {
197
208
  marginRight: "4px",
198
209
  marginLeft: "4px"
199
210
  },
211
+ "data-sheet-id": sheet.id != null ? String(sheet.id) : undefined,
212
+ "data-testid": "sheettab-item-icon-menu-".concat((_e = sheet.id) !== null && _e !== void 0 ? _e : "placeholder"),
200
213
  onClick: function onClick(e) {
201
214
  if (isDropPlaceholder || context.allowEdit === false) return;
202
215
  var rect = refs.workbookContainer.current.getBoundingClientRect();
@@ -130,8 +130,9 @@ var SheetTab = function SheetTab() {
130
130
  });
131
131
  var finalStats = statsFilter.length !== 6 ? [] : statsFilter;
132
132
  return /*#__PURE__*/React.createElement("div", null, showDisclaimer && (/*#__PURE__*/React.createElement("div", {
133
- className: "w-full",
133
+ className: "fortune-sheettab__info fortune-sheettab__disclaimer w-full",
134
134
  id: "denomination-warning",
135
+ "data-testid": "sheettab-info-disclaimer",
135
136
  style: {
136
137
  zIndex: 1003,
137
138
  position: "absolute",
@@ -148,36 +149,43 @@ var SheetTab = function SheetTab() {
148
149
  }, /*#__PURE__*/React.createElement("div", {
149
150
  className: "max-w-7xl mx-auto px-4 py-1 ".concat(isMobile && "w-full flex justify-between")
150
151
  }, /*#__PURE__*/React.createElement("p", {
151
- className: "".concat(isMobile ? "text-left" : "text-center", " text-xsm")
152
+ className: "fortune-sheettab__para ".concat(isMobile ? "text-left" : "text-center", " text-xsm"),
153
+ "data-testid": "sheettab-para-disclaimer"
152
154
  }, /*#__PURE__*/React.createElement("span", {
153
155
  className: "font-medium"
154
156
  }, "Disclaimer:"), " Prices are not updated in real time and may differ slightly. Updates may be delayed by up to 20 minutes."), isMobile && (/*#__PURE__*/React.createElement("p", {
155
- className: "ml-4 content-center cursor-pointer",
157
+ className: "fortune-sheettab__action fortune-sheettab__action--close-disclaimer ml-4 content-center cursor-pointer",
156
158
  style: {
157
159
  alignContent: "center"
158
160
  },
159
- onClick: handleCloseDisclaimer
161
+ onClick: handleCloseDisclaimer,
162
+ "data-testid": "sheettab-action-close-disclaimer"
160
163
  }, "Close"))))), /*#__PURE__*/React.createElement("div", {
161
- className: "luckysheet-sheet-area luckysheet-noselected-text border-t color-border-default color-bg-secondary",
164
+ className: "fortune-sheettab luckysheet-sheet-area luckysheet-noselected-text border-t color-border-default color-bg-secondary",
162
165
  onContextMenu: function onContextMenu(e) {
163
166
  return e.preventDefault();
164
167
  },
165
- id: "luckysheet-sheet-area"
168
+ id: "luckysheet-sheet-area",
169
+ "data-testid": "sheettab"
166
170
  }, /*#__PURE__*/React.createElement("div", {
167
- id: "luckysheet-sheet-content"
171
+ id: "luckysheet-sheet-content",
172
+ className: "fortune-sheettab__content",
173
+ "data-testid": "sheettab-content"
168
174
  }, context.allowEdit && (/*#__PURE__*/React.createElement(IconButton, {
169
- className: "fortune-sheettab-button border-none shadow-none",
175
+ className: "fortune-sheettab__cta fortune-sheettab-button border-none shadow-none",
170
176
  onClick: onAddSheetClick,
171
177
  elevation: 1,
172
178
  icon: "Plus",
173
179
  size: "sm",
174
- variant: "secondary"
180
+ variant: "secondary",
181
+ "data-testid": "sheettab-cta-add-sheet"
175
182
  })), context.allowEdit && (/*#__PURE__*/React.createElement("div", {
176
183
  className: "sheet-list-container"
177
184
  }, /*#__PURE__*/React.createElement("div", {
178
185
  id: "all-sheets",
179
- className: "fortune-sheettab-button",
186
+ className: "fortune-sheettab__icon fortune-sheettab-button",
180
187
  ref: tabContainerRef,
188
+ "data-testid": "sheettab-icon-all-sheets",
181
189
  onMouseDown: function onMouseDown(e) {
182
190
  e.stopPropagation();
183
191
  setContext(function (ctx) {
@@ -186,14 +194,16 @@ var SheetTab = function SheetTab() {
186
194
  });
187
195
  }
188
196
  }, /*#__PURE__*/React.createElement(IconButton, {
189
- className: "fortune-sheettab-button border-none shadow-none",
197
+ className: "fortune-sheettab__icon fortune-sheettab-button border-none shadow-none",
190
198
  elevation: 1,
191
199
  icon: "Menu",
192
200
  size: "sm",
193
- variant: "secondary"
201
+ variant: "secondary",
202
+ "data-testid": "sheettab-icon-menu"
194
203
  })))), /*#__PURE__*/React.createElement("div", {
195
- className: "fortune-sheettab-container",
196
- id: "fortune-sheettab-container"
204
+ className: "fortune-sheettab__tabs fortune-sheettab-container",
205
+ id: "fortune-sheettab-container",
206
+ "data-testid": "sheettab-tabs"
197
207
  }, !isShowBoundary && /*#__PURE__*/React.createElement("div", {
198
208
  className: "boundary boundary-left"
199
209
  }), /*#__PURE__*/React.createElement("div", {
@@ -246,21 +256,24 @@ var SheetTab = function SheetTab() {
246
256
  })))), /*#__PURE__*/React.createElement("div", {
247
257
  className: "fortune-sheet-area-right"
248
258
  }, statsFilter.length === 6 && calInfo.count > 1 && (/*#__PURE__*/React.createElement(Popover, null, /*#__PURE__*/React.createElement(PopoverTrigger, {
249
- className: "p-0 m-0 mr-2"
259
+ className: "fortune-sheettab__info-trigger p-0 m-0 mr-2",
260
+ "data-testid": "sheettab-info-stats-trigger"
250
261
  }, /*#__PURE__*/React.createElement(Button, {
251
262
  variant: "ghost",
252
- className: "w-full !h-6 p-2 m-1 text-left flex items-center justify-center transition mr-2 !rounded-[0px]",
263
+ className: "fortune-sheettab__info fortune-sheettab__info--stats w-full !h-6 p-2 m-1 text-left flex items-center justify-center transition mr-2 !rounded-[0px]",
253
264
  style: {
254
265
  height: "24px !important"
255
- }
266
+ },
267
+ "data-testid": "sheettab-info-stats"
256
268
  }, /*#__PURE__*/React.createElement("div", {
257
269
  className: "flex items-center"
258
270
  }, /*#__PURE__*/React.createElement("p", {
259
- className: "text-body-sm",
271
+ className: "fortune-sheettab__para fortune-sheettab__para--stats text-body-sm",
260
272
  style: {
261
273
  fontWeight: "500",
262
274
  marginRight: "8px"
263
- }
275
+ },
276
+ "data-testid": "sheettab-para-stats"
264
277
  }, STATS_LABELS[selectedStat], ":", " ", calInfo[selectedStat]), /*#__PURE__*/React.createElement("svg", {
265
278
  xmlns: "http://www.w3.org/2000/svg",
266
279
  width: "18",
@@ -293,7 +306,9 @@ var SheetTab = function SheetTab() {
293
306
  return /*#__PURE__*/React.createElement(Button, {
294
307
  variant: "ghost",
295
308
  key: option.value,
296
- className: "w-full h-8 rounded p-2 m-1 text-left flex items-center justify-between transition mr-2 min-w-[50px] ".concat(selectedStat === option.value && "bg-[#F8F9FA]"),
309
+ className: "fortune-sheettab__stats-option fortune-sheettab__stats-option--".concat(option.value, " w-full h-8 rounded p-2 m-1 text-left flex items-center justify-between transition mr-2 min-w-[50px] ").concat(selectedStat === option.value && "bg-[#F8F9FA]"),
310
+ "data-stat-value": option.value,
311
+ "data-testid": "sheettab-stats-option-".concat(option.value),
297
312
  onClick: function onClick() {
298
313
  return setSelectedStat(option.value);
299
314
  }
@@ -10,18 +10,25 @@ var Button = function Button(_a) {
10
10
  children = _a.children,
11
11
  style = _a.style,
12
12
  id = _a.id;
13
+ var iconIdClass = iconId.replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
13
14
  return /*#__PURE__*/React.createElement(Tooltip, {
14
15
  text: tooltip,
15
16
  placement: "bottom"
16
17
  }, /*#__PURE__*/React.createElement("div", {
17
18
  id: id,
18
- className: "fortune-toolbar-button fortune-toolbar-item",
19
+ className: "fortune-toolbar-button fortune-toolbar-item fortune-toolbar-button__cta fortune-toolbar-button--".concat(iconIdClass),
20
+ "data-icon-id": iconId,
19
21
  onClick: onClick,
20
22
  tabIndex: 0,
21
23
  role: "button",
22
24
  style: selected ? {
23
25
  backgroundColor: "#FFDF0A"
24
- } : style
26
+ } : style,
27
+ "data-testid": "toolbar-cta-".concat(id !== null && id !== void 0 ? id : iconId)
28
+ }, /*#__PURE__*/React.createElement("span", {
29
+ className: "fortune-toolbar-button__icon fortune-toolbar-button__icon--".concat(iconIdClass),
30
+ "data-icon-id": iconId,
31
+ "data-testid": "toolbar-icon-".concat(iconId)
25
32
  }, /*#__PURE__*/React.createElement(LucideIcon, {
26
33
  name: getLucideIcon(iconId),
27
34
  width: 16,
@@ -29,6 +36,6 @@ var Button = function Button(_a) {
29
36
  style: disabled ? {
30
37
  opacity: 0.3
31
38
  } : {}
32
- }), children));
39
+ })), children));
33
40
  };
34
41
  export default Button;
@@ -2,6 +2,9 @@ import React, { useMemo, useRef, useState } from "react";
2
2
  import { IconButton, Tooltip, Popover, PopoverContent, PopoverTrigger, cn, Button, LucideIcon } from "@fileverse/ui";
3
3
  import SVGIcon from "../SVGIcon";
4
4
  import { getLucideIcon } from ".";
5
+ var toCssId = function toCssId(s) {
6
+ return String(s).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
7
+ };
5
8
  var Combo = function Combo(_a) {
6
9
  var tooltip = _a.tooltip,
7
10
  _onClick = _a.onClick,
@@ -20,6 +23,7 @@ var Combo = function Combo(_a) {
20
23
  setOpen = _c[1];
21
24
  var buttonRef = useRef(null);
22
25
  var ref = useRef(null);
26
+ var iconIdClass = iconId ? toCssId(iconId) : "combo";
23
27
  if (!triggerRef) {
24
28
  triggerRef = ref;
25
29
  }
@@ -33,7 +37,9 @@ var Combo = function Combo(_a) {
33
37
  text: tooltip,
34
38
  placement: "bottom"
35
39
  }, /*#__PURE__*/React.createElement("div", {
36
- className: "fortune-toolbar-combo-button",
40
+ className: "fortune-toolbar-combo-button fortune-toolbar-combo-button--".concat(iconIdClass),
41
+ "data-icon-id": iconId !== null && iconId !== void 0 ? iconId : undefined,
42
+ "data-testid": "toolbar-combo-".concat(iconId !== null && iconId !== void 0 ? iconId : "combo"),
37
43
  onClick: function onClick(e) {
38
44
  if (_onClick) {
39
45
  _onClick(e);
@@ -93,7 +99,9 @@ var Combo = function Combo(_a) {
93
99
  })))));
94
100
  return /*#__PURE__*/React.createElement("div", {
95
101
  ref: buttonRef,
96
- className: "fortune-toolbar-item",
102
+ className: "fortune-toolbar-item fortune-toolbar-combo fortune-toolbar-combo--".concat(iconIdClass),
103
+ "data-icon-id": iconId !== null && iconId !== void 0 ? iconId : undefined,
104
+ "data-testid": "toolbar-combo-".concat(iconId !== null && iconId !== void 0 ? iconId : "combo"),
97
105
  onKeyDown: function onKeyDown(e) {
98
106
  e.stopPropagation();
99
107
  }
@@ -1,6 +1,9 @@
1
1
  import React from "react";
2
2
  import { Tooltip } from "@fileverse/ui";
3
3
  import CustomIcon from "./CustomIcon";
4
+ var toCssId = function toCssId(s) {
5
+ return String(s).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
6
+ };
4
7
  var CustomButton = function CustomButton(_a) {
5
8
  var tooltip = _a.tooltip,
6
9
  onClick = _a.onClick,
@@ -8,22 +11,28 @@ var CustomButton = function CustomButton(_a) {
8
11
  children = _a.children,
9
12
  iconName = _a.iconName,
10
13
  icon = _a.icon;
14
+ var iconNameClass = iconName ? toCssId(iconName) : "custom";
11
15
  return /*#__PURE__*/React.createElement(Tooltip, {
12
16
  text: tooltip,
13
17
  placement: "bottom"
14
18
  }, /*#__PURE__*/React.createElement("div", {
15
- className: "fortune-toolbar-button fortune-toolbar-item",
19
+ className: "fortune-toolbar-button fortune-toolbar-item fortune-toolbar-button--".concat(iconNameClass),
20
+ "data-icon-name": iconName !== null && iconName !== void 0 ? iconName : undefined,
16
21
  onClick: onClick,
17
22
  tabIndex: 0,
18
23
  role: "button",
19
24
  style: selected ? {
20
25
  backgroundColor: "#FFDF0A"
21
- } : {}
26
+ } : {},
27
+ "data-testid": "toolbar-cta-".concat(iconName !== null && iconName !== void 0 ? iconName : "custom")
28
+ }, /*#__PURE__*/React.createElement("span", {
29
+ className: "fortune-toolbar-button__icon fortune-toolbar-button__icon--".concat(iconNameClass),
30
+ "data-icon-name": iconName !== null && iconName !== void 0 ? iconName : undefined
22
31
  }, /*#__PURE__*/React.createElement(CustomIcon, {
23
32
  width: 16,
24
33
  height: 16,
25
34
  iconName: iconName,
26
35
  content: icon
27
- }), children));
36
+ })), children));
28
37
  };
29
38
  export default CustomButton;
@@ -8,16 +8,22 @@ var Select = function Select(_a) {
8
8
  style: style
9
9
  }, children);
10
10
  };
11
+ var toCssId = function toCssId(s) {
12
+ return String(s).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
13
+ };
11
14
  var Option = function Option(_a) {
12
15
  var iconId = _a.iconId,
13
16
  onClick = _a.onClick,
14
17
  children = _a.children,
15
18
  _onMouseLeave = _a.onMouseLeave,
16
19
  _onMouseEnter = _a.onMouseEnter;
20
+ var iconIdClass = iconId ? toCssId(iconId) : "option";
17
21
  return /*#__PURE__*/React.createElement("div", {
18
22
  onClick: onClick,
19
23
  tabIndex: 0,
20
- className: "fortune-toolbar-select-option",
24
+ className: "fortune-toolbar-select-option fortune-toolbar-select-option--".concat(iconIdClass),
25
+ "data-icon-id": iconId !== null && iconId !== void 0 ? iconId : undefined,
26
+ "data-testid": "toolbar-select-option-".concat(iconId !== null && iconId !== void 0 ? iconId : "option"),
21
27
  onMouseLeave: function onMouseLeave(e) {
22
28
  return _onMouseLeave === null || _onMouseLeave === void 0 ? void 0 : _onMouseLeave(e);
23
29
  },
@@ -369,8 +369,10 @@ var ConditionRules = function ConditionRules(_a) {
369
369
  setEditConditionRange(rangeEdit);
370
370
  setEditConditionFormatValue(allConditionFormats[key].conditionValue);
371
371
  },
372
- className: "group flex items-center border-b border-gray-200 condition-list-parent",
373
- key: key
372
+ className: "group flex items-center border-b border-gray-200 condition-list-parent fortune-condition-rules__item fortune-condition-rules__item--".concat(String(key).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-")),
373
+ "data-condition-key": key,
374
+ key: key,
375
+ "data-testid": "condition-rules-item-".concat(key)
374
376
  }, /*#__PURE__*/_react.default.createElement("div", {
375
377
  className: "condition-list-pill",
376
378
  style: {
@@ -392,9 +394,11 @@ var ConditionRules = function ConditionRules(_a) {
392
394
  buttonClickCreateRef.current = true;
393
395
  }
394
396
  }, /*#__PURE__*/_react.default.createElement("h3", {
395
- className: "condition-list-type"
397
+ className: "fortune-condition-rules__heading condition-list-type",
398
+ "data-testid": "condition-rules-heading-".concat(key)
396
399
  }, conditionformat[allConditionFormats[key].conditionName], " ", (_a = allConditionFormats[key].conditionValue) === null || _a === void 0 ? void 0 : _a[0]), /*#__PURE__*/_react.default.createElement("p", {
397
- className: "condition-list-range"
400
+ className: "fortune-condition-rules__para condition-list-range",
401
+ "data-testid": "condition-rules-para-".concat(key)
398
402
  }, (_b = allConditionFormats[key].cellrange) === null || _b === void 0 ? void 0 : _b.map(function (range) {
399
403
  var startCol = (0, _helper.numberToColumn)(range.column[0] + 1);
400
404
  var endCol = (0, _helper.numberToColumn)(range.column[1] + 1);
@@ -402,12 +406,15 @@ var ConditionRules = function ConditionRules(_a) {
402
406
  var endRow = range.row[1] + 1;
403
407
  return "".concat(startCol).concat(startRow, ":").concat(endCol).concat(endRow);
404
408
  }).join(", "))), /*#__PURE__*/_react.default.createElement("div", {
405
- className: "opacity-0 group-hover:opacity-100 transition-opacity"
409
+ className: "fortune-condition-rules__icon fortune-condition-rules__action opacity-0 group-hover:opacity-100 transition-opacity",
410
+ "data-condition-key": key,
411
+ "data-testid": "condition-rules-action-delete-".concat(key)
406
412
  }, /*#__PURE__*/_react.default.createElement(_ui.IconButton, {
407
413
  elevation: 1,
408
414
  icon: "Trash2",
409
415
  size: "md",
410
416
  variant: "secondary",
417
+ className: "fortune-condition-rules__icon--trash",
411
418
  style: {
412
419
  border: "0px",
413
420
  boxShadow: "none",
@@ -428,6 +435,7 @@ var ConditionRules = function ConditionRules(_a) {
428
435
  leftIcon: "Plus",
429
436
  size: "md",
430
437
  variant: "secondary",
438
+ className: "fortune-condition-rules__cta fortune-condition-rules__cta--add",
431
439
  onClick: function onClick() {
432
440
  setType("greaterThan");
433
441
  setCreate(true);
@@ -441,11 +449,13 @@ var ConditionRules = function ConditionRules(_a) {
441
449
  });
442
450
  editKeyRef.current = null;
443
451
  buttonClickCreateRef.current = true;
444
- }
452
+ },
453
+ "data-testid": "condition-rules-cta-add"
445
454
  }, "Add another rule"))) : (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
446
- className: "flex flex-col"
455
+ className: "flex flex-col fortune-condition-rules__form"
447
456
  }, /*#__PURE__*/_react.default.createElement("div", {
448
- className: "condition-rules-value text-heading-xsm"
457
+ className: "fortune-condition-rules__info condition-rules-value text-heading-xsm",
458
+ "data-testid": "condition-rules-info-range"
449
459
  }, conditionformat.applyRange, " range"), /*#__PURE__*/_react.default.createElement(_ui.TextField, {
450
460
  rightIcon: /*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
451
461
  name: "Grid2x2",
@@ -463,7 +473,8 @@ var ConditionRules = function ConditionRules(_a) {
463
473
  dataSelectRange("conditionRules".concat(type));
464
474
  }
465
475
  })), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
466
- className: "condition-rules-value text-heading-xsm"
476
+ className: "fortune-condition-rules__heading-sm condition-rules-value text-heading-xsm",
477
+ "data-testid": "condition-rules-heading-format"
467
478
  }, "Format cells if"), /*#__PURE__*/_react.default.createElement(_ui.Select, {
468
479
  value: type,
469
480
  onValueChange: function onValueChange(value) {