rsuite 5.79.0 → 5.80.0

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 (80) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/cjs/Calendar/Calendar.js +1 -2
  3. package/cjs/Calendar/CalendarBody.js +0 -2
  4. package/cjs/Calendar/CalendarContainer.js +1 -2
  5. package/cjs/Calendar/CalendarProvider.d.ts +1 -1
  6. package/cjs/Calendar/Grid/GridHeaderRow.js +1 -2
  7. package/cjs/Calendar/Grid/GridRow.d.ts +2 -0
  8. package/cjs/Calendar/Grid/GridRow.js +6 -4
  9. package/cjs/Calendar/hooks/useCalendar.d.ts +25 -2
  10. package/cjs/Calendar/hooks/useCalendar.js +36 -1
  11. package/cjs/CustomProvider/CustomContext.d.ts +253 -0
  12. package/cjs/CustomProvider/CustomContext.js +8 -0
  13. package/cjs/CustomProvider/CustomProvider.d.ts +1 -258
  14. package/cjs/CustomProvider/CustomProvider.js +2 -3
  15. package/cjs/CustomProvider/FormattedDate.js +2 -2
  16. package/cjs/CustomProvider/FormattedNumber.js +2 -2
  17. package/cjs/CustomProvider/index.d.ts +2 -2
  18. package/cjs/CustomProvider/index.js +4 -4
  19. package/cjs/CustomProvider/useCustom.js +2 -2
  20. package/cjs/DatePicker/DatePicker.js +1 -2
  21. package/cjs/DateRangePicker/DateRangePicker.js +1 -2
  22. package/cjs/DateRangePicker/utils.d.ts +1 -1
  23. package/cjs/DateRangePicker/utils.js +2 -1
  24. package/cjs/Image/hooks/useImage.js +2 -3
  25. package/cjs/InlineEdit/InlineEdit.js +3 -1
  26. package/cjs/InlineEdit/useEditState.d.ts +2 -0
  27. package/cjs/InlineEdit/useEditState.js +9 -1
  28. package/cjs/List/List.js +6 -2
  29. package/cjs/List/helper/useSortHelper.d.ts +7 -5
  30. package/cjs/List/helper/useSortHelper.js +109 -16
  31. package/cjs/List/helper/utils.js +15 -7
  32. package/cjs/internals/Picker/propTypes.d.ts +2 -2
  33. package/cjs/internals/hooks/useClassNames.js +2 -2
  34. package/cjs/internals/utils/date/getWeekStartDates.d.ts +0 -1
  35. package/cjs/internals/utils/date/getWeekStartDates.js +2 -5
  36. package/cjs/internals/utils/date/index.d.ts +1 -0
  37. package/cjs/internals/utils/date/index.js +4 -1
  38. package/cjs/useToaster/useToaster.js +2 -2
  39. package/dist/rsuite.js +69 -25
  40. package/dist/rsuite.js.map +1 -1
  41. package/dist/rsuite.min.js +1 -1
  42. package/dist/rsuite.min.js.map +1 -1
  43. package/esm/Calendar/Calendar.js +1 -2
  44. package/esm/Calendar/CalendarBody.js +0 -2
  45. package/esm/Calendar/CalendarContainer.js +1 -2
  46. package/esm/Calendar/CalendarProvider.d.ts +1 -1
  47. package/esm/Calendar/Grid/GridHeaderRow.js +1 -2
  48. package/esm/Calendar/Grid/GridRow.d.ts +2 -0
  49. package/esm/Calendar/Grid/GridRow.js +6 -4
  50. package/esm/Calendar/hooks/useCalendar.d.ts +25 -2
  51. package/esm/Calendar/hooks/useCalendar.js +36 -2
  52. package/esm/CustomProvider/CustomContext.d.ts +253 -0
  53. package/esm/CustomProvider/CustomContext.js +3 -0
  54. package/esm/CustomProvider/CustomProvider.d.ts +1 -258
  55. package/esm/CustomProvider/CustomProvider.js +1 -1
  56. package/esm/CustomProvider/FormattedDate.js +1 -1
  57. package/esm/CustomProvider/FormattedNumber.js +1 -1
  58. package/esm/CustomProvider/index.d.ts +2 -2
  59. package/esm/CustomProvider/index.js +1 -1
  60. package/esm/CustomProvider/useCustom.js +1 -1
  61. package/esm/DatePicker/DatePicker.js +1 -2
  62. package/esm/DateRangePicker/DateRangePicker.js +1 -2
  63. package/esm/DateRangePicker/utils.d.ts +1 -1
  64. package/esm/DateRangePicker/utils.js +2 -1
  65. package/esm/Image/hooks/useImage.js +1 -1
  66. package/esm/InlineEdit/InlineEdit.js +3 -1
  67. package/esm/InlineEdit/useEditState.d.ts +2 -0
  68. package/esm/InlineEdit/useEditState.js +9 -1
  69. package/esm/List/List.js +6 -2
  70. package/esm/List/helper/useSortHelper.d.ts +7 -5
  71. package/esm/List/helper/useSortHelper.js +109 -16
  72. package/esm/List/helper/utils.js +15 -7
  73. package/esm/internals/Picker/propTypes.d.ts +2 -2
  74. package/esm/internals/hooks/useClassNames.js +1 -1
  75. package/esm/internals/utils/date/getWeekStartDates.d.ts +0 -1
  76. package/esm/internals/utils/date/getWeekStartDates.js +2 -5
  77. package/esm/internals/utils/date/index.d.ts +1 -0
  78. package/esm/internals/utils/date/index.js +1 -0
  79. package/esm/useToaster/useToaster.js +1 -1
  80. package/package.json +2 -2
@@ -7,8 +7,8 @@ import IconProvider from '@rsuite/icons/IconProvider';
7
7
  import { usePortal, useIsomorphicLayoutEffect } from "../internals/hooks/index.js";
8
8
  import { getClassNamePrefix, prefix } from "../internals/utils/prefix.js";
9
9
  import { addClass, removeClass, canUseDOM } from "../DOMHelper/index.js";
10
+ import { CustomContext } from "./CustomContext.js";
10
11
  import ToastContainer, { toastPlacements, defaultToasterContainer } from "../toaster/ToastContainer.js";
11
- export var CustomContext = /*#__PURE__*/React.createContext({});
12
12
  var themes = ['light', 'dark', 'high-contrast'];
13
13
 
14
14
  /**
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import React from 'react';
3
- import { useCustom } from "./useCustom.js";
3
+ import { useCustom } from "./index.js";
4
4
  export function FormattedDate(_ref) {
5
5
  var date = _ref.date,
6
6
  formatStr = _ref.formatStr;
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import React, { useMemo } from 'react';
3
- import { useCustom } from "./useCustom.js";
3
+ import { useCustom } from "./index.js";
4
4
  export function FormattedNumber(_ref) {
5
5
  var value = _ref.value,
6
6
  formatOptions = _ref.formatOptions;
@@ -2,7 +2,7 @@ import CustomProvider from './CustomProvider';
2
2
  export { FormattedDate } from './FormattedDate';
3
3
  export { FormattedNumber } from './FormattedNumber';
4
4
  export { useCustom } from './useCustom';
5
- export { CustomContext } from './CustomProvider';
6
- export type { CustomProviderProps } from './CustomProvider';
5
+ export { CustomContext } from './CustomContext';
6
+ export type { CustomProviderProps } from './CustomContext';
7
7
  export type { ReactSuiteComponents } from './types';
8
8
  export default CustomProvider;
@@ -3,5 +3,5 @@ import CustomProvider from "./CustomProvider.js";
3
3
  export { FormattedDate } from "./FormattedDate.js";
4
4
  export { FormattedNumber } from "./FormattedNumber.js";
5
5
  export { useCustom } from "./useCustom.js";
6
- export { CustomContext } from "./CustomProvider.js";
6
+ export { CustomContext } from "./CustomContext.js";
7
7
  export default CustomProvider;
@@ -6,7 +6,7 @@ import { useContext, useCallback, useMemo } from 'react';
6
6
  import assign from 'lodash/assign';
7
7
  import enGB from "../locales/en_GB.js";
8
8
  import { format, parse, isValid } from "../internals/utils/date/index.js";
9
- import { CustomContext } from "./CustomProvider.js";
9
+ import { CustomContext } from "./CustomContext.js";
10
10
  function getDefaultRTL() {
11
11
  return typeof document !== 'undefined' && (document.body.getAttribute('dir') || document.dir) === 'rtl';
12
12
  }
@@ -56,8 +56,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
56
56
  format = propsWithDefaults.format,
57
57
  idProp = propsWithDefaults.id,
58
58
  isoWeek = propsWithDefaults.isoWeek,
59
- _propsWithDefaults$we = propsWithDefaults.weekStart,
60
- weekStart = _propsWithDefaults$we === void 0 ? 0 : _propsWithDefaults$we,
59
+ weekStart = propsWithDefaults.weekStart,
61
60
  _propsWithDefaults$li = propsWithDefaults.limitEndYear,
62
61
  limitEndYear = _propsWithDefaults$li === void 0 ? 1000 : _propsWithDefaults$li,
63
62
  limitStartYear = propsWithDefaults.limitStartYear,
@@ -67,8 +67,7 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
67
67
  idProp = propsWithDefaults.id,
68
68
  _propsWithDefaults$is = propsWithDefaults.isoWeek,
69
69
  isoWeek = _propsWithDefaults$is === void 0 ? false : _propsWithDefaults$is,
70
- _propsWithDefaults$we = propsWithDefaults.weekStart,
71
- weekStart = _propsWithDefaults$we === void 0 ? 0 : _propsWithDefaults$we,
70
+ weekStart = propsWithDefaults.weekStart,
72
71
  _propsWithDefaults$li = propsWithDefaults.limitEndYear,
73
72
  limitEndYear = _propsWithDefaults$li === void 0 ? 1000 : _propsWithDefaults$li,
74
73
  limitStartYear = propsWithDefaults.limitStartYear,
@@ -9,6 +9,6 @@ export declare const isSameRange: (source: DateRange | null, dest: DateRange | n
9
9
  export declare const getMonthHoverRange: (date: Date) => DateRange;
10
10
  export declare const getWeekHoverRange: (date: Date, options: {
11
11
  isoWeek: boolean;
12
- weekStart: 0 | 1 | 2 | 3 | 4 | 5 | 6;
12
+ weekStart?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
13
13
  locale?: Locale;
14
14
  }) => DateRange;
@@ -46,7 +46,8 @@ export var getMonthHoverRange = function getMonthHoverRange(date) {
46
46
  };
47
47
  export var getWeekHoverRange = function getWeekHoverRange(date, options) {
48
48
  var isoWeek = options.isoWeek,
49
- weekStart = options.weekStart,
49
+ _options$weekStart = options.weekStart,
50
+ weekStart = _options$weekStart === void 0 ? 0 : _options$weekStart,
50
51
  locale = options.locale;
51
52
  if (isoWeek) {
52
53
  // set to the first day of this week according to ISO 8601, 12:00 am
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { useState, useEffect, useRef, useCallback } from 'react';
3
- import useIsomorphicLayoutEffect from "../../internals/hooks/useIsomorphicLayoutEffect.js";
3
+ import { useIsomorphicLayoutEffect } from "../../internals/hooks/index.js";
4
4
  export var useImage = function useImage(props) {
5
5
  var src = props.src,
6
6
  fallbackSrc = props.fallbackSrc,
@@ -44,6 +44,7 @@ var InlineEdit = /*#__PURE__*/React.forwardRef(function (props, ref) {
44
44
  onChange = _useEditState.onChange,
45
45
  onKeyDown = _useEditState.onKeyDown,
46
46
  onClick = _useEditState.onClick,
47
+ onFocus = _useEditState.onFocus,
47
48
  htmlProps = _useEditState.htmlProps;
48
49
  var _useFocusEvent = useFocusEvent({
49
50
  isEditing: isEditing,
@@ -70,7 +71,8 @@ var InlineEdit = /*#__PURE__*/React.forwardRef(function (props, ref) {
70
71
  disabled: disabled
71
72
  })),
72
73
  onClick: onClick,
73
- onKeyDown: onKeyDown
74
+ onKeyDown: onKeyDown,
75
+ onFocus: onFocus
74
76
  }, htmlProps), renderChildren(children, childrenProps, target), showControls && isEditing && /*#__PURE__*/React.createElement(EditableControls, {
75
77
  className: prefix('controls'),
76
78
  onSave: onSave,
@@ -8,12 +8,14 @@ interface EditStateProps {
8
8
  onCancel?: (event?: React.MouseEvent) => void;
9
9
  onSave?: (event?: React.MouseEvent) => void;
10
10
  onClick?: (event: React.SyntheticEvent) => void;
11
+ onFocus?: (event?: React.FocusEvent) => void;
11
12
  }
12
13
  declare const useEditState: (props: EditStateProps) => {
13
14
  isEditing: boolean;
14
15
  value: any;
15
16
  onClick: (...args: any[]) => any;
16
17
  onChange: (...args: any[]) => any;
18
+ onFocus: (...args: any[]) => any;
17
19
  onCancel: (...args: any[]) => any;
18
20
  onSave: (...args: any[]) => any;
19
21
  onKeyDown: (...args: any[]) => any;
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- var _excluded = ["value", "defaultValue", "disabled", "onChange", "onEdit", "onCancel", "onSave", "onClick"];
3
+ var _excluded = ["value", "defaultValue", "disabled", "onChange", "onEdit", "onCancel", "onSave", "onClick", "onFocus"];
4
4
  import { useState } from 'react';
5
5
  import { useEventCallback, useControlled } from "../internals/hooks/index.js";
6
6
  var useEditState = function useEditState(props) {
@@ -12,6 +12,7 @@ var useEditState = function useEditState(props) {
12
12
  onCancel = props.onCancel,
13
13
  onSave = props.onSave,
14
14
  onClick = props.onClick,
15
+ onFocus = props.onFocus,
15
16
  htmlProps = _objectWithoutPropertiesLoose(props, _excluded);
16
17
  var _useState = useState(false),
17
18
  isEditing = _useState[0],
@@ -33,6 +34,12 @@ var useEditState = function useEditState(props) {
33
34
  setIsEditing(true);
34
35
  setResetValue(value);
35
36
  });
37
+ var handleFocus = useEventCallback(function (event) {
38
+ if (disabled) return;
39
+ onFocus === null || onFocus === void 0 || onFocus(event);
40
+ setIsEditing(true);
41
+ setResetValue(value);
42
+ });
36
43
  var handleChange = useEventCallback(function (value, event) {
37
44
  setValue(value);
38
45
  onChange === null || onChange === void 0 || onChange(value, event);
@@ -70,6 +77,7 @@ var useEditState = function useEditState(props) {
70
77
  value: value,
71
78
  onClick: handleClick,
72
79
  onChange: handleChange,
80
+ onFocus: handleFocus,
73
81
  onCancel: handleCancel,
74
82
  onSave: handleSave,
75
83
  onKeyDown: handleKeyDown,
package/esm/List/List.js CHANGED
@@ -58,7 +58,9 @@ var List = /*#__PURE__*/React.forwardRef(function (props, ref) {
58
58
  register = _useSortHelper.register,
59
59
  sorting = _useSortHelper.sorting,
60
60
  handleEnd = _useSortHelper.handleEnd,
61
- handleStart = _useSortHelper.handleStart;
61
+ handleStart = _useSortHelper.handleStart,
62
+ handleTouchStart = _useSortHelper.handleTouchStart,
63
+ handleTouchEnd = _useSortHelper.handleTouchEnd;
62
64
  var classes = merge(className, withClassPrefix({
63
65
  bordered: bordered,
64
66
  sortable: sortable,
@@ -79,7 +81,9 @@ var List = /*#__PURE__*/React.forwardRef(function (props, ref) {
79
81
  ref: mergeRefs(containerRef, ref),
80
82
  className: classes,
81
83
  onMouseDown: sortable ? handleStart : undefined,
82
- onMouseUp: sortable ? handleEnd : undefined
84
+ onMouseUp: sortable ? handleEnd : undefined,
85
+ onTouchStart: sortable ? handleTouchStart : undefined,
86
+ onTouchEnd: sortable ? handleTouchEnd : undefined
83
87
  }), /*#__PURE__*/React.createElement(ListContext.Provider, {
84
88
  value: contextValue
85
89
  }, children));
@@ -1,4 +1,4 @@
1
- import { MouseEventHandler } from 'react';
1
+ import { MouseEventHandler, TouchEventHandler } from 'react';
2
2
  import { Collection, ManagedItem } from './useManager';
3
3
  export interface MovedItemInfo {
4
4
  collection: Collection;
@@ -10,14 +10,16 @@ export type SortConfig = {
10
10
  autoScroll?: boolean;
11
11
  pressDelay?: number;
12
12
  transitionDuration?: number;
13
- onSortStart?(payload?: MovedItemInfo, event?: MouseEvent): void;
14
- onSortMove?(payload?: MovedItemInfo, event?: MouseEvent): void;
15
- onSortEnd?(payload?: MovedItemInfo, event?: MouseEvent): void;
16
- onSort?(payload?: MovedItemInfo, event?: MouseEvent): void;
13
+ onSortStart?(payload?: MovedItemInfo, event?: MouseEvent | TouchEvent): void;
14
+ onSortMove?(payload?: MovedItemInfo, event?: MouseEvent | TouchEvent): void;
15
+ onSortEnd?(payload?: MovedItemInfo, event?: MouseEvent | TouchEvent): void;
16
+ onSort?(payload?: MovedItemInfo, event?: MouseEvent | TouchEvent): void;
17
17
  };
18
18
  declare const useSortHelper: (config: SortConfig) => {
19
19
  handleStart: MouseEventHandler<Element>;
20
20
  handleEnd: MouseEventHandler<Element>;
21
+ handleTouchStart: TouchEventHandler<Element>;
22
+ handleTouchEnd: TouchEventHandler<Element>;
21
23
  containerRef: import("react").RefObject<HTMLDivElement>;
22
24
  sorting: boolean;
23
25
  register: (item: ManagedItem) => {
@@ -32,7 +32,7 @@ var useSortHelper = function useSortHelper(config) {
32
32
  /**
33
33
  * start dragging
34
34
  * */
35
- var handlePress = useCallback(function (mouseDownEvent, _targetNode, curManagedItem) {
35
+ var handlePress = useCallback(function (event, _targetNode, curManagedItem) {
36
36
  var _curManagedItem$info$, _curManagedItem$info$2, _activeNodeHelper;
37
37
  if (!isMounted()) return;
38
38
  // data
@@ -46,6 +46,13 @@ var useSortHelper = function useSortHelper(config) {
46
46
  };
47
47
  var animatedNodesOffset = []; // all list item offset
48
48
 
49
+ // Get initial position from event
50
+ var isTouchEvent = 'touches' in event;
51
+ var initialPosition = {
52
+ pageX: isTouchEvent ? event.touches[0].pageX : event.pageX,
53
+ pageY: isTouchEvent ? event.touches[0].pageY : event.pageY
54
+ };
55
+
49
56
  // init scroller
50
57
  var scrollContainer = getScrollingParent(containerElement) || containerElement;
51
58
  var initScroll = {
@@ -87,17 +94,31 @@ var useSortHelper = function useSortHelper(config) {
87
94
  y: 0
88
95
  });
89
96
  };
90
- var sortMouseMoveListener = on(window, 'mousemove', function (mouseOverEvent) {
97
+
98
+ // Common handler for both mouse and touch move events
99
+ var handleSortMove = function handleSortMove(moveEvent) {
100
+ // Prevent default to stop page scrolling during touch drag
101
+ if ('touches' in moveEvent) {
102
+ moveEvent.preventDefault();
103
+ }
104
+
105
+ // Get current position from event
106
+ var isTouchMoveEvent = 'touches' in moveEvent;
107
+ var currentPosition = {
108
+ pageX: isTouchMoveEvent ? moveEvent.touches[0].pageX : moveEvent.pageX,
109
+ pageY: isTouchMoveEvent ? moveEvent.touches[0].pageY : moveEvent.pageY
110
+ };
111
+
91
112
  // Update helper position
92
113
  var offset = {
93
- x: (mouseOverEvent === null || mouseOverEvent === void 0 ? void 0 : mouseOverEvent.pageX) || 0,
94
- y: (mouseOverEvent === null || mouseOverEvent === void 0 ? void 0 : mouseOverEvent.pageY) || 0
114
+ x: currentPosition.pageX,
115
+ y: currentPosition.pageY
95
116
  };
96
117
  var containerScrollDelta = getContainerScrollDelta();
97
118
  var containerBoundingRect = scrollContainer.getBoundingClientRect();
98
119
  activeNodeHolderTranslate = {
99
- x: offset.x - mouseDownEvent.pageX,
100
- y: offset.y - mouseDownEvent.pageY
120
+ x: offset.x - initialPosition.pageX,
121
+ y: offset.y - initialPosition.pageY
101
122
  };
102
123
  if (activeNodeHelper) {
103
124
  setTranslate3d(activeNodeHelper, activeNodeHolderTranslate);
@@ -197,14 +218,22 @@ var useSortHelper = function useSortHelper(config) {
197
218
  node: activeNode,
198
219
  oldIndex: activeNodeOldIndex,
199
220
  newIndex: activeNodeNextIndex
200
- }, mouseOverEvent);
201
- }, {
202
- passive: false
203
- });
204
- var sortMouseEndListener = on(window, 'mouseup', function (event) {
221
+ }, moveEvent);
222
+ };
223
+
224
+ // Common handler for both mouse and touch end events
225
+ var handleSortEnd = function handleSortEnd(endEvent) {
226
+ var _sortTouchMoveListene, _sortTouchEndListener;
205
227
  // Remove the event listeners
206
228
  sortMouseMoveListener.off();
207
229
  sortMouseEndListener.off();
230
+ (_sortTouchMoveListene = sortTouchMoveListener) === null || _sortTouchMoveListene === void 0 || _sortTouchMoveListene.off();
231
+ (_sortTouchEndListener = sortTouchEndListener) === null || _sortTouchEndListener === void 0 || _sortTouchEndListener.off();
232
+
233
+ // Enable page scrolling again
234
+ if (document.body.style.overflow === 'hidden') {
235
+ document.body.style.overflow = '';
236
+ }
208
237
  var holderTranslate = getHolderTranslate();
209
238
  var containerScrollDelta = getContainerScrollDelta();
210
239
  if (activeNodeHelper) {
@@ -251,12 +280,33 @@ var useSortHelper = function useSortHelper(config) {
251
280
  newIndex: activeNodeNextIndex,
252
281
  oldIndex: activeNodeOldIndex
253
282
  };
254
- onSortEnd === null || onSortEnd === void 0 || onSortEnd(callbackPayload, event);
255
- onSort === null || onSort === void 0 || onSort(callbackPayload, event);
283
+ onSortEnd === null || onSortEnd === void 0 || onSortEnd(callbackPayload, endEvent);
284
+ onSort === null || onSort === void 0 || onSort(callbackPayload, endEvent);
256
285
  }, transitionDuration);
257
- }, {
286
+ };
287
+
288
+ // Set up mouse event listeners
289
+ var sortMouseMoveListener = on(window, 'mousemove', handleSortMove, {
290
+ passive: false
291
+ });
292
+ var sortMouseEndListener = on(window, 'mouseup', handleSortEnd, {
258
293
  passive: false
259
294
  });
295
+
296
+ // Set up touch event listeners
297
+ var sortTouchMoveListener;
298
+ var sortTouchEndListener;
299
+ if (isTouchEvent) {
300
+ // Disable page scrolling during touch drag
301
+ document.body.style.overflow = 'hidden';
302
+ sortTouchMoveListener = on(window, 'touchmove', handleSortMove, {
303
+ passive: false
304
+ } // Important: passive: false allows preventDefault() to work
305
+ );
306
+ sortTouchEndListener = on(window, 'touchend', handleSortEnd, {
307
+ passive: false
308
+ });
309
+ }
260
310
  setSorting(true);
261
311
  // start callback
262
312
  onSortStart === null || onSortStart === void 0 || onSortStart({
@@ -264,7 +314,7 @@ var useSortHelper = function useSortHelper(config) {
264
314
  node: activeNode,
265
315
  oldIndex: activeNodeOldIndex,
266
316
  newIndex: activeNodeNextIndex
267
- }, mouseDownEvent.nativeEvent);
317
+ }, event);
268
318
  }, [autoScroll, getOrderedItems, isMounted, onSort, onSortEnd, onSortMove, onSortStart, transitionDuration]);
269
319
 
270
320
  /**
@@ -292,15 +342,58 @@ var useSortHelper = function useSortHelper(config) {
292
342
  }
293
343
  }, [getManagedItem, handlePress, pressDelay, sorting]);
294
344
 
345
+ /**
346
+ * Handle touch start for mobile devices
347
+ */
348
+ var handleTouchStart = useCallback(function (touchStartEvent) {
349
+ var triggeredNode = touchStartEvent.target;
350
+ var targetNode = closestNode(triggeredNode, function (el) {
351
+ return Boolean(getManagedItem(el));
352
+ });
353
+ var curManagedItem = getManagedItem(targetNode);
354
+ if (
355
+ // is list item
356
+ Boolean(curManagedItem) && !curManagedItem.info.disabled &&
357
+ // is not sorting
358
+ !sorting &&
359
+ // is valid node
360
+ targetNode instanceof HTMLElement &&
361
+ // excludes interactive elements
362
+ !targetNode.contains(closestNode(triggeredNode, isContainInteractiveElement))) {
363
+ // Prevent scrolling while sorting
364
+ touchStartEvent.preventDefault();
365
+ pressTimer.current = setTimeout(handlePress, pressDelay, touchStartEvent, targetNode, curManagedItem);
366
+ }
367
+ }, [getManagedItem, handlePress, pressDelay, sorting]);
368
+
295
369
  /**
296
370
  * Clear timer after drag
297
371
  * */
298
372
  var handleEnd = useCallback(function () {
299
- return clearTimeout(pressTimer.current);
373
+ clearTimeout(pressTimer.current);
374
+
375
+ // Ensure page scrolling is re-enabled
376
+ if (document.body.style.overflow === 'hidden') {
377
+ document.body.style.overflow = '';
378
+ }
379
+ }, []);
380
+
381
+ /**
382
+ * Clear timer after touch end
383
+ */
384
+ var handleTouchEnd = useCallback(function () {
385
+ clearTimeout(pressTimer.current);
386
+
387
+ // Ensure page scrolling is re-enabled
388
+ if (document.body.style.overflow === 'hidden') {
389
+ document.body.style.overflow = '';
390
+ }
300
391
  }, []);
301
392
  return {
302
393
  handleStart: handleStart,
303
394
  handleEnd: handleEnd,
395
+ handleTouchStart: handleTouchStart,
396
+ handleTouchEnd: handleTouchEnd,
304
397
  containerRef: containerRef,
305
398
  sorting: sorting,
306
399
  register: listItemRegister
@@ -62,12 +62,20 @@ export function getEdgeOffset(node, parent, offset) {
62
62
  return getEdgeOffset(node.parentNode, parent, nodeOffset);
63
63
  }
64
64
  export function getScrollingParent(el) {
65
- return closestNode(el, function (el) {
66
- var computedStyle = window.getComputedStyle(el);
67
- var overflowRegex = /(auto|scroll)/;
68
- var properties = ['overflow', 'overflowX', 'overflowY'];
69
- return properties.some(function (property) {
70
- return overflowRegex.test(computedStyle[property]);
65
+ if (!el || typeof window === 'undefined' || !window.getComputedStyle) {
66
+ return null;
67
+ }
68
+ try {
69
+ return closestNode(el, function (el) {
70
+ var computedStyle = window.getComputedStyle(el);
71
+ var overflowRegex = /(auto|scroll)/;
72
+ var properties = ['overflow', 'overflowX', 'overflowY'];
73
+ return properties.some(function (property) {
74
+ return overflowRegex.test(computedStyle[property]);
75
+ });
71
76
  });
72
- });
77
+ } catch (error) {
78
+ // In test environments, errors may occur, so return null
79
+ return null;
80
+ }
73
81
  }
@@ -12,7 +12,7 @@ export declare const pickerPropTypes: {
12
12
  menuClassName: PropTypes.Requireable<string>;
13
13
  menuStyle: PropTypes.Requireable<object>;
14
14
  placeholder: PropTypes.Requireable<PropTypes.ReactNodeLike>;
15
- placement: PropTypes.Requireable<"left" | "right" | "top" | "bottom" | "bottomStart" | "bottomEnd" | "topStart" | "topEnd" | "leftStart" | "rightStart" | "leftEnd" | "rightEnd" | "auto" | "autoVertical" | "autoVerticalStart" | "autoVerticalEnd" | "autoHorizontal" | "autoHorizontalStart" | "autoHorizontalEnd">;
15
+ placement: PropTypes.Requireable<"top" | "bottom" | "right" | "left" | "bottomStart" | "bottomEnd" | "topStart" | "topEnd" | "leftStart" | "rightStart" | "leftEnd" | "rightEnd" | "auto" | "autoVertical" | "autoVerticalStart" | "autoVerticalEnd" | "autoHorizontal" | "autoHorizontalStart" | "autoHorizontalEnd">;
16
16
  preventOverflow: PropTypes.Requireable<boolean>;
17
17
  open: PropTypes.Requireable<boolean>;
18
18
  defaultOpen: PropTypes.Requireable<boolean>;
@@ -51,7 +51,7 @@ export declare const listPickerPropTypes: {
51
51
  menuClassName: PropTypes.Requireable<string>;
52
52
  menuStyle: PropTypes.Requireable<object>;
53
53
  placeholder: PropTypes.Requireable<PropTypes.ReactNodeLike>;
54
- placement: PropTypes.Requireable<"left" | "right" | "top" | "bottom" | "bottomStart" | "bottomEnd" | "topStart" | "topEnd" | "leftStart" | "rightStart" | "leftEnd" | "rightEnd" | "auto" | "autoVertical" | "autoVerticalStart" | "autoVerticalEnd" | "autoHorizontal" | "autoHorizontalStart" | "autoHorizontalEnd">;
54
+ placement: PropTypes.Requireable<"top" | "bottom" | "right" | "left" | "bottomStart" | "bottomEnd" | "topStart" | "topEnd" | "leftStart" | "rightStart" | "leftEnd" | "rightEnd" | "auto" | "autoVertical" | "autoVerticalStart" | "autoVerticalEnd" | "autoHorizontal" | "autoHorizontalStart" | "autoHorizontalEnd">;
55
55
  preventOverflow: PropTypes.Requireable<boolean>;
56
56
  open: PropTypes.Requireable<boolean>;
57
57
  defaultOpen: PropTypes.Requireable<boolean>;
@@ -2,7 +2,7 @@
2
2
  import { useCallback, useContext } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { prefix as addPrefix } from "../utils/prefix.js";
5
- import { CustomContext } from "../../CustomProvider/CustomProvider.js";
5
+ import { CustomContext } from "../../CustomProvider/CustomContext.js";
6
6
 
7
7
  // This is the only way I found to break circular references between ClassArray and ClassValue
8
8
  // https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
@@ -8,7 +8,6 @@ import type { Locale } from 'date-fns';
8
8
  */
9
9
  export declare function getWeekStartDates(firstDayOfMonth: Date, options: {
10
10
  weekStart?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
11
- isoWeek?: boolean;
12
11
  locale?: Locale;
13
12
  }): Date[];
14
13
  export default getWeekStartDates;
@@ -9,13 +9,10 @@ import startOfWeek from 'date-fns/startOfWeek';
9
9
  * @returns A list of first days of weeks in a month
10
10
  */
11
11
  export function getWeekStartDates(firstDayOfMonth, options) {
12
- var _options$weekStart = options.weekStart,
13
- weekStart = _options$weekStart === void 0 ? 0 : _options$weekStart,
14
- isoWeek = options.isoWeek,
12
+ var weekStart = options.weekStart,
15
13
  locale = options.locale;
16
- var weekStartsOn = isoWeek ? 1 : weekStart;
17
14
  var firstDay = startOfWeek(firstDayOfMonth, {
18
- weekStartsOn: weekStartsOn,
15
+ weekStartsOn: weekStart,
19
16
  locale: locale
20
17
  });
21
18
  var days = [firstDay];
@@ -44,6 +44,7 @@ export { default as differenceInCalendarMonths } from 'date-fns/differenceInCale
44
44
  export { default as isLastDayOfMonth } from 'date-fns/isLastDayOfMonth';
45
45
  export { default as lastDayOfMonth } from 'date-fns/lastDayOfMonth';
46
46
  export { default as startOfToday } from 'date-fns/startOfToday';
47
+ export { default as getISOWeek } from 'date-fns/getISOWeek';
47
48
  export { getWeekStartDates } from './getWeekStartDates';
48
49
  export { getWeekKeys } from './getWeekKeys';
49
50
  export { reverseDateRangeOmitTime } from './reverseDateRangeOmitTime';
@@ -46,6 +46,7 @@ export { default as differenceInCalendarMonths } from 'date-fns/differenceInCale
46
46
  export { default as isLastDayOfMonth } from 'date-fns/isLastDayOfMonth';
47
47
  export { default as lastDayOfMonth } from 'date-fns/lastDayOfMonth';
48
48
  export { default as startOfToday } from 'date-fns/startOfToday';
49
+ export { default as getISOWeek } from 'date-fns/getISOWeek';
49
50
 
50
51
  // Export custom functions
51
52
  export { getWeekStartDates } from "./getWeekStartDates.js";
@@ -3,7 +3,7 @@ import { useMemo, useContext } from 'react';
3
3
  import toaster from "../toaster/index.js";
4
4
  // From CustomProvider/CustomProvider.tsx import CustomContext instead of directly from 'CustomProvider/index.ts'
5
5
  // because babel compiles commonjs, which causes CustomContext to be undefined
6
- import { CustomContext } from "../CustomProvider/CustomProvider.js";
6
+ import { CustomContext } from "../CustomProvider/CustomContext.js";
7
7
  /**
8
8
  * Toaster display brief, temporary notifications of actions, errors, or other events in an application.
9
9
  * It is often used with the Message and Notification components.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsuite",
3
- "version": "5.79.0",
3
+ "version": "5.80.0",
4
4
  "description": "A suite of react components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -39,7 +39,7 @@
39
39
  "react-use-set": "^1.0.0",
40
40
  "react-window": "^1.8.8",
41
41
  "rsuite-table": "^5.19.1",
42
- "schema-typed": "^2.4.1"
42
+ "schema-typed": "^2.4.2"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": ">=16.8.0",