rsuite 5.83.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)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsuite",
3
- "version": "5.83.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",