rsuite 5.23.2 → 5.23.3

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.
@@ -1,3 +1,4 @@
1
- import { ItemDataType } from '../@types/common';
2
1
  export declare function transformData(data: any[]): any[];
3
- export declare const shouldDisplay: (filterBy: ((value: string, item: ItemDataType) => boolean) | undefined, value: any) => (item: any) => boolean;
2
+ export declare const shouldDisplay: <TItem extends {
3
+ label: string;
4
+ }>(filterBy: ((value: string, item: TItem) => boolean) | undefined, value: string) => (item: TItem) => boolean;
@@ -27,7 +27,7 @@ export var shouldDisplay = function shouldDisplay(filterBy, value) {
27
27
  return false;
28
28
  }
29
29
 
30
- var keyword = (value || '').toLocaleLowerCase();
30
+ var keyword = value.toLocaleLowerCase();
31
31
  return ("" + item.label).toLocaleLowerCase().indexOf(keyword) >= 0;
32
32
  };
33
33
  };
@@ -1,4 +1,5 @@
1
1
  import { WithAsProps, RsRefForwardingComponent } from '../@types/common';
2
+ import Stack from '../Stack';
2
3
  export interface ButtonToolbarProps extends WithAsProps {
3
4
  /**
4
5
  * The ARIA role describing the button toolbar. Generally the default
@@ -7,5 +8,5 @@ export interface ButtonToolbarProps extends WithAsProps {
7
8
  */
8
9
  role?: string;
9
10
  }
10
- declare const ButtonToolbar: RsRefForwardingComponent<'div', ButtonToolbarProps>;
11
+ declare const ButtonToolbar: RsRefForwardingComponent<typeof Stack, ButtonToolbarProps>;
11
12
  export default ButtonToolbar;
@@ -3,22 +3,29 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  import React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { useClassNames } from '../utils';
6
+ import Stack from '../Stack';
6
7
  var ButtonToolbar = /*#__PURE__*/React.forwardRef(function (props, ref) {
7
8
  var className = props.className,
8
9
  _props$classPrefix = props.classPrefix,
9
10
  classPrefix = _props$classPrefix === void 0 ? 'btn-toolbar' : _props$classPrefix,
10
11
  _props$as = props.as,
11
- Component = _props$as === void 0 ? 'div' : _props$as,
12
+ Component = _props$as === void 0 ? Stack : _props$as,
12
13
  _props$role = props.role,
13
14
  role = _props$role === void 0 ? 'toolbar' : _props$role,
14
15
  rest = _objectWithoutPropertiesLoose(props, ["className", "classPrefix", "as", "role"]);
15
16
 
17
+ var stackProps = Component === Stack ? {
18
+ wrap: true,
19
+ spacing: 10,
20
+ childrenRenderMode: 'clone'
21
+ } : null;
22
+
16
23
  var _useClassNames = useClassNames(classPrefix),
17
24
  withClassPrefix = _useClassNames.withClassPrefix,
18
25
  merge = _useClassNames.merge;
19
26
 
20
27
  var classes = merge(className, withClassPrefix());
21
- return /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
28
+ return /*#__PURE__*/React.createElement(Component, _extends({}, stackProps, rest, {
22
29
  role: role,
23
30
  ref: ref,
24
31
  className: classes
@@ -432,7 +432,8 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
432
432
  classPrefix: 'picker-cascader-menu',
433
433
  cascadeData: columnData,
434
434
  cascadePaths: selectedPaths,
435
- activeItemValue: value,
435
+ activeItemValue: value // FIXME make onSelect generic
436
+ ,
436
437
  onSelect: handleSelect,
437
438
  renderMenu: renderMenu,
438
439
  renderMenuItem: renderMenuItem
@@ -1,18 +1,23 @@
1
1
  /// <reference types="react" />
2
- import { CascaderProps } from './Cascader';
3
- import { ItemDataType } from '../@types/common';
4
- export declare function getColumnsAndPaths<T extends ItemDataType>(data: T[], value: any, options: any): {
5
- columns: ItemDataType<string | number>[][];
2
+ export declare function getColumnsAndPaths<T extends Record<string, unknown>>(data: T[], value: any, options: any): {
3
+ columns: T[][];
6
4
  paths: T[];
7
5
  };
8
- export declare function usePaths(props: CascaderProps): {
6
+ declare type UsePathsParams<T> = {
7
+ data: T[];
8
+ valueKey: string;
9
+ childrenKey: string;
10
+ value: unknown;
11
+ };
12
+ export declare function usePaths<T extends Record<string, unknown>>(params: UsePathsParams<T>): {
9
13
  enforceUpdate: (nextValue: any, isAttachChildren?: boolean) => void;
10
- columnData: ItemDataType<string | number>[][];
11
- valueToPaths: ItemDataType<string | number>[];
12
- selectedPaths: ItemDataType<string | number>[];
13
- setValueToPaths: import("react").Dispatch<import("react").SetStateAction<ItemDataType<string | number>[]>>;
14
- setColumnData: import("react").Dispatch<import("react").SetStateAction<ItemDataType<string | number>[][]>>;
15
- setSelectedPaths: import("react").Dispatch<import("react").SetStateAction<ItemDataType<string | number>[]>>;
16
- addColumn: (column: ItemDataType[], index: number) => void;
14
+ columnData: T[][];
15
+ valueToPaths: T[];
16
+ selectedPaths: T[];
17
+ setValueToPaths: import("react").Dispatch<import("react").SetStateAction<T[]>>;
18
+ setColumnData: import("react").Dispatch<import("react").SetStateAction<T[][]>>;
19
+ setSelectedPaths: import("react").Dispatch<import("react").SetStateAction<T[]>>;
20
+ addColumn: (column: T[], index: number) => void;
17
21
  romoveColumnByIndex: (index: number) => void;
18
22
  };
23
+ export {};
@@ -72,11 +72,11 @@ export function getColumnsAndPaths(data, value, options) {
72
72
  paths: paths
73
73
  };
74
74
  }
75
- export function usePaths(props) {
76
- var data = props.data,
77
- valueKey = props.valueKey,
78
- childrenKey = props.childrenKey,
79
- value = props.value;
75
+ export function usePaths(params) {
76
+ var data = params.data,
77
+ valueKey = params.valueKey,
78
+ childrenKey = params.childrenKey,
79
+ value = params.value;
80
80
 
81
81
  var _useMemo = useMemo(function () {
82
82
  return getColumnsAndPaths(data, value, {
@@ -9,25 +9,28 @@ interface ItemKeys {
9
9
  labelKey: string;
10
10
  childrenKey: string;
11
11
  }
12
+ declare type MayHasParent<T extends Record<string, unknown>> = T & {
13
+ parent?: MayHasParent<T>;
14
+ };
12
15
  /**
13
16
  * Get all parents of a node
14
17
  * @param node
15
18
  */
16
- export declare const getParents: (node: ItemType) => ItemType[];
19
+ export declare const getParents: <T extends Record<string, unknown>>(node: MayHasParent<T>) => MayHasParent<T>[];
17
20
  /**
18
21
  * Check if any child nodes are selected.
19
22
  * @param node
20
23
  * @param value
21
24
  * @param itemKeys
22
25
  */
23
- export declare const isSomeChildChecked: (node: ItemDataType, value: ValueType, itemKeys: Omit<ItemKeys, 'labelKey'>) => any;
26
+ export declare const isSomeChildChecked: <T extends Record<string, unknown>>(node: T, value: ValueType, itemKeys: Omit<ItemKeys, 'labelKey'>) => any;
24
27
  /**
25
28
  * Check if the parent is selected.
26
29
  * @param node
27
30
  * @param value
28
31
  * @param itemKeys
29
32
  */
30
- export declare const isSomeParentChecked: (node: ItemDataType, value: ValueType, itemKeys: Pick<ItemKeys, 'valueKey'>) => any;
33
+ export declare const isSomeParentChecked: <T extends Record<string, unknown>>(node: MayHasParent<T>, value: ValueType, itemKeys: Pick<ItemKeys, 'valueKey'>) => any;
31
34
  export declare const getOtherItemValuesByUnselectChild: <T>(itemNode: ItemType, value: any, itemKeys: Omit<ItemKeys, 'labelKey'>) => T[];
32
35
  /**
33
36
  * Remove the values of all children.
@@ -37,20 +40,20 @@ export declare const removeAllChildrenValue: <T>(value: T[], item: ItemType, ite
37
40
  * A hook to flatten tree structure data
38
41
  * @param data
39
42
  */
40
- export declare function useFlattenData(data: ItemDataType[], itemKeys: ItemKeys): {
41
- addFlattenData: (children: ItemDataType[], parent: ItemDataType) => void;
42
- flattenData: ItemDataType<string | number>[];
43
+ export declare function useFlattenData<T>(data: T[], itemKeys: ItemKeys): {
44
+ addFlattenData: (children: T[], parent: T) => void;
45
+ flattenData: T[];
43
46
  };
44
47
  /**
45
48
  * A hook for column data
46
49
  * @param flattenData
47
50
  */
48
- export declare function useColumnData(flattenData: ItemType[]): {
49
- columnData: ItemDataType<string | number>[][];
50
- addColumn: (column: ItemDataType[], index: number) => void;
51
+ export declare function useColumnData<T extends MayHasParent<Record<string, unknown>>>(flattenData: T[]): {
52
+ columnData: T[][];
53
+ addColumn: (column: T[], index: number) => void;
51
54
  romoveColumnByIndex: (index: number) => void;
52
- setColumnData: import("react").Dispatch<import("react").SetStateAction<ItemDataType<string | number>[][]>>;
53
- enforceUpdateColumnData: (nextData: ItemDataType[]) => void;
55
+ setColumnData: import("react").Dispatch<import("react").SetStateAction<T[][]>>;
56
+ enforceUpdateColumnData: (nextData: T[]) => void;
54
57
  };
55
58
  /**
56
59
  * A hook that converts the value into a cascading value
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { OverlayTriggerHandle } from './PickerToggleTrigger';
3
- import { TypeAttributes, ItemDataType } from '../@types/common';
3
+ import { TypeAttributes } from '../@types/common';
4
4
  import type { ListHandle } from '../Windowing';
5
5
  export interface NodeKeys {
6
6
  valueKey: string;
@@ -86,24 +86,25 @@ export interface ToggleKeyDownEventProps {
86
86
  * @param props
87
87
  */
88
88
  export declare const useToggleKeyDownEvent: (props: ToggleKeyDownEventProps) => (event: React.KeyboardEvent) => void;
89
- export interface SearchProps {
89
+ export interface SearchProps<TItem extends Record<string, unknown>, TLabel> {
90
90
  labelKey: string;
91
- data: ItemDataType[];
92
- searchBy?: (keyword: any, label: any, item: any) => boolean;
93
- callback?: (keyword: string, data: ItemDataType[], event: React.SyntheticEvent) => void;
91
+ data: TItem[];
92
+ searchBy?: (keyword: string, label: TLabel, item: TItem) => boolean;
93
+ callback?: (keyword: string, data: TItem[], event: React.SyntheticEvent) => void;
94
94
  }
95
+ declare type UseSearchResult<TItem extends Record<string, unknown>> = {
96
+ searchKeyword: string;
97
+ filteredData: TItem[];
98
+ updateFilteredData: (nextData: TItem[]) => void;
99
+ setSearchKeyword: (value: string) => void;
100
+ checkShouldDisplay: (item: TItem, keyword?: string) => boolean;
101
+ handleSearch: (searchKeyword: string, event: React.SyntheticEvent) => void;
102
+ };
95
103
  /**
96
104
  * A hook that handles search filter options
97
105
  * @param props
98
106
  */
99
- export declare function useSearch(props: SearchProps): {
100
- searchKeyword: string;
101
- filteredData: import("../CheckTreePicker/utils").TreeNodeType[];
102
- updateFilteredData: (nextData: ItemDataType[]) => void;
103
- setSearchKeyword: React.Dispatch<React.SetStateAction<string>>;
104
- checkShouldDisplay: (item: ItemDataType, keyword?: string) => boolean;
105
- handleSearch: (searchKeyword: string, event: React.SyntheticEvent) => void;
106
- };
107
+ export declare function useSearch<TItem extends Record<string, unknown>, TLabel>(props: SearchProps<TItem, TLabel>): UseSearchResult<TItem>;
107
108
  export interface PickerDependentParameters {
108
109
  triggerRef?: React.RefObject<OverlayTriggerHandle>;
109
110
  rootRef?: React.RefObject<HTMLElement>;
@@ -116,3 +117,4 @@ export interface PickerDependentParameters {
116
117
  * A hook of the exposed method of Picker
117
118
  */
118
119
  export declare function usePublicMethods(ref: any, parmas: PickerDependentParameters): void;
120
+ export {};
@@ -22,6 +22,10 @@ export interface StackProps extends WithAsProps {
22
22
  * Define whether the children in the stack are forced onto one line or can wrap onto multiple lines
23
23
  */
24
24
  wrap?: boolean;
25
+ /**
26
+ * The render mode of the children.
27
+ */
28
+ childrenRenderMode?: 'clone' | 'wrap';
25
29
  }
26
30
  export interface StackComponent extends RsRefForwardingComponent<'div', StackProps> {
27
31
  Item: typeof StackItem;
@@ -13,6 +13,8 @@ var Stack = /*#__PURE__*/React.forwardRef(function (props, ref) {
13
13
  alignItems = _props$alignItems === void 0 ? 'center' : _props$alignItems,
14
14
  _props$classPrefix = props.classPrefix,
15
15
  classPrefix = _props$classPrefix === void 0 ? 'stack' : _props$classPrefix,
16
+ _props$childrenRender = props.childrenRenderMode,
17
+ childrenRenderMode = _props$childrenRender === void 0 ? 'wrap' : _props$childrenRender,
16
18
  className = props.className,
17
19
  children = props.children,
18
20
  direction = props.direction,
@@ -21,7 +23,7 @@ var Stack = /*#__PURE__*/React.forwardRef(function (props, ref) {
21
23
  divider = props.divider,
22
24
  style = props.style,
23
25
  wrap = props.wrap,
24
- rest = _objectWithoutPropertiesLoose(props, ["as", "alignItems", "classPrefix", "className", "children", "direction", "justifyContent", "spacing", "divider", "style", "wrap"]);
26
+ rest = _objectWithoutPropertiesLoose(props, ["as", "alignItems", "classPrefix", "childrenRenderMode", "className", "children", "direction", "justifyContent", "spacing", "divider", "style", "wrap"]);
25
27
 
26
28
  var _useCustom = useCustom('Stack'),
27
29
  rtl = _useCustom.rtl;
@@ -32,16 +34,16 @@ var Stack = /*#__PURE__*/React.forwardRef(function (props, ref) {
32
34
  prefix = _useClassNames.prefix;
33
35
 
34
36
  var classes = merge(className, withClassPrefix());
35
- var isSupportGridGap = isSupportFlexGap();
36
- var gridGap = Array.isArray(spacing) ? spacing : [spacing, 0];
37
- var itemStyles = (_itemStyles = {}, _itemStyles[rtl ? 'marginLeft' : 'marginRight'] = gridGap[0], _itemStyles.marginBottom = gridGap[1], _itemStyles);
37
+ var isSupportGap = isSupportFlexGap();
38
+ var flexGap = Array.isArray(spacing) ? spacing : [spacing, spacing];
39
+ var itemStyles = (_itemStyles = {}, _itemStyles[rtl ? 'marginLeft' : 'marginRight'] = flexGap[0], _itemStyles.marginBottom = flexGap[1], _itemStyles);
38
40
 
39
41
  var styles = _extends({
40
42
  alignItems: alignItems,
41
43
  justifyContent: justifyContent,
42
44
  flexDirection: direction,
43
45
  flexWrap: wrap ? 'wrap' : undefined,
44
- gap: isSupportGridGap ? spacing : undefined
46
+ gap: isSupportGap ? spacing : undefined
45
47
  }, style);
46
48
  /*
47
49
  * toArray remove undefined, null and boolean
@@ -55,13 +57,13 @@ var Stack = /*#__PURE__*/React.forwardRef(function (props, ref) {
55
57
  className: classes,
56
58
  style: styles
57
59
  }), React.Children.map(filterChildren, function (child, index) {
58
- var childNode = child.type !== StackItem ? /*#__PURE__*/React.createElement(StackItem, {
60
+ var childNode = childrenRenderMode === 'wrap' && child.type !== StackItem ? /*#__PURE__*/React.createElement(StackItem, {
59
61
  key: index,
60
62
  className: prefix('item'),
61
- style: !isSupportGridGap ? itemStyles : undefined
63
+ style: !isSupportGap ? itemStyles : undefined
62
64
  }, child) : /*#__PURE__*/React.cloneElement(child, {
63
65
  className: merge(prefix('item'), child.props.className),
64
- style: !isSupportGridGap ? _extends({}, itemStyles, child.props.style) : child.props.style
66
+ style: !isSupportGap ? _extends({}, itemStyles, child.props.style) : child.props.style
65
67
  });
66
68
  return [childNode, index < count - 1 ? divider : null];
67
69
  }));
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  import { TreeNodeType, TreeNodesType } from '../CheckTreePicker/utils';
3
3
  import { TREE_NODE_DROP_POSITION } from '../utils';
4
4
  import { CheckTreePickerProps } from '../CheckTreePicker/CheckTreePicker';
5
- import { ItemDataType } from '../@types/common';
6
5
  import { TreePickerProps } from '../TreePicker/TreePicker';
7
6
  import { ListHandle } from '../Windowing';
8
7
  declare type PartialTreeProps = Partial<TreePickerProps | CheckTreePickerProps>;
@@ -11,14 +10,14 @@ declare type PartialTreeProps = Partial<TreePickerProps | CheckTreePickerProps>;
11
10
  * @param {*} expandItemValues
12
11
  * @param {*} parentKeys
13
12
  */
14
- export declare function shouldShowNodeByParentExpanded(expandItemValues?: any[], parentKeys?: any[]): boolean;
13
+ export declare function shouldShowNodeByParentExpanded<T>(expandItemValues?: T[], parentKeys?: T[]): boolean;
15
14
  /**
16
15
  * flatten tree structure to array
17
16
  * @param {*} tree
18
17
  * @param {*} childrenKey
19
18
  * @param {*} executor
20
19
  */
21
- export declare function flattenTree(tree: any[], childrenKey?: string, executor?: (node: any, index: number) => any): any[];
20
+ export declare function flattenTree<TItem>(tree: TItem[], childrenKey?: string, executor?: (node: any, index: number) => any): TItem[];
22
21
  /**
23
22
  * get all ancestor nodes of given node
24
23
  * @param {*} node
@@ -30,7 +29,7 @@ export declare function getNodeParents(node: any, parentKey?: string, valueKey?:
30
29
  * @param node
31
30
  * @param valueKey
32
31
  */
33
- export declare function getNodeParentKeys(nodes: TreeNodesType, node: TreeNodeType, valueKey: string): TreeNodeType[];
32
+ export declare function getNodeParentKeys<T>(nodes: TreeNodesType, node: TreeNodeType, valueKey: string): T[];
34
33
  export declare function hasVisibleChildren(node: TreeNodeType, childrenKey: string): any;
35
34
  /**
36
35
  * shallow equal array
@@ -38,7 +37,7 @@ export declare function hasVisibleChildren(node: TreeNodeType, childrenKey: stri
38
37
  * @param b
39
38
  */
40
39
  export declare function compareArray(a: any[], b: any[]): boolean;
41
- export declare function getDefaultExpandItemValues(data: ItemDataType[], props: Required<Pick<TreePickerProps, 'defaultExpandAll' | 'valueKey' | 'childrenKey' | 'defaultExpandItemValues'>>): any[];
40
+ export declare function getDefaultExpandItemValues<TItem>(data: TItem[], props: Required<Pick<TreePickerProps, 'defaultExpandAll' | 'valueKey' | 'childrenKey' | 'defaultExpandItemValues'>>): any[];
42
41
  /**
43
42
  * 获取 expandItemValues 的 value
44
43
  * @param props
@@ -61,7 +60,10 @@ export declare function createUpdateTreeDataFunction(params: any, { valueKey, ch
61
60
  childrenKey: any;
62
61
  }): (tree: any[]) => any[];
63
62
  export declare function findNodeOfTree(data: any, check: any): any;
64
- export declare function filterNodesOfTree(data: any, check: any): TreeNodeType[];
63
+ declare type HasChildren<T extends Record<string, unknown>> = T & {
64
+ children?: readonly HasChildren<T>[];
65
+ };
66
+ export declare function filterNodesOfTree<TItem extends HasChildren<Record<string, unknown>>>(data: readonly TItem[], check: (item: TItem) => boolean): TItem[];
65
67
  /**
66
68
  * get all focusable items
67
69
  * exclude not visible and disabled node
@@ -70,7 +72,7 @@ export declare function filterNodesOfTree(data: any, check: any): TreeNodeType[]
70
72
  * @param isSearching - component is in Searching
71
73
  * @returns
72
74
  */
73
- export declare const getFocusableItems: (filteredData: ItemDataType[], props: Required<Pick<PartialTreeProps, 'disabledItemValues' | 'valueKey' | 'childrenKey' | 'expandItemValues'>>, isSearching?: boolean) => TreeNodeType[];
75
+ export declare const getFocusableItems: <TItem extends TreeNodeType>(filteredData: TItem[], props: Required<Pick<PartialTreeProps, 'disabledItemValues' | 'valueKey' | 'childrenKey' | 'expandItemValues'>>, isSearching?: boolean) => TItem[];
74
76
  /**
75
77
  * return all focusable Item and active Element index
76
78
  * @param focusItemValue
@@ -150,7 +152,13 @@ export { getTreeActiveNode };
150
152
  * toggle tree node
151
153
  * @param param0
152
154
  */
153
- export declare function toggleExpand({ node, isExpand, expandItemValues, valueKey }: any): ItemDataType<string | number>[];
155
+ export declare function toggleExpand<T>({ node, isExpand, expandItemValues, valueKey }: ToggleExpandOptions<T>): T[];
156
+ declare type ToggleExpandOptions<T> = {
157
+ node: Record<string, unknown>;
158
+ isExpand: boolean;
159
+ expandItemValues: T[];
160
+ valueKey: string;
161
+ };
154
162
  export declare function getTreeNodeTitle(label: any): string | undefined;
155
163
  /**
156
164
  * get all children from flattenNodes object by given parent node
@@ -158,12 +166,12 @@ export declare function getTreeNodeTitle(label: any): string | undefined;
158
166
  * @param parent
159
167
  */
160
168
  export declare function getChildrenByFlattenNodes(nodes: TreeNodesType, parent: TreeNodeType): TreeNodeType[];
161
- export declare function useTreeDrag(): {
162
- dragNode: ItemDataType<string | number> | null;
169
+ export declare function useTreeDrag<T>(): {
170
+ dragNode: T | null;
163
171
  dragOverNodeKey: null;
164
172
  dragNodeKeys: (string | number)[];
165
173
  dropNodePosition: TREE_NODE_DROP_POSITION | null;
166
- setDragNode: (node: ItemDataType | null) => void;
174
+ setDragNode: (node: T | null) => void;
167
175
  setDragOverNodeKey: React.Dispatch<React.SetStateAction<null>>;
168
176
  setDragNodeKeys: React.Dispatch<React.SetStateAction<(string | number)[]>>;
169
177
  setDropNodePosition: React.Dispatch<React.SetStateAction<TREE_NODE_DROP_POSITION | null>>;
@@ -193,7 +201,7 @@ export declare function useFlattenTreeData({ data, labelKey, valueKey, childrenK
193
201
  flattenTreeData: (treeData: TreeNodeType[], parent?: TreeNodeType, layer?: any) => never[] | undefined;
194
202
  serializeListOnlyParent: (nodes: TreeNodesType, key: string) => (string | number)[];
195
203
  unSerializeList: ({ nodes, key, value, cascade, uncheckableItemValues }: UnSerializeListProps) => void;
196
- formatVirtualizedTreeData: (nodes: TreeNodesType, data: any[], expandItemValues: ItemDataType[], options: {
204
+ formatVirtualizedTreeData: (nodes: TreeNodesType, data: any[], expandItemValues: unknown[], options: {
197
205
  cascade?: boolean;
198
206
  searchKeyword?: string;
199
207
  }) => TreeNodeType[];
@@ -205,28 +213,28 @@ export declare function useTreeNodeRefs(): {
205
213
  treeNodesRefs: {};
206
214
  saveTreeNodeRef: (ref: React.Ref<any>, refKey?: string) => void;
207
215
  };
208
- interface TreeSearchProps {
216
+ interface TreeSearchProps<T> {
209
217
  labelKey: string;
210
218
  childrenKey: string;
211
219
  searchKeyword?: string;
212
- data: ItemDataType[];
220
+ data: T[];
213
221
  searchBy?: (keyword: any, label: any, item: any) => boolean;
214
- callback?: (keyword: string, data: ItemDataType[], event: React.SyntheticEvent) => void;
222
+ callback?: (keyword: string, data: T[], event: React.SyntheticEvent) => void;
215
223
  }
216
224
  /**
217
225
  * A hook that handles tree search filter options
218
226
  * @param props
219
227
  */
220
- export declare function useTreeSearch<T extends HTMLElement = HTMLInputElement>(props: TreeSearchProps): {
228
+ export declare function useTreeSearch<T>(props: TreeSearchProps<T>): {
221
229
  searchKeywordState: string;
222
- filteredData: ItemDataType<string | number>[];
223
- setFilteredData: (data: ItemDataType[], searchKeyword: string) => void;
230
+ filteredData: T[];
231
+ setFilteredData: (data: T[], searchKeyword: string) => void;
224
232
  setSearchKeyword: React.Dispatch<React.SetStateAction<string>>;
225
- handleSearch: (searchKeyword: string, event: React.ChangeEvent<T>) => void;
233
+ handleSearch: (searchKeyword: string, event: React.ChangeEvent) => void;
226
234
  };
227
- export declare function useGetTreeNodeChildren(treeData: ItemDataType[], valueKey: string, childrenKey: string): {
228
- data: ItemDataType<string | number>[];
229
- setData: React.Dispatch<React.SetStateAction<ItemDataType<string | number>[]>>;
235
+ export declare function useGetTreeNodeChildren<T extends Record<string, unknown>>(treeData: T[], valueKey: string, childrenKey: string): {
236
+ data: T[];
237
+ setData: React.Dispatch<React.SetStateAction<T[]>>;
230
238
  loadingNodeValues: never[];
231
239
  loadChildren: (node: any, getChildren: any) => void;
232
240
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsuite",
3
- "version": "5.23.2",
3
+ "version": "5.23.3",
4
4
  "description": "A suite of react components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -520,7 +520,8 @@
520
520
 
521
521
  @modal-close-btn-size: @font-size-small;
522
522
  @modal-close-btn-line-height: @line-height-small;
523
- @modal-close-btn-color: var(--rs-text-primary);
523
+ @modal-close-btn-color: var(--rs-text-secondary);
524
+ @modal-close-btn-hover-color: var(--rs-text-primary);
524
525
 
525
526
  // Modal sizes
526
527
  @modal-lg: 968px;
@@ -540,7 +541,7 @@
540
541
 
541
542
  @drawer-close-btn-size: @font-size-small;
542
543
  @drawer-close-btn-line-height: @line-height-small;
543
- @drawer-close-btn-color: @modal-close-btn-color;
544
+ @drawer-close-btn-color: var(--rs-text-primary);
544
545
 
545
546
  // Drawer sizes
546
547
  @drawer-horizontal-lg: @modal-lg;