"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FocusOn = void 0; var tslib_1 = require("tslib"); var React = require("react"); var UI_1 = require("react-remove-scroll/UI"); var UI_2 = require("react-focus-lock/UI"); var medium_1 = require("./medium"); var PREVENT_SCROLL = { preventScroll: true }; exports.FocusOn = React.forwardRef(function (props, parentRef) { var _a = React.useState(false), lockProps = _a[0], setLockProps = _a[1]; var children = props.children, autoFocus = props.autoFocus, shards = props.shards, crossFrame = props.crossFrame, _b = props.enabled, enabled = _b === void 0 ? true : _b, _c = props.scrollLock, scrollLock = _c === void 0 ? true : _c, _d = props.focusLock, focusLock = _d === void 0 ? true : _d, _e = props.returnFocus, returnFocus = _e === void 0 ? true : _e, inert = props.inert, allowPinchZoom = props.allowPinchZoom, sideCar = props.sideCar, className = props.className, shouldIgnore = props.shouldIgnore, preventScrollOnFocus = props.preventScrollOnFocus, style = props.style, as = props.as, gapMode = props.gapMode, rest = tslib_1.__rest(props, ["children", "autoFocus", "shards", "crossFrame", "enabled", "scrollLock", "focusLock", "returnFocus", "inert", "allowPinchZoom", "sideCar", "className", "shouldIgnore", "preventScrollOnFocus", "style", "as", "gapMode"]); var SideCar = sideCar; var onActivation = lockProps.onActivation, onDeactivation = lockProps.onDeactivation, restProps = tslib_1.__rest(lockProps, ["onActivation", "onDeactivation"]); var appliedLockProps = tslib_1.__assign(tslib_1.__assign({}, restProps), { as: as, style: style, sideCar: sideCar, shards: shards, allowPinchZoom: allowPinchZoom, gapMode: gapMode, inert: inert, enabled: enabled && scrollLock }); return (React.createElement(React.Fragment, null, React.createElement(UI_2.default, { ref: parentRef, sideCar: sideCar, disabled: !(lockProps && enabled && focusLock), returnFocus: returnFocus, autoFocus: autoFocus, shards: shards, crossFrame: crossFrame, onActivation: onActivation, onDeactivation: onDeactivation, className: className, whiteList: shouldIgnore, lockProps: appliedLockProps, focusOptions: preventScrollOnFocus ? PREVENT_SCROLL : undefined, as: UI_1.RemoveScroll }, children), enabled && (React.createElement(SideCar, tslib_1.__assign({}, rest, { sideCar: medium_1.effectCar, setLockProps: setLockProps, shards: shards }))))); }); tslib_1.__exportStar(require("./reExports"), exports);