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.
@@ -10,12 +10,29 @@ import { CustomContext } from "./CustomContext.js";
10
10
  function getDefaultRTL() {
11
11
  return typeof document !== 'undefined' && (document.body.getAttribute('dir') || document.dir) === 'rtl';
12
12
  }
13
- function toLocaleKey(componentName) {
14
- var Picker = ['Cascader', 'CheckTreePicker', 'MultiCascader', 'SelectPicker', 'TreePicker', 'CheckPicker', 'CheckTreePicker'];
15
- if (Picker.includes(componentName)) {
16
- return 'Combobox';
17
- }
18
- return componentName;
13
+
14
+ /**
15
+ * Maps a component name to its corresponding locale key
16
+ * @param componentName - The name of the component
17
+ * @returns The locale key for the component
18
+ */
19
+ function getComponentLocaleKey(componentName) {
20
+ // Define mappings for components that share locale keys
21
+ var localeKeyMappings = {
22
+ // All picker components use the Combobox locale
23
+ Cascader: 'Combobox',
24
+ CheckTreePicker: 'Combobox',
25
+ MultiCascader: 'Combobox',
26
+ SelectPicker: 'Combobox',
27
+ TreePicker: 'Combobox',
28
+ CheckPicker: 'Combobox',
29
+ // Time components use date components locales
30
+ TimePicker: 'DatePicker',
31
+ TimeRangePicker: 'DateRangePicker'
32
+ };
33
+
34
+ // Return the mapped locale key or the component name itself if no mapping exists
35
+ return localeKeyMappings[componentName] || componentName;
19
36
  }
20
37
 
21
38
  /**
@@ -63,7 +80,7 @@ export function useCustom(componentName, componentProps) {
63
80
  //Memoize the global default props based on component name
64
81
  var globalDefaultProps = ((_components$component = components[componentName]) === null || _components$component === void 0 ? void 0 : _components$component.defaultProps) || {};
65
82
  var mergedProps = assign({}, globalDefaultProps, restProps);
66
- var localeKey = toLocaleKey(componentName);
83
+ var localeKey = getComponentLocaleKey(componentName);
67
84
 
68
85
  // If the default locale has the component name, then merge the locale.
69
86
  if (Object.keys(enGB).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;
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
4
- var _excluded = ["as", "calendarDateRange", "format", "disabledDate", "index", "limitEndYear", "limitStartYear", "onChangeCalendarMonth", "onChangeCalendarTime", "onSelect", "value"];
4
+ var _excluded = ["as", "calendarDateRange", "format", "disabledDate", "index", "limitEndYear", "limitStartYear", "onChangeCalendarMonth", "onChangeCalendarTime", "onSelect", "renderTitle", "value"];
5
5
  import React, { useCallback } from 'react';
6
6
  import CalendarContainer from "../Calendar/CalendarContainer.js";
7
7
  import { addMonths, startOfToday } from "../internals/utils/date/index.js";
@@ -22,9 +22,11 @@ var Calendar = /*#__PURE__*/React.forwardRef(function (props, ref) {
22
22
  onChangeCalendarMonth = props.onChangeCalendarMonth,
23
23
  onChangeCalendarTime = props.onChangeCalendarTime,
24
24
  onSelect = props.onSelect,
25
+ renderTitle = props.renderTitle,
25
26
  _props$value = props.value,
26
27
  value = _props$value === void 0 ? [] : _props$value,
27
28
  rest = _objectWithoutPropertiesLoose(props, _excluded);
29
+ var calendarKey = index === 0 ? 'start' : 'end';
28
30
  var calendarHandlers = useCalendarHandlers({
29
31
  index: index,
30
32
  calendarDateRange: calendarDateRange,
@@ -35,8 +37,11 @@ var Calendar = /*#__PURE__*/React.forwardRef(function (props, ref) {
35
37
  var disableCalendarDate = useCallback(function (date) {
36
38
  return disabledDate === null || disabledDate === void 0 ? void 0 : disabledDate(date, value, DATERANGE_DISABLED_TARGET.CALENDAR);
37
39
  }, [disabledDate, value]);
40
+ var handleRenderTitle = useCallback(function (date) {
41
+ return renderTitle === null || renderTitle === void 0 ? void 0 : renderTitle(date, calendarKey);
42
+ }, [renderTitle, calendarKey]);
38
43
  return /*#__PURE__*/React.createElement(Component, _extends({
39
- "data-testid": "calendar-" + (index === 0 ? 'start' : 'end')
44
+ "data-testid": "calendar-" + calendarKey
40
45
  }, rest, calendarHandlers, {
41
46
  index: index,
42
47
  format: format,
@@ -44,7 +49,8 @@ var Calendar = /*#__PURE__*/React.forwardRef(function (props, ref) {
44
49
  disabledDate: disableCalendarDate,
45
50
  limitEndYear: limitEndYear,
46
51
  limitStartYear: limitStartYear,
47
- ref: ref
52
+ ref: ref,
53
+ renderTitle: handleRenderTitle
48
54
  }));
49
55
  });
50
56
  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,86 @@
1
+ 'use client';
2
+ import _extends from "@babel/runtime/helpers/esm/extends";
3
+ import guIn from 'date-fns/locale/gu';
4
+ var DateTimeFormats = {
5
+ sunday: 'રવિ',
6
+ monday: 'સોમ',
7
+ tuesday: 'મંગળ',
8
+ wednesday: 'બુધ',
9
+ thursday: 'ગુરુ',
10
+ friday: 'શુક્ર',
11
+ saturday: 'શનિ',
12
+ ok: 'OK',
13
+ today: 'આજે',
14
+ yesterday: 'ગઈ કાલે',
15
+ now: 'અત્યારે',
16
+ hours: 'કલાક',
17
+ minutes: 'મિનિટ',
18
+ seconds: 'સેકંડ',
19
+ formattedMonthPattern: 'MMM, yyyy',
20
+ formattedDayPattern: 'MMM dd, yyyy',
21
+ shortDateFormat: 'MM/dd/yyyy',
22
+ shortTimeFormat: 'hh:mm aa',
23
+ dateLocale: guIn
24
+ };
25
+ var Combobox = {
26
+ noResultsText: 'કોઈ પરિણામો મળ્યા નથી',
27
+ placeholder: 'પસંદ કરો',
28
+ searchPlaceholder: 'શોધો',
29
+ checkAll: 'બધા પસંદ કરો'
30
+ };
31
+ var CreatableComboBox = _extends({}, Combobox, {
32
+ newItem: 'નવી આઇટમ',
33
+ createOption: 'વિકલ્પ બનાવો "{0}"'
34
+ });
35
+ export default {
36
+ code: 'gu-IN',
37
+ common: {
38
+ loading: 'લોડ થઈ રહ્યું છે...',
39
+ emptyMessage: 'પરિણામો મળ્યા નથી',
40
+ remove: 'હટાવો',
41
+ clear: 'સાફ કરો'
42
+ },
43
+ Plaintext: {
44
+ unfilled: 'અપૂર્ણ',
45
+ notSelected: 'પસંદ ન કરાયું',
46
+ notUploaded: 'ઉમેરાયું નથી'
47
+ },
48
+ Pagination: {
49
+ more: 'વધુ',
50
+ prev: 'પાછળ',
51
+ next: 'આગળ',
52
+ first: 'પ્રથમ',
53
+ last: 'છેલ્લું',
54
+ limit: '{0} / પૃષ્ઠ',
55
+ total: 'કુલ હરોળ: {0}',
56
+ skip: 'જા ઑ{0}'
57
+ },
58
+ DateTimeFormats: DateTimeFormats,
59
+ Calendar: DateTimeFormats,
60
+ DatePicker: DateTimeFormats,
61
+ DateRangePicker: _extends({}, DateTimeFormats, {
62
+ last7Days: 'છેલ્લા 7 દિવસ'
63
+ }),
64
+ Combobox: Combobox,
65
+ InputPicker: CreatableComboBox,
66
+ TagPicker: CreatableComboBox,
67
+ Uploader: {
68
+ inited: 'પ્રારંભિક',
69
+ progress: 'અપલોડ થઈ રહ્યું છે',
70
+ error: 'ભૂલ',
71
+ complete: 'પૂર્ણ',
72
+ emptyFile: 'ખાલી',
73
+ upload: 'અપલોડ કરો',
74
+ removeFile: 'ફાઇલ હટાવો'
75
+ },
76
+ CloseButton: {
77
+ closeLabel: 'બંધ કરો'
78
+ },
79
+ Breadcrumb: {
80
+ expandText: 'પાથ બતાવો'
81
+ },
82
+ Toggle: {
83
+ on: 'શરૂ',
84
+ off: 'બંધ'
85
+ }
86
+ };
@@ -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
  };
@@ -26,4 +26,5 @@ export { default as neNP } from "./ne_NP.js";
26
26
  export { default as csCZ } from "./cs_CZ.js";
27
27
  export { default as plPL } from "./pl_PL.js";
28
28
  export { default as ukUA } from "./uk_UA.js";
29
- export { default as thTH } from "./th_TH.js";
29
+ export { default as thTH } from "./th_TH.js";
30
+ export { default as guIN } from "./gu_IN.js";
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "rsuite/locales/gu_IN",
3
+ "private": true,
4
+ "main": "../../cjs/locales/gu_IN.js",
5
+ "module": "../../esm/locales/gu_IN.js",
6
+ "types": "../../esm/locales/gu_IN.d.ts"
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsuite",
3
- "version": "5.82.0",
3
+ "version": "5.83.1",
4
4
  "description": "A suite of react components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",