rsuite 5.82.0 → 5.83.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,22 @@
1
+ ## [5.83.1](https://github.com/rsuite/rsuite/compare/v5.83.0...v5.83.1) (2025-06-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * allow TimePicker and TimeRangePicker locale prop to override global locale ([#4333](https://github.com/rsuite/rsuite/issues/4333)) ([6f66dfd](https://github.com/rsuite/rsuite/commit/6f66dfdc570c930b99e2954bc339446707947b92))
7
+
8
+
9
+
10
+ # [5.83.0](https://github.com/rsuite/rsuite/compare/v5.82.0...v5.83.0) (2025-06-19)
11
+
12
+
13
+ ### Features
14
+
15
+ * **DateRangePicker:** add calendarKey parameter to renderTitle function ([#4318](https://github.com/rsuite/rsuite/issues/4318)) ([5b8c198](https://github.com/rsuite/rsuite/commit/5b8c19891945c2416475d493daef0aabf7e0f214))
16
+ * **locale:** add Gujarati [gu_IN] locale ([#4309](https://github.com/rsuite/rsuite/issues/4309)) ([9715633](https://github.com/rsuite/rsuite/commit/9715633f72bdbb9b141380d9ad134d619d65e2fb))
17
+
18
+
19
+
1
20
  # [5.82.0](https://github.com/rsuite/rsuite/compare/v5.81.0...v5.82.0) (2025-05-29)
2
21
 
3
22
 
@@ -16,12 +16,29 @@ var _excluded = ["locale"];
16
16
  function getDefaultRTL() {
17
17
  return typeof document !== 'undefined' && (document.body.getAttribute('dir') || document.dir) === 'rtl';
18
18
  }
19
- function toLocaleKey(componentName) {
20
- var Picker = ['Cascader', 'CheckTreePicker', 'MultiCascader', 'SelectPicker', 'TreePicker', 'CheckPicker', 'CheckTreePicker'];
21
- if (Picker.includes(componentName)) {
22
- return 'Combobox';
23
- }
24
- return componentName;
19
+
20
+ /**
21
+ * Maps a component name to its corresponding locale key
22
+ * @param componentName - The name of the component
23
+ * @returns The locale key for the component
24
+ */
25
+ function getComponentLocaleKey(componentName) {
26
+ // Define mappings for components that share locale keys
27
+ var localeKeyMappings = {
28
+ // All picker components use the Combobox locale
29
+ Cascader: 'Combobox',
30
+ CheckTreePicker: 'Combobox',
31
+ MultiCascader: 'Combobox',
32
+ SelectPicker: 'Combobox',
33
+ TreePicker: 'Combobox',
34
+ CheckPicker: 'Combobox',
35
+ // Time components use date components locales
36
+ TimePicker: 'DatePicker',
37
+ TimeRangePicker: 'DateRangePicker'
38
+ };
39
+
40
+ // Return the mapped locale key or the component name itself if no mapping exists
41
+ return localeKeyMappings[componentName] || componentName;
25
42
  }
26
43
 
27
44
  /**
@@ -69,7 +86,7 @@ function useCustom(componentName, componentProps) {
69
86
  //Memoize the global default props based on component name
70
87
  var globalDefaultProps = ((_components$component = components[componentName]) === null || _components$component === void 0 ? void 0 : _components$component.defaultProps) || {};
71
88
  var mergedProps = (0, _assign.default)({}, globalDefaultProps, restProps);
72
- var localeKey = toLocaleKey(componentName);
89
+ var localeKey = getComponentLocaleKey(componentName);
73
90
 
74
91
  // If the default locale has the component name, then merge the locale.
75
92
  if (Object.keys(_en_GB.default).includes(localeKey)) {
@@ -4,7 +4,7 @@ import { DATERANGE_DISABLED_TARGET } from '../internals/constants';
4
4
  import { DateRange } from './types';
5
5
  import { RsRefForwardingComponent, WithAsProps } from '../internals/types';
6
6
  import { DateRangePickerLocale } from '../locales';
7
- type OmitCalendarCoreTypes = 'disabledDate' | 'onSelect' | 'onMouseMove' | 'calendarDate' | 'format' | 'locale';
7
+ type OmitCalendarCoreTypes = 'disabledDate' | 'onSelect' | 'onMouseMove' | 'calendarDate' | 'format' | 'locale' | 'renderTitle';
8
8
  export interface CalendarProps extends WithAsProps, Omit<CalendarContainerProps, OmitCalendarCoreTypes> {
9
9
  calendarDateRange?: DateRange;
10
10
  disabledDate?: (date: Date, selectValue: [] | [Date] | [Date, Date], type: DATERANGE_DISABLED_TARGET) => boolean;
@@ -18,6 +18,7 @@ export interface CalendarProps extends WithAsProps, Omit<CalendarContainerProps,
18
18
  locale?: Partial<DateRangePickerLocale>;
19
19
  showWeekNumbers?: boolean;
20
20
  value?: [] | [Date] | [Date, Date];
21
+ renderTitle?: (date: Date, calendarKey: 'start' | 'end') => React.ReactNode;
21
22
  onChangeCalendarMonth?: (index: number, date: Date) => void;
22
23
  onChangeCalendarTime?: (index: number, date: Date) => void;
23
24
  onSelect?: (index: number, date: Date, event: React.SyntheticEvent) => void;
@@ -11,7 +11,7 @@ var _CalendarContainer = _interopRequireDefault(require("../Calendar/CalendarCon
11
11
  var _date = require("../internals/utils/date");
12
12
  var _constants = require("../internals/constants");
13
13
  var _hooks = require("./hooks");
14
- var _excluded = ["as", "calendarDateRange", "format", "disabledDate", "index", "limitEndYear", "limitStartYear", "onChangeCalendarMonth", "onChangeCalendarTime", "onSelect", "value"];
14
+ var _excluded = ["as", "calendarDateRange", "format", "disabledDate", "index", "limitEndYear", "limitStartYear", "onChangeCalendarMonth", "onChangeCalendarTime", "onSelect", "renderTitle", "value"];
15
15
  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); }
16
16
  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; }
17
17
  var Calendar = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
@@ -29,9 +29,11 @@ var Calendar = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
29
29
  onChangeCalendarMonth = props.onChangeCalendarMonth,
30
30
  onChangeCalendarTime = props.onChangeCalendarTime,
31
31
  onSelect = props.onSelect,
32
+ renderTitle = props.renderTitle,
32
33
  _props$value = props.value,
33
34
  value = _props$value === void 0 ? [] : _props$value,
34
35
  rest = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
36
+ var calendarKey = index === 0 ? 'start' : 'end';
35
37
  var calendarHandlers = (0, _hooks.useCalendarHandlers)({
36
38
  index: index,
37
39
  calendarDateRange: calendarDateRange,
@@ -42,8 +44,11 @@ var Calendar = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
42
44
  var disableCalendarDate = (0, _react.useCallback)(function (date) {
43
45
  return disabledDate === null || disabledDate === void 0 ? void 0 : disabledDate(date, value, _constants.DATERANGE_DISABLED_TARGET.CALENDAR);
44
46
  }, [disabledDate, value]);
47
+ var handleRenderTitle = (0, _react.useCallback)(function (date) {
48
+ return renderTitle === null || renderTitle === void 0 ? void 0 : renderTitle(date, calendarKey);
49
+ }, [renderTitle, calendarKey]);
45
50
  return /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({
46
- "data-testid": "calendar-" + (index === 0 ? 'start' : 'end')
51
+ "data-testid": "calendar-" + calendarKey
47
52
  }, rest, calendarHandlers, {
48
53
  index: index,
49
54
  format: format,
@@ -51,7 +56,8 @@ var Calendar = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
51
56
  disabledDate: disableCalendarDate,
52
57
  limitEndYear: limitEndYear,
53
58
  limitStartYear: limitStartYear,
54
- ref: ref
59
+ ref: ref,
60
+ renderTitle: handleRenderTitle
55
61
  }));
56
62
  });
57
63
  Calendar.displayName = 'DateRangePicker.Calendar';
@@ -157,8 +157,10 @@ export interface DateRangePickerProps extends PickerBaseProps<DateRangePickerLoc
157
157
  renderValue?: (value: DateRange, format: string) => string;
158
158
  /**
159
159
  * Custom render for calendar title
160
+ *
161
+ * - calendarKey is added in v5.83.0
160
162
  */
161
- renderTitle?: (date: Date) => React.ReactNode;
163
+ renderTitle?: (date: Date, calendarKey: 'start' | 'end') => React.ReactNode;
162
164
  /**
163
165
  * Custom rendering calendar cell content.
164
166
  *
@@ -0,0 +1,151 @@
1
+ declare const _default: {
2
+ code: string;
3
+ common: {
4
+ loading: string;
5
+ emptyMessage: string;
6
+ remove: string;
7
+ clear: string;
8
+ };
9
+ Plaintext: {
10
+ unfilled: string;
11
+ notSelected: string;
12
+ notUploaded: string;
13
+ };
14
+ Pagination: {
15
+ more: string;
16
+ prev: string;
17
+ next: string;
18
+ first: string;
19
+ last: string;
20
+ limit: string;
21
+ total: string;
22
+ skip: string;
23
+ };
24
+ DateTimeFormats: {
25
+ sunday: string;
26
+ monday: string;
27
+ tuesday: string;
28
+ wednesday: string;
29
+ thursday: string;
30
+ friday: string;
31
+ saturday: string;
32
+ ok: string;
33
+ today: string;
34
+ yesterday: string;
35
+ now: string;
36
+ hours: string;
37
+ minutes: string;
38
+ seconds: string;
39
+ formattedMonthPattern: string;
40
+ formattedDayPattern: string;
41
+ shortDateFormat: string;
42
+ shortTimeFormat: string;
43
+ dateLocale: any;
44
+ };
45
+ Calendar: {
46
+ sunday: string;
47
+ monday: string;
48
+ tuesday: string;
49
+ wednesday: string;
50
+ thursday: string;
51
+ friday: string;
52
+ saturday: string;
53
+ ok: string;
54
+ today: string;
55
+ yesterday: string;
56
+ now: string;
57
+ hours: string;
58
+ minutes: string;
59
+ seconds: string;
60
+ formattedMonthPattern: string;
61
+ formattedDayPattern: string;
62
+ shortDateFormat: string;
63
+ shortTimeFormat: string;
64
+ dateLocale: any;
65
+ };
66
+ DatePicker: {
67
+ sunday: string;
68
+ monday: string;
69
+ tuesday: string;
70
+ wednesday: string;
71
+ thursday: string;
72
+ friday: string;
73
+ saturday: string;
74
+ ok: string;
75
+ today: string;
76
+ yesterday: string;
77
+ now: string;
78
+ hours: string;
79
+ minutes: string;
80
+ seconds: string;
81
+ formattedMonthPattern: string;
82
+ formattedDayPattern: string;
83
+ shortDateFormat: string;
84
+ shortTimeFormat: string;
85
+ dateLocale: any;
86
+ };
87
+ DateRangePicker: {
88
+ last7Days: string;
89
+ sunday: string;
90
+ monday: string;
91
+ tuesday: string;
92
+ wednesday: string;
93
+ thursday: string;
94
+ friday: string;
95
+ saturday: string;
96
+ ok: string;
97
+ today: string;
98
+ yesterday: string;
99
+ now: string;
100
+ hours: string;
101
+ minutes: string;
102
+ seconds: string;
103
+ formattedMonthPattern: string;
104
+ formattedDayPattern: string;
105
+ shortDateFormat: string;
106
+ shortTimeFormat: string;
107
+ dateLocale: any;
108
+ };
109
+ Combobox: {
110
+ noResultsText: string;
111
+ placeholder: string;
112
+ searchPlaceholder: string;
113
+ checkAll: string;
114
+ };
115
+ InputPicker: {
116
+ newItem: string;
117
+ createOption: string;
118
+ noResultsText: string;
119
+ placeholder: string;
120
+ searchPlaceholder: string;
121
+ checkAll: string;
122
+ };
123
+ TagPicker: {
124
+ newItem: string;
125
+ createOption: string;
126
+ noResultsText: string;
127
+ placeholder: string;
128
+ searchPlaceholder: string;
129
+ checkAll: string;
130
+ };
131
+ Uploader: {
132
+ inited: string;
133
+ progress: string;
134
+ error: string;
135
+ complete: string;
136
+ emptyFile: string;
137
+ upload: string;
138
+ removeFile: string;
139
+ };
140
+ CloseButton: {
141
+ closeLabel: string;
142
+ };
143
+ Breadcrumb: {
144
+ expandText: string;
145
+ };
146
+ Toggle: {
147
+ on: string;
148
+ off: string;
149
+ };
150
+ };
151
+ export default _default;
@@ -0,0 +1,91 @@
1
+ 'use client';
2
+ "use strict";
3
+
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ exports.__esModule = true;
6
+ exports.default = void 0;
7
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
+ var _gu = _interopRequireDefault(require("date-fns/locale/gu"));
9
+ var DateTimeFormats = {
10
+ sunday: 'રવિ',
11
+ monday: 'સોમ',
12
+ tuesday: 'મંગળ',
13
+ wednesday: 'બુધ',
14
+ thursday: 'ગુરુ',
15
+ friday: 'શુક્ર',
16
+ saturday: 'શનિ',
17
+ ok: 'OK',
18
+ today: 'આજે',
19
+ yesterday: 'ગઈ કાલે',
20
+ now: 'અત્યારે',
21
+ hours: 'કલાક',
22
+ minutes: 'મિનિટ',
23
+ seconds: 'સેકંડ',
24
+ formattedMonthPattern: 'MMM, yyyy',
25
+ formattedDayPattern: 'MMM dd, yyyy',
26
+ shortDateFormat: 'MM/dd/yyyy',
27
+ shortTimeFormat: 'hh:mm aa',
28
+ dateLocale: _gu.default
29
+ };
30
+ var Combobox = {
31
+ noResultsText: 'કોઈ પરિણામો મળ્યા નથી',
32
+ placeholder: 'પસંદ કરો',
33
+ searchPlaceholder: 'શોધો',
34
+ checkAll: 'બધા પસંદ કરો'
35
+ };
36
+ var CreatableComboBox = (0, _extends2.default)({}, Combobox, {
37
+ newItem: 'નવી આઇટમ',
38
+ createOption: 'વિકલ્પ બનાવો "{0}"'
39
+ });
40
+ var _default = exports.default = {
41
+ code: 'gu-IN',
42
+ common: {
43
+ loading: 'લોડ થઈ રહ્યું છે...',
44
+ emptyMessage: 'પરિણામો મળ્યા નથી',
45
+ remove: 'હટાવો',
46
+ clear: 'સાફ કરો'
47
+ },
48
+ Plaintext: {
49
+ unfilled: 'અપૂર્ણ',
50
+ notSelected: 'પસંદ ન કરાયું',
51
+ notUploaded: 'ઉમેરાયું નથી'
52
+ },
53
+ Pagination: {
54
+ more: 'વધુ',
55
+ prev: 'પાછળ',
56
+ next: 'આગળ',
57
+ first: 'પ્રથમ',
58
+ last: 'છેલ્લું',
59
+ limit: '{0} / પૃષ્ઠ',
60
+ total: 'કુલ હરોળ: {0}',
61
+ skip: 'જા ઑ{0}'
62
+ },
63
+ DateTimeFormats: DateTimeFormats,
64
+ Calendar: DateTimeFormats,
65
+ DatePicker: DateTimeFormats,
66
+ DateRangePicker: (0, _extends2.default)({}, DateTimeFormats, {
67
+ last7Days: 'છેલ્લા 7 દિવસ'
68
+ }),
69
+ Combobox: Combobox,
70
+ InputPicker: CreatableComboBox,
71
+ TagPicker: CreatableComboBox,
72
+ Uploader: {
73
+ inited: 'પ્રારંભિક',
74
+ progress: 'અપલોડ થઈ રહ્યું છે',
75
+ error: 'ભૂલ',
76
+ complete: 'પૂર્ણ',
77
+ emptyFile: 'ખાલી',
78
+ upload: 'અપલોડ કરો',
79
+ removeFile: 'ફાઇલ હટાવો'
80
+ },
81
+ CloseButton: {
82
+ closeLabel: 'બંધ કરો'
83
+ },
84
+ Breadcrumb: {
85
+ expandText: 'પાથ બતાવો'
86
+ },
87
+ Toggle: {
88
+ on: 'શરૂ',
89
+ off: 'બંધ'
90
+ }
91
+ };
@@ -28,6 +28,7 @@ export { default as csCZ } from './cs_CZ';
28
28
  export { default as plPL } from './pl_PL';
29
29
  export { default as ukUA } from './uk_UA';
30
30
  export { default as thTH } from './th_TH';
31
+ export { default as guIN } from './gu_IN';
31
32
  type PickKeys<T> = {
32
33
  [keys in keyof T]?: T[keys];
33
34
  };
@@ -3,7 +3,7 @@
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
5
  exports.__esModule = true;
6
- exports.zhTW = exports.zhCN = exports.ukUA = exports.trTR = exports.thTH = exports.svSE = exports.ruRU = exports.ptBR = exports.plPL = exports.nlNL = exports.neNP = exports.koKR = exports.kkKZ = exports.jaJP = exports.itIT = exports.huHU = exports.frFR = exports.fiFI = exports.faIR = exports.esES = exports.esAR = exports.enUS = exports.enGB = exports.deDE = exports.daDK = exports.csCZ = exports.caES = exports.arEG = void 0;
6
+ exports.zhTW = exports.zhCN = exports.ukUA = exports.trTR = exports.thTH = exports.svSE = exports.ruRU = exports.ptBR = exports.plPL = exports.nlNL = exports.neNP = exports.koKR = exports.kkKZ = exports.jaJP = exports.itIT = exports.huHU = exports.guIN = exports.frFR = exports.fiFI = exports.faIR = exports.esES = exports.esAR = exports.enUS = exports.enGB = exports.deDE = exports.daDK = exports.csCZ = exports.caES = exports.arEG = void 0;
7
7
  var _ar_EG = _interopRequireDefault(require("./ar_EG"));
8
8
  exports.arEG = _ar_EG.default;
9
9
  var _da_DK = _interopRequireDefault(require("./da_DK"));
@@ -59,4 +59,6 @@ exports.plPL = _pl_PL.default;
59
59
  var _uk_UA = _interopRequireDefault(require("./uk_UA"));
60
60
  exports.ukUA = _uk_UA.default;
61
61
  var _th_TH = _interopRequireDefault(require("./th_TH"));
62
- exports.thTH = _th_TH.default;
62
+ exports.thTH = _th_TH.default;
63
+ var _gu_IN = _interopRequireDefault(require("./gu_IN"));
64
+ exports.guIN = _gu_IN.default;