rsuite 5.52.0 → 5.53.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/AutoComplete/styles/index.css +4 -0
- package/CHANGELOG.md +25 -0
- package/Cascader/styles/index.css +4 -0
- package/CheckPicker/styles/index.css +4 -0
- package/CheckTree/styles/index.css +34 -14
- package/CheckTreePicker/styles/index.css +34 -14
- package/CheckTreePicker/styles/index.less +39 -29
- package/DatePicker/styles/index.css +4 -0
- package/DateRangePicker/styles/index.css +4 -0
- package/InputGroup/styles/index.css +5 -0
- package/InputGroup/styles/index.less +1 -1
- package/InputNumber/styles/index.css +2 -0
- package/InputPicker/styles/index.css +4 -0
- package/Message/styles/index.css +170 -29
- package/Message/styles/index.less +42 -3
- package/Message/styles/mixin.less +18 -3
- package/MultiCascader/styles/index.css +4 -0
- package/Pagination/styles/index.css +4 -0
- package/SelectPicker/styles/index.css +4 -0
- package/Tabs/package.json +7 -0
- package/Tabs/styles/index.css +1816 -0
- package/Tabs/styles/index.less +28 -0
- package/TagInput/styles/index.css +4 -0
- package/TagPicker/styles/index.css +4 -0
- package/Tree/styles/index.css +10 -4
- package/TreePicker/styles/index.css +10 -4
- package/TreePicker/styles/index.less +9 -5
- package/cjs/Carousel/Carousel.js +1 -1
- package/cjs/CheckTreePicker/CheckTreeNode.js +1 -1
- package/cjs/DateRangePicker/DateRangePicker.d.ts +10 -10
- package/cjs/DateRangePicker/DateRangePicker.js +1 -1
- package/cjs/DateRangePicker/index.d.ts +1 -1
- package/cjs/Dropdown/DropdownItem.js +4 -2
- package/cjs/Message/Message.d.ts +28 -6
- package/cjs/Message/Message.js +17 -11
- package/cjs/Nav/Nav.d.ts +2 -0
- package/cjs/Nav/Nav.js +14 -10
- package/cjs/Panel/Panel.js +2 -2
- package/cjs/Stack/Stack.js +2 -2
- package/cjs/Steps/Steps.js +1 -1
- package/cjs/Tabs/Tab.d.ts +25 -0
- package/cjs/Tabs/Tab.js +21 -0
- package/cjs/Tabs/TabPanel.d.ts +10 -0
- package/cjs/Tabs/TabPanel.js +33 -0
- package/cjs/Tabs/Tabs.d.ts +50 -0
- package/cjs/Tabs/Tabs.js +221 -0
- package/cjs/Tabs/index.d.ts +3 -0
- package/cjs/Tabs/index.js +9 -0
- package/cjs/Timeline/Timeline.js +1 -1
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +3 -1
- package/cjs/internals/Menu/Menu.js +12 -1
- package/cjs/internals/Picker/ListCheckItem.js +7 -2
- package/cjs/internals/Picker/ListItem.js +6 -2
- package/cjs/internals/Picker/TreeView.js +1 -1
- package/cjs/utils/ReactChildren.d.ts +2 -2
- package/cjs/utils/ReactChildren.js +22 -20
- package/cjs/utils/index.d.ts +2 -0
- package/cjs/utils/index.js +8 -2
- package/cjs/utils/statusIcons.js +2 -2
- package/dist/rsuite-no-reset-rtl.css +212 -35
- package/dist/rsuite-no-reset-rtl.min.css +1 -1
- package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
- package/dist/rsuite-no-reset.css +212 -35
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite-no-reset.min.css.map +1 -1
- package/dist/rsuite-rtl.css +212 -35
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +212 -35
- package/dist/rsuite.js +84 -51
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.css.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/Carousel/Carousel.js +1 -1
- package/esm/CheckTreePicker/CheckTreeNode.js +1 -1
- package/esm/DateRangePicker/DateRangePicker.d.ts +10 -10
- package/esm/DateRangePicker/DateRangePicker.js +1 -1
- package/esm/DateRangePicker/index.d.ts +1 -1
- package/esm/Dropdown/DropdownItem.js +4 -2
- package/esm/Message/Message.d.ts +28 -6
- package/esm/Message/Message.js +19 -13
- package/esm/Nav/Nav.d.ts +2 -0
- package/esm/Nav/Nav.js +13 -9
- package/esm/Panel/Panel.js +2 -2
- package/esm/Stack/Stack.js +3 -3
- package/esm/Steps/Steps.js +1 -1
- package/esm/Tabs/Tab.d.ts +25 -0
- package/esm/Tabs/Tab.js +15 -0
- package/esm/Tabs/TabPanel.d.ts +10 -0
- package/esm/Tabs/TabPanel.js +27 -0
- package/esm/Tabs/Tabs.d.ts +50 -0
- package/esm/Tabs/Tabs.js +215 -0
- package/esm/Tabs/index.d.ts +3 -0
- package/esm/Tabs/index.js +3 -0
- package/esm/Timeline/Timeline.js +1 -1
- package/esm/index.d.ts +2 -0
- package/esm/index.js +1 -0
- package/esm/internals/Menu/Menu.js +12 -1
- package/esm/internals/Picker/ListCheckItem.js +7 -2
- package/esm/internals/Picker/ListItem.js +6 -2
- package/esm/internals/Picker/TreeView.js +1 -1
- package/esm/utils/ReactChildren.d.ts +2 -2
- package/esm/utils/ReactChildren.js +22 -20
- package/esm/utils/index.d.ts +2 -0
- package/esm/utils/index.js +3 -1
- package/esm/utils/statusIcons.js +2 -2
- package/internals/Picker/styles/index.less +1 -1
- package/package.json +1 -1
- package/styles/color-modes/dark.less +4 -0
- package/styles/color-modes/light.less +18 -4
- package/styles/index.less +1 -0
- package/styles/mixins/listbox.less +2 -7
- package/styles/variables.less +2 -1
package/esm/Carousel/Carousel.js
CHANGED
|
@@ -91,7 +91,7 @@ var Carousel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
91
91
|
var uniqueId = useMemo(function () {
|
|
92
92
|
return guid();
|
|
93
93
|
}, []);
|
|
94
|
-
var items =
|
|
94
|
+
var items = ReactChildren.map(children, function (child, index) {
|
|
95
95
|
var _extends2;
|
|
96
96
|
if (!child) {
|
|
97
97
|
return;
|
|
@@ -126,7 +126,7 @@ var CheckTreeNode = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
126
126
|
title: getTitle(),
|
|
127
127
|
onSelect: handleSelect
|
|
128
128
|
}, /*#__PURE__*/React.createElement("span", {
|
|
129
|
-
className: prefix('
|
|
129
|
+
className: prefix('label-content')
|
|
130
130
|
}, typeof renderTreeNode === 'function' ? renderTreeNode(nodeData) : label))) : null;
|
|
131
131
|
});
|
|
132
132
|
CheckTreeNode.displayName = 'CheckTreeNode';
|
|
@@ -72,28 +72,28 @@ export interface DateRangePickerProps extends PickerBaseProps<DateRangePickerLoc
|
|
|
72
72
|
/** Custom render for calendar title */
|
|
73
73
|
renderTitle?: (date: Date) => React.ReactNode;
|
|
74
74
|
}
|
|
75
|
-
export interface
|
|
75
|
+
export interface DateRangePickerComponent extends PickerComponent<DateRangePickerProps> {
|
|
76
76
|
/** Allow the maximum number of days specified, other dates are disabled */
|
|
77
|
-
allowedMaxDays
|
|
77
|
+
allowedMaxDays: (days: number) => DisabledDateFunction;
|
|
78
78
|
/** Only allowed days are specified, other dates are disabled */
|
|
79
|
-
allowedDays
|
|
79
|
+
allowedDays: (days: number) => DisabledDateFunction;
|
|
80
80
|
/** Allow specified date range, other dates are disabled */
|
|
81
|
-
allowedRange
|
|
81
|
+
allowedRange: (startDate: string | Date, endDate: string | Date) => DisabledDateFunction;
|
|
82
82
|
/** Disable dates after the specified date */
|
|
83
|
-
before
|
|
83
|
+
before: (beforeDate: string | Date) => DisabledDateFunction;
|
|
84
84
|
/** Disable dates before the specified date */
|
|
85
|
-
after
|
|
85
|
+
after: (afterDate: string | Date) => DisabledDateFunction;
|
|
86
86
|
/** Disable dates after today. */
|
|
87
|
-
beforeToday
|
|
87
|
+
beforeToday: () => DisabledDateFunction;
|
|
88
88
|
/** Disable dates before today */
|
|
89
|
-
afterToday
|
|
89
|
+
afterToday: () => DisabledDateFunction;
|
|
90
90
|
/** Used to combine multiple conditions */
|
|
91
|
-
combine
|
|
91
|
+
combine: (...args: any) => DisabledDateFunction;
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
94
|
* A date range picker allows you to select a date range from a calendar.
|
|
95
95
|
*
|
|
96
96
|
* @see https://rsuitejs.com/components/date-range-picker
|
|
97
97
|
*/
|
|
98
|
-
declare const DateRangePicker:
|
|
98
|
+
declare const DateRangePicker: DateRangePickerComponent;
|
|
99
99
|
export default DateRangePicker;
|
|
@@ -622,7 +622,7 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
622
622
|
disabledShortcut: disabledShortcutButton,
|
|
623
623
|
onShortcutClick: handleShortcutPageDate,
|
|
624
624
|
"data-testid": "daterange-predefined-side"
|
|
625
|
-
}), /*#__PURE__*/React.createElement(
|
|
625
|
+
}), /*#__PURE__*/React.createElement(Stack.Item, null, /*#__PURE__*/React.createElement("div", {
|
|
626
626
|
className: prefix('daterange-content')
|
|
627
627
|
}, showHeader && /*#__PURE__*/React.createElement("div", {
|
|
628
628
|
className: prefix('daterange-header'),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import DateRangePicker from './DateRangePicker';
|
|
2
|
-
export type {
|
|
2
|
+
export type { DateRangePickerComponent, DateRangePickerProps } from './DateRangePicker';
|
|
3
3
|
export type { ValueType, DateRange, RangeType, DisabledDateFunction } from './types';
|
|
4
4
|
export default DateRangePicker;
|
|
@@ -1,13 +1,13 @@
|
|
|
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
|
-
import _pick from "lodash/pick";
|
|
5
4
|
import React, { useCallback, useContext, useEffect } from 'react';
|
|
6
5
|
import PropTypes from 'prop-types';
|
|
7
6
|
import { deprecatePropType, deprecatePropTypeNew, oneOf } from '../internals/propTypes';
|
|
8
7
|
import MenuItem from '../internals/Menu/MenuItem';
|
|
9
8
|
import DropdownContext from './DropdownContext';
|
|
10
9
|
import isNil from 'lodash/isNil';
|
|
10
|
+
import pick from 'lodash/pick';
|
|
11
11
|
import { mergeRefs, shallowEqual, useClassNames } from '../utils';
|
|
12
12
|
import NavContext from '../Nav/NavContext';
|
|
13
13
|
import useInternalId from '../utils/useInternalId';
|
|
@@ -83,7 +83,9 @@ var DropdownItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
83
83
|
}, props));
|
|
84
84
|
}
|
|
85
85
|
if (divider) {
|
|
86
|
-
return /*#__PURE__*/React.createElement(DropdownSeparator,
|
|
86
|
+
return /*#__PURE__*/React.createElement(DropdownSeparator, _extends({
|
|
87
|
+
as: "li"
|
|
88
|
+
}, pick(props, ['data-testid'])));
|
|
87
89
|
}
|
|
88
90
|
if (panel) {
|
|
89
91
|
return renderDropdownItem(_extends({
|
package/esm/Message/Message.d.ts
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { WithAsProps, TypeAttributes, RsRefForwardingComponent } from '../@types/common';
|
|
3
3
|
export interface MessageProps extends WithAsProps {
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* The type of the message box.
|
|
6
|
+
*/
|
|
5
7
|
type?: TypeAttributes.Status;
|
|
6
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Show a border around the message box.
|
|
10
|
+
* @version 5.53.0
|
|
11
|
+
*/
|
|
12
|
+
bordered?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Center the message vertically.
|
|
15
|
+
* @version 5.53.0
|
|
16
|
+
*/
|
|
17
|
+
centered?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether it is possible to close the message box
|
|
20
|
+
*/
|
|
7
21
|
closable?: boolean;
|
|
8
22
|
/**
|
|
9
23
|
* Delay automatic removal of messages.
|
|
@@ -15,13 +29,21 @@ export interface MessageProps extends WithAsProps {
|
|
|
15
29
|
*
|
|
16
30
|
*/
|
|
17
31
|
duration?: number;
|
|
18
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* The title of the message
|
|
34
|
+
*/
|
|
19
35
|
header?: React.ReactNode;
|
|
20
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Whether to display an icon
|
|
38
|
+
*/
|
|
21
39
|
showIcon?: boolean;
|
|
22
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Fill the container
|
|
42
|
+
*/
|
|
23
43
|
full?: boolean;
|
|
24
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Callback after the message is removed
|
|
46
|
+
*/
|
|
25
47
|
onClose?: (event?: React.MouseEvent<HTMLButtonElement>) => void;
|
|
26
48
|
}
|
|
27
49
|
/**
|
package/esm/Message/Message.js
CHANGED
|
@@ -3,9 +3,9 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
import _taggedTemplateLiteralLoose from "@babel/runtime/helpers/esm/taggedTemplateLiteralLoose";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
5
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
6
|
-
import React, { useState,
|
|
6
|
+
import React, { useState, useContext } from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { useClassNames, useTimeout, MESSAGE_STATUS_ICONS, STATUS, useIsMounted } from '../utils';
|
|
8
|
+
import { useClassNames, useTimeout, MESSAGE_STATUS_ICONS, STATUS, useIsMounted, useEventCallback } from '../utils';
|
|
9
9
|
import { oneOf } from '../internals/propTypes';
|
|
10
10
|
import CloseButton from '../internals/CloseButton';
|
|
11
11
|
import ToastContext from '../toaster/ToastContext';
|
|
@@ -17,6 +17,8 @@ var Message = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
17
17
|
var _withClassPrefix;
|
|
18
18
|
var _props$as = props.as,
|
|
19
19
|
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
20
|
+
bordered = props.bordered,
|
|
21
|
+
centered = props.centered,
|
|
20
22
|
className = props.className,
|
|
21
23
|
_props$classPrefix = props.classPrefix,
|
|
22
24
|
classPrefix = _props$classPrefix === void 0 ? 'message' : _props$classPrefix,
|
|
@@ -30,7 +32,7 @@ var Message = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
30
32
|
type = _props$type === void 0 ? 'info' : _props$type,
|
|
31
33
|
showIcon = props.showIcon,
|
|
32
34
|
onClose = props.onClose,
|
|
33
|
-
rest = _objectWithoutPropertiesLoose(props, ["as", "className", "classPrefix", "children", "closable", "duration", "full", "header", "type", "showIcon", "onClose"]);
|
|
35
|
+
rest = _objectWithoutPropertiesLoose(props, ["as", "bordered", "centered", "className", "classPrefix", "children", "closable", "duration", "full", "header", "type", "showIcon", "onClose"]);
|
|
34
36
|
var _useState = useState('show'),
|
|
35
37
|
display = _useState[0],
|
|
36
38
|
setDisplay = _useState[1];
|
|
@@ -43,7 +45,7 @@ var Message = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
43
45
|
usedToaster = _useContext.usedToaster; // Timed close message
|
|
44
46
|
var _useTimeout = useTimeout(onClose, duration, usedToaster && duration > 0),
|
|
45
47
|
clear = _useTimeout.clear;
|
|
46
|
-
var handleClose =
|
|
48
|
+
var handleClose = useEventCallback(function (event) {
|
|
47
49
|
setDisplay('hiding');
|
|
48
50
|
onClose === null || onClose === void 0 ? void 0 : onClose(event);
|
|
49
51
|
clear();
|
|
@@ -52,12 +54,14 @@ var Message = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
52
54
|
setDisplay('hide');
|
|
53
55
|
}
|
|
54
56
|
}, 1000);
|
|
55
|
-
}
|
|
57
|
+
});
|
|
56
58
|
if (display === 'hide') {
|
|
57
59
|
return null;
|
|
58
60
|
}
|
|
59
61
|
var classes = merge(className, withClassPrefix(type, display, (_withClassPrefix = {
|
|
60
|
-
full: full
|
|
62
|
+
full: full,
|
|
63
|
+
bordered: bordered,
|
|
64
|
+
centered: centered
|
|
61
65
|
}, _withClassPrefix['has-title'] = header, _withClassPrefix['has-icon'] = showIcon, _withClassPrefix)));
|
|
62
66
|
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
63
67
|
role: "alert"
|
|
@@ -69,7 +73,7 @@ var Message = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
69
73
|
}, closable && /*#__PURE__*/React.createElement(CloseButton, {
|
|
70
74
|
onClick: handleClose
|
|
71
75
|
}), showIcon && /*#__PURE__*/React.createElement("div", {
|
|
72
|
-
className: prefix(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["icon
|
|
76
|
+
className: prefix(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["icon"])))
|
|
73
77
|
}, MESSAGE_STATUS_ICONS[type]), /*#__PURE__*/React.createElement("div", {
|
|
74
78
|
className: prefix(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["content"])))
|
|
75
79
|
}, header && /*#__PURE__*/React.createElement("div", {
|
|
@@ -80,14 +84,16 @@ var Message = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
80
84
|
});
|
|
81
85
|
Message.displayName = 'Message';
|
|
82
86
|
Message.propTypes = {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
onClose: PropTypes.func,
|
|
87
|
+
bordered: PropTypes.bool,
|
|
88
|
+
centered: PropTypes.bool,
|
|
86
89
|
closable: PropTypes.bool,
|
|
87
|
-
|
|
90
|
+
className: PropTypes.string,
|
|
91
|
+
classPrefix: PropTypes.string,
|
|
88
92
|
description: PropTypes.node,
|
|
89
|
-
showIcon: PropTypes.bool,
|
|
90
93
|
full: PropTypes.bool,
|
|
91
|
-
|
|
94
|
+
onClose: PropTypes.func,
|
|
95
|
+
showIcon: PropTypes.bool,
|
|
96
|
+
title: PropTypes.node,
|
|
97
|
+
type: oneOf(STATUS)
|
|
92
98
|
};
|
|
93
99
|
export default Message;
|
package/esm/Nav/Nav.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export interface NavProps<T = any> extends WithAsProps, Omit<React.HTMLAttribute
|
|
|
16
16
|
pullRight?: boolean;
|
|
17
17
|
/** Active key, corresponding to eventkey in <Nav.item>. */
|
|
18
18
|
activeKey?: T;
|
|
19
|
+
/** Default active key, corresponding to eventkey in <Nav.item>. */
|
|
20
|
+
defaultActiveKey?: T;
|
|
19
21
|
/** Callback function triggered after selection */
|
|
20
22
|
onSelect?: (eventKey: T | undefined, event: React.SyntheticEvent) => void;
|
|
21
23
|
}
|
package/esm/Nav/Nav.js
CHANGED
|
@@ -4,11 +4,10 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
4
4
|
import React, { useContext, useEffect, useMemo } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import NavItem from './NavItem';
|
|
7
|
-
import { useClassNames } from '../utils';
|
|
7
|
+
import { useClassNames, useEnsuredRef, useInternalId, useControlled } from '../utils';
|
|
8
8
|
import { NavbarContext } from '../Navbar/Navbar';
|
|
9
9
|
import { SidenavContext } from '../Sidenav/Sidenav';
|
|
10
10
|
import NavContext from './NavContext';
|
|
11
|
-
import useEnsuredRef from '../utils/useEnsuredRef';
|
|
12
11
|
import Menubar from '../internals/Menu/Menubar';
|
|
13
12
|
import { oneOf } from '../internals/propTypes';
|
|
14
13
|
import NavDropdown from './NavDropdown';
|
|
@@ -20,7 +19,6 @@ import NavbarDropdownItem from '../Navbar/NavbarDropdownItem';
|
|
|
20
19
|
import SidenavDropdownItem from '../Sidenav/SidenavDropdownItem';
|
|
21
20
|
import NavbarItem from '../Navbar/NavbarItem';
|
|
22
21
|
import SidenavItem from '../Sidenav/SidenavItem';
|
|
23
|
-
import useInternalId from '../utils/useInternalId';
|
|
24
22
|
/**
|
|
25
23
|
* The `Nav` component is used to create navigation links.
|
|
26
24
|
* @see https://rsuitejs.com/components/nav
|
|
@@ -39,8 +37,9 @@ var Nav = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
39
37
|
className = props.className,
|
|
40
38
|
children = props.children,
|
|
41
39
|
activeKeyProp = props.activeKey,
|
|
40
|
+
defaultActiveKey = props.defaultActiveKey,
|
|
42
41
|
onSelectProp = props.onSelect,
|
|
43
|
-
rest = _objectWithoutPropertiesLoose(props, ["as", "classPrefix", "appearance", "vertical", "justified", "reversed", "pullRight", "className", "children", "activeKey", "onSelect"]);
|
|
42
|
+
rest = _objectWithoutPropertiesLoose(props, ["as", "classPrefix", "appearance", "vertical", "justified", "reversed", "pullRight", "className", "children", "activeKey", "defaultActiveKey", "onSelect"]);
|
|
44
43
|
var sidenav = useContext(SidenavContext);
|
|
45
44
|
|
|
46
45
|
// Whether inside a <Navbar>
|
|
@@ -63,15 +62,20 @@ var Nav = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
63
62
|
}));
|
|
64
63
|
var _ref = sidenav || {},
|
|
65
64
|
activeKeyFromSidenav = _ref.activeKey,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
onSelectFromSidenav = _ref.onSelect;
|
|
66
|
+
var _useControlled = useControlled(activeKeyProp !== null && activeKeyProp !== void 0 ? activeKeyProp : activeKeyFromSidenav, defaultActiveKey),
|
|
67
|
+
activeKey = _useControlled[0],
|
|
68
|
+
setActiveKey = _useControlled[1];
|
|
69
69
|
var contextValue = useMemo(function () {
|
|
70
70
|
return {
|
|
71
71
|
activeKey: activeKey,
|
|
72
|
-
onSelect:
|
|
72
|
+
onSelect: function onSelect(eventKey, event) {
|
|
73
|
+
setActiveKey(eventKey);
|
|
74
|
+
onSelectProp === null || onSelectProp === void 0 ? void 0 : onSelectProp(eventKey, event);
|
|
75
|
+
onSelectFromSidenav === null || onSelectFromSidenav === void 0 ? void 0 : onSelectFromSidenav(eventKey, event);
|
|
76
|
+
}
|
|
73
77
|
};
|
|
74
|
-
}, [activeKey, onSelectFromSidenav, onSelectProp]);
|
|
78
|
+
}, [activeKey, onSelectFromSidenav, onSelectProp, setActiveKey]);
|
|
75
79
|
if (sidenav !== null && sidenav !== void 0 && sidenav.expanded) {
|
|
76
80
|
return /*#__PURE__*/React.createElement(NavContext.Provider, {
|
|
77
81
|
value: contextValue
|
package/esm/Panel/Panel.js
CHANGED
|
@@ -75,14 +75,14 @@ var Panel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
75
75
|
onGroupSelect === null || onGroupSelect === void 0 ? void 0 : onGroupSelect(eventKey, event);
|
|
76
76
|
setExpanded(!expanded);
|
|
77
77
|
});
|
|
78
|
-
var renderBody =
|
|
78
|
+
var renderBody = function renderBody(bodyProps) {
|
|
79
79
|
var classes = prefix('body', {
|
|
80
80
|
'body-fill': bodyFill
|
|
81
81
|
});
|
|
82
82
|
return /*#__PURE__*/React.createElement("div", _extends({}, bodyProps, {
|
|
83
83
|
className: classes
|
|
84
84
|
}), children);
|
|
85
|
-
}
|
|
85
|
+
};
|
|
86
86
|
var renderCollapsibleBody = function renderCollapsibleBody() {
|
|
87
87
|
return /*#__PURE__*/React.createElement(Collapse, {
|
|
88
88
|
in: expanded,
|
package/esm/Stack/Stack.js
CHANGED
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { useClassNames, useCustom, isSupportFlexGap } from '../utils';
|
|
6
|
+
import { useClassNames, useCustom, isSupportFlexGap, ReactChildren } from '../utils';
|
|
7
7
|
import { oneOf } from '../internals/propTypes';
|
|
8
8
|
import StackItem from './StackItem';
|
|
9
9
|
/**
|
|
@@ -53,12 +53,12 @@ var Stack = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
53
53
|
* toArray remove undefined, null and boolean
|
|
54
54
|
*/
|
|
55
55
|
var filterChildren = React.Children.toArray(children);
|
|
56
|
-
var count = filterChildren
|
|
56
|
+
var count = ReactChildren.count(filterChildren);
|
|
57
57
|
return /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
|
|
58
58
|
ref: ref,
|
|
59
59
|
className: classes,
|
|
60
60
|
style: styles
|
|
61
|
-
}),
|
|
61
|
+
}), ReactChildren.map(filterChildren, function (child, index) {
|
|
62
62
|
var childNode = childrenRenderMode === 'wrap' && child.type !== StackItem ? /*#__PURE__*/React.createElement(StackItem, {
|
|
63
63
|
key: index,
|
|
64
64
|
className: prefix('item'),
|
package/esm/Steps/Steps.js
CHANGED
|
@@ -35,7 +35,7 @@ var Steps = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
35
35
|
vertical: vertical,
|
|
36
36
|
horizontal: !vertical
|
|
37
37
|
}));
|
|
38
|
-
var count =
|
|
38
|
+
var count = ReactChildren.count(children);
|
|
39
39
|
var items = ReactChildren.mapCloneElement(children, function (item, index) {
|
|
40
40
|
var itemStyles = {
|
|
41
41
|
flexBasis: index < count - 1 ? 100 / (count - 1) + "%" : undefined,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface TabProps {
|
|
3
|
+
/**
|
|
4
|
+
* The children of the tab.
|
|
5
|
+
*/
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* The disabled state of the tab.
|
|
9
|
+
*/
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The event key of the tab.
|
|
13
|
+
*/
|
|
14
|
+
eventKey?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The icon of the tab.
|
|
17
|
+
*/
|
|
18
|
+
icon?: React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Content for the tab title.
|
|
21
|
+
*/
|
|
22
|
+
title: React.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
declare const Tab: React.FC<TabProps>;
|
|
25
|
+
export default Tab;
|
package/esm/Tabs/Tab.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
var Tab = function Tab() {
|
|
5
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
6
|
+
};
|
|
7
|
+
Tab.displayName = 'Tab';
|
|
8
|
+
Tab.propTypes = {
|
|
9
|
+
disabled: PropTypes.bool,
|
|
10
|
+
eventKey: PropTypes.string,
|
|
11
|
+
title: PropTypes.node,
|
|
12
|
+
children: PropTypes.node,
|
|
13
|
+
icon: PropTypes.node
|
|
14
|
+
};
|
|
15
|
+
export default Tab;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WithAsProps } from '../@types/common';
|
|
3
|
+
interface TabPanelProps extends WithAsProps {
|
|
4
|
+
/** The active state of the tab. */
|
|
5
|
+
active?: boolean;
|
|
6
|
+
/** The HTML id attribute, which should be unique. */
|
|
7
|
+
id?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const TabPanel: React.ForwardRefExoticComponent<TabPanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export default TabPanel;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { useClassNames } from '../utils';
|
|
6
|
+
var TabPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
7
|
+
var _props$as = props.as,
|
|
8
|
+
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
9
|
+
_props$classPrefix = props.classPrefix,
|
|
10
|
+
classPrefix = _props$classPrefix === void 0 ? 'tab-panel' : _props$classPrefix,
|
|
11
|
+
children = props.children,
|
|
12
|
+
active = props.active,
|
|
13
|
+
className = props.className,
|
|
14
|
+
rest = _objectWithoutPropertiesLoose(props, ["as", "classPrefix", "children", "active", "className"]);
|
|
15
|
+
var _useClassNames = useClassNames(classPrefix),
|
|
16
|
+
withClassPrefix = _useClassNames.withClassPrefix,
|
|
17
|
+
merge = _useClassNames.merge;
|
|
18
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
19
|
+
role: "tabpanel",
|
|
20
|
+
ref: ref,
|
|
21
|
+
tabIndex: 0,
|
|
22
|
+
hidden: !active,
|
|
23
|
+
className: merge(className, withClassPrefix())
|
|
24
|
+
}, rest), children);
|
|
25
|
+
});
|
|
26
|
+
TabPanel.displayName = 'TabPanel';
|
|
27
|
+
export default TabPanel;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WithAsProps, RsRefForwardingComponent } from '../@types/common';
|
|
3
|
+
import Tab from './Tab';
|
|
4
|
+
export interface TabsProps extends WithAsProps {
|
|
5
|
+
/**
|
|
6
|
+
* The tabs appearance style.
|
|
7
|
+
*/
|
|
8
|
+
appearance?: 'tabs' | 'subtle';
|
|
9
|
+
/**
|
|
10
|
+
* Mark the Tab with a matching `eventKey` as active.
|
|
11
|
+
*/
|
|
12
|
+
activeKey?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The default active tabKey.
|
|
15
|
+
*/
|
|
16
|
+
defaultActiveKey?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Reversed display.
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
reversed?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Vertical display.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
vertical?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The HTML id attribute, which should be unique.
|
|
29
|
+
* @default use generated id
|
|
30
|
+
*/
|
|
31
|
+
id?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Callback fired when a Tab is selected.
|
|
34
|
+
* @param eventKey
|
|
35
|
+
* @param event
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
onSelect?: (eventKey: string | undefined, event: React.SyntheticEvent) => void;
|
|
39
|
+
}
|
|
40
|
+
interface TabsComponent extends RsRefForwardingComponent<'div', TabsProps> {
|
|
41
|
+
Tab: typeof Tab;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Tabs are a set of layered sections of content, known as tab panels, that display one panel of content at a time.
|
|
45
|
+
*
|
|
46
|
+
* @version 5.53.0
|
|
47
|
+
* @see https://rsuitejs.com/components/tabs
|
|
48
|
+
*/
|
|
49
|
+
declare const Tabs: TabsComponent;
|
|
50
|
+
export default Tabs;
|