Socket
Socket
Sign inDemoInstall

@os-design/menu-utils

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@os-design/menu-utils - npm Package Compare versions

Comparing version 1.0.10 to 1.0.11

7

dist/cjs/index.js
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", {

@@ -24,5 +23,3 @@ value: true

});
var _MenuContext = _interopRequireWildcard(require("./utils/MenuContext"));
Object.keys(_MenuContext).forEach(function (key) {

@@ -39,5 +36,3 @@ if (key === "default" || key === "__esModule") return;

});
var _useSelectHandler = _interopRequireWildcard(require("./utils/useSelectHandler"));
Object.keys(_useSelectHandler).forEach(function (key) {

@@ -54,6 +49,4 @@ if (key === "default" || key === "__esModule") return;

});
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; }
//# sourceMappingURL=index.js.map

4

dist/cjs/utils/MenuContext.js

@@ -7,7 +7,4 @@ "use strict";

exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var MenuContext = /*#__PURE__*/_react["default"].createContext({

@@ -17,3 +14,2 @@ closeOnSelect: true,

});
MenuContext.displayName = 'MenuContext';

@@ -20,0 +16,0 @@ var _default = MenuContext;

26

dist/cjs/utils/useSelectHandler.js

@@ -7,17 +7,9 @@ "use strict";

exports["default"] = void 0;
var _react = require("react");
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
var useSelectHandler = function useSelectHandler(props) {

@@ -30,7 +22,8 @@ var propsRef = (0, _react.useRef)(props);

var _propsRef$current = propsRef.current,
value = _propsRef$current.value,
onChange = _propsRef$current.onChange,
maxSelectedItems = _propsRef$current.maxSelectedItems;
var items = value || []; // Delete the value because it was already selected
value = _propsRef$current.value,
onChange = _propsRef$current.onChange,
maxSelectedItems = _propsRef$current.maxSelectedItems;
var items = value || [];
// Delete the value because it was already selected
if (items.includes(v)) {

@@ -41,11 +34,11 @@ onChange(items.filter(function (item) {

return;
} // Change the selected value if the max number of selected items equals 1
}
// Change the selected value if the max number of selected items equals 1
if (maxSelectedItems === 1) {
onChange([v]);
return;
} // Add a new value if the number of selected items is less than max
}
// Add a new value if the number of selected items is less than max
if (maxSelectedItems === 'all' || items.length < maxSelectedItems) {

@@ -56,5 +49,4 @@ onChange([].concat(_toConsumableArray(items), [v]));

};
var _default = useSelectHandler;
exports["default"] = _default;
//# sourceMappingURL=useSelectHandler.js.map
import { useCallback, useEffect, useRef } from 'react';
const useSelectHandler = props => {

@@ -14,16 +13,17 @@ const propsRef = useRef(props);

} = propsRef.current;
const items = value || []; // Delete the value because it was already selected
const items = value || [];
// Delete the value because it was already selected
if (items.includes(v)) {
onChange(items.filter(item => item !== v));
return;
} // Change the selected value if the max number of selected items equals 1
}
// Change the selected value if the max number of selected items equals 1
if (maxSelectedItems === 1) {
onChange([v]);
return;
} // Add a new value if the number of selected items is less than max
}
// Add a new value if the number of selected items is less than max
if (maxSelectedItems === 'all' || items.length < maxSelectedItems) {

@@ -34,4 +34,3 @@ onChange([...items, v]);

};
export default useSelectHandler;
//# sourceMappingURL=useSelectHandler.js.map
{
"name": "@os-design/menu-utils",
"version": "1.0.10",
"version": "1.0.11",
"license": "UNLICENSED",

@@ -34,3 +34,3 @@ "repository": "git@gitlab.com:os-team/libs/os-design.git",

},
"gitHead": "174987fc6c9d55db201be10abde3a4cf5a790573"
"gitHead": "8cb28f6719d699c014fbce91d832a9ff06abe515"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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