@apexcura/ui-components 0.0.16-Beta43 → 0.0.16-Beta45

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/index.js CHANGED
@@ -779,7 +779,6 @@ var { Sider } = import_antd11.Layout;
779
779
  var Sidebar = (props) => {
780
780
  const [collapsed, setCollapsed] = (0, import_react16.useState)(false);
781
781
  const handleChange = (item) => {
782
- console.log(item);
783
782
  if (props.onChange) {
784
783
  props.onChange(item);
785
784
  }
@@ -787,30 +786,26 @@ var Sidebar = (props) => {
787
786
  function getItem(label, key, icon, children, item) {
788
787
  return {
789
788
  key,
790
- icon: icon ? /* @__PURE__ */ import_react16.default.createElement("span", { className: props.iconsClassName, style: { filter: "brightness(0) invert(1)" } }, icon) : null,
789
+ icon: icon ? /* @__PURE__ */ import_react16.default.createElement("span", { className: props.iconsClassName }, icon) : null,
791
790
  children,
792
791
  label,
793
792
  onClick: () => handleChange(item)
794
793
  };
795
794
  }
796
- const items = props.items?.map((eachItem, index) => {
797
- const childItems = eachItem.items?.map(
798
- (child, childIndex) => getItem(
799
- child.label,
800
- `${index}-${childIndex}`,
801
- child.icon ? icons[child.icon] || /* @__PURE__ */ import_react16.default.createElement("img", { src: child.icon, alt: "" }) : null,
802
- void 0,
803
- child
804
- )
805
- );
806
- return getItem(
807
- eachItem.label,
808
- index.toString(),
809
- eachItem.icon ? icons[eachItem.icon] || /* @__PURE__ */ import_react16.default.createElement("img", { src: eachItem.icon, alt: "" }) : null,
810
- childItems,
811
- eachItem
812
- );
813
- });
795
+ function mapItems(items2, parentKey = "") {
796
+ return items2.map((eachItem, index) => {
797
+ const key = parentKey ? `${parentKey}-${index}` : index.toString();
798
+ const childItems = eachItem.items ? mapItems(eachItem.items, key) : void 0;
799
+ return getItem(
800
+ eachItem.label,
801
+ key,
802
+ eachItem.icon ? icons[eachItem.icon] || /* @__PURE__ */ import_react16.default.createElement("img", { src: eachItem.icon, alt: "" }) : null,
803
+ childItems,
804
+ eachItem
805
+ );
806
+ });
807
+ }
808
+ const items = props.items ? mapItems(props.items) : [];
814
809
  return /* @__PURE__ */ import_react16.default.createElement(import_antd11.Layout, { style: { minHeight: "100vh" } }, /* @__PURE__ */ import_react16.default.createElement(
815
810
  Sider,
816
811
  {
package/dist/index.mjs CHANGED
@@ -708,7 +708,6 @@ var { Sider } = Layout;
708
708
  var Sidebar = (props) => {
709
709
  const [collapsed, setCollapsed] = useState5(false);
710
710
  const handleChange = (item) => {
711
- console.log(item);
712
711
  if (props.onChange) {
713
712
  props.onChange(item);
714
713
  }
@@ -716,30 +715,26 @@ var Sidebar = (props) => {
716
715
  function getItem(label, key, icon, children, item) {
717
716
  return {
718
717
  key,
719
- icon: icon ? /* @__PURE__ */ React15.createElement("span", { className: props.iconsClassName, style: { filter: "brightness(0) invert(1)" } }, icon) : null,
718
+ icon: icon ? /* @__PURE__ */ React15.createElement("span", { className: props.iconsClassName }, icon) : null,
720
719
  children,
721
720
  label,
722
721
  onClick: () => handleChange(item)
723
722
  };
724
723
  }
725
- const items = props.items?.map((eachItem, index) => {
726
- const childItems = eachItem.items?.map(
727
- (child, childIndex) => getItem(
728
- child.label,
729
- `${index}-${childIndex}`,
730
- child.icon ? icons[child.icon] || /* @__PURE__ */ React15.createElement("img", { src: child.icon, alt: "" }) : null,
731
- void 0,
732
- child
733
- )
734
- );
735
- return getItem(
736
- eachItem.label,
737
- index.toString(),
738
- eachItem.icon ? icons[eachItem.icon] || /* @__PURE__ */ React15.createElement("img", { src: eachItem.icon, alt: "" }) : null,
739
- childItems,
740
- eachItem
741
- );
742
- });
724
+ function mapItems(items2, parentKey = "") {
725
+ return items2.map((eachItem, index) => {
726
+ const key = parentKey ? `${parentKey}-${index}` : index.toString();
727
+ const childItems = eachItem.items ? mapItems(eachItem.items, key) : void 0;
728
+ return getItem(
729
+ eachItem.label,
730
+ key,
731
+ eachItem.icon ? icons[eachItem.icon] || /* @__PURE__ */ React15.createElement("img", { src: eachItem.icon, alt: "" }) : null,
732
+ childItems,
733
+ eachItem
734
+ );
735
+ });
736
+ }
737
+ const items = props.items ? mapItems(props.items) : [];
743
738
  return /* @__PURE__ */ React15.createElement(Layout, { style: { minHeight: "100vh" } }, /* @__PURE__ */ React15.createElement(
744
739
  Sider,
745
740
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.16-Beta43",
3
+ "version": "0.0.16-Beta45",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",