@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.
- package/es/components/ConditionFormat/ConditionRules.js +20 -9
- package/es/components/DataVerification/RangeDialog.js +19 -8
- package/es/components/Dialog/index.css +37 -0
- package/es/components/Dialog/index.js +24 -10
- package/es/components/ErrorState/index.js +6 -3
- package/es/components/LinkEidtCard/index.js +21 -12
- package/es/components/Sheet/use-smooth-scroll.js +145 -0
- package/es/components/SheetOverlay/FormulaHint/index.js +48 -33
- package/es/components/SheetTab/SheetItem.js +29 -16
- package/es/components/SheetTab/index.js +35 -20
- package/es/components/Toolbar/Button.js +10 -3
- package/es/components/Toolbar/Combo.js +10 -2
- package/es/components/Toolbar/CustomButton.js +12 -3
- package/es/components/Toolbar/Select.js +7 -1
- package/lib/components/ConditionFormat/ConditionRules.js +20 -9
- package/lib/components/DataVerification/RangeDialog.js +19 -8
- package/lib/components/Dialog/index.css +37 -0
- package/lib/components/Dialog/index.js +24 -10
- package/lib/components/ErrorState/index.js +6 -3
- package/lib/components/LinkEidtCard/index.js +21 -12
- package/lib/components/Sheet/use-smooth-scroll.js +145 -0
- package/lib/components/SheetOverlay/FormulaHint/index.js +48 -33
- package/lib/components/SheetTab/SheetItem.js +29 -16
- package/lib/components/SheetTab/index.js +35 -20
- package/lib/components/Toolbar/Button.js +10 -3
- package/lib/components/Toolbar/Combo.js +10 -2
- package/lib/components/Toolbar/CustomButton.js +12 -3
- package/lib/components/Toolbar/Select.js +7 -1
- package/package.json +2 -2
|
@@ -13,22 +13,28 @@ var _useAlert = require("../../hooks/useAlert");
|
|
|
13
13
|
var _SVGIcon = _interopRequireDefault(require("../SVGIcon"));
|
|
14
14
|
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); }
|
|
15
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
var toCssId = function toCssId(s) {
|
|
17
|
+
return String(s).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
|
|
18
|
+
};
|
|
16
19
|
var SheetItem = function SheetItem(_a) {
|
|
20
|
+
var _b, _c, _d, _e;
|
|
17
21
|
var sheet = _a.sheet,
|
|
18
22
|
isDropPlaceholder = _a.isDropPlaceholder;
|
|
19
|
-
var
|
|
20
|
-
context =
|
|
21
|
-
setContext =
|
|
22
|
-
refs =
|
|
23
|
-
var
|
|
24
|
-
editing =
|
|
25
|
-
setEditing =
|
|
23
|
+
var _f = (0, _react.useContext)(_context.default),
|
|
24
|
+
context = _f.context,
|
|
25
|
+
setContext = _f.setContext,
|
|
26
|
+
refs = _f.refs;
|
|
27
|
+
var _g = (0, _react.useState)(false),
|
|
28
|
+
editing = _g[0],
|
|
29
|
+
setEditing = _g[1];
|
|
26
30
|
var containerRef = (0, _react.useRef)(null);
|
|
27
31
|
var editable = (0, _react.useRef)(null);
|
|
28
|
-
var
|
|
29
|
-
dragOver =
|
|
30
|
-
setDragOver =
|
|
32
|
+
var _h = (0, _react.useState)(false),
|
|
33
|
+
dragOver = _h[0],
|
|
34
|
+
setDragOver = _h[1];
|
|
31
35
|
var showAlert = (0, _useAlert.useAlert)().showAlert;
|
|
36
|
+
var sheetIdClass = sheet.id != null ? toCssId(String(sheet.id)) : "placeholder";
|
|
37
|
+
var sheetNameClass = sheet.name ? toCssId(sheet.name) : "";
|
|
32
38
|
(0, _react.useEffect)(function () {
|
|
33
39
|
setContext(function (draftCtx) {
|
|
34
40
|
var _a, _b, _c, _d;
|
|
@@ -136,7 +142,10 @@ var SheetItem = function SheetItem(_a) {
|
|
|
136
142
|
draggable: context.allowEdit && !editing,
|
|
137
143
|
key: sheet.id,
|
|
138
144
|
ref: containerRef,
|
|
139
|
-
className: isDropPlaceholder ? "fortune-sheettab-placeholder" : "luckysheet-sheets-item".concat(context.currentSheetId === sheet.id ? " luckysheet-sheets-item-active" : ""),
|
|
145
|
+
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" : ""),
|
|
146
|
+
"data-sheet-id": sheet.id != null ? String(sheet.id) : undefined,
|
|
147
|
+
"data-sheet-name": sheet.name || undefined,
|
|
148
|
+
"data-testid": "sheettab-item-".concat((_b = sheet.id) !== null && _b !== void 0 ? _b : "placeholder"),
|
|
140
149
|
onClick: function onClick() {
|
|
141
150
|
if (isDropPlaceholder) return;
|
|
142
151
|
setContext(function (draftCtx) {
|
|
@@ -180,13 +189,14 @@ var SheetItem = function SheetItem(_a) {
|
|
|
180
189
|
display: sheet.hide === 1 ? "none" : ""
|
|
181
190
|
}
|
|
182
191
|
}, editing === false && (/*#__PURE__*/_react.default.createElement("p", {
|
|
183
|
-
className: "luckysheet-sheets-item-name",
|
|
192
|
+
className: "fortune-sheettab-item__para luckysheet-sheets-item-name",
|
|
184
193
|
onDoubleClick: function onDoubleClick() {
|
|
185
194
|
if (context.isFlvReadOnly) return;
|
|
186
195
|
setEditing(true);
|
|
187
|
-
}
|
|
196
|
+
},
|
|
197
|
+
"data-testid": "sheettab-item-para-".concat((_c = sheet.id) !== null && _c !== void 0 ? _c : "placeholder")
|
|
188
198
|
}, sheet.name)), editing && (/*#__PURE__*/_react.default.createElement("span", {
|
|
189
|
-
className: "luckysheet-sheets-item-name",
|
|
199
|
+
className: "fortune-sheettab-item__para luckysheet-sheets-item-name",
|
|
190
200
|
spellCheck: "false",
|
|
191
201
|
suppressContentEditableWarning: true,
|
|
192
202
|
contentEditable: isDropPlaceholder ? false : editing,
|
|
@@ -199,13 +209,16 @@ var SheetItem = function SheetItem(_a) {
|
|
|
199
209
|
ref: editable,
|
|
200
210
|
style: dragOver ? {
|
|
201
211
|
pointerEvents: "none"
|
|
202
|
-
} : {}
|
|
212
|
+
} : {},
|
|
213
|
+
"data-testid": "sheettab-item-para-editable-".concat((_d = sheet.id) !== null && _d !== void 0 ? _d : "placeholder")
|
|
203
214
|
}, sheet.name)), /*#__PURE__*/_react.default.createElement("span", {
|
|
204
|
-
className: "luckysheet-sheets-item-function",
|
|
215
|
+
className: "fortune-sheettab-item__icon fortune-sheettab-item__action fortune-sheettab-item__icon--menu luckysheet-sheets-item-function",
|
|
205
216
|
style: {
|
|
206
217
|
marginRight: "4px",
|
|
207
218
|
marginLeft: "4px"
|
|
208
219
|
},
|
|
220
|
+
"data-sheet-id": sheet.id != null ? String(sheet.id) : undefined,
|
|
221
|
+
"data-testid": "sheettab-item-icon-menu-".concat((_e = sheet.id) !== null && _e !== void 0 ? _e : "placeholder"),
|
|
209
222
|
onClick: function onClick(e) {
|
|
210
223
|
if (isDropPlaceholder || context.allowEdit === false) return;
|
|
211
224
|
var rect = refs.workbookContainer.current.getBoundingClientRect();
|
|
@@ -139,8 +139,9 @@ var SheetTab = function SheetTab() {
|
|
|
139
139
|
});
|
|
140
140
|
var finalStats = statsFilter.length !== 6 ? [] : statsFilter;
|
|
141
141
|
return /*#__PURE__*/_react.default.createElement("div", null, showDisclaimer && (/*#__PURE__*/_react.default.createElement("div", {
|
|
142
|
-
className: "w-full",
|
|
142
|
+
className: "fortune-sheettab__info fortune-sheettab__disclaimer w-full",
|
|
143
143
|
id: "denomination-warning",
|
|
144
|
+
"data-testid": "sheettab-info-disclaimer",
|
|
144
145
|
style: {
|
|
145
146
|
zIndex: 1003,
|
|
146
147
|
position: "absolute",
|
|
@@ -157,36 +158,43 @@ var SheetTab = function SheetTab() {
|
|
|
157
158
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
158
159
|
className: "max-w-7xl mx-auto px-4 py-1 ".concat(isMobile && "w-full flex justify-between")
|
|
159
160
|
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
160
|
-
className: "".concat(isMobile ? "text-left" : "text-center", " text-xsm")
|
|
161
|
+
className: "fortune-sheettab__para ".concat(isMobile ? "text-left" : "text-center", " text-xsm"),
|
|
162
|
+
"data-testid": "sheettab-para-disclaimer"
|
|
161
163
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
162
164
|
className: "font-medium"
|
|
163
165
|
}, "Disclaimer:"), " Prices are not updated in real time and may differ slightly. Updates may be delayed by up to 20 minutes."), isMobile && (/*#__PURE__*/_react.default.createElement("p", {
|
|
164
|
-
className: "ml-4 content-center cursor-pointer",
|
|
166
|
+
className: "fortune-sheettab__action fortune-sheettab__action--close-disclaimer ml-4 content-center cursor-pointer",
|
|
165
167
|
style: {
|
|
166
168
|
alignContent: "center"
|
|
167
169
|
},
|
|
168
|
-
onClick: handleCloseDisclaimer
|
|
170
|
+
onClick: handleCloseDisclaimer,
|
|
171
|
+
"data-testid": "sheettab-action-close-disclaimer"
|
|
169
172
|
}, "Close"))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
170
|
-
className: "luckysheet-sheet-area luckysheet-noselected-text border-t color-border-default color-bg-secondary",
|
|
173
|
+
className: "fortune-sheettab luckysheet-sheet-area luckysheet-noselected-text border-t color-border-default color-bg-secondary",
|
|
171
174
|
onContextMenu: function onContextMenu(e) {
|
|
172
175
|
return e.preventDefault();
|
|
173
176
|
},
|
|
174
|
-
id: "luckysheet-sheet-area"
|
|
177
|
+
id: "luckysheet-sheet-area",
|
|
178
|
+
"data-testid": "sheettab"
|
|
175
179
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
176
|
-
id: "luckysheet-sheet-content"
|
|
180
|
+
id: "luckysheet-sheet-content",
|
|
181
|
+
className: "fortune-sheettab__content",
|
|
182
|
+
"data-testid": "sheettab-content"
|
|
177
183
|
}, context.allowEdit && (/*#__PURE__*/_react.default.createElement(_ui.IconButton, {
|
|
178
|
-
className: "fortune-sheettab-button border-none shadow-none",
|
|
184
|
+
className: "fortune-sheettab__cta fortune-sheettab-button border-none shadow-none",
|
|
179
185
|
onClick: onAddSheetClick,
|
|
180
186
|
elevation: 1,
|
|
181
187
|
icon: "Plus",
|
|
182
188
|
size: "sm",
|
|
183
|
-
variant: "secondary"
|
|
189
|
+
variant: "secondary",
|
|
190
|
+
"data-testid": "sheettab-cta-add-sheet"
|
|
184
191
|
})), context.allowEdit && (/*#__PURE__*/_react.default.createElement("div", {
|
|
185
192
|
className: "sheet-list-container"
|
|
186
193
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
187
194
|
id: "all-sheets",
|
|
188
|
-
className: "fortune-sheettab-button",
|
|
195
|
+
className: "fortune-sheettab__icon fortune-sheettab-button",
|
|
189
196
|
ref: tabContainerRef,
|
|
197
|
+
"data-testid": "sheettab-icon-all-sheets",
|
|
190
198
|
onMouseDown: function onMouseDown(e) {
|
|
191
199
|
e.stopPropagation();
|
|
192
200
|
setContext(function (ctx) {
|
|
@@ -195,14 +203,16 @@ var SheetTab = function SheetTab() {
|
|
|
195
203
|
});
|
|
196
204
|
}
|
|
197
205
|
}, /*#__PURE__*/_react.default.createElement(_ui.IconButton, {
|
|
198
|
-
className: "fortune-sheettab-button border-none shadow-none",
|
|
206
|
+
className: "fortune-sheettab__icon fortune-sheettab-button border-none shadow-none",
|
|
199
207
|
elevation: 1,
|
|
200
208
|
icon: "Menu",
|
|
201
209
|
size: "sm",
|
|
202
|
-
variant: "secondary"
|
|
210
|
+
variant: "secondary",
|
|
211
|
+
"data-testid": "sheettab-icon-menu"
|
|
203
212
|
})))), /*#__PURE__*/_react.default.createElement("div", {
|
|
204
|
-
className: "fortune-sheettab-container",
|
|
205
|
-
id: "fortune-sheettab-container"
|
|
213
|
+
className: "fortune-sheettab__tabs fortune-sheettab-container",
|
|
214
|
+
id: "fortune-sheettab-container",
|
|
215
|
+
"data-testid": "sheettab-tabs"
|
|
206
216
|
}, !isShowBoundary && /*#__PURE__*/_react.default.createElement("div", {
|
|
207
217
|
className: "boundary boundary-left"
|
|
208
218
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -255,21 +265,24 @@ var SheetTab = function SheetTab() {
|
|
|
255
265
|
})))), /*#__PURE__*/_react.default.createElement("div", {
|
|
256
266
|
className: "fortune-sheet-area-right"
|
|
257
267
|
}, statsFilter.length === 6 && calInfo.count > 1 && (/*#__PURE__*/_react.default.createElement(_ui.Popover, null, /*#__PURE__*/_react.default.createElement(_ui.PopoverTrigger, {
|
|
258
|
-
className: "p-0 m-0 mr-2"
|
|
268
|
+
className: "fortune-sheettab__info-trigger p-0 m-0 mr-2",
|
|
269
|
+
"data-testid": "sheettab-info-stats-trigger"
|
|
259
270
|
}, /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
260
271
|
variant: "ghost",
|
|
261
|
-
className: "w-full !h-6 p-2 m-1 text-left flex items-center justify-center transition mr-2 !rounded-[0px]",
|
|
272
|
+
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]",
|
|
262
273
|
style: {
|
|
263
274
|
height: "24px !important"
|
|
264
|
-
}
|
|
275
|
+
},
|
|
276
|
+
"data-testid": "sheettab-info-stats"
|
|
265
277
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
266
278
|
className: "flex items-center"
|
|
267
279
|
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
268
|
-
className: "text-body-sm",
|
|
280
|
+
className: "fortune-sheettab__para fortune-sheettab__para--stats text-body-sm",
|
|
269
281
|
style: {
|
|
270
282
|
fontWeight: "500",
|
|
271
283
|
marginRight: "8px"
|
|
272
|
-
}
|
|
284
|
+
},
|
|
285
|
+
"data-testid": "sheettab-para-stats"
|
|
273
286
|
}, STATS_LABELS[selectedStat], ":", " ", calInfo[selectedStat]), /*#__PURE__*/_react.default.createElement("svg", {
|
|
274
287
|
xmlns: "http://www.w3.org/2000/svg",
|
|
275
288
|
width: "18",
|
|
@@ -302,7 +315,9 @@ var SheetTab = function SheetTab() {
|
|
|
302
315
|
return /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
303
316
|
variant: "ghost",
|
|
304
317
|
key: option.value,
|
|
305
|
-
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]"),
|
|
318
|
+
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]"),
|
|
319
|
+
"data-stat-value": option.value,
|
|
320
|
+
"data-testid": "sheettab-stats-option-".concat(option.value),
|
|
306
321
|
onClick: function onClick() {
|
|
307
322
|
return setSelectedStat(option.value);
|
|
308
323
|
}
|
|
@@ -17,18 +17,25 @@ var Button = function Button(_a) {
|
|
|
17
17
|
children = _a.children,
|
|
18
18
|
style = _a.style,
|
|
19
19
|
id = _a.id;
|
|
20
|
+
var iconIdClass = iconId.replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
|
|
20
21
|
return /*#__PURE__*/_react.default.createElement(_ui.Tooltip, {
|
|
21
22
|
text: tooltip,
|
|
22
23
|
placement: "bottom"
|
|
23
24
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
24
25
|
id: id,
|
|
25
|
-
className: "fortune-toolbar-button fortune-toolbar-item",
|
|
26
|
+
className: "fortune-toolbar-button fortune-toolbar-item fortune-toolbar-button__cta fortune-toolbar-button--".concat(iconIdClass),
|
|
27
|
+
"data-icon-id": iconId,
|
|
26
28
|
onClick: onClick,
|
|
27
29
|
tabIndex: 0,
|
|
28
30
|
role: "button",
|
|
29
31
|
style: selected ? {
|
|
30
32
|
backgroundColor: "#FFDF0A"
|
|
31
|
-
} : style
|
|
33
|
+
} : style,
|
|
34
|
+
"data-testid": "toolbar-cta-".concat(id !== null && id !== void 0 ? id : iconId)
|
|
35
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
36
|
+
className: "fortune-toolbar-button__icon fortune-toolbar-button__icon--".concat(iconIdClass),
|
|
37
|
+
"data-icon-id": iconId,
|
|
38
|
+
"data-testid": "toolbar-icon-".concat(iconId)
|
|
32
39
|
}, /*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
|
|
33
40
|
name: (0, _.getLucideIcon)(iconId),
|
|
34
41
|
width: 16,
|
|
@@ -36,6 +43,6 @@ var Button = function Button(_a) {
|
|
|
36
43
|
style: disabled ? {
|
|
37
44
|
opacity: 0.3
|
|
38
45
|
} : {}
|
|
39
|
-
}), children));
|
|
46
|
+
})), children));
|
|
40
47
|
};
|
|
41
48
|
var _default = exports.default = Button;
|
|
@@ -11,6 +11,9 @@ var _SVGIcon = _interopRequireDefault(require("../SVGIcon"));
|
|
|
11
11
|
var _ = require(".");
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
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); }
|
|
14
|
+
var toCssId = function toCssId(s) {
|
|
15
|
+
return String(s).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
|
|
16
|
+
};
|
|
14
17
|
var Combo = function Combo(_a) {
|
|
15
18
|
var tooltip = _a.tooltip,
|
|
16
19
|
_onClick = _a.onClick,
|
|
@@ -29,6 +32,7 @@ var Combo = function Combo(_a) {
|
|
|
29
32
|
setOpen = _c[1];
|
|
30
33
|
var buttonRef = (0, _react.useRef)(null);
|
|
31
34
|
var ref = (0, _react.useRef)(null);
|
|
35
|
+
var iconIdClass = iconId ? toCssId(iconId) : "combo";
|
|
32
36
|
if (!triggerRef) {
|
|
33
37
|
triggerRef = ref;
|
|
34
38
|
}
|
|
@@ -42,7 +46,9 @@ var Combo = function Combo(_a) {
|
|
|
42
46
|
text: tooltip,
|
|
43
47
|
placement: "bottom"
|
|
44
48
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
45
|
-
className: "fortune-toolbar-combo-button",
|
|
49
|
+
className: "fortune-toolbar-combo-button fortune-toolbar-combo-button--".concat(iconIdClass),
|
|
50
|
+
"data-icon-id": iconId !== null && iconId !== void 0 ? iconId : undefined,
|
|
51
|
+
"data-testid": "toolbar-combo-".concat(iconId !== null && iconId !== void 0 ? iconId : "combo"),
|
|
46
52
|
onClick: function onClick(e) {
|
|
47
53
|
if (_onClick) {
|
|
48
54
|
_onClick(e);
|
|
@@ -102,7 +108,9 @@ var Combo = function Combo(_a) {
|
|
|
102
108
|
})))));
|
|
103
109
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
104
110
|
ref: buttonRef,
|
|
105
|
-
className: "fortune-toolbar-item",
|
|
111
|
+
className: "fortune-toolbar-item fortune-toolbar-combo fortune-toolbar-combo--".concat(iconIdClass),
|
|
112
|
+
"data-icon-id": iconId !== null && iconId !== void 0 ? iconId : undefined,
|
|
113
|
+
"data-testid": "toolbar-combo-".concat(iconId !== null && iconId !== void 0 ? iconId : "combo"),
|
|
106
114
|
onKeyDown: function onKeyDown(e) {
|
|
107
115
|
e.stopPropagation();
|
|
108
116
|
}
|
|
@@ -8,6 +8,9 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _ui = require("@fileverse/ui");
|
|
9
9
|
var _CustomIcon = _interopRequireDefault(require("./CustomIcon"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
var toCssId = function toCssId(s) {
|
|
12
|
+
return String(s).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
|
|
13
|
+
};
|
|
11
14
|
var CustomButton = function CustomButton(_a) {
|
|
12
15
|
var tooltip = _a.tooltip,
|
|
13
16
|
onClick = _a.onClick,
|
|
@@ -15,22 +18,28 @@ var CustomButton = function CustomButton(_a) {
|
|
|
15
18
|
children = _a.children,
|
|
16
19
|
iconName = _a.iconName,
|
|
17
20
|
icon = _a.icon;
|
|
21
|
+
var iconNameClass = iconName ? toCssId(iconName) : "custom";
|
|
18
22
|
return /*#__PURE__*/_react.default.createElement(_ui.Tooltip, {
|
|
19
23
|
text: tooltip,
|
|
20
24
|
placement: "bottom"
|
|
21
25
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
22
|
-
className: "fortune-toolbar-button fortune-toolbar-item",
|
|
26
|
+
className: "fortune-toolbar-button fortune-toolbar-item fortune-toolbar-button--".concat(iconNameClass),
|
|
27
|
+
"data-icon-name": iconName !== null && iconName !== void 0 ? iconName : undefined,
|
|
23
28
|
onClick: onClick,
|
|
24
29
|
tabIndex: 0,
|
|
25
30
|
role: "button",
|
|
26
31
|
style: selected ? {
|
|
27
32
|
backgroundColor: "#FFDF0A"
|
|
28
|
-
} : {}
|
|
33
|
+
} : {},
|
|
34
|
+
"data-testid": "toolbar-cta-".concat(iconName !== null && iconName !== void 0 ? iconName : "custom")
|
|
35
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
36
|
+
className: "fortune-toolbar-button__icon fortune-toolbar-button__icon--".concat(iconNameClass),
|
|
37
|
+
"data-icon-name": iconName !== null && iconName !== void 0 ? iconName : undefined
|
|
29
38
|
}, /*#__PURE__*/_react.default.createElement(_CustomIcon.default, {
|
|
30
39
|
width: 16,
|
|
31
40
|
height: 16,
|
|
32
41
|
iconName: iconName,
|
|
33
42
|
content: icon
|
|
34
|
-
}), children));
|
|
43
|
+
})), children));
|
|
35
44
|
};
|
|
36
45
|
var _default = exports.default = CustomButton;
|
|
@@ -15,16 +15,22 @@ var Select = function Select(_a) {
|
|
|
15
15
|
style: style
|
|
16
16
|
}, children);
|
|
17
17
|
};
|
|
18
|
+
var toCssId = function toCssId(s) {
|
|
19
|
+
return String(s).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
|
|
20
|
+
};
|
|
18
21
|
var Option = exports.Option = function Option(_a) {
|
|
19
22
|
var iconId = _a.iconId,
|
|
20
23
|
onClick = _a.onClick,
|
|
21
24
|
children = _a.children,
|
|
22
25
|
_onMouseLeave = _a.onMouseLeave,
|
|
23
26
|
_onMouseEnter = _a.onMouseEnter;
|
|
27
|
+
var iconIdClass = iconId ? toCssId(iconId) : "option";
|
|
24
28
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
25
29
|
onClick: onClick,
|
|
26
30
|
tabIndex: 0,
|
|
27
|
-
className: "fortune-toolbar-select-option",
|
|
31
|
+
className: "fortune-toolbar-select-option fortune-toolbar-select-option--".concat(iconIdClass),
|
|
32
|
+
"data-icon-id": iconId !== null && iconId !== void 0 ? iconId : undefined,
|
|
33
|
+
"data-testid": "toolbar-select-option-".concat(iconId !== null && iconId !== void 0 ? iconId : "option"),
|
|
28
34
|
onMouseLeave: function onMouseLeave(e) {
|
|
29
35
|
return _onMouseLeave === null || _onMouseLeave === void 0 ? void 0 : _onMouseLeave(e);
|
|
30
36
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.98-play",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"tsc": "tsc"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@fileverse-dev/fortune-core": "1.2.
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.2.98-play",
|
|
20
20
|
"@fileverse/ui": "5.0.0",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|