@servicetitan/link-item 31.2.0 → 32.0.0
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 +1 -0
- package/dist/index.js.map +1 -1
- package/dist/sidenav-link-item.js +26 -5
- package/dist/sidenav-link-item.js.map +1 -1
- package/dist/tab-link-item.js +23 -5
- package/dist/tab-link-item.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './sidenav-link-item';\nexport * from './tab-link-item';\n"],"names":[],"mappings":"AAAA,cAAc,sBAAsB;AACpC,cAAc,kBAAkB"}
|
|
@@ -2,12 +2,33 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo, useCallback } from 'react';
|
|
3
3
|
import { withRouter, matchPath } from 'react-router-dom';
|
|
4
4
|
import { SideNav } from '@servicetitan/design-system';
|
|
5
|
-
const SideNavLinkItemUnwrapped = ({ exact, pathname, search, className, children, history
|
|
6
|
-
const href = useMemo(()
|
|
7
|
-
|
|
5
|
+
const SideNavLinkItemUnwrapped = ({ exact, pathname, search, className, children, history })=>{
|
|
6
|
+
const href = useMemo(()=>history.createHref({
|
|
7
|
+
pathname,
|
|
8
|
+
search
|
|
9
|
+
}), [
|
|
10
|
+
history,
|
|
11
|
+
pathname,
|
|
12
|
+
search
|
|
13
|
+
]);
|
|
14
|
+
const handleClick = useCallback(()=>{
|
|
8
15
|
history.push(pathname + (search !== null && search !== void 0 ? search : ''));
|
|
9
|
-
}, [
|
|
10
|
-
|
|
16
|
+
}, [
|
|
17
|
+
history,
|
|
18
|
+
pathname,
|
|
19
|
+
search
|
|
20
|
+
]);
|
|
21
|
+
return /*#__PURE__*/ _jsx(SideNav.Item, {
|
|
22
|
+
href: href,
|
|
23
|
+
active: !!matchPath(history.location.pathname, {
|
|
24
|
+
exact,
|
|
25
|
+
path: pathname
|
|
26
|
+
}),
|
|
27
|
+
onClick: handleClick,
|
|
28
|
+
className: className,
|
|
29
|
+
children: children
|
|
30
|
+
});
|
|
11
31
|
};
|
|
12
32
|
export const SideNavLinkItem = withRouter(SideNavLinkItemUnwrapped);
|
|
33
|
+
|
|
13
34
|
//# sourceMappingURL=sidenav-link-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/sidenav-link-item.tsx"],"sourcesContent":["import { useMemo, useCallback, FC, PropsWithChildren } from 'react';\nimport { withRouter, RouteComponentProps, matchPath } from 'react-router-dom';\n\nimport { SideNav } from '@servicetitan/design-system';\n\ninterface SideNavLinkItemProps extends PropsWithChildren<{}> {\n exact?: boolean;\n pathname: string;\n search?: string;\n className?: string;\n}\n\nconst SideNavLinkItemUnwrapped: FC<SideNavLinkItemProps & RouteComponentProps> = ({\n exact,\n pathname,\n search,\n className,\n children,\n history,\n}) => {\n const href = useMemo(\n () => history.createHref({ pathname, search }),\n [history, pathname, search]\n );\n\n const handleClick = useCallback(() => {\n history.push(pathname + (search ?? ''));\n }, [history, pathname, search]);\n\n return (\n <SideNav.Item\n href={href}\n active={!!matchPath(history.location.pathname, { exact, path: pathname })}\n onClick={handleClick}\n className={className}\n >\n {children}\n </SideNav.Item>\n );\n};\n\nexport const SideNavLinkItem = withRouter(SideNavLinkItemUnwrapped);\n"],"names":["useMemo","useCallback","withRouter","matchPath","SideNav","SideNavLinkItemUnwrapped","exact","pathname","search","className","children","history","href","createHref","handleClick","push","Item","active","location","path","onClick","SideNavLinkItem"],"mappings":";AAAA,SAASA,OAAO,EAAEC,WAAW,QAA+B,QAAQ;AACpE,SAASC,UAAU,EAAuBC,SAAS,QAAQ,mBAAmB;AAE9E,SAASC,OAAO,QAAQ,8BAA8B;AAStD,MAAMC,2BAA2E,CAAC,EAC9EC,KAAK,EACLC,QAAQ,EACRC,MAAM,EACNC,SAAS,EACTC,QAAQ,EACRC,OAAO,EACV;IACG,MAAMC,OAAOZ,QACT,IAAMW,QAAQE,UAAU,CAAC;YAAEN;YAAUC;QAAO,IAC5C;QAACG;QAASJ;QAAUC;KAAO;IAG/B,MAAMM,cAAcb,YAAY;QAC5BU,QAAQI,IAAI,CAACR,WAAYC,CAAAA,mBAAAA,oBAAAA,SAAU,EAAC;IACxC,GAAG;QAACG;QAASJ;QAAUC;KAAO;IAE9B,qBACI,KAACJ,QAAQY,IAAI;QACTJ,MAAMA;QACNK,QAAQ,CAAC,CAACd,UAAUQ,QAAQO,QAAQ,CAACX,QAAQ,EAAE;YAAED;YAAOa,MAAMZ;QAAS;QACvEa,SAASN;QACTL,WAAWA;kBAEVC;;AAGb;AAEA,OAAO,MAAMW,kBAAkBnB,WAAWG,0BAA0B"}
|
package/dist/tab-link-item.js
CHANGED
|
@@ -2,12 +2,30 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo, useCallback } from 'react';
|
|
3
3
|
import { withRouter, matchPath } from 'react-router-dom';
|
|
4
4
|
import { Tab } from '@servicetitan/design-system';
|
|
5
|
-
const TabLinkItemUnwrapped = ({ exact, pathname, className, children, history
|
|
6
|
-
const href = useMemo(()
|
|
7
|
-
|
|
5
|
+
const TabLinkItemUnwrapped = ({ exact, pathname, className, children, history })=>{
|
|
6
|
+
const href = useMemo(()=>history.createHref({
|
|
7
|
+
pathname
|
|
8
|
+
}), [
|
|
9
|
+
history,
|
|
10
|
+
pathname
|
|
11
|
+
]);
|
|
12
|
+
const handleClick = useCallback(()=>{
|
|
8
13
|
history.push(pathname);
|
|
9
|
-
}, [
|
|
10
|
-
|
|
14
|
+
}, [
|
|
15
|
+
history,
|
|
16
|
+
pathname
|
|
17
|
+
]);
|
|
18
|
+
return /*#__PURE__*/ _jsx(Tab, {
|
|
19
|
+
href: href,
|
|
20
|
+
active: !!matchPath(history.location.pathname, {
|
|
21
|
+
exact,
|
|
22
|
+
path: pathname
|
|
23
|
+
}),
|
|
24
|
+
onClick: handleClick,
|
|
25
|
+
className: className,
|
|
26
|
+
children: children
|
|
27
|
+
});
|
|
11
28
|
};
|
|
12
29
|
export const TabLinkItem = withRouter(TabLinkItemUnwrapped);
|
|
30
|
+
|
|
13
31
|
//# sourceMappingURL=tab-link-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/tab-link-item.tsx"],"sourcesContent":["import { useMemo, useCallback, FC, PropsWithChildren } from 'react';\nimport { withRouter, RouteComponentProps, matchPath } from 'react-router-dom';\n\nimport { Tab } from '@servicetitan/design-system';\n\ninterface TabLinkItemProps extends PropsWithChildren<{}> {\n exact?: boolean;\n pathname: string;\n className?: string;\n}\n\nconst TabLinkItemUnwrapped: FC<TabLinkItemProps & RouteComponentProps> = ({\n exact,\n pathname,\n className,\n children,\n history,\n}) => {\n const href = useMemo(() => history.createHref({ pathname }), [history, pathname]);\n\n const handleClick = useCallback(() => {\n history.push(pathname);\n }, [history, pathname]);\n\n return (\n <Tab\n href={href}\n active={!!matchPath(history.location.pathname, { exact, path: pathname })}\n onClick={handleClick}\n className={className}\n >\n {children}\n </Tab>\n );\n};\n\nexport const TabLinkItem = withRouter(TabLinkItemUnwrapped);\n"],"names":["useMemo","useCallback","withRouter","matchPath","Tab","TabLinkItemUnwrapped","exact","pathname","className","children","history","href","createHref","handleClick","push","active","location","path","onClick","TabLinkItem"],"mappings":";AAAA,SAASA,OAAO,EAAEC,WAAW,QAA+B,QAAQ;AACpE,SAASC,UAAU,EAAuBC,SAAS,QAAQ,mBAAmB;AAE9E,SAASC,GAAG,QAAQ,8BAA8B;AAQlD,MAAMC,uBAAmE,CAAC,EACtEC,KAAK,EACLC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,OAAO,EACV;IACG,MAAMC,OAAOX,QAAQ,IAAMU,QAAQE,UAAU,CAAC;YAAEL;QAAS,IAAI;QAACG;QAASH;KAAS;IAEhF,MAAMM,cAAcZ,YAAY;QAC5BS,QAAQI,IAAI,CAACP;IACjB,GAAG;QAACG;QAASH;KAAS;IAEtB,qBACI,KAACH;QACGO,MAAMA;QACNI,QAAQ,CAAC,CAACZ,UAAUO,QAAQM,QAAQ,CAACT,QAAQ,EAAE;YAAED;YAAOW,MAAMV;QAAS;QACvEW,SAASL;QACTL,WAAWA;kBAEVC;;AAGb;AAEA,OAAO,MAAMU,cAAcjB,WAAWG,sBAAsB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/link-item",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "32.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://docs.st.dev/docs/frontend/link-item",
|
|
6
6
|
"repository": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@types/history": "~4.7.10",
|
|
21
21
|
"@types/react": "~18.2.55",
|
|
22
22
|
"@types/react-router": "~5.1.17",
|
|
23
|
-
"react": "
|
|
23
|
+
"react": "^18.2.0",
|
|
24
24
|
"react-router-dom": "~5.3.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"cli": {
|
|
35
35
|
"webpack": false
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "511315cbee77cc7c60f20d0d86d24f69779c85ed"
|
|
38
38
|
}
|