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
@@ -1,262 +1,5 @@
1
1
  import React from 'react';
2
- import { Locale } from '../locales';
3
- import { ToastContainerInstance } from '../toaster/ToastContainer';
4
- import type { FormatDateOptions } from '../internals/utils/date/types';
5
- import type { ReactSuiteComponents } from './types';
6
- export interface CustomValue<T = Locale> {
7
- /**
8
- * The prefix of the component CSS class
9
- */
10
- classPrefix?: string;
11
- /**
12
- * The locale object that contains the language and formatting rules for the date.
13
- */
14
- locale: T;
15
- /**
16
- * Right-to-left text direction.
17
- */
18
- rtl: boolean;
19
- /**
20
- * Return the formatted date string in the given format. The result may vary by locale.
21
- *
22
- * Example:
23
- *
24
- * import format from 'date-fns/format';
25
- * import eo from 'date-fns/locale/eo'
26
- *
27
- * function formatDate(date, formatStr) {
28
- * return format(date, formatStr, { locale: eo });
29
- * }
30
- *
31
- */
32
- formatDate: (date: Date | number, format: string, options?: FormatDateOptions) => string;
33
- /**
34
- * Return the date parsed from string using the given format string.
35
- *
36
- * Example:
37
- *
38
- * import parse from 'date-fns/parse';
39
- * import eo from 'date-fns/locale/eo'
40
- *
41
- * function parseDate(date, formatStr) {
42
- * return parse(date, formatStr, new Date(), { locale: eo });
43
- * }
44
- *
45
- */
46
- parseDate: (dateString: string, formatString: string, referenceDate?: Date | number, options?: FormatDateOptions) => Date;
47
- /**
48
- * A Map of toast containers
49
- */
50
- toasters?: React.MutableRefObject<Map<string, ToastContainerInstance>>;
51
- /**
52
- * If true, the ripple effect is disabled.
53
- * Affected components include: Button, Nav.Item, Pagination.
54
- */
55
- disableRipple?: boolean;
56
- }
57
- export interface CustomProviderProps<T = Locale> extends Partial<CustomValue<T>> {
58
- /**
59
- * Supported themes
60
- */
61
- theme?: 'light' | 'dark' | 'high-contrast';
62
- /**
63
- * The prefix of the icon CSS class
64
- */
65
- iconClassPrefix?: string;
66
- /**
67
- * Primary content
68
- */
69
- children?: React.ReactNode;
70
- /**
71
- * Sets a container for toast rendering
72
- */
73
- toastContainer?: HTMLElement | (() => HTMLElement | null) | null;
74
- csp?: {
75
- /**
76
- * Content Security Policy nonce
77
- * https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce
78
- */
79
- nonce?: string;
80
- };
81
- /**
82
- * Disable inline styles
83
- * @default false
84
- */
85
- disableInlineStyles?: boolean;
86
- /**
87
- * components allows setting default props for specific components globally.
88
- * It accepts an object where each key represents a component name (e.g., 'Button', 'Input'),
89
- * and the corresponding value is an object containing the `defaultProps` object.
90
- * The `defaultProps` object defines the default props for that component.
91
- * These props will be automatically applied to the component unless overridden by specific props
92
- * passed in an individual component instance.
93
- *
94
- * @example
95
- * ```js
96
- * components={{
97
- * Button: { defaultProps: { appearance: 'primary', size: 'lg' } },
98
- * Input: { defaultProps: { placeholder: 'Enter text', size: 'lg' } }
99
- * }}
100
- * ```
101
- */
102
- components?: Partial<ReactSuiteComponents>;
103
- }
104
- export declare const CustomContext: React.Context<CustomProviderProps<{
105
- code?: string | undefined;
106
- common?: {
107
- loading: string;
108
- emptyMessage: string;
109
- remove: string;
110
- clear: string;
111
- } | undefined;
112
- Plaintext?: {
113
- unfilled: string;
114
- notSelected: string;
115
- notUploaded: string;
116
- } | undefined;
117
- Pagination?: {
118
- more: string;
119
- prev: string;
120
- next: string;
121
- first: string;
122
- last: string;
123
- limit: string;
124
- total: string;
125
- skip: string;
126
- } | undefined;
127
- DateTimeFormats?: {
128
- sunday: string;
129
- monday: string;
130
- tuesday: string;
131
- wednesday: string;
132
- thursday: string;
133
- friday: string;
134
- saturday: string;
135
- ok: string;
136
- today: string;
137
- yesterday: string;
138
- now: string;
139
- hours: string;
140
- minutes: string;
141
- seconds: string;
142
- formattedMonthPattern: string;
143
- formattedDayPattern: string;
144
- shortDateFormat: string;
145
- shortTimeFormat: string;
146
- dateLocale: any;
147
- } | undefined;
148
- Calendar?: {
149
- sunday: string;
150
- monday: string;
151
- tuesday: string;
152
- wednesday: string;
153
- thursday: string;
154
- friday: string;
155
- saturday: string;
156
- ok: string;
157
- today: string;
158
- yesterday: string;
159
- now: string;
160
- hours: string;
161
- minutes: string;
162
- seconds: string;
163
- formattedMonthPattern: string;
164
- formattedDayPattern: string;
165
- shortDateFormat: string;
166
- shortTimeFormat: string;
167
- dateLocale: any;
168
- } | undefined;
169
- DatePicker?: {
170
- sunday: string;
171
- monday: string;
172
- tuesday: string;
173
- wednesday: string;
174
- thursday: string;
175
- friday: string;
176
- saturday: string;
177
- ok: string;
178
- today: string;
179
- yesterday: string;
180
- now: string;
181
- hours: string;
182
- minutes: string;
183
- seconds: string;
184
- formattedMonthPattern: string;
185
- formattedDayPattern: string;
186
- shortDateFormat: string;
187
- shortTimeFormat: string;
188
- dateLocale: any;
189
- } | undefined;
190
- DateRangePicker?: {
191
- last7Days: string;
192
- sunday: string;
193
- monday: string;
194
- tuesday: string;
195
- wednesday: string;
196
- thursday: string;
197
- friday: string;
198
- saturday: string;
199
- ok: string;
200
- today: string;
201
- yesterday: string;
202
- now: string;
203
- hours: string;
204
- minutes: string;
205
- seconds: string;
206
- formattedMonthPattern: string;
207
- formattedDayPattern: string;
208
- shortDateFormat: string;
209
- shortTimeFormat: string;
210
- dateLocale: any;
211
- } | undefined;
212
- Combobox?: {
213
- noResultsText: string;
214
- placeholder: string; /**
215
- * The locale object that contains the language and formatting rules for the date.
216
- */
217
- searchPlaceholder: string;
218
- checkAll: string;
219
- } | undefined;
220
- InputPicker?: {
221
- newItem: string;
222
- createOption: string;
223
- noResultsText: string;
224
- placeholder: string; /**
225
- * The locale object that contains the language and formatting rules for the date.
226
- */
227
- searchPlaceholder: string;
228
- checkAll: string;
229
- } | undefined;
230
- TagPicker?: {
231
- newItem: string;
232
- createOption: string;
233
- noResultsText: string;
234
- placeholder: string; /**
235
- * The locale object that contains the language and formatting rules for the date.
236
- */
237
- searchPlaceholder: string;
238
- checkAll: string;
239
- } | undefined;
240
- Uploader?: {
241
- inited: string;
242
- progress: string;
243
- error: string;
244
- complete: string;
245
- emptyFile: string;
246
- upload: string;
247
- removeFile: string;
248
- } | undefined;
249
- CloseButton?: {
250
- closeLabel: string;
251
- } | undefined;
252
- Breadcrumb?: {
253
- expandText: string;
254
- } | undefined;
255
- Toggle?: {
256
- on: string;
257
- off: string;
258
- } | undefined;
259
- }>>;
2
+ import { CustomProviderProps } from './CustomContext';
260
3
  /**
261
4
  * CustomProvider is used to provide global configuration, such as language, theme, etc.
262
5
  *
@@ -3,7 +3,6 @@
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
5
  exports.__esModule = true;
6
- exports.CustomContext = void 0;
7
6
  exports.default = CustomProvider;
8
7
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
8
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
@@ -12,11 +11,11 @@ var _IconProvider = _interopRequireDefault(require("@rsuite/icons/IconProvider")
12
11
  var _hooks = require("../internals/hooks");
13
12
  var _prefix = require("../internals/utils/prefix");
14
13
  var _DOMHelper = require("../DOMHelper");
14
+ var _CustomContext = require("./CustomContext");
15
15
  var _ToastContainer = _interopRequireWildcard(require("../toaster/ToastContainer"));
16
16
  var _excluded = ["children", "classPrefix", "components", "iconClassPrefix", "theme", "toastContainer", "disableRipple", "csp", "disableInlineStyles"];
17
17
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
18
18
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
19
- var CustomContext = exports.CustomContext = /*#__PURE__*/_react.default.createContext({});
20
19
  var themes = ['light', 'dark', 'high-contrast'];
21
20
 
22
21
  /**
@@ -73,7 +72,7 @@ function CustomProvider(props) {
73
72
  });
74
73
  }
75
74
  }, [classPrefix, theme]);
76
- return /*#__PURE__*/_react.default.createElement(CustomContext.Provider, {
75
+ return /*#__PURE__*/_react.default.createElement(_CustomContext.CustomContext.Provider, {
77
76
  value: value
78
77
  }, /*#__PURE__*/_react.default.createElement(_IconProvider.default, {
79
78
  value: iconContext
@@ -6,11 +6,11 @@ exports.__esModule = true;
6
6
  exports.FormattedDate = FormattedDate;
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
- var _useCustom2 = require("./useCustom");
9
+ var _ = require("./");
10
10
  function FormattedDate(_ref) {
11
11
  var date = _ref.date,
12
12
  formatStr = _ref.formatStr;
13
- var _useCustom = (0, _useCustom2.useCustom)('Calendar'),
13
+ var _useCustom = (0, _.useCustom)('Calendar'),
14
14
  formatDate = _useCustom.formatDate;
15
15
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, formatDate(date, formatStr));
16
16
  }
@@ -4,13 +4,13 @@
4
4
  exports.__esModule = true;
5
5
  exports.FormattedNumber = FormattedNumber;
6
6
  var _react = _interopRequireWildcard(require("react"));
7
- var _useCustom2 = require("./useCustom");
7
+ var _ = require("./");
8
8
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
9
9
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
10
  function FormattedNumber(_ref) {
11
11
  var value = _ref.value,
12
12
  formatOptions = _ref.formatOptions;
13
- var _useCustom = (0, _useCustom2.useCustom)(),
13
+ var _useCustom = (0, _.useCustom)(),
14
14
  code = _useCustom.code;
15
15
  var formatter = (0, _react.useMemo)(function () {
16
16
  return new Intl.NumberFormat(code, 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;
@@ -1,16 +1,16 @@
1
1
  'use client';
2
2
  "use strict";
3
3
 
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
5
  exports.__esModule = true;
5
6
  exports.useCustom = exports.default = exports.FormattedNumber = exports.FormattedDate = exports.CustomContext = void 0;
6
- var _CustomProvider = _interopRequireWildcard(require("./CustomProvider"));
7
- exports.CustomContext = _CustomProvider.CustomContext;
7
+ var _CustomProvider = _interopRequireDefault(require("./CustomProvider"));
8
8
  var _FormattedDate = require("./FormattedDate");
9
9
  exports.FormattedDate = _FormattedDate.FormattedDate;
10
10
  var _FormattedNumber = require("./FormattedNumber");
11
11
  exports.FormattedNumber = _FormattedNumber.FormattedNumber;
12
12
  var _useCustom = require("./useCustom");
13
13
  exports.useCustom = _useCustom.useCustom;
14
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
15
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
+ var _CustomContext = require("./CustomContext");
15
+ exports.CustomContext = _CustomContext.CustomContext;
16
16
  var _default = exports.default = _CustomProvider.default;
@@ -11,7 +11,7 @@ var _react = require("react");
11
11
  var _assign = _interopRequireDefault(require("lodash/assign"));
12
12
  var _en_GB = _interopRequireDefault(require("../locales/en_GB"));
13
13
  var _date = require("../internals/utils/date");
14
- var _CustomProvider = require("./CustomProvider");
14
+ var _CustomContext = require("./CustomContext");
15
15
  var _excluded = ["locale"];
16
16
  function getDefaultRTL() {
17
17
  return typeof document !== 'undefined' && (document.body.getAttribute('dir') || document.dir) === 'rtl';
@@ -31,7 +31,7 @@ function toLocaleKey(componentName) {
31
31
  */
32
32
  function useCustom(componentName, componentProps) {
33
33
  var _globalLocale$DateTim;
34
- var _useContext = (0, _react.useContext)(_CustomProvider.CustomContext),
34
+ var _useContext = (0, _react.useContext)(_CustomContext.CustomContext),
35
35
  _useContext$component = _useContext.components,
36
36
  components = _useContext$component === void 0 ? {} : _useContext$component,
37
37
  _useContext$locale = _useContext.locale,
@@ -62,8 +62,7 @@ var DatePicker = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
62
62
  format = propsWithDefaults.format,
63
63
  idProp = propsWithDefaults.id,
64
64
  isoWeek = propsWithDefaults.isoWeek,
65
- _propsWithDefaults$we = propsWithDefaults.weekStart,
66
- weekStart = _propsWithDefaults$we === void 0 ? 0 : _propsWithDefaults$we,
65
+ weekStart = propsWithDefaults.weekStart,
67
66
  _propsWithDefaults$li = propsWithDefaults.limitEndYear,
68
67
  limitEndYear = _propsWithDefaults$li === void 0 ? 1000 : _propsWithDefaults$li,
69
68
  limitStartYear = propsWithDefaults.limitStartYear,
@@ -74,8 +74,7 @@ var DateRangePicker = /*#__PURE__*/_react.default.forwardRef(function (props, re
74
74
  idProp = propsWithDefaults.id,
75
75
  _propsWithDefaults$is = propsWithDefaults.isoWeek,
76
76
  isoWeek = _propsWithDefaults$is === void 0 ? false : _propsWithDefaults$is,
77
- _propsWithDefaults$we = propsWithDefaults.weekStart,
78
- weekStart = _propsWithDefaults$we === void 0 ? 0 : _propsWithDefaults$we,
77
+ weekStart = propsWithDefaults.weekStart,
79
78
  _propsWithDefaults$li = propsWithDefaults.limitEndYear,
80
79
  limitEndYear = _propsWithDefaults$li === void 0 ? 1000 : _propsWithDefaults$li,
81
80
  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;
@@ -52,7 +52,8 @@ var getMonthHoverRange = exports.getMonthHoverRange = function getMonthHoverRang
52
52
  };
53
53
  var getWeekHoverRange = exports.getWeekHoverRange = function getWeekHoverRange(date, options) {
54
54
  var isoWeek = options.isoWeek,
55
- weekStart = options.weekStart,
55
+ _options$weekStart = options.weekStart,
56
+ weekStart = _options$weekStart === void 0 ? 0 : _options$weekStart,
56
57
  locale = options.locale;
57
58
  if (isoWeek) {
58
59
  // set to the first day of this week according to ISO 8601, 12:00 am
@@ -1,11 +1,10 @@
1
1
  'use client';
2
2
  "use strict";
3
3
 
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
4
  exports.__esModule = true;
6
5
  exports.useImage = void 0;
7
6
  var _react = require("react");
8
- var _useIsomorphicLayoutEffect = _interopRequireDefault(require("../../internals/hooks/useIsomorphicLayoutEffect"));
7
+ var _hooks = require("../../internals/hooks");
9
8
  var useImage = exports.useImage = function useImage(props) {
10
9
  var src = props.src,
11
10
  fallbackSrc = props.fallbackSrc,
@@ -54,7 +53,7 @@ var useImage = exports.useImage = function useImage(props) {
54
53
  };
55
54
  imageRef.current = image;
56
55
  }, [crossOrigin, fallbackSrc, loading, sizes, src, srcSet]);
57
- (0, _useIsomorphicLayoutEffect.default)(function () {
56
+ (0, _hooks.useIsomorphicLayoutEffect)(function () {
58
57
  loadImage();
59
58
  return function () {
60
59
  flush();
@@ -49,6 +49,7 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
49
49
  onChange = _useEditState.onChange,
50
50
  onKeyDown = _useEditState.onKeyDown,
51
51
  onClick = _useEditState.onClick,
52
+ onFocus = _useEditState.onFocus,
52
53
  htmlProps = _useEditState.htmlProps;
53
54
  var _useFocusEvent = (0, _useFocusEvent2.default)({
54
55
  isEditing: isEditing,
@@ -75,7 +76,8 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
75
76
  disabled: disabled
76
77
  })),
77
78
  onClick: onClick,
78
- onKeyDown: onKeyDown
79
+ onKeyDown: onKeyDown,
80
+ onFocus: onFocus
79
81
  }, htmlProps), (0, _renderChildren.renderChildren)(children, childrenProps, target), showControls && isEditing && /*#__PURE__*/_react.default.createElement(_EditableControls.default, {
80
82
  className: prefix('controls'),
81
83
  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;
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
8
8
  var _react = require("react");
9
9
  var _hooks = require("../internals/hooks");
10
- var _excluded = ["value", "defaultValue", "disabled", "onChange", "onEdit", "onCancel", "onSave", "onClick"];
10
+ var _excluded = ["value", "defaultValue", "disabled", "onChange", "onEdit", "onCancel", "onSave", "onClick", "onFocus"];
11
11
  var useEditState = function useEditState(props) {
12
12
  var valueProp = props.value,
13
13
  defaultValue = props.defaultValue,
@@ -17,6 +17,7 @@ var useEditState = function useEditState(props) {
17
17
  onCancel = props.onCancel,
18
18
  onSave = props.onSave,
19
19
  onClick = props.onClick,
20
+ onFocus = props.onFocus,
20
21
  htmlProps = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
21
22
  var _useState = (0, _react.useState)(false),
22
23
  isEditing = _useState[0],
@@ -38,6 +39,12 @@ var useEditState = function useEditState(props) {
38
39
  setIsEditing(true);
39
40
  setResetValue(value);
40
41
  });
42
+ var handleFocus = (0, _hooks.useEventCallback)(function (event) {
43
+ if (disabled) return;
44
+ onFocus === null || onFocus === void 0 || onFocus(event);
45
+ setIsEditing(true);
46
+ setResetValue(value);
47
+ });
41
48
  var handleChange = (0, _hooks.useEventCallback)(function (value, event) {
42
49
  setValue(value);
43
50
  onChange === null || onChange === void 0 || onChange(value, event);
@@ -75,6 +82,7 @@ var useEditState = function useEditState(props) {
75
82
  value: value,
76
83
  onClick: handleClick,
77
84
  onChange: handleChange,
85
+ onFocus: handleFocus,
78
86
  onCancel: handleCancel,
79
87
  onSave: handleSave,
80
88
  onKeyDown: handleKeyDown,
package/cjs/List/List.js CHANGED
@@ -65,7 +65,9 @@ var List = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
65
65
  register = _useSortHelper.register,
66
66
  sorting = _useSortHelper.sorting,
67
67
  handleEnd = _useSortHelper.handleEnd,
68
- handleStart = _useSortHelper.handleStart;
68
+ handleStart = _useSortHelper.handleStart,
69
+ handleTouchStart = _useSortHelper.handleTouchStart,
70
+ handleTouchEnd = _useSortHelper.handleTouchEnd;
69
71
  var classes = merge(className, withClassPrefix({
70
72
  bordered: bordered,
71
73
  sortable: sortable,
@@ -86,7 +88,9 @@ var List = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
86
88
  ref: (0, _utils.mergeRefs)(containerRef, ref),
87
89
  className: classes,
88
90
  onMouseDown: sortable ? handleStart : undefined,
89
- onMouseUp: sortable ? handleEnd : undefined
91
+ onMouseUp: sortable ? handleEnd : undefined,
92
+ onTouchStart: sortable ? handleTouchStart : undefined,
93
+ onTouchEnd: sortable ? handleTouchEnd : undefined
90
94
  }), /*#__PURE__*/_react.default.createElement(_ListContext.default.Provider, {
91
95
  value: contextValue
92
96
  }, 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) => {