orcs-design-system 3.2.39 → 3.2.40

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.
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable react/prop-types */
2
2
  import React from "react";
3
3
  import SideNav from "./index";
4
- import { BrowserRouter as Router, Route, Link, Routes, useParams, useMatch, Navigate } from "react-router-dom";
4
+ import { BrowserRouter as Router, Route, Link, useLocation, matchPath, Switch, Redirect, useParams } from "react-router-dom";
5
5
  import { H5, P } from "../Typography";
6
6
  import Box from "../Box";
7
7
  import { far } from "@fortawesome/free-regular-svg-icons";
@@ -59,46 +59,59 @@ const PageCard = _ref2 => {
59
59
  });
60
60
  };
61
61
  const SideBarWithConfig = () => {
62
- const isHome = useMatch("/");
63
- const isProfile = useMatch("/profile");
64
- const isSearch = useMatch("/search");
62
+ const location = useLocation();
65
63
  const items = [{
66
64
  iconName: "building",
67
65
  name: "Home",
68
66
  component: makeLinkComponent("/"),
69
67
  actionType: "link",
70
- isActive: !!isHome
68
+ isActive: matchPath(location.pathname, {
69
+ path: "/",
70
+ exact: true
71
+ })
71
72
  }, {
72
73
  iconName: "user",
73
74
  name: "My profile",
74
75
  component: makeLinkComponent("/profile"),
75
76
  actionType: "link",
76
- isActive: !!isProfile
77
+ isActive: matchPath(location.pathname, {
78
+ path: "/profile"
79
+ })
77
80
  }, {
78
81
  iconName: "id-card",
79
82
  name: "Search Page",
80
83
  component: makeLinkComponent("/search"),
81
84
  actionType: "link",
82
- isActive: isSearch
85
+ isActive: matchPath(location.pathname, {
86
+ path: "/search"
87
+ })
83
88
  }, {
84
89
  iconName: "snowflake",
85
90
  name: "Filter",
86
- hide: !isSearch,
91
+ hide: !matchPath(location.pathname, {
92
+ path: "/search"
93
+ }),
87
94
  // Specify hide if you want to hide this item
88
95
  component: makePanelComponent("Filter"),
89
96
  actionType: "component",
90
97
  // Use 'component' for a component
91
- pageSpecific: isSearch,
98
+ pageSpecific: matchPath(location.pathname, {
99
+ path: "/search"
100
+ }),
92
101
  isExpandedByDefault: true
93
102
  }, {
94
103
  iconName: "sun",
95
104
  name: "People",
96
- hide: !isProfile,
105
+ hide: !matchPath(location.pathname, {
106
+ path: "/profile"
107
+ }),
97
108
  // Specify hide if you want to hide this item
98
109
  component: makePanelComponent("People"),
99
110
  actionType: "component",
100
111
  // Use 'component' for a component
101
- pageSpecific: isProfile,
112
+ pageSpecific: matchPath(location.pathname, {
113
+ path: "/profile"
114
+ }),
102
115
  isExpandedByDefault: true
103
116
  }, {
104
117
  iconName: "bell",
@@ -159,32 +172,30 @@ const SideBarWithConfig = () => {
159
172
  children: [/*#__PURE__*/_jsx(SideNav, {
160
173
  items: items,
161
174
  sideNavHeight: "500px"
162
- }), /*#__PURE__*/_jsxs(Routes, {
175
+ }), /*#__PURE__*/_jsxs(Switch, {
163
176
  children: [/*#__PURE__*/_jsx(Route, {
177
+ exact: true,
164
178
  path: "/",
165
- element: /*#__PURE__*/_jsx(PageCard, {
179
+ children: /*#__PURE__*/_jsx(PageCard, {
166
180
  children: /*#__PURE__*/_jsx("div", {
167
181
  children: "Home"
168
182
  })
169
183
  })
170
184
  }), /*#__PURE__*/_jsx(Route, {
171
185
  path: "/profile",
172
- element: /*#__PURE__*/_jsx(PageCard, {
186
+ children: /*#__PURE__*/_jsx(PageCard, {
173
187
  children: /*#__PURE__*/_jsx("div", {
174
188
  children: "Profile route"
175
189
  })
176
190
  })
177
191
  }), /*#__PURE__*/_jsx(Route, {
178
192
  path: "/teams/:teamId",
179
- element: /*#__PURE__*/_jsx(PageCard, {
193
+ children: /*#__PURE__*/_jsx(PageCard, {
180
194
  children: /*#__PURE__*/_jsx(Teams, {})
181
195
  })
182
- }), /*#__PURE__*/_jsx(Route, {
183
- path: "/iframe.html",
184
- element: /*#__PURE__*/_jsx(Navigate, {
185
- to: "/",
186
- replace: true
187
- })
196
+ }), /*#__PURE__*/_jsx(Redirect, {
197
+ from: "/iframe.html",
198
+ to: "/"
188
199
  })]
189
200
  })]
190
201
  });
@@ -3,7 +3,7 @@ import StyledLink from ".";
3
3
  import Box from "../Box";
4
4
  import Flex from "../Flex";
5
5
  import Spacer from "../Spacer";
6
- import { BrowserRouter, Route, Routes } from "react-router-dom";
6
+ import { BrowserRouter, Route, Switch } from "react-router-dom";
7
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  export default {
9
9
  title: "Components/StyledLink",
@@ -72,10 +72,11 @@ export const reactLink = () => /*#__PURE__*/_jsxs(BrowserRouter, {
72
72
  children: [routes.map(route => /*#__PURE__*/_jsx(StyledLink, {
73
73
  to: route.path,
74
74
  children: route.label
75
- }, route.path)), /*#__PURE__*/_jsx(Routes, {
75
+ }, route.path)), /*#__PURE__*/_jsx(Switch, {
76
76
  children: routes.map(route => /*#__PURE__*/_jsx(Route, {
77
77
  path: route.path,
78
- element: /*#__PURE__*/_jsxs("div", {
78
+ exact: route.exact,
79
+ children: /*#__PURE__*/_jsxs("div", {
79
80
  style: {
80
81
  padding: "100px"
81
82
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orcs-design-system",
3
- "version": "3.2.39",
3
+ "version": "3.2.40",
4
4
  "engines": {
5
5
  "node": "20.12.2"
6
6
  },
@@ -66,7 +66,7 @@
66
66
  "react-intersection-observer": "^9.4.3",
67
67
  "react-moment-proptypes": "^1.8.1",
68
68
  "react-number-format": "^5.3.0",
69
- "react-router-dom": "^6.26.2",
69
+ "react-router-dom": "^5.3.4",
70
70
  "react-select": "^5.7.4",
71
71
  "styled-system": "^5.1.5"
72
72
  },