Socket
Socket
Sign inDemoInstall

pcln-menu

Package Overview
Dependencies
Maintainers
1
Versions
337
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pcln-menu - npm Package Compare versions

Comparing version 4.0.0-beta.1 to 4.0.0-beta.2

35

dist/cjs/Menu/Menu.js
"use strict";
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); }
Object.defineProperty(exports, "__esModule", {

@@ -8,3 +10,3 @@ value: true

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

@@ -15,2 +17,4 @@ var _propTypes = _interopRequireDefault(require("prop-types"));

var _styledSystem = require("styled-system");
var _pclnDesignSystem = require("pcln-design-system");

@@ -26,2 +30,6 @@

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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 _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

@@ -36,11 +44,12 @@

componentId: "sc-1mj8ibm-0"
})(["display:flex;align-items:center;padding:8px;"]);
})(["display:flex;align-items:center;padding:", "px;"], (0, _styledSystem.themeGet)('space.2'));
function Menu(_ref) {
var buttonText = _ref.buttonText,
var id = _ref.id,
buttonText = _ref.buttonText,
color = _ref.color,
height = _ref.height,
columns = _ref.columns,
size = _ref.size,
children = _ref.children,
props = _objectWithoutProperties(_ref, ["buttonText", "color", "height", "columns", "children"]);
props = _objectWithoutProperties(_ref, ["id", "buttonText", "color", "height", "size", "children"]);

@@ -50,5 +59,5 @@ var MenuContent = function MenuContent(_ref2) {

return /*#__PURE__*/_react["default"].createElement(_MenuList["default"], {
id: "menu-container",
id: id,
color: color,
columns: columns,
size: size,
height: height,

@@ -62,4 +71,3 @@ handleClose: handleClose

};
var onKeyDown = function onKeyDown(evt) {
var onKeyDown = (0, _react.useCallback)(function (evt) {
var key = evt.key;

@@ -71,4 +79,3 @@

}
};
}, []);
return /*#__PURE__*/_react["default"].createElement(_pclnPopover["default"], _extends({

@@ -80,2 +87,3 @@ hideArrow: true,

placement: "bottom",
"aria-controls": id,
renderContent: MenuContent

@@ -92,12 +100,13 @@ }, props), /*#__PURE__*/_react["default"].createElement(LinkButton, {

Menu.propTypes = {
id: _propTypes["default"].string,
buttonText: _propTypes["default"].string,
color: _propTypes["default"].string,
height: _propTypes["default"].number,
columns: _propTypes["default"].number,
size: _propTypes["default"].string,
children: _propTypes["default"].node
};
Menu.defaultProps = {
columns: 1
size: 'singleColumn'
};
var _default = Menu;
exports["default"] = _default;

@@ -47,7 +47,6 @@ "use strict";

var handleClick = function handleClick() {
var handleClick = (0, _react.useCallback)(function () {
onClick && onClick();
handleClose && handleClose();
};
}, [onClick, handleClose]);
return /*#__PURE__*/_react["default"].createElement(MenuButton, _extends({

@@ -54,0 +53,0 @@ id: id,

@@ -14,4 +14,6 @@ "use strict";

var _styledComponents = _interopRequireDefault(require("styled-components"));
var _styledComponents = _interopRequireWildcard(require("styled-components"));
var _styledSystem = require("styled-system");
var _pclnDesignSystem = require("pcln-design-system");

@@ -25,11 +27,24 @@

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure 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 _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; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
var sizes = {
singleColumn: (0, _styledComponents.css)(["& > *{width:100%;}"]),
twoColumns: (0, _styledComponents.css)(["& > *{width:calc(50% - ", "px);}"], (0, _styledSystem.themeGet)('space.1'))
};
var MenuContainer = (0, _styledComponents["default"])(_pclnDesignSystem.Flex).withConfig({
displayName: "MenuList__MenuContainer",
componentId: "enbv9e-0"
})(["font-family:'Montserrat','Helvetica Neue',Helvetica,Arial,sans-serif;overflow-y:scroll;height:", "px;& > *{margin-right:4px;margin-bottom:4px;width:", ";}"], function (props) {
})(["font-family:'Montserrat','Helvetica Neue',Helvetica,Arial,sans-serif;overflow-y:scroll;height:", "px;& > *{margin-right:", "px;margin-bottom:", "px;}", ";"], function (props) {
return props.height || 300;
}, function (props) {
var columnWidth = 100 / props.columns;
return "calc(".concat(columnWidth, "% - 4px)");
});
}, (0, _styledSystem.themeGet)('space.1'), (0, _styledSystem.themeGet)('space.1'), (0, _pclnDesignSystem.applySizes)(sizes));

@@ -50,5 +65,6 @@ function focusNext(item) {

function MenuList(_ref) {
var children = _ref.children,
var id = _ref.id,
children = _ref.children,
color = _ref.color,
columns = _ref.columns,
size = _ref.size,
height = _ref.height,

@@ -58,9 +74,15 @@ handleClose = _ref.handleClose;

var currentItemRef = (0, _react.useRef)(null);
var _useState = (0, _react.useState)(null),
_useState2 = _slicedToArray(_useState, 2),
currentItemId = _useState2[0],
setCurrentItemId = _useState2[1];
(0, _react.useEffect)(function () {
var _currentItemRef$curre;
var _currentItemRef$curre, _currentItemRef$curre2;
currentItemRef === null || currentItemRef === void 0 ? void 0 : (_currentItemRef$curre = currentItemRef.current) === null || _currentItemRef$curre === void 0 ? void 0 : _currentItemRef$curre.focus();
setCurrentItemId((_currentItemRef$curre = currentItemRef.current) === null || _currentItemRef$curre === void 0 ? void 0 : _currentItemRef$curre.id);
(_currentItemRef$curre2 = currentItemRef.current) === null || _currentItemRef$curre2 === void 0 ? void 0 : _currentItemRef$curre2.focus();
}, []);
function handleKeyDown(evt) {
var handleKeyDown = (0, _react.useCallback)(function (evt) {
var _list$ownerDocument;

@@ -79,10 +101,11 @@

}
}
}, []);
return /*#__PURE__*/_react["default"].createElement(MenuContainer, {
id: id,
ref: listRef,
role: "list",
role: "listbox",
"aria-activedescendant": currentItemId,
flexWrap: "wrap",
height: height,
columns: columns,
size: size,
p: 2,

@@ -95,5 +118,5 @@ pr: 1,

id: "option".concat(index),
ref: child.props.selected ? currentItemRef : null,
color: child.props.color || color,
handleClose: handleClose,
ref: child.props.selected ? currentItemRef : null
handleClose: handleClose
});

@@ -105,5 +128,6 @@ }));

MenuList.propTypes = {
id: _propTypes["default"].string,
children: _propTypes["default"].node,
color: _propTypes["default"].string,
columns: _propTypes["default"].number,
size: _propTypes["default"].string,
height: _propTypes["default"].number,

@@ -113,5 +137,5 @@ handleClose: _propTypes["default"].func

MenuList.defaultProps = {
columns: 1
size: 'singleColumn'
};
var _default = MenuList;
exports["default"] = _default;

@@ -7,5 +7,6 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

import React from 'react';
import React, { useCallback } from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { themeGet } from 'styled-system';
import { Button } from 'pcln-design-system';

@@ -18,11 +19,12 @@ import { ChevronDown } from 'pcln-icons';

componentId: "sc-1mj8ibm-0"
})(["display:flex;align-items:center;padding:8px;"]);
})(["display:flex;align-items:center;padding:", "px;"], themeGet('space.2'));
function Menu(_ref) {
var buttonText = _ref.buttonText,
var id = _ref.id,
buttonText = _ref.buttonText,
color = _ref.color,
height = _ref.height,
columns = _ref.columns,
size = _ref.size,
children = _ref.children,
props = _objectWithoutProperties(_ref, ["buttonText", "color", "height", "columns", "children"]);
props = _objectWithoutProperties(_ref, ["id", "buttonText", "color", "height", "size", "children"]);

@@ -32,5 +34,5 @@ var MenuContent = function MenuContent(_ref2) {

return /*#__PURE__*/React.createElement(MenuList, {
id: "menu-container",
id: id,
color: color,
columns: columns,
size: size,
height: height,

@@ -44,4 +46,3 @@ handleClose: handleClose

};
var onKeyDown = function onKeyDown(evt) {
var onKeyDown = useCallback(function (evt) {
var key = evt.key;

@@ -53,4 +54,3 @@

}
};
}, []);
return /*#__PURE__*/React.createElement(Popover, _extends({

@@ -62,2 +62,3 @@ hideArrow: true,

placement: "bottom",
"aria-controls": id,
renderContent: MenuContent

@@ -74,11 +75,12 @@ }, props), /*#__PURE__*/React.createElement(LinkButton, {

Menu.propTypes = {
id: PropTypes.string,
buttonText: PropTypes.string,
color: PropTypes.string,
height: PropTypes.number,
columns: PropTypes.number,
size: PropTypes.string,
children: PropTypes.node
};
Menu.defaultProps = {
columns: 1
size: 'singleColumn'
};
export default Menu;

@@ -7,3 +7,3 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

import React, { memo } from 'react';
import React, { memo, useCallback } from 'react';
import PropTypes from 'prop-types';

@@ -27,7 +27,6 @@ import styled from 'styled-components';

var handleClick = function handleClick() {
var handleClick = useCallback(function () {
onClick && onClick();
handleClose && handleClose();
};
}, [onClick, handleClose]);
return /*#__PURE__*/React.createElement(MenuButton, _extends({

@@ -34,0 +33,0 @@ id: id,

@@ -1,14 +0,28 @@

import React, { useEffect, useRef } from 'react';
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure 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 _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; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import React, { useCallback, useEffect, useRef, useState } from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { Flex } from 'pcln-design-system';
import styled, { css } from 'styled-components';
import { themeGet } from 'styled-system';
import { Flex, applySizes } from 'pcln-design-system';
var sizes = {
singleColumn: css(["& > *{width:100%;}"]),
twoColumns: css(["& > *{width:calc(50% - ", "px);}"], themeGet('space.1'))
};
var MenuContainer = styled(Flex).withConfig({
displayName: "MenuList__MenuContainer",
componentId: "enbv9e-0"
})(["font-family:'Montserrat','Helvetica Neue',Helvetica,Arial,sans-serif;overflow-y:scroll;height:", "px;& > *{margin-right:4px;margin-bottom:4px;width:", ";}"], function (props) {
})(["font-family:'Montserrat','Helvetica Neue',Helvetica,Arial,sans-serif;overflow-y:scroll;height:", "px;& > *{margin-right:", "px;margin-bottom:", "px;}", ";"], function (props) {
return props.height || 300;
}, function (props) {
var columnWidth = 100 / props.columns;
return "calc(".concat(columnWidth, "% - 4px)");
});
}, themeGet('space.1'), themeGet('space.1'), applySizes(sizes));

@@ -29,5 +43,6 @@ function focusNext(item) {

function MenuList(_ref) {
var children = _ref.children,
var id = _ref.id,
children = _ref.children,
color = _ref.color,
columns = _ref.columns,
size = _ref.size,
height = _ref.height,

@@ -37,9 +52,15 @@ handleClose = _ref.handleClose;

var currentItemRef = useRef(null);
var _useState = useState(null),
_useState2 = _slicedToArray(_useState, 2),
currentItemId = _useState2[0],
setCurrentItemId = _useState2[1];
useEffect(function () {
var _currentItemRef$curre;
var _currentItemRef$curre, _currentItemRef$curre2;
currentItemRef === null || currentItemRef === void 0 ? void 0 : (_currentItemRef$curre = currentItemRef.current) === null || _currentItemRef$curre === void 0 ? void 0 : _currentItemRef$curre.focus();
setCurrentItemId((_currentItemRef$curre = currentItemRef.current) === null || _currentItemRef$curre === void 0 ? void 0 : _currentItemRef$curre.id);
(_currentItemRef$curre2 = currentItemRef.current) === null || _currentItemRef$curre2 === void 0 ? void 0 : _currentItemRef$curre2.focus();
}, []);
function handleKeyDown(evt) {
var handleKeyDown = useCallback(function (evt) {
var _list$ownerDocument;

@@ -58,10 +79,11 @@

}
}
}, []);
return /*#__PURE__*/React.createElement(MenuContainer, {
id: id,
ref: listRef,
role: "list",
role: "listbox",
"aria-activedescendant": currentItemId,
flexWrap: "wrap",
height: height,
columns: columns,
size: size,
p: 2,

@@ -74,5 +96,5 @@ pr: 1,

id: "option".concat(index),
ref: child.props.selected ? currentItemRef : null,
color: child.props.color || color,
handleClose: handleClose,
ref: child.props.selected ? currentItemRef : null
handleClose: handleClose
});

@@ -84,5 +106,6 @@ }));

MenuList.propTypes = {
id: PropTypes.string,
children: PropTypes.node,
color: PropTypes.string,
columns: PropTypes.number,
size: PropTypes.string,
height: PropTypes.number,

@@ -92,4 +115,4 @@ handleClose: PropTypes.func

MenuList.defaultProps = {
columns: 1
size: 'singleColumn'
};
export default MenuList;

@@ -7,5 +7,6 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

import React from 'react';
import React, { useCallback } from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { themeGet } from 'styled-system';
import { Button } from 'pcln-design-system';

@@ -18,11 +19,12 @@ import { ChevronDown } from 'pcln-icons';

componentId: "sc-1mj8ibm-0"
})(["display:flex;align-items:center;padding:8px;"]);
})(["display:flex;align-items:center;padding:", "px;"], themeGet('space.2'));
function Menu(_ref) {
var buttonText = _ref.buttonText,
var id = _ref.id,
buttonText = _ref.buttonText,
color = _ref.color,
height = _ref.height,
columns = _ref.columns,
size = _ref.size,
children = _ref.children,
props = _objectWithoutProperties(_ref, ["buttonText", "color", "height", "columns", "children"]);
props = _objectWithoutProperties(_ref, ["id", "buttonText", "color", "height", "size", "children"]);

@@ -32,5 +34,5 @@ var MenuContent = function MenuContent(_ref2) {

return /*#__PURE__*/React.createElement(MenuList, {
id: "menu-container",
id: id,
color: color,
columns: columns,
size: size,
height: height,

@@ -44,4 +46,3 @@ handleClose: handleClose

};
var onKeyDown = function onKeyDown(evt) {
var onKeyDown = useCallback(function (evt) {
var key = evt.key;

@@ -53,4 +54,3 @@

}
};
}, []);
return /*#__PURE__*/React.createElement(Popover, _extends({

@@ -62,2 +62,3 @@ hideArrow: true,

placement: "bottom",
"aria-controls": id,
renderContent: MenuContent

@@ -74,11 +75,12 @@ }, props), /*#__PURE__*/React.createElement(LinkButton, {

Menu.propTypes = {
id: PropTypes.string,
buttonText: PropTypes.string,
color: PropTypes.string,
height: PropTypes.number,
columns: PropTypes.number,
size: PropTypes.string,
children: PropTypes.node
};
Menu.defaultProps = {
columns: 1
size: 'singleColumn'
};
export default Menu;

@@ -7,3 +7,3 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

import React, { memo } from 'react';
import React, { memo, useCallback } from 'react';
import PropTypes from 'prop-types';

@@ -27,7 +27,6 @@ import styled from 'styled-components';

var handleClick = function handleClick() {
var handleClick = useCallback(function () {
onClick && onClick();
handleClose && handleClose();
};
}, [onClick, handleClose]);
return /*#__PURE__*/React.createElement(MenuButton, _extends({

@@ -34,0 +33,0 @@ id: id,

@@ -1,14 +0,28 @@

import React, { useEffect, useRef } from 'react';
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure 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 _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; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import React, { useCallback, useEffect, useRef, useState } from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { Flex } from 'pcln-design-system';
import styled, { css } from 'styled-components';
import { themeGet } from 'styled-system';
import { Flex, applySizes } from 'pcln-design-system';
var sizes = {
singleColumn: css(["& > *{width:100%;}"]),
twoColumns: css(["& > *{width:calc(50% - ", "px);}"], themeGet('space.1'))
};
var MenuContainer = styled(Flex).withConfig({
displayName: "MenuList__MenuContainer",
componentId: "enbv9e-0"
})(["font-family:'Montserrat','Helvetica Neue',Helvetica,Arial,sans-serif;overflow-y:scroll;height:", "px;& > *{margin-right:4px;margin-bottom:4px;width:", ";}"], function (props) {
})(["font-family:'Montserrat','Helvetica Neue',Helvetica,Arial,sans-serif;overflow-y:scroll;height:", "px;& > *{margin-right:", "px;margin-bottom:", "px;}", ";"], function (props) {
return props.height || 300;
}, function (props) {
var columnWidth = 100 / props.columns;
return "calc(".concat(columnWidth, "% - 4px)");
});
}, themeGet('space.1'), themeGet('space.1'), applySizes(sizes));

@@ -29,5 +43,6 @@ function focusNext(item) {

function MenuList(_ref) {
var children = _ref.children,
var id = _ref.id,
children = _ref.children,
color = _ref.color,
columns = _ref.columns,
size = _ref.size,
height = _ref.height,

@@ -37,9 +52,15 @@ handleClose = _ref.handleClose;

var currentItemRef = useRef(null);
var _useState = useState(null),
_useState2 = _slicedToArray(_useState, 2),
currentItemId = _useState2[0],
setCurrentItemId = _useState2[1];
useEffect(function () {
var _currentItemRef$curre;
var _currentItemRef$curre, _currentItemRef$curre2;
currentItemRef === null || currentItemRef === void 0 ? void 0 : (_currentItemRef$curre = currentItemRef.current) === null || _currentItemRef$curre === void 0 ? void 0 : _currentItemRef$curre.focus();
setCurrentItemId((_currentItemRef$curre = currentItemRef.current) === null || _currentItemRef$curre === void 0 ? void 0 : _currentItemRef$curre.id);
(_currentItemRef$curre2 = currentItemRef.current) === null || _currentItemRef$curre2 === void 0 ? void 0 : _currentItemRef$curre2.focus();
}, []);
function handleKeyDown(evt) {
var handleKeyDown = useCallback(function (evt) {
var _list$ownerDocument;

@@ -58,10 +79,11 @@

}
}
}, []);
return /*#__PURE__*/React.createElement(MenuContainer, {
id: id,
ref: listRef,
role: "list",
role: "listbox",
"aria-activedescendant": currentItemId,
flexWrap: "wrap",
height: height,
columns: columns,
size: size,
p: 2,

@@ -74,5 +96,5 @@ pr: 1,

id: "option".concat(index),
ref: child.props.selected ? currentItemRef : null,
color: child.props.color || color,
handleClose: handleClose,
ref: child.props.selected ? currentItemRef : null
handleClose: handleClose
});

@@ -84,5 +106,6 @@ }));

MenuList.propTypes = {
id: PropTypes.string,
children: PropTypes.node,
color: PropTypes.string,
columns: PropTypes.number,
size: PropTypes.string,
height: PropTypes.number,

@@ -92,4 +115,4 @@ handleClose: PropTypes.func

MenuList.defaultProps = {
columns: 1
size: 'singleColumn'
};
export default MenuList;
{
"name": "pcln-menu",
"version": "4.0.0-beta.1",
"version": "4.0.0-beta.2",
"main": "dist/cjs/index.js",

@@ -5,0 +5,0 @@ "module": "dist/esm/index.js",

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