rc-dialog
Advanced tools
| import React from 'react'; | ||
| import type { IDialogChildProps } from '..'; | ||
| export interface PanelProps extends Omit<IDialogChildProps, 'getOpenCount'> { | ||
| prefixCls: string; | ||
| ariaId?: string; | ||
| onMouseDown?: React.MouseEventHandler; | ||
| onMouseUp?: React.MouseEventHandler; | ||
| holderRef?: React.Ref<HTMLDivElement>; | ||
| } | ||
| export declare type ContentRef = { | ||
| focus: () => void; | ||
| changeActive: (next: boolean) => void; | ||
| }; | ||
| declare const Panel: React.ForwardRefExoticComponent<PanelProps & React.RefAttributes<ContentRef>>; | ||
| export default Panel; |
| import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
| import _extends from "@babel/runtime/helpers/esm/extends"; | ||
| import React, { useRef } from 'react'; | ||
| import classNames from 'classnames'; | ||
| import MemoChildren from './MemoChildren'; | ||
| var sentinelStyle = { | ||
| width: 0, | ||
| height: 0, | ||
| overflow: 'hidden', | ||
| outline: 'none' | ||
| }; | ||
| var Panel = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
| var prefixCls = props.prefixCls, | ||
| className = props.className, | ||
| style = props.style, | ||
| title = props.title, | ||
| ariaId = props.ariaId, | ||
| footer = props.footer, | ||
| closable = props.closable, | ||
| closeIcon = props.closeIcon, | ||
| onClose = props.onClose, | ||
| children = props.children, | ||
| bodyStyle = props.bodyStyle, | ||
| bodyProps = props.bodyProps, | ||
| modalRender = props.modalRender, | ||
| onMouseDown = props.onMouseDown, | ||
| onMouseUp = props.onMouseUp, | ||
| holderRef = props.holderRef, | ||
| visible = props.visible, | ||
| forceRender = props.forceRender, | ||
| width = props.width, | ||
| height = props.height; // ================================= Refs ================================= | ||
| var sentinelStartRef = useRef(); | ||
| var sentinelEndRef = useRef(); | ||
| React.useImperativeHandle(ref, function () { | ||
| return { | ||
| focus: function focus() { | ||
| var _sentinelStartRef$cur; | ||
| (_sentinelStartRef$cur = sentinelStartRef.current) === null || _sentinelStartRef$cur === void 0 ? void 0 : _sentinelStartRef$cur.focus(); | ||
| }, | ||
| changeActive: function changeActive(next) { | ||
| var _document = document, | ||
| activeElement = _document.activeElement; | ||
| if (next && activeElement === sentinelEndRef.current) { | ||
| sentinelStartRef.current.focus(); | ||
| } else if (!next && activeElement === sentinelStartRef.current) { | ||
| sentinelEndRef.current.focus(); | ||
| } | ||
| } | ||
| }; | ||
| }); // ================================ Style ================================= | ||
| var contentStyle = {}; | ||
| if (width !== undefined) { | ||
| contentStyle.width = width; | ||
| } | ||
| if (height !== undefined) { | ||
| contentStyle.height = height; | ||
| } // ================================ Render ================================ | ||
| var footerNode; | ||
| if (footer) { | ||
| footerNode = /*#__PURE__*/React.createElement("div", { | ||
| className: "".concat(prefixCls, "-footer") | ||
| }, footer); | ||
| } | ||
| var headerNode; | ||
| if (title) { | ||
| headerNode = /*#__PURE__*/React.createElement("div", { | ||
| className: "".concat(prefixCls, "-header") | ||
| }, /*#__PURE__*/React.createElement("div", { | ||
| className: "".concat(prefixCls, "-title"), | ||
| id: ariaId | ||
| }, title)); | ||
| } | ||
| var closer; | ||
| if (closable) { | ||
| closer = /*#__PURE__*/React.createElement("button", { | ||
| type: "button", | ||
| onClick: onClose, | ||
| "aria-label": "Close", | ||
| className: "".concat(prefixCls, "-close") | ||
| }, closeIcon || /*#__PURE__*/React.createElement("span", { | ||
| className: "".concat(prefixCls, "-close-x") | ||
| })); | ||
| } | ||
| var content = /*#__PURE__*/React.createElement("div", { | ||
| className: "".concat(prefixCls, "-content") | ||
| }, closer, headerNode, /*#__PURE__*/React.createElement("div", _extends({ | ||
| className: "".concat(prefixCls, "-body"), | ||
| style: bodyStyle | ||
| }, bodyProps), children), footerNode); | ||
| return /*#__PURE__*/React.createElement("div", { | ||
| key: "dialog-element", | ||
| role: "dialog", | ||
| "aria-labelledby": title ? ariaId : null, | ||
| "aria-modal": "true", | ||
| ref: holderRef, | ||
| style: _objectSpread(_objectSpread({}, style), contentStyle), | ||
| className: classNames(prefixCls, className), | ||
| onMouseDown: onMouseDown, | ||
| onMouseUp: onMouseUp | ||
| }, /*#__PURE__*/React.createElement("div", { | ||
| tabIndex: 0, | ||
| ref: sentinelStartRef, | ||
| style: sentinelStyle, | ||
| "aria-hidden": "true" | ||
| }), /*#__PURE__*/React.createElement(MemoChildren, { | ||
| shouldUpdate: visible || forceRender | ||
| }, modalRender ? modalRender(content) : content), /*#__PURE__*/React.createElement("div", { | ||
| tabIndex: 0, | ||
| ref: sentinelEndRef, | ||
| style: sentinelStyle, | ||
| "aria-hidden": "true" | ||
| })); | ||
| }); | ||
| if (process.env.NODE_ENV !== 'production') { | ||
| Panel.displayName = 'Panel'; | ||
| } | ||
| export default Panel; |
| import React from 'react'; | ||
| import type { IDialogChildProps } from '..'; | ||
| export interface PanelProps extends Omit<IDialogChildProps, 'getOpenCount'> { | ||
| prefixCls: string; | ||
| ariaId?: string; | ||
| onMouseDown?: React.MouseEventHandler; | ||
| onMouseUp?: React.MouseEventHandler; | ||
| holderRef?: React.Ref<HTMLDivElement>; | ||
| } | ||
| export declare type ContentRef = { | ||
| focus: () => void; | ||
| changeActive: (next: boolean) => void; | ||
| }; | ||
| declare const Panel: React.ForwardRefExoticComponent<PanelProps & React.RefAttributes<ContentRef>>; | ||
| export default Panel; |
| "use strict"; | ||
| var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
| var _typeof = require("@babel/runtime/helpers/typeof"); | ||
| Object.defineProperty(exports, "__esModule", { | ||
| value: true | ||
| }); | ||
| exports.default = void 0; | ||
| var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
| var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
| var _react = _interopRequireWildcard(require("react")); | ||
| var _classnames = _interopRequireDefault(require("classnames")); | ||
| var _MemoChildren = _interopRequireDefault(require("./MemoChildren")); | ||
| function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
| function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
| var sentinelStyle = { | ||
| width: 0, | ||
| height: 0, | ||
| overflow: 'hidden', | ||
| outline: 'none' | ||
| }; | ||
| var Panel = /*#__PURE__*/_react.default.forwardRef(function (props, ref) { | ||
| var prefixCls = props.prefixCls, | ||
| className = props.className, | ||
| style = props.style, | ||
| title = props.title, | ||
| ariaId = props.ariaId, | ||
| footer = props.footer, | ||
| closable = props.closable, | ||
| closeIcon = props.closeIcon, | ||
| onClose = props.onClose, | ||
| children = props.children, | ||
| bodyStyle = props.bodyStyle, | ||
| bodyProps = props.bodyProps, | ||
| modalRender = props.modalRender, | ||
| onMouseDown = props.onMouseDown, | ||
| onMouseUp = props.onMouseUp, | ||
| holderRef = props.holderRef, | ||
| visible = props.visible, | ||
| forceRender = props.forceRender, | ||
| width = props.width, | ||
| height = props.height; // ================================= Refs ================================= | ||
| var sentinelStartRef = (0, _react.useRef)(); | ||
| var sentinelEndRef = (0, _react.useRef)(); | ||
| _react.default.useImperativeHandle(ref, function () { | ||
| return { | ||
| focus: function focus() { | ||
| var _sentinelStartRef$cur; | ||
| (_sentinelStartRef$cur = sentinelStartRef.current) === null || _sentinelStartRef$cur === void 0 ? void 0 : _sentinelStartRef$cur.focus(); | ||
| }, | ||
| changeActive: function changeActive(next) { | ||
| var _document = document, | ||
| activeElement = _document.activeElement; | ||
| if (next && activeElement === sentinelEndRef.current) { | ||
| sentinelStartRef.current.focus(); | ||
| } else if (!next && activeElement === sentinelStartRef.current) { | ||
| sentinelEndRef.current.focus(); | ||
| } | ||
| } | ||
| }; | ||
| }); // ================================ Style ================================= | ||
| var contentStyle = {}; | ||
| if (width !== undefined) { | ||
| contentStyle.width = width; | ||
| } | ||
| if (height !== undefined) { | ||
| contentStyle.height = height; | ||
| } // ================================ Render ================================ | ||
| var footerNode; | ||
| if (footer) { | ||
| footerNode = /*#__PURE__*/_react.default.createElement("div", { | ||
| className: "".concat(prefixCls, "-footer") | ||
| }, footer); | ||
| } | ||
| var headerNode; | ||
| if (title) { | ||
| headerNode = /*#__PURE__*/_react.default.createElement("div", { | ||
| className: "".concat(prefixCls, "-header") | ||
| }, /*#__PURE__*/_react.default.createElement("div", { | ||
| className: "".concat(prefixCls, "-title"), | ||
| id: ariaId | ||
| }, title)); | ||
| } | ||
| var closer; | ||
| if (closable) { | ||
| closer = /*#__PURE__*/_react.default.createElement("button", { | ||
| type: "button", | ||
| onClick: onClose, | ||
| "aria-label": "Close", | ||
| className: "".concat(prefixCls, "-close") | ||
| }, closeIcon || /*#__PURE__*/_react.default.createElement("span", { | ||
| className: "".concat(prefixCls, "-close-x") | ||
| })); | ||
| } | ||
| var content = /*#__PURE__*/_react.default.createElement("div", { | ||
| className: "".concat(prefixCls, "-content") | ||
| }, closer, headerNode, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({ | ||
| className: "".concat(prefixCls, "-body"), | ||
| style: bodyStyle | ||
| }, bodyProps), children), footerNode); | ||
| return /*#__PURE__*/_react.default.createElement("div", { | ||
| key: "dialog-element", | ||
| role: "dialog", | ||
| "aria-labelledby": title ? ariaId : null, | ||
| "aria-modal": "true", | ||
| ref: holderRef, | ||
| style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, style), contentStyle), | ||
| className: (0, _classnames.default)(prefixCls, className), | ||
| onMouseDown: onMouseDown, | ||
| onMouseUp: onMouseUp | ||
| }, /*#__PURE__*/_react.default.createElement("div", { | ||
| tabIndex: 0, | ||
| ref: sentinelStartRef, | ||
| style: sentinelStyle, | ||
| "aria-hidden": "true" | ||
| }), /*#__PURE__*/_react.default.createElement(_MemoChildren.default, { | ||
| shouldUpdate: visible || forceRender | ||
| }, modalRender ? modalRender(content) : content), /*#__PURE__*/_react.default.createElement("div", { | ||
| tabIndex: 0, | ||
| ref: sentinelEndRef, | ||
| style: sentinelStyle, | ||
| "aria-hidden": "true" | ||
| })); | ||
| }); | ||
| if (process.env.NODE_ENV !== 'production') { | ||
| Panel.displayName = 'Panel'; | ||
| } | ||
| var _default = Panel; | ||
| exports.default = _default; |
| import * as React from 'react'; | ||
| import type { IDialogChildProps } from '..'; | ||
| import type { PanelProps, ContentRef } from './Panel'; | ||
| export declare type ContentProps = { | ||
@@ -7,9 +7,3 @@ motionName: string; | ||
| onVisibleChanged: (visible: boolean) => void; | ||
| onMouseDown: React.MouseEventHandler; | ||
| onMouseUp: React.MouseEventHandler; | ||
| } & IDialogChildProps; | ||
| export declare type ContentRef = { | ||
| focus: () => void; | ||
| changeActive: (next: boolean) => void; | ||
| }; | ||
| } & PanelProps; | ||
| declare const Content: React.ForwardRefExoticComponent<{ | ||
@@ -19,8 +13,3 @@ motionName: string; | ||
| onVisibleChanged: (visible: boolean) => void; | ||
| onMouseDown: React.MouseEventHandler; | ||
| onMouseUp: React.MouseEventHandler; | ||
| } & { | ||
| getOpenCount: () => number; | ||
| scrollLocker?: import("rc-util/lib/Dom/scrollLocker").default; | ||
| } & import("../..").DialogProps & React.RefAttributes<ContentRef>>; | ||
| } & PanelProps & React.RefAttributes<ContentRef>>; | ||
| export default Content; |
+11
-111
@@ -0,3 +1,3 @@ | ||
| import _extends from "@babel/runtime/helpers/esm/extends"; | ||
| import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
| import _extends from "@babel/runtime/helpers/esm/extends"; | ||
| import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
@@ -9,17 +9,6 @@ import * as React from 'react'; | ||
| import { offset } from '../../util'; | ||
| import MemoChildren from './MemoChildren'; | ||
| var sentinelStyle = { | ||
| width: 0, | ||
| height: 0, | ||
| overflow: 'hidden', | ||
| outline: 'none' | ||
| }; | ||
| import Panel from './Panel'; | ||
| var Content = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
| var closable = props.closable, | ||
| prefixCls = props.prefixCls, | ||
| width = props.width, | ||
| height = props.height, | ||
| footer = props.footer, | ||
| var prefixCls = props.prefixCls, | ||
| title = props.title, | ||
| closeIcon = props.closeIcon, | ||
| style = props.style, | ||
@@ -29,38 +18,9 @@ className = props.className, | ||
| forceRender = props.forceRender, | ||
| bodyStyle = props.bodyStyle, | ||
| bodyProps = props.bodyProps, | ||
| children = props.children, | ||
| destroyOnClose = props.destroyOnClose, | ||
| modalRender = props.modalRender, | ||
| motionName = props.motionName, | ||
| ariaId = props.ariaId, | ||
| onClose = props.onClose, | ||
| onVisibleChanged = props.onVisibleChanged, | ||
| onMouseDown = props.onMouseDown, | ||
| onMouseUp = props.onMouseUp, | ||
| mousePosition = props.mousePosition; | ||
| var sentinelStartRef = useRef(); | ||
| var sentinelEndRef = useRef(); | ||
| var dialogRef = useRef(); // ============================== Ref =============================== | ||
| var dialogRef = useRef(); // ============================= Style ============================== | ||
| React.useImperativeHandle(ref, function () { | ||
| return { | ||
| focus: function focus() { | ||
| var _sentinelStartRef$cur; | ||
| (_sentinelStartRef$cur = sentinelStartRef.current) === null || _sentinelStartRef$cur === void 0 ? void 0 : _sentinelStartRef$cur.focus(); | ||
| }, | ||
| changeActive: function changeActive(next) { | ||
| var _document = document, | ||
| activeElement = _document.activeElement; | ||
| if (next && activeElement === sentinelEndRef.current) { | ||
| sentinelStartRef.current.focus(); | ||
| } else if (!next && activeElement === sentinelStartRef.current) { | ||
| sentinelEndRef.current.focus(); | ||
| } | ||
| } | ||
| }; | ||
| }); // ============================= Style ============================== | ||
| var _React$useState = React.useState(), | ||
@@ -73,10 +33,2 @@ _React$useState2 = _slicedToArray(_React$useState, 2), | ||
| if (width !== undefined) { | ||
| contentStyle.width = width; | ||
| } | ||
| if (height !== undefined) { | ||
| contentStyle.height = height; | ||
| } | ||
| if (transformOrigin) { | ||
@@ -92,40 +44,2 @@ contentStyle.transformOrigin = transformOrigin; | ||
| var footerNode; | ||
| if (footer) { | ||
| footerNode = /*#__PURE__*/React.createElement("div", { | ||
| className: "".concat(prefixCls, "-footer") | ||
| }, footer); | ||
| } | ||
| var headerNode; | ||
| if (title) { | ||
| headerNode = /*#__PURE__*/React.createElement("div", { | ||
| className: "".concat(prefixCls, "-header") | ||
| }, /*#__PURE__*/React.createElement("div", { | ||
| className: "".concat(prefixCls, "-title"), | ||
| id: ariaId | ||
| }, title)); | ||
| } | ||
| var closer; | ||
| if (closable) { | ||
| closer = /*#__PURE__*/React.createElement("button", { | ||
| type: "button", | ||
| onClick: onClose, | ||
| "aria-label": "Close", | ||
| className: "".concat(prefixCls, "-close") | ||
| }, closeIcon || /*#__PURE__*/React.createElement("span", { | ||
| className: "".concat(prefixCls, "-close-x") | ||
| })); | ||
| } | ||
| var content = /*#__PURE__*/React.createElement("div", { | ||
| className: "".concat(prefixCls, "-content") | ||
| }, closer, headerNode, /*#__PURE__*/React.createElement("div", _extends({ | ||
| className: "".concat(prefixCls, "-body"), | ||
| style: bodyStyle | ||
| }, bodyProps), children), footerNode); | ||
| return /*#__PURE__*/React.createElement(CSSMotion, { | ||
@@ -143,24 +57,10 @@ visible: visible, | ||
| motionStyle = _ref.style; | ||
| return /*#__PURE__*/React.createElement("div", { | ||
| key: "dialog-element", | ||
| role: "dialog", | ||
| "aria-labelledby": title ? ariaId : null, | ||
| "aria-modal": "true", | ||
| ref: motionRef, | ||
| return /*#__PURE__*/React.createElement(Panel, _extends({}, props, { | ||
| ref: ref, | ||
| title: title, | ||
| ariaId: ariaId, | ||
| prefixCls: prefixCls, | ||
| holderRef: motionRef, | ||
| style: _objectSpread(_objectSpread(_objectSpread({}, motionStyle), style), contentStyle), | ||
| className: classNames(prefixCls, className, motionClassName), | ||
| onMouseDown: onMouseDown, | ||
| onMouseUp: onMouseUp | ||
| }, /*#__PURE__*/React.createElement("div", { | ||
| tabIndex: 0, | ||
| ref: sentinelStartRef, | ||
| style: sentinelStyle, | ||
| "aria-hidden": "true" | ||
| }), /*#__PURE__*/React.createElement(MemoChildren, { | ||
| shouldUpdate: visible || forceRender | ||
| }, modalRender ? modalRender(content) : content), /*#__PURE__*/React.createElement("div", { | ||
| tabIndex: 0, | ||
| ref: sentinelEndRef, | ||
| style: sentinelStyle, | ||
| "aria-hidden": "true" | ||
| className: classNames(className, motionClassName) | ||
| })); | ||
@@ -167,0 +67,0 @@ }); |
+4
-2
| import DialogWrap from './DialogWrap'; | ||
| import { IDialogPropTypes as DialogProps } from './IDialogPropTypes'; | ||
| export { DialogProps }; | ||
| import Panel from './Dialog/Content/Panel'; | ||
| import type { IDialogPropTypes as DialogProps } from './IDialogPropTypes'; | ||
| export type { DialogProps }; | ||
| export { Panel }; | ||
| export default DialogWrap; |
+2
-0
| import DialogWrap from './DialogWrap'; | ||
| import Panel from './Dialog/Content/Panel'; | ||
| export { Panel }; | ||
| export default DialogWrap; |
| import * as React from 'react'; | ||
| import type { IDialogChildProps } from '..'; | ||
| import type { PanelProps, ContentRef } from './Panel'; | ||
| export declare type ContentProps = { | ||
@@ -7,9 +7,3 @@ motionName: string; | ||
| onVisibleChanged: (visible: boolean) => void; | ||
| onMouseDown: React.MouseEventHandler; | ||
| onMouseUp: React.MouseEventHandler; | ||
| } & IDialogChildProps; | ||
| export declare type ContentRef = { | ||
| focus: () => void; | ||
| changeActive: (next: boolean) => void; | ||
| }; | ||
| } & PanelProps; | ||
| declare const Content: React.ForwardRefExoticComponent<{ | ||
@@ -19,8 +13,3 @@ motionName: string; | ||
| onVisibleChanged: (visible: boolean) => void; | ||
| onMouseDown: React.MouseEventHandler; | ||
| onMouseUp: React.MouseEventHandler; | ||
| } & { | ||
| getOpenCount: () => number; | ||
| scrollLocker?: import("rc-util/lib/Dom/scrollLocker").default; | ||
| } & import("../..").DialogProps & React.RefAttributes<ContentRef>>; | ||
| } & PanelProps & React.RefAttributes<ContentRef>>; | ||
| export default Content; |
+12
-112
@@ -12,6 +12,6 @@ "use strict"; | ||
| var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
| var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
| var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
| var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); | ||
@@ -27,3 +27,3 @@ | ||
| var _MemoChildren = _interopRequireDefault(require("./MemoChildren")); | ||
| var _Panel = _interopRequireDefault(require("./Panel")); | ||
@@ -34,16 +34,5 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
| var sentinelStyle = { | ||
| width: 0, | ||
| height: 0, | ||
| overflow: 'hidden', | ||
| outline: 'none' | ||
| }; | ||
| var Content = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
| var closable = props.closable, | ||
| prefixCls = props.prefixCls, | ||
| width = props.width, | ||
| height = props.height, | ||
| footer = props.footer, | ||
| var prefixCls = props.prefixCls, | ||
| title = props.title, | ||
| closeIcon = props.closeIcon, | ||
| style = props.style, | ||
@@ -53,38 +42,9 @@ className = props.className, | ||
| forceRender = props.forceRender, | ||
| bodyStyle = props.bodyStyle, | ||
| bodyProps = props.bodyProps, | ||
| children = props.children, | ||
| destroyOnClose = props.destroyOnClose, | ||
| modalRender = props.modalRender, | ||
| motionName = props.motionName, | ||
| ariaId = props.ariaId, | ||
| onClose = props.onClose, | ||
| onVisibleChanged = props.onVisibleChanged, | ||
| onMouseDown = props.onMouseDown, | ||
| onMouseUp = props.onMouseUp, | ||
| mousePosition = props.mousePosition; | ||
| var sentinelStartRef = (0, React.useRef)(); | ||
| var sentinelEndRef = (0, React.useRef)(); | ||
| var dialogRef = (0, React.useRef)(); // ============================== Ref =============================== | ||
| var dialogRef = (0, React.useRef)(); // ============================= Style ============================== | ||
| React.useImperativeHandle(ref, function () { | ||
| return { | ||
| focus: function focus() { | ||
| var _sentinelStartRef$cur; | ||
| (_sentinelStartRef$cur = sentinelStartRef.current) === null || _sentinelStartRef$cur === void 0 ? void 0 : _sentinelStartRef$cur.focus(); | ||
| }, | ||
| changeActive: function changeActive(next) { | ||
| var _document = document, | ||
| activeElement = _document.activeElement; | ||
| if (next && activeElement === sentinelEndRef.current) { | ||
| sentinelStartRef.current.focus(); | ||
| } else if (!next && activeElement === sentinelStartRef.current) { | ||
| sentinelEndRef.current.focus(); | ||
| } | ||
| } | ||
| }; | ||
| }); // ============================= Style ============================== | ||
| var _React$useState = React.useState(), | ||
@@ -97,10 +57,2 @@ _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), | ||
| if (width !== undefined) { | ||
| contentStyle.width = width; | ||
| } | ||
| if (height !== undefined) { | ||
| contentStyle.height = height; | ||
| } | ||
| if (transformOrigin) { | ||
@@ -116,40 +68,2 @@ contentStyle.transformOrigin = transformOrigin; | ||
| var footerNode; | ||
| if (footer) { | ||
| footerNode = /*#__PURE__*/React.createElement("div", { | ||
| className: "".concat(prefixCls, "-footer") | ||
| }, footer); | ||
| } | ||
| var headerNode; | ||
| if (title) { | ||
| headerNode = /*#__PURE__*/React.createElement("div", { | ||
| className: "".concat(prefixCls, "-header") | ||
| }, /*#__PURE__*/React.createElement("div", { | ||
| className: "".concat(prefixCls, "-title"), | ||
| id: ariaId | ||
| }, title)); | ||
| } | ||
| var closer; | ||
| if (closable) { | ||
| closer = /*#__PURE__*/React.createElement("button", { | ||
| type: "button", | ||
| onClick: onClose, | ||
| "aria-label": "Close", | ||
| className: "".concat(prefixCls, "-close") | ||
| }, closeIcon || /*#__PURE__*/React.createElement("span", { | ||
| className: "".concat(prefixCls, "-close-x") | ||
| })); | ||
| } | ||
| var content = /*#__PURE__*/React.createElement("div", { | ||
| className: "".concat(prefixCls, "-content") | ||
| }, closer, headerNode, /*#__PURE__*/React.createElement("div", (0, _extends2.default)({ | ||
| className: "".concat(prefixCls, "-body"), | ||
| style: bodyStyle | ||
| }, bodyProps), children), footerNode); | ||
| return /*#__PURE__*/React.createElement(_rcMotion.default, { | ||
@@ -167,24 +81,10 @@ visible: visible, | ||
| motionStyle = _ref.style; | ||
| return /*#__PURE__*/React.createElement("div", { | ||
| key: "dialog-element", | ||
| role: "dialog", | ||
| "aria-labelledby": title ? ariaId : null, | ||
| "aria-modal": "true", | ||
| ref: motionRef, | ||
| return /*#__PURE__*/React.createElement(_Panel.default, (0, _extends2.default)({}, props, { | ||
| ref: ref, | ||
| title: title, | ||
| ariaId: ariaId, | ||
| prefixCls: prefixCls, | ||
| holderRef: motionRef, | ||
| style: (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, motionStyle), style), contentStyle), | ||
| className: (0, _classnames.default)(prefixCls, className, motionClassName), | ||
| onMouseDown: onMouseDown, | ||
| onMouseUp: onMouseUp | ||
| }, /*#__PURE__*/React.createElement("div", { | ||
| tabIndex: 0, | ||
| ref: sentinelStartRef, | ||
| style: sentinelStyle, | ||
| "aria-hidden": "true" | ||
| }), /*#__PURE__*/React.createElement(_MemoChildren.default, { | ||
| shouldUpdate: visible || forceRender | ||
| }, modalRender ? modalRender(content) : content), /*#__PURE__*/React.createElement("div", { | ||
| tabIndex: 0, | ||
| ref: sentinelEndRef, | ||
| style: sentinelStyle, | ||
| "aria-hidden": "true" | ||
| className: (0, _classnames.default)(className, motionClassName) | ||
| })); | ||
@@ -191,0 +91,0 @@ }); |
+4
-2
| import DialogWrap from './DialogWrap'; | ||
| import { IDialogPropTypes as DialogProps } from './IDialogPropTypes'; | ||
| export { DialogProps }; | ||
| import Panel from './Dialog/Content/Panel'; | ||
| import type { IDialogPropTypes as DialogProps } from './IDialogPropTypes'; | ||
| export type { DialogProps }; | ||
| export { Panel }; | ||
| export default DialogWrap; |
+8
-0
@@ -8,2 +8,8 @@ "use strict"; | ||
| }); | ||
| Object.defineProperty(exports, "Panel", { | ||
| enumerable: true, | ||
| get: function get() { | ||
| return _Panel.default; | ||
| } | ||
| }); | ||
| exports.default = void 0; | ||
@@ -13,3 +19,5 @@ | ||
| var _Panel = _interopRequireDefault(require("./Dialog/Content/Panel")); | ||
| var _default = _DialogWrap.default; | ||
| exports.default = _default; |
+1
-1
| { | ||
| "name": "rc-dialog", | ||
| "version": "8.8.2", | ||
| "version": "8.9.0", | ||
| "description": "dialog ui component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
75312
6.62%42
10.53%1577
6.05%4
100%