rsuite 5.60.0 → 5.60.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [5.60.1](https://github.com/rsuite/rsuite/compare/v5.60.0...v5.60.1) (2024-05-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **DateRangePicker:** fix not auto switching to the end calendar when only one calendar is displayed ([#3781](https://github.com/rsuite/rsuite/issues/3781)) ([5322f9c](https://github.com/rsuite/rsuite/commit/5322f9cc747750b865e8184dcab36609e906b274))
7
+ * **DateRangePicker:** fix not updating time on calendar when typing to change time ([#3777](https://github.com/rsuite/rsuite/issues/3777)) ([d1a7350](https://github.com/rsuite/rsuite/commit/d1a73502908026ceb20b5f2f49709b4dd03f334a))
8
+ * **toggle:** block pointer events when disabled ([#3774](https://github.com/rsuite/rsuite/issues/3774)) ([d833a0a](https://github.com/rsuite/rsuite/commit/d833a0ab1c759b568bba6d87d697687e3ca7cbed))
9
+ * **Toggle:** fix the height problem of the switch element ([#3780](https://github.com/rsuite/rsuite/issues/3780)) ([ff1570c](https://github.com/rsuite/rsuite/commit/ff1570c7d8776f2a120f1c048237725597157143))
10
+
11
+
12
+
1
13
  # [5.60.0](https://github.com/rsuite/rsuite/compare/v5.59.2...v5.60.0) (2024-04-26)
2
14
 
3
15
 
@@ -5,13 +17,12 @@
5
17
 
6
18
  * **Fade:** fix Picker not working in Drawer without backdrop ([#3759](https://github.com/rsuite/rsuite/issues/3759)) ([930a321](https://github.com/rsuite/rsuite/commit/930a3212b58202f4d0bf05a8bb191195944d589c))
7
19
  * **TagPicker:** fix misalignment of large size tag with textbox ([#3755](https://github.com/rsuite/rsuite/issues/3755)) ([2bcd793](https://github.com/rsuite/rsuite/commit/2bcd793cd7cf1b181643125fe92f4ffb0e18f771))
20
+ * **TagPicker:** fix text flicker when entering ([#3758](https://github.com/rsuite/rsuite/issues/3758)) ([f7058d1](https://github.com/rsuite/rsuite/commit/f7058d1e9234e43c9f8d7884636a09d83f40fcb9))
8
21
 
9
22
 
10
23
  ### Features
11
24
 
12
25
  * **Form:** add support for onSubmit and onReset ([#3750](https://github.com/rsuite/rsuite/issues/3750)) ([d9b747e](https://github.com/rsuite/rsuite/commit/d9b747e97f3aaaa1d0b047ab81150d2a01764ed1))
13
- * **TagPicker:** fix text flicker when entering ([#3758](https://github.com/rsuite/rsuite/issues/3758)) ([f7058d1](https://github.com/rsuite/rsuite/commit/f7058d1e9234e43c9f8d7884636a09d83f40fcb9))
14
-
15
26
 
16
27
 
17
28
  ## [5.59.2](https://github.com/rsuite/rsuite/compare/v5.59.1...v5.59.2) (2024-04-19)
@@ -4017,9 +4017,6 @@ textarea.rs-input-group-inside.rs-input-group-xs > .rs-input-group-btn {
4017
4017
  .rs-picker-popup .rs-calendar-month-dropdown-list {
4018
4018
  width: 185px;
4019
4019
  }
4020
- .rs-picker-popup .rs-picker-daterange-panel-show-one-calendar .rs-picker-toolbar {
4021
- max-width: 255px;
4022
- }
4023
4020
  .rs-picker-popup .rs-picker-daterange-panel-show-one-calendar .rs-picker-toolbar-ranges {
4024
4021
  width: 190px;
4025
4022
  }
@@ -4058,6 +4055,8 @@ textarea.rs-input-group-inside.rs-input-group-xs > .rs-input-group-btn {
4058
4055
  bottom: -1px;
4059
4056
  border-bottom: 2px solid #3498ff;
4060
4057
  left: 0;
4058
+ -webkit-transition: left 0.3s;
4059
+ transition: left 0.3s;
4061
4060
  }
4062
4061
  .rs-picker-daterange-header.rs-picker-tab-active-end::after {
4063
4062
  left: 50%;
@@ -62,11 +62,11 @@
62
62
  }
63
63
  }
64
64
 
65
- .rs-picker-daterange-panel-show-one-calendar .rs-picker-toolbar {
66
- max-width: @date-range-picker-calendar-default-width;
67
-
68
- &-ranges {
69
- width: 190px;
65
+ .rs-picker-daterange-panel-show-one-calendar {
66
+ .rs-picker-toolbar {
67
+ &-ranges {
68
+ width: 190px;
69
+ }
70
70
  }
71
71
  }
72
72
 
@@ -105,6 +105,7 @@
105
105
  bottom: -1px;
106
106
  border-bottom: 2px solid #3498ff;
107
107
  left: 0;
108
+ transition: left 0.3s;
108
109
  }
109
110
  }
110
111
 
@@ -114,6 +114,7 @@
114
114
  }
115
115
  .rs-toggle {
116
116
  position: relative;
117
+ display: inline-block;
117
118
  }
118
119
  .rs-toggle .rs-toggle-loader {
119
120
  width: 18px;
@@ -239,7 +240,7 @@
239
240
  -webkit-box-shadow: inset 0 0 0 1px var(--rs-toggle-disabled-thumb);
240
241
  box-shadow: inset 0 0 0 1px #fff;
241
242
  box-shadow: inset 0 0 0 1px var(--rs-toggle-disabled-thumb);
242
- cursor: not-allowed;
243
+ pointer-events: none;
243
244
  }
244
245
  .rs-toggle-checked .rs-toggle-presentation {
245
246
  background-color: #3498ff;
@@ -10,6 +10,7 @@
10
10
  // todo: Consider renaming as .rs-toggle
11
11
  .rs-toggle {
12
12
  position: relative;
13
+ display: inline-block;
13
14
 
14
15
  // Default size is middle.
15
16
  .toggle(md);
@@ -70,7 +71,7 @@
70
71
  background-color: var(--rs-toggle-disabled-bg);
71
72
  color: var(--rs-toggle-disabled-thumb);
72
73
  box-shadow: inset 0 0 0 1px var(--rs-toggle-disabled-thumb);
73
- cursor: not-allowed;
74
+ pointer-events: none;
74
75
  }
75
76
 
76
77
  // checked state
@@ -108,7 +108,8 @@ var DateRangePicker = /*#__PURE__*/_react.default.forwardRef(function (props, re
108
108
  prefix = _useClassNames.prefix;
109
109
  var _useCustom = (0, _utils.useCustom)('DateRangePicker', overrideLocale),
110
110
  locale = _useCustom.locale,
111
- formatDate = _useCustom.formatDate;
111
+ formatDate = _useCustom.formatDate; // Default gap between two calendars, if `showOneCalendar` is set, the gap is 0
112
+ var calendarGap = showOneCalendar ? 0 : 1;
112
113
  var rangeFormatStr = "" + formatStr + character + formatStr;
113
114
  var _useControlled = (0, _utils.useControlled)(valueProp, defaultValue !== null && defaultValue !== void 0 ? defaultValue : null),
114
115
  value = _useControlled[0],
@@ -135,7 +136,7 @@ var DateRangePicker = /*#__PURE__*/_react.default.forwardRef(function (props, re
135
136
  var _useState2 = (0, _react.useState)((_ref = valueProp !== null && valueProp !== void 0 ? valueProp : defaultValue) !== null && _ref !== void 0 ? _ref : []),
136
137
  selectedDates = _useState2[0],
137
138
  setSelectedDates = _useState2[1]; // The date of the current hover, used to reduce the calculation of `handleMouseMove`
138
- var _useState3 = (0, _react.useState)(null),
139
+ var _useState3 = (0, _react.useState)(value),
139
140
  hoverDateRange = _useState3[0],
140
141
  setHoverDateRange = _useState3[1]; // The displayed calendar panel is rendered based on this value.
141
142
  var _useState4 = (0, _react.useState)((0, _utils2.getSafeCalendarDate)({
@@ -171,14 +172,14 @@ var DateRangePicker = /*#__PURE__*/_react.default.forwardRef(function (props, re
171
172
  var nextValue = dateRange;
172
173
 
173
174
  // The time should remain the same when the dates in the date range are changed.
174
- if ((0, _dateUtils.shouldRenderTime)(formatStr) && dateRange !== null && dateRange !== void 0 && dateRange.length && eventName !== 'changeTime' && eventName !== 'shortcutSelection') {
175
+ if ((0, _dateUtils.shouldRenderTime)(formatStr) && dateRange !== null && dateRange !== void 0 && dateRange.length && (eventName === 'changeDate' || eventName === 'changeMonth')) {
175
176
  var _startDate = (0, _dateUtils.copyTime)({
176
177
  from: getCalendarDatetime('start'),
177
178
  to: dateRange[0]
178
179
  });
179
180
  var _endDate = (0, _dateUtils.copyTime)({
180
181
  from: getCalendarDatetime('end'),
181
- to: dateRange.length === 1 ? (0, _dateUtils.addMonths)(_startDate, 1) : dateRange[1]
182
+ to: dateRange.length === 1 ? (0, _dateUtils.addMonths)(_startDate, calendarGap) : dateRange[1]
182
183
  });
183
184
  nextValue = [_startDate, _endDate];
184
185
  } else if (dateRange === null && typeof defaultCalendarValue !== 'undefined') {
@@ -188,7 +189,9 @@ var DateRangePicker = /*#__PURE__*/_react.default.forwardRef(function (props, re
188
189
  var nextCalendarDate = (0, _utils2.getSafeCalendarDate)({
189
190
  value: nextValue,
190
191
  calendarKey: calendarKey,
191
- allowAameMonth: onlyShowMonth
192
+ // When only the month is displayed and only one calendar is displayed,
193
+ // there is no need to add a month and two calendar panels are allowed to display the same month
194
+ allowSameMonth: onlyShowMonth || showOneCalendar
192
195
  });
193
196
  setCalendarDate(nextCalendarDate);
194
197
  if (onlyShowMonth && eventName === 'changeMonth') {
@@ -337,6 +340,11 @@ var DateRangePicker = /*#__PURE__*/_react.default.forwardRef(function (props, re
337
340
  } else {
338
341
  setHoverDateRange([nextSelectDates[0], nextSelectDates[0]]);
339
342
  }
343
+ if (isSelectedIdle) {
344
+ setActiveCalendarKey('end');
345
+ } else {
346
+ setActiveCalendarKey('start');
347
+ }
340
348
  setSelectedDates(nextSelectDates);
341
349
  setCalendarDateRange({
342
350
  dateRange: nextSelectDates,
@@ -408,7 +416,7 @@ var DateRangePicker = /*#__PURE__*/_react.default.forwardRef(function (props, re
408
416
  if (value && value.length) {
409
417
  var _startDate3 = value[0],
410
418
  endData = value[1];
411
- nextCalendarDate = [_startDate3, (0, _dateUtils.isSameMonth)(_startDate3, endData) ? (0, _dateUtils.addMonths)(endData, 1) : endData];
419
+ nextCalendarDate = [_startDate3, (0, _dateUtils.isSameMonth)(_startDate3, endData) ? (0, _dateUtils.addMonths)(endData, calendarGap) : endData];
412
420
  } else {
413
421
  // Reset the date on the calendar to the default date
414
422
  nextCalendarDate = (0, _utils2.getSafeCalendarDate)({
@@ -737,11 +745,11 @@ var DateRangePicker = /*#__PURE__*/_react.default.forwardRef(function (props, re
737
745
  format: formatStr,
738
746
  placeholder: placeholder ? placeholder : rangeFormatStr,
739
747
  disabled: disabled,
740
- onChange: handleInputChange,
741
748
  readOnly: readOnly || !editable || loading,
742
749
  plaintext: plaintext,
743
- onKeyDown: handleInputKeyDown,
744
- htmlSize: getInputHtmlSize()
750
+ htmlSize: getInputHtmlSize(),
751
+ onChange: handleInputChange,
752
+ onKeyDown: handleInputKeyDown
745
753
  })), /*#__PURE__*/_react.default.createElement(_Picker.PickerIndicator, {
746
754
  loading: loading,
747
755
  caretAs: caretAs,
@@ -1,8 +1,8 @@
1
1
  import { DateRange } from './types';
2
- export declare function getSafeCalendarDate({ value, calendarKey, allowAameMonth }: {
2
+ export declare function getSafeCalendarDate({ value, calendarKey, allowSameMonth }: {
3
3
  value: [] | [Date] | [Date, Date] | null;
4
4
  calendarKey?: 'start' | 'end';
5
- allowAameMonth?: boolean;
5
+ allowSameMonth?: boolean;
6
6
  }): DateRange;
7
7
  export declare const isSameRange: (source: DateRange | null, dest: DateRange | null, format: string) => boolean;
8
8
  export declare const getMonthHoverRange: (date: Date) => DateRange;
@@ -10,10 +10,10 @@ function getSafeCalendarDate(_ref) {
10
10
  var value = _ref.value,
11
11
  _ref$calendarKey = _ref.calendarKey,
12
12
  calendarKey = _ref$calendarKey === void 0 ? 'start' : _ref$calendarKey,
13
- allowAameMonth = _ref.allowAameMonth;
13
+ allowSameMonth = _ref.allowSameMonth;
14
14
  // Update calendarDate if the value is not null
15
15
  value = (_value = value) !== null && _value !== void 0 ? _value : [];
16
- var gap = allowAameMonth ? 0 : 1;
16
+ var gap = allowSameMonth ? 0 : 1;
17
17
  if (value[0] && value[1]) {
18
18
  var diffMonth = (0, _dateUtils.differenceInCalendarMonths)(value[1], value[0]);
19
19
  if (calendarKey === 'start') {
@@ -4662,9 +4662,6 @@ label:hover .rs-checkbox-control .rs-checkbox-inner::before {
4662
4662
  .rs-picker-popup .rs-calendar-month-dropdown-list {
4663
4663
  width: 185px;
4664
4664
  }
4665
- .rs-picker-popup .rs-picker-daterange-panel-show-one-calendar .rs-picker-toolbar {
4666
- max-width: 255px;
4667
- }
4668
4665
  .rs-picker-popup .rs-picker-daterange-panel-show-one-calendar .rs-picker-toolbar-ranges {
4669
4666
  width: 190px;
4670
4667
  }
@@ -4703,6 +4700,8 @@ label:hover .rs-checkbox-control .rs-checkbox-inner::before {
4703
4700
  bottom: -1px;
4704
4701
  border-bottom: 2px solid #3498ff;
4705
4702
  right: 0;
4703
+ -webkit-transition: right 0.3s;
4704
+ transition: right 0.3s;
4706
4705
  }
4707
4706
  .rs-picker-daterange-header.rs-picker-tab-active-end::after {
4708
4707
  right: 50%;
@@ -14471,6 +14470,7 @@ textarea.rs-inline-edit-sm .rs-plaintext {
14471
14470
  }
14472
14471
  .rs-toggle {
14473
14472
  position: relative;
14473
+ display: inline-block;
14474
14474
  }
14475
14475
  .rs-toggle .rs-toggle-loader {
14476
14476
  width: 18px;
@@ -14596,7 +14596,7 @@ textarea.rs-inline-edit-sm .rs-plaintext {
14596
14596
  -webkit-box-shadow: inset 0 0 0 1px var(--rs-toggle-disabled-thumb);
14597
14597
  box-shadow: inset 0 0 0 1px #fff;
14598
14598
  box-shadow: inset 0 0 0 1px var(--rs-toggle-disabled-thumb);
14599
- cursor: not-allowed;
14599
+ pointer-events: none;
14600
14600
  }
14601
14601
  .rs-toggle-checked .rs-toggle-presentation {
14602
14602
  background-color: #3498ff;