@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 CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './sidenav-link-item';
2
2
  export * from './tab-link-item';
3
+
3
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
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(() => history.createHref({ pathname, search }), [history, pathname, search]);
7
- const handleClick = useCallback(() => {
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
- }, [history, pathname, search]);
10
- return (_jsx(SideNav.Item, { href: href, active: !!matchPath(history.location.pathname, { exact, path: pathname }), onClick: handleClick, className: className, children: children }));
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,"file":"sidenav-link-item.js","sourceRoot":"","sources":["../src/sidenav-link-item.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAyB,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,UAAU,EAAuB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAStD,MAAM,wBAAwB,GAAmD,CAAC,EAC9E,KAAK,EACL,QAAQ,EACR,MAAM,EACN,SAAS,EACT,QAAQ,EACR,OAAO,GACV,EAAE,EAAE;IACD,MAAM,IAAI,GAAG,OAAO,CAChB,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,EAC9C,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAC9B,CAAC;IAEF,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE;QACjC,OAAO,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IAEhC,OAAO,CACH,KAAC,OAAO,CAAC,IAAI,IACT,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EACzE,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,SAAS,YAEnB,QAAQ,GACE,CAClB,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC,wBAAwB,CAAC,CAAC"}
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"}
@@ -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(() => history.createHref({ pathname }), [history, pathname]);
7
- const handleClick = useCallback(() => {
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
- }, [history, pathname]);
10
- return (_jsx(Tab, { href: href, active: !!matchPath(history.location.pathname, { exact, path: pathname }), onClick: handleClick, className: className, children: children }));
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,"file":"tab-link-item.js","sourceRoot":"","sources":["../src/tab-link-item.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAyB,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,UAAU,EAAuB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAQlD,MAAM,oBAAoB,GAA+C,CAAC,EACtE,KAAK,EACL,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,OAAO,GACV,EAAE,EAAE;IACD,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAElF,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE;QACjC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAExB,OAAO,CACH,KAAC,GAAG,IACA,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EACzE,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,SAAS,YAEnB,QAAQ,GACP,CACT,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC"}
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": "31.2.0",
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": "~18.2.0",
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": "03cfa4dc1e3cb374c8593f568ae47d0996ac7bae"
37
+ "gitHead": "511315cbee77cc7c60f20d0d86d24f69779c85ed"
38
38
  }