rsuite 5.76.2 → 5.77.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 (49) hide show
  1. package/AutoComplete/styles/index.css +20 -0
  2. package/CHANGELOG.md +26 -0
  3. package/Cascader/styles/index.css +20 -0
  4. package/CheckPicker/styles/index.css +20 -0
  5. package/CheckTree/styles/index.css +20 -0
  6. package/CheckTreePicker/styles/index.css +20 -0
  7. package/DatePicker/styles/index.css +20 -0
  8. package/DateRangePicker/styles/index.css +20 -0
  9. package/InputPicker/styles/index.css +20 -0
  10. package/MultiCascadeTree/styles/index.css +20 -0
  11. package/MultiCascader/styles/index.css +20 -0
  12. package/Pagination/styles/index.css +20 -0
  13. package/SelectPicker/styles/index.css +20 -0
  14. package/TagInput/styles/index.css +20 -0
  15. package/TagPicker/styles/index.css +20 -0
  16. package/Text/styles/index.css +1 -1
  17. package/TimePicker/styles/index.css +20 -0
  18. package/TimeRangePicker/styles/index.css +20 -0
  19. package/cjs/DateRangePicker/DateRangePicker.d.ts +6 -0
  20. package/cjs/DateRangePicker/DateRangePicker.js +4 -2
  21. package/cjs/FormControl/hooks/useField.js +4 -1
  22. package/cjs/FormControl/utils.d.ts +8 -0
  23. package/cjs/FormControl/utils.js +44 -1
  24. package/cjs/InputPicker/InputPicker.js +7 -1
  25. package/dist/rsuite-no-reset-rtl.css +21 -1
  26. package/dist/rsuite-no-reset-rtl.min.css +1 -1
  27. package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
  28. package/dist/rsuite-no-reset.css +21 -1
  29. package/dist/rsuite-no-reset.min.css +1 -1
  30. package/dist/rsuite-no-reset.min.css.map +1 -1
  31. package/dist/rsuite-rtl.css +22 -6
  32. package/dist/rsuite-rtl.min.css +1 -1
  33. package/dist/rsuite-rtl.min.css.map +1 -1
  34. package/dist/rsuite.css +22 -6
  35. package/dist/rsuite.js +6 -6
  36. package/dist/rsuite.min.css +1 -1
  37. package/dist/rsuite.min.css.map +1 -1
  38. package/dist/rsuite.min.js +1 -1
  39. package/dist/rsuite.min.js.map +1 -1
  40. package/esm/DateRangePicker/DateRangePicker.d.ts +6 -0
  41. package/esm/DateRangePicker/DateRangePicker.js +4 -2
  42. package/esm/FormControl/hooks/useField.js +4 -1
  43. package/esm/FormControl/utils.d.ts +8 -0
  44. package/esm/FormControl/utils.js +44 -1
  45. package/esm/InputPicker/InputPicker.js +7 -1
  46. package/internals/Picker/styles/mixin.less +5 -0
  47. package/package.json +1 -1
  48. package/styles/typography.less +0 -5
  49. package/styles/variables.less +1 -1
@@ -159,6 +159,12 @@ export interface DateRangePickerProps extends PickerBaseProps<DateRangePickerLoc
159
159
  * Custom render for calendar title
160
160
  */
161
161
  renderTitle?: (date: Date) => React.ReactNode;
162
+ /**
163
+ * Custom rendering calendar cell content.
164
+ *
165
+ * @version 5.77.0
166
+ */
167
+ renderCell?: (date: Date) => React.ReactNode;
162
168
  }
163
169
  export interface DateRangePickerComponent extends PickerComponent<DateRangePickerProps> {
164
170
  /** Allow the maximum number of days specified, other dates are disabled */
@@ -3,7 +3,7 @@ import _taggedTemplateLiteralLoose from "@babel/runtime/helpers/esm/taggedTempla
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
5
  var _templateObject, _templateObject2;
6
- var _excluded = ["as", "classPrefix", "className", "appearance", "editable", "cleanable", "character", "calendarSnapping", "defaultCalendarValue", "defaultValue", "plaintext", "disabled", "disabledDate", "shouldDisableDate", "shouldDisableHour", "shouldDisableMinute", "shouldDisableSecond", "format", "hoverRange", "id", "isoWeek", "weekStart", "limitEndYear", "limitStartYear", "locale", "loading", "label", "menuClassName", "menuStyle", "oneTap", "placeholder", "placement", "ranges", "readOnly", "showOneCalendar", "showWeekNumbers", "showMeridian", "showMeridiem", "showHeader", "style", "size", "caretAs", "value", "monthDropdownProps", "hideHours", "hideMinutes", "hideSeconds", "onChange", "onClean", "onEnter", "onExit", "onOk", "onSelect", "onShortcutClick", "renderTitle", "renderValue"];
6
+ var _excluded = ["as", "classPrefix", "className", "appearance", "editable", "cleanable", "character", "calendarSnapping", "defaultCalendarValue", "defaultValue", "plaintext", "disabled", "disabledDate", "shouldDisableDate", "shouldDisableHour", "shouldDisableMinute", "shouldDisableSecond", "format", "hoverRange", "id", "isoWeek", "weekStart", "limitEndYear", "limitStartYear", "locale", "loading", "label", "menuClassName", "menuStyle", "oneTap", "placeholder", "placement", "ranges", "readOnly", "showOneCalendar", "showWeekNumbers", "showMeridian", "showMeridiem", "showHeader", "style", "size", "caretAs", "value", "monthDropdownProps", "hideHours", "hideMinutes", "hideSeconds", "onChange", "onClean", "onEnter", "onExit", "onOk", "onSelect", "onShortcutClick", "renderTitle", "renderValue", "renderCell"];
7
7
  import React, { useEffect, useRef, useState, useMemo } from 'react';
8
8
  import isNil from 'lodash/isNil';
9
9
  import omit from 'lodash/omit';
@@ -109,6 +109,7 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
109
109
  onShortcutClick = propsWithDefaults.onShortcutClick,
110
110
  renderTitle = propsWithDefaults.renderTitle,
111
111
  renderValue = propsWithDefaults.renderValue,
112
+ renderCell = propsWithDefaults.renderCell,
112
113
  restProps = _objectWithoutPropertiesLoose(propsWithDefaults, _excluded);
113
114
  var id = useUniqueId('rs-', idProp);
114
115
  var _usePickerRef = usePickerRef(ref),
@@ -666,7 +667,8 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
666
667
  onChangeCalendarMonth: onChangeCalendarMonth,
667
668
  onChangeCalendarTime: onChangeCalendarTime,
668
669
  onMouseMove: onMouseMove,
669
- renderTitle: renderTitle
670
+ renderTitle: renderTitle,
671
+ renderCellOnPicker: renderCell
670
672
  };
671
673
  var getCalendars = function getCalendars() {
672
674
  if (showOneCalendar) {
@@ -15,7 +15,10 @@ function getErrorMessage(error) {
15
15
  * the error object won't contain the errorMessage directly. @see https://github.com/rsuite/rsuite/issues/3866
16
16
  */
17
17
  if (error !== null && error !== void 0 && error.array && ((_error$array = error.array) === null || _error$array === void 0 ? void 0 : _error$array.length) > 0) {
18
- return error.array[0].errorMessage;
18
+ var _error$array$find;
19
+ return (_error$array$find = error.array.find(function (item) {
20
+ return item.hasError;
21
+ })) === null || _error$array$find === void 0 ? void 0 : _error$array$find.errorMessage;
19
22
  }
20
23
  if (/*#__PURE__*/isValidElement(error)) {
21
24
  return error;
@@ -1 +1,9 @@
1
+ /**
2
+ * Converts a field name to a path that can be used in a nested object.
3
+ * @example
4
+ * nameToPath('a.b.c') // 'a.object.b.object.c'
5
+ * nameToPath('items[0].name') // 'items.array[0].object.name'
6
+ * @param name the field name to convert
7
+ * @returns the converted path
8
+ */
1
9
  export declare function nameToPath(name: string): string;
@@ -1,4 +1,47 @@
1
1
  'use client';
2
+ /**
3
+ * Converts a field name to a path that can be used in a nested object.
4
+ * @example
5
+ * nameToPath('a.b.c') // 'a.object.b.object.c'
6
+ * nameToPath('items[0].name') // 'items.array[0].object.name'
7
+ * @param name the field name to convert
8
+ * @returns the converted path
9
+ */
2
10
  export function nameToPath(name) {
3
- return name.includes('.') ? name.replace('.', '.object.') : name;
11
+ if (!name.includes('.') && !name.includes('[')) {
12
+ return name;
13
+ }
14
+
15
+ // Split the path by dots and array accessors
16
+ var parts = name.split(/\.|\[|\]\.?/).filter(Boolean);
17
+ var result = [];
18
+ for (var i = 0; i < parts.length; i++) {
19
+ var part = parts[i];
20
+ var isLast = i === parts.length - 1;
21
+ if (part.match(/^\d+$/)) {
22
+ // If it's a number (array index), add array accessor
23
+ result.push("array[" + part + "]");
24
+ // If there's a next part and it's not an array index, add .object
25
+ if (!isLast && !parts[i + 1].match(/^\d+$/)) {
26
+ result.push('object');
27
+ }
28
+ } else {
29
+ // For regular property names
30
+ if (!isLast) {
31
+ // Not the last part, add .object unless next part is array index
32
+ var nextPart = parts[i + 1];
33
+ if (nextPart && nextPart.match(/^\d+$/)) {
34
+ // Next part is array index
35
+ result.push(part);
36
+ } else {
37
+ // Next part is object property
38
+ result.push(part + ".object");
39
+ }
40
+ } else {
41
+ // Last part, just add the name
42
+ result.push(part);
43
+ }
44
+ }
45
+ }
46
+ return result.join('.');
4
47
  }
@@ -390,7 +390,13 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
390
390
  handleChange(val, event);
391
391
  });
392
392
  var handleClean = useEventCallback(function (event) {
393
- if (disabled || searchKeyword !== '') {
393
+ if (disabled) {
394
+ return;
395
+ }
396
+
397
+ // When there is a value in the search box and the user presses the delete key on the keyboard,
398
+ // do not trigger clearing
399
+ if (inputRef.current === event.target && searchKeyword !== '') {
394
400
  return;
395
401
  }
396
402
  setValue(null);
@@ -110,6 +110,11 @@
110
110
  top: @padding-vertical - @picker-default-toggle-border-width;
111
111
  }
112
112
  }
113
+
114
+ .rs-picker-loader{
115
+ top: @padding-vertical;
116
+ right: @padding-horizontal;
117
+ }
113
118
  }
114
119
  }
115
120
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsuite",
3
- "version": "5.76.2",
3
+ "version": "5.77.0",
4
4
  "description": "A suite of react components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -116,8 +116,3 @@ dd {
116
116
  margin-bottom: (@line-height-computed / 2);
117
117
  }
118
118
 
119
- // font-face
120
- @font-face {
121
- font-family: Apple-System;
122
- src: local(-apple-system), local(BlinkMacSystemFont), local(system-ui);
123
- }
@@ -124,7 +124,7 @@
124
124
  // Typography
125
125
  // Font, line-height, and color for body text, headings, and more.
126
126
 
127
- @font-family-base: Apple-System, Arial, Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', STXihei, sans-serif;
127
+ @font-family-base: -apple-system, BlinkMacSystemFont, Arial, Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', STXihei, sans-serif;
128
128
 
129
129
  @font-size-extra-large: 18px;
130
130
  @font-size-large: 16px;