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

@clayui/shared

Package Overview
Dependencies
Maintainers
15
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clayui/shared - npm Package Compare versions

Comparing version 3.40.0 to 3.45.0

27

lib/FocusScope.js

@@ -8,3 +8,3 @@ "use strict";

var _react = _interopRequireDefault(require("react"));
var _react = _interopRequireWildcard(require("react"));

@@ -15,7 +15,15 @@ var _Keys = require("./Keys");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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; }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/**
* The context helps to identify if the FocusScope is being declared nested, to
* avoid focus being controlled by more than one focus manager, we stop event
* propagation to prevent the parent focus generator from doing anything.
*/
var FocusConflictContext = /*#__PURE__*/_react.default.createContext(false);
/**
* FocusScope is a component only for controlling focus and listening

@@ -25,2 +33,4 @@ * for children's key down events, since the component handles the `onKeyDown`

*/
var FocusScope = function FocusScope(_ref) {

@@ -36,2 +46,3 @@ var _ref$arrowKeysLeftRig = _ref.arrowKeysLeftRight,

var focusManager = (0, _useFocusManagement.useFocusManagement)(elRef);
var hasParentFocus = (0, _react.useContext)(FocusConflictContext);

@@ -53,6 +64,12 @@ var _onKeyDown = function onKeyDown(event) {

return /*#__PURE__*/_react.default.cloneElement(children, {
return /*#__PURE__*/_react.default.createElement(FocusConflictContext.Provider, {
value: true
}, /*#__PURE__*/_react.default.cloneElement(children, {
onKeyDown: function onKeyDown(event) {
// If the element already exists a `onKeyDown` event should
if (hasParentFocus) {
event.stopPropagation();
} // If the element already exists a `onKeyDown` event should
// invoke it as well.
if (children.props.onKeyDown) {

@@ -76,5 +93,5 @@ children.props.onKeyDown(event);

}
});
}));
};
exports.FocusScope = FocusScope;

6

package.json
{
"name": "@clayui/shared",
"version": "3.40.0",
"version": "3.45.0",
"description": "ClayShared component",

@@ -30,3 +30,3 @@ "license": "BSD-3-Clause",

"@clayui/button": "^3.40.0",
"@clayui/link": "^3.40.0",
"@clayui/link": "^3.45.0",
"@clayui/provider": "^3.40.0",

@@ -44,3 +44,3 @@ "classnames": "^2.2.6",

],
"gitHead": "35f995fa7784af86b2052a542ae5d7b1eccfd356"
"gitHead": "82d19a7d31a21a6bb4ac92a0d709b32fc19502e9"
}

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