@servicetitan/mpa-components 2.0.0 → 2.1.1

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/lib/components/brands/brand-card/actions-button-section.d.ts +1 -1
  3. package/lib/components/brands/brand-card/actions-button-section.d.ts.map +1 -1
  4. package/lib/components/brands/brand-card/actions-button-section.js +7 -8
  5. package/lib/components/brands/brand-card/actions-button-section.js.map +1 -1
  6. package/lib/components/brands/brand-card/brand-card.d.ts.map +1 -1
  7. package/lib/components/brands/brand-card/brand-card.js +3 -5
  8. package/lib/components/brands/brand-card/brand-card.js.map +1 -1
  9. package/lib/components/brands/brand-card/info-section.d.ts +11 -0
  10. package/lib/components/brands/brand-card/info-section.d.ts.map +1 -0
  11. package/lib/components/brands/brand-card/info-section.js +4 -0
  12. package/lib/components/brands/brand-card/info-section.js.map +1 -0
  13. package/lib/components/brands/styles.module.less +0 -23
  14. package/package.json +2 -2
  15. package/src/components/brands/brand-card/actions-button-section.tsx +12 -25
  16. package/src/components/brands/brand-card/brand-card.tsx +16 -10
  17. package/src/components/brands/brand-card/info-section.tsx +32 -0
  18. package/src/components/brands/styles.module.less +0 -23
  19. package/src/components/brands/styles.module.less.d.ts +0 -4
  20. package/tsconfig.tsbuildinfo +1 -1
  21. package/lib/components/brands/brand-card/brand-logo.d.ts +0 -6
  22. package/lib/components/brands/brand-card/brand-logo.d.ts.map +0 -1
  23. package/lib/components/brands/brand-card/brand-logo.js +0 -8
  24. package/lib/components/brands/brand-card/brand-logo.js.map +0 -1
  25. package/lib/components/brands/brand-card/cart-tags.d.ts +0 -6
  26. package/lib/components/brands/brand-card/cart-tags.d.ts.map +0 -1
  27. package/lib/components/brands/brand-card/cart-tags.js +0 -10
  28. package/lib/components/brands/brand-card/cart-tags.js.map +0 -1
  29. package/lib/components/brands/brand-card/name-and-mail-section.d.ts +0 -7
  30. package/lib/components/brands/brand-card/name-and-mail-section.d.ts.map +0 -1
  31. package/lib/components/brands/brand-card/name-and-mail-section.js +0 -7
  32. package/lib/components/brands/brand-card/name-and-mail-section.js.map +0 -1
  33. package/src/components/brands/brand-card/brand-logo.tsx +0 -21
  34. package/src/components/brands/brand-card/cart-tags.tsx +0 -20
  35. package/src/components/brands/brand-card/name-and-mail-section.tsx +0 -28
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.1.1](https://github.com/servicetitan/marketing/compare/@servicetitan/mpa-components@2.1.0...@servicetitan/mpa-components@2.1.1) (2025-04-18)
7
+
8
+ **Note:** Version bump only for package @servicetitan/mpa-components
9
+
10
+
11
+
12
+
13
+
14
+ # [2.1.0](https://github.com/servicetitan/marketing/compare/@servicetitan/mpa-components@2.0.0...@servicetitan/mpa-components@2.1.0) (2025-04-17)
15
+
16
+ **Note:** Version bump only for package @servicetitan/mpa-components
17
+
18
+
19
+
20
+
21
+
6
22
  # [2.0.0](https://github.com/servicetitan/marketing/compare/@servicetitan/mpa-components@1.11.0...@servicetitan/mpa-components@2.0.0) (2025-04-10)
7
23
 
8
24
  **Note:** Version bump only for package @servicetitan/mpa-components
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  import { BrandAction } from '../../../utils/interfaces';
3
3
  export declare const ActionsButtonSection: FC<{
4
4
  actions: BrandAction | BrandAction[];
@@ -1 +1 @@
1
- {"version":3,"file":"actions-button-section.d.ts","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/actions-button-section.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AAMrC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC;IAClC,OAAO,EAAE,WAAW,GAAG,WAAW,EAAE,CAAC;CACxC,CAmDA,CAAC"}
1
+ {"version":3,"file":"actions-button-section.d.ts","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/actions-button-section.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAOhC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC;IAClC,OAAO,EAAE,WAAW,GAAG,WAAW,EAAE,CAAC;CACxC,CAqCA,CAAC"}
@@ -1,18 +1,17 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import { useHistory } from 'react-router-dom';
4
- import { ActionMenu, BodyText, Button, Icon } from '@servicetitan/design-system';
3
+ import { Menu } from '@servicetitan/anvil2';
4
+ import ExpandMoreIcon from '@servicetitan/anvil2/assets/icons/material/round/expand_more.svg';
5
5
  import { SingleActionButtonSection } from './single-action-button';
6
6
  export const ActionsButtonSection = ({ actions }) => {
7
- const [isOpen, setOpen] = useState(false);
8
7
  const history = useHistory();
9
8
  if (!Array.isArray(actions)) {
10
9
  return _jsx(SingleActionButtonSection, { action: actions });
11
10
  }
12
- const trigger = (_jsxs(Button, { outline: true, size: "small", onClick: () => setOpen(true), className: "qa-brand-card-actions-trigger", children: ["Actions ", _jsx(Icon, { name: "keyboard_arrow_down", size: 16 })] }));
13
- return (_jsx(ActionMenu, { trigger: trigger, open: isOpen, onClickOutside: () => setOpen(false), direction: "bl", className: "qa-brand-card-action-menu", children: actions.map(action => {
11
+ return (_jsx(Menu, { label: "Actions", className: "qa-brand-card-action-menu", size: "small",
12
+ // @ts-expect-error Menu icon API expects a raw component, but we're passing an object with 'after' per design, Anvil has ticket to fix it
13
+ icon: { after: ExpandMoreIcon }, children: actions.map(action => {
14
14
  const actionClick = () => {
15
- setOpen(false);
16
15
  if (action.action) {
17
16
  action.action();
18
17
  }
@@ -20,7 +19,7 @@ export const ActionsButtonSection = ({ actions }) => {
20
19
  history.push(action.href);
21
20
  }
22
21
  };
23
- return (_jsx(ActionMenu.Item, { disabled: action.disabled, onClick: actionClick, className: "qa-brand-card-action-menu-item", children: _jsx(BodyText, { subdued: action.disabled, children: action.name }) }, action.name));
22
+ return (_jsx(Menu.Item, { disabled: action.disabled, onClick: actionClick, className: "qa-brand-card-action-menu-item", label: action.name }, action.name));
24
23
  }) }));
25
24
  };
26
25
  //# sourceMappingURL=actions-button-section.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"actions-button-section.js","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/actions-button-section.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAEjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,MAAM,CAAC,MAAM,oBAAoB,GAE5B,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IACjB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAC,yBAAyB,IAAC,MAAM,EAAE,OAAO,GAAI,CAAC;IAC1D,CAAC;IAED,MAAM,OAAO,GAAG,CACZ,MAAC,MAAM,IACH,OAAO,QACP,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAC5B,SAAS,EAAC,+BAA+B,yBAEjC,KAAC,IAAI,IAAC,IAAI,EAAC,qBAAqB,EAAC,IAAI,EAAE,EAAE,GAAI,IAChD,CACZ,CAAC;IAEF,OAAO,CACH,KAAC,UAAU,IACP,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EACpC,SAAS,EAAC,IAAI,EACd,SAAS,EAAC,2BAA2B,YAEpC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;YAClB,MAAM,WAAW,GAAG,GAAG,EAAE;gBACrB,OAAO,CAAC,KAAK,CAAC,CAAC;gBACf,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;oBAChB,MAAM,CAAC,MAAM,EAAE,CAAC;gBACpB,CAAC;gBACD,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;oBACd,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBAC9B,CAAC;YACL,CAAC,CAAC;YAEF,OAAO,CACH,KAAC,UAAU,CAAC,IAAI,IACZ,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAEzB,OAAO,EAAE,WAAW,EACpB,SAAS,EAAC,gCAAgC,YAE1C,KAAC,QAAQ,IAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,YAAG,MAAM,CAAC,IAAI,GAAY,IAJvD,MAAM,CAAC,IAAI,CAKF,CACrB,CAAC;QACN,CAAC,CAAC,GACO,CAChB,CAAC;AACN,CAAC,CAAC"}
1
+ {"version":3,"file":"actions-button-section.js","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/actions-button-section.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,cAAc,MAAM,kEAAkE,CAAC;AAE9F,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,MAAM,CAAC,MAAM,oBAAoB,GAE5B,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IACjB,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAC,yBAAyB,IAAC,MAAM,EAAE,OAAO,GAAI,CAAC;IAC1D,CAAC;IAED,OAAO,CACH,KAAC,IAAI,IACD,KAAK,EAAC,SAAS,EACf,SAAS,EAAC,2BAA2B,EACrC,IAAI,EAAC,OAAO;QACZ,0IAA0I;QAC1I,IAAI,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,YAE9B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;YAClB,MAAM,WAAW,GAAG,GAAG,EAAE;gBACrB,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;oBAChB,MAAM,CAAC,MAAM,EAAE,CAAC;gBACpB,CAAC;gBACD,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;oBACd,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBAC9B,CAAC;YACL,CAAC,CAAC;YAEF,OAAO,CACH,KAAC,IAAI,CAAC,IAAI,IACN,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAEzB,OAAO,EAAE,WAAW,EACpB,SAAS,EAAC,gCAAgC,EAC1C,KAAK,EAAE,MAAM,CAAC,IAAI,IAHb,MAAM,CAAC,IAAI,CAIlB,CACL,CAAC;QACN,CAAC,CAAC,GACC,CACV,CAAC;AACN,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"brand-card.d.ts","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/brand-card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAM3B,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAS3D,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAuCxC,CAAC"}
1
+ {"version":3,"file":"brand-card.d.ts","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/brand-card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAK3B,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAQ3D,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CA+CxC,CAAC"}
@@ -1,16 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import classNames from 'classnames';
3
- import { Flex, Card } from '@servicetitan/anvil2';
4
- import { NameAndMailSection } from './name-and-mail-section';
3
+ import { Flex, Card, Avatar } from '@servicetitan/anvil2';
5
4
  import { ActionsButtonSection } from './actions-button-section';
6
- import { CardTags } from './cart-tags';
7
- import { BrandLogo } from './brand-logo';
5
+ import { InfoSection } from './info-section';
8
6
  import * as Styles from '../styles.module.less';
9
7
  const BRAND_NAME_PLACEHOLDER = 'Assign Brand Name';
10
8
  export const BrandCard = ({ actions, email, isDefault, isShared, logo, name, hasError, }) => {
11
9
  const nameToShow = name || BRAND_NAME_PLACEHOLDER;
12
10
  return (_jsx(Card, { className: classNames({
13
11
  [Styles.cardWithError]: hasError,
14
- }, Styles.brandCard, 'qa-brand-card'), padding: "large", children: _jsxs(Flex, { className: Styles.cardContent, justifyContent: "space-between", direction: "column", children: [_jsxs(Flex, { justifyContent: "space-between", alignItems: "flex-start", className: "qa-brand-card-left-section", children: [_jsx(BrandLogo, { logo: logo, alt: nameToShow }), _jsx(ActionsButtonSection, { actions: actions })] }), _jsxs(Flex, { justifyContent: "space-between", children: [_jsx(NameAndMailSection, { name: name, nameToShow: nameToShow, email: email }), _jsx(CardTags, { isDefault: isDefault, isShared: isShared })] })] }) }));
12
+ }, Styles.brandCard, 'qa-brand-card'), padding: "large", children: _jsxs(Flex, { className: Styles.cardContent, justifyContent: "space-between", direction: "column", gap: "6", children: [_jsxs(Flex, { justifyContent: "space-between", alignItems: "flex-start", className: "qa-brand-card-left-section", children: [_jsx(Avatar, { image: logo, name: nameToShow, size: "large" }), _jsx(ActionsButtonSection, { actions: actions })] }), _jsx(InfoSection, { name: name, nameToShow: nameToShow, email: email, isDefault: isDefault, isShared: isShared })] }) }));
15
13
  };
16
14
  //# sourceMappingURL=brand-card.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"brand-card.js","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/brand-card.tsx"],"names":[],"mappings":";AACA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAEnD,MAAM,CAAC,MAAM,SAAS,GAAuB,CAAC,EAC1C,OAAO,EACP,KAAK,EACL,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,QAAQ,GACX,EAAE,EAAE;IACD,MAAM,UAAU,GAAG,IAAI,IAAI,sBAAsB,CAAC;IAElD,OAAO,CACH,KAAC,IAAI,IACD,SAAS,EAAE,UAAU,CACjB;YACI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,QAAQ;SACnC,EACD,MAAM,CAAC,SAAS,EAChB,eAAe,CAClB,EACD,OAAO,EAAC,OAAO,YAEf,MAAC,IAAI,IAAC,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,cAAc,EAAC,eAAe,EAAC,SAAS,EAAC,QAAQ,aAClF,MAAC,IAAI,IACD,cAAc,EAAC,eAAe,EAC9B,UAAU,EAAC,YAAY,EACvB,SAAS,EAAC,4BAA4B,aAEtC,KAAC,SAAS,IAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,GAAI,EAC1C,KAAC,oBAAoB,IAAC,OAAO,EAAE,OAAO,GAAI,IACvC,EAEP,MAAC,IAAI,IAAC,cAAc,EAAC,eAAe,aAChC,KAAC,kBAAkB,IAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,GAAI,EACxE,KAAC,QAAQ,IAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAI,IACnD,IACJ,GACJ,CACV,CAAC;AACN,CAAC,CAAC"}
1
+ {"version":3,"file":"brand-card.js","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/brand-card.tsx"],"names":[],"mappings":";AACA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAEnD,MAAM,CAAC,MAAM,SAAS,GAAuB,CAAC,EAC1C,OAAO,EACP,KAAK,EACL,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,QAAQ,GACX,EAAE,EAAE;IACD,MAAM,UAAU,GAAG,IAAI,IAAI,sBAAsB,CAAC;IAElD,OAAO,CACH,KAAC,IAAI,IACD,SAAS,EAAE,UAAU,CACjB;YACI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,QAAQ;SACnC,EACD,MAAM,CAAC,SAAS,EAChB,eAAe,CAClB,EACD,OAAO,EAAC,OAAO,YAEf,MAAC,IAAI,IACD,SAAS,EAAE,MAAM,CAAC,WAAW,EAC7B,cAAc,EAAC,eAAe,EAC9B,SAAS,EAAC,QAAQ,EAClB,GAAG,EAAC,GAAG,aAEP,MAAC,IAAI,IACD,cAAc,EAAC,eAAe,EAC9B,UAAU,EAAC,YAAY,EACvB,SAAS,EAAC,4BAA4B,aAEtC,KAAC,MAAM,IAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAC,OAAO,GAAG,EACtD,KAAC,oBAAoB,IAAC,OAAO,EAAE,OAAO,GAAI,IACvC,EAEP,KAAC,WAAW,IACR,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,GACpB,IACC,GACJ,CACV,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { FC } from 'react';
2
+ interface InfoSectionProps {
3
+ nameToShow: string;
4
+ name?: string;
5
+ email?: string;
6
+ isDefault?: boolean;
7
+ isShared?: boolean;
8
+ }
9
+ export declare const InfoSection: FC<InfoSectionProps>;
10
+ export {};
11
+ //# sourceMappingURL=info-section.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"info-section.d.ts","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/info-section.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,UAAU,gBAAgB;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAmB5C,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Chip, Flex, Text } from '@servicetitan/anvil2';
3
+ export const InfoSection = ({ nameToShow, email, isDefault, isShared }) => (_jsx(Flex, { direction: "column", gap: "4", children: _jsxs(Flex, { direction: "column", gap: "1", children: [_jsxs(Flex, { gap: "2", alignItems: "center", children: [_jsx(Text, { className: "t-truncate-i m-0", title: nameToShow, variant: "headline", el: "h3", children: nameToShow }), _jsxs(Flex, { gap: "1", children: [isDefault && _jsx(Chip, { label: "Default" }), isShared && _jsx(Chip, { color: "#b5deff", label: "Corporate HQ" })] })] }), email && (_jsx(Text, { subdued: true, title: email, className: "t-truncate-i", size: "small", children: email }))] }) }));
4
+ //# sourceMappingURL=info-section.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"info-section.js","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/info-section.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAUxD,MAAM,CAAC,MAAM,WAAW,GAAyB,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAC7F,KAAC,IAAI,IAAC,SAAS,EAAC,QAAQ,EAAC,GAAG,EAAC,GAAG,YAC5B,MAAC,IAAI,IAAC,SAAS,EAAC,QAAQ,EAAC,GAAG,EAAC,GAAG,aAC5B,MAAC,IAAI,IAAC,GAAG,EAAC,GAAG,EAAC,UAAU,EAAC,QAAQ,aAC7B,KAAC,IAAI,IAAC,SAAS,EAAC,kBAAkB,EAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAC,UAAU,EAAC,EAAE,EAAC,IAAI,YAC3E,UAAU,GACR,EACP,MAAC,IAAI,IAAC,GAAG,EAAC,GAAG,aACR,SAAS,IAAI,KAAC,IAAI,IAAC,KAAK,EAAC,SAAS,GAAG,EACrC,QAAQ,IAAI,KAAC,IAAI,IAAC,KAAK,EAAC,SAAS,EAAC,KAAK,EAAC,cAAc,GAAG,IACvD,IACJ,EACN,KAAK,IAAI,CACN,KAAC,IAAI,IAAC,OAAO,QAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAC,cAAc,EAAC,IAAI,EAAC,OAAO,YAC5D,KAAK,GACH,CACV,IACE,GACJ,CACV,CAAC"}
@@ -5,10 +5,6 @@
5
5
  @card-max-width: 700px;
6
6
  @max-number-of-cards: 3;
7
7
 
8
- .delete-tooltip {
9
- min-width: 327px;
10
- }
11
-
12
8
  .grid {
13
9
  grid-template-columns: repeat(auto-fill, minmax(@card-min-width, 1fr));
14
10
  max-width: calc(@card-max-width * @max-number-of-cards + @spacing-3 * 2);
@@ -27,7 +23,6 @@
27
23
  }
28
24
 
29
25
  .brand-card {
30
- height: 200px;
31
26
  min-width: @card-min-width;
32
27
  max-width: @card-max-width;
33
28
  }
@@ -36,24 +31,6 @@
36
31
  width: 100%;
37
32
  }
38
33
 
39
- .card-left-section-texts {
40
- min-width: 0;
41
- }
42
-
43
- .brand-img {
44
- width: @spacing-6;
45
- height: @spacing-6;
46
- min-width: @spacing-6;
47
- min-height: @spacing-6;
48
- border-radius: @border-radius-circular;
49
- border: solid 1px @color-neutral-60;
50
- }
51
-
52
- .brand-img-placeholder {
53
- .brand-img();
54
- background-color: @color-neutral-60;
55
- }
56
-
57
34
  .card-with-error {
58
35
  border-color: @color-red-500;
59
36
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "repository": {
4
4
  "url": "https://github.com/servicetitan/marketing"
5
5
  },
6
- "version": "2.0.0",
6
+ "version": "2.1.1",
7
7
  "description": "",
8
8
  "main": "./lib/index.js",
9
9
  "typings": "./lib/index.d.ts",
@@ -34,5 +34,5 @@
34
34
  "cli": {
35
35
  "webpack": false
36
36
  },
37
- "gitHead": "45fb622e2875d33d9db1a15935ec8cb327bb5326"
37
+ "gitHead": "9e6c56f3f0868c39c727b8d3c3eefb4f68efacd5"
38
38
  }
@@ -1,7 +1,8 @@
1
- import { FC, useState } from 'react';
1
+ import type { FC } from 'react';
2
2
  import { useHistory } from 'react-router-dom';
3
3
 
4
- import { ActionMenu, BodyText, Button, Icon } from '@servicetitan/design-system';
4
+ import { Menu } from '@servicetitan/anvil2';
5
+ import ExpandMoreIcon from '@servicetitan/anvil2/assets/icons/material/round/expand_more.svg';
5
6
 
6
7
  import { SingleActionButtonSection } from './single-action-button';
7
8
  import { BrandAction } from '../../../utils/interfaces';
@@ -9,35 +10,22 @@ import { BrandAction } from '../../../utils/interfaces';
9
10
  export const ActionsButtonSection: FC<{
10
11
  actions: BrandAction | BrandAction[];
11
12
  }> = ({ actions }) => {
12
- const [isOpen, setOpen] = useState(false);
13
13
  const history = useHistory();
14
14
 
15
15
  if (!Array.isArray(actions)) {
16
16
  return <SingleActionButtonSection action={actions} />;
17
17
  }
18
18
 
19
- const trigger = (
20
- <Button
21
- outline
22
- size="small"
23
- onClick={() => setOpen(true)}
24
- className="qa-brand-card-actions-trigger"
25
- >
26
- Actions <Icon name="keyboard_arrow_down" size={16} />
27
- </Button>
28
- );
29
-
30
19
  return (
31
- <ActionMenu
32
- trigger={trigger}
33
- open={isOpen}
34
- onClickOutside={() => setOpen(false)}
35
- direction="bl"
20
+ <Menu
21
+ label="Actions"
36
22
  className="qa-brand-card-action-menu"
23
+ size="small"
24
+ // @ts-expect-error Menu icon API expects a raw component, but we're passing an object with 'after' per design, Anvil has ticket to fix it
25
+ icon={{ after: ExpandMoreIcon }}
37
26
  >
38
27
  {actions.map(action => {
39
28
  const actionClick = () => {
40
- setOpen(false);
41
29
  if (action.action) {
42
30
  action.action();
43
31
  }
@@ -47,16 +35,15 @@ export const ActionsButtonSection: FC<{
47
35
  };
48
36
 
49
37
  return (
50
- <ActionMenu.Item
38
+ <Menu.Item
51
39
  disabled={action.disabled}
52
40
  key={action.name}
53
41
  onClick={actionClick}
54
42
  className="qa-brand-card-action-menu-item"
55
- >
56
- <BodyText subdued={action.disabled}>{action.name}</BodyText>
57
- </ActionMenu.Item>
43
+ label={action.name}
44
+ />
58
45
  );
59
46
  })}
60
- </ActionMenu>
47
+ </Menu>
61
48
  );
62
49
  };
@@ -1,13 +1,11 @@
1
1
  import { FC } from 'react';
2
2
  import classNames from 'classnames';
3
3
 
4
- import { Flex, Card } from '@servicetitan/anvil2';
4
+ import { Flex, Card, Avatar } from '@servicetitan/anvil2';
5
5
 
6
- import { NameAndMailSection } from './name-and-mail-section';
7
6
  import { BrandCardProps } from '../../../utils/interfaces';
8
7
  import { ActionsButtonSection } from './actions-button-section';
9
- import { CardTags } from './cart-tags';
10
- import { BrandLogo } from './brand-logo';
8
+ import { InfoSection } from './info-section';
11
9
 
12
10
  import * as Styles from '../styles.module.less';
13
11
 
@@ -35,20 +33,28 @@ export const BrandCard: FC<BrandCardProps> = ({
35
33
  )}
36
34
  padding="large"
37
35
  >
38
- <Flex className={Styles.cardContent} justifyContent="space-between" direction="column">
36
+ <Flex
37
+ className={Styles.cardContent}
38
+ justifyContent="space-between"
39
+ direction="column"
40
+ gap="6"
41
+ >
39
42
  <Flex
40
43
  justifyContent="space-between"
41
44
  alignItems="flex-start"
42
45
  className="qa-brand-card-left-section"
43
46
  >
44
- <BrandLogo logo={logo} alt={nameToShow} />
47
+ <Avatar image={logo} name={nameToShow} size="large" />
45
48
  <ActionsButtonSection actions={actions} />
46
49
  </Flex>
47
50
 
48
- <Flex justifyContent="space-between">
49
- <NameAndMailSection name={name} nameToShow={nameToShow} email={email} />
50
- <CardTags isDefault={isDefault} isShared={isShared} />
51
- </Flex>
51
+ <InfoSection
52
+ name={name}
53
+ nameToShow={nameToShow}
54
+ email={email}
55
+ isDefault={isDefault}
56
+ isShared={isShared}
57
+ />
52
58
  </Flex>
53
59
  </Card>
54
60
  );
@@ -0,0 +1,32 @@
1
+ import type { FC } from 'react';
2
+
3
+ import { Chip, Flex, Text } from '@servicetitan/anvil2';
4
+
5
+ interface InfoSectionProps {
6
+ nameToShow: string;
7
+ name?: string;
8
+ email?: string;
9
+ isDefault?: boolean;
10
+ isShared?: boolean;
11
+ }
12
+
13
+ export const InfoSection: FC<InfoSectionProps> = ({ nameToShow, email, isDefault, isShared }) => (
14
+ <Flex direction="column" gap="4">
15
+ <Flex direction="column" gap="1">
16
+ <Flex gap="2" alignItems="center">
17
+ <Text className="t-truncate-i m-0" title={nameToShow} variant="headline" el="h3">
18
+ {nameToShow}
19
+ </Text>
20
+ <Flex gap="1">
21
+ {isDefault && <Chip label="Default" />}
22
+ {isShared && <Chip color="#b5deff" label="Corporate HQ" />}
23
+ </Flex>
24
+ </Flex>
25
+ {email && (
26
+ <Text subdued title={email} className="t-truncate-i" size="small">
27
+ {email}
28
+ </Text>
29
+ )}
30
+ </Flex>
31
+ </Flex>
32
+ );
@@ -5,10 +5,6 @@
5
5
  @card-max-width: 700px;
6
6
  @max-number-of-cards: 3;
7
7
 
8
- .delete-tooltip {
9
- min-width: 327px;
10
- }
11
-
12
8
  .grid {
13
9
  grid-template-columns: repeat(auto-fill, minmax(@card-min-width, 1fr));
14
10
  max-width: calc(@card-max-width * @max-number-of-cards + @spacing-3 * 2);
@@ -27,7 +23,6 @@
27
23
  }
28
24
 
29
25
  .brand-card {
30
- height: 200px;
31
26
  min-width: @card-min-width;
32
27
  max-width: @card-max-width;
33
28
  }
@@ -36,24 +31,6 @@
36
31
  width: 100%;
37
32
  }
38
33
 
39
- .card-left-section-texts {
40
- min-width: 0;
41
- }
42
-
43
- .brand-img {
44
- width: @spacing-6;
45
- height: @spacing-6;
46
- min-width: @spacing-6;
47
- min-height: @spacing-6;
48
- border-radius: @border-radius-circular;
49
- border: solid 1px @color-neutral-60;
50
- }
51
-
52
- .brand-img-placeholder {
53
- .brand-img();
54
- background-color: @color-neutral-60;
55
- }
56
-
57
34
  .card-with-error {
58
35
  border-color: @color-red-500;
59
36
  }
@@ -1,10 +1,6 @@
1
1
  export const __esModule: true;
2
2
  export const brandCard: string;
3
- export const brandImg: string;
4
- export const brandImgPlaceholder: string;
5
3
  export const cardContent: string;
6
- export const cardLeftSectionTexts: string;
7
4
  export const cardWithError: string;
8
- export const deleteTooltip: string;
9
5
  export const grid: string;
10
6