@bigbinary/neeto-molecules 1.0.84 → 1.0.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/MenuBar.js CHANGED
@@ -2,8 +2,9 @@ import React, { Children, isValidElement, cloneElement } from 'react';
2
2
  import { Button, Typography, Input } from '@bigbinary/neetoui';
3
3
  import { Plus, Search as Search$1, Close } from '@bigbinary/neeto-icons';
4
4
  import { noop as noop$1 } from '@bigbinary/neeto-commons-frontend/pure';
5
+ import { joinHyphenCase } from '@bigbinary/neeto-commons-frontend/utils';
5
6
  import { Link } from 'react-router-dom';
6
- import { useTranslation } from 'react-i18next';
7
+ import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
7
8
 
8
9
  function _typeof(obj) {
9
10
  "@babel/helpers - typeof";
@@ -30888,6 +30889,8 @@ var AddNew = function AddNew(_ref) {
30888
30889
  };
30889
30890
 
30890
30891
  var _excluded$4 = ["url", "icon", "label", "count", "active", "onEdit", "onClick", "className"];
30892
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
30893
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
30891
30894
  var Block = function Block(_ref) {
30892
30895
  var url = _ref.url,
30893
30896
  icon = _ref.icon,
@@ -30907,20 +30910,18 @@ var Block = function Block(_ref) {
30907
30910
  var Parent = url ? Link : function (props) {
30908
30911
  return /*#__PURE__*/React.createElement("button", props);
30909
30912
  };
30910
- var hyphenize = function hyphenize(string) {
30911
- if (string && typeof string === "string") return undefined;
30912
- return string.replace(/[\s_]/g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").replace(/-+/g, "-").toLowerCase();
30913
- };
30914
30913
  return /*#__PURE__*/React.createElement(Parent, _extends({
30915
- "data-cy": otherProps["data-cy"] || hyphenize(label) || "nui",
30914
+ "data-cy": otherProps["data-cy"] || "menubar-block",
30916
30915
  to: url,
30917
30916
  className: classnames("neeto-molecules-menubar__block", _defineProperty({
30918
30917
  "neeto-molecules-menubar__block--editable": !!onEdit,
30919
30918
  "neeto-molecules-menubar__block--active": active
30920
- }, className, className)),
30919
+ }, className, className))
30920
+ }, _objectSpread({
30921
30921
  onClick: onClick
30922
- }, otherProps), /*#__PURE__*/React.createElement("div", {
30923
- className: "neeto-molecules-menubar__block-label"
30922
+ }, otherProps)), /*#__PURE__*/React.createElement("div", {
30923
+ className: "neeto-molecules-menubar__block-label",
30924
+ "data-cy": joinHyphenCase("menubar-block-label", label)
30924
30925
  }, icon && /*#__PURE__*/React.createElement("i", {
30925
30926
  className: "neeto-molecules-menubar__block-icon"
30926
30927
  }, icon), /*#__PURE__*/React.createElement(Typography, {
@@ -30962,25 +30963,35 @@ var Item = function Item(_ref) {
30962
30963
  }, description));
30963
30964
  };
30964
30965
 
30965
- var _excluded$2 = ["isCollapsed", "onCollapse"];
30966
- var Search = function Search(_ref) {
30967
- var _ref$isCollapsed = _ref.isCollapsed,
30966
+ var _excluded$2 = ["t", "isCollapsed", "onCollapse"];
30967
+ var Search = withT(function (_ref) {
30968
+ var t = _ref.t,
30969
+ _ref$isCollapsed = _ref.isCollapsed,
30968
30970
  isCollapsed = _ref$isCollapsed === void 0 ? true : _ref$isCollapsed,
30969
30971
  onCollapse = _ref.onCollapse,
30970
30972
  props = _objectWithoutProperties(_ref, _excluded$2);
30971
- var _useTranslation = useTranslation(),
30972
- t = _useTranslation.t;
30973
- return !isCollapsed && /*#__PURE__*/React.createElement("div", {
30973
+ return /*#__PURE__*/React.createElement(React.Fragment, null, !isCollapsed && /*#__PURE__*/React.createElement("div", {
30974
30974
  className: "neeto-molecules-menubar__search"
30975
30975
  }, /*#__PURE__*/React.createElement(Input, _extends({
30976
30976
  placeholder: t("neetoMolecules.common.actions.search"),
30977
30977
  prefix: /*#__PURE__*/React.createElement(Search$1, null),
30978
30978
  type: "search"
30979
30979
  }, props)), /*#__PURE__*/React.createElement(Button, {
30980
+ "data-cy": "menubar-search-close-icon",
30980
30981
  icon: Close,
30981
30982
  style: "text",
30982
30983
  onClick: onCollapse
30983
- }));
30984
+ })));
30985
+ });
30986
+ Search.propTypes = {
30987
+ /**
30988
+ * To specify whether the search field is collapsed.
30989
+ */
30990
+ isCollapsed: propTypes.exports.bool,
30991
+ /**
30992
+ * To provide a callback function on collapse of the search field.
30993
+ */
30994
+ onCollapse: propTypes.exports.func
30984
30995
  };
30985
30996
 
30986
30997
  var _excluded$1 = ["children", "iconProps"];
@@ -31019,7 +31030,8 @@ var MenuBar = function MenuBar(_ref) {
31019
31030
  }, /*#__PURE__*/React.createElement("div", {
31020
31031
  className: classnames("neeto-molecules-menubar__wrapper", _defineProperty({}, className, className))
31021
31032
  }, /*#__PURE__*/React.createElement("div", {
31022
- className: "neeto-molecules-menubar__container"
31033
+ className: "neeto-molecules-menubar__container",
31034
+ "data-cy": "menubar-container"
31023
31035
  }, title && /*#__PURE__*/React.createElement(Typography, {
31024
31036
  className: "neeto-molecules-menubar__title",
31025
31037
  "data-cy": otherProps["data-cy"] || "menubar-heading",