rsuite 5.66.0 → 5.68.0
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 +0 -1
- package/Button/styles/index.css +0 -1
- package/Button/styles/index.less +0 -1
- package/CHANGELOG.md +34 -0
- package/Calendar/styles/index.css +0 -1
- package/Cascader/styles/index.css +0 -1
- package/CheckPicker/styles/index.css +0 -1
- package/CheckTree/styles/index.css +0 -1
- package/CheckTreePicker/styles/index.css +0 -1
- package/DatePicker/styles/index.css +0 -1
- package/DateRangePicker/styles/index.css +0 -1
- package/Dropdown/styles/index.css +0 -1
- package/IconButton/styles/index.css +0 -1
- package/InputGroup/styles/index.css +0 -1
- package/InputNumber/styles/index.css +0 -1
- package/InputPicker/styles/index.css +0 -1
- package/MultiCascadeTree/styles/index.css +0 -1
- package/MultiCascader/styles/index.css +0 -1
- package/Nav/styles/index.css +68 -1
- package/Nav/styles/index.less +37 -0
- package/NavItem/package.json +3 -3
- package/Navbar/styles/index.css +0 -1
- package/Pagination/styles/index.css +0 -1
- package/SelectPicker/styles/index.css +0 -1
- package/Tabs/styles/index.css +68 -4
- package/Tabs/styles/index.less +0 -4
- package/TagInput/styles/index.css +0 -1
- package/TagPicker/styles/index.css +0 -1
- package/Uploader/styles/index.css +0 -1
- package/cjs/DateInput/DateInput.js +18 -2
- package/cjs/DateInput/hooks/useDateInputState.d.ts +1 -0
- package/cjs/DateInput/hooks/useDateInputState.js +10 -9
- package/cjs/DateInput/hooks/useKeyboardInputEvent.js +5 -0
- package/cjs/DateRangeInput/DateRangeInput.js +24 -2
- package/cjs/Form/Form.js +4 -10
- package/cjs/Form/FormContext.d.ts +2 -4
- package/cjs/Form/hooks/useFormValidate.d.ts +2 -2
- package/cjs/Form/hooks/useFormValidate.js +99 -35
- package/cjs/FormControl/FormControl.js +6 -22
- package/cjs/Nav/AdaptiveNavItem.d.ts +9 -0
- package/cjs/Nav/AdaptiveNavItem.js +89 -0
- package/cjs/Nav/Nav.d.ts +28 -9
- package/cjs/Nav/Nav.js +4 -74
- package/cjs/Nav/NavContext.d.ts +2 -2
- package/cjs/Nav/NavItem.d.ts +1 -1
- package/cjs/Navbar/NavbarItem.d.ts +1 -1
- package/cjs/Sidenav/Sidenav.d.ts +3 -3
- package/cjs/Stack/Stack.js +6 -1
- package/cjs/Tabs/Tabs.d.ts +20 -17
- package/cjs/Tabs/Tabs.js +5 -1
- package/cjs/Uploader/Uploader.d.ts +2 -2
- package/cjs/Uploader/Uploader.js +11 -9
- package/cjs/internals/Overlay/OverlayTrigger.d.ts +2 -2
- package/cjs/internals/Overlay/OverlayTrigger.js +17 -8
- package/cjs/internals/utils/BrowserDetection.js +6 -0
- package/cjs/internals/utils/ReactChildren.d.ts +6 -0
- package/cjs/internals/utils/ReactChildren.js +1 -0
- package/cjs/locales/ca_ES.d.ts +120 -0
- package/cjs/locales/ca_ES.js +87 -0
- package/cjs/locales/index.d.ts +1 -0
- package/cjs/locales/index.js +3 -1
- package/dist/rsuite-no-reset-rtl.css +65 -4
- 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 +65 -4
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite-no-reset.min.css.map +1 -1
- package/dist/rsuite-rtl.css +65 -4
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +65 -4
- package/dist/rsuite.js +25 -14
- 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/DateInput/DateInput.js +18 -2
- package/esm/DateInput/hooks/useDateInputState.d.ts +1 -0
- package/esm/DateInput/hooks/useDateInputState.js +11 -10
- package/esm/DateInput/hooks/useKeyboardInputEvent.js +5 -0
- package/esm/DateRangeInput/DateRangeInput.js +24 -2
- package/esm/Form/Form.js +4 -10
- package/esm/Form/FormContext.d.ts +2 -4
- package/esm/Form/hooks/useFormValidate.d.ts +2 -2
- package/esm/Form/hooks/useFormValidate.js +98 -34
- package/esm/FormControl/FormControl.js +6 -22
- package/esm/Nav/AdaptiveNavItem.d.ts +9 -0
- package/esm/Nav/AdaptiveNavItem.js +83 -0
- package/esm/Nav/Nav.d.ts +28 -9
- package/esm/Nav/Nav.js +6 -76
- package/esm/Nav/NavContext.d.ts +2 -2
- package/esm/Nav/NavItem.d.ts +1 -1
- package/esm/Navbar/NavbarItem.d.ts +1 -1
- package/esm/Sidenav/Sidenav.d.ts +3 -3
- package/esm/Stack/Stack.js +6 -1
- package/esm/Tabs/Tabs.d.ts +20 -17
- package/esm/Tabs/Tabs.js +6 -1
- package/esm/Uploader/Uploader.d.ts +2 -2
- package/esm/Uploader/Uploader.js +11 -9
- package/esm/internals/Overlay/OverlayTrigger.d.ts +2 -2
- package/esm/internals/Overlay/OverlayTrigger.js +18 -9
- package/esm/internals/utils/BrowserDetection.js +6 -0
- package/esm/internals/utils/ReactChildren.d.ts +6 -0
- package/esm/internals/utils/ReactChildren.js +1 -1
- package/esm/locales/ca_ES.d.ts +120 -0
- package/esm/locales/ca_ES.js +82 -0
- package/esm/locales/index.d.ts +1 -0
- package/esm/locales/index.js +1 -0
- package/locales/ca_ES/package.json +7 -0
- package/package.json +1 -1
- package/styles/color-modes/dark.less +7 -0
- package/styles/color-modes/high-contrast.less +7 -0
- package/styles/color-modes/light.less +8 -0
- package/styles/plugins/palette.js +34 -6
package/esm/Nav/Nav.d.ts
CHANGED
|
@@ -4,21 +4,40 @@ import { WithAsProps, RsRefForwardingComponent } from '../internals/types';
|
|
|
4
4
|
import NavDropdown from './NavDropdown';
|
|
5
5
|
import NavMenu from './NavMenu';
|
|
6
6
|
export interface NavProps<T = any> extends WithAsProps, Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> {
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The appearance style of the Nav component.
|
|
9
|
+
*
|
|
10
|
+
* @default 'default'
|
|
11
|
+
* @version 'pills' is supported in version 5.68.0
|
|
12
|
+
*/
|
|
13
|
+
appearance?: 'default' | 'subtle' | 'tabs' | 'pills';
|
|
14
|
+
/**
|
|
15
|
+
* Whether the Nav component is reversed.
|
|
16
|
+
*/
|
|
10
17
|
reversed?: boolean;
|
|
11
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Whether the Nav component is justified.
|
|
20
|
+
*/
|
|
12
21
|
justified?: boolean;
|
|
13
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Whether the Nav component is vertical.
|
|
24
|
+
*/
|
|
14
25
|
vertical?: boolean;
|
|
15
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Whether the Nav component is pulled to the right.
|
|
28
|
+
*/
|
|
16
29
|
pullRight?: boolean;
|
|
17
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* The active key of the Nav component.
|
|
32
|
+
*/
|
|
18
33
|
activeKey?: T;
|
|
19
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* The default active key of the Nav component.
|
|
36
|
+
*/
|
|
20
37
|
defaultActiveKey?: T;
|
|
21
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Event handler for selecting a Nav item.
|
|
40
|
+
*/
|
|
22
41
|
onSelect?: (eventKey: T | undefined, event: React.SyntheticEvent) => void;
|
|
23
42
|
}
|
|
24
43
|
interface NavComponent extends RsRefForwardingComponent<'div', NavProps> {
|
package/esm/Nav/Nav.js
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
var _excluded = ["as", "classPrefix", "appearance", "vertical", "justified", "reversed", "pullRight", "className", "children", "activeKey", "defaultActiveKey", "onSelect"];
|
|
5
|
-
import React, { useContext,
|
|
5
|
+
import React, { useContext, useMemo } from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import
|
|
8
|
-
import { useClassNames, useEnsuredRef, useInternalId, useControlled } from "../internals/hooks/index.js";
|
|
7
|
+
import { useClassNames, useEnsuredRef, useControlled } from "../internals/hooks/index.js";
|
|
9
8
|
import { NavbarContext } from "../Navbar/Navbar.js";
|
|
10
9
|
import { SidenavContext } from "../Sidenav/Sidenav.js";
|
|
11
10
|
import NavContext from "./NavContext.js";
|
|
@@ -13,13 +12,10 @@ import Menubar from "../internals/Menu/Menubar.js";
|
|
|
13
12
|
import { oneOf } from "../internals/propTypes/index.js";
|
|
14
13
|
import { deprecateComponent } from "../internals/utils/index.js";
|
|
15
14
|
import NavDropdown from "./NavDropdown.js";
|
|
16
|
-
import NavMenu
|
|
15
|
+
import NavMenu from "./NavMenu.js";
|
|
17
16
|
import NavDropdownItem from "./NavDropdownItem.js";
|
|
18
17
|
import NavDropdownMenu from "./NavDropdownMenu.js";
|
|
19
|
-
import
|
|
20
|
-
import SidenavDropdownItem from "../Sidenav/SidenavDropdownItem.js";
|
|
21
|
-
import NavbarItem from "../Navbar/NavbarItem.js";
|
|
22
|
-
import SidenavItem from "../Sidenav/SidenavItem.js";
|
|
18
|
+
import AdaptiveNavItem from "./AdaptiveNavItem.js";
|
|
23
19
|
/**
|
|
24
20
|
* The `Nav` component is used to create navigation links.
|
|
25
21
|
* @see https://rsuitejs.com/components/nav
|
|
@@ -114,80 +110,14 @@ var DeprecatedNavDropdown = deprecateComponent(NavDropdown, '<Nav.Dropdown> is d
|
|
|
114
110
|
DeprecatedNavDropdown.Menu = deprecateComponent(NavDropdownMenu, '<Nav.Dropdown.Menu> is deprecated, use <Nav.Menu> instead');
|
|
115
111
|
DeprecatedNavDropdown.Item = deprecateComponent(NavDropdownItem, '<Nav.Dropdown.Item> is deprecated, use <Nav.Item> instead');
|
|
116
112
|
Nav.Dropdown = DeprecatedNavDropdown;
|
|
117
|
-
|
|
118
|
-
* The <Nav.Item> API
|
|
119
|
-
* When used as direct child of <Nav>, render the NavItem
|
|
120
|
-
* When used within a <Nav.Menu>, render the NavDropdownItem
|
|
121
|
-
*/
|
|
122
|
-
Nav.Item = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
123
|
-
var nav = useContext(NavContext);
|
|
124
|
-
if (!nav) {
|
|
125
|
-
throw new Error('<Nav.Item> must be rendered within a <Nav> component.');
|
|
126
|
-
}
|
|
127
|
-
var parentNavMenu = useContext(NavMenuContext);
|
|
128
|
-
var navbar = useContext(NavbarContext);
|
|
129
|
-
var sidenav = useContext(SidenavContext);
|
|
130
|
-
var _ref2 = parentNavMenu !== null && parentNavMenu !== void 0 ? parentNavMenu : [],
|
|
131
|
-
dispatch = _ref2[1];
|
|
132
|
-
var _id = useInternalId('Nav.Item');
|
|
133
|
-
useEffect(function () {
|
|
134
|
-
if (dispatch) {
|
|
135
|
-
var _props$active;
|
|
136
|
-
dispatch({
|
|
137
|
-
type: NavMenuActionType.RegisterItem,
|
|
138
|
-
payload: {
|
|
139
|
-
_id: _id,
|
|
140
|
-
eventKey: props.eventKey,
|
|
141
|
-
active: (_props$active = props.active) !== null && _props$active !== void 0 ? _props$active : false
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
return function () {
|
|
145
|
-
dispatch({
|
|
146
|
-
type: NavMenuActionType.UnregisterItem,
|
|
147
|
-
payload: {
|
|
148
|
-
_id: _id
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
}, [dispatch, _id, props.eventKey, props.active]);
|
|
154
|
-
if (parentNavMenu) {
|
|
155
|
-
if (navbar) {
|
|
156
|
-
return /*#__PURE__*/React.createElement(NavbarDropdownItem, _extends({
|
|
157
|
-
ref: ref
|
|
158
|
-
}, props));
|
|
159
|
-
}
|
|
160
|
-
if (sidenav) {
|
|
161
|
-
return /*#__PURE__*/React.createElement(SidenavDropdownItem, _extends({
|
|
162
|
-
ref: ref
|
|
163
|
-
}, props));
|
|
164
|
-
}
|
|
165
|
-
return /*#__PURE__*/React.createElement(NavDropdownItem, _extends({
|
|
166
|
-
ref: ref
|
|
167
|
-
}, props));
|
|
168
|
-
}
|
|
169
|
-
if (navbar) {
|
|
170
|
-
return /*#__PURE__*/React.createElement(NavbarItem, _extends({
|
|
171
|
-
ref: ref
|
|
172
|
-
}, props));
|
|
173
|
-
}
|
|
174
|
-
if (sidenav) {
|
|
175
|
-
return /*#__PURE__*/React.createElement(SidenavItem, _extends({
|
|
176
|
-
ref: ref
|
|
177
|
-
}, props));
|
|
178
|
-
}
|
|
179
|
-
return /*#__PURE__*/React.createElement(NavItem, _extends({
|
|
180
|
-
ref: ref
|
|
181
|
-
}, props));
|
|
182
|
-
});
|
|
183
|
-
Nav.Item.displayName = 'Nav.Item';
|
|
113
|
+
Nav.Item = AdaptiveNavItem;
|
|
184
114
|
Nav.Menu = NavMenu;
|
|
185
115
|
Nav.displayName = 'Nav';
|
|
186
116
|
Nav.propTypes = {
|
|
187
117
|
classPrefix: PropTypes.string,
|
|
188
118
|
className: PropTypes.string,
|
|
189
119
|
children: PropTypes.node,
|
|
190
|
-
appearance: oneOf(['default', 'subtle', 'tabs']),
|
|
120
|
+
appearance: oneOf(['default', 'subtle', 'tabs', 'pills']),
|
|
191
121
|
// Reverse Direction of tabs/subtle
|
|
192
122
|
reversed: PropTypes.bool,
|
|
193
123
|
justified: PropTypes.bool,
|
package/esm/Nav/NavContext.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface NavContextProps {
|
|
3
|
-
activeKey: string | undefined;
|
|
4
|
-
onSelect?: (eventKey: string | undefined, event: React.SyntheticEvent) => void;
|
|
3
|
+
activeKey: string | number | undefined;
|
|
4
|
+
onSelect?: (eventKey: string | number | undefined, event: React.SyntheticEvent) => void;
|
|
5
5
|
}
|
|
6
6
|
declare const NavContext: React.Context<NavContextProps | null>;
|
|
7
7
|
export default NavContext;
|
package/esm/Nav/NavItem.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { RsRefForwardingComponent, WithAsProps } from '../internals/types';
|
|
3
3
|
import { IconProps } from '@rsuite/icons/lib/Icon';
|
|
4
|
-
export interface NavItemProps<T = string> extends WithAsProps, Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> {
|
|
4
|
+
export interface NavItemProps<T = string | number> extends WithAsProps, Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> {
|
|
5
5
|
/** Activation status */
|
|
6
6
|
active?: boolean;
|
|
7
7
|
/** Disabled status */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IconProps } from '@rsuite/icons/lib/Icon';
|
|
3
3
|
import { RsRefForwardingComponent, WithAsProps } from '../internals/types';
|
|
4
|
-
export interface NavbarItemProps<T = string> extends WithAsProps, Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> {
|
|
4
|
+
export interface NavbarItemProps<T = string | number> extends WithAsProps, Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> {
|
|
5
5
|
/** Activation status */
|
|
6
6
|
active?: boolean;
|
|
7
7
|
/** Disabled status */
|
package/esm/Sidenav/Sidenav.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import SidenavBody from './SidenavBody';
|
|
|
3
3
|
import SidenavHeader from './SidenavHeader';
|
|
4
4
|
import SidenavToggle from './SidenavToggle';
|
|
5
5
|
import { WithAsProps, RsRefForwardingComponent } from '../internals/types';
|
|
6
|
-
export interface SidenavProps<T = string> extends WithAsProps {
|
|
6
|
+
export interface SidenavProps<T = string | number> extends WithAsProps {
|
|
7
7
|
/** Whether to expand the Sidenav */
|
|
8
8
|
expanded?: boolean;
|
|
9
9
|
/** Menu style */
|
|
@@ -25,8 +25,8 @@ export interface SidenavProps<T = string> extends WithAsProps {
|
|
|
25
25
|
*/
|
|
26
26
|
onSelect?: (eventKey: T | undefined, event: React.SyntheticEvent) => void;
|
|
27
27
|
}
|
|
28
|
-
export declare const SidenavContext: React.Context<SidenavContextType<string> | null>;
|
|
29
|
-
export interface SidenavContextType<T = string> {
|
|
28
|
+
export declare const SidenavContext: React.Context<SidenavContextType<string | number> | null>;
|
|
29
|
+
export interface SidenavContextType<T = string | number> {
|
|
30
30
|
openKeys: T[];
|
|
31
31
|
/**
|
|
32
32
|
* @deprecated Use activeKey from NavContext instead
|
package/esm/Stack/Stack.js
CHANGED
|
@@ -8,6 +8,11 @@ import { isSupportFlexGap, ReactChildren } from "../internals/utils/index.js";
|
|
|
8
8
|
import { oneOf } from "../internals/propTypes/index.js";
|
|
9
9
|
import { useClassNames, useCustom } from "../internals/hooks/index.js";
|
|
10
10
|
import StackItem from "./StackItem.js";
|
|
11
|
+
function isStackItem(child) {
|
|
12
|
+
var _child$type;
|
|
13
|
+
return child.type === StackItem || ((_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName) === 'StackItem';
|
|
14
|
+
}
|
|
15
|
+
|
|
11
16
|
/**
|
|
12
17
|
* The `Stack` component is a quick layout component through Flexbox,
|
|
13
18
|
* supporting vertical and horizontal stacking, custom spacing and line wrapping.
|
|
@@ -61,7 +66,7 @@ var Stack = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
61
66
|
className: classes,
|
|
62
67
|
style: styles
|
|
63
68
|
}), ReactChildren.map(filterChildren, function (child, index) {
|
|
64
|
-
var childNode = childrenRenderMode === 'wrap' && child
|
|
69
|
+
var childNode = childrenRenderMode === 'wrap' && !isStackItem(child) ? /*#__PURE__*/React.createElement(StackItem, {
|
|
65
70
|
key: index,
|
|
66
71
|
className: prefix('item'),
|
|
67
72
|
style: !isSupportGap ? itemStyles : undefined
|
package/esm/Tabs/Tabs.d.ts
CHANGED
|
@@ -1,41 +1,44 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { WithAsProps, RsRefForwardingComponent } from '../internals/types';
|
|
3
3
|
import Tab from './Tab';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the Tabs component.
|
|
6
|
+
*/
|
|
4
7
|
export interface TabsProps extends WithAsProps {
|
|
5
8
|
/**
|
|
6
|
-
* The
|
|
9
|
+
* The appearance of the tabs.
|
|
10
|
+
* @default 'tabs'
|
|
11
|
+
* @version 'pills' is supported in version 5.68.0
|
|
7
12
|
*/
|
|
8
|
-
appearance?: 'tabs' | 'subtle';
|
|
13
|
+
appearance?: 'tabs' | 'subtle' | 'pills';
|
|
9
14
|
/**
|
|
10
|
-
*
|
|
15
|
+
* The key of the active tab.
|
|
11
16
|
*/
|
|
12
|
-
activeKey?: string;
|
|
17
|
+
activeKey?: string | number;
|
|
13
18
|
/**
|
|
14
|
-
* The default active
|
|
19
|
+
* The default key of the active tab.
|
|
15
20
|
*/
|
|
16
|
-
defaultActiveKey?: string;
|
|
21
|
+
defaultActiveKey?: string | number;
|
|
17
22
|
/**
|
|
18
|
-
*
|
|
19
|
-
* @default false
|
|
23
|
+
* Whether to reverse the order of the tabs.
|
|
20
24
|
*/
|
|
21
25
|
reversed?: boolean;
|
|
22
26
|
/**
|
|
23
|
-
*
|
|
24
|
-
* @default false
|
|
27
|
+
* Whether to display the tabs vertically.
|
|
25
28
|
*/
|
|
26
29
|
vertical?: boolean;
|
|
27
30
|
/**
|
|
28
|
-
* The
|
|
29
|
-
* @default
|
|
31
|
+
* The ID of the tabs.
|
|
32
|
+
* @default A unique ID is automatically generated.
|
|
30
33
|
*/
|
|
31
34
|
id?: string;
|
|
32
35
|
/**
|
|
33
|
-
* Callback
|
|
34
|
-
*
|
|
35
|
-
* @param
|
|
36
|
-
* @
|
|
36
|
+
* Callback function that is called when a tab is selected.
|
|
37
|
+
*
|
|
38
|
+
* @param eventKey - The key of the selected tab.
|
|
39
|
+
* @param event - The event object.
|
|
37
40
|
*/
|
|
38
|
-
onSelect?: (eventKey: string | undefined, event: React.SyntheticEvent) => void;
|
|
41
|
+
onSelect?: (eventKey: string | number | undefined, event: React.SyntheticEvent) => void;
|
|
39
42
|
}
|
|
40
43
|
interface TabsComponent extends RsRefForwardingComponent<'div', TabsProps> {
|
|
41
44
|
Tab: typeof Tab;
|
package/esm/Tabs/Tabs.js
CHANGED
|
@@ -11,6 +11,11 @@ import { ReactChildren } from "../internals/utils/index.js";
|
|
|
11
11
|
import Nav from "../Nav/index.js";
|
|
12
12
|
import Tab from "./Tab.js";
|
|
13
13
|
import TabPanel from "./TabPanel.js";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Props for the Tabs component.
|
|
17
|
+
*/
|
|
18
|
+
|
|
14
19
|
function getFocusableTabs(tablist) {
|
|
15
20
|
var tabs = tablist === null || tablist === void 0 ? void 0 : tablist.querySelectorAll('[role=tab]');
|
|
16
21
|
return Array.from(tabs).filter(function (tab) {
|
|
@@ -203,7 +208,7 @@ var Tabs = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
203
208
|
Tabs.Tab = Tab;
|
|
204
209
|
Tabs.displayName = 'Tabs';
|
|
205
210
|
Tabs.propTypes = {
|
|
206
|
-
appearance: PropTypes.oneOf(['tabs', 'subtle']),
|
|
211
|
+
appearance: PropTypes.oneOf(['tabs', 'subtle', 'pills']),
|
|
207
212
|
activeKey: PropTypes.any,
|
|
208
213
|
defaultActiveKey: PropTypes.any,
|
|
209
214
|
reversed: PropTypes.bool,
|
|
@@ -36,7 +36,7 @@ export interface UploaderProps extends WithAsProps, Omit<UploadTriggerProps, 'on
|
|
|
36
36
|
fileList?: FileType[];
|
|
37
37
|
/** Upload the parameters with */
|
|
38
38
|
data?: any;
|
|
39
|
-
/** Allow multiple file uploads
|
|
39
|
+
/** Allow multiple file uploads */
|
|
40
40
|
multiple?: boolean;
|
|
41
41
|
/** Disabled upload button */
|
|
42
42
|
disabled?: boolean;
|
|
@@ -80,7 +80,7 @@ export interface UploaderProps extends WithAsProps, Omit<UploadTriggerProps, 'on
|
|
|
80
80
|
/** Allow uploading of files. Check function before file upload, return false without uploading */
|
|
81
81
|
shouldUpload?: (file: FileType) => boolean | Promise<boolean>;
|
|
82
82
|
/** callback function that the upload queue has changed */
|
|
83
|
-
onChange?: (fileList: FileType[]) => void;
|
|
83
|
+
onChange?: (fileList: FileType[], event: React.ChangeEvent | React.MouseEvent) => void;
|
|
84
84
|
/** The callback function that starts the upload file */
|
|
85
85
|
onUpload?: (file: FileType, uploadData: any, xhr: XMLHttpRequest) => void;
|
|
86
86
|
/** In the file list, for uploading failed files, click the callback function to upload */
|
package/esm/Uploader/Uploader.js
CHANGED
|
@@ -301,13 +301,15 @@ var Uploader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
301
301
|
return;
|
|
302
302
|
}
|
|
303
303
|
var upload = function upload() {
|
|
304
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(nextFileList);
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
304
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(nextFileList, event);
|
|
305
|
+
if (rootRef.current) {
|
|
306
|
+
dispatch({
|
|
307
|
+
type: 'push',
|
|
308
|
+
files: newFileList
|
|
309
|
+
}, function () {
|
|
310
|
+
autoUpload && handleAjaxUpload();
|
|
311
|
+
});
|
|
312
|
+
}
|
|
311
313
|
};
|
|
312
314
|
if (checkState instanceof Promise) {
|
|
313
315
|
checkState.then(function (res) {
|
|
@@ -317,7 +319,7 @@ var Uploader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
317
319
|
}
|
|
318
320
|
upload();
|
|
319
321
|
};
|
|
320
|
-
var handleRemoveFile = function handleRemoveFile(fileKey) {
|
|
322
|
+
var handleRemoveFile = function handleRemoveFile(fileKey, event) {
|
|
321
323
|
var _xhrs$current, _xhrs$current$file$fi;
|
|
322
324
|
var file = find(fileList.current, function (f) {
|
|
323
325
|
return f.fileKey === fileKey;
|
|
@@ -334,7 +336,7 @@ var Uploader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
334
336
|
fileKey: fileKey
|
|
335
337
|
});
|
|
336
338
|
onRemove === null || onRemove === void 0 ? void 0 : onRemove(file);
|
|
337
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(nextFileList);
|
|
339
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(nextFileList, event);
|
|
338
340
|
cleanInputValue();
|
|
339
341
|
};
|
|
340
342
|
var handleReupload = function handleReupload(file) {
|
|
@@ -31,7 +31,7 @@ export interface OverlayTriggerProps extends Omit<StandardProps, 'children'>, An
|
|
|
31
31
|
/** Whether mouse is allowed to enter the floating layer of popover, whose default value is false. */
|
|
32
32
|
enterable?: boolean;
|
|
33
33
|
/** For the monitored component, the event will be bound to this component. */
|
|
34
|
-
children: React.
|
|
34
|
+
children: React.ReactNode | ((props: any, ref: any) => React.ReactElement);
|
|
35
35
|
/** Whether to allow clicking document to close the overlay */
|
|
36
36
|
rootClose?: boolean;
|
|
37
37
|
/** Once disabled, the event cannot be triggered. */
|
|
@@ -73,7 +73,7 @@ export declare enum OverlayCloseCause {
|
|
|
73
73
|
ImperativeHandle = 1
|
|
74
74
|
}
|
|
75
75
|
export interface OverlayTriggerHandle {
|
|
76
|
-
root
|
|
76
|
+
root?: HTMLElement | null;
|
|
77
77
|
updatePosition: () => void;
|
|
78
78
|
open: (delay?: number) => void;
|
|
79
79
|
close: (delay?: number) => void;
|
|
@@ -3,13 +3,14 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _isUndefined from "lodash/isUndefined";
|
|
5
5
|
var _excluded = ["children", "container", "controlId", "defaultOpen", "trigger", "disabled", "followCursor", "readOnly", "plaintext", "open", "delay", "delayOpen", "delayClose", "enterable", "placement", "speaker", "rootClose", "onClick", "onMouseOver", "onMouseMove", "onMouseOut", "onContextMenu", "onFocus", "onBlur", "onOpen", "onClose", "onExited"];
|
|
6
|
-
import React, { useRef, useEffect, useImperativeHandle, useCallback, useContext, useState, useMemo } from 'react';
|
|
6
|
+
import React, { useRef, useEffect, useImperativeHandle, useCallback, useContext, useState, useMemo, isValidElement, cloneElement } from 'react';
|
|
7
7
|
import get from 'lodash/get';
|
|
8
8
|
import isNil from 'lodash/isNil';
|
|
9
9
|
import contains from 'dom-lib/contains';
|
|
10
10
|
import Overlay from "./Overlay.js";
|
|
11
11
|
import { usePortal, useControlled } from "../hooks/index.js";
|
|
12
12
|
import { createChainedFunction, isOneOf } from "../utils/index.js";
|
|
13
|
+
import { isFragment } from "../utils/ReactChildren.js";
|
|
13
14
|
import OverlayContext from "./OverlayContext.js";
|
|
14
15
|
function mergeEvents(events, props) {
|
|
15
16
|
if (events === void 0) {
|
|
@@ -98,7 +99,7 @@ var OverlayTrigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
98
99
|
}),
|
|
99
100
|
Portal = _usePortal.Portal,
|
|
100
101
|
containerElement = _usePortal.target;
|
|
101
|
-
var triggerRef = useRef();
|
|
102
|
+
var triggerRef = useRef(null);
|
|
102
103
|
var overlayRef = useRef();
|
|
103
104
|
var _useControlled = useControlled(openProp, defaultOpen),
|
|
104
105
|
open = _useControlled[0],
|
|
@@ -361,13 +362,21 @@ var OverlayTrigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
361
362
|
}), ref);
|
|
362
363
|
} : speaker);
|
|
363
364
|
};
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
365
|
+
var triggerElement = useMemo(function () {
|
|
366
|
+
if (typeof children === 'function') {
|
|
367
|
+
return children(triggerEvents, triggerRef);
|
|
368
|
+
} else if (isFragment(children) || ! /*#__PURE__*/isValidElement(children)) {
|
|
369
|
+
return /*#__PURE__*/React.createElement("span", _extends({
|
|
370
|
+
ref: triggerRef,
|
|
371
|
+
"aria-describedby": controlId
|
|
372
|
+
}, triggerEvents), children);
|
|
373
|
+
}
|
|
374
|
+
return /*#__PURE__*/cloneElement(children, _extends({
|
|
375
|
+
ref: triggerRef,
|
|
376
|
+
'aria-describedby': controlId
|
|
377
|
+
}, mergeEvents(triggerEvents, children.props)));
|
|
378
|
+
}, [children, controlId, triggerEvents]);
|
|
379
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, triggerElement, /*#__PURE__*/React.createElement(Portal, null, renderOverlay()));
|
|
371
380
|
});
|
|
372
381
|
OverlayTrigger.displayName = 'OverlayTrigger';
|
|
373
382
|
export default OverlayTrigger;
|
|
@@ -41,6 +41,12 @@ export var getSafariVersion = function getSafariVersion() {
|
|
|
41
41
|
* @see https://caniuse.com/flexbox-gap
|
|
42
42
|
*/
|
|
43
43
|
export var isSupportFlexGap = function isSupportFlexGap() {
|
|
44
|
+
// Check if the browser supports the `gap` property
|
|
45
|
+
if (typeof CSS !== 'undefined' && typeof CSS.supports !== 'undefined') {
|
|
46
|
+
return CSS.supports('(gap: 1px)');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// IE does not support flex-gap
|
|
44
50
|
if (isIE()) {
|
|
45
51
|
return false;
|
|
46
52
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if the given children is a React fragment.
|
|
4
|
+
* @param children - The children to check.
|
|
5
|
+
* @returns True if the children is a React fragment, false otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isFragment(children: React.ReactNode): boolean;
|
|
2
8
|
/**
|
|
3
9
|
* Finds the first child that satisfies the given condition.
|
|
4
10
|
* @param children - The children to search.
|
|
@@ -18,7 +18,7 @@ function typeOf(object) {
|
|
|
18
18
|
* @param children - The children to check.
|
|
19
19
|
* @returns True if the children is a React fragment, false otherwise.
|
|
20
20
|
*/
|
|
21
|
-
function isFragment(children) {
|
|
21
|
+
export function isFragment(children) {
|
|
22
22
|
return React.Children.count(children) === 1 && typeOf(children) === Symbol.for('react.fragment');
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
common: {
|
|
3
|
+
loading: string;
|
|
4
|
+
emptyMessage: string;
|
|
5
|
+
remove: string;
|
|
6
|
+
clear: string;
|
|
7
|
+
};
|
|
8
|
+
Plaintext: {
|
|
9
|
+
unfilled: string;
|
|
10
|
+
notSelected: string;
|
|
11
|
+
notUploaded: string;
|
|
12
|
+
};
|
|
13
|
+
Pagination: {
|
|
14
|
+
more: string;
|
|
15
|
+
prev: string;
|
|
16
|
+
next: string;
|
|
17
|
+
first: string;
|
|
18
|
+
last: string;
|
|
19
|
+
limit: string;
|
|
20
|
+
total: string;
|
|
21
|
+
skip: string;
|
|
22
|
+
};
|
|
23
|
+
Calendar: {
|
|
24
|
+
sunday: string;
|
|
25
|
+
monday: string;
|
|
26
|
+
tuesday: string;
|
|
27
|
+
wednesday: string;
|
|
28
|
+
thursday: string;
|
|
29
|
+
friday: string;
|
|
30
|
+
saturday: string;
|
|
31
|
+
ok: string;
|
|
32
|
+
today: string;
|
|
33
|
+
yesterday: string;
|
|
34
|
+
hours: string;
|
|
35
|
+
minutes: string;
|
|
36
|
+
seconds: string;
|
|
37
|
+
/**
|
|
38
|
+
* Format of the string is based on Unicode Technical Standard #35:
|
|
39
|
+
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
40
|
+
**/
|
|
41
|
+
formattedMonthPattern: string;
|
|
42
|
+
formattedDayPattern: string;
|
|
43
|
+
dateLocale: Locale;
|
|
44
|
+
};
|
|
45
|
+
DatePicker: {
|
|
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
|
+
hours: string;
|
|
57
|
+
minutes: string;
|
|
58
|
+
seconds: string;
|
|
59
|
+
/**
|
|
60
|
+
* Format of the string is based on Unicode Technical Standard #35:
|
|
61
|
+
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
62
|
+
**/
|
|
63
|
+
formattedMonthPattern: string;
|
|
64
|
+
formattedDayPattern: string;
|
|
65
|
+
dateLocale: Locale;
|
|
66
|
+
};
|
|
67
|
+
DateRangePicker: {
|
|
68
|
+
last7Days: string;
|
|
69
|
+
sunday: string;
|
|
70
|
+
monday: string;
|
|
71
|
+
tuesday: string;
|
|
72
|
+
wednesday: string;
|
|
73
|
+
thursday: string;
|
|
74
|
+
friday: string;
|
|
75
|
+
saturday: string;
|
|
76
|
+
ok: string;
|
|
77
|
+
today: string;
|
|
78
|
+
yesterday: string;
|
|
79
|
+
hours: string;
|
|
80
|
+
minutes: string;
|
|
81
|
+
seconds: string;
|
|
82
|
+
/**
|
|
83
|
+
* Format of the string is based on Unicode Technical Standard #35:
|
|
84
|
+
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
85
|
+
**/
|
|
86
|
+
formattedMonthPattern: string;
|
|
87
|
+
formattedDayPattern: string;
|
|
88
|
+
dateLocale: Locale;
|
|
89
|
+
};
|
|
90
|
+
Picker: {
|
|
91
|
+
noResultsText: string;
|
|
92
|
+
placeholder: string;
|
|
93
|
+
searchPlaceholder: string;
|
|
94
|
+
checkAll: string;
|
|
95
|
+
};
|
|
96
|
+
InputPicker: {
|
|
97
|
+
newItem: string;
|
|
98
|
+
createOption: string;
|
|
99
|
+
};
|
|
100
|
+
Uploader: {
|
|
101
|
+
inited: string;
|
|
102
|
+
progress: string;
|
|
103
|
+
error: string;
|
|
104
|
+
complete: string;
|
|
105
|
+
emptyFile: string;
|
|
106
|
+
upload: string;
|
|
107
|
+
removeFile: string;
|
|
108
|
+
};
|
|
109
|
+
CloseButton: {
|
|
110
|
+
closeLabel: string;
|
|
111
|
+
};
|
|
112
|
+
Breadcrumb: {
|
|
113
|
+
expandText: string;
|
|
114
|
+
};
|
|
115
|
+
Toggle: {
|
|
116
|
+
on: string;
|
|
117
|
+
off: string;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
export default _default;
|