rsuite 5.13.1 → 5.15.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/Button/styles/index.less +1 -0
- package/CHANGELOG.md +37 -0
- package/Dropdown/styles/index.less +8 -3
- package/Grid/styles/index.less +42 -10
- package/Sidenav/styles/index.less +7 -9
- package/Table/styles/index.less +0 -2
- package/Tooltip/styles/index.less +4 -4
- package/cjs/@types/common.d.ts +6 -0
- package/cjs/Cascader/utils.d.ts +1 -1
- package/cjs/Col/Col.d.ts +25 -5
- package/cjs/Col/Col.js +9 -1
- package/cjs/CustomProvider/CustomProvider.d.ts +20 -7
- package/cjs/CustomProvider/CustomProvider.js +24 -3
- package/cjs/Dropdown/useRenderDropdownItem.d.ts +1 -1
- package/cjs/Form/Form.d.ts +8 -8
- package/cjs/Form/test/Form.test.d.ts +1 -0
- package/cjs/Form/test/Form.test.js +18 -0
- package/cjs/Modal/test/Modal.test.d.ts +1 -0
- package/cjs/Modal/test/Modal.test.js +14 -0
- package/cjs/Modal/utils.d.ts +1 -1
- package/cjs/Nav/NavDropdownMenu.d.ts +12 -1
- package/cjs/Nav/NavDropdownMenu.js +9 -3
- package/cjs/Nav/test/Nav.test.d.ts +1 -0
- package/cjs/Nav/test/Nav.test.js +17 -0
- package/cjs/Navbar/NavbarDropdownMenu.d.ts +12 -1
- package/cjs/Navbar/NavbarDropdownMenu.js +9 -3
- package/cjs/Overlay/Modal.d.ts +1 -4
- package/cjs/Overlay/Overlay.d.ts +3 -1
- package/cjs/Overlay/Overlay.js +6 -2
- package/cjs/Overlay/OverlayTrigger.d.ts +4 -0
- package/cjs/Overlay/OverlayTrigger.js +32 -4
- package/cjs/Overlay/Position.d.ts +3 -1
- package/cjs/Overlay/Position.js +12 -4
- package/cjs/Overlay/positionUtils.d.ts +11 -4
- package/cjs/Overlay/positionUtils.js +48 -2
- package/cjs/Panel/Panel.js +9 -6
- package/cjs/Picker/utils.d.ts +1 -1
- package/cjs/Popover/Popover.d.ts +2 -0
- package/cjs/Popover/Popover.js +6 -3
- package/cjs/Sidenav/SidenavDropdownToggle.js +2 -1
- package/cjs/Sidenav/SidenavItem.d.ts +4 -0
- package/cjs/Sidenav/SidenavItem.js +40 -31
- package/cjs/Toggle/Toggle.d.ts +1 -1
- package/cjs/Tooltip/Tooltip.d.ts +3 -1
- package/cjs/Tooltip/Tooltip.js +8 -3
- package/cjs/Uploader/Uploader.d.ts +2 -0
- package/cjs/Uploader/Uploader.js +6 -2
- package/cjs/Whisper/Whisper.js +6 -1
- package/cjs/index.d.ts +2 -2
- package/cjs/index.js +3 -2
- package/cjs/toaster/ToastContainer.d.ts +1 -0
- package/cjs/toaster/ToastContainer.js +4 -1
- package/cjs/toaster/index.d.ts +1 -0
- package/cjs/toaster/index.js +4 -1
- package/cjs/toaster/toaster.d.ts +0 -1
- package/cjs/toaster/useToaster.d.ts +12 -0
- package/cjs/toaster/useToaster.js +43 -0
- package/cjs/utils/ajaxUpload.d.ts +1 -0
- package/cjs/utils/ajaxUpload.js +3 -1
- package/cjs/utils/constants.d.ts +1 -0
- package/cjs/utils/constants.js +3 -1
- package/cjs/utils/stringToObject.d.ts +1 -1
- package/cjs/utils/tplTransform.d.ts +1 -1
- package/cjs/utils/treeUtils.d.ts +3 -3
- package/cjs/utils/useCustom.d.ts +1 -1
- package/cjs/utils/useCustom.js +5 -3
- package/cjs/utils/useFocus.d.ts +1 -1
- package/dist/rsuite-rtl.css +684 -71
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +684 -71
- package/dist/rsuite.js +92 -103
- 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/@types/common.d.ts +6 -0
- package/esm/Cascader/utils.d.ts +1 -1
- package/esm/Col/Col.d.ts +25 -5
- package/esm/Col/Col.js +10 -2
- package/esm/CustomProvider/CustomProvider.d.ts +20 -7
- package/esm/CustomProvider/CustomProvider.js +22 -3
- package/esm/Dropdown/useRenderDropdownItem.d.ts +1 -1
- package/esm/Form/Form.d.ts +8 -8
- package/esm/Form/test/Form.test.d.ts +1 -0
- package/esm/Form/test/Form.test.js +11 -0
- package/esm/Modal/test/Modal.test.d.ts +1 -0
- package/esm/Modal/test/Modal.test.js +9 -0
- package/esm/Modal/utils.d.ts +1 -1
- package/esm/Nav/NavDropdownMenu.d.ts +12 -1
- package/esm/Nav/NavDropdownMenu.js +8 -3
- package/esm/Nav/test/Nav.test.d.ts +1 -0
- package/esm/Nav/test/Nav.test.js +11 -0
- package/esm/Navbar/NavbarDropdownMenu.d.ts +12 -1
- package/esm/Navbar/NavbarDropdownMenu.js +8 -3
- package/esm/Overlay/Modal.d.ts +1 -4
- package/esm/Overlay/Overlay.d.ts +3 -1
- package/esm/Overlay/Overlay.js +6 -2
- package/esm/Overlay/OverlayTrigger.d.ts +4 -0
- package/esm/Overlay/OverlayTrigger.js +33 -5
- package/esm/Overlay/Position.d.ts +3 -1
- package/esm/Overlay/Position.js +12 -4
- package/esm/Overlay/positionUtils.d.ts +11 -4
- package/esm/Overlay/positionUtils.js +46 -2
- package/esm/Panel/Panel.js +9 -6
- package/esm/Picker/utils.d.ts +1 -1
- package/esm/Popover/Popover.d.ts +2 -0
- package/esm/Popover/Popover.js +6 -3
- package/esm/Sidenav/SidenavDropdownToggle.js +2 -1
- package/esm/Sidenav/SidenavItem.d.ts +4 -0
- package/esm/Sidenav/SidenavItem.js +38 -31
- package/esm/Toggle/Toggle.d.ts +1 -1
- package/esm/Tooltip/Tooltip.d.ts +3 -1
- package/esm/Tooltip/Tooltip.js +8 -3
- package/esm/Uploader/Uploader.d.ts +2 -0
- package/esm/Uploader/Uploader.js +6 -2
- package/esm/Whisper/Whisper.js +6 -1
- package/esm/index.d.ts +2 -2
- package/esm/index.js +1 -1
- package/esm/toaster/ToastContainer.d.ts +1 -0
- package/esm/toaster/ToastContainer.js +1 -0
- package/esm/toaster/index.d.ts +1 -0
- package/esm/toaster/index.js +1 -0
- package/esm/toaster/toaster.d.ts +0 -1
- package/esm/toaster/useToaster.d.ts +12 -0
- package/esm/toaster/useToaster.js +34 -0
- package/esm/utils/ajaxUpload.d.ts +1 -0
- package/esm/utils/ajaxUpload.js +3 -1
- package/esm/utils/constants.d.ts +1 -0
- package/esm/utils/constants.js +1 -0
- package/esm/utils/stringToObject.d.ts +1 -1
- package/esm/utils/tplTransform.d.ts +1 -1
- package/esm/utils/treeUtils.d.ts +3 -3
- package/esm/utils/useCustom.d.ts +1 -1
- package/esm/utils/useCustom.js +5 -3
- package/esm/utils/useFocus.d.ts +1 -1
- package/package.json +1 -1
- package/styles/color-modes/dark.less +223 -184
- package/styles/color-modes/high-contrast.less +221 -182
- package/styles/color-modes/light.less +44 -5
- package/styles/colors/dark.less +91 -91
- package/styles/colors/high-contrast.less +91 -91
- package/styles/variables.less +33 -12
- package/styles/color-modes/common.less +0 -44
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { WithAsProps, RsRefForwardingComponent } from '../@types/common';
|
|
3
3
|
export declare type PlacementType = 'topCenter' | 'bottomCenter' | 'topStart' | 'topEnd' | 'bottomStart' | 'bottomEnd';
|
|
4
|
+
export declare const toastPlacements: PlacementType[];
|
|
4
5
|
export interface ToastContainerProps extends WithAsProps {
|
|
5
6
|
/** The placement of the message box */
|
|
6
7
|
placement?: PlacementType;
|
|
@@ -6,6 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import kebabCase from 'lodash/kebabCase';
|
|
7
7
|
import Transition from '../Animation/Transition';
|
|
8
8
|
import { useClassNames, guid, createChainedFunction } from '../utils';
|
|
9
|
+
export var toastPlacements = ['topCenter', 'bottomCenter', 'topStart', 'topEnd', 'bottomStart', 'bottomEnd'];
|
|
9
10
|
|
|
10
11
|
var useMessages = function useMessages() {
|
|
11
12
|
var _useState = useState([]),
|
package/esm/toaster/index.d.ts
CHANGED
package/esm/toaster/index.js
CHANGED
package/esm/toaster/toaster.d.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ToastContainerProps } from './ToastContainer';
|
|
3
|
+
/**
|
|
4
|
+
* Hook to use the toaster
|
|
5
|
+
* @returns toaster { push, remove, clear }
|
|
6
|
+
*/
|
|
7
|
+
declare const useToaster: () => {
|
|
8
|
+
push: (message: React.ReactNode, options?: ToastContainerProps) => string | undefined;
|
|
9
|
+
remove: (key: string) => void;
|
|
10
|
+
clear: () => void;
|
|
11
|
+
};
|
|
12
|
+
export default useToaster;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import toaster from './toaster';
|
|
2
|
+
import { useCustom } from '../utils';
|
|
3
|
+
/**
|
|
4
|
+
* Hook to use the toaster
|
|
5
|
+
* @returns toaster { push, remove, clear }
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
var useToaster = function useToaster() {
|
|
9
|
+
var _useCustom = useCustom(),
|
|
10
|
+
toasters = _useCustom.toasters;
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
push: function push(message, options) {
|
|
14
|
+
var _toasters$current;
|
|
15
|
+
|
|
16
|
+
var customToaster = toasters === null || toasters === void 0 ? void 0 : (_toasters$current = toasters.current) === null || _toasters$current === void 0 ? void 0 : _toasters$current.get((options === null || options === void 0 ? void 0 : options.placement) || 'topCenter');
|
|
17
|
+
return customToaster ? customToaster.push(message) : toaster.push(message, options);
|
|
18
|
+
},
|
|
19
|
+
remove: function remove(key) {
|
|
20
|
+
toasters ? Array.from(toasters.current).forEach(function (_ref) {
|
|
21
|
+
var c = _ref[1];
|
|
22
|
+
return c === null || c === void 0 ? void 0 : c.remove(key);
|
|
23
|
+
}) : toaster.remove(key);
|
|
24
|
+
},
|
|
25
|
+
clear: function clear() {
|
|
26
|
+
toasters ? Array.from(toasters.current).forEach(function (_ref2) {
|
|
27
|
+
var c = _ref2[1];
|
|
28
|
+
return c === null || c === void 0 ? void 0 : c.clear();
|
|
29
|
+
}) : toaster.clear();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default useToaster;
|
|
@@ -11,6 +11,7 @@ interface Options {
|
|
|
11
11
|
headers?: any;
|
|
12
12
|
file: File;
|
|
13
13
|
url: string;
|
|
14
|
+
method?: string;
|
|
14
15
|
onError: (status: ErrorStatus, event: ProgressEvent, xhr: XMLHttpRequest) => void;
|
|
15
16
|
onSuccess: (response: any, event: ProgressEvent, xhr: XMLHttpRequest) => void;
|
|
16
17
|
onProgress: (percent: number, event: ProgressEvent, xhr: XMLHttpRequest) => void;
|
package/esm/utils/ajaxUpload.js
CHANGED
|
@@ -19,6 +19,8 @@ export default function ajaxUpload(options) {
|
|
|
19
19
|
headers = _options$headers === void 0 ? {} : _options$headers,
|
|
20
20
|
_options$data = options.data,
|
|
21
21
|
data = _options$data === void 0 ? {} : _options$data,
|
|
22
|
+
_options$method = options.method,
|
|
23
|
+
method = _options$method === void 0 ? 'POST' : _options$method,
|
|
22
24
|
onError = options.onError,
|
|
23
25
|
onSuccess = options.onSuccess,
|
|
24
26
|
onProgress = options.onProgress,
|
|
@@ -28,7 +30,7 @@ export default function ajaxUpload(options) {
|
|
|
28
30
|
disableMultipart = options.disableMultipart;
|
|
29
31
|
var xhr = new XMLHttpRequest();
|
|
30
32
|
var sendableData;
|
|
31
|
-
xhr.open(
|
|
33
|
+
xhr.open(method, url, true);
|
|
32
34
|
|
|
33
35
|
if (!disableMultipart) {
|
|
34
36
|
sendableData = new FormData();
|
package/esm/utils/constants.d.ts
CHANGED
package/esm/utils/constants.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export var SIZE = ['lg', 'md', 'sm', 'xs'];
|
|
2
|
+
export var COLUMN_SIZE = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
|
|
2
3
|
export var STATUS = ['success', 'warning', 'error', 'info'];
|
|
3
4
|
export var COLOR = ['red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'violet'];
|
|
4
5
|
export var PLACEMENT_4 = ['top', 'bottom', 'right', 'left'];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: (value: any, labelKey?: string
|
|
1
|
+
declare const _default: (value: any, labelKey?: string, valueKey?: string) => object | null;
|
|
2
2
|
export default _default;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const _default: (pattern: string, ...data: any[]) => React.ReactNode;
|
|
3
2
|
/**
|
|
4
3
|
* tplTransform('Show {0} data', <i>100</i>);
|
|
5
4
|
* output:
|
|
6
5
|
* Show <span><i>100</i></span> data
|
|
7
6
|
*/
|
|
7
|
+
declare const _default: (pattern: string, ...data: any[]) => React.ReactNode;
|
|
8
8
|
export default _default;
|
package/esm/utils/treeUtils.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export declare function filterNodesOfTree(data: any, check: any): TreeNodeType[]
|
|
|
70
70
|
* @param isSearching - component is in Searching
|
|
71
71
|
* @returns
|
|
72
72
|
*/
|
|
73
|
-
export declare const getFocusableItems: (filteredData: ItemDataType[], props: Required<Pick<PartialTreeProps, 'disabledItemValues' | 'valueKey' | 'childrenKey' | 'expandItemValues'>>, isSearching?: boolean
|
|
73
|
+
export declare const getFocusableItems: (filteredData: ItemDataType[], props: Required<Pick<PartialTreeProps, 'disabledItemValues' | 'valueKey' | 'childrenKey' | 'expandItemValues'>>, isSearching?: boolean) => TreeNodeType[];
|
|
74
74
|
/**
|
|
75
75
|
* return all focusable Item and active Element index
|
|
76
76
|
* @param focusItemValue
|
|
@@ -190,7 +190,7 @@ interface UnSerializeListProps {
|
|
|
190
190
|
export declare function useFlattenTreeData({ data, labelKey, valueKey, childrenKey, uncheckableItemValues, callback }: FlattenTreeDataProps): {
|
|
191
191
|
forceUpdate: () => void;
|
|
192
192
|
flattenNodes: TreeNodesType;
|
|
193
|
-
flattenTreeData: (treeData: TreeNodeType[], ref: string, parent?: TreeNodeType
|
|
193
|
+
flattenTreeData: (treeData: TreeNodeType[], ref: string, parent?: TreeNodeType, layer?: any) => never[] | undefined;
|
|
194
194
|
serializeListOnlyParent: (nodes: TreeNodesType, key: string) => (string | number)[];
|
|
195
195
|
unSerializeList: ({ nodes, key, value, cascade, uncheckableItemValues }: UnSerializeListProps) => void;
|
|
196
196
|
formatVirtualizedTreeData: (nodes: TreeNodesType, data: any[], expandItemValues: ItemDataType[], options: {
|
|
@@ -203,7 +203,7 @@ export declare function useFlattenTreeData({ data, labelKey, valueKey, childrenK
|
|
|
203
203
|
*/
|
|
204
204
|
export declare function useTreeNodeRefs(): {
|
|
205
205
|
treeNodesRefs: {};
|
|
206
|
-
saveTreeNodeRef: (ref: React.Ref<any>, refKey?: string
|
|
206
|
+
saveTreeNodeRef: (ref: React.Ref<any>, refKey?: string) => void;
|
|
207
207
|
};
|
|
208
208
|
interface TreeSearchProps {
|
|
209
209
|
labelKey: string;
|
package/esm/utils/useCustom.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ import { CustomValue } from '../CustomProvider/CustomProvider';
|
|
|
3
3
|
* A hook to get custom configuration of `<CustomProvider>`
|
|
4
4
|
* @param keys
|
|
5
5
|
*/
|
|
6
|
-
declare function useCustom<T = any>(keys
|
|
6
|
+
declare function useCustom<T = any>(keys?: string | string[], overrideLocale?: any): CustomValue<T>;
|
|
7
7
|
export default useCustom;
|
package/esm/utils/useCustom.js
CHANGED
|
@@ -29,11 +29,12 @@ function useCustom(keys, overrideLocale) {
|
|
|
29
29
|
_useContext$rtl = _useContext.rtl,
|
|
30
30
|
rtl = _useContext$rtl === void 0 ? getDefaultRTL() : _useContext$rtl,
|
|
31
31
|
formatDate = _useContext.formatDate,
|
|
32
|
-
parseDate = _useContext.parseDate
|
|
32
|
+
parseDate = _useContext.parseDate,
|
|
33
|
+
toasters = _useContext.toasters;
|
|
33
34
|
|
|
34
|
-
var componentLocale = _extends({}, locale === null || locale === void 0 ? void 0 : locale.common, typeof keys === 'string' ? locale === null || locale === void 0 ? void 0 : locale[keys] : mergeObject(keys.map(function (key) {
|
|
35
|
+
var componentLocale = _extends({}, locale === null || locale === void 0 ? void 0 : locale.common, typeof keys === 'string' ? locale === null || locale === void 0 ? void 0 : locale[keys] : typeof keys === 'object' ? mergeObject(keys.map(function (key) {
|
|
35
36
|
return locale === null || locale === void 0 ? void 0 : locale[key];
|
|
36
|
-
}))); // Component custom locale
|
|
37
|
+
})) : {}); // Component custom locale
|
|
37
38
|
|
|
38
39
|
|
|
39
40
|
if (overrideLocale) {
|
|
@@ -57,6 +58,7 @@ function useCustom(keys, overrideLocale) {
|
|
|
57
58
|
return {
|
|
58
59
|
locale: componentLocale,
|
|
59
60
|
rtl: rtl,
|
|
61
|
+
toasters: toasters,
|
|
60
62
|
formatDate: formatDate || defaultFormatDate,
|
|
61
63
|
parseDate: parseDate || defaultParseDate
|
|
62
64
|
};
|
package/esm/utils/useFocus.d.ts
CHANGED