@fileverse-dev/fortune-react 1.2.98 → 1.2.99

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.
@@ -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) {
@@ -47,7 +47,8 @@ var RangeDialog = function RangeDialog() {
47
47
  }, [context, context.luckysheet_select_save]);
48
48
  return /*#__PURE__*/_react.default.createElement("div", {
49
49
  id: "range-dialog",
50
- className: "fortune-dialog",
50
+ className: "fortune-dialog fortune-range-dialog",
51
+ "data-testid": "range-dialog",
51
52
  onClick: function onClick(e) {
52
53
  return e.stopPropagation();
53
54
  },
@@ -65,32 +66,41 @@ var RangeDialog = function RangeDialog() {
65
66
  },
66
67
  tabIndex: 0
67
68
  }, /*#__PURE__*/_react.default.createElement("div", {
68
- className: (0, _ui.cn)("flex items-center justify-between border-b color-border-default py-3 px-6")
69
+ className: (0, _ui.cn)("fortune-range-dialog__header flex items-center justify-between border-b color-border-default py-3 px-6"),
70
+ "data-testid": "range-dialog-header"
69
71
  }, /*#__PURE__*/_react.default.createElement("div", {
70
- className: "text-heading-sm"
72
+ className: "fortune-range-dialog__heading text-heading-sm",
73
+ "data-testid": "range-dialog-heading"
71
74
  }, dataVerification.selectCellRange), /*#__PURE__*/_react.default.createElement(_ui.IconButton, {
72
75
  icon: "X",
73
76
  variant: "ghost",
74
77
  onClick: close,
75
- tabIndex: 0
78
+ tabIndex: 0,
79
+ className: "fortune-range-dialog__icon fortune-range-dialog__icon--close",
80
+ "data-testid": "range-dialog-icon-close"
76
81
  })), /*#__PURE__*/_react.default.createElement("div", {
77
- className: "px-6 pb-6 pt-4 text-body-sm"
82
+ className: "fortune-range-dialog__para px-6 pb-6 pt-4 text-body-sm",
83
+ "data-testid": "range-dialog-para"
78
84
  }, /*#__PURE__*/_react.default.createElement(_ui.TextField, {
79
85
  className: "w-full",
80
86
  readOnly: true,
81
87
  placeholder: dataVerification.selectCellRange2,
82
88
  value: rangeTxt2
83
89
  })), /*#__PURE__*/_react.default.createElement("div", {
84
- className: "px-6 pb-6 flex flex-row gap-2 justify-end"
90
+ className: "fortune-range-dialog__actions px-6 pb-6 flex flex-row gap-2 justify-end",
91
+ "data-testid": "range-dialog-actions"
85
92
  }, /*#__PURE__*/_react.default.createElement(_ui.Button, {
86
93
  variant: "secondary",
94
+ className: "fortune-range-dialog__cta fortune-range-dialog__cta--close",
87
95
  style: {
88
96
  minWidth: "80px"
89
97
  },
90
98
  onClick: close,
91
- tabIndex: 0
99
+ tabIndex: 0,
100
+ "data-testid": "range-dialog-cta-close"
92
101
  }, button.close), /*#__PURE__*/_react.default.createElement(_ui.Button, {
93
102
  variant: "default",
103
+ className: "fortune-range-dialog__cta fortune-range-dialog__cta--confirm",
94
104
  style: {
95
105
  minWidth: "80px"
96
106
  },
@@ -100,7 +110,8 @@ var RangeDialog = function RangeDialog() {
100
110
  });
101
111
  close();
102
112
  },
103
- tabIndex: 0
113
+ tabIndex: 0,
114
+ "data-testid": "range-dialog-cta-confirm"
104
115
  }, button.confirm)));
105
116
  };
106
117
  var _default = exports.default = RangeDialog;
@@ -9,6 +9,43 @@
9
9
  overflow: auto;
10
10
  }
11
11
 
12
+ /* BEM selectors for testing and styling */
13
+ .fortune-dialog__header {
14
+ /* header container */
15
+ }
16
+
17
+ .fortune-dialog__heading {
18
+ /* dialog title */
19
+ }
20
+
21
+ .fortune-dialog__para {
22
+ /* dialog body content */
23
+ }
24
+
25
+ .fortune-dialog__icon {
26
+ /* icon in header (e.g. close) */
27
+ }
28
+
29
+ .fortune-dialog__icon--close {
30
+ /* close button icon */
31
+ }
32
+
33
+ .fortune-dialog__actions {
34
+ /* footer action container */
35
+ }
36
+
37
+ .fortune-dialog__cta {
38
+ /* primary/secondary action button */
39
+ }
40
+
41
+ .fortune-dialog__cta--cancel {
42
+ /* cancel button */
43
+ }
44
+
45
+ .fortune-dialog__cta--confirm {
46
+ /* confirm/ok button */
47
+ }
48
+
12
49
  .fortune-dialog-box-button-container {
13
50
  display: flex;
14
51
  align-items: center;
@@ -36,46 +36,60 @@ var Dialog = function Dialog(_a) {
36
36
  var button = (0, _fortuneCore.locale)(context).button;
37
37
  return /*#__PURE__*/_react.default.createElement("div", {
38
38
  className: "fortune-dialog",
39
+ "data-testid": "dialog",
39
40
  style: __assign(__assign({}, containerStyle), ["Data validation", "Split text to columns", "Resize column"].includes(title) ? {
40
41
  maxWidth: "unset"
41
42
  } : {})
42
43
  }, /*#__PURE__*/_react.default.createElement("div", {
43
- className: (0, _ui.cn)("flex items-center justify-between border-b color-border-default py-3 px-6")
44
+ className: (0, _ui.cn)("fortune-dialog__header flex items-center justify-between border-b color-border-default py-3 px-6"),
45
+ "data-testid": "dialog-header"
44
46
  }, title ? (/*#__PURE__*/_react.default.createElement("div", {
45
- className: "text-heading-sm"
47
+ className: "fortune-dialog__heading text-heading-sm",
48
+ "data-testid": "dialog-heading"
46
49
  }, title)) : (/*#__PURE__*/_react.default.createElement("div", {
47
- className: "text-heading-sm"
50
+ className: "fortune-dialog__heading text-heading-sm",
51
+ "data-testid": "dialog-heading"
48
52
  }, "Oops! Something went wrong")), /*#__PURE__*/_react.default.createElement(_ui.IconButton, {
49
53
  icon: "X",
50
54
  variant: "ghost",
51
55
  onClick: onCancel,
52
- tabIndex: 0
56
+ tabIndex: 0,
57
+ className: "fortune-dialog__icon fortune-dialog__icon--close",
58
+ "data-testid": "dialog-icon-close"
53
59
  })), /*#__PURE__*/_react.default.createElement("div", {
54
- className: "px-6 pb-6 pt-4 text-body-sm",
55
- style: contentStyle
60
+ className: "fortune-dialog__para px-6 pb-6 pt-4 text-body-sm",
61
+ style: contentStyle,
62
+ "data-testid": "dialog-para"
56
63
  }, children), type != null && (/*#__PURE__*/_react.default.createElement("div", {
57
- className: "px-6 pb-6 flex flex-row gap-2 justify-end"
64
+ className: "fortune-dialog__actions px-6 pb-6 flex flex-row gap-2 justify-end",
65
+ "data-testid": "dialog-actions"
58
66
  }, type === "ok" ? (/*#__PURE__*/_react.default.createElement(_ui.Button, {
59
67
  variant: "default",
68
+ className: "fortune-dialog__cta fortune-dialog__cta--confirm",
60
69
  style: {
61
70
  minWidth: "80px"
62
71
  },
63
72
  onClick: onOk,
64
- tabIndex: 0
73
+ tabIndex: 0,
74
+ "data-testid": "dialog-cta-confirm"
65
75
  }, okLabel || button.confirm)) : (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ui.Button, {
66
76
  variant: "secondary",
77
+ className: "fortune-dialog__cta fortune-dialog__cta--cancel",
67
78
  style: {
68
79
  minWidth: "80px"
69
80
  },
70
81
  onClick: onCancel,
71
- tabIndex: 0
82
+ tabIndex: 0,
83
+ "data-testid": "dialog-cta-cancel"
72
84
  }, cancelLabel || button.cancel), /*#__PURE__*/_react.default.createElement(_ui.Button, {
73
85
  variant: "default",
86
+ className: "fortune-dialog__cta fortune-dialog__cta--confirm",
74
87
  style: {
75
88
  minWidth: "80px"
76
89
  },
77
90
  onClick: onOk,
78
- tabIndex: 0
91
+ tabIndex: 0,
92
+ "data-testid": "dialog-cta-confirm"
79
93
  }, okLabel || button.confirm))))));
80
94
  };
81
95
  var _default = exports.default = Dialog;
@@ -31,11 +31,14 @@ var ErrorBoxes = function ErrorBoxes() {
31
31
  zIndex: 100,
32
32
  borderRadius: "4px"
33
33
  },
34
- className: "shadow-lg flex flex-col gap-2 break-all"
34
+ className: "fortune-error-state shadow-lg flex flex-col gap-2 break-all",
35
+ "data-testid": "error-state"
35
36
  }, /*#__PURE__*/_react.default.createElement("h3", {
36
- className: "text-heading-xsm color-text-danger"
37
+ className: "fortune-error-state__heading text-heading-xsm color-text-danger",
38
+ "data-testid": "error-state-heading"
37
39
  }, title), /*#__PURE__*/_react.default.createElement("div", {
38
- className: "color-text-default text-body-sm"
40
+ className: "fortune-error-state__para color-text-default text-body-sm",
41
+ "data-testid": "error-state-para"
39
42
  }, message));
40
43
  };
41
44
  var _default = exports.default = ErrorBoxes;
@@ -105,10 +105,13 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
105
105
  };
106
106
  }, [refs.globalCache, isButtonDisabled]);
107
107
  var renderToolbarButton = (0, _react.useCallback)(function (iconId, onClick) {
108
+ var iconIdClass = iconId.replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
108
109
  return /*#__PURE__*/_react.default.createElement("div", {
109
- className: "fortune-toolbar-button",
110
+ className: "fortune-link-card__icon fortune-link-card__action fortune-link-card__action--".concat(iconIdClass, " fortune-toolbar-button"),
111
+ "data-icon-id": iconId,
110
112
  onClick: onClick,
111
- tabIndex: 0
113
+ tabIndex: 0,
114
+ "data-testid": "link-card-action-".concat(iconId)
112
115
  }, /*#__PURE__*/_react.default.createElement(_SVGIcon.default, {
113
116
  name: iconId,
114
117
  style: {
@@ -161,19 +164,21 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
161
164
  onKeyDown: function onKeyDown(e) {
162
165
  e.stopPropagation();
163
166
  },
164
- className: "fortune-link-modify-modal link-toolbar",
167
+ className: "fortune-link-card fortune-link-modify-modal link-toolbar",
165
168
  style: {
166
169
  left: position.cellLeft + 20,
167
170
  top: position.cellBottom - 5
168
- }
171
+ },
172
+ "data-testid": "link-card"
169
173
  }), /*#__PURE__*/_react.default.createElement("div", {
170
- className: "link-content",
174
+ className: "fortune-link-card__info link-content",
171
175
  onClick: function onClick() {
172
176
  setContext(function (draftCtx) {
173
177
  return (0, _fortuneCore.goToLink)(draftCtx, r, c, linkType, linkAddress, refs.scrollbarX.current, refs.scrollbarY.current);
174
178
  });
175
179
  },
176
- tabIndex: 0
180
+ tabIndex: 0,
181
+ "data-testid": "link-card-info-open"
177
182
  }, linkType === "webpage" ? insertLink.openLink : (0, _fortuneCore.replaceHtml)(insertLink.goTo, {
178
183
  linkAddress: linkAddress
179
184
  })), context.allowEdit === true && /*#__PURE__*/_react.default.createElement("div", {
@@ -197,13 +202,15 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
197
202
  }));
198
203
  }
199
204
  return /*#__PURE__*/_react.default.createElement("div", __assign({
200
- className: "fortune-link-card",
205
+ className: "fortune-link-card fortune-link-card--editing",
201
206
  ref: cardRef,
202
207
  style: {
203
208
  left: position.cellLeft + 20,
204
209
  top: cardTop
205
210
  }
206
- }, containerEvent), /*#__PURE__*/_react.default.createElement(_ui.Select, {
211
+ }, containerEvent, {
212
+ "data-testid": "link-card-editing"
213
+ }), /*#__PURE__*/_react.default.createElement(_ui.Select, {
207
214
  value: linkType,
208
215
  onValueChange: function onValueChange(value) {
209
216
  if (value === "sheet") {
@@ -228,9 +235,10 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
228
235
  value: type.value
229
236
  }, type.text);
230
237
  }))), /*#__PURE__*/_react.default.createElement("div", {
231
- className: "fortune-input-with-icon"
238
+ className: "fortune-link-card__para fortune-input-with-icon",
239
+ "data-testid": "link-card-para-text"
232
240
  }, /*#__PURE__*/_react.default.createElement("div", {
233
- className: "input-icon"
241
+ className: "fortune-link-card__icon input-icon"
234
242
  }, /*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
235
243
  name: "ALargeSmall"
236
244
  })), /*#__PURE__*/_react.default.createElement(_ui.TextField, {
@@ -283,7 +291,7 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
283
291
  value: sheet.name
284
292
  }, sheet.name);
285
293
  }))))), /*#__PURE__*/_react.default.createElement(_ui.Button, {
286
- className: "fortune-insert-button",
294
+ className: "fortune-link-card__cta fortune-insert-button",
287
295
  disabled: isButtonDisabled,
288
296
  onClick: function onClick() {
289
297
  if (isButtonDisabled) return;
@@ -291,7 +299,8 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
291
299
  setContext(function (draftCtx) {
292
300
  return (0, _fortuneCore.saveHyperlink)(draftCtx, r, c, linkText, linkType, linkAddress);
293
301
  });
294
- }
302
+ },
303
+ "data-testid": "link-card-cta-insert"
295
304
  }, "Insert link"));
296
305
  };
297
306
  var _default = exports.default = LinkEditCard;