rsuite 6.0.0-canary-20251029 → 6.0.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/Badge/styles/index.css +62 -5
- package/Breadcrumb/styles/index.css +2 -3
- package/CHANGELOG.md +196 -396
- package/Modal/styles/index.css +5 -0
- package/Nav/styles/index.css +4 -0
- package/Pagination/styles/index.css +25 -2
- package/Tabs/styles/index.css +4 -0
- package/cjs/AutoComplete/utils.js +0 -0
- package/cjs/Badge/Badge.d.ts +5 -1
- package/cjs/Badge/Badge.js +4 -2
- package/cjs/Breadcrumb/Breadcrumb.js +1 -1
- package/cjs/CheckPicker/CheckPicker.js +5 -2
- package/cjs/CheckTreePicker/CheckTreePicker.js +5 -2
- package/cjs/DOMHelper/isElement.js +0 -0
- package/cjs/DatePicker/Toolbar.js +4 -1
- package/cjs/Dropdown/DropdownState.js +0 -0
- package/cjs/List/ListContext.js +0 -0
- package/cjs/List/helper/AutoScroller.js +0 -0
- package/cjs/List/helper/useManager.js +0 -0
- package/cjs/MaskedInput/adjustCaretPosition.js +0 -0
- package/cjs/MaskedInput/types.js +0 -0
- package/cjs/MaskedInput/utilities.js +0 -0
- package/cjs/Modal/Modal.d.ts +5 -0
- package/cjs/Modal/Modal.js +2 -0
- package/cjs/Modal/utils.js +24 -5
- package/cjs/MultiCascader/MultiCascader.js +5 -2
- package/cjs/Sidenav/Node.js +0 -0
- package/cjs/internals/Picker/SelectedElement.d.ts +2 -0
- package/cjs/internals/Picker/SelectedElement.js +4 -2
- package/dist/rsuite-no-reset.css +97 -7
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite.css +97 -7
- package/dist/rsuite.js +265 -265
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/AutoComplete/utils.js +0 -0
- package/esm/Badge/Badge.d.ts +5 -1
- package/esm/Badge/Badge.js +4 -2
- package/esm/Breadcrumb/Breadcrumb.js +1 -1
- package/esm/CheckPicker/CheckPicker.js +5 -2
- package/esm/CheckTreePicker/CheckTreePicker.js +5 -2
- package/esm/DOMHelper/isElement.js +0 -0
- package/esm/DatePicker/Toolbar.js +4 -1
- package/esm/Dropdown/DropdownState.js +0 -0
- package/esm/List/ListContext.js +0 -0
- package/esm/List/helper/AutoScroller.js +0 -0
- package/esm/List/helper/useManager.js +0 -0
- package/esm/MaskedInput/adjustCaretPosition.js +0 -0
- package/esm/MaskedInput/types.js +0 -0
- package/esm/MaskedInput/utilities.js +0 -0
- package/esm/Modal/Modal.d.ts +5 -0
- package/esm/Modal/Modal.js +2 -0
- package/esm/Modal/utils.js +24 -5
- package/esm/MultiCascader/MultiCascader.js +5 -2
- package/esm/Sidenav/Node.js +0 -0
- package/esm/internals/Picker/SelectedElement.d.ts +2 -0
- package/esm/internals/Picker/SelectedElement.js +4 -2
- package/package.json +1 -1
|
File without changes
|
package/esm/Badge/Badge.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BoxProps } from '../internals/Box';
|
|
3
|
-
import type { Color, PlacementCorners } from '../internals/types';
|
|
3
|
+
import type { Color, PlacementCorners, Size } from '../internals/types';
|
|
4
4
|
export interface BadgeProps extends BoxProps {
|
|
5
5
|
/**
|
|
6
6
|
* The content of the badge
|
|
@@ -33,6 +33,10 @@ export interface BadgeProps extends BoxProps {
|
|
|
33
33
|
* @version 6.0.0
|
|
34
34
|
*/
|
|
35
35
|
shape?: 'rectangle' | 'circle';
|
|
36
|
+
/**
|
|
37
|
+
* A badge can have different sizes
|
|
38
|
+
*/
|
|
39
|
+
size?: Size;
|
|
36
40
|
/**
|
|
37
41
|
* Define the horizontal and vertical offset of the badge relative to its wrapped element
|
|
38
42
|
* @version 6.0.0
|
package/esm/Badge/Badge.js
CHANGED
|
@@ -25,6 +25,7 @@ const Badge = forwardRef((props, ref) => {
|
|
|
25
25
|
outline = true,
|
|
26
26
|
placement = 'topEnd',
|
|
27
27
|
shape,
|
|
28
|
+
size = 'md',
|
|
28
29
|
style,
|
|
29
30
|
invisible,
|
|
30
31
|
...rest
|
|
@@ -52,9 +53,10 @@ const Badge = forwardRef((props, ref) => {
|
|
|
52
53
|
['data-outline']: outline,
|
|
53
54
|
['data-hidden']: invisible,
|
|
54
55
|
['data-independent']: !children,
|
|
55
|
-
['data-placement']: children ? placement : undefined
|
|
56
|
+
['data-placement']: children ? placement : undefined,
|
|
57
|
+
['data-size']: size
|
|
56
58
|
};
|
|
57
|
-
}, [color, shape, compact, isOneChar, outline, invisible, children, placement]);
|
|
59
|
+
}, [color, shape, compact, isOneChar, outline, invisible, children, placement, size]);
|
|
58
60
|
if (!children) {
|
|
59
61
|
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
60
62
|
as: as,
|
|
@@ -46,6 +46,7 @@ const CheckPicker = forwardRef((props, ref) => {
|
|
|
46
46
|
searchable = true,
|
|
47
47
|
sticky,
|
|
48
48
|
style,
|
|
49
|
+
size,
|
|
49
50
|
toggleAs,
|
|
50
51
|
value: valueProp,
|
|
51
52
|
valueKey = 'value',
|
|
@@ -204,7 +205,8 @@ const CheckPicker = forwardRef((props, ref) => {
|
|
|
204
205
|
countable: countable,
|
|
205
206
|
valueKey: valueKey,
|
|
206
207
|
labelKey: labelKey,
|
|
207
|
-
prefix: prefix
|
|
208
|
+
prefix: prefix,
|
|
209
|
+
badgeSize: size
|
|
208
210
|
});
|
|
209
211
|
}
|
|
210
212
|
if ((value === null || value === void 0 ? void 0 : value.length) > 0 && isFunction(renderValue)) {
|
|
@@ -304,7 +306,8 @@ const CheckPicker = forwardRef((props, ref) => {
|
|
|
304
306
|
active: active,
|
|
305
307
|
placement: placement,
|
|
306
308
|
inputValue: value,
|
|
307
|
-
focusItemValue: focusItemValue
|
|
309
|
+
focusItemValue: focusItemValue,
|
|
310
|
+
size: size
|
|
308
311
|
}, rest), selectedElement || (locale === null || locale === void 0 ? void 0 : locale.placeholder)));
|
|
309
312
|
});
|
|
310
313
|
CheckPicker.displayName = 'CheckPicker';
|
|
@@ -55,6 +55,7 @@ const CheckTreePicker = forwardRef((props, ref) => {
|
|
|
55
55
|
showIndentLine,
|
|
56
56
|
searchable = true,
|
|
57
57
|
style,
|
|
58
|
+
size,
|
|
58
59
|
valueKey = 'value',
|
|
59
60
|
value: controlledValue,
|
|
60
61
|
virtualized = false,
|
|
@@ -268,7 +269,8 @@ const CheckTreePicker = forwardRef((props, ref) => {
|
|
|
268
269
|
childrenKey: childrenKey,
|
|
269
270
|
prefix: prefix,
|
|
270
271
|
cascade: cascade,
|
|
271
|
-
locale: locale
|
|
272
|
+
locale: locale,
|
|
273
|
+
badgeSize: size
|
|
272
274
|
});
|
|
273
275
|
if (isFunction(renderValue)) {
|
|
274
276
|
selectedElement = renderValue(value, selectedNodes, selectedElement);
|
|
@@ -310,7 +312,8 @@ const CheckTreePicker = forwardRef((props, ref) => {
|
|
|
310
312
|
active: active,
|
|
311
313
|
placement: placement,
|
|
312
314
|
inputValue: value,
|
|
313
|
-
focusItemValue: focusItemValue
|
|
315
|
+
focusItemValue: focusItemValue,
|
|
316
|
+
size: size
|
|
314
317
|
}, rest), selectedElement || (locale === null || locale === void 0 ? void 0 : locale.placeholder)));
|
|
315
318
|
});
|
|
316
319
|
CheckTreePicker.displayName = 'CheckTreePicker';
|
|
File without changes
|
|
@@ -46,10 +46,13 @@ const Toolbar = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
48
|
const classes = merge(className, withPrefix());
|
|
49
|
+
|
|
50
|
+
// If there are no ranges, the ok button should be aligned to the right
|
|
51
|
+
const justify = (ranges === null || ranges === void 0 ? void 0 : ranges.length) === 0 ? 'flex-end' : 'space-between';
|
|
49
52
|
return /*#__PURE__*/React.createElement(Stack, _extends({
|
|
50
53
|
ref: ref,
|
|
51
54
|
className: classes,
|
|
52
|
-
justify:
|
|
55
|
+
justify: justify,
|
|
53
56
|
align: "flex-start"
|
|
54
57
|
}, rest), /*#__PURE__*/React.createElement(PredefinedRanges, {
|
|
55
58
|
wrap: true,
|
|
File without changes
|
package/esm/List/ListContext.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/esm/MaskedInput/types.js
CHANGED
|
File without changes
|
|
File without changes
|
package/esm/Modal/Modal.d.ts
CHANGED
|
@@ -27,6 +27,11 @@ export interface ModalProps extends BaseModalProps, Pick<React.HTMLAttributes<HT
|
|
|
27
27
|
isDrawer?: boolean;
|
|
28
28
|
/** Custom close button, used when rendered as a Drawer */
|
|
29
29
|
closeButton?: React.ReactNode | boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Remove default padding from the dialog and body so the content can occupy the full height.
|
|
32
|
+
* Useful for creating custom layouts with full-width/height content like split panels or image galleries.
|
|
33
|
+
*/
|
|
34
|
+
bodyFill?: boolean;
|
|
30
35
|
}
|
|
31
36
|
/**
|
|
32
37
|
* The `Modal` component is used to show content in a layer above the app.
|
package/esm/Modal/Modal.js
CHANGED
|
@@ -40,6 +40,7 @@ const Modal = forwardRef((props, ref) => {
|
|
|
40
40
|
'aria-describedby': ariaDescribedby,
|
|
41
41
|
backdropClassName,
|
|
42
42
|
backdrop = true,
|
|
43
|
+
bodyFill,
|
|
43
44
|
className,
|
|
44
45
|
classPrefix = 'modal',
|
|
45
46
|
centered,
|
|
@@ -71,6 +72,7 @@ const Modal = forwardRef((props, ref) => {
|
|
|
71
72
|
const [shake, setShake] = useState(false);
|
|
72
73
|
const classes = merge(className, prefix({
|
|
73
74
|
full,
|
|
75
|
+
fill: bodyFill,
|
|
74
76
|
[size]: modalSizes.includes(size)
|
|
75
77
|
}));
|
|
76
78
|
const dialogRef = useRef(null);
|
package/esm/Modal/utils.js
CHANGED
|
@@ -15,7 +15,6 @@ export const useBodyStyles = (ref, options) => {
|
|
|
15
15
|
const contentElementResizeObserver = useRef(null);
|
|
16
16
|
const updateBodyStyles = useCallback((_event, entering) => {
|
|
17
17
|
const dialog = ref.current;
|
|
18
|
-
const scrollHeight = dialog ? dialog.scrollHeight : 0;
|
|
19
18
|
const styles = {
|
|
20
19
|
overflow: 'auto'
|
|
21
20
|
};
|
|
@@ -28,13 +27,33 @@ export const useBodyStyles = (ref, options) => {
|
|
|
28
27
|
headerHeight = headerDOM ? getHeight(headerDOM) + headerHeight : headerHeight;
|
|
29
28
|
footerHeight = footerDOM ? getHeight(footerDOM) + footerHeight : footerHeight;
|
|
30
29
|
|
|
30
|
+
// Get the actual margin from the modal element itself (.rs-modal)
|
|
31
|
+
const computedStyle = window.getComputedStyle(dialog);
|
|
32
|
+
const marginTop = parseFloat(computedStyle.marginTop) || 0;
|
|
33
|
+
const marginBottom = parseFloat(computedStyle.marginBottom) || 0;
|
|
34
|
+
const dialogMargin = marginTop + marginBottom;
|
|
35
|
+
|
|
36
|
+
// Get padding from the wrapper if needed
|
|
37
|
+
const wrapper = dialog.parentElement;
|
|
38
|
+
let wrapperPadding = 0;
|
|
39
|
+
if (wrapper) {
|
|
40
|
+
const wrapperStyle = window.getComputedStyle(wrapper);
|
|
41
|
+
const paddingTop = parseFloat(wrapperStyle.paddingTop) || 0;
|
|
42
|
+
const paddingBottom = parseFloat(wrapperStyle.paddingBottom) || 0;
|
|
43
|
+
wrapperPadding = paddingTop + paddingBottom;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Add extra space during entering animation (10px buffer)
|
|
47
|
+
const extraSpace = entering ? 10 : 0;
|
|
48
|
+
|
|
31
49
|
/**
|
|
32
|
-
* Header height + Footer height + Dialog margin
|
|
50
|
+
* Header height + Footer height + Dialog margin + Wrapper padding + Extra space
|
|
33
51
|
*/
|
|
34
|
-
const excludeHeight = headerHeight + footerHeight +
|
|
52
|
+
const excludeHeight = headerHeight + footerHeight + dialogMargin + wrapperPadding + extraSpace;
|
|
35
53
|
const bodyHeight = getHeight(window) - excludeHeight;
|
|
36
|
-
|
|
37
|
-
|
|
54
|
+
|
|
55
|
+
// Always set maxHeight to available space, let browser handle content that's smaller
|
|
56
|
+
styles.maxHeight = bodyHeight;
|
|
38
57
|
}
|
|
39
58
|
setBodyStyles(styles);
|
|
40
59
|
}, [prefix, ref]);
|
|
@@ -54,6 +54,7 @@ const MultiCascader = forwardRef((props, ref) => {
|
|
|
54
54
|
renderValue,
|
|
55
55
|
searchable = true,
|
|
56
56
|
style,
|
|
57
|
+
size,
|
|
57
58
|
toggleAs,
|
|
58
59
|
uncheckableItemValues = emptyArray,
|
|
59
60
|
value: valueProp,
|
|
@@ -270,7 +271,8 @@ const MultiCascader = forwardRef((props, ref) => {
|
|
|
270
271
|
childrenKey: childrenKey,
|
|
271
272
|
prefix: prefix,
|
|
272
273
|
cascade: cascade,
|
|
273
|
-
locale: locale
|
|
274
|
+
locale: locale,
|
|
275
|
+
badgeSize: size
|
|
274
276
|
});
|
|
275
277
|
}
|
|
276
278
|
|
|
@@ -319,7 +321,8 @@ const MultiCascader = forwardRef((props, ref) => {
|
|
|
319
321
|
hasValue: hasValue,
|
|
320
322
|
active: active,
|
|
321
323
|
placement: placement,
|
|
322
|
-
inputValue: value
|
|
324
|
+
inputValue: value,
|
|
325
|
+
size: size
|
|
323
326
|
}, rest), selectedElement || (locale === null || locale === void 0 ? void 0 : locale.placeholder)));
|
|
324
327
|
});
|
|
325
328
|
MultiCascader.displayName = 'MultiCascader';
|
package/esm/Sidenav/Node.js
CHANGED
|
File without changes
|
|
@@ -11,7 +11,8 @@ const SelectedElement = props => {
|
|
|
11
11
|
childrenKey = 'children',
|
|
12
12
|
countable,
|
|
13
13
|
cascade,
|
|
14
|
-
locale
|
|
14
|
+
locale,
|
|
15
|
+
badgeSize
|
|
15
16
|
} = props;
|
|
16
17
|
const count = selectedItems.length;
|
|
17
18
|
let title = '';
|
|
@@ -41,7 +42,8 @@ const SelectedElement = props => {
|
|
|
41
42
|
})), countable ? /*#__PURE__*/React.createElement(Badge, {
|
|
42
43
|
className: prefix('value-count'),
|
|
43
44
|
title: `${count}`,
|
|
44
|
-
content: count > 99 ? '99+' : count
|
|
45
|
+
content: count > 99 ? '99+' : count,
|
|
46
|
+
size: badgeSize
|
|
45
47
|
}) : null);
|
|
46
48
|
};
|
|
47
49
|
export default SelectedElement;
|