@unifiedsoftware/react-ui 1.0.2 → 1.0.3

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.d.mts CHANGED
@@ -156,11 +156,12 @@ interface Props$1 {
156
156
  }[];
157
157
  }
158
158
  declare const AppBreadCrumb: ({ title, paths }: Props$1) => react_jsx_runtime.JSX.Element;
159
- declare const AppBreadCrumbNav: ({ paths }: {
159
+ declare const AppBreadCrumbNav: ({ paths, onPush, }: {
160
160
  paths?: {
161
161
  route: string;
162
162
  title: string;
163
163
  }[] | undefined;
164
+ onPush: (to: string | number) => void;
164
165
  }) => react_jsx_runtime.JSX.Element;
165
166
 
166
167
  type LoadingType = 'window' | 'page' | 'grid' | 'button' | 'card' | 'div' | 'none';
package/dist/index.d.ts CHANGED
@@ -156,11 +156,12 @@ interface Props$1 {
156
156
  }[];
157
157
  }
158
158
  declare const AppBreadCrumb: ({ title, paths }: Props$1) => react_jsx_runtime.JSX.Element;
159
- declare const AppBreadCrumbNav: ({ paths }: {
159
+ declare const AppBreadCrumbNav: ({ paths, onPush, }: {
160
160
  paths?: {
161
161
  route: string;
162
162
  title: string;
163
163
  }[] | undefined;
164
+ onPush: (to: string | number) => void;
164
165
  }) => react_jsx_runtime.JSX.Element;
165
166
 
166
167
  type LoadingType = 'window' | 'page' | 'grid' | 'button' | 'card' | 'div' | 'none';
package/dist/index.js CHANGED
@@ -939,9 +939,11 @@ var AppBreadCrumb = ({ title, paths }) => {
939
939
  }, []);
940
940
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(BreadCrumbTitle, { children: title != null ? title : "Home" });
941
941
  };
942
- var AppBreadCrumbNav = ({ paths }) => {
942
+ var AppBreadCrumbNav = ({
943
+ paths,
944
+ onPush
945
+ }) => {
943
946
  const { active, path, routes, setRoutes } = (0, import_react15.useContext)(BreadCrumbContext);
944
- const navigate = (0, import_react_router_dom3.useNavigate)();
945
947
  const { updateList } = (0, import_react15.useContext)(HistoryContext);
946
948
  (0, import_react15.useEffect)(() => {
947
949
  updateList({ name: active, path });
@@ -955,7 +957,7 @@ var AppBreadCrumbNav = ({ paths }) => {
955
957
  routes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_vsc.VscChevronRight, { color: "black" }),
956
958
  routes.length > 0 ? routes.map((i, idx, arr) => {
957
959
  if (i.route === -1) {
958
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "link", onClick: () => navigate(-1), children: [
960
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "link", onClick: () => onPush(-1), children: [
959
961
  i.title,
960
962
  " ",
961
963
  idx + 1 === arr.length ? "" : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_vsc.VscChevronRight, { color: "black" })
@@ -973,11 +975,11 @@ var AppBreadCrumbNav = ({ paths }) => {
973
975
  {
974
976
  onClick: () => {
975
977
  if ((routes == null ? void 0 : routes.length) === 1) {
976
- navigate("/");
978
+ onPush("/");
977
979
  setRoutes([]);
978
980
  return;
979
981
  }
980
- navigate(`${routes && routes[(routes == null ? void 0 : routes.length) - 2].route}`);
982
+ onPush(`${routes && routes[(routes == null ? void 0 : routes.length) - 2].route}`);
981
983
  },
982
984
  children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_md.MdClose, { fontSize: 20 })
983
985
  }
package/dist/index.mjs CHANGED
@@ -442,7 +442,7 @@ var useStep = (maxStep) => {
442
442
  import { useContext as useContext2, useEffect as useEffect7 } from "react";
443
443
  import { MdClose } from "react-icons/md";
444
444
  import { VscChevronRight } from "react-icons/vsc";
445
- import { Link as Link3, useNavigate } from "react-router-dom";
445
+ import { Link as Link3 } from "react-router-dom";
446
446
 
447
447
  // src/styled-components/breadcrumb.ts
448
448
  import styled from "styled-components";
@@ -874,9 +874,11 @@ var AppBreadCrumb = ({ title, paths }) => {
874
874
  }, []);
875
875
  return /* @__PURE__ */ jsx10(BreadCrumbTitle, { children: title != null ? title : "Home" });
876
876
  };
877
- var AppBreadCrumbNav = ({ paths }) => {
877
+ var AppBreadCrumbNav = ({
878
+ paths,
879
+ onPush
880
+ }) => {
878
881
  const { active, path, routes, setRoutes } = useContext2(BreadCrumbContext);
879
- const navigate = useNavigate();
880
882
  const { updateList } = useContext2(HistoryContext);
881
883
  useEffect7(() => {
882
884
  updateList({ name: active, path });
@@ -890,7 +892,7 @@ var AppBreadCrumbNav = ({ paths }) => {
890
892
  routes.length > 0 && /* @__PURE__ */ jsx10(VscChevronRight, { color: "black" }),
891
893
  routes.length > 0 ? routes.map((i, idx, arr) => {
892
894
  if (i.route === -1) {
893
- return /* @__PURE__ */ jsxs4("span", { className: "link", onClick: () => navigate(-1), children: [
895
+ return /* @__PURE__ */ jsxs4("span", { className: "link", onClick: () => onPush(-1), children: [
894
896
  i.title,
895
897
  " ",
896
898
  idx + 1 === arr.length ? "" : /* @__PURE__ */ jsx10(VscChevronRight, { color: "black" })
@@ -908,11 +910,11 @@ var AppBreadCrumbNav = ({ paths }) => {
908
910
  {
909
911
  onClick: () => {
910
912
  if ((routes == null ? void 0 : routes.length) === 1) {
911
- navigate("/");
913
+ onPush("/");
912
914
  setRoutes([]);
913
915
  return;
914
916
  }
915
- navigate(`${routes && routes[(routes == null ? void 0 : routes.length) - 2].route}`);
917
+ onPush(`${routes && routes[(routes == null ? void 0 : routes.length) - 2].route}`);
916
918
  },
917
919
  children: /* @__PURE__ */ jsx10(MdClose, { fontSize: 20 })
918
920
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unifiedsoftware/react-ui",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "files": [