Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-focus-lock

Package Overview
Dependencies
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-focus-lock - npm Package Compare versions

Comparing version 1.17.4 to 1.17.5

128

dist/es2015/Lock.js
import _extends from "@babel/runtime/helpers/extends";
import _objectSpread from "@babel/runtime/helpers/objectSpread";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/inherits";
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";

@@ -37,11 +32,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";

function (_Component) {
_inherits(FocusLock, _Component);
_inheritsLoose(FocusLock, _Component);
function FocusLock() {
var _getPrototypeOf2;
var _this;
_classCallCheck(this, FocusLock);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {

@@ -51,3 +42,3 @@ args[_key] = arguments[_key];

_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(FocusLock)).call.apply(_getPrototypeOf2, [this].concat(args)));
_this = _Component.call.apply(_Component, [this].concat(args)) || this;

@@ -97,64 +88,63 @@ _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", {

_createClass(FocusLock, [{
key: "render",
value: function render() {
var _objectSpread2;
var _proto = FocusLock.prototype;
var _this$props = this.props,
children = _this$props.children,
disabled = _this$props.disabled,
noFocusGuards = _this$props.noFocusGuards,
persistentFocus = _this$props.persistentFocus,
autoFocus = _this$props.autoFocus,
allowTextSelection = _this$props.allowTextSelection,
group = _this$props.group,
className = _this$props.className,
whiteList = _this$props.whiteList,
_this$props$as = _this$props.as,
Container = _this$props$as === void 0 ? 'div' : _this$props$as,
_this$props$lockProps = _this$props.lockProps,
containerProps = _this$props$lockProps === void 0 ? {} : _this$props$lockProps;
var observed = this.state.observed;
_proto.render = function render() {
var _extends2;
if (process.env.NODE_ENV !== 'production') {
if (typeof allowTextSelection !== 'undefined') {
// eslint-disable-next-line no-console
console.warn('React-Focus-Lock: allowTextSelection is deprecated and enabled by default');
}
var _this$props = this.props,
children = _this$props.children,
disabled = _this$props.disabled,
noFocusGuards = _this$props.noFocusGuards,
persistentFocus = _this$props.persistentFocus,
autoFocus = _this$props.autoFocus,
allowTextSelection = _this$props.allowTextSelection,
group = _this$props.group,
className = _this$props.className,
whiteList = _this$props.whiteList,
_this$props$as = _this$props.as,
Container = _this$props$as === void 0 ? 'div' : _this$props$as,
_this$props$lockProps = _this$props.lockProps,
containerProps = _this$props$lockProps === void 0 ? {} : _this$props$lockProps;
var observed = this.state.observed;
if (process.env.NODE_ENV !== 'production') {
if (typeof allowTextSelection !== 'undefined') {
// eslint-disable-next-line no-console
console.warn('React-Focus-Lock: allowTextSelection is deprecated and enabled by default');
}
}
var lockProps = _objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, constants.FOCUS_DISABLED, disabled && 'disabled'), _defineProperty(_objectSpread2, constants.FOCUS_GROUP, group), _objectSpread2), containerProps);
var lockProps = _extends((_extends2 = {}, _extends2[constants.FOCUS_DISABLED] = disabled && 'disabled', _extends2[constants.FOCUS_GROUP] = group, _extends2), containerProps);
return React.createElement(Fragment, null, !noFocusGuards && [React.createElement("div", {
key: "guard-first",
"data-focus-guard": true,
tabIndex: disabled ? -1 : 0,
style: hidden
}), // nearest focus guard
React.createElement("div", {
key: "guard-nearest",
"data-focus-guard": true,
tabIndex: disabled ? -1 : 1,
style: hidden
})], React.createElement(Container, _extends({
ref: this.setObserveNode
}, lockProps, {
className: className,
onBlur: onBlur,
onFocus: onFocus
}), React.createElement(FocusTrap, {
observed: observed,
disabled: disabled,
persistentFocus: persistentFocus,
autoFocus: autoFocus,
whiteList: whiteList,
onActivation: this.onActivation,
onDeactivation: this.onDeactivation
}), children), !noFocusGuards && React.createElement("div", {
"data-focus-guard": true,
tabIndex: disabled ? -1 : 0,
style: hidden
}));
}
}]);
return React.createElement(Fragment, null, !noFocusGuards && [React.createElement("div", {
key: "guard-first",
"data-focus-guard": true,
tabIndex: disabled ? -1 : 0,
style: hidden
}), // nearest focus guard
React.createElement("div", {
key: "guard-nearest",
"data-focus-guard": true,
tabIndex: disabled ? -1 : 1,
style: hidden
})], React.createElement(Container, _extends({
ref: this.setObserveNode
}, lockProps, {
className: className,
onBlur: onBlur,
onFocus: onFocus
}), React.createElement(FocusTrap, {
observed: observed,
disabled: disabled,
persistentFocus: persistentFocus,
autoFocus: autoFocus,
whiteList: whiteList,
onActivation: this.onActivation,
onDeactivation: this.onDeactivation
}), children), !noFocusGuards && React.createElement("div", {
"data-focus-guard": true,
tabIndex: disabled ? -1 : 0,
style: hidden
}));
};

@@ -161,0 +151,0 @@ return FocusLock;

import _extends from "@babel/runtime/helpers/extends";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/inherits";
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";

@@ -17,11 +13,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";

function (_Component) {
_inherits(MoveFocusInside, _Component);
_inheritsLoose(MoveFocusInside, _Component);
function MoveFocusInside() {
var _getPrototypeOf2;
var _this;
_classCallCheck(this, MoveFocusInside);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {

@@ -31,3 +23,3 @@ args[_key] = arguments[_key];

_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(MoveFocusInside)).call.apply(_getPrototypeOf2, [this].concat(args)));
_this = _Component.call.apply(_Component, [this].concat(args)) || this;

@@ -43,39 +35,35 @@ _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "setObserveNode", function (ref) {

_createClass(MoveFocusInside, [{
key: "componentDidMount",
value: function componentDidMount() {
var _proto = MoveFocusInside.prototype;
_proto.componentDidMount = function componentDidMount() {
this.moveFocus();
};
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
if (prevProps.disabled && !this.props.disabled) {
this.moveFocus();
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
if (prevProps.disabled && !this.props.disabled) {
this.moveFocus();
}
}
}, {
key: "moveFocus",
value: function moveFocus() {
var observed = this.observed;
};
if (!this.props.disabled && observed) {
if (!focusInside(observed)) {
moveFocusInside(observed, null);
}
_proto.moveFocus = function moveFocus() {
var observed = this.observed;
if (!this.props.disabled && observed) {
if (!focusInside(observed)) {
moveFocusInside(observed, null);
}
}
}, {
key: "render",
value: function render() {
var _this$props = this.props,
children = _this$props.children,
disabled = _this$props.disabled,
className = _this$props.className;
return React.createElement("div", _extends({}, inlineProp(constants.FOCUS_AUTO, !disabled), {
ref: this.setObserveNode,
className: className
}), children);
}
}]);
};
_proto.render = function render() {
var _this$props = this.props,
children = _this$props.children,
disabled = _this$props.disabled,
className = _this$props.className;
return React.createElement("div", _extends({}, inlineProp(constants.FOCUS_AUTO, !disabled), {
ref: this.setObserveNode,
className: className
}), children);
};
return MoveFocusInside;

@@ -82,0 +70,0 @@ }(Component);

{
"name": "react-focus-lock",
"version": "1.17.4",
"version": "1.17.5",
"description": "It is a trap! (for a focus)",

@@ -18,4 +18,4 @@ "main": "dist/cjs/index.js",

"lint:fix": "eslint src tests --fix",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
"storybook": "NODE_ENV=es2015 start-storybook -p 6006",
"build-storybook": "NODE_ENV=es2015 build-storybook",
"package-self": "package-self",

@@ -52,6 +52,7 @@ "size": "npm run build && size-limit"

"@babel/register": "^7.0.0",
"@storybook/addon-actions": "^3.2.14",
"@storybook/addon-links": "^3.2.14",
"@storybook/react": "^3.2.14",
"@storybook/addon-actions": "^4.0.4",
"@storybook/addon-links": "^4.0.4",
"@storybook/react": "^4.0.4",
"babel-eslint": "^9.0.0",
"babel-loader": "^8.0.4",
"babel-plugin-transform-react-remove-prop-types": "^0.4.19",

@@ -73,5 +74,5 @@ "chai": "^4.1.0",

"package-self": "^1.1.1",
"react": "^16.2.0",
"react": "^16.6.1",
"react-compat": "^0.0.1",
"react-dom": "^16.2.0",
"react-dom": "^16.6.1",
"react-hot-loader": "^3.0.0-beta.7",

@@ -85,6 +86,6 @@ "react-test-renderer": "^16.2.0",

"@babel/runtime": "^7.0.0",
"focus-lock": "^0.5.1",
"focus-lock": "^0.5.2",
"prop-types": "^15.6.2",
"react-clientside-effect": "^1.0.0"
"react-clientside-effect": "^1.2.0"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc