@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
@@ -360,8 +360,10 @@ var ConditionRules = function ConditionRules(_a) {
360
360
  setEditConditionRange(rangeEdit);
361
361
  setEditConditionFormatValue(allConditionFormats[key].conditionValue);
362
362
  },
363
- className: "group flex items-center border-b border-gray-200 condition-list-parent",
364
- key: key
363
+ 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, "-")),
364
+ "data-condition-key": key,
365
+ key: key,
366
+ "data-testid": "condition-rules-item-".concat(key)
365
367
  }, /*#__PURE__*/React.createElement("div", {
366
368
  className: "condition-list-pill",
367
369
  style: {
@@ -383,9 +385,11 @@ var ConditionRules = function ConditionRules(_a) {
383
385
  buttonClickCreateRef.current = true;
384
386
  }
385
387
  }, /*#__PURE__*/React.createElement("h3", {
386
- className: "condition-list-type"
388
+ className: "fortune-condition-rules__heading condition-list-type",
389
+ "data-testid": "condition-rules-heading-".concat(key)
387
390
  }, conditionformat[allConditionFormats[key].conditionName], " ", (_a = allConditionFormats[key].conditionValue) === null || _a === void 0 ? void 0 : _a[0]), /*#__PURE__*/React.createElement("p", {
388
- className: "condition-list-range"
391
+ className: "fortune-condition-rules__para condition-list-range",
392
+ "data-testid": "condition-rules-para-".concat(key)
389
393
  }, (_b = allConditionFormats[key].cellrange) === null || _b === void 0 ? void 0 : _b.map(function (range) {
390
394
  var startCol = numberToColumn(range.column[0] + 1);
391
395
  var endCol = numberToColumn(range.column[1] + 1);
@@ -393,12 +397,15 @@ var ConditionRules = function ConditionRules(_a) {
393
397
  var endRow = range.row[1] + 1;
394
398
  return "".concat(startCol).concat(startRow, ":").concat(endCol).concat(endRow);
395
399
  }).join(", "))), /*#__PURE__*/React.createElement("div", {
396
- className: "opacity-0 group-hover:opacity-100 transition-opacity"
400
+ className: "fortune-condition-rules__icon fortune-condition-rules__action opacity-0 group-hover:opacity-100 transition-opacity",
401
+ "data-condition-key": key,
402
+ "data-testid": "condition-rules-action-delete-".concat(key)
397
403
  }, /*#__PURE__*/React.createElement(IconButton, {
398
404
  elevation: 1,
399
405
  icon: "Trash2",
400
406
  size: "md",
401
407
  variant: "secondary",
408
+ className: "fortune-condition-rules__icon--trash",
402
409
  style: {
403
410
  border: "0px",
404
411
  boxShadow: "none",
@@ -419,6 +426,7 @@ var ConditionRules = function ConditionRules(_a) {
419
426
  leftIcon: "Plus",
420
427
  size: "md",
421
428
  variant: "secondary",
429
+ className: "fortune-condition-rules__cta fortune-condition-rules__cta--add",
422
430
  onClick: function onClick() {
423
431
  setType("greaterThan");
424
432
  setCreate(true);
@@ -432,11 +440,13 @@ var ConditionRules = function ConditionRules(_a) {
432
440
  });
433
441
  editKeyRef.current = null;
434
442
  buttonClickCreateRef.current = true;
435
- }
443
+ },
444
+ "data-testid": "condition-rules-cta-add"
436
445
  }, "Add another rule"))) : (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
437
- className: "flex flex-col"
446
+ className: "flex flex-col fortune-condition-rules__form"
438
447
  }, /*#__PURE__*/React.createElement("div", {
439
- className: "condition-rules-value text-heading-xsm"
448
+ className: "fortune-condition-rules__info condition-rules-value text-heading-xsm",
449
+ "data-testid": "condition-rules-info-range"
440
450
  }, conditionformat.applyRange, " range"), /*#__PURE__*/React.createElement(TextField, {
441
451
  rightIcon: /*#__PURE__*/React.createElement(LucideIcon, {
442
452
  name: "Grid2x2",
@@ -454,7 +464,8 @@ var ConditionRules = function ConditionRules(_a) {
454
464
  dataSelectRange("conditionRules".concat(type));
455
465
  }
456
466
  })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
457
- className: "condition-rules-value text-heading-xsm"
467
+ className: "fortune-condition-rules__heading-sm condition-rules-value text-heading-xsm",
468
+ "data-testid": "condition-rules-heading-format"
458
469
  }, "Format cells if"), /*#__PURE__*/React.createElement(Select, {
459
470
  value: type,
460
471
  onValueChange: function onValueChange(value) {
@@ -38,7 +38,8 @@ var RangeDialog = function RangeDialog() {
38
38
  }, [context, context.luckysheet_select_save]);
39
39
  return /*#__PURE__*/React.createElement("div", {
40
40
  id: "range-dialog",
41
- className: "fortune-dialog",
41
+ className: "fortune-dialog fortune-range-dialog",
42
+ "data-testid": "range-dialog",
42
43
  onClick: function onClick(e) {
43
44
  return e.stopPropagation();
44
45
  },
@@ -56,32 +57,41 @@ var RangeDialog = function RangeDialog() {
56
57
  },
57
58
  tabIndex: 0
58
59
  }, /*#__PURE__*/React.createElement("div", {
59
- className: cn("flex items-center justify-between border-b color-border-default py-3 px-6")
60
+ className: cn("fortune-range-dialog__header flex items-center justify-between border-b color-border-default py-3 px-6"),
61
+ "data-testid": "range-dialog-header"
60
62
  }, /*#__PURE__*/React.createElement("div", {
61
- className: "text-heading-sm"
63
+ className: "fortune-range-dialog__heading text-heading-sm",
64
+ "data-testid": "range-dialog-heading"
62
65
  }, dataVerification.selectCellRange), /*#__PURE__*/React.createElement(IconButton, {
63
66
  icon: "X",
64
67
  variant: "ghost",
65
68
  onClick: close,
66
- tabIndex: 0
69
+ tabIndex: 0,
70
+ className: "fortune-range-dialog__icon fortune-range-dialog__icon--close",
71
+ "data-testid": "range-dialog-icon-close"
67
72
  })), /*#__PURE__*/React.createElement("div", {
68
- className: "px-6 pb-6 pt-4 text-body-sm"
73
+ className: "fortune-range-dialog__para px-6 pb-6 pt-4 text-body-sm",
74
+ "data-testid": "range-dialog-para"
69
75
  }, /*#__PURE__*/React.createElement(TextField, {
70
76
  className: "w-full",
71
77
  readOnly: true,
72
78
  placeholder: dataVerification.selectCellRange2,
73
79
  value: rangeTxt2
74
80
  })), /*#__PURE__*/React.createElement("div", {
75
- className: "px-6 pb-6 flex flex-row gap-2 justify-end"
81
+ className: "fortune-range-dialog__actions px-6 pb-6 flex flex-row gap-2 justify-end",
82
+ "data-testid": "range-dialog-actions"
76
83
  }, /*#__PURE__*/React.createElement(Button, {
77
84
  variant: "secondary",
85
+ className: "fortune-range-dialog__cta fortune-range-dialog__cta--close",
78
86
  style: {
79
87
  minWidth: "80px"
80
88
  },
81
89
  onClick: close,
82
- tabIndex: 0
90
+ tabIndex: 0,
91
+ "data-testid": "range-dialog-cta-close"
83
92
  }, button.close), /*#__PURE__*/React.createElement(Button, {
84
93
  variant: "default",
94
+ className: "fortune-range-dialog__cta fortune-range-dialog__cta--confirm",
85
95
  style: {
86
96
  minWidth: "80px"
87
97
  },
@@ -91,7 +101,8 @@ var RangeDialog = function RangeDialog() {
91
101
  });
92
102
  close();
93
103
  },
94
- tabIndex: 0
104
+ tabIndex: 0,
105
+ "data-testid": "range-dialog-cta-confirm"
95
106
  }, button.confirm)));
96
107
  };
97
108
  export 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;
@@ -27,46 +27,60 @@ var Dialog = function Dialog(_a) {
27
27
  var button = locale(context).button;
28
28
  return /*#__PURE__*/React.createElement("div", {
29
29
  className: "fortune-dialog",
30
+ "data-testid": "dialog",
30
31
  style: __assign(__assign({}, containerStyle), ["Data validation", "Split text to columns", "Resize column"].includes(title) ? {
31
32
  maxWidth: "unset"
32
33
  } : {})
33
34
  }, /*#__PURE__*/React.createElement("div", {
34
- className: cn("flex items-center justify-between border-b color-border-default py-3 px-6")
35
+ className: cn("fortune-dialog__header flex items-center justify-between border-b color-border-default py-3 px-6"),
36
+ "data-testid": "dialog-header"
35
37
  }, title ? (/*#__PURE__*/React.createElement("div", {
36
- className: "text-heading-sm"
38
+ className: "fortune-dialog__heading text-heading-sm",
39
+ "data-testid": "dialog-heading"
37
40
  }, title)) : (/*#__PURE__*/React.createElement("div", {
38
- className: "text-heading-sm"
41
+ className: "fortune-dialog__heading text-heading-sm",
42
+ "data-testid": "dialog-heading"
39
43
  }, "Oops! Something went wrong")), /*#__PURE__*/React.createElement(IconButton, {
40
44
  icon: "X",
41
45
  variant: "ghost",
42
46
  onClick: onCancel,
43
- tabIndex: 0
47
+ tabIndex: 0,
48
+ className: "fortune-dialog__icon fortune-dialog__icon--close",
49
+ "data-testid": "dialog-icon-close"
44
50
  })), /*#__PURE__*/React.createElement("div", {
45
- className: "px-6 pb-6 pt-4 text-body-sm",
46
- style: contentStyle
51
+ className: "fortune-dialog__para px-6 pb-6 pt-4 text-body-sm",
52
+ style: contentStyle,
53
+ "data-testid": "dialog-para"
47
54
  }, children), type != null && (/*#__PURE__*/React.createElement("div", {
48
- className: "px-6 pb-6 flex flex-row gap-2 justify-end"
55
+ className: "fortune-dialog__actions px-6 pb-6 flex flex-row gap-2 justify-end",
56
+ "data-testid": "dialog-actions"
49
57
  }, type === "ok" ? (/*#__PURE__*/React.createElement(Button, {
50
58
  variant: "default",
59
+ className: "fortune-dialog__cta fortune-dialog__cta--confirm",
51
60
  style: {
52
61
  minWidth: "80px"
53
62
  },
54
63
  onClick: onOk,
55
- tabIndex: 0
64
+ tabIndex: 0,
65
+ "data-testid": "dialog-cta-confirm"
56
66
  }, okLabel || button.confirm)) : (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
57
67
  variant: "secondary",
68
+ className: "fortune-dialog__cta fortune-dialog__cta--cancel",
58
69
  style: {
59
70
  minWidth: "80px"
60
71
  },
61
72
  onClick: onCancel,
62
- tabIndex: 0
73
+ tabIndex: 0,
74
+ "data-testid": "dialog-cta-cancel"
63
75
  }, cancelLabel || button.cancel), /*#__PURE__*/React.createElement(Button, {
64
76
  variant: "default",
77
+ className: "fortune-dialog__cta fortune-dialog__cta--confirm",
65
78
  style: {
66
79
  minWidth: "80px"
67
80
  },
68
81
  onClick: onOk,
69
- tabIndex: 0
82
+ tabIndex: 0,
83
+ "data-testid": "dialog-cta-confirm"
70
84
  }, okLabel || button.confirm))))));
71
85
  };
72
86
  export default Dialog;
@@ -22,11 +22,14 @@ var ErrorBoxes = function ErrorBoxes() {
22
22
  zIndex: 100,
23
23
  borderRadius: "4px"
24
24
  },
25
- className: "shadow-lg flex flex-col gap-2 break-all"
25
+ className: "fortune-error-state shadow-lg flex flex-col gap-2 break-all",
26
+ "data-testid": "error-state"
26
27
  }, /*#__PURE__*/React.createElement("h3", {
27
- className: "text-heading-xsm color-text-danger"
28
+ className: "fortune-error-state__heading text-heading-xsm color-text-danger",
29
+ "data-testid": "error-state-heading"
28
30
  }, title), /*#__PURE__*/React.createElement("div", {
29
- className: "color-text-default text-body-sm"
31
+ className: "fortune-error-state__para color-text-default text-body-sm",
32
+ "data-testid": "error-state-para"
30
33
  }, message));
31
34
  };
32
35
  export default ErrorBoxes;
@@ -96,10 +96,13 @@ export var LinkEditCard = function LinkEditCard(_a) {
96
96
  };
97
97
  }, [refs.globalCache, isButtonDisabled]);
98
98
  var renderToolbarButton = useCallback(function (iconId, onClick) {
99
+ var iconIdClass = iconId.replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
99
100
  return /*#__PURE__*/React.createElement("div", {
100
- className: "fortune-toolbar-button",
101
+ className: "fortune-link-card__icon fortune-link-card__action fortune-link-card__action--".concat(iconIdClass, " fortune-toolbar-button"),
102
+ "data-icon-id": iconId,
101
103
  onClick: onClick,
102
- tabIndex: 0
104
+ tabIndex: 0,
105
+ "data-testid": "link-card-action-".concat(iconId)
103
106
  }, /*#__PURE__*/React.createElement(SVGIcon, {
104
107
  name: iconId,
105
108
  style: {
@@ -152,19 +155,21 @@ export var LinkEditCard = function LinkEditCard(_a) {
152
155
  onKeyDown: function onKeyDown(e) {
153
156
  e.stopPropagation();
154
157
  },
155
- className: "fortune-link-modify-modal link-toolbar",
158
+ className: "fortune-link-card fortune-link-modify-modal link-toolbar",
156
159
  style: {
157
160
  left: position.cellLeft + 20,
158
161
  top: position.cellBottom - 5
159
- }
162
+ },
163
+ "data-testid": "link-card"
160
164
  }), /*#__PURE__*/React.createElement("div", {
161
- className: "link-content",
165
+ className: "fortune-link-card__info link-content",
162
166
  onClick: function onClick() {
163
167
  setContext(function (draftCtx) {
164
168
  return goToLink(draftCtx, r, c, linkType, linkAddress, refs.scrollbarX.current, refs.scrollbarY.current);
165
169
  });
166
170
  },
167
- tabIndex: 0
171
+ tabIndex: 0,
172
+ "data-testid": "link-card-info-open"
168
173
  }, linkType === "webpage" ? insertLink.openLink : replaceHtml(insertLink.goTo, {
169
174
  linkAddress: linkAddress
170
175
  })), context.allowEdit === true && /*#__PURE__*/React.createElement("div", {
@@ -188,13 +193,15 @@ export var LinkEditCard = function LinkEditCard(_a) {
188
193
  }));
189
194
  }
190
195
  return /*#__PURE__*/React.createElement("div", __assign({
191
- className: "fortune-link-card",
196
+ className: "fortune-link-card fortune-link-card--editing",
192
197
  ref: cardRef,
193
198
  style: {
194
199
  left: position.cellLeft + 20,
195
200
  top: cardTop
196
201
  }
197
- }, containerEvent), /*#__PURE__*/React.createElement(Select, {
202
+ }, containerEvent, {
203
+ "data-testid": "link-card-editing"
204
+ }), /*#__PURE__*/React.createElement(Select, {
198
205
  value: linkType,
199
206
  onValueChange: function onValueChange(value) {
200
207
  if (value === "sheet") {
@@ -219,9 +226,10 @@ export var LinkEditCard = function LinkEditCard(_a) {
219
226
  value: type.value
220
227
  }, type.text);
221
228
  }))), /*#__PURE__*/React.createElement("div", {
222
- className: "fortune-input-with-icon"
229
+ className: "fortune-link-card__para fortune-input-with-icon",
230
+ "data-testid": "link-card-para-text"
223
231
  }, /*#__PURE__*/React.createElement("div", {
224
- className: "input-icon"
232
+ className: "fortune-link-card__icon input-icon"
225
233
  }, /*#__PURE__*/React.createElement(LucideIcon, {
226
234
  name: "ALargeSmall"
227
235
  })), /*#__PURE__*/React.createElement(TextField, {
@@ -274,7 +282,7 @@ export var LinkEditCard = function LinkEditCard(_a) {
274
282
  value: sheet.name
275
283
  }, sheet.name);
276
284
  }))))), /*#__PURE__*/React.createElement(Button, {
277
- className: "fortune-insert-button",
285
+ className: "fortune-link-card__cta fortune-insert-button",
278
286
  disabled: isButtonDisabled,
279
287
  onClick: function onClick() {
280
288
  if (isButtonDisabled) return;
@@ -282,7 +290,8 @@ export var LinkEditCard = function LinkEditCard(_a) {
282
290
  setContext(function (draftCtx) {
283
291
  return saveHyperlink(draftCtx, r, c, linkText, linkType, linkAddress);
284
292
  });
285
- }
293
+ },
294
+ "data-testid": "link-card-cta-insert"
286
295
  }, "Insert link"));
287
296
  };
288
297
  export default LinkEditCard;
@@ -62,6 +62,147 @@ export var useSmoothScroll = function useSmoothScroll(scrollContainerRef) {
62
62
  }
63
63
  };
64
64
  }
65
+ function handleMouseDragScroll(containerEl, scrollHandler, getPixelScale) {
66
+ var isDragging = false;
67
+ var startX = 0;
68
+ var startY = 0;
69
+ var lastX = 0;
70
+ var lastY = 0;
71
+ var velocityX = 0;
72
+ var velocityY = 0;
73
+ var autoScrollAnimationId = 0;
74
+ var lastMoveTime = 0;
75
+ var scrollDirection = "none";
76
+ var VELOCITY_SMOOTHING = 0.3;
77
+ var MIN_DRAG_THRESHOLD = 5;
78
+ var ACCELERATION_FACTOR = 1.02;
79
+ var MAX_VELOCITY = 50;
80
+ var DIRECTION_LOCK_THRESHOLD = 1.5;
81
+ var EDGE_SCROLL_ZONE = 10;
82
+ function stopAutoScroll() {
83
+ if (autoScrollAnimationId) {
84
+ cancelAnimationFrame(autoScrollAnimationId);
85
+ autoScrollAnimationId = 0;
86
+ }
87
+ velocityX = 0;
88
+ velocityY = 0;
89
+ }
90
+ function autoScroll() {
91
+ if (!isDragging) {
92
+ stopAutoScroll();
93
+ return;
94
+ }
95
+ if (Math.abs(velocityX) > 0.1) {
96
+ velocityX *= ACCELERATION_FACTOR;
97
+ velocityX = Math.max(-MAX_VELOCITY, Math.min(MAX_VELOCITY, velocityX));
98
+ }
99
+ if (Math.abs(velocityY) > 0.1) {
100
+ velocityY *= ACCELERATION_FACTOR;
101
+ velocityY = Math.max(-MAX_VELOCITY, Math.min(MAX_VELOCITY, velocityY));
102
+ }
103
+ var scale = getPixelScale();
104
+ scrollHandler(velocityX * scale, velocityY * scale);
105
+ autoScrollAnimationId = requestAnimationFrame(autoScroll);
106
+ }
107
+ function onMouseDown(e) {
108
+ if (e.button !== 0) return;
109
+ var target = e.target;
110
+ if (target.tagName === "INPUT" || target.tagName === "BUTTON" || target.tagName === "SELECT" || target.tagName === "TEXTAREA" || target.closest("button") || target.closest("input")) {
111
+ return;
112
+ }
113
+ isDragging = true;
114
+ scrollDirection = "none";
115
+ startX = e.clientX;
116
+ startY = e.clientY;
117
+ lastX = e.clientX;
118
+ lastY = e.clientY;
119
+ lastMoveTime = performance.now();
120
+ velocityX = 0;
121
+ velocityY = 0;
122
+ containerEl.style.cursor = "grabbing";
123
+ e.preventDefault();
124
+ }
125
+ function onMouseMove(e) {
126
+ if (!isDragging) return;
127
+ var currentTime = performance.now();
128
+ var deltaTime = Math.max(1, currentTime - lastMoveTime);
129
+ var deltaX = e.clientX - lastX;
130
+ var deltaY = e.clientY - lastY;
131
+ var totalMovedX = e.clientX - startX;
132
+ var totalMovedY = e.clientY - startY;
133
+ var absMovedX = Math.abs(totalMovedX);
134
+ var absMovedY = Math.abs(totalMovedY);
135
+ var containerRect = containerEl.getBoundingClientRect();
136
+ var mouseX = e.clientX - containerRect.left;
137
+ var mouseY = e.clientY - containerRect.top;
138
+ var isNearLeftEdge = mouseX < EDGE_SCROLL_ZONE;
139
+ var isNearRightEdge = mouseX > containerRect.width - EDGE_SCROLL_ZONE;
140
+ var isNearTopEdge = mouseY < EDGE_SCROLL_ZONE;
141
+ var isNearBottomEdge = mouseY > containerRect.height - EDGE_SCROLL_ZONE;
142
+ if (scrollDirection === "none" && (absMovedX > MIN_DRAG_THRESHOLD || absMovedY > MIN_DRAG_THRESHOLD)) {
143
+ if (absMovedX > absMovedY * DIRECTION_LOCK_THRESHOLD) {
144
+ scrollDirection = "horizontal";
145
+ } else if (absMovedY > absMovedX * DIRECTION_LOCK_THRESHOLD) {
146
+ scrollDirection = "vertical";
147
+ } else {
148
+ scrollDirection = "none";
149
+ }
150
+ }
151
+ if (scrollDirection === "horizontal" || scrollDirection === "none") {
152
+ if (absMovedX > MIN_DRAG_THRESHOLD) {
153
+ if (isNearLeftEdge || isNearRightEdge) {
154
+ if (Math.abs(deltaX) > 0.1) {
155
+ var instantVelocityX = deltaX / deltaTime * 16;
156
+ velocityX = velocityX * (1 - VELOCITY_SMOOTHING) + instantVelocityX * VELOCITY_SMOOTHING;
157
+ }
158
+ if (!autoScrollAnimationId) {
159
+ autoScrollAnimationId = requestAnimationFrame(autoScroll);
160
+ }
161
+ } else {
162
+ velocityX = 0;
163
+ }
164
+ }
165
+ } else {
166
+ velocityX = 0;
167
+ }
168
+ if (scrollDirection === "vertical" || scrollDirection === "none") {
169
+ if (absMovedY > MIN_DRAG_THRESHOLD) {
170
+ if (isNearTopEdge || isNearBottomEdge) {
171
+ if (Math.abs(deltaY) > 0.1) {
172
+ var instantVelocityY = deltaY / deltaTime * 16;
173
+ velocityY = velocityY * (1 - VELOCITY_SMOOTHING) + instantVelocityY * VELOCITY_SMOOTHING;
174
+ }
175
+ if (!autoScrollAnimationId) {
176
+ autoScrollAnimationId = requestAnimationFrame(autoScroll);
177
+ }
178
+ } else {
179
+ velocityY = 0;
180
+ }
181
+ }
182
+ } else {
183
+ velocityY = 0;
184
+ }
185
+ lastX = e.clientX;
186
+ lastY = e.clientY;
187
+ lastMoveTime = currentTime;
188
+ e.preventDefault();
189
+ }
190
+ function onMouseUp() {
191
+ if (!isDragging) return;
192
+ isDragging = false;
193
+ stopAutoScroll();
194
+ containerEl.style.cursor = "";
195
+ }
196
+ containerEl.addEventListener("mousedown", onMouseDown);
197
+ window.addEventListener("mousemove", onMouseMove);
198
+ window.addEventListener("mouseup", onMouseUp);
199
+ return function () {
200
+ stopAutoScroll();
201
+ containerEl.removeEventListener("mousedown", onMouseDown);
202
+ window.removeEventListener("mousemove", onMouseMove);
203
+ window.removeEventListener("mouseup", onMouseUp);
204
+ };
205
+ }
65
206
  function handleMobileScroll(containerEl, scrollHandler, getPixelScale) {
66
207
  var isScrolling = false;
67
208
  var gestureStartClientX = 0;
@@ -210,9 +351,13 @@ export var useSmoothScroll = function useSmoothScroll(scrollContainerRef) {
210
351
  var unmountMobileScrollHandler = handleMobileScroll(scrollContainerEl, scrollHandler, function () {
211
352
  return (window.devicePixelRatio || 1) * context.zoomRatio;
212
353
  });
354
+ var unmountMouseDragHandler = handleMouseDragScroll(scrollContainerEl, scrollHandler, function () {
355
+ return (window.devicePixelRatio || 1) * context.zoomRatio;
356
+ });
213
357
  return function () {
214
358
  unmountScrollHandler();
215
359
  unmountMobileScrollHandler();
360
+ unmountMouseDragHandler();
216
361
  };
217
362
  }
218
363
  useEffect(function () {