rsuite 5.13.1 → 5.14.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.
Files changed (132) hide show
  1. package/Button/styles/index.less +1 -0
  2. package/CHANGELOG.md +25 -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/Whisper/Whisper.js +6 -1
  47. package/cjs/index.d.ts +2 -2
  48. package/cjs/index.js +3 -2
  49. package/cjs/toaster/ToastContainer.d.ts +1 -0
  50. package/cjs/toaster/ToastContainer.js +4 -1
  51. package/cjs/toaster/index.d.ts +1 -0
  52. package/cjs/toaster/index.js +4 -1
  53. package/cjs/toaster/toaster.d.ts +0 -1
  54. package/cjs/toaster/useToaster.d.ts +12 -0
  55. package/cjs/toaster/useToaster.js +43 -0
  56. package/cjs/utils/constants.d.ts +1 -0
  57. package/cjs/utils/constants.js +3 -1
  58. package/cjs/utils/stringToObject.d.ts +1 -1
  59. package/cjs/utils/tplTransform.d.ts +1 -1
  60. package/cjs/utils/treeUtils.d.ts +3 -3
  61. package/cjs/utils/useCustom.d.ts +1 -1
  62. package/cjs/utils/useCustom.js +5 -3
  63. package/cjs/utils/useFocus.d.ts +1 -1
  64. package/dist/rsuite-rtl.css +660 -47
  65. package/dist/rsuite-rtl.min.css +1 -1
  66. package/dist/rsuite-rtl.min.css.map +1 -1
  67. package/dist/rsuite.css +660 -47
  68. package/dist/rsuite.js +90 -101
  69. package/dist/rsuite.js.map +1 -1
  70. package/dist/rsuite.min.css +1 -1
  71. package/dist/rsuite.min.css.map +1 -1
  72. package/dist/rsuite.min.js +1 -1
  73. package/dist/rsuite.min.js.map +1 -1
  74. package/esm/@types/common.d.ts +6 -0
  75. package/esm/Cascader/utils.d.ts +1 -1
  76. package/esm/Col/Col.d.ts +25 -5
  77. package/esm/Col/Col.js +10 -2
  78. package/esm/CustomProvider/CustomProvider.d.ts +20 -7
  79. package/esm/CustomProvider/CustomProvider.js +22 -3
  80. package/esm/Dropdown/useRenderDropdownItem.d.ts +1 -1
  81. package/esm/Form/Form.d.ts +8 -8
  82. package/esm/Form/test/Form.test.d.ts +1 -0
  83. package/esm/Form/test/Form.test.js +11 -0
  84. package/esm/Modal/test/Modal.test.d.ts +1 -0
  85. package/esm/Modal/test/Modal.test.js +9 -0
  86. package/esm/Modal/utils.d.ts +1 -1
  87. package/esm/Nav/NavDropdownMenu.d.ts +12 -1
  88. package/esm/Nav/NavDropdownMenu.js +8 -3
  89. package/esm/Nav/test/Nav.test.d.ts +1 -0
  90. package/esm/Nav/test/Nav.test.js +11 -0
  91. package/esm/Navbar/NavbarDropdownMenu.d.ts +12 -1
  92. package/esm/Navbar/NavbarDropdownMenu.js +8 -3
  93. package/esm/Overlay/Modal.d.ts +1 -4
  94. package/esm/Overlay/Overlay.d.ts +3 -1
  95. package/esm/Overlay/Overlay.js +6 -2
  96. package/esm/Overlay/OverlayTrigger.d.ts +4 -0
  97. package/esm/Overlay/OverlayTrigger.js +33 -5
  98. package/esm/Overlay/Position.d.ts +3 -1
  99. package/esm/Overlay/Position.js +12 -4
  100. package/esm/Overlay/positionUtils.d.ts +11 -4
  101. package/esm/Overlay/positionUtils.js +46 -2
  102. package/esm/Panel/Panel.js +9 -6
  103. package/esm/Picker/utils.d.ts +1 -1
  104. package/esm/Popover/Popover.d.ts +2 -0
  105. package/esm/Popover/Popover.js +6 -3
  106. package/esm/Sidenav/SidenavDropdownToggle.js +2 -1
  107. package/esm/Sidenav/SidenavItem.d.ts +4 -0
  108. package/esm/Sidenav/SidenavItem.js +38 -31
  109. package/esm/Toggle/Toggle.d.ts +1 -1
  110. package/esm/Tooltip/Tooltip.d.ts +3 -1
  111. package/esm/Tooltip/Tooltip.js +8 -3
  112. package/esm/Whisper/Whisper.js +6 -1
  113. package/esm/index.d.ts +2 -2
  114. package/esm/index.js +1 -1
  115. package/esm/toaster/ToastContainer.d.ts +1 -0
  116. package/esm/toaster/ToastContainer.js +1 -0
  117. package/esm/toaster/index.d.ts +1 -0
  118. package/esm/toaster/index.js +1 -0
  119. package/esm/toaster/toaster.d.ts +0 -1
  120. package/esm/toaster/useToaster.d.ts +12 -0
  121. package/esm/toaster/useToaster.js +34 -0
  122. package/esm/utils/constants.d.ts +1 -0
  123. package/esm/utils/constants.js +1 -0
  124. package/esm/utils/stringToObject.d.ts +1 -1
  125. package/esm/utils/tplTransform.d.ts +1 -1
  126. package/esm/utils/treeUtils.d.ts +3 -3
  127. package/esm/utils/useCustom.d.ts +1 -1
  128. package/esm/utils/useCustom.js +5 -3
  129. package/esm/utils/useFocus.d.ts +1 -1
  130. package/package.json +1 -1
  131. package/styles/color-modes/light.less +2 -2
  132. package/styles/variables.less +30 -12
@@ -149,4 +149,10 @@ export interface Offset {
149
149
  height: number;
150
150
  }
151
151
  export declare type OnChangeCallback<T, E = React.SyntheticEvent> = (value: T, event: E) => void;
152
+ export declare type CursorPosition = {
153
+ top: number;
154
+ left: number;
155
+ clientTop: number;
156
+ clientLeft: number;
157
+ };
152
158
  export {};
@@ -6,7 +6,7 @@ export declare function getColumnsAndPaths<T extends ItemDataType>(data: T[], va
6
6
  paths: T[];
7
7
  };
8
8
  export declare function usePaths(props: CascaderProps): {
9
- enforceUpdate: (nextValue: any, isAttachChildren?: boolean | undefined) => void;
9
+ enforceUpdate: (nextValue: any, isAttachChildren?: boolean) => void;
10
10
  columnData: ItemDataType<string | number>[][];
11
11
  valueToPaths: ItemDataType<string | number>[];
12
12
  selectedPaths: ItemDataType<string | number>[];
package/esm/Col/Col.d.ts CHANGED
@@ -1,21 +1,29 @@
1
1
  import { WithAsProps, RsRefForwardingComponent } from '../@types/common';
2
2
  export interface ColProps extends WithAsProps {
3
- /** The number of columns you wish to span for Extra small devices Phones (< 480px) */
3
+ /** The number of columns you wish to span for Extra small devices Phones (< 576px) */
4
4
  xs?: number;
5
- /** The number of columns you wish to span for Small devices Tablets (≥ 480px) */
5
+ /** The number of columns you wish to span for Small devices Tablets (≥ 576px) */
6
6
  sm?: number;
7
- /** The number of columns you wish to span for Medium devices Desktops (≥ 992px) */
7
+ /** The number of columns you wish to span for Medium devices Desktops (≥ 768px) */
8
8
  md?: number;
9
- /** The number of columns you wish to span for Large devices Desktops (≥ 1200px) */
9
+ /** The number of columns you wish to span for Large devices Desktops (≥ 992px) */
10
10
  lg?: number;
11
+ /** The number of columns you wish to span for Extra Large devices Desktops (≥ 1200px) */
12
+ xl?: number;
13
+ /** The number of columns you wish to span for Ultra Large devices Desktops (≥ 1400px) */
14
+ xxl?: number;
11
15
  /** Move columns to the right for Extra small devices Phones */
12
16
  xsOffset?: number;
13
17
  /** Move columns to the right for Small devices Tablets */
14
18
  smOffset?: number;
15
19
  /** Move columns to the right for Medium devices Desktops */
16
20
  mdOffset?: number;
17
- /** Move columns to the right for Medium devices Desktops */
21
+ /** Move columns to the right for Large devices Desktops */
18
22
  lgOffset?: number;
23
+ /** Move columns to the right for Extra large devices Desktops */
24
+ xlOffset?: number;
25
+ /** Move columns to the right for Ultra large devices Desktops */
26
+ xxlOffset?: number;
19
27
  /** Change the order of grid columns to the right for Extra small devices Phones */
20
28
  xsPush?: number;
21
29
  /** Change the order of grid columns to the right for Small devices Tablets */
@@ -24,6 +32,10 @@ export interface ColProps extends WithAsProps {
24
32
  mdPush?: number;
25
33
  /** Change the order of grid columns to the right for Large devices Desktops */
26
34
  lgPush?: number;
35
+ /** Change the order of grid columns to the right for Extra large devices Desktops */
36
+ xlPush?: number;
37
+ /** Change the order of grid columns to the right for Ultra large devices Desktops */
38
+ xxlPush?: number;
27
39
  /** Change the order of grid columns to the left for Extra small devices Phones */
28
40
  xsPull?: number;
29
41
  /** Change the order of grid columns to the left for Small devices Tablets */
@@ -32,6 +44,10 @@ export interface ColProps extends WithAsProps {
32
44
  mdPull?: number;
33
45
  /** Change the order of grid columns to the left for Large devices Desktops */
34
46
  lgPull?: number;
47
+ /** Change the order of grid columns to the left for Extra large devices Desktops */
48
+ xlPull?: number;
49
+ /** Change the order of grid columns to the left for Ultra large devices Desktops */
50
+ xxlPull?: number;
35
51
  /** Hide column on Extra small devices Phones */
36
52
  xsHidden?: boolean;
37
53
  /** Hide column on Small devices Tablets */
@@ -40,6 +56,10 @@ export interface ColProps extends WithAsProps {
40
56
  mdHidden?: boolean;
41
57
  /** Hide column on Large devices Desktops */
42
58
  lgHidden?: boolean;
59
+ /** Hide column on Extra large devices Desktops */
60
+ xlHidden?: boolean;
61
+ /** Hide column on Ultra large devices Desktops */
62
+ xxlHidden?: boolean;
43
63
  }
44
64
  declare const Col: RsRefForwardingComponent<'div', ColProps>;
45
65
  export default Col;
package/esm/Col/Col.js CHANGED
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  import React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import omit from 'lodash/omit';
6
- import { useClassNames, SIZE } from '../utils';
6
+ import { useClassNames, COLUMN_SIZE } from '../utils';
7
7
  var Col = /*#__PURE__*/React.forwardRef(function (props, ref) {
8
8
  var _props$as = props.as,
9
9
  Component = _props$as === void 0 ? 'div' : _props$as,
@@ -26,7 +26,7 @@ var Col = /*#__PURE__*/React.forwardRef(function (props, ref) {
26
26
  return rest[key];
27
27
  };
28
28
 
29
- SIZE.forEach(function (size) {
29
+ COLUMN_SIZE.forEach(function (size) {
30
30
  var col = getPropValue(size);
31
31
  var hidden = getPropValue(size + "Hidden");
32
32
  var offset = getPropValue(size + "Offset");
@@ -55,10 +55,14 @@ Col.propTypes = {
55
55
  sm: PropTypes.number,
56
56
  md: PropTypes.number,
57
57
  lg: PropTypes.number,
58
+ xl: PropTypes.number,
59
+ xxl: PropTypes.number,
58
60
  xsOffset: PropTypes.number,
59
61
  smOffset: PropTypes.number,
60
62
  mdOffset: PropTypes.number,
61
63
  lgOffset: PropTypes.number,
64
+ xlOffset: PropTypes.number,
65
+ xxlOffset: PropTypes.number,
62
66
  xsPush: PropTypes.number,
63
67
  smPush: PropTypes.number,
64
68
  mdPush: PropTypes.number,
@@ -67,10 +71,14 @@ Col.propTypes = {
67
71
  smPull: PropTypes.number,
68
72
  mdPull: PropTypes.number,
69
73
  lgPull: PropTypes.number,
74
+ xlPull: PropTypes.number,
75
+ xxlPull: PropTypes.number,
70
76
  xsHidden: PropTypes.bool,
71
77
  smHidden: PropTypes.bool,
72
78
  mdHidden: PropTypes.bool,
73
79
  lgHidden: PropTypes.bool,
80
+ xlHidden: PropTypes.bool,
81
+ xxlHidden: PropTypes.bool,
74
82
  as: PropTypes.elementType
75
83
  };
76
84
  export default Col;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Locale } from '../locales';
3
+ import { ToastContainerInstance } from '../toaster/ToastContainer';
3
4
  export interface CustomValue<T = Locale> {
4
5
  /** Language configuration */
5
6
  locale: T;
@@ -33,6 +34,10 @@ export interface CustomValue<T = Locale> {
33
34
  *
34
35
  * */
35
36
  parseDate: (dateString: string, formatString: string) => Date;
37
+ /**
38
+ * A Map of toast containers
39
+ */
40
+ toasters?: React.MutableRefObject<Map<string, ToastContainerInstance>>;
36
41
  }
37
42
  export interface CustomProviderProps<T = Locale> extends Partial<CustomValue<T>> {
38
43
  /** Supported themes */
@@ -41,6 +46,8 @@ export interface CustomProviderProps<T = Locale> extends Partial<CustomValue<T>>
41
46
  classPrefix?: string;
42
47
  /** Primary content */
43
48
  children?: React.ReactNode;
49
+ /** Sets a container for toast rendering */
50
+ toastContainer?: HTMLElement | (() => HTMLElement | null) | null;
44
51
  }
45
52
  declare const CustomContext: React.Context<CustomProviderProps<{
46
53
  common?: {
@@ -75,7 +82,7 @@ declare const CustomContext: React.Context<CustomProviderProps<{
75
82
  yesterday: string;
76
83
  hours: string;
77
84
  minutes: string;
78
- seconds: string; /** Support right-to-left */
85
+ seconds: string;
79
86
  formattedMonthPattern: string;
80
87
  formattedDayPattern: string;
81
88
  dateLocale: any;
@@ -93,7 +100,7 @@ declare const CustomContext: React.Context<CustomProviderProps<{
93
100
  yesterday: string;
94
101
  hours: string;
95
102
  minutes: string;
96
- seconds: string; /** Support right-to-left */
103
+ seconds: string;
97
104
  formattedMonthPattern: string;
98
105
  formattedDayPattern: string;
99
106
  dateLocale: any;
@@ -112,7 +119,7 @@ declare const CustomContext: React.Context<CustomProviderProps<{
112
119
  yesterday: string;
113
120
  hours: string;
114
121
  minutes: string;
115
- seconds: string; /** Support right-to-left */
122
+ seconds: string;
116
123
  formattedMonthPattern: string;
117
124
  formattedDayPattern: string;
118
125
  dateLocale: any;
@@ -125,6 +132,9 @@ declare const CustomContext: React.Context<CustomProviderProps<{
125
132
  } | undefined;
126
133
  InputPicker?: {
127
134
  newItem: string;
135
+ /**
136
+ * A Map of toast containers
137
+ */
128
138
  createOption: string;
129
139
  } | undefined;
130
140
  Uploader?: {
@@ -179,7 +189,7 @@ declare const Consumer: React.Consumer<CustomProviderProps<{
179
189
  yesterday: string;
180
190
  hours: string;
181
191
  minutes: string;
182
- seconds: string; /** Support right-to-left */
192
+ seconds: string;
183
193
  formattedMonthPattern: string;
184
194
  formattedDayPattern: string;
185
195
  dateLocale: any;
@@ -197,7 +207,7 @@ declare const Consumer: React.Consumer<CustomProviderProps<{
197
207
  yesterday: string;
198
208
  hours: string;
199
209
  minutes: string;
200
- seconds: string; /** Support right-to-left */
210
+ seconds: string;
201
211
  formattedMonthPattern: string;
202
212
  formattedDayPattern: string;
203
213
  dateLocale: any;
@@ -216,7 +226,7 @@ declare const Consumer: React.Consumer<CustomProviderProps<{
216
226
  yesterday: string;
217
227
  hours: string;
218
228
  minutes: string;
219
- seconds: string; /** Support right-to-left */
229
+ seconds: string;
220
230
  formattedMonthPattern: string;
221
231
  formattedDayPattern: string;
222
232
  dateLocale: any;
@@ -229,6 +239,9 @@ declare const Consumer: React.Consumer<CustomProviderProps<{
229
239
  } | undefined;
230
240
  InputPicker?: {
231
241
  newItem: string;
242
+ /**
243
+ * A Map of toast containers
244
+ */
232
245
  createOption: string;
233
246
  } | undefined;
234
247
  Uploader?: {
@@ -250,6 +263,6 @@ declare const Consumer: React.Consumer<CustomProviderProps<{
250
263
  off: string;
251
264
  } | undefined;
252
265
  }>>;
253
- declare const CustomProvider: (props: CustomProviderProps) => JSX.Element;
266
+ declare const CustomProvider: (props: Omit<CustomProviderProps, 'toasters'>) => JSX.Element;
254
267
  export { CustomContext, Consumer as CustomConsumer };
255
268
  export default CustomProvider;
@@ -3,6 +3,8 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  import React, { useEffect } from 'react';
4
4
  import { getClassNamePrefix, prefix } from '../utils/prefix';
5
5
  import { addClass, removeClass, canUseDOM } from '../DOMHelper';
6
+ import ToastContainer, { toastPlacements } from '../toaster/ToastContainer';
7
+ import { usePortal } from '../utils';
6
8
  var CustomContext = /*#__PURE__*/React.createContext({});
7
9
  var Consumer = CustomContext.Consumer,
8
10
  Provider = CustomContext.Provider;
@@ -13,12 +15,21 @@ var CustomProvider = function CustomProvider(props) {
13
15
  _props$classPrefix = props.classPrefix,
14
16
  classPrefix = _props$classPrefix === void 0 ? getClassNamePrefix() : _props$classPrefix,
15
17
  theme = props.theme,
16
- rest = _objectWithoutPropertiesLoose(props, ["children", "classPrefix", "theme"]);
18
+ container = props.toastContainer,
19
+ rest = _objectWithoutPropertiesLoose(props, ["children", "classPrefix", "theme", "toastContainer"]);
20
+
21
+ var toasters = React.useRef(new Map());
22
+
23
+ var _usePortal = usePortal({
24
+ container: container
25
+ }),
26
+ Portal = _usePortal.Portal;
17
27
 
18
28
  var value = React.useMemo(function () {
19
29
  return _extends({
20
30
  classPrefix: classPrefix,
21
- theme: theme
31
+ theme: theme,
32
+ toasters: toasters
22
33
  }, rest);
23
34
  }, [classPrefix, theme, rest]);
24
35
  useEffect(function () {
@@ -34,7 +45,15 @@ var CustomProvider = function CustomProvider(props) {
34
45
  }, [classPrefix, theme]);
35
46
  return /*#__PURE__*/React.createElement(Provider, {
36
47
  value: value
37
- }, children);
48
+ }, children, /*#__PURE__*/React.createElement(Portal, null, toastPlacements.map(function (placement) {
49
+ return /*#__PURE__*/React.createElement(ToastContainer, {
50
+ key: placement,
51
+ placement: placement,
52
+ ref: function ref(_ref) {
53
+ toasters.current.set(placement, _ref);
54
+ }
55
+ });
56
+ })));
38
57
  };
39
58
 
40
59
  export { CustomContext, Consumer as CustomConsumer };
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare function useRenderDropdownItem(Component: React.ElementType): (props: any, OverrideComponent?: React.ElementType<any> | undefined) => JSX.Element;
2
+ export declare function useRenderDropdownItem(Component: React.ElementType): (props: any, OverrideComponent?: React.ElementType) => JSX.Element;
@@ -44,21 +44,21 @@ export interface FormProps<T = Record<string, any>, errorMsgType = any, E = {
44
44
  export interface FormInstance<T = Record<string, any>, errorMsg = string, E = {
45
45
  [P in keyof T]?: errorMsg;
46
46
  }> {
47
- root: React.FormHTMLAttributes<HTMLFormElement>;
47
+ root: HTMLFormElement | null;
48
48
  /** Verify form data */
49
- check?: (callback?: (formError: E) => void) => boolean;
49
+ check: (callback?: (formError: E) => void) => boolean;
50
50
  /** Asynchronously check form data */
51
- checkAsync?: () => Promise<any>;
51
+ checkAsync: () => Promise<any>;
52
52
  /** Check the data field */
53
- checkForField?: (fieldName: keyof T, callback?: (checkResult: CheckResult<errorMsg>) => void) => boolean;
53
+ checkForField: (fieldName: keyof T, callback?: (checkResult: CheckResult<errorMsg>) => void) => boolean;
54
54
  /** Asynchronous verification as a data field */
55
- checkForFieldAsync?: (fieldName: keyof T) => Promise<CheckResult>;
55
+ checkForFieldAsync: (fieldName: keyof T) => Promise<CheckResult>;
56
56
  /** Clear all error messages */
57
- cleanErrors?: (callback?: () => void) => void;
57
+ cleanErrors: (callback?: () => void) => void;
58
58
  /** Clear the error message of the specified field */
59
- cleanErrorForField?: (fieldName: keyof E, callback?: () => void) => void;
59
+ cleanErrorForField: (fieldName: keyof E, callback?: () => void) => void;
60
60
  /** All error messages are reset, and an initial value can be set */
61
- resetErrors?: (formError: E, callback?: () => void) => void;
61
+ resetErrors: (formError: E, callback?: () => void) => void;
62
62
  }
63
63
  export interface FormComponent extends RsRefForwardingComponent<'form', FormProps & {
64
64
  ref?: React.Ref<FormInstance>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ var _formRef$current;
2
+
3
+ import React from 'react';
4
+ import Form from '../Form';
5
+ var formRef = /*#__PURE__*/React.createRef();
6
+
7
+ /*#__PURE__*/
8
+ React.createElement(Form, {
9
+ ref: formRef
10
+ });
11
+ (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.check();
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import Modal from '../Modal';
3
+
4
+ /*#__PURE__*/
5
+ React.createElement(Modal, {
6
+ container: function container() {
7
+ return document.body;
8
+ }
9
+ });
@@ -3,4 +3,4 @@ export declare const useBodyStyles: (ref: React.RefObject<HTMLElement>, options:
3
3
  overflow: boolean;
4
4
  drawer: boolean;
5
5
  prefix: (...classes: any) => string;
6
- }) => [import("react").CSSProperties, (entering?: boolean | undefined) => void, () => void];
6
+ }) => [import("react").CSSProperties, (entering?: boolean) => void, () => void];
@@ -4,8 +4,19 @@ import { IconProps } from '@rsuite/icons/lib/Icon';
4
4
  export interface NavDropdownMenuProps<T = any> extends StandardProps {
5
5
  /** Define the title as a submenu */
6
6
  title?: React.ReactNode;
7
- /** The submenu expands from the left and defaults to the right */
7
+ /**
8
+ * The submenu expands from the left and defaults to the right
9
+ * @deprecated Use openDirection="start" instead
10
+ */
8
11
  pullLeft?: boolean;
12
+ /**
13
+ * Direction that the sub-menu open towards
14
+ * - start: towards the head of the reading direction (right by default, left in RTL)
15
+ * - end: towards the end of the reading direction (left by default, right in RTL)
16
+ *
17
+ * @default 'end'
18
+ */
19
+ openDirection?: 'start' | 'end';
9
20
  /**
10
21
  * Only used for setting the default expand state when it's a submenu.
11
22
  */
@@ -14,6 +14,7 @@ import AngleLeft from '@rsuite/icons/legacy/AngleLeft';
14
14
  import AngleRight from '@rsuite/icons/legacy/AngleRight';
15
15
  import useCustom from '../utils/useCustom';
16
16
  import NavContext from './NavContext';
17
+ import deprecatePropType from '../utils/deprecatePropType';
17
18
 
18
19
  /**
19
20
  * @private
@@ -31,7 +32,9 @@ var NavDropdownMenu = /*#__PURE__*/React.forwardRef(function (props, ref) {
31
32
  _props$classPrefix = props.classPrefix,
32
33
  classPrefix = _props$classPrefix === void 0 ? 'dropdown-menu' : _props$classPrefix,
33
34
  children = props.children,
34
- rest = _objectWithoutPropertiesLoose(props, ["onToggle", "eventKey", "title", "classPrefix", "children"]);
35
+ _props$openDirection = props.openDirection,
36
+ openDirection = _props$openDirection === void 0 ? 'end' : _props$openDirection,
37
+ rest = _objectWithoutPropertiesLoose(props, ["onToggle", "eventKey", "title", "classPrefix", "children", "openDirection"]);
35
38
 
36
39
  var _useCustom = useCustom('DropdownMenu'),
37
40
  rtl = _useCustom.rtl;
@@ -101,7 +104,8 @@ var NavDropdownMenu = /*#__PURE__*/React.forwardRef(function (props, ref) {
101
104
  return /*#__PURE__*/React.createElement("ul", _extends({
102
105
  ref: popupRef,
103
106
  className: menuClassName,
104
- hidden: !open
107
+ hidden: !open,
108
+ "data-direction": openDirection
105
109
  }, popupProps, menuProps), children);
106
110
  },
107
111
  onToggleMenu: handleToggleSubmenu
@@ -127,7 +131,8 @@ NavDropdownMenu.propTypes = {
127
131
  children: PropTypes.node,
128
132
  icon: PropTypes.any,
129
133
  classPrefix: PropTypes.string,
130
- pullLeft: PropTypes.bool,
134
+ pullLeft: deprecatePropType(PropTypes.bool, 'Use openDirection="start" instead.'),
135
+ openDirection: PropTypes.oneOf(['start', 'end']),
131
136
  title: PropTypes.node,
132
137
  open: PropTypes.bool,
133
138
  eventKey: PropTypes.any,
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import Navbar from '../../Navbar';
3
+ import Nav from '../Nav';
4
+
5
+ /*#__PURE__*/
6
+ React.createElement(Navbar, null, /*#__PURE__*/React.createElement(Nav, null, /*#__PURE__*/React.createElement(Nav.Menu, {
7
+ title: "Menu"
8
+ }, /*#__PURE__*/React.createElement(Nav.Menu, {
9
+ title: "Submenu",
10
+ openDirection: "start"
11
+ }, /*#__PURE__*/React.createElement(Nav.Item, null, "Submenu item")))));
@@ -4,8 +4,19 @@ import { IconProps } from '@rsuite/icons/lib/Icon';
4
4
  export interface NavbarDropdownMenuProps<T = any> extends StandardProps {
5
5
  /** Define the title as a submenu */
6
6
  title?: React.ReactNode;
7
- /** The submenu expands from the left and defaults to the right */
7
+ /**
8
+ * The submenu expands from the left and defaults to the right
9
+ * @deprecated Use openDirection="start" instead.
10
+ */
8
11
  pullLeft?: boolean;
12
+ /**
13
+ * Direction that the sub-menu open towards
14
+ * - start: towards the head of the reading direction (right by default, left in RTL)
15
+ * - end: towards the end of the reading direction (left by default, right in RTL)
16
+ *
17
+ * @default 'end'
18
+ */
19
+ openDirection?: 'start' | 'end';
9
20
  /**
10
21
  * Only used for setting the default expand state when it's a submenu.
11
22
  */
@@ -14,6 +14,7 @@ import useCustom from '../utils/useCustom';
14
14
  import { NavbarContext } from '.';
15
15
  import Disclosure from '../Disclosure';
16
16
  import NavContext from '../Nav/NavContext';
17
+ import deprecatePropType from '../utils/deprecatePropType';
17
18
 
18
19
  /**
19
20
  * @private this component is not supposed to be used directly
@@ -42,7 +43,9 @@ var NavbarDropdownMenu = /*#__PURE__*/React.forwardRef(function (props, ref) {
42
43
  _props$classPrefix = props.classPrefix,
43
44
  classPrefix = _props$classPrefix === void 0 ? 'dropdown-menu' : _props$classPrefix,
44
45
  children = props.children,
45
- rest = _objectWithoutPropertiesLoose(props, ["onToggle", "eventKey", "title", "classPrefix", "children"]);
46
+ _props$openDirection = props.openDirection,
47
+ openDirection = _props$openDirection === void 0 ? 'end' : _props$openDirection,
48
+ rest = _objectWithoutPropertiesLoose(props, ["onToggle", "eventKey", "title", "classPrefix", "children", "openDirection"]);
46
49
 
47
50
  var _useCustom = useCustom('DropdownMenu'),
48
51
  rtl = _useCustom.rtl;
@@ -111,7 +114,8 @@ var NavbarDropdownMenu = /*#__PURE__*/React.forwardRef(function (props, ref) {
111
114
  return /*#__PURE__*/React.createElement("ul", _extends({
112
115
  ref: elementRef,
113
116
  className: menuClassName,
114
- hidden: !open
117
+ hidden: !open,
118
+ "data-direction": openDirection
115
119
  }, menuProps), children);
116
120
  }));
117
121
  });
@@ -124,7 +128,8 @@ NavbarDropdownMenu.propTypes = {
124
128
  children: PropTypes.node,
125
129
  icon: PropTypes.any,
126
130
  classPrefix: PropTypes.string,
127
- pullLeft: PropTypes.bool,
131
+ pullLeft: deprecatePropType(PropTypes.bool, 'Use openDirection="start" instead.'),
132
+ openDirection: PropTypes.oneOf(['start', 'end']),
128
133
  title: PropTypes.node,
129
134
  open: PropTypes.bool,
130
135
  eventKey: PropTypes.any,
@@ -37,9 +37,6 @@ export interface BaseModalProps extends WithAsProps, AnimationEventProps {
37
37
  onOpen?: () => void;
38
38
  /** Called when Modal is closed */
39
39
  onClose?: (event: React.SyntheticEvent) => void;
40
- }
41
- interface ModalProps extends BaseModalProps {
42
- children: (props: any, ref: any) => React.ReactElement;
43
40
  container?: HTMLElement | (() => HTMLElement);
44
41
  containerClassName?: string;
45
42
  backdropTransitionTimeout?: number;
@@ -48,7 +45,7 @@ interface ModalProps extends BaseModalProps {
48
45
  onEsc?: React.KeyboardEventHandler;
49
46
  onBackdropClick?: React.MouseEventHandler;
50
47
  }
51
- declare const Modal: RsRefForwardingComponent<'div', ModalProps>;
48
+ declare const Modal: RsRefForwardingComponent<'div', BaseModalProps>;
52
49
  export declare const modalPropTypes: {
53
50
  as: PropTypes.Requireable<PropTypes.ReactComponentLike>;
54
51
  className: PropTypes.Requireable<string>;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { TypeAttributes, AnimationEventProps } from '../@types/common';
3
+ import { TypeAttributes, AnimationEventProps, CursorPosition } from '../@types/common';
4
4
  export interface OverlayProps extends AnimationEventProps {
5
5
  container?: HTMLElement | (() => HTMLElement | null) | null;
6
6
  children: React.ReactElement | ((props: any, ref: any) => React.ReactElement);
@@ -14,6 +14,8 @@ export interface OverlayProps extends AnimationEventProps {
14
14
  transition?: React.ElementType;
15
15
  triggerTarget?: React.RefObject<any>;
16
16
  onClose?: React.ReactEventHandler;
17
+ followCursor?: boolean;
18
+ cursorPosition?: CursorPosition | null;
17
19
  }
18
20
  export declare const overlayPropTypes: {
19
21
  container: PropTypes.Requireable<any>;
@@ -48,7 +48,9 @@ var Overlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
48
48
  onExiting = props.onExiting,
49
49
  onEnter = props.onEnter,
50
50
  onEntering = props.onEntering,
51
- onEntered = props.onEntered;
51
+ onEntered = props.onEntered,
52
+ followCursor = props.followCursor,
53
+ cursorPosition = props.cursorPosition;
52
54
 
53
55
  var _useState = useState(!open),
54
56
  exited = _useState[0],
@@ -82,7 +84,9 @@ var Overlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
82
84
  containerPadding: containerPadding,
83
85
  triggerTarget: triggerTarget,
84
86
  placement: placement,
85
- preventOverflow: preventOverflow
87
+ preventOverflow: preventOverflow,
88
+ followCursor: followCursor,
89
+ cursorPosition: cursorPosition
86
90
  };
87
91
 
88
92
  var renderChildWithPosition = function renderChildWithPosition(transitionProps, transitionRef) {
@@ -50,10 +50,14 @@ export interface OverlayTriggerProps extends StandardProps, AnimationEventProps
50
50
  onMouseOut?: React.MouseEventHandler;
51
51
  /** Mouse over callback function */
52
52
  onMouseOver?: React.MouseEventHandler;
53
+ /** Mouse move callback function */
54
+ onMouseMove?: React.MouseEventHandler;
53
55
  /** Callback fired when open component */
54
56
  onOpen?: () => void;
55
57
  /** Callback fired when close component */
56
58
  onClose?: () => void;
59
+ /** Whether speaker to follow the cursor */
60
+ followCursor?: boolean;
57
61
  }
58
62
  export interface OverlayTriggerInstance {
59
63
  root: HTMLElement | undefined;