@teambit/ui-foundation.ui.react-router.slot-router 0.0.498 → 0.0.500
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/{preview-1669911866429.js → preview-1670470092710.js} +0 -0
- package/dist/slot-router.d.ts +7 -2
- package/dist/slot-router.js +2 -2
- package/dist/slot-router.js.map +1 -1
- package/package-tar/teambit-ui-foundation.ui.react-router.slot-router-0.0.500.tgz +0 -0
- package/package.json +4 -2
- package/slot-router.tsx +8 -3
- package/package-tar/teambit-ui-foundation.ui.react-router.slot-router-0.0.498.tgz +0 -0
|
File without changes
|
package/dist/slot-router.d.ts
CHANGED
|
@@ -5,8 +5,13 @@ import type { LinkProps } from '@teambit/base-react.navigation.link';
|
|
|
5
5
|
export declare type RouteSlot = SlotRegistry<RouteProps | RouteProps[]>;
|
|
6
6
|
export declare type NavigationSlot = SlotRegistry<LinkProps>;
|
|
7
7
|
export declare type SlotRouterProps = PropsWithChildren<{
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated
|
|
10
|
+
* use @property routes to pass list of routes instead
|
|
11
|
+
*/
|
|
12
|
+
slot?: RouteSlot;
|
|
13
|
+
routes?: RouteProps[];
|
|
9
14
|
rootRoutes?: RouteProps[];
|
|
10
15
|
parentPath?: string;
|
|
11
16
|
}>;
|
|
12
|
-
export declare function SlotRouter({ slot, rootRoutes, children, parentPath }: SlotRouterProps): JSX.Element;
|
|
17
|
+
export declare function SlotRouter({ routes: routesFromProps, slot, rootRoutes, children, parentPath }: SlotRouterProps): JSX.Element;
|
package/dist/slot-router.js
CHANGED
|
@@ -7,8 +7,8 @@ exports.SlotRouter = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const react_router_dom_1 = require("react-router-dom");
|
|
9
9
|
const lodash_1 = require("lodash");
|
|
10
|
-
function SlotRouter({ slot, rootRoutes, children, parentPath }) {
|
|
11
|
-
const routes = (0, lodash_1.flatten)(slot.values());
|
|
10
|
+
function SlotRouter({ routes: routesFromProps, slot, rootRoutes, children, parentPath }) {
|
|
11
|
+
const routes = routesFromProps || (slot && (0, lodash_1.flatten)(slot.values())) || [];
|
|
12
12
|
const withRoot = routes.concat(rootRoutes || []);
|
|
13
13
|
const jsxRoutes = withRoot.map((route) => react_1.default.createElement(react_router_dom_1.Route, Object.assign({ key: toKey(route) }, route)));
|
|
14
14
|
if (parentPath) {
|
package/dist/slot-router.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot-router.js","sourceRoot":"","sources":["../slot-router.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAiD;AAEjD,uDAA6D;AAC7D,mCAAiC;
|
|
1
|
+
{"version":3,"file":"slot-router.js","sourceRoot":"","sources":["../slot-router.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAiD;AAEjD,uDAA6D;AAC7D,mCAAiC;AAiBjC,SAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAmB;IAC7G,MAAM,MAAM,GAAG,eAAe,IAAI,CAAC,IAAI,IAAI,IAAA,gBAAO,EAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACzE,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;IAEjD,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,8BAAC,wBAAK,kBAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,IAAM,KAAK,EAAI,CAAC,CAAC;IAEnF,IAAI,UAAU,EAAE;QACd,OAAO,CACL,8BAAC,yBAAM;YACL,8BAAC,wBAAK,IAAC,IAAI,EAAE,UAAU;gBACpB,SAAS;gBACT,QAAQ,CACH,CACD,CACV,CAAC;KACH;IAED,OAAO,CACL,8BAAC,yBAAM;QACL,8BAAC,wBAAK,IAAC,IAAI,EAAE,UAAU;YACpB,SAAS;YACT,QAAQ,CACH,CACD,CACV,CAAC;AACJ,CAAC;AAzBD,gCAyBC;AAED,SAAS,KAAK,CAAC,KAAiB;IAC9B,IAAI,KAAK,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC;IAClC,IAAI,KAAK,CAAC,KAAK;QAAE,OAAO,GAAG,CAAC;IAC5B,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/ui-foundation.ui.react-router.slot-router",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.500",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/ui-foundation/ui/react-router/slot-router",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.ui-foundation",
|
|
8
8
|
"name": "ui/react-router/slot-router",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.500"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"lodash": "4.17.21",
|
|
13
|
+
"core-js": "^3.0.0",
|
|
13
14
|
"@teambit/base-react.navigation.link": "2.0.27",
|
|
14
15
|
"@teambit/harmony": "0.3.3"
|
|
15
16
|
},
|
|
@@ -18,6 +19,7 @@
|
|
|
18
19
|
"@types/react": "^17.0.8",
|
|
19
20
|
"@types/mocha": "9.1.0",
|
|
20
21
|
"@types/testing-library__jest-dom": "5.9.5",
|
|
22
|
+
"@babel/runtime": "7.20.0",
|
|
21
23
|
"@types/jest": "^26.0.0",
|
|
22
24
|
"@types/react-dom": "^17.0.5",
|
|
23
25
|
"@types/node": "12.20.4"
|
package/slot-router.tsx
CHANGED
|
@@ -8,13 +8,18 @@ export type RouteSlot = SlotRegistry<RouteProps | RouteProps[]>;
|
|
|
8
8
|
export type NavigationSlot = SlotRegistry<LinkProps>;
|
|
9
9
|
|
|
10
10
|
export type SlotRouterProps = PropsWithChildren<{
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated
|
|
13
|
+
* use @property routes to pass list of routes instead
|
|
14
|
+
*/
|
|
15
|
+
slot?: RouteSlot;
|
|
16
|
+
routes?: RouteProps[];
|
|
12
17
|
rootRoutes?: RouteProps[];
|
|
13
18
|
parentPath?: string;
|
|
14
19
|
}>;
|
|
15
20
|
|
|
16
|
-
export function SlotRouter({ slot, rootRoutes, children, parentPath }: SlotRouterProps) {
|
|
17
|
-
const routes = flatten(slot.values());
|
|
21
|
+
export function SlotRouter({ routes: routesFromProps, slot, rootRoutes, children, parentPath }: SlotRouterProps) {
|
|
22
|
+
const routes = routesFromProps || (slot && flatten(slot.values())) || [];
|
|
18
23
|
const withRoot = routes.concat(rootRoutes || []);
|
|
19
24
|
|
|
20
25
|
const jsxRoutes = withRoot.map((route) => <Route key={toKey(route)} {...route} />);
|