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.
Files changed (145) hide show
  1. package/Button/styles/index.less +1 -0
  2. package/CHANGELOG.md +37 -0
  3. package/Dropdown/styles/index.less +8 -3
  4. package/Grid/styles/index.less +42 -10
  5. package/Sidenav/styles/index.less +7 -9
  6. package/Table/styles/index.less +0 -2
  7. package/Tooltip/styles/index.less +4 -4
  8. package/cjs/@types/common.d.ts +6 -0
  9. package/cjs/Cascader/utils.d.ts +1 -1
  10. package/cjs/Col/Col.d.ts +25 -5
  11. package/cjs/Col/Col.js +9 -1
  12. package/cjs/CustomProvider/CustomProvider.d.ts +20 -7
  13. package/cjs/CustomProvider/CustomProvider.js +24 -3
  14. package/cjs/Dropdown/useRenderDropdownItem.d.ts +1 -1
  15. package/cjs/Form/Form.d.ts +8 -8
  16. package/cjs/Form/test/Form.test.d.ts +1 -0
  17. package/cjs/Form/test/Form.test.js +18 -0
  18. package/cjs/Modal/test/Modal.test.d.ts +1 -0
  19. package/cjs/Modal/test/Modal.test.js +14 -0
  20. package/cjs/Modal/utils.d.ts +1 -1
  21. package/cjs/Nav/NavDropdownMenu.d.ts +12 -1
  22. package/cjs/Nav/NavDropdownMenu.js +9 -3
  23. package/cjs/Nav/test/Nav.test.d.ts +1 -0
  24. package/cjs/Nav/test/Nav.test.js +17 -0
  25. package/cjs/Navbar/NavbarDropdownMenu.d.ts +12 -1
  26. package/cjs/Navbar/NavbarDropdownMenu.js +9 -3
  27. package/cjs/Overlay/Modal.d.ts +1 -4
  28. package/cjs/Overlay/Overlay.d.ts +3 -1
  29. package/cjs/Overlay/Overlay.js +6 -2
  30. package/cjs/Overlay/OverlayTrigger.d.ts +4 -0
  31. package/cjs/Overlay/OverlayTrigger.js +32 -4
  32. package/cjs/Overlay/Position.d.ts +3 -1
  33. package/cjs/Overlay/Position.js +12 -4
  34. package/cjs/Overlay/positionUtils.d.ts +11 -4
  35. package/cjs/Overlay/positionUtils.js +48 -2
  36. package/cjs/Panel/Panel.js +9 -6
  37. package/cjs/Picker/utils.d.ts +1 -1
  38. package/cjs/Popover/Popover.d.ts +2 -0
  39. package/cjs/Popover/Popover.js +6 -3
  40. package/cjs/Sidenav/SidenavDropdownToggle.js +2 -1
  41. package/cjs/Sidenav/SidenavItem.d.ts +4 -0
  42. package/cjs/Sidenav/SidenavItem.js +40 -31
  43. package/cjs/Toggle/Toggle.d.ts +1 -1
  44. package/cjs/Tooltip/Tooltip.d.ts +3 -1
  45. package/cjs/Tooltip/Tooltip.js +8 -3
  46. package/cjs/Uploader/Uploader.d.ts +2 -0
  47. package/cjs/Uploader/Uploader.js +6 -2
  48. package/cjs/Whisper/Whisper.js +6 -1
  49. package/cjs/index.d.ts +2 -2
  50. package/cjs/index.js +3 -2
  51. package/cjs/toaster/ToastContainer.d.ts +1 -0
  52. package/cjs/toaster/ToastContainer.js +4 -1
  53. package/cjs/toaster/index.d.ts +1 -0
  54. package/cjs/toaster/index.js +4 -1
  55. package/cjs/toaster/toaster.d.ts +0 -1
  56. package/cjs/toaster/useToaster.d.ts +12 -0
  57. package/cjs/toaster/useToaster.js +43 -0
  58. package/cjs/utils/ajaxUpload.d.ts +1 -0
  59. package/cjs/utils/ajaxUpload.js +3 -1
  60. package/cjs/utils/constants.d.ts +1 -0
  61. package/cjs/utils/constants.js +3 -1
  62. package/cjs/utils/stringToObject.d.ts +1 -1
  63. package/cjs/utils/tplTransform.d.ts +1 -1
  64. package/cjs/utils/treeUtils.d.ts +3 -3
  65. package/cjs/utils/useCustom.d.ts +1 -1
  66. package/cjs/utils/useCustom.js +5 -3
  67. package/cjs/utils/useFocus.d.ts +1 -1
  68. package/dist/rsuite-rtl.css +684 -71
  69. package/dist/rsuite-rtl.min.css +1 -1
  70. package/dist/rsuite-rtl.min.css.map +1 -1
  71. package/dist/rsuite.css +684 -71
  72. package/dist/rsuite.js +92 -103
  73. package/dist/rsuite.js.map +1 -1
  74. package/dist/rsuite.min.css +1 -1
  75. package/dist/rsuite.min.css.map +1 -1
  76. package/dist/rsuite.min.js +1 -1
  77. package/dist/rsuite.min.js.map +1 -1
  78. package/esm/@types/common.d.ts +6 -0
  79. package/esm/Cascader/utils.d.ts +1 -1
  80. package/esm/Col/Col.d.ts +25 -5
  81. package/esm/Col/Col.js +10 -2
  82. package/esm/CustomProvider/CustomProvider.d.ts +20 -7
  83. package/esm/CustomProvider/CustomProvider.js +22 -3
  84. package/esm/Dropdown/useRenderDropdownItem.d.ts +1 -1
  85. package/esm/Form/Form.d.ts +8 -8
  86. package/esm/Form/test/Form.test.d.ts +1 -0
  87. package/esm/Form/test/Form.test.js +11 -0
  88. package/esm/Modal/test/Modal.test.d.ts +1 -0
  89. package/esm/Modal/test/Modal.test.js +9 -0
  90. package/esm/Modal/utils.d.ts +1 -1
  91. package/esm/Nav/NavDropdownMenu.d.ts +12 -1
  92. package/esm/Nav/NavDropdownMenu.js +8 -3
  93. package/esm/Nav/test/Nav.test.d.ts +1 -0
  94. package/esm/Nav/test/Nav.test.js +11 -0
  95. package/esm/Navbar/NavbarDropdownMenu.d.ts +12 -1
  96. package/esm/Navbar/NavbarDropdownMenu.js +8 -3
  97. package/esm/Overlay/Modal.d.ts +1 -4
  98. package/esm/Overlay/Overlay.d.ts +3 -1
  99. package/esm/Overlay/Overlay.js +6 -2
  100. package/esm/Overlay/OverlayTrigger.d.ts +4 -0
  101. package/esm/Overlay/OverlayTrigger.js +33 -5
  102. package/esm/Overlay/Position.d.ts +3 -1
  103. package/esm/Overlay/Position.js +12 -4
  104. package/esm/Overlay/positionUtils.d.ts +11 -4
  105. package/esm/Overlay/positionUtils.js +46 -2
  106. package/esm/Panel/Panel.js +9 -6
  107. package/esm/Picker/utils.d.ts +1 -1
  108. package/esm/Popover/Popover.d.ts +2 -0
  109. package/esm/Popover/Popover.js +6 -3
  110. package/esm/Sidenav/SidenavDropdownToggle.js +2 -1
  111. package/esm/Sidenav/SidenavItem.d.ts +4 -0
  112. package/esm/Sidenav/SidenavItem.js +38 -31
  113. package/esm/Toggle/Toggle.d.ts +1 -1
  114. package/esm/Tooltip/Tooltip.d.ts +3 -1
  115. package/esm/Tooltip/Tooltip.js +8 -3
  116. package/esm/Uploader/Uploader.d.ts +2 -0
  117. package/esm/Uploader/Uploader.js +6 -2
  118. package/esm/Whisper/Whisper.js +6 -1
  119. package/esm/index.d.ts +2 -2
  120. package/esm/index.js +1 -1
  121. package/esm/toaster/ToastContainer.d.ts +1 -0
  122. package/esm/toaster/ToastContainer.js +1 -0
  123. package/esm/toaster/index.d.ts +1 -0
  124. package/esm/toaster/index.js +1 -0
  125. package/esm/toaster/toaster.d.ts +0 -1
  126. package/esm/toaster/useToaster.d.ts +12 -0
  127. package/esm/toaster/useToaster.js +34 -0
  128. package/esm/utils/ajaxUpload.d.ts +1 -0
  129. package/esm/utils/ajaxUpload.js +3 -1
  130. package/esm/utils/constants.d.ts +1 -0
  131. package/esm/utils/constants.js +1 -0
  132. package/esm/utils/stringToObject.d.ts +1 -1
  133. package/esm/utils/tplTransform.d.ts +1 -1
  134. package/esm/utils/treeUtils.d.ts +3 -3
  135. package/esm/utils/useCustom.d.ts +1 -1
  136. package/esm/utils/useCustom.js +5 -3
  137. package/esm/utils/useFocus.d.ts +1 -1
  138. package/package.json +1 -1
  139. package/styles/color-modes/dark.less +223 -184
  140. package/styles/color-modes/high-contrast.less +221 -182
  141. package/styles/color-modes/light.less +44 -5
  142. package/styles/colors/dark.less +91 -91
  143. package/styles/colors/high-contrast.less +91 -91
  144. package/styles/variables.less +33 -12
  145. 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([]),
@@ -1,3 +1,4 @@
1
1
  import toaster from './toaster';
2
2
  export type { Toaster } from './toaster';
3
+ export { default as useToaster } from './useToaster';
3
4
  export default toaster;
@@ -1,2 +1,3 @@
1
1
  import toaster from './toaster';
2
+ export { default as useToaster } from './useToaster';
2
3
  export default toaster;
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { ToastContainerProps } from './ToastContainer';
3
- export declare type PlacementType = 'topStart' | 'topEnd' | 'bottomStart' | 'bottomEnd';
4
3
  export interface Toaster {
5
4
  /**
6
5
  * Add a message to the container.
@@ -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;
@@ -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('POST', url, true);
33
+ xhr.open(method, url, true);
32
34
 
33
35
  if (!disableMultipart) {
34
36
  sendableData = new FormData();
@@ -1,4 +1,5 @@
1
1
  export declare const SIZE: string[];
2
+ export declare const COLUMN_SIZE: string[];
2
3
  export declare const STATUS: string[];
3
4
  export declare const COLOR: string[];
4
5
  export declare const PLACEMENT_4: readonly ["top", "bottom", "right", "left"];
@@ -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 | undefined, valueKey?: string | undefined) => object | null;
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;
@@ -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 | undefined) => TreeNodeType[];
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 | undefined, layer?: any) => never[] | undefined;
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 | undefined) => void;
206
+ saveTreeNodeRef: (ref: React.Ref<any>, refKey?: string) => void;
207
207
  };
208
208
  interface TreeSearchProps {
209
209
  labelKey: string;
@@ -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: string | string[], overrideLocale?: any): CustomValue<T>;
6
+ declare function useCustom<T = any>(keys?: string | string[], overrideLocale?: any): CustomValue<T>;
7
7
  export default useCustom;
@@ -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
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  export default function useFocus<E extends HTMLElement>(elementRef: React.RefObject<E>): {
3
3
  grab: () => void;
4
- release: (options?: FocusOptions | undefined) => void;
4
+ release: (options?: FocusOptions) => void;
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsuite",
3
- "version": "5.13.1",
3
+ "version": "5.15.1",
4
4
  "description": "A suite of react components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",