@servicetitan/link-item 21.4.0 → 21.6.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.
@@ -3,6 +3,7 @@ import { RouteComponentProps } from 'react-router-dom';
3
3
  interface SideNavLinkItemProps {
4
4
  exact?: boolean;
5
5
  pathname: string;
6
+ search?: string;
6
7
  className?: string;
7
8
  }
8
9
  export declare const SideNavLinkItem: import("react").ComponentClass<Pick<SideNavLinkItemProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>, keyof SideNavLinkItemProps>, any> & import("react-router").WithRouterStatics<FC<SideNavLinkItemProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>>;
@@ -1 +1 @@
1
- {"version":3,"file":"sidenav-link-item.d.ts","sourceRoot":"","sources":["../src/sidenav-link-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,EAAE,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAc,mBAAmB,EAAa,MAAM,kBAAkB,CAAC;AAI9E,UAAU,oBAAoB;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AA2BD,eAAO,MAAM,eAAe,oTAAuC,CAAC"}
1
+ {"version":3,"file":"sidenav-link-item.d.ts","sourceRoot":"","sources":["../src/sidenav-link-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,EAAE,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAc,mBAAmB,EAAa,MAAM,kBAAkB,CAAC;AAI9E,UAAU,oBAAoB;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AA+BD,eAAO,MAAM,eAAe,oTAAuC,CAAC"}
@@ -2,11 +2,11 @@ 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, className, children, history, }) => {
6
- const href = useMemo(() => history.createHref({ pathname }), [history, pathname]);
5
+ const SideNavLinkItemUnwrapped = ({ exact, pathname, search, className, children, history, }) => {
6
+ const href = useMemo(() => history.createHref({ pathname, search }), [history, pathname, search]);
7
7
  const handleClick = useCallback(() => {
8
- history.push(pathname);
9
- }, [history, pathname]);
8
+ history.push(pathname + (search !== null && search !== void 0 ? search : ''));
9
+ }, [history, pathname, search]);
10
10
  return (_jsx(SideNav.Item, Object.assign({ href: href, active: !!matchPath(history.location.pathname, { exact, path: pathname }), onClick: handleClick, className: className }, { children: children })));
11
11
  };
12
12
  export const SideNavLinkItem = withRouter(SideNavLinkItemUnwrapped);
@@ -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,EAAM,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,UAAU,EAAuB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAQtD,MAAM,wBAAwB,GAAmD,CAAC,EAC9E,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,EA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AAE,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,gBAEnB,QAAQ,IACE,CAClB,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC,wBAAwB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/link-item",
3
- "version": "21.4.0",
3
+ "version": "21.6.0",
4
4
  "description": "",
5
5
  "homepage": "https://docs.st.dev/docs/frontend/link-item",
6
6
  "repository": {
@@ -16,7 +16,7 @@
16
16
  "src"
17
17
  ],
18
18
  "devDependencies": {
19
- "@servicetitan/design-system": "~11.4.2",
19
+ "@servicetitan/design-system": "~11.6.0",
20
20
  "@types/history": "~4.7.10",
21
21
  "@types/react": "~17.0.38",
22
22
  "@types/react-router": "~5.1.17",
@@ -24,7 +24,7 @@
24
24
  "react-router-dom": "~5.3.0"
25
25
  },
26
26
  "peerDependencies": {
27
- "@servicetitan/design-system": "~11.4.2",
27
+ "@servicetitan/design-system": "~11.6.0",
28
28
  "react": "~17.0.2",
29
29
  "react-router-dom": "~5.3.0"
30
30
  },
@@ -34,5 +34,5 @@
34
34
  "cli": {
35
35
  "webpack": false
36
36
  },
37
- "gitHead": "45fd290071174c85e85bfc7396b8ccab7486b39e"
37
+ "gitHead": "1b89db23f0e18078ee310e95a760b34826893258"
38
38
  }
@@ -6,21 +6,26 @@ import { SideNav } from '@servicetitan/design-system';
6
6
  interface SideNavLinkItemProps {
7
7
  exact?: boolean;
8
8
  pathname: string;
9
+ search?: string;
9
10
  className?: string;
10
11
  }
11
12
 
12
13
  const SideNavLinkItemUnwrapped: FC<SideNavLinkItemProps & RouteComponentProps> = ({
13
14
  exact,
14
15
  pathname,
16
+ search,
15
17
  className,
16
18
  children,
17
19
  history,
18
20
  }) => {
19
- const href = useMemo(() => history.createHref({ pathname }), [history, pathname]);
21
+ const href = useMemo(
22
+ () => history.createHref({ pathname, search }),
23
+ [history, pathname, search]
24
+ );
20
25
 
21
26
  const handleClick = useCallback(() => {
22
- history.push(pathname);
23
- }, [history, pathname]);
27
+ history.push(pathname + (search ?? ''));
28
+ }, [history, pathname, search]);
24
29
 
25
30
  return (
26
31
  <SideNav.Item