rsuite 5.69.0 → 5.70.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.
Files changed (75) hide show
  1. package/Breadcrumb/styles/index.css +16 -0
  2. package/Breadcrumb/styles/index.less +10 -0
  3. package/CHANGELOG.md +23 -0
  4. package/README.md +2 -2
  5. package/Table/styles/index.css +1 -1
  6. package/Table/styles/index.less +1 -1
  7. package/cjs/Breadcrumb/Breadcrumb.d.ts +14 -4
  8. package/cjs/Breadcrumb/Breadcrumb.js +30 -32
  9. package/cjs/Breadcrumb/BreadcrumbItem.d.ts +20 -0
  10. package/cjs/Breadcrumb/BreadcrumbItem.js +13 -17
  11. package/cjs/Button/Button.js +3 -3
  12. package/cjs/Calendar/TableRow.js +6 -2
  13. package/cjs/CascadeTree/CascadeTree.js +3 -1
  14. package/cjs/CascadeTree/SearchView.d.ts +1 -0
  15. package/cjs/CascadeTree/SearchView.js +3 -2
  16. package/cjs/CascadeTree/types.d.ts +5 -1
  17. package/cjs/Cascader/Cascader.d.ts +1 -1
  18. package/cjs/Cascader/Cascader.js +1 -0
  19. package/cjs/CustomProvider/CustomProvider.d.ts +60 -9
  20. package/cjs/MultiCascadeTree/MultiCascadeTree.d.ts +1 -1
  21. package/cjs/MultiCascadeTree/MultiCascadeTree.js +4 -1
  22. package/cjs/MultiCascadeTree/SearchView.d.ts +1 -0
  23. package/cjs/MultiCascadeTree/SearchView.js +3 -2
  24. package/cjs/MultiCascadeTree/types.d.ts +5 -1
  25. package/cjs/MultiCascader/MultiCascader.d.ts +1 -1
  26. package/cjs/MultiCascader/MultiCascader.js +3 -0
  27. package/cjs/TreePicker/TreePicker.js +1 -0
  28. package/cjs/internals/hooks/useEventCallback.js +8 -1
  29. package/cjs/internals/types/index.d.ts +14 -0
  30. package/cjs/internals/utils/ReactChildren.d.ts +11 -0
  31. package/cjs/internals/utils/ReactChildren.js +22 -0
  32. package/cjs/locales/index.d.ts +4 -1
  33. package/dist/rsuite-no-reset-rtl.css +17 -1
  34. package/dist/rsuite-no-reset-rtl.min.css +1 -1
  35. package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
  36. package/dist/rsuite-no-reset.css +17 -1
  37. package/dist/rsuite-no-reset.min.css +1 -1
  38. package/dist/rsuite-no-reset.min.css.map +1 -1
  39. package/dist/rsuite-rtl.css +17 -1
  40. package/dist/rsuite-rtl.min.css +1 -1
  41. package/dist/rsuite-rtl.min.css.map +1 -1
  42. package/dist/rsuite.css +17 -1
  43. package/dist/rsuite.js +70 -59
  44. package/dist/rsuite.js.map +1 -1
  45. package/dist/rsuite.min.css +1 -1
  46. package/dist/rsuite.min.css.map +1 -1
  47. package/dist/rsuite.min.js +1 -1
  48. package/dist/rsuite.min.js.map +1 -1
  49. package/esm/Breadcrumb/Breadcrumb.d.ts +14 -4
  50. package/esm/Breadcrumb/Breadcrumb.js +32 -34
  51. package/esm/Breadcrumb/BreadcrumbItem.d.ts +20 -0
  52. package/esm/Breadcrumb/BreadcrumbItem.js +13 -17
  53. package/esm/Button/Button.js +4 -4
  54. package/esm/Calendar/TableRow.js +6 -2
  55. package/esm/CascadeTree/CascadeTree.js +3 -1
  56. package/esm/CascadeTree/SearchView.d.ts +1 -0
  57. package/esm/CascadeTree/SearchView.js +3 -2
  58. package/esm/CascadeTree/types.d.ts +5 -1
  59. package/esm/Cascader/Cascader.d.ts +1 -1
  60. package/esm/Cascader/Cascader.js +1 -0
  61. package/esm/CustomProvider/CustomProvider.d.ts +60 -9
  62. package/esm/MultiCascadeTree/MultiCascadeTree.d.ts +1 -1
  63. package/esm/MultiCascadeTree/MultiCascadeTree.js +4 -1
  64. package/esm/MultiCascadeTree/SearchView.d.ts +1 -0
  65. package/esm/MultiCascadeTree/SearchView.js +3 -2
  66. package/esm/MultiCascadeTree/types.d.ts +5 -1
  67. package/esm/MultiCascader/MultiCascader.d.ts +1 -1
  68. package/esm/MultiCascader/MultiCascader.js +3 -0
  69. package/esm/TreePicker/TreePicker.js +1 -0
  70. package/esm/internals/hooks/useEventCallback.js +8 -2
  71. package/esm/internals/types/index.d.ts +14 -0
  72. package/esm/internals/utils/ReactChildren.d.ts +11 -0
  73. package/esm/internals/utils/ReactChildren.js +21 -0
  74. package/esm/locales/index.d.ts +4 -1
  75. package/package.json +2 -2
@@ -3,17 +3,27 @@ import BreadcrumbItem from './BreadcrumbItem';
3
3
  import { WithAsProps, RsRefForwardingComponent } from '../internals/types';
4
4
  import { BreadcrumbLocale } from '../locales';
5
5
  export interface BreadcrumbProps extends WithAsProps {
6
- /** Shorthand for primary content of the React.ReactNode */
6
+ /**
7
+ * The separator between each breadcrumb item.
8
+ */
7
9
  separator?: React.ReactNode;
8
10
  /**
9
11
  * Set the maximum number of breadcrumbs to display.
10
12
  * When there are more than the maximum number,
11
13
  * only the first and last will be shown, with an ellipsis in between.
12
- * */
14
+ */
13
15
  maxItems?: number;
14
- /** Custom locale */
16
+ /**
17
+ * The locale of the component.
18
+ */
15
19
  locale?: BreadcrumbLocale;
16
- /** A function to be called when you are in the collapsed view and click the ellipsis. */
20
+ /**
21
+ * The ellipsis element.
22
+ */
23
+ ellipsis?: React.ReactNode;
24
+ /**
25
+ * Callback function for clicking the ellipsis.
26
+ */
17
27
  onExpand?: (event: React.MouseEvent) => void;
18
28
  }
19
29
  export interface BreadcrumbComponent extends RsRefForwardingComponent<'ol', BreadcrumbProps> {
@@ -1,13 +1,18 @@
1
1
  'use client';
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- import _taggedTemplateLiteralLoose from "@babel/runtime/helpers/esm/taggedTemplateLiteralLoose";
4
3
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- var _templateObject;
6
- var _excluded = ["as", "className", "classPrefix", "children", "maxItems", "separator", "locale", "onExpand"];
7
- import React, { useState, useCallback } from 'react';
4
+ var _excluded = ["as", "className", "classPrefix", "children", "ellipsis", "maxItems", "separator", "locale", "onExpand"];
5
+ import React, { useState, useMemo } from 'react';
8
6
  import PropTypes from 'prop-types';
9
- import { useClassNames, useCustom } from "../internals/hooks/index.js";
7
+ import { useClassNames, useCustom, useEventCallback } from "../internals/hooks/index.js";
8
+ import { ReactChildren, createComponent } from "../internals/utils/index.js";
10
9
  import BreadcrumbItem from "./BreadcrumbItem.js";
10
+ var Separator = createComponent({
11
+ name: 'BreadcrumbSeparator',
12
+ componentAs: 'span',
13
+ 'aria-hidden': true
14
+ });
15
+
11
16
  /**
12
17
  * The Breadcrumb component is used to indicate the current page location and navigate.
13
18
  * @see https://rsuitejs.com/components/breadcrumb
@@ -19,6 +24,8 @@ var Breadcrumb = /*#__PURE__*/React.forwardRef(function (props, ref) {
19
24
  _props$classPrefix = props.classPrefix,
20
25
  classPrefix = _props$classPrefix === void 0 ? 'breadcrumb' : _props$classPrefix,
21
26
  children = props.children,
27
+ _props$ellipsis = props.ellipsis,
28
+ ellipsis = _props$ellipsis === void 0 ? '...' : _props$ellipsis,
22
29
  _props$maxItems = props.maxItems,
23
30
  maxItems = _props$maxItems === void 0 ? 5 : _props$maxItems,
24
31
  _props$separator = props.separator,
@@ -28,62 +35,53 @@ var Breadcrumb = /*#__PURE__*/React.forwardRef(function (props, ref) {
28
35
  rest = _objectWithoutPropertiesLoose(props, _excluded);
29
36
  var _useClassNames = useClassNames(classPrefix),
30
37
  merge = _useClassNames.merge,
31
- prefix = _useClassNames.prefix,
32
38
  withClassPrefix = _useClassNames.withClassPrefix;
33
39
  var _useState = useState(true),
34
- ellipsis = _useState[0],
35
- setEllipsis = _useState[1];
40
+ showEllipsis = _useState[0],
41
+ setShowEllipsis = _useState[1];
36
42
  var _useCustom = useCustom('Breadcrumb', overrideLocale),
37
43
  locale = _useCustom.locale;
38
- var renderSeparator = function renderSeparator(key) {
39
- return /*#__PURE__*/React.createElement("span", {
40
- key: "breadcrumb-separator-" + key,
41
- "aria-hidden": true,
42
- className: prefix(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["separator"])))
43
- }, separator);
44
- };
45
- var handleClickEllipsis = useCallback(function (event) {
46
- setEllipsis(false);
44
+ var handleClickEllipsis = useEventCallback(function (event) {
45
+ setShowEllipsis(false);
47
46
  onExpand === null || onExpand === void 0 ? void 0 : onExpand(event);
48
- }, [onExpand]);
49
- var items = [];
50
- var count = React.Children.count(children);
51
- if (count) {
52
- React.Children.forEach(children, function (item, index) {
53
- items.push(item);
54
- if (index < count - 1) {
55
- items.push(renderSeparator(index));
56
- }
47
+ });
48
+ var content = useMemo(function () {
49
+ var count = ReactChildren.count(children);
50
+ var items = ReactChildren.mapCloneElement(children, function (item, index) {
51
+ var isLast = index === count - 1;
52
+ return _extends({}, item.props, {
53
+ separator: isLast ? null : /*#__PURE__*/React.createElement(Separator, null, separator)
54
+ });
57
55
  });
58
- }
59
- var renderCollapseItems = function renderCollapseItems() {
60
- if (count > maxItems && count > 2 && ellipsis) {
61
- return [].concat(items.slice(0, 2), [[/*#__PURE__*/React.createElement(BreadcrumbItem, {
56
+ if (count > maxItems && count > 2 && showEllipsis) {
57
+ return [].concat(items.slice(0, 1), [[/*#__PURE__*/React.createElement(BreadcrumbItem, {
62
58
  role: "button",
63
59
  key: "ellipsis",
64
60
  title: locale.expandText,
65
61
  "aria-label": locale.expandText,
62
+ separator: /*#__PURE__*/React.createElement(Separator, null, separator),
66
63
  onClick: handleClickEllipsis
67
64
  }, /*#__PURE__*/React.createElement("span", {
68
65
  "aria-hidden": true
69
- }, "..."))]], items.slice(items.length - 2, items.length));
66
+ }, ellipsis))]], items.slice(items.length - 1, items.length));
70
67
  }
71
68
  return items;
72
- };
69
+ }, [children, ellipsis, handleClickEllipsis, locale.expandText, maxItems, separator, showEllipsis]);
73
70
  var classes = merge(className, withClassPrefix());
74
71
  return /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
75
72
  ref: ref,
76
73
  className: classes
77
- }), renderCollapseItems());
74
+ }), /*#__PURE__*/React.createElement("ol", null, content));
78
75
  });
79
76
  Breadcrumb.Item = BreadcrumbItem;
80
77
  Breadcrumb.displayName = 'Breadcrumb';
81
78
  Breadcrumb.propTypes = {
82
- separator: PropTypes.node,
83
79
  as: PropTypes.elementType,
84
80
  children: PropTypes.node,
85
81
  className: PropTypes.string,
86
82
  classPrefix: PropTypes.string,
83
+ ellipsis: PropTypes.node,
84
+ separator: PropTypes.node,
87
85
  maxItems: PropTypes.number,
88
86
  onExpand: PropTypes.func
89
87
  };
@@ -1,10 +1,30 @@
1
1
  import React from 'react';
2
2
  import { WithAsProps, RsRefForwardingComponent } from '../internals/types';
3
3
  export interface BreadcrumbItemProps extends WithAsProps<React.ElementType | string> {
4
+ /**
5
+ * The wrapper element of the BreadcrumbItem.
6
+ */
7
+ wrapperAs?: React.ElementType;
8
+ /**
9
+ * The active state of the BreadcrumbItem.
10
+ */
4
11
  active?: boolean;
12
+ /**
13
+ * The href attribute specifies the URL of the page the link goes to.
14
+ */
5
15
  href?: string;
16
+ /**
17
+ * The title attribute specifies extra information about an element.
18
+ */
6
19
  title?: string;
20
+ /**
21
+ * The target attribute specifies where to open the linked document.
22
+ */
7
23
  target?: string;
24
+ /**
25
+ * The separator between each breadcrumb item.
26
+ */
27
+ separator?: React.ReactNode;
8
28
  }
9
29
  /**
10
30
  * The `<Breadcrumb.Item>` component is used to specify each section of the Breadcrumb.
@@ -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", "href", "classPrefix", "title", "target", "className", "style", "active", "children"];
4
+ var _excluded = ["wrapperAs", "href", "as", "classPrefix", "title", "target", "className", "style", "active", "children", "separator"];
5
5
  import React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import SafeAnchor from "../SafeAnchor/index.js";
@@ -11,9 +11,11 @@ import { useClassNames } from "../internals/hooks/index.js";
11
11
  * @see https://rsuitejs.com/components/breadcrumb
12
12
  */
13
13
  var BreadcrumbItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
14
- var _props$as = props.as,
15
- Component = _props$as === void 0 ? props.href ? SafeAnchor : 'span' : _props$as,
14
+ var _props$wrapperAs = props.wrapperAs,
15
+ WrapperComponent = _props$wrapperAs === void 0 ? 'li' : _props$wrapperAs,
16
16
  href = props.href,
17
+ _props$as = props.as,
18
+ Component = _props$as === void 0 ? href ? SafeAnchor : 'span' : _props$as,
17
19
  _props$classPrefix = props.classPrefix,
18
20
  classPrefix = _props$classPrefix === void 0 ? 'breadcrumb-item' : _props$classPrefix,
19
21
  title = props.title,
@@ -22,6 +24,7 @@ var BreadcrumbItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
22
24
  style = props.style,
23
25
  active = props.active,
24
26
  children = props.children,
27
+ separator = props.separator,
25
28
  rest = _objectWithoutPropertiesLoose(props, _excluded);
26
29
  var _useClassNames = useClassNames(classPrefix),
27
30
  merge = _useClassNames.merge,
@@ -29,22 +32,15 @@ var BreadcrumbItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
29
32
  var classes = merge(className, withClassPrefix({
30
33
  active: active
31
34
  }));
32
- if (active) {
33
- return /*#__PURE__*/React.createElement("span", _extends({
34
- ref: ref
35
- }, rest, {
36
- style: style,
37
- className: classes
38
- }), children);
39
- }
40
- return /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
35
+ return /*#__PURE__*/React.createElement(WrapperComponent, _extends({
36
+ style: style,
37
+ className: classes,
38
+ ref: ref
39
+ }, rest), active ? /*#__PURE__*/React.createElement("span", null, children) : /*#__PURE__*/React.createElement(Component, {
41
40
  href: href,
42
41
  title: title,
43
- target: target,
44
- ref: ref,
45
- style: style,
46
- className: classes
47
- }), children);
42
+ target: target
43
+ }, children), separator);
48
44
  });
49
45
  BreadcrumbItem.displayName = 'BreadcrumbItem';
50
46
  BreadcrumbItem.propTypes = {
@@ -4,7 +4,7 @@ import _taggedTemplateLiteralLoose from "@babel/runtime/helpers/esm/taggedTempla
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
5
  var _templateObject, _templateObject2, _templateObject3;
6
6
  var _excluded = ["as", "active", "appearance", "block", "className", "children", "classPrefix", "color", "disabled", "loading", "ripple", "size", "startIcon", "endIcon", "type"];
7
- import React, { useCallback, useContext } from 'react';
7
+ import React, { useContext, useMemo } from 'react';
8
8
  import PropTypes from 'prop-types';
9
9
  import Ripple from "../internals/Ripple/index.js";
10
10
  import { oneOf } from "../internals/propTypes/index.js";
@@ -48,7 +48,7 @@ var Button = /*#__PURE__*/React.forwardRef(function (props, ref) {
48
48
  loading: loading,
49
49
  block: block
50
50
  }));
51
- var renderButtonContent = useCallback(function () {
51
+ var buttonContent = useMemo(function () {
52
52
  var spin = /*#__PURE__*/React.createElement("span", {
53
53
  className: prefix(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["spin"])))
54
54
  });
@@ -66,7 +66,7 @@ var Button = /*#__PURE__*/React.forwardRef(function (props, ref) {
66
66
  "aria-disabled": disabled,
67
67
  disabled: disabled,
68
68
  className: classes
69
- }), renderButtonContent());
69
+ }), buttonContent);
70
70
  }
71
71
  var Component = as || 'button';
72
72
  var type = typeProp || (Component === 'button' ? 'button' : undefined);
@@ -78,7 +78,7 @@ var Button = /*#__PURE__*/React.forwardRef(function (props, ref) {
78
78
  disabled: disabled,
79
79
  "aria-disabled": disabled,
80
80
  className: classes
81
- }), renderButtonContent());
81
+ }), buttonContent);
82
82
  });
83
83
  Button.displayName = 'Button';
84
84
  Button.propTypes = {
@@ -9,6 +9,7 @@ import { useClassNames } from "../internals/hooks/index.js";
9
9
  import { useCalendarContext } from "./CalendarContext.js";
10
10
  import TableCell from "./TableCell.js";
11
11
  var TableRow = /*#__PURE__*/React.forwardRef(function (props, ref) {
12
+ var _locale$dateLocale$op, _locale$dateLocale;
12
13
  var _props$as = props.as,
13
14
  Component = _props$as === void 0 ? 'div' : _props$as,
14
15
  className = props.className,
@@ -93,10 +94,13 @@ var TableRow = /*#__PURE__*/React.forwardRef(function (props, ref) {
93
94
  return days;
94
95
  };
95
96
  var classes = merge(className, prefix('row'));
97
+ var _ref3 = (_locale$dateLocale$op = locale === null || locale === void 0 ? void 0 : (_locale$dateLocale = locale.dateLocale) === null || _locale$dateLocale === void 0 ? void 0 : _locale$dateLocale.options) !== null && _locale$dateLocale$op !== void 0 ? _locale$dateLocale$op : {},
98
+ firstWeekContainsDate = _ref3.firstWeekContainsDate,
99
+ weekStartsOn = _ref3.weekStartsOn;
96
100
  var week = format(weekendDate, isoWeek ? 'I' : 'w', {
97
101
  locale: locale === null || locale === void 0 ? void 0 : locale.dateLocale,
98
- firstWeekContainsDate: 4,
99
- weekStartsOn: weekStart
102
+ firstWeekContainsDate: firstWeekContainsDate,
103
+ weekStartsOn: weekStart || weekStartsOn
100
104
  });
101
105
  return /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
102
106
  ref: ref,
@@ -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", "data", "defaultValue", "className", "classPrefix", "childrenKey", "valueKey", "labelKey", "value", "disabledItemValues", "columnWidth", "columnHeight", "searchable", "renderTreeNode", "renderColumn", "onSelect", "onSearch", "onChange", "getChildren"];
4
+ var _excluded = ["as", "data", "defaultValue", "className", "classPrefix", "childrenKey", "valueKey", "labelKey", "locale", "value", "disabledItemValues", "columnWidth", "columnHeight", "searchable", "renderTreeNode", "renderColumn", "onSelect", "onSearch", "onChange", "getChildren"];
5
5
  import React, { useCallback, useMemo } from 'react';
6
6
  import { getParentMap } from "../internals/Tree/utils/index.js";
7
7
  import { flattenTree } from "../Tree/utils/index.js";
@@ -29,6 +29,7 @@ var CascadeTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
29
29
  valueKey = _props$valueKey === void 0 ? 'value' : _props$valueKey,
30
30
  _props$labelKey = props.labelKey,
31
31
  labelKey = _props$labelKey === void 0 ? 'label' : _props$labelKey,
32
+ locale = props.locale,
32
33
  valueProp = props.value,
33
34
  _props$disabledItemVa = props.disabledItemValues,
34
35
  disabledItemValues = _props$disabledItemVa === void 0 ? [] : _props$disabledItemVa,
@@ -145,6 +146,7 @@ var CascadeTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
145
146
  searchKeyword: searchKeyword,
146
147
  valueKey: valueKey,
147
148
  labelKey: labelKey,
149
+ locale: locale,
148
150
  parentMap: parentMap,
149
151
  disabledItemValues: disabledItemValues,
150
152
  onSelect: handleSearchRowSelect,
@@ -8,6 +8,7 @@ interface SearchViewProps<T> extends WithAsProps {
8
8
  data: ItemDataType<T>[];
9
9
  focusItemValue?: T | null;
10
10
  disabledItemValues: any[];
11
+ locale?: Record<string, string>;
11
12
  renderSearchItem?: (label: React.ReactNode, items: ItemDataType<T>[]) => React.ReactNode;
12
13
  onSelect: (item: ItemDataType<T>, items: ItemDataType<T>[], event: React.MouseEvent) => void;
13
14
  onSearch: (value: string, event: React.ChangeEvent<HTMLInputElement>) => 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", "classPrefix", "className", "searchKeyword", "labelKey", "valueKey", "parentMap", "data", "focusItemValue", "disabledItemValues", "inputRef", "renderSearchItem", "onSearch", "onSelect"];
4
+ var _excluded = ["as", "classPrefix", "className", "searchKeyword", "labelKey", "locale", "valueKey", "parentMap", "data", "focusItemValue", "disabledItemValues", "inputRef", "renderSearchItem", "onSearch", "onSelect"];
5
5
  import React from 'react';
6
6
  import { useClassNames, useCustom } from "../internals/hooks/index.js";
7
7
  import { getPathTowardsItem } from "../internals/Tree/utils/index.js";
@@ -15,6 +15,7 @@ function SearchView(props) {
15
15
  className = props.className,
16
16
  searchKeyword = props.searchKeyword,
17
17
  labelKey = props.labelKey,
18
+ overrideLocale = props.locale,
18
19
  valueKey = props.valueKey,
19
20
  parentMap = props.parentMap,
20
21
  data = props.data,
@@ -31,7 +32,7 @@ function SearchView(props) {
31
32
  withClassPrefix = _useClassNames.withClassPrefix,
32
33
  rootPrefix = _useClassNames.rootPrefix;
33
34
  var classes = merge(className, withClassPrefix());
34
- var _useCustom = useCustom('Picker'),
35
+ var _useCustom = useCustom('Picker', overrideLocale),
35
36
  locale = _useCustom.locale;
36
37
  var renderSearchRow = function renderSearchRow(item, key) {
37
38
  var items = getPathTowardsItem(item, function (item) {
@@ -10,7 +10,7 @@ export interface CascadeColumn<T> {
10
10
  parentItem?: ItemDataType<T>;
11
11
  layer?: number;
12
12
  }
13
- export interface CascadeTreeProps<T, V = T> extends WithAsProps, DataProps<ItemDataType<T>> {
13
+ export interface CascadeTreeProps<T, V = T, L = any> extends WithAsProps, DataProps<ItemDataType<T>> {
14
14
  /**
15
15
  * Initial value
16
16
  */
@@ -35,6 +35,10 @@ export interface CascadeTreeProps<T, V = T> extends WithAsProps, DataProps<ItemD
35
35
  * Whether dispaly search input box
36
36
  */
37
37
  searchable?: boolean;
38
+ /**
39
+ * A collection of localized strings.
40
+ */
41
+ locale?: Partial<L>;
38
42
  /**
39
43
  * Custom render columns
40
44
  */
@@ -3,7 +3,7 @@ import type { CascadeTreeProps } from '../CascadeTree/types';
3
3
  import { PickerLocale } from '../locales';
4
4
  import { PickerHandle, PickerToggleProps } from '../internals/Picker';
5
5
  import { ItemDataType, DataItemValue, FormControlPickerProps } from '../internals/types';
6
- export interface CascaderProps<T = DataItemValue> extends FormControlPickerProps<T, PickerLocale, ItemDataType<T>>, CascadeTreeProps<T>, Pick<PickerToggleProps, 'label' | 'caretAs' | 'loading'> {
6
+ export interface CascaderProps<T = DataItemValue> extends FormControlPickerProps<T, PickerLocale, ItemDataType<T>>, CascadeTreeProps<T, T, PickerLocale>, Pick<PickerToggleProps, 'label' | 'caretAs' | 'loading'> {
7
7
  /**
8
8
  * The panel is displayed directly when the component is initialized
9
9
  * @deprecated Use CascadeTree instead
@@ -329,6 +329,7 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
329
329
  searchKeyword: searchKeyword,
330
330
  valueKey: valueKey,
331
331
  labelKey: labelKey,
332
+ locale: locale,
332
333
  parentMap: parentMap,
333
334
  disabledItemValues: disabledItemValues,
334
335
  focusItemValue: focusItemValue,
@@ -1,18 +1,67 @@
1
1
  import React from 'react';
2
- import type { Locale as DateFnsLocale } from 'date-fns';
3
2
  import { Locale } from '../locales';
4
3
  import { ToastContainerInstance } from '../toaster/ToastContainer';
4
+ import type { Locale as DateFnsLocale } from 'date-fns';
5
+ import type { DateFns } from '../internals/types';
5
6
  export interface FormatDateOptions {
7
+ /**
8
+ * The locale object that contains the language and formatting rules for the date.
9
+ */
6
10
  locale?: DateFnsLocale;
7
- weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
8
- firstWeekContainsDate?: number;
11
+ /**
12
+ * Defines which day of the week should be considered the start of the week.
13
+ *
14
+ * The value should be an integer from 0 to 6, where:
15
+ * - `0` represents Sunday,
16
+ * - `1` represents Monday,
17
+ * - `2` represents Tuesday,
18
+ * - `3` represents Wednesday,
19
+ * - `4` represents Thursday,
20
+ * - `5` represents Friday,
21
+ * - `6` represents Saturday.
22
+ *
23
+ * This option is important for functions that operate on weeks, such as calculating
24
+ * the start or end of a week, determining which week a date falls in, or generating
25
+ * calendar views. The default value varies depending on the locale, with Monday (`1`)
26
+ * being the default in most regions following ISO 8601, while Sunday (`0`) is often
27
+ * the default in regions like the United States.
28
+ */
29
+ weekStartsOn?: DateFns.Day;
30
+ /**
31
+ * `firstWeekContainsDate` is used to determine which week is considered the first week of the year.
32
+ *
33
+ * This option specifies the minimum day of January that must be included in the first week.
34
+ *
35
+ * The value can be set to:
36
+ * - `1`: The first week of the year must include January 1st.
37
+ * - `4`: The first week of the year must include January 4th, which is the default according to ISO 8601.
38
+ *
39
+ * The choice between `1` and `4` typically depends on the regional or business conventions for week numbering.
40
+ *
41
+ * Please note that this option only accepts `1` (Sunday) or `4` (Thursday), aligning with common international standards.
42
+ *
43
+ * For more detailed information, please refer to https://en.wikipedia.org/wiki/Week#Week_numbering.
44
+ */
45
+ firstWeekContainsDate?: DateFns.FirstWeekContainsDate;
46
+ /**
47
+ * If true, allows usage of the week-numbering year tokens `YY` and `YYYY`.
48
+ * See: https://date-fns.org/docs/Unicode-Tokens
49
+ **/
9
50
  useAdditionalWeekYearTokens?: boolean;
51
+ /**
52
+ * If true, allows usage of the day of year tokens `D` and `DD`.
53
+ * See: https://date-fns.org/docs/Unicode-Tokens
54
+ */
10
55
  useAdditionalDayOfYearTokens?: boolean;
11
56
  }
12
57
  export interface CustomValue<T = Locale> {
13
- /** Language configuration */
58
+ /**
59
+ * The locale object that contains the language and formatting rules for the date.
60
+ */
14
61
  locale: T;
15
- /** Support right-to-left */
62
+ /**
63
+ * Right-to-left text direction.
64
+ */
16
65
  rtl: boolean;
17
66
  /**
18
67
  * Return the formatted date string in the given format. The result may vary by locale.
@@ -26,7 +75,7 @@ export interface CustomValue<T = Locale> {
26
75
  * return format(date, formatStr, { locale: eo });
27
76
  * }
28
77
  *
29
- * */
78
+ */
30
79
  formatDate: (date: Date | number, format: string, options?: FormatDateOptions) => string;
31
80
  /**
32
81
  * Return the date parsed from string using the given format string.
@@ -40,13 +89,16 @@ export interface CustomValue<T = Locale> {
40
89
  * return parse(date, formatStr, new Date(), { locale: eo });
41
90
  * }
42
91
  *
43
- * */
92
+ */
44
93
  parseDate: (dateString: string, formatString: string, referenceDate?: Date | number, options?: FormatDateOptions) => Date;
45
94
  /**
46
95
  * A Map of toast containers
47
96
  */
48
97
  toasters?: React.MutableRefObject<Map<string, ToastContainerInstance>>;
49
- /** If true, the ripple effect is disabled. Affected components include: Button, Nav.Item, Pagination. */
98
+ /**
99
+ * If true, the ripple effect is disabled.
100
+ * Affected components include: Button, Nav.Item, Pagination.
101
+ */
50
102
  disableRipple?: boolean;
51
103
  }
52
104
  export interface CustomProviderProps<T = Locale> extends Partial<CustomValue<T>> {
@@ -68,7 +120,6 @@ declare const CustomContext: React.Context<CustomProviderProps<{
68
120
  } | undefined;
69
121
  Plaintext?: {
70
122
  unfilled: string;
71
- /** Support right-to-left */
72
123
  notSelected: string;
73
124
  notUploaded: string;
74
125
  } | undefined;
@@ -5,5 +5,5 @@ import type { MultiCascadeTreeProps } from './types';
5
5
  * The `MultiCascadeTree` component is used to select multiple values from cascading options.
6
6
  * @see https://rsuitejs.com/components/multi-cascade-tree/
7
7
  */
8
- declare const MultiCascadeTree: React.ForwardRefExoticComponent<MultiCascadeTreeProps<DataItemValue, DataItemValue[]> & React.RefAttributes<unknown>>;
8
+ declare const MultiCascadeTree: React.ForwardRefExoticComponent<MultiCascadeTreeProps<DataItemValue, DataItemValue[], any> & React.RefAttributes<unknown>>;
9
9
  export default MultiCascadeTree;
@@ -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", "data", "defaultValue", "className", "classPrefix", "value", "valueKey", "labelKey", "childrenKey", "disabledItemValues", "cascade", "columnWidth", "columnHeight", "searchable", "uncheckableItemValues", "getChildren", "renderColumn", "renderTreeNode", "onSelect", "onCheck", "onChange", "onSearch"];
4
+ var _excluded = ["as", "data", "defaultValue", "className", "classPrefix", "value", "valueKey", "labelKey", "locale", "childrenKey", "disabledItemValues", "cascade", "columnWidth", "columnHeight", "searchable", "uncheckableItemValues", "getChildren", "renderColumn", "renderTreeNode", "onSelect", "onCheck", "onChange", "onSearch"];
5
5
  import React from 'react';
6
6
  import TreeView from "./TreeView.js";
7
7
  import { useCascadeValue, useSelect, useSearch } from "./hooks/index.js";
@@ -27,6 +27,7 @@ var MultiCascadeTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
27
27
  valueKey = _props$valueKey === void 0 ? 'value' : _props$valueKey,
28
28
  _props$labelKey = props.labelKey,
29
29
  labelKey = _props$labelKey === void 0 ? 'label' : _props$labelKey,
30
+ locale = props.locale,
30
31
  _props$childrenKey = props.childrenKey,
31
32
  childrenKey = _props$childrenKey === void 0 ? 'children' : _props$childrenKey,
32
33
  _props$disabledItemVa = props.disabledItemValues,
@@ -94,11 +95,13 @@ var MultiCascadeTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
94
95
  ref: ref,
95
96
  className: classes
96
97
  }, rest), searchable && /*#__PURE__*/React.createElement(SearchView, {
98
+ cascade: cascade,
97
99
  data: items,
98
100
  value: value,
99
101
  searchKeyword: searchKeyword,
100
102
  valueKey: valueKey,
101
103
  labelKey: labelKey,
104
+ locale: locale,
102
105
  childrenKey: childrenKey,
103
106
  disabledItemValues: disabledItemValues,
104
107
  onCheck: handleCheck,
@@ -9,6 +9,7 @@ interface SearchViewProps<T> extends WithAsProps {
9
9
  data: ItemDataType<T>[];
10
10
  disabledItemValues: any[];
11
11
  cascade?: boolean;
12
+ locale?: Record<string, string>;
12
13
  onSearch: (value: string, event: React.ChangeEvent<HTMLInputElement>) => void;
13
14
  onCheck: (item: ItemDataType<T>, event: React.SyntheticEvent, checked: boolean) => void;
14
15
  inputRef?: React.RefObject<HTMLInputElement>;
@@ -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", "classPrefix", "className", "searchKeyword", "childrenKey", "labelKey", "valueKey", "value", "data", "disabledItemValues", "inputRef", "cascade", "onSearch", "onCheck"];
4
+ var _excluded = ["as", "classPrefix", "className", "searchKeyword", "childrenKey", "labelKey", "valueKey", "value", "data", "disabledItemValues", "inputRef", "cascade", "locale", "onSearch", "onCheck"];
5
5
  import React from 'react';
6
6
  import { useClassNames, useCustom } from "../internals/hooks/index.js";
7
7
  import SearchBox from "../internals/SearchBox/index.js";
@@ -23,6 +23,7 @@ function SearchView(props) {
23
23
  disabledItemValues = props.disabledItemValues,
24
24
  inputRef = props.inputRef,
25
25
  cascade = props.cascade,
26
+ overrideLocale = props.locale,
26
27
  onSearch = props.onSearch,
27
28
  onCheck = props.onCheck,
28
29
  rest = _objectWithoutPropertiesLoose(props, _excluded);
@@ -32,7 +33,7 @@ function SearchView(props) {
32
33
  withClassPrefix = _useClassNames.withClassPrefix,
33
34
  rootPrefix = _useClassNames.rootPrefix;
34
35
  var classes = merge(className, withClassPrefix());
35
- var _useCustom = useCustom('Picker'),
36
+ var _useCustom = useCustom('Picker', overrideLocale),
36
37
  locale = _useCustom.locale;
37
38
  var renderSearchRow = function renderSearchRow(item, key) {
38
39
  var _extends2;
@@ -6,7 +6,7 @@ export interface ItemKeys {
6
6
  labelKey: string;
7
7
  childrenKey: string;
8
8
  }
9
- export interface MultiCascadeTreeProps<T, V = T[]> extends WithAsProps, CascadeTreeProps<T, V> {
9
+ export interface MultiCascadeTreeProps<T, V = T[], L = any> extends WithAsProps, CascadeTreeProps<T, V> {
10
10
  /**
11
11
  * When set to true, selecting a child node will update the state of the parent node.
12
12
  */
@@ -19,6 +19,10 @@ export interface MultiCascadeTreeProps<T, V = T[]> extends WithAsProps, CascadeT
19
19
  * Set the option value for the check box not to be rendered
20
20
  */
21
21
  uncheckableItemValues?: T[];
22
+ /**
23
+ * A collection of localized strings.
24
+ */
25
+ locale?: Partial<L>;
22
26
  /**
23
27
  * Called after the checkbox state changes.
24
28
  */
@@ -3,7 +3,7 @@ import { PickerLocale } from '../locales';
3
3
  import { PickerComponent, PickerToggleProps } from '../internals/Picker';
4
4
  import { FormControlPickerProps, ItemDataType, DataItemValue } from '../internals/types';
5
5
  import type { MultiCascadeTreeProps } from '../MultiCascadeTree';
6
- export interface MultiCascaderProps<T extends DataItemValue> extends FormControlPickerProps<T[], PickerLocale, ItemDataType<T>, T>, MultiCascadeTreeProps<T, T[]>, Pick<PickerToggleProps, 'loading'> {
6
+ export interface MultiCascaderProps<T extends DataItemValue> extends FormControlPickerProps<T[], PickerLocale, ItemDataType<T>, T>, MultiCascadeTreeProps<T, T[], PickerLocale>, Pick<PickerToggleProps, 'loading'> {
7
7
  /**
8
8
  * A picker that can be counted
9
9
  */
@@ -267,6 +267,8 @@ var MultiCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
267
267
  target: trigger,
268
268
  onKeyDown: onPickerKeyDown
269
269
  }, searchable && /*#__PURE__*/React.createElement(SearchView, {
270
+ locale: locale,
271
+ cascade: cascade,
270
272
  data: items,
271
273
  value: value,
272
274
  searchKeyword: searchKeyword,
@@ -274,6 +276,7 @@ var MultiCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
274
276
  labelKey: labelKey,
275
277
  childrenKey: childrenKey,
276
278
  disabledItemValues: disabledItemValues,
279
+ inputRef: searchInput,
277
280
  onCheck: handleCheck,
278
281
  onSearch: handleSearch
279
282
  }), !searchKeyword && /*#__PURE__*/React.createElement(TreeView, {
@@ -216,6 +216,7 @@ var TreePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
216
216
  searchable: searchable,
217
217
  searchKeyword: searchKeyword,
218
218
  searchBy: searchBy,
219
+ searchInputRef: searchInput,
219
220
  loadingNodeValues: loadingNodeValues,
220
221
  flattenedNodes: flattenedNodes,
221
222
  listProps: listProps,