Skip to content

Commit

Permalink
use default imports for commonjs sources
Browse files Browse the repository at this point in the history
  • Loading branch information
theKashey committed Apr 20, 2024
1 parent 832f34c commit 8c41445
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
33 changes: 33 additions & 0 deletions src/Lock.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import * as constants from 'focus-lock/constants';
import { useMergeRefs } from 'use-callback-ref';

Expand Down Expand Up @@ -191,4 +192,36 @@ const FocusLock = React.forwardRef(function FocusLockUI(props, parentRef) {
);
});


const {
node, bool, string, any, arrayOf, oneOfType, object, func,
} = PropTypes;
FocusLock.propTypes = {
children: node,
disabled: bool,
returnFocus: oneOfType([bool, object, func]),
focusOptions: object,
noFocusGuards: bool,
hasPositiveIndices: bool,

allowTextSelection: bool,
autoFocus: bool,
persistentFocus: bool,
crossFrame: bool,

group: string,
className: string,

whiteList: func,
shards: arrayOf(any),

as: oneOfType([string, func, object]),
lockProps: object,

onActivation: func,
onDeactivation: func,

sideCar: any.isRequired,
};

export default FocusLock;
11 changes: 7 additions & 4 deletions src/Trap.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import withSideEffect from 'react-clientside-effect';
import {
import focusLockPkg from 'focus-lock';
import { deferAction, extractRef } from './util.js';
import { mediumFocus, mediumBlur, mediumEffect } from './medium.js';


const {
moveFocusInside, focusInside,
focusIsHidden, expandFocusableNodes,
focusNextElement,
focusPrevElement,
focusFirstElement,
focusLastElement,
captureFocusRestore,
} from 'focus-lock';
import { deferAction, extractRef } from './util.js';
import { mediumFocus, mediumBlur, mediumEffect } from './medium.js';
} = focusLockPkg;

const focusOnBody = () => (
document && document.activeElement === document.body
Expand Down

0 comments on commit 8c41445

Please sign in to comment.