@rc-component/dialog 1.8.3 → 1.9.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.
|
@@ -40,7 +40,7 @@ const Panel = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
40
40
|
} = React.useContext(RefContext);
|
|
41
41
|
const internalRef = useRef(null);
|
|
42
42
|
const mergedRef = useComposeRef(holderRef, panelRef, internalRef);
|
|
43
|
-
useLockFocus(visible && isFixedPos && focusTrap !== false, () => internalRef.current);
|
|
43
|
+
const [ignoreElement] = useLockFocus(visible && isFixedPos && focusTrap !== false, () => internalRef.current);
|
|
44
44
|
React.useImperativeHandle(ref, () => ({
|
|
45
45
|
focus: () => {
|
|
46
46
|
internalRef.current?.focus({
|
|
@@ -96,8 +96,9 @@ const Panel = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
96
96
|
onClick: onClose,
|
|
97
97
|
"aria-label": "Close"
|
|
98
98
|
}, ariaProps, {
|
|
99
|
-
className: `${prefixCls}-close`,
|
|
100
|
-
disabled: closeBtnIsDisabled
|
|
99
|
+
className: clsx(`${prefixCls}-close`, modalClassNames?.close),
|
|
100
|
+
disabled: closeBtnIsDisabled,
|
|
101
|
+
style: modalStyles?.close
|
|
101
102
|
}), closableObj.closeIcon) : null;
|
|
102
103
|
const content = /*#__PURE__*/React.createElement("div", {
|
|
103
104
|
className: clsx(`${prefixCls}-container`, modalClassNames?.container),
|
|
@@ -122,7 +123,10 @@ const Panel = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
122
123
|
className: clsx(prefixCls, className),
|
|
123
124
|
onMouseDown: onMouseDown,
|
|
124
125
|
onMouseUp: onMouseUp,
|
|
125
|
-
tabIndex: -1
|
|
126
|
+
tabIndex: -1,
|
|
127
|
+
onFocus: e => {
|
|
128
|
+
ignoreElement(e.target);
|
|
129
|
+
}
|
|
126
130
|
}, /*#__PURE__*/React.createElement(MemoChildren, {
|
|
127
131
|
shouldUpdate: visible || forceRender
|
|
128
132
|
}, modalRender ? modalRender(content) : content));
|
package/es/IDialogPropTypes.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GetContainer } from '@rc-component/util/lib/PortalWrapper';
|
|
2
2
|
import type { CSSProperties, ReactNode, SyntheticEvent } from 'react';
|
|
3
|
-
export type SemanticName = 'header' | 'body' | 'footer' | 'container' | 'title' | 'wrapper' | 'mask';
|
|
3
|
+
export type SemanticName = 'header' | 'body' | 'footer' | 'container' | 'title' | 'wrapper' | 'mask' | 'close';
|
|
4
4
|
export type ModalClassNames = Partial<Record<SemanticName, string>>;
|
|
5
5
|
export type ModalStyles = Partial<Record<SemanticName, CSSProperties>>;
|
|
6
6
|
export type ClosableType = {
|
|
@@ -49,7 +49,7 @@ const Panel = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
49
49
|
} = _react.default.useContext(_context.RefContext);
|
|
50
50
|
const internalRef = (0, _react.useRef)(null);
|
|
51
51
|
const mergedRef = (0, _ref.useComposeRef)(holderRef, panelRef, internalRef);
|
|
52
|
-
(0, _focus.useLockFocus)(visible && isFixedPos && focusTrap !== false, () => internalRef.current);
|
|
52
|
+
const [ignoreElement] = (0, _focus.useLockFocus)(visible && isFixedPos && focusTrap !== false, () => internalRef.current);
|
|
53
53
|
_react.default.useImperativeHandle(ref, () => ({
|
|
54
54
|
focus: () => {
|
|
55
55
|
internalRef.current?.focus({
|
|
@@ -105,8 +105,9 @@ const Panel = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
105
105
|
onClick: onClose,
|
|
106
106
|
"aria-label": "Close"
|
|
107
107
|
}, ariaProps, {
|
|
108
|
-
className: `${prefixCls}-close`,
|
|
109
|
-
disabled: closeBtnIsDisabled
|
|
108
|
+
className: (0, _clsx.clsx)(`${prefixCls}-close`, modalClassNames?.close),
|
|
109
|
+
disabled: closeBtnIsDisabled,
|
|
110
|
+
style: modalStyles?.close
|
|
110
111
|
}), closableObj.closeIcon) : null;
|
|
111
112
|
const content = /*#__PURE__*/_react.default.createElement("div", {
|
|
112
113
|
className: (0, _clsx.clsx)(`${prefixCls}-container`, modalClassNames?.container),
|
|
@@ -131,7 +132,10 @@ const Panel = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
131
132
|
className: (0, _clsx.clsx)(prefixCls, className),
|
|
132
133
|
onMouseDown: onMouseDown,
|
|
133
134
|
onMouseUp: onMouseUp,
|
|
134
|
-
tabIndex: -1
|
|
135
|
+
tabIndex: -1,
|
|
136
|
+
onFocus: e => {
|
|
137
|
+
ignoreElement(e.target);
|
|
138
|
+
}
|
|
135
139
|
}, /*#__PURE__*/_react.default.createElement(_MemoChildren.default, {
|
|
136
140
|
shouldUpdate: visible || forceRender
|
|
137
141
|
}, modalRender ? modalRender(content) : content));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GetContainer } from '@rc-component/util/lib/PortalWrapper';
|
|
2
2
|
import type { CSSProperties, ReactNode, SyntheticEvent } from 'react';
|
|
3
|
-
export type SemanticName = 'header' | 'body' | 'footer' | 'container' | 'title' | 'wrapper' | 'mask';
|
|
3
|
+
export type SemanticName = 'header' | 'body' | 'footer' | 'container' | 'title' | 'wrapper' | 'mask' | 'close';
|
|
4
4
|
export type ModalClassNames = Partial<Record<SemanticName, string>>;
|
|
5
5
|
export type ModalStyles = Partial<Record<SemanticName, CSSProperties>>;
|
|
6
6
|
export type ClosableType = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rc-component/dialog",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "dialog ui component for react",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@rc-component/motion": "^1.1.3",
|
|
53
53
|
"@rc-component/portal": "^2.1.0",
|
|
54
|
-
"@rc-component/util": "^1.
|
|
54
|
+
"@rc-component/util": "^1.9.0",
|
|
55
55
|
"clsx": "^2.1.1"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
@@ -87,4 +87,4 @@
|
|
|
87
87
|
"react": ">=18.0.0",
|
|
88
88
|
"react-dom": ">=18.0.0"
|
|
89
89
|
}
|
|
90
|
-
}
|
|
90
|
+
}
|