@rc-component/dialog 1.7.0 → 1.8.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.
@@ -30,7 +30,8 @@ const Panel = /*#__PURE__*/React.forwardRef((props, ref) => {
30
30
  height,
31
31
  classNames: modalClassNames,
32
32
  styles: modalStyles,
33
- isFixedPos
33
+ isFixedPos,
34
+ focusTrap
34
35
  } = props;
35
36
 
36
37
  // ================================= Refs =================================
@@ -39,7 +40,7 @@ const Panel = /*#__PURE__*/React.forwardRef((props, ref) => {
39
40
  } = React.useContext(RefContext);
40
41
  const internalRef = useRef(null);
41
42
  const mergedRef = useComposeRef(holderRef, panelRef, internalRef);
42
- useLockFocus(visible && isFixedPos, () => internalRef.current);
43
+ useLockFocus(visible && isFixedPos && focusTrap !== false, () => internalRef.current);
43
44
  React.useImperativeHandle(ref, () => ({
44
45
  focus: () => {
45
46
  internalRef.current?.focus({
@@ -51,5 +51,6 @@ export type IDialogPropTypes = {
51
51
  modalRender?: (node: ReactNode) => ReactNode;
52
52
  forceRender?: boolean;
53
53
  focusTriggerAfterClose?: boolean;
54
+ focusTrap?: boolean;
54
55
  panelRef?: React.Ref<HTMLDivElement>;
55
56
  };
@@ -39,7 +39,8 @@ const Panel = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
39
39
  height,
40
40
  classNames: modalClassNames,
41
41
  styles: modalStyles,
42
- isFixedPos
42
+ isFixedPos,
43
+ focusTrap
43
44
  } = props;
44
45
 
45
46
  // ================================= Refs =================================
@@ -48,7 +49,7 @@ const Panel = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
48
49
  } = _react.default.useContext(_context.RefContext);
49
50
  const internalRef = (0, _react.useRef)(null);
50
51
  const mergedRef = (0, _ref.useComposeRef)(holderRef, panelRef, internalRef);
51
- (0, _focus.useLockFocus)(visible && isFixedPos, () => internalRef.current);
52
+ (0, _focus.useLockFocus)(visible && isFixedPos && focusTrap !== false, () => internalRef.current);
52
53
  _react.default.useImperativeHandle(ref, () => ({
53
54
  focus: () => {
54
55
  internalRef.current?.focus({
@@ -51,5 +51,6 @@ export type IDialogPropTypes = {
51
51
  modalRender?: (node: ReactNode) => ReactNode;
52
52
  forceRender?: boolean;
53
53
  focusTriggerAfterClose?: boolean;
54
+ focusTrap?: boolean;
54
55
  panelRef?: React.Ref<HTMLDivElement>;
55
56
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rc-component/dialog",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "dialog ui component for react",
5
5
  "keywords": [
6
6
  "react",