@servicetitan/navigation 13.2.0 → 13.3.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/components/logo/logo-titan.js +1 -3
- package/dist/components/logo/logo-titan.js.map +1 -1
- package/dist/components/profile-dropdown/interface.d.ts +1 -2
- package/dist/components/profile-dropdown/interface.d.ts.map +1 -1
- package/dist/components/profile-dropdown/interface.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.d.ts +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.js +90 -7
- package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.module.less +31 -4
- package/dist/components/profile-dropdown/profile-dropdown.module.less.d.ts +6 -3
- package/dist/components/titan-layout/layout-profile.js +1 -1
- package/dist/components/titan-layout/layout-profile.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links.js +4 -4
- package/dist/components/titan-layout/layout-sidebar-links.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.js +5 -5
- package/dist/components/titan-layout/layout-sidebar.js.map +1 -1
- package/dist/components/titan-layout/titan-layout.js +7 -7
- package/dist/components/titan-layout/titan-layout.js.map +1 -1
- package/dist/utils/use-breakpoint.js +3 -3
- package/dist/utils/use-breakpoint.js.map +1 -1
- package/package.json +5 -3
- package/src/components/profile-dropdown/interface.ts +1 -2
- package/src/components/profile-dropdown/profile-dropdown.module.less +31 -4
- package/src/components/profile-dropdown/profile-dropdown.module.less.d.ts +6 -3
- package/src/components/profile-dropdown/profile-dropdown.tsx +107 -12
- package/src/components/titan-layout/layout-profile.tsx +1 -1
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/* tslint:disable: max-line-length */ export const LogoTitanSvg = (props)=>{
|
|
3
|
-
var _props_width, _props_height;
|
|
3
|
+
var _props_width, _props_height, _props_fill, _props_mantleFill;
|
|
4
4
|
const dimensions = {
|
|
5
5
|
width: (_props_width = props.width) !== null && _props_width !== void 0 ? _props_width : 116,
|
|
6
6
|
height: (_props_height = props.height) !== null && _props_height !== void 0 ? _props_height : 106
|
|
7
7
|
};
|
|
8
|
-
var _props_fill;
|
|
9
8
|
const fill = (_props_fill = props.fill) !== null && _props_fill !== void 0 ? _props_fill : 'currentColor';
|
|
10
|
-
var _props_mantleFill;
|
|
11
9
|
const mantleFill = (_props_mantleFill = props.mantleFill) !== null && _props_mantleFill !== void 0 ? _props_mantleFill : fill;
|
|
12
10
|
return /*#__PURE__*/ _jsxs("svg", {
|
|
13
11
|
className: props.className,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/logo/logo-titan.tsx"],"sourcesContent":["import { FC } from 'react';\n\nexport interface LogoTitanSvgProps {\n className?: string;\n height?: number;\n width?: number;\n fill?: string;\n mantleFill?: string;\n}\n\n/* tslint:disable: max-line-length */\nexport const LogoTitanSvg: FC<LogoTitanSvgProps> = props => {\n const dimensions = {\n width: props.width ?? 116,\n height: props.height ?? 106,\n };\n const fill = props.fill ?? 'currentColor';\n const mantleFill = props.mantleFill ?? fill;\n\n return (\n <svg\n className={props.className}\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n {...dimensions}\n viewBox=\"0 0 116 106\"\n >\n <defs>\n <path id=\"a\" d=\"M0 .12h63.625V40H0z\" />\n </defs>\n <g fill=\"none\" fillRule=\"evenodd\">\n <path\n fill={mantleFill}\n d=\"M10.33 96S17 98.545 17 101.089c0 0-.403 1.911-2.671 1.911C12.066 103 9 99.581 9 97.908 9 96.236 10.33 96 10.33 96\"\n />\n <g transform=\"translate(0 66)\">\n <path\n fill={mantleFill}\n d=\"M3.733.453A.416.416 0 0 0 3.51.167a.403.403 0 0 0-.36-.01C1.968.677 0 2.1 0 5.058 0 15.962 29.34 17.19 45.224 36.706a8.92 8.92 0 0 0 7.085 3.293c3.607-.068 7.2-.258 10.388-.773a1.1 1.1 0 0 0 .84-.663c.15-.352.105-.757-.112-1.07C44.077 9.88 7.247 16.268 3.733.453\"\n />\n </g>\n <path\n fill={fill}\n d=\"M45 32.862c-1.712-1.879-6.568-.445-9.176 1.978-2.68 2.49-1.615 4.16-1.615 4.16 2.177-3.367 5.588-4.741 7.514-5.01 2.36-.328 3.277-1.128 3.277-1.128\"\n />\n <path\n fill={fill}\n d=\"M105.301 37.812s-3.795.958-7.721-3.088c0 0 1.52.174 1.913-2.045 0 0 2.14 4.393 5.808 5.133m-1.397 18.16s-.596 4.407-6.07 4.407c-5.473 0-10.251-7.73-12.135-25.417 1.354 2.102 2.738 4.128 3.767 6.507.003-2.493 1.17-6.633-4.396-10.887 0 0 14.727 3.053 15.077 18.144 0 2.603-1.53 5.282-2.512 6.262 0 0-.674.577-.256 1.424.415.842 1.441.641 2.828-.29 1.389-.933 3.697-2.53 3.697-.15M83.19 64.374s-3.986 7.51-9.403 7.51c-2.21 0-3.79-1.577-3.79-3.756 0-2.182 2.681-9.984 14.331-9.984 2.783 0 4.963.508 4.963 2.184 0 1.677-2.644 4.559-6.1 4.046m0-37.55s-1.54-.301-1.045-2.59c.241-.777.415-.764.415-1.948s.311-2.563 1.255-2.969c0 0 1.618.003 1.618 4.222 0 1.83-2.244 3.286-2.244 3.286m-5.027 0c-2.25-.238-.649-3.865-2.267-4.086-.62-.086-.77 4.103-1.503 3.464-1.449-1.27-.378-3.862-.226-5.07.151-1.214.743-2.727-.567-1.816-1.31.911-2.008 2.83-2.455 4.467-.445 1.634.447 2.412 1.056 4.303.609 1.895-.522 1.243-.522 1.243-6.098-3.642-1.704-11.315-1.704-11.315 2.644-4.504 6.597-3.16 6.597-3.16.77.275.962.723.962 1.68s.259 1.262 1.394 1.53c1.136.27 1.673 1.658 1.673 3.91 0 2.252-1.434 4.956-2.438 4.85m9.368-.414l10.035 3.026s1.842 3.414-1.869 2.414c-3.712-1.003-7.336-2.134-7.336-2.134s-1.965-1-.83-3.306M38.182 41.47c-7.117 1.26-9.637-.916-9.637-2.753 0-5.601 16.175-9.942 20.728-10.011.917 1.382-.696 1.144-1.357 3.229-.658 2.082-2.269 2.743-4.622 3.028-2.356.285-4.826 1.5-6.38 2.924-1.44 1.322 0 1.93 2.938 1.087 2.873-.824 3.223.406 4.399-.03 1.173-.435.129-1.844.628-2.104.756-.394 2.327.673 2.327.673l4.092 2.595s-4.597 2.328-4.92 2.506c-.323.178-.872.483-.872 1.11 0 .99 2.547.628 3.42.628.874 0 1.008 1.424 1.008 1.424-1.337 1.538-4.818 1.55-4.818 1.55.775 1.637 5.156 1.372 6.043 1.401.882.033.974 1.273 1.422 3.296.45 2.028 3.287 2.89 3.287 2.89.92 3-2.706 3.872-5.106 3.872-14.063 0-12.58-17.315-12.58-17.315m1.6-22.275a.437.437 0 0 1-.385-.373C38.64 13.21 41.11 6.368 41.11 6.368s-5.997 4.821-5.763 12.524c-5.09-.126-12.575.424-16.988 4.182-6.188 5.265-7.204 15.201-7.366 17.81a.419.419 0 0 1-.631.33c-1.459-.876-4.898-3.776-2.425-10.632C11.023 22.032 20.546 4.298 39.539 3.1c0 0 5.813-.243 9.737 1.835a.432.432 0 0 1 .23.341.438.438 0 0 1-.163.38c-1.628 1.29-6.688 5.803-8.502 13.28a.44.44 0 0 1-.48.33c-.15-.022-.345-.044-.578-.072m14.12 23.535s1.754 7.649 5.283 10.355c0 0-.132.773-1.245.773-1.11 0-3.208-1.773-4.038-5.906-.83-4.135 0-5.222 0-5.222m5.283-19.013c-4.453 0-6.419-3.771-6.419-3.771s5.107 4.816 12.204.896c0 0-1.33 2.875-5.785 2.875m54.718 6.38c-1.125-2.282-2.882-4.117-6.24-4.94-3.265-.801-6.145-.39-8.12 1.328l-6.541-2.214c-.741-1.6-1.357-3.06-1.8-4.32a4.647 4.647 0 0 0-2.1-2.509c-4.279-2.431-15.872-8.208-20.362-2.305 0 0-.236.263-.554.733l-1.402-.475c-.725-2.514-3.116-4.442-6.431-5.255-2.04-.5-4.048-.373-5.713.238-1.21.446-1.268 1.857-.05 2.283l5.216 1.822a2.261 2.261 0 0 1 1.394 2.885l-.007.017a2.273 2.273 0 0 1-2.895 1.39s-3.323-.981-5.651-1.672c-1.233-.366-2.359.78-1.988 2.003.748 2.491 3.208 4.697 6.496 5.502 2.79.681 5.524.196 7.4-1.104l1.228.413c.092 2.83 2.284 6.21 4.336 7.426 3.144 1.86 6.026.206 9.3-1.387 0 0 8.195 6.527 4.395 25.033-10.492 1.1-14.289 4.86-18.096 8.657-2.386-.944-9.597-1.407-13.437-.523 1.089-1.084 2.893-2.364 5.107-3.219a2.601 2.601 0 0 0 1.668-2.424s4.803-1.53 4.803-3.29c0-1.758-5.931-1.578-8.37-14.22-.394-1.469-.842-2.7-3.108-3.757 0 0-.631-1.324.283-2.773.917-1.448 1.588-2.12 1.345-3.268-.241-1.15-1.939-2.095-1.939-2.095v-1.924s-4.856-3.526-4.856-8.572c0-5.046 6.583-11.11 8.378-12.868a.452.452 0 0 0 .134-.394.492.492 0 0 0-.241-.339C53.17 2.545 48.577 0 41.515 0 13.618 0 7.089 24.934 1.11 37.047c-.131.27-.154.582-.02.85C7.06 49.753 16.697 48.79 17.223 58.734c.423 7.955-1.443 8.131-3.302 7.963-1.22-.112-3.007-1.196-4.093-1.932a.423.423 0 0 0-.492.013c-.144.109-.201.297-.144.468.728 2.169 2.877 6.638 9.04 6.638 3.134 0 4.13-2.833 4.13-5.442v-8.99c0-.887-.293-1.727-.969-2.304-2.12-1.817-6.637-6.182-6.637-10.057 0-1.654 1.106-2.514 2.395-2.514 2.426 0 4.77 3.628 6.59 8.204.423 1.07 1.032 1.827 1.589 2.196a.26.26 0 0 0 .288-.005.25.25 0 0 0 .094-.268c-.75-2.659-.999-5.432-1.078-6.799a1.997 1.997 0 0 0-.696-1.394c-1.8-1.53-6.667-6.339-6.667-13.524 0-9.681 15.469-8.872 18.59-8.607.927 3.226 2.866 4.625 4.158 5.215-4.677 1.718-15.241 5.17-15.241 11.127 0 6.388 10.586 5.923 10.586 5.923s-1.68 12.754 10.244 16.6c0 0-1.864 1.876-8.268 1.876-5.977 0-8.894-2.659-10.316-5.796a.36.36 0 0 0-.664.015c-.325.812-.583 2.285.548 4.127 1.757 2.855 4.023 4.494 4.023 8.124 0 2.684-2.416 4.368-3.407 4.945a.178.178 0 0 0-.09.183.18.18 0 0 0 .14.151c2.345.567 13.031 3.241 20.225 6.641.058.03.125.025.18-.007.805-.506 7.027-4.556 7.382-9.897 0 0 .473-3.492-4.76-4.123 0 0 2.263-.871 6.36-.871 4.084 0 8.542 3.3.515 19.744a.183.183 0 0 0 .065.235c1.232.775 10.367 6.579 16.21 12.227a.645.645 0 0 0 .964-.077c.755-.993 2.214-3.657 3.29-10.216a1.59 1.59 0 0 1 1.13-1.268c3.487-1.003 15.433-4.86 20.662-12.029 6.16-8.44 8.295-9.35 8.295-9.35s4.03-2.248 2.326-8.198c-.892-3.105-5.584-11.253-10.201-19.593a10.952 10.952 0 0 0 3.757 1.704c2.808.686 5.557.255 7.527-.968a1.323 1.323 0 1 0-.263-2.372l-5.196-1.815a2.394 2.394 0 0 1-1.474-3.053l.007-.02a2.407 2.407 0 0 1 3.064-1.468l4.638 1.621c.462.161.979.045 1.327-.302.345-.346.517-.879.3-1.32\"\n />\n <path\n fill={mantleFill}\n d=\"M44.151 45s-2.766.605-2.025 3.75C42.868 51.914 46 52 46 52c-2.723-2.607-1.849-7-1.849-7M8.875 84.576c7.098 4.115 22.77 8.899 26.046 17.51 0 0 1.12 1.914-5.066 1.914-4.685 0-5.949-1.166-9.277-5.101C15.69 93.119 6 89.753 6 85.29c0 0 .064-2.343 2.875-.714\"\n />\n </g>\n </svg>\n );\n};\n"],"names":["LogoTitanSvg","props","dimensions","width","height","fill","mantleFill","svg","className","xmlns","xmlnsXlink","viewBox","defs","path","id","d","g","fillRule","transform"],"mappings":";AAUA,mCAAmC,GACnC,OAAO,MAAMA,eAAsCC,CAAAA;QAEpCA,cACCA;
|
|
1
|
+
{"version":3,"sources":["../../../src/components/logo/logo-titan.tsx"],"sourcesContent":["import { FC } from 'react';\n\nexport interface LogoTitanSvgProps {\n className?: string;\n height?: number;\n width?: number;\n fill?: string;\n mantleFill?: string;\n}\n\n/* tslint:disable: max-line-length */\nexport const LogoTitanSvg: FC<LogoTitanSvgProps> = props => {\n const dimensions = {\n width: props.width ?? 116,\n height: props.height ?? 106,\n };\n const fill = props.fill ?? 'currentColor';\n const mantleFill = props.mantleFill ?? fill;\n\n return (\n <svg\n className={props.className}\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n {...dimensions}\n viewBox=\"0 0 116 106\"\n >\n <defs>\n <path id=\"a\" d=\"M0 .12h63.625V40H0z\" />\n </defs>\n <g fill=\"none\" fillRule=\"evenodd\">\n <path\n fill={mantleFill}\n d=\"M10.33 96S17 98.545 17 101.089c0 0-.403 1.911-2.671 1.911C12.066 103 9 99.581 9 97.908 9 96.236 10.33 96 10.33 96\"\n />\n <g transform=\"translate(0 66)\">\n <path\n fill={mantleFill}\n d=\"M3.733.453A.416.416 0 0 0 3.51.167a.403.403 0 0 0-.36-.01C1.968.677 0 2.1 0 5.058 0 15.962 29.34 17.19 45.224 36.706a8.92 8.92 0 0 0 7.085 3.293c3.607-.068 7.2-.258 10.388-.773a1.1 1.1 0 0 0 .84-.663c.15-.352.105-.757-.112-1.07C44.077 9.88 7.247 16.268 3.733.453\"\n />\n </g>\n <path\n fill={fill}\n d=\"M45 32.862c-1.712-1.879-6.568-.445-9.176 1.978-2.68 2.49-1.615 4.16-1.615 4.16 2.177-3.367 5.588-4.741 7.514-5.01 2.36-.328 3.277-1.128 3.277-1.128\"\n />\n <path\n fill={fill}\n d=\"M105.301 37.812s-3.795.958-7.721-3.088c0 0 1.52.174 1.913-2.045 0 0 2.14 4.393 5.808 5.133m-1.397 18.16s-.596 4.407-6.07 4.407c-5.473 0-10.251-7.73-12.135-25.417 1.354 2.102 2.738 4.128 3.767 6.507.003-2.493 1.17-6.633-4.396-10.887 0 0 14.727 3.053 15.077 18.144 0 2.603-1.53 5.282-2.512 6.262 0 0-.674.577-.256 1.424.415.842 1.441.641 2.828-.29 1.389-.933 3.697-2.53 3.697-.15M83.19 64.374s-3.986 7.51-9.403 7.51c-2.21 0-3.79-1.577-3.79-3.756 0-2.182 2.681-9.984 14.331-9.984 2.783 0 4.963.508 4.963 2.184 0 1.677-2.644 4.559-6.1 4.046m0-37.55s-1.54-.301-1.045-2.59c.241-.777.415-.764.415-1.948s.311-2.563 1.255-2.969c0 0 1.618.003 1.618 4.222 0 1.83-2.244 3.286-2.244 3.286m-5.027 0c-2.25-.238-.649-3.865-2.267-4.086-.62-.086-.77 4.103-1.503 3.464-1.449-1.27-.378-3.862-.226-5.07.151-1.214.743-2.727-.567-1.816-1.31.911-2.008 2.83-2.455 4.467-.445 1.634.447 2.412 1.056 4.303.609 1.895-.522 1.243-.522 1.243-6.098-3.642-1.704-11.315-1.704-11.315 2.644-4.504 6.597-3.16 6.597-3.16.77.275.962.723.962 1.68s.259 1.262 1.394 1.53c1.136.27 1.673 1.658 1.673 3.91 0 2.252-1.434 4.956-2.438 4.85m9.368-.414l10.035 3.026s1.842 3.414-1.869 2.414c-3.712-1.003-7.336-2.134-7.336-2.134s-1.965-1-.83-3.306M38.182 41.47c-7.117 1.26-9.637-.916-9.637-2.753 0-5.601 16.175-9.942 20.728-10.011.917 1.382-.696 1.144-1.357 3.229-.658 2.082-2.269 2.743-4.622 3.028-2.356.285-4.826 1.5-6.38 2.924-1.44 1.322 0 1.93 2.938 1.087 2.873-.824 3.223.406 4.399-.03 1.173-.435.129-1.844.628-2.104.756-.394 2.327.673 2.327.673l4.092 2.595s-4.597 2.328-4.92 2.506c-.323.178-.872.483-.872 1.11 0 .99 2.547.628 3.42.628.874 0 1.008 1.424 1.008 1.424-1.337 1.538-4.818 1.55-4.818 1.55.775 1.637 5.156 1.372 6.043 1.401.882.033.974 1.273 1.422 3.296.45 2.028 3.287 2.89 3.287 2.89.92 3-2.706 3.872-5.106 3.872-14.063 0-12.58-17.315-12.58-17.315m1.6-22.275a.437.437 0 0 1-.385-.373C38.64 13.21 41.11 6.368 41.11 6.368s-5.997 4.821-5.763 12.524c-5.09-.126-12.575.424-16.988 4.182-6.188 5.265-7.204 15.201-7.366 17.81a.419.419 0 0 1-.631.33c-1.459-.876-4.898-3.776-2.425-10.632C11.023 22.032 20.546 4.298 39.539 3.1c0 0 5.813-.243 9.737 1.835a.432.432 0 0 1 .23.341.438.438 0 0 1-.163.38c-1.628 1.29-6.688 5.803-8.502 13.28a.44.44 0 0 1-.48.33c-.15-.022-.345-.044-.578-.072m14.12 23.535s1.754 7.649 5.283 10.355c0 0-.132.773-1.245.773-1.11 0-3.208-1.773-4.038-5.906-.83-4.135 0-5.222 0-5.222m5.283-19.013c-4.453 0-6.419-3.771-6.419-3.771s5.107 4.816 12.204.896c0 0-1.33 2.875-5.785 2.875m54.718 6.38c-1.125-2.282-2.882-4.117-6.24-4.94-3.265-.801-6.145-.39-8.12 1.328l-6.541-2.214c-.741-1.6-1.357-3.06-1.8-4.32a4.647 4.647 0 0 0-2.1-2.509c-4.279-2.431-15.872-8.208-20.362-2.305 0 0-.236.263-.554.733l-1.402-.475c-.725-2.514-3.116-4.442-6.431-5.255-2.04-.5-4.048-.373-5.713.238-1.21.446-1.268 1.857-.05 2.283l5.216 1.822a2.261 2.261 0 0 1 1.394 2.885l-.007.017a2.273 2.273 0 0 1-2.895 1.39s-3.323-.981-5.651-1.672c-1.233-.366-2.359.78-1.988 2.003.748 2.491 3.208 4.697 6.496 5.502 2.79.681 5.524.196 7.4-1.104l1.228.413c.092 2.83 2.284 6.21 4.336 7.426 3.144 1.86 6.026.206 9.3-1.387 0 0 8.195 6.527 4.395 25.033-10.492 1.1-14.289 4.86-18.096 8.657-2.386-.944-9.597-1.407-13.437-.523 1.089-1.084 2.893-2.364 5.107-3.219a2.601 2.601 0 0 0 1.668-2.424s4.803-1.53 4.803-3.29c0-1.758-5.931-1.578-8.37-14.22-.394-1.469-.842-2.7-3.108-3.757 0 0-.631-1.324.283-2.773.917-1.448 1.588-2.12 1.345-3.268-.241-1.15-1.939-2.095-1.939-2.095v-1.924s-4.856-3.526-4.856-8.572c0-5.046 6.583-11.11 8.378-12.868a.452.452 0 0 0 .134-.394.492.492 0 0 0-.241-.339C53.17 2.545 48.577 0 41.515 0 13.618 0 7.089 24.934 1.11 37.047c-.131.27-.154.582-.02.85C7.06 49.753 16.697 48.79 17.223 58.734c.423 7.955-1.443 8.131-3.302 7.963-1.22-.112-3.007-1.196-4.093-1.932a.423.423 0 0 0-.492.013c-.144.109-.201.297-.144.468.728 2.169 2.877 6.638 9.04 6.638 3.134 0 4.13-2.833 4.13-5.442v-8.99c0-.887-.293-1.727-.969-2.304-2.12-1.817-6.637-6.182-6.637-10.057 0-1.654 1.106-2.514 2.395-2.514 2.426 0 4.77 3.628 6.59 8.204.423 1.07 1.032 1.827 1.589 2.196a.26.26 0 0 0 .288-.005.25.25 0 0 0 .094-.268c-.75-2.659-.999-5.432-1.078-6.799a1.997 1.997 0 0 0-.696-1.394c-1.8-1.53-6.667-6.339-6.667-13.524 0-9.681 15.469-8.872 18.59-8.607.927 3.226 2.866 4.625 4.158 5.215-4.677 1.718-15.241 5.17-15.241 11.127 0 6.388 10.586 5.923 10.586 5.923s-1.68 12.754 10.244 16.6c0 0-1.864 1.876-8.268 1.876-5.977 0-8.894-2.659-10.316-5.796a.36.36 0 0 0-.664.015c-.325.812-.583 2.285.548 4.127 1.757 2.855 4.023 4.494 4.023 8.124 0 2.684-2.416 4.368-3.407 4.945a.178.178 0 0 0-.09.183.18.18 0 0 0 .14.151c2.345.567 13.031 3.241 20.225 6.641.058.03.125.025.18-.007.805-.506 7.027-4.556 7.382-9.897 0 0 .473-3.492-4.76-4.123 0 0 2.263-.871 6.36-.871 4.084 0 8.542 3.3.515 19.744a.183.183 0 0 0 .065.235c1.232.775 10.367 6.579 16.21 12.227a.645.645 0 0 0 .964-.077c.755-.993 2.214-3.657 3.29-10.216a1.59 1.59 0 0 1 1.13-1.268c3.487-1.003 15.433-4.86 20.662-12.029 6.16-8.44 8.295-9.35 8.295-9.35s4.03-2.248 2.326-8.198c-.892-3.105-5.584-11.253-10.201-19.593a10.952 10.952 0 0 0 3.757 1.704c2.808.686 5.557.255 7.527-.968a1.323 1.323 0 1 0-.263-2.372l-5.196-1.815a2.394 2.394 0 0 1-1.474-3.053l.007-.02a2.407 2.407 0 0 1 3.064-1.468l4.638 1.621c.462.161.979.045 1.327-.302.345-.346.517-.879.3-1.32\"\n />\n <path\n fill={mantleFill}\n d=\"M44.151 45s-2.766.605-2.025 3.75C42.868 51.914 46 52 46 52c-2.723-2.607-1.849-7-1.849-7M8.875 84.576c7.098 4.115 22.77 8.899 26.046 17.51 0 0 1.12 1.914-5.066 1.914-4.685 0-5.949-1.166-9.277-5.101C15.69 93.119 6 89.753 6 85.29c0 0 .064-2.343 2.875-.714\"\n />\n </g>\n </svg>\n );\n};\n"],"names":["LogoTitanSvg","props","dimensions","width","height","fill","mantleFill","svg","className","xmlns","xmlnsXlink","viewBox","defs","path","id","d","g","fillRule","transform"],"mappings":";AAUA,mCAAmC,GACnC,OAAO,MAAMA,eAAsCC,CAAAA;QAEpCA,cACCA,eAECA,aACMA;IALnB,MAAMC,aAAa;QACfC,KAAK,GAAEF,eAAAA,MAAME,KAAK,cAAXF,0BAAAA,eAAe;QACtBG,MAAM,GAAEH,gBAAAA,MAAMG,MAAM,cAAZH,2BAAAA,gBAAgB;IAC5B;IACA,MAAMI,QAAOJ,cAAAA,MAAMI,IAAI,cAAVJ,yBAAAA,cAAc;IAC3B,MAAMK,cAAaL,oBAAAA,MAAMK,UAAU,cAAhBL,+BAAAA,oBAAoBI;IAEvC,qBACI,MAACE;QACGC,WAAWP,MAAMO,SAAS;QAC1BC,OAAM;QACNC,YAAW;QACV,GAAGR,UAAU;QACdS,SAAQ;;0BAER,KAACC;0BACG,cAAA,KAACC;oBAAKC,IAAG;oBAAIC,GAAE;;;0BAEnB,MAACC;gBAAEX,MAAK;gBAAOY,UAAS;;kCACpB,KAACJ;wBACGR,MAAMC;wBACNS,GAAE;;kCAEN,KAACC;wBAAEE,WAAU;kCACT,cAAA,KAACL;4BACGR,MAAMC;4BACNS,GAAE;;;kCAGV,KAACF;wBACGR,MAAMA;wBACNU,GAAE;;kCAEN,KAACF;wBACGR,MAAMA;wBACNU,GAAE;;kCAEN,KAACF;wBACGR,MAAMC;wBACNS,GAAE;;;;;;AAKtB,EAAE"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PopoverProps } from '@servicetitan/anvil2';
|
|
2
1
|
import { ComponentPropsWithoutRef, FC, ReactNode } from 'react';
|
|
3
2
|
import { CounterTagData, CounterTagValue } from '../../utils/counter-tag';
|
|
4
3
|
export type ProfileDropdownTriggerProps = {
|
|
@@ -14,7 +13,7 @@ export type ProfileDropdownTriggerProps = {
|
|
|
14
13
|
};
|
|
15
14
|
} & Omit<ComponentPropsWithoutRef<'div'>, 'onClick'>;
|
|
16
15
|
export type ProfileDropdownProps = {
|
|
17
|
-
|
|
16
|
+
anvil1?: boolean;
|
|
18
17
|
trigger?: Omit<ProfileDropdownTriggerProps, 'onClick' | 'open' | 'hintArrow'>;
|
|
19
18
|
hintPopup?: {
|
|
20
19
|
bgColor?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/components/profile-dropdown/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/components/profile-dropdown/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,M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,QAAQ,EAAE,SAAS,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,OAAO,CAAC,EAAE,eAAe,CAAC;CAC7B,GAAG,kBAAkB,CAAC;AAEvB,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,GAAG;IACrF,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,OAAO,CAAC,EAAE,eAAe,CAAC;CAC7B,GAAG,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/profile-dropdown/interface.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/profile-dropdown/interface.ts"],"sourcesContent":["import { ComponentPropsWithoutRef, FC, ReactNode } from 'react';\nimport { CounterTagData, CounterTagValue } from '../../utils/counter-tag';\n\nexport type ProfileDropdownTriggerProps = {\n info?: { title: string; text: string };\n imageSrc?: string | null;\n avatarBadge?: boolean | string;\n badge?: { content?: number | string; color: string };\n} & Omit<ComponentPropsWithoutRef<'div'>, 'onClick'>;\n\nexport type ProfileDropdownProps = {\n anvil1?: boolean;\n trigger?: Omit<ProfileDropdownTriggerProps, 'onClick' | 'open' | 'hintArrow'>;\n hintPopup?: {\n bgColor?: string;\n content: FC<{ openProfile(): void }>;\n onClose?: () => void;\n };\n portal?: boolean;\n onClose?(): void;\n onOpen?(): void;\n} & ComponentPropsWithoutRef<'div'>;\n\nexport type ProfileItemContent =\n | { children: string; text?: string }\n | { children: ReactNode; text: string };\n\nexport type ProfileDropdownSectionProps = Omit<ComponentPropsWithoutRef<'div'>, 'children'> & {\n children: ReactNode;\n id: string;\n tooltip?: string;\n tag?: CounterTagData;\n counter?: CounterTagValue;\n} & ProfileItemContent;\n\nexport type ProfileDropdownLinkProps = Omit<ComponentPropsWithoutRef<'a'>, 'children'> & {\n id: string;\n children: ReactNode;\n external?: boolean;\n tooltip?: string;\n to: string;\n tag?: CounterTagData;\n counter?: CounterTagValue;\n} & ProfileItemContent;\n"],"names":[],"mappings":"AAmCA,WAQuB"}
|
|
@@ -2,7 +2,7 @@ import { FC } from 'react';
|
|
|
2
2
|
import { ProfileDropdownLinkProps, ProfileDropdownProps, ProfileDropdownSectionProps } from './interface';
|
|
3
3
|
declare function DesktopProfileDropdownSection({ children, className, counter, id, tag, text, tooltip, onClick, ...rest }: ProfileDropdownSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare function DesktopProfileDropdownLink({ children, className, external, id, counter, tag, target, text, to, tooltip, onClick, ...rest }: ProfileDropdownLinkProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
declare function DesktopProfileDropdownComponent({
|
|
5
|
+
declare function DesktopProfileDropdownComponent({ anvil1, ...props }: ProfileDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export declare const DesktopProfileDropdown: typeof DesktopProfileDropdownComponent & {
|
|
7
7
|
Divider: FC;
|
|
8
8
|
Link: typeof DesktopProfileDropdownLink;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-dropdown.d.ts","sourceRoot":"","sources":["../../../src/components/profile-dropdown/profile-dropdown.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"profile-dropdown.d.ts","sourceRoot":"","sources":["../../../src/components/profile-dropdown/profile-dropdown.tsx"],"names":[],"mappings":"AAQA,OAAO,EAEH,EAAE,EASL,MAAM,OAAO,CAAC;AAOf,OAAO,EACH,wBAAwB,EACxB,oBAAoB,EACpB,2BAA2B,EAE9B,MAAM,aAAa,CAAC;AAyGrB,iBAAS,6BAA6B,CAAC,EACnC,QAAQ,EACR,SAAS,EACT,OAAO,EACP,EAAE,EACF,GAAG,EACH,IAAI,EACJ,OAAO,EACP,OAAO,EACP,GAAG,IAAI,EACV,EAAE,2BAA2B,2CA8B7B;AAID,iBAAS,0BAA0B,CAAC,EAChC,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,EAAE,EACF,OAAO,EACP,GAAG,EACH,MAAM,EACN,IAAI,EACJ,EAAE,EACF,OAAO,EACP,OAAO,EACP,GAAG,IAAI,EACV,EAAE,wBAAwB,2CA8C1B;AAED,iBAAS,+BAA+B,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,2CAMlF;AAiLD,eAAO,MAAM,sBAAsB;;;;CAIjC,CAAC"}
|
|
@@ -4,6 +4,7 @@ import SvgExpandLess from '@servicetitan/anvil2/assets/icons/material/round/expa
|
|
|
4
4
|
import SvgExpandMore from '@servicetitan/anvil2/assets/icons/material/round/expand_more.svg';
|
|
5
5
|
import SvgAccountActive from '@servicetitan/anvil2/assets/icons/st/gnav_account_active.svg';
|
|
6
6
|
import SvgAccountInactive from '@servicetitan/anvil2/assets/icons/st/gnav_account_inactive.svg';
|
|
7
|
+
import { Popover as PopoverAnvil1 } from '@servicetitan/design-system';
|
|
7
8
|
import { tokens } from '@servicetitan/tokens/core';
|
|
8
9
|
import classNames from 'classnames';
|
|
9
10
|
import { createElement, forwardRef, useCallback, useEffect, useMemo, useState } from 'react';
|
|
@@ -156,7 +157,90 @@ function DesktopProfileDropdownLink({ children, className, external, id, counter
|
|
|
156
157
|
placement: 'left'
|
|
157
158
|
});
|
|
158
159
|
}
|
|
159
|
-
function DesktopProfileDropdownComponent({
|
|
160
|
+
function DesktopProfileDropdownComponent({ anvil1, ...props }) {
|
|
161
|
+
return anvil1 ? /*#__PURE__*/ _jsx(DesktopProfileDropdownComponentAnvil1, {
|
|
162
|
+
...props
|
|
163
|
+
}) : /*#__PURE__*/ _jsx(DesktopProfileDropdownComponentAnvil2, {
|
|
164
|
+
...props
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* A2 profile dropdown popover sometimes rendered incorrectly in top left corner. It is seen on cypress test failed builds.
|
|
169
|
+
* it needs to be investigated, but for now keeping an option for A1 popover
|
|
170
|
+
*/ function DesktopProfileDropdownComponentAnvil1({ children, trigger, hintPopup, portal, onClose, onOpen, ...rest }) {
|
|
171
|
+
var _hintPopup_bgColor;
|
|
172
|
+
const [open, setOpen] = useState(false);
|
|
173
|
+
const handleClose = useCallback(()=>{
|
|
174
|
+
setOpen(false);
|
|
175
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
176
|
+
}, [
|
|
177
|
+
onClose
|
|
178
|
+
]);
|
|
179
|
+
const handleOpen = useCallback(()=>{
|
|
180
|
+
setOpen(true);
|
|
181
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
182
|
+
}, [
|
|
183
|
+
onOpen
|
|
184
|
+
]);
|
|
185
|
+
const onTriggerClick = useCallback((e)=>{
|
|
186
|
+
e.stopPropagation();
|
|
187
|
+
setOpen(!open);
|
|
188
|
+
if (open) {
|
|
189
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
190
|
+
} else {
|
|
191
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
192
|
+
}
|
|
193
|
+
}, [
|
|
194
|
+
open,
|
|
195
|
+
onOpen,
|
|
196
|
+
onClose
|
|
197
|
+
]);
|
|
198
|
+
const hintShown = !!hintPopup && !open;
|
|
199
|
+
const triggerElement = /*#__PURE__*/ _jsx(ProfileDropdownTrigger, {
|
|
200
|
+
...trigger,
|
|
201
|
+
onClick: children ? onTriggerClick : undefined,
|
|
202
|
+
hintArrow: hintShown,
|
|
203
|
+
open: open
|
|
204
|
+
});
|
|
205
|
+
const hintPopover = (hintPopup === null || hintPopup === void 0 ? void 0 : hintPopup.content) && !open ? /*#__PURE__*/ _jsx(PopoverAnvil1, {
|
|
206
|
+
direction: "bl",
|
|
207
|
+
width: "xs",
|
|
208
|
+
trigger: triggerElement,
|
|
209
|
+
popoverContentClassName: Styles.hint1,
|
|
210
|
+
onClickOutside: hintPopup === null || hintPopup === void 0 ? void 0 : hintPopup.onClose,
|
|
211
|
+
open: true,
|
|
212
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
213
|
+
className: classNames(Styles.hintContent1),
|
|
214
|
+
style: {
|
|
215
|
+
'--hint-background': (_hintPopup_bgColor = hintPopup.bgColor) !== null && _hintPopup_bgColor !== void 0 ? _hintPopup_bgColor : '#fff'
|
|
216
|
+
},
|
|
217
|
+
children: /*#__PURE__*/ createElement(hintPopup.content, {
|
|
218
|
+
openProfile: handleOpen
|
|
219
|
+
})
|
|
220
|
+
})
|
|
221
|
+
}) : null;
|
|
222
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
223
|
+
"data-cy": "profile-dropdown",
|
|
224
|
+
...rest,
|
|
225
|
+
children: hintPopover !== null && hintPopover !== void 0 ? hintPopover : /*#__PURE__*/ _jsx(PopoverAnvil1, {
|
|
226
|
+
direction: "bl",
|
|
227
|
+
width: "xs",
|
|
228
|
+
trigger: triggerElement,
|
|
229
|
+
open: open,
|
|
230
|
+
portal: portal,
|
|
231
|
+
onClickOutside: handleClose,
|
|
232
|
+
popoverContentClassName: classNames(Styles.dropdown1),
|
|
233
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
234
|
+
className: Styles.dropdownContent,
|
|
235
|
+
onClick: handleClose,
|
|
236
|
+
"data-cy": "profile-dropdown-content",
|
|
237
|
+
children: children
|
|
238
|
+
})
|
|
239
|
+
})
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
function DesktopProfileDropdownComponentAnvil2({ children, trigger, hintPopup, portal, onClose, onOpen, ...rest }) {
|
|
243
|
+
var _hintPopup_bgColor;
|
|
160
244
|
const [open, setOpen] = useState(false);
|
|
161
245
|
const handleClose = useCallback(()=>{
|
|
162
246
|
setOpen(false);
|
|
@@ -189,9 +273,8 @@ function DesktopProfileDropdownComponent({ children, placement, trigger, hintPop
|
|
|
189
273
|
open: open,
|
|
190
274
|
onClick: children ? onTriggerClick : undefined
|
|
191
275
|
});
|
|
192
|
-
var _hintPopup_bgColor;
|
|
193
276
|
const hintPopover = (hintPopup === null || hintPopup === void 0 ? void 0 : hintPopup.content) && !open ? /*#__PURE__*/ _jsxs(Popover, {
|
|
194
|
-
placement:
|
|
277
|
+
placement: "bottom-start",
|
|
195
278
|
onClickOutside: hintPopup === null || hintPopup === void 0 ? void 0 : hintPopup.onClose,
|
|
196
279
|
noPadding: true,
|
|
197
280
|
open: true,
|
|
@@ -200,12 +283,12 @@ function DesktopProfileDropdownComponent({ children, placement, trigger, hintPop
|
|
|
200
283
|
children: triggerElement
|
|
201
284
|
}),
|
|
202
285
|
/*#__PURE__*/ _jsx(Popover.Content, {
|
|
203
|
-
className: Styles.
|
|
286
|
+
className: Styles.hint2,
|
|
204
287
|
style: {
|
|
205
288
|
'--hint-background': (_hintPopup_bgColor = hintPopup.bgColor) !== null && _hintPopup_bgColor !== void 0 ? _hintPopup_bgColor : '#fff'
|
|
206
289
|
},
|
|
207
290
|
children: /*#__PURE__*/ _jsx("div", {
|
|
208
|
-
className: classNames(Styles.
|
|
291
|
+
className: classNames(Styles.hintContent2),
|
|
209
292
|
children: /*#__PURE__*/ createElement(hintPopup.content, {
|
|
210
293
|
openProfile: handleOpen
|
|
211
294
|
})
|
|
@@ -217,7 +300,7 @@ function DesktopProfileDropdownComponent({ children, placement, trigger, hintPop
|
|
|
217
300
|
"data-cy": "profile-dropdown",
|
|
218
301
|
...rest,
|
|
219
302
|
children: hintPopover !== null && hintPopover !== void 0 ? hintPopover : /*#__PURE__*/ _jsxs(Popover, {
|
|
220
|
-
placement:
|
|
303
|
+
placement: "bottom-start",
|
|
221
304
|
open: open,
|
|
222
305
|
onClickOutside: handleClose,
|
|
223
306
|
noPadding: true,
|
|
@@ -226,7 +309,7 @@ function DesktopProfileDropdownComponent({ children, placement, trigger, hintPop
|
|
|
226
309
|
children: triggerElement
|
|
227
310
|
}),
|
|
228
311
|
/*#__PURE__*/ _jsx(Popover.Content, {
|
|
229
|
-
className: Styles.
|
|
312
|
+
className: Styles.dropdown2,
|
|
230
313
|
children: /*#__PURE__*/ _jsx("div", {
|
|
231
314
|
onClick: handleClose,
|
|
232
315
|
"data-cy": "profile-dropdown-content",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/profile-dropdown/profile-dropdown.tsx"],"sourcesContent":["import { Divider, Icon, Popover, Text } from '@servicetitan/anvil2';\nimport SvgExpandLess from '@servicetitan/anvil2/assets/icons/material/round/expand_less.svg';\nimport SvgExpandMore from '@servicetitan/anvil2/assets/icons/material/round/expand_more.svg';\nimport SvgAccountActive from '@servicetitan/anvil2/assets/icons/st/gnav_account_active.svg';\nimport SvgAccountInactive from '@servicetitan/anvil2/assets/icons/st/gnav_account_inactive.svg';\nimport { tokens } from '@servicetitan/tokens/core';\nimport classNames from 'classnames';\nimport {\n ComponentPropsWithoutRef,\n FC,\n MouseEvent,\n MouseEventHandler,\n createElement,\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\n\nimport { CounterTagData, CounterTagValue } from '../../utils/counter-tag';\nimport { getCounterTag } from '../../utils/side-nav';\nimport { CounterTag } from '../counter-tag';\nimport { useTitanLayoutContext } from '../titan-layout';\nimport { withTooltip } from '../titan-layout/with-tooltip';\nimport {\n ProfileDropdownLinkProps,\n ProfileDropdownProps,\n ProfileDropdownSectionProps,\n ProfileDropdownTriggerProps,\n} from './interface';\nimport * as Styles from './profile-dropdown.module.less';\n\nconst ProfileDropdownTrigger = forwardRef<\n HTMLDivElement,\n ProfileDropdownTriggerProps & {\n hintArrow?: boolean;\n open: boolean;\n onClick: ComponentPropsWithoutRef<'div'>['onClick'];\n }\n>(({ info, imageSrc, avatarBadge, badge, className, hintArrow, open, onClick, ...rest }, ref) => {\n const [avatarSource, setAvatarSource] = useState(imageSrc ?? '');\n const [avatarSourceError, setAvatarSourceError] = useState(false);\n\n useEffect(() => {\n const src = imageSrc ?? '';\n\n if (src === avatarSource) {\n return;\n }\n\n setAvatarSource(src);\n setAvatarSourceError(false);\n }, [imageSrc, avatarSource]);\n\n const onAvatarError = useCallback(() => {\n setAvatarSourceError(true);\n }, []);\n\n return (\n <div\n data-cy=\"profile-dropdown-trigger\"\n data-pendo=\"profile-dropdown-trigger\"\n tabIndex={0}\n {...rest}\n className={classNames('profile-dropdown-trigger', Styles.triggerContainer, className)}\n onClick={onClick}\n ref={ref}\n >\n {avatarSource && !avatarSourceError ? (\n <img\n src={avatarSource}\n className={classNames(Styles.profileImage, 'profile-dropdown-image')}\n onError={onAvatarError}\n alt=\"user dropdown menu\"\n />\n ) : (\n <Icon\n className={Styles.profileIcon}\n size=\"large\"\n svg={open ? SvgAccountActive : SvgAccountInactive}\n />\n )}\n\n {!!info && (\n <div className={Styles.info}>\n <Text title={info.title} className={Styles.infoTitle} size=\"small\">\n {info.title}\n </Text>\n <Text title={info.text} className={Styles.infoText} size=\"small\" subdued>\n {info.text}\n </Text>\n </div>\n )}\n\n <Icon\n svg={open ? SvgExpandLess : SvgExpandMore}\n className={Styles.expandIcon}\n size=\"small\"\n />\n\n {!!avatarBadge && (\n <div\n className={Styles.avatarBadge}\n style={{\n backgroundColor: avatarBadge === true ? tokens.colorBlue500 : avatarBadge,\n }}\n />\n )}\n {!!badge && (\n <span\n className={classNames(\n Styles.badge,\n badge.content ? Styles.badgeWithContent : Styles.badgeNoContent\n )}\n style={{ backgroundColor: badge.color }}\n >\n {badge.content}\n </span>\n )}\n </div>\n );\n});\n\nconst useTag = (counter?: CounterTagValue, tag?: CounterTagData) =>\n useMemo(() => {\n const data = getCounterTag(counter, tag);\n\n return data ? (\n <div className={Styles.counterWrapper}>\n <CounterTag className={Styles.counter} data={data} />\n </div>\n ) : undefined;\n }, [counter, tag]);\n\nfunction DesktopProfileDropdownSection({\n children,\n className,\n counter,\n id,\n tag,\n text,\n tooltip,\n onClick,\n ...rest\n}: ProfileDropdownSectionProps) {\n const clickHandler: MouseEventHandler<never> = e => {\n if (onClick) {\n onClick(e);\n } else {\n e.stopPropagation();\n }\n };\n\n const tagElement = useTag(counter, tag);\n\n return withTooltip(\n <div\n className={classNames(\n Styles.dropdownSection,\n tagElement && Styles.dropdownSectionWithCounter,\n !!onClick && Styles.dropdownLink,\n className\n )}\n onClick={clickHandler}\n data-cy={`profile-dropdown-section-${id}`}\n data-pendo={`profile-dropdown-section-${id}`}\n {...rest}\n >\n {children}\n {tagElement}\n </div>,\n tooltip,\n { placement: 'left' }\n );\n}\n\nconst DesktopProfileDropdownDivider: FC = Divider;\n\nfunction DesktopProfileDropdownLink({\n children,\n className,\n external,\n id,\n counter,\n tag,\n target,\n text,\n to,\n tooltip,\n onClick,\n ...rest\n}: ProfileDropdownLinkProps) {\n const { NavigationComponent } = useTitanLayoutContext();\n\n const isExternalLink = external ?? to?.startsWith('http');\n\n const tagElement = useTag(counter, tag);\n\n return withTooltip(\n isExternalLink ? (\n <a\n className={classNames(\n Styles.dropdownSection,\n tagElement && Styles.dropdownSectionWithCounter,\n Styles.dropdownLink,\n className\n )}\n href={to}\n target={target}\n data-cy={`profile-dropdown-link-${id}`}\n data-pendo={`profile-dropdown-link-${id}`}\n {...rest}\n >\n {children}\n {tagElement}\n </a>\n ) : (\n <NavigationComponent\n className={classNames(\n Styles.dropdownSection,\n Styles.dropdownLink,\n { [Styles.dropdownSectionWithCounter]: !!tagElement },\n className\n )}\n target={target}\n to={to}\n data-cy={`profile-dropdown-link-${id}`}\n data-pendo={`profile-dropdown-link-${id}`}\n {...rest}\n >\n {children}\n {tagElement}\n </NavigationComponent>\n ),\n tooltip,\n { placement: 'left' }\n );\n}\n\nfunction DesktopProfileDropdownComponent({\n children,\n\n placement,\n trigger,\n hintPopup,\n portal,\n onClose,\n onOpen,\n\n ...rest\n}: ProfileDropdownProps) {\n const [open, setOpen] = useState(false);\n const handleClose = useCallback(() => {\n setOpen(false);\n onClose?.();\n }, [onClose]);\n const handleOpen = useCallback(() => {\n setOpen(true);\n onOpen?.();\n }, [onOpen]);\n const onTriggerClick = useCallback(\n (e: MouseEvent) => {\n e.stopPropagation();\n setOpen(!open);\n\n if (open) {\n onClose?.();\n } else {\n onOpen?.();\n }\n },\n [open, onOpen, onClose]\n );\n\n const triggerElement = (props: any) => (\n <ProfileDropdownTrigger\n {...trigger}\n {...props}\n open={open}\n onClick={children ? onTriggerClick : undefined}\n />\n );\n\n const hintPopover =\n hintPopup?.content && !open ? (\n <Popover\n placement={placement ?? 'bottom-start'}\n onClickOutside={hintPopup?.onClose}\n noPadding\n open\n >\n <Popover.Trigger>{triggerElement}</Popover.Trigger>\n <Popover.Content\n className={Styles.hint}\n style={{ '--hint-background': hintPopup.bgColor ?? '#fff' } as any}\n >\n <div className={classNames(Styles.hintContent)}>\n {createElement(hintPopup.content, { openProfile: handleOpen })}\n </div>\n </Popover.Content>\n </Popover>\n ) : null;\n\n return (\n <div data-cy=\"profile-dropdown\" {...rest}>\n {hintPopover ?? (\n <Popover\n placement={placement ?? 'bottom-start'}\n open={open}\n onClickOutside={handleClose}\n noPadding\n >\n <Popover.Trigger>{triggerElement}</Popover.Trigger>\n <Popover.Content className={Styles.dropdown}>\n <div\n onClick={handleClose}\n data-cy=\"profile-dropdown-content\"\n className={Styles.dropdownContent}\n >\n {children}\n </div>\n </Popover.Content>\n </Popover>\n )}\n </div>\n );\n}\n\nexport const DesktopProfileDropdown = Object.assign(DesktopProfileDropdownComponent, {\n Divider: DesktopProfileDropdownDivider,\n Link: DesktopProfileDropdownLink,\n Section: DesktopProfileDropdownSection,\n});\n"],"names":["Divider","Icon","Popover","Text","SvgExpandLess","SvgExpandMore","SvgAccountActive","SvgAccountInactive","tokens","classNames","createElement","forwardRef","useCallback","useEffect","useMemo","useState","getCounterTag","CounterTag","useTitanLayoutContext","withTooltip","Styles","ProfileDropdownTrigger","info","imageSrc","avatarBadge","badge","className","hintArrow","open","onClick","rest","ref","avatarSource","setAvatarSource","avatarSourceError","setAvatarSourceError","src","onAvatarError","div","data-cy","data-pendo","tabIndex","triggerContainer","img","profileImage","onError","alt","profileIcon","size","svg","title","infoTitle","text","infoText","subdued","expandIcon","style","backgroundColor","colorBlue500","span","content","badgeWithContent","badgeNoContent","color","useTag","counter","tag","data","counterWrapper","undefined","DesktopProfileDropdownSection","children","id","tooltip","clickHandler","e","stopPropagation","tagElement","dropdownSection","dropdownSectionWithCounter","dropdownLink","placement","DesktopProfileDropdownDivider","DesktopProfileDropdownLink","external","target","to","NavigationComponent","isExternalLink","startsWith","a","href","DesktopProfileDropdownComponent","trigger","hintPopup","portal","onClose","onOpen","setOpen","handleClose","handleOpen","onTriggerClick","triggerElement","props","hintPopover","onClickOutside","noPadding","Trigger","Content","hint","bgColor","hintContent","openProfile","dropdown","dropdownContent","DesktopProfileDropdown","Object","assign","Link","Section"],"mappings":";AAAA,SAASA,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI,QAAQ,uBAAuB;AACpE,OAAOC,mBAAmB,mEAAmE;AAC7F,OAAOC,mBAAmB,mEAAmE;AAC7F,OAAOC,sBAAsB,+DAA+D;AAC5F,OAAOC,wBAAwB,iEAAiE;AAChG,SAASC,MAAM,QAAQ,4BAA4B;AACnD,OAAOC,gBAAgB,aAAa;AACpC,SAKIC,aAAa,EACbC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACL,QAAQ;AAGf,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,qBAAqB,QAAQ,kBAAkB;AACxD,SAASC,WAAW,QAAQ,+BAA+B;AAO3D,YAAYC,YAAY,iCAAiC;AAEzD,MAAMC,uCAAyBV,WAO7B,CAAC,EAAEW,IAAI,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,KAAK,EAAEC,SAAS,EA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OAAO;oBAAClF,WAAWN,OAAO6F,QAAQ;8BACvC,cAAA,KAAC3E;wBACGT,SAASsE;wBACT5D,WAAQ;wBACRb,WAAWN,OAAO8F,eAAe;kCAEhC3C;;;;;;AAO7B;AAEA,OAAO,MAAM4C,yBAAyBC,OAAOC,MAAM,CAACzB,iCAAiC;IACjF5F,SAASkF;IACToC,MAAMnC;IACNoC,SAASjD;AACb,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/profile-dropdown/profile-dropdown.tsx"],"sourcesContent":["import { Divider, Icon, Popover, Text } from '@servicetitan/anvil2';\nimport SvgExpandLess from '@servicetitan/anvil2/assets/icons/material/round/expand_less.svg';\nimport SvgExpandMore from '@servicetitan/anvil2/assets/icons/material/round/expand_more.svg';\nimport SvgAccountActive from '@servicetitan/anvil2/assets/icons/st/gnav_account_active.svg';\nimport SvgAccountInactive from '@servicetitan/anvil2/assets/icons/st/gnav_account_inactive.svg';\nimport { Popover as PopoverAnvil1 } from '@servicetitan/design-system';\nimport { tokens } from '@servicetitan/tokens/core';\nimport classNames from 'classnames';\nimport {\n ComponentPropsWithoutRef,\n FC,\n MouseEvent,\n MouseEventHandler,\n createElement,\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\n\nimport { CounterTagData, CounterTagValue } from '../../utils/counter-tag';\nimport { getCounterTag } from '../../utils/side-nav';\nimport { CounterTag } from '../counter-tag';\nimport { useTitanLayoutContext } from '../titan-layout';\nimport { withTooltip } from '../titan-layout/with-tooltip';\nimport {\n ProfileDropdownLinkProps,\n ProfileDropdownProps,\n ProfileDropdownSectionProps,\n ProfileDropdownTriggerProps,\n} from './interface';\nimport * as Styles from './profile-dropdown.module.less';\n\nconst ProfileDropdownTrigger = forwardRef<\n HTMLDivElement,\n ProfileDropdownTriggerProps & {\n hintArrow?: boolean;\n open: boolean;\n onClick: ComponentPropsWithoutRef<'div'>['onClick'];\n }\n>(({ info, imageSrc, avatarBadge, badge, className, hintArrow, open, onClick, ...rest }, ref) => {\n const [avatarSource, setAvatarSource] = useState(imageSrc ?? '');\n const [avatarSourceError, setAvatarSourceError] = useState(false);\n\n useEffect(() => {\n const src = imageSrc ?? '';\n\n if (src === avatarSource) {\n return;\n }\n\n setAvatarSource(src);\n setAvatarSourceError(false);\n }, [imageSrc, avatarSource]);\n\n const onAvatarError = useCallback(() => {\n setAvatarSourceError(true);\n }, []);\n\n return (\n <div\n data-cy=\"profile-dropdown-trigger\"\n data-pendo=\"profile-dropdown-trigger\"\n tabIndex={0}\n {...rest}\n className={classNames('profile-dropdown-trigger', Styles.triggerContainer, className)}\n onClick={onClick}\n ref={ref}\n >\n {avatarSource && !avatarSourceError ? (\n <img\n src={avatarSource}\n className={classNames(Styles.profileImage, 'profile-dropdown-image')}\n onError={onAvatarError}\n alt=\"user dropdown menu\"\n />\n ) : (\n <Icon\n className={Styles.profileIcon}\n size=\"large\"\n svg={open ? SvgAccountActive : SvgAccountInactive}\n />\n )}\n\n {!!info && (\n <div className={Styles.info}>\n <Text title={info.title} className={Styles.infoTitle} size=\"small\">\n {info.title}\n </Text>\n <Text title={info.text} className={Styles.infoText} size=\"small\" subdued>\n {info.text}\n </Text>\n </div>\n )}\n\n <Icon\n svg={open ? SvgExpandLess : SvgExpandMore}\n className={Styles.expandIcon}\n size=\"small\"\n />\n\n {!!avatarBadge && (\n <div\n className={Styles.avatarBadge}\n style={{\n backgroundColor: avatarBadge === true ? tokens.colorBlue500 : avatarBadge,\n }}\n />\n )}\n {!!badge && (\n <span\n className={classNames(\n Styles.badge,\n badge.content ? Styles.badgeWithContent : Styles.badgeNoContent\n )}\n style={{ backgroundColor: badge.color }}\n >\n {badge.content}\n </span>\n )}\n </div>\n );\n});\n\nconst useTag = (counter?: CounterTagValue, tag?: CounterTagData) =>\n useMemo(() => {\n const data = getCounterTag(counter, tag);\n\n return data ? (\n <div className={Styles.counterWrapper}>\n <CounterTag className={Styles.counter} data={data} />\n </div>\n ) : undefined;\n }, [counter, tag]);\n\nfunction DesktopProfileDropdownSection({\n children,\n className,\n counter,\n id,\n tag,\n text,\n tooltip,\n onClick,\n ...rest\n}: ProfileDropdownSectionProps) {\n const clickHandler: MouseEventHandler<never> = e => {\n if (onClick) {\n onClick(e);\n } else {\n e.stopPropagation();\n }\n };\n\n const tagElement = useTag(counter, tag);\n\n return withTooltip(\n <div\n className={classNames(\n Styles.dropdownSection,\n tagElement && Styles.dropdownSectionWithCounter,\n !!onClick && Styles.dropdownLink,\n className\n )}\n onClick={clickHandler}\n data-cy={`profile-dropdown-section-${id}`}\n data-pendo={`profile-dropdown-section-${id}`}\n {...rest}\n >\n {children}\n {tagElement}\n </div>,\n tooltip,\n { placement: 'left' }\n );\n}\n\nconst DesktopProfileDropdownDivider: FC = Divider;\n\nfunction DesktopProfileDropdownLink({\n children,\n className,\n external,\n id,\n counter,\n tag,\n target,\n text,\n to,\n tooltip,\n onClick,\n ...rest\n}: ProfileDropdownLinkProps) {\n const { NavigationComponent } = useTitanLayoutContext();\n\n const isExternalLink = external ?? to?.startsWith('http');\n\n const tagElement = useTag(counter, tag);\n\n return withTooltip(\n isExternalLink ? (\n <a\n className={classNames(\n Styles.dropdownSection,\n tagElement && Styles.dropdownSectionWithCounter,\n Styles.dropdownLink,\n className\n )}\n href={to}\n target={target}\n data-cy={`profile-dropdown-link-${id}`}\n data-pendo={`profile-dropdown-link-${id}`}\n {...rest}\n >\n {children}\n {tagElement}\n </a>\n ) : (\n <NavigationComponent\n className={classNames(\n Styles.dropdownSection,\n Styles.dropdownLink,\n { [Styles.dropdownSectionWithCounter]: !!tagElement },\n className\n )}\n target={target}\n to={to}\n data-cy={`profile-dropdown-link-${id}`}\n data-pendo={`profile-dropdown-link-${id}`}\n {...rest}\n >\n {children}\n {tagElement}\n </NavigationComponent>\n ),\n tooltip,\n { placement: 'left' }\n );\n}\n\nfunction DesktopProfileDropdownComponent({ anvil1, ...props }: ProfileDropdownProps) {\n return anvil1 ? (\n <DesktopProfileDropdownComponentAnvil1 {...props} />\n ) : (\n <DesktopProfileDropdownComponentAnvil2 {...props} />\n );\n}\n\n/**\n * A2 profile dropdown popover sometimes rendered incorrectly in top left corner. It is seen on cypress test failed builds.\n * it needs to be investigated, but for now keeping an option for A1 popover\n */\nfunction DesktopProfileDropdownComponentAnvil1({\n children,\n\n trigger,\n hintPopup,\n portal,\n onClose,\n onOpen,\n\n ...rest\n}: ProfileDropdownProps) {\n const [open, setOpen] = useState(false);\n const handleClose = useCallback(() => {\n setOpen(false);\n onClose?.();\n }, [onClose]);\n const handleOpen = useCallback(() => {\n setOpen(true);\n onOpen?.();\n }, [onOpen]);\n const onTriggerClick = useCallback(\n (e: MouseEvent) => {\n e.stopPropagation();\n setOpen(!open);\n\n if (open) {\n onClose?.();\n } else {\n onOpen?.();\n }\n },\n [open, onOpen, onClose]\n );\n const hintShown = !!hintPopup && !open;\n\n const triggerElement = (\n <ProfileDropdownTrigger\n {...trigger}\n onClick={children ? onTriggerClick : undefined}\n hintArrow={hintShown}\n open={open}\n />\n );\n\n const hintPopover =\n hintPopup?.content && !open ? (\n <PopoverAnvil1\n direction=\"bl\"\n width=\"xs\"\n trigger={triggerElement}\n popoverContentClassName={Styles.hint1}\n onClickOutside={hintPopup?.onClose}\n open\n >\n <div\n className={classNames(Styles.hintContent1)}\n style={{ '--hint-background': hintPopup.bgColor ?? '#fff' } as any}\n >\n {createElement(hintPopup.content, { openProfile: handleOpen })}\n </div>\n </PopoverAnvil1>\n ) : null;\n\n return (\n <div data-cy=\"profile-dropdown\" {...rest}>\n {hintPopover ?? (\n <PopoverAnvil1\n direction=\"bl\"\n width=\"xs\"\n trigger={triggerElement}\n open={open}\n portal={portal}\n onClickOutside={handleClose}\n popoverContentClassName={classNames(Styles.dropdown1)}\n >\n <div\n className={Styles.dropdownContent}\n onClick={handleClose}\n data-cy=\"profile-dropdown-content\"\n >\n {children}\n </div>\n </PopoverAnvil1>\n )}\n </div>\n );\n}\n\nfunction DesktopProfileDropdownComponentAnvil2({\n children,\n\n trigger,\n hintPopup,\n portal,\n onClose,\n onOpen,\n\n ...rest\n}: ProfileDropdownProps) {\n const [open, setOpen] = useState(false);\n const handleClose = useCallback(() => {\n setOpen(false);\n onClose?.();\n }, [onClose]);\n const handleOpen = useCallback(() => {\n setOpen(true);\n onOpen?.();\n }, [onOpen]);\n const onTriggerClick = useCallback(\n (e: MouseEvent) => {\n e.stopPropagation();\n setOpen(!open);\n\n if (open) {\n onClose?.();\n } else {\n onOpen?.();\n }\n },\n [open, onOpen, onClose]\n );\n\n const triggerElement = (props: any) => (\n <ProfileDropdownTrigger\n {...trigger}\n {...props}\n open={open}\n onClick={children ? onTriggerClick : undefined}\n />\n );\n\n const hintPopover =\n hintPopup?.content && !open ? (\n <Popover placement=\"bottom-start\" onClickOutside={hintPopup?.onClose} noPadding open>\n <Popover.Trigger>{triggerElement}</Popover.Trigger>\n <Popover.Content\n className={Styles.hint2}\n style={{ '--hint-background': hintPopup.bgColor ?? '#fff' } as any}\n >\n <div className={classNames(Styles.hintContent2)}>\n {createElement(hintPopup.content, { openProfile: handleOpen })}\n </div>\n </Popover.Content>\n </Popover>\n ) : null;\n\n return (\n <div data-cy=\"profile-dropdown\" {...rest}>\n {hintPopover ?? (\n <Popover\n placement=\"bottom-start\"\n open={open}\n onClickOutside={handleClose}\n noPadding\n >\n <Popover.Trigger>{triggerElement}</Popover.Trigger>\n <Popover.Content className={Styles.dropdown2}>\n <div\n onClick={handleClose}\n data-cy=\"profile-dropdown-content\"\n className={Styles.dropdownContent}\n >\n {children}\n </div>\n </Popover.Content>\n </Popover>\n )}\n </div>\n );\n}\n\nexport const DesktopProfileDropdown = Object.assign(DesktopProfileDropdownComponent, {\n Divider: DesktopProfileDropdownDivider,\n Link: DesktopProfileDropdownLink,\n Section: DesktopProfileDropdownSection,\n});\n"],"names":["Divider","Icon","Popover","Text","SvgExpandLess","SvgExpandMore","SvgAccountActive","SvgAccountInactive","PopoverAnvil1","tokens","classNames","createElement","forwardRef","useCallback","useEffect","useMemo","useState","getCounterTag","CounterTag","useTitanLayoutContext","withTooltip","Styles","ProfileDropdownTrigger","info","imageSrc","avatarBadge","badge","className","hintArrow","open","onClick","rest","ref","avatarSource","setAvatarSource","avatarSourceError","setAvatarSourceError","src","onAvatarError","div","data-cy","data-pendo","tabIndex","triggerContainer","img","profileImage","onError","alt","profileIcon","size","svg","title","infoTitle","text","infoText","subdued","expandIcon","style","backgroundColor","colorBlue500","span","content","badgeWithContent","badgeNoContent","color","useTag","counter","tag","data","counterWrapper","undefined","DesktopProfileDropdownSection","children","id","tooltip","clickHandler","e","stopPropagation","tagElement","dropdownSection","dropdownSectionWithCounter","dropdownLink","placement","DesktopProfileDropdownDivider","DesktopProfileDropdownLink","external","target","to","NavigationComponent","isExternalLink","startsWith","a","href","DesktopProfileDropdownComponent","anvil1","props","DesktopProfileDropdownComponentAnvil1","DesktopProfileDropdownComponentAnvil2","trigger","hintPopup","portal","onClose","onOpen","setOpen","handleClose","handleOpen","onTriggerClick","hintShown","triggerElement","hintPopover","direction","width","popoverContentClassName","hint1","onClickOutside","hintContent1","bgColor","openProfile","dropdown1","dropdownContent","noPadding","Trigger","Content","hint2","hintContent2","dropdown2","DesktopProfileDropdown","Object","assign","Link","Section"],"mappings":";AAAA,SAASA,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI,QAAQ,uBAAuB;AACpE,OAAOC,mBAAmB,mEAAmE;AAC7F,OAAOC,mBAAmB,mEAAmE;AAC7F,OAAOC,sBAAsB,+DAA+D;AAC5F,OAAOC,wBAAwB,iEAAiE;AAChG,SAASL,WAAWM,aAAa,QAAQ,8BAA8B;AACvE,SAASC,MAAM,QAAQ,4BAA4B;AACnD,OAAOC,gBAAgB,aAAa;AACpC,SAKIC,aAAa,EACbC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACL,QAAQ;AAGf,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,UAAU,QAAQ,iBAAiB;AAC5C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EmB,SAAS;QAAC3F,IAAI;;0BAChF,KAAC3B,QAAQuH,OAAO;0BAAEb;;0BAClB,KAAC1G,QAAQwH,OAAO;gBACZ/F,WAAWN,OAAOsG,KAAK;gBACvBlE,OAAO;oBAAE,mBAAmB,GAAE0C,qBAAAA,UAAUiB,OAAO,cAAjBjB,gCAAAA,qBAAqB;gBAAO;0BAE1D,cAAA,KAAC5D;oBAAIZ,WAAWjB,WAAWW,OAAOuG,YAAY;8BACzCjH,cAAAA,cAAcwF,UAAUtC,OAAO,EAAE;wBAAEwD,aAAaZ;oBAAW;;;;SAIxE;IAER,qBACI,KAAClE;QAAIC,WAAQ;QAAoB,GAAGT,IAAI;kBACnC8E,wBAAAA,yBAAAA,4BACG,MAAC3G;YACGgF,WAAU;YACVrD,MAAMA;YACNqF,gBAAgBV;YAChBgB,SAAS;;8BAET,KAACtH,QAAQuH,OAAO;8BAAEb;;8BAClB,KAAC1G,QAAQwH,OAAO;oBAAC/F,WAAWN,OAAOwG,SAAS;8BACxC,cAAA,KAACtF;wBACGT,SAAS0E;wBACThE,WAAQ;wBACRb,WAAWN,OAAOkG,eAAe;kCAEhC/C;;;;;;AAO7B;AAEA,OAAO,MAAMsD,yBAAyBC,OAAOC,MAAM,CAACnC,iCAAiC;IACjF7F,SAASmF;IACT8C,MAAM7C;IACN8C,SAAS3D;AACb,GAAG"}
|
|
@@ -74,10 +74,14 @@
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
.
|
|
77
|
+
.dropdown2[data-anv][data-anv] {
|
|
78
78
|
width: 320px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.dropdown1,
|
|
82
|
+
.dropdown2[data-anv][data-anv] {
|
|
79
83
|
font-size: @typescale-2;
|
|
80
|
-
padding: @spacing-1 @spacing-0;
|
|
84
|
+
padding: @spacing-1 @spacing-0 !important;
|
|
81
85
|
position: relative;
|
|
82
86
|
|
|
83
87
|
:global([data-anv='divider']) {
|
|
@@ -136,11 +140,11 @@
|
|
|
136
140
|
}
|
|
137
141
|
}
|
|
138
142
|
|
|
139
|
-
.
|
|
143
|
+
.hint2 {
|
|
140
144
|
background-color: var(--hint-background) !important;
|
|
141
145
|
padding: @spacing-0 !important;
|
|
142
146
|
|
|
143
|
-
.hint-
|
|
147
|
+
.hint-content2 {
|
|
144
148
|
padding: @spacing-1 @spacing-2;
|
|
145
149
|
background-color: inherit;
|
|
146
150
|
}
|
|
@@ -154,6 +158,29 @@
|
|
|
154
158
|
}
|
|
155
159
|
}
|
|
156
160
|
|
|
161
|
+
.hint1 {
|
|
162
|
+
padding: @spacing-0 !important;
|
|
163
|
+
|
|
164
|
+
.hint-content1 {
|
|
165
|
+
padding: @spacing-1 @spacing-2;
|
|
166
|
+
background-color: var(--hint-background) !important;
|
|
167
|
+
|
|
168
|
+
&::before {
|
|
169
|
+
content: '';
|
|
170
|
+
position: absolute;
|
|
171
|
+
top: -6px;
|
|
172
|
+
right: 29px;
|
|
173
|
+
height: 12px;
|
|
174
|
+
width: 12px;
|
|
175
|
+
background-color: inherit;
|
|
176
|
+
transform: rotateY(0deg) rotate(45deg);
|
|
177
|
+
border-left: 1px solid @color-neutral-60;
|
|
178
|
+
border-top: 1px solid @color-neutral-60;
|
|
179
|
+
z-index: (@z-index-popover + 2);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
157
184
|
.info-title[data-anv][data-anv],
|
|
158
185
|
.info-text[data-anv][data-anv] {
|
|
159
186
|
text-overflow: ellipsis;
|
|
@@ -5,14 +5,17 @@ export const badgeNoContent: string;
|
|
|
5
5
|
export const badgeWithContent: string;
|
|
6
6
|
export const counter: string;
|
|
7
7
|
export const counterWrapper: string;
|
|
8
|
-
export const
|
|
8
|
+
export const dropdown1: string;
|
|
9
|
+
export const dropdown2: string;
|
|
9
10
|
export const dropdownContent: string;
|
|
10
11
|
export const dropdownLink: string;
|
|
11
12
|
export const dropdownSection: string;
|
|
12
13
|
export const dropdownSectionWithCounter: string;
|
|
13
14
|
export const expandIcon: string;
|
|
14
|
-
export const
|
|
15
|
-
export const
|
|
15
|
+
export const hint1: string;
|
|
16
|
+
export const hint2: string;
|
|
17
|
+
export const hintContent1: string;
|
|
18
|
+
export const hintContent2: string;
|
|
16
19
|
export const info: string;
|
|
17
20
|
export const infoText: string;
|
|
18
21
|
export const infoTitle: string;
|
|
@@ -22,7 +22,7 @@ function ProfileDropdownComponent(props) {
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
const profileId = '--profile';
|
|
25
|
-
const MobileProfileDropdown = ({
|
|
25
|
+
const MobileProfileDropdown = ({ anvil1, trigger, hintPopup, portal, onClose, onOpen, className, children, ...rest })=>{
|
|
26
26
|
const [expanded, setExpanded] = useState(false);
|
|
27
27
|
const { hasNotifications, NotificationsContextProvider } = useNotificationsState();
|
|
28
28
|
const { onNotificationsUpdate } = useNotificationsContext();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/titan-layout/layout-profile.tsx"],"sourcesContent":["import SvgAccountActive from '@servicetitan/anvil2/assets/icons/st/gnav_account_active.svg';\nimport SvgAccountInactive from '@servicetitan/anvil2/assets/icons/st/gnav_account_inactive.svg';\n\nimport { FC, useEffect, useState } from 'react';\nimport { NavLinkComponentProps } from '../../utils/navigation-context';\nimport { getCounterTag } from '../../utils/side-nav';\nimport {\n ProfileDropdownLinkProps,\n ProfileDropdownProps,\n ProfileDropdownSectionProps,\n} from '../profile-dropdown/interface';\nimport { DesktopProfileDropdown } from '../profile-dropdown/profile-dropdown';\nimport { NavigationComponentProps } from './interface-internal';\nimport { useTitanLayoutContext } from './layout-context';\nimport {\n InternalSideNavigationGroup,\n InternalSideNavigationGroupDivider,\n InternalSideNavigationGroupLink,\n InternalSideNavigationGroupTrigger,\n} from './layout-sidebar-links-internal';\nimport { useNotificationsContext, useNotificationsState } from './notifications-context';\n\nexport type {\n ProfileDropdownProps,\n ProfileDropdownSectionProps,\n ProfileDropdownLinkProps,\n} from '../profile-dropdown/interface';\n\nconst ExternalNavComponent: FC<NavLinkComponentProps> = ({\n children,\n isActive,\n to,\n activeClassName,\n ...props\n}) => (\n <a {...props} href={to}>\n {children}\n </a>\n);\n\nfunction ProfileDropdownComponent(props: ProfileDropdownProps) {\n const { breakpoint, NavigationComponent } = useTitanLayoutContext();\n return breakpoint.isMobile ? (\n <MobileProfileDropdown {...props} navigationComponent={NavigationComponent} />\n ) : (\n <DesktopProfileDropdown {...props} />\n );\n}\nconst profileId = '--profile';\n\nconst MobileProfileDropdown: FC<ProfileDropdownProps & NavigationComponentProps> = ({\n placement,\n trigger,\n hintPopup,\n portal,\n onClose,\n onOpen,\n className,\n children,\n ...rest\n}) => {\n const [expanded, setExpanded] = useState(false);\n const { hasNotifications, NotificationsContextProvider } = useNotificationsState();\n const { onNotificationsUpdate } = useNotificationsContext();\n const onExpandToggle = () => {\n setExpanded(!expanded);\n };\n\n useEffect(() => {\n onNotificationsUpdate(profileId, hasNotifications);\n }, [hasNotifications, onNotificationsUpdate]);\n\n return (\n <NotificationsContextProvider>\n <InternalSideNavigationGroup\n id={profileId}\n to={undefined}\n title=\"Profile\"\n icon={SvgAccountInactive}\n iconActive={SvgAccountActive}\n isActive={expanded}\n className={className}\n {...rest}\n submenuExpanded={expanded}\n onSubmenuExpand={onExpandToggle}\n onClick={onExpandToggle}\n tag={{ value: hasNotifications }}\n >\n {children}\n </InternalSideNavigationGroup>\n </NotificationsContextProvider>\n );\n};\n\nconst ProfileDropdownDivider: FC = () => {\n const { breakpoint } = useTitanLayoutContext();\n return breakpoint.isMobile ? (\n <InternalSideNavigationGroupDivider />\n ) : (\n <DesktopProfileDropdown.Divider />\n );\n};\n\nconst getText = (children: any, text: any): string | undefined => {\n if (typeof children === 'string') {\n return children;\n }\n\n if (typeof text === 'string') {\n return text;\n }\n\n return undefined;\n};\n\nfunction ProfileDropdownSection(props: ProfileDropdownSectionProps) {\n const { breakpoint } = useTitanLayoutContext();\n return breakpoint.isMobile ? (\n <MobileProfileDropdownSection {...props} />\n ) : (\n <DesktopProfileDropdown.Section {...props} />\n );\n}\nconst MobileProfileDropdownSection: FC<ProfileDropdownSectionProps> = ({\n id,\n tooltip,\n tag,\n counter,\n\n className,\n children,\n text,\n ...rest\n}) => {\n const sectionText = getText(children, text);\n const { onNotificationsUpdate } = useNotificationsContext();\n const tagData = getCounterTag(counter, tag);\n onNotificationsUpdate(id, !!tagData);\n\n return sectionText ? (\n <InternalSideNavigationGroupTrigger\n {...rest}\n id={id}\n title={sectionText}\n isActive={undefined}\n tag={tagData}\n className={className}\n />\n ) : null;\n};\n\nfunction ProfileDropdownLink(props: ProfileDropdownLinkProps) {\n const { breakpoint, NavigationComponent } = useTitanLayoutContext();\n return breakpoint.isMobile ? (\n <MobileProfileDropdownLink {...props} navigationComponent={NavigationComponent} />\n ) : (\n <DesktopProfileDropdown.Link {...props} />\n );\n}\nconst MobileProfileDropdownLink: FC<ProfileDropdownLinkProps & NavigationComponentProps> = ({\n id,\n external,\n to,\n tooltip,\n text,\n children,\n className,\n navigationComponent,\n tag,\n counter,\n ...rest\n}) => {\n const { onNotificationsUpdate } = useNotificationsContext();\n const linkText = getText(children, text);\n const isExternalLink = external ?? to?.startsWith('http');\n const tagData = getCounterTag(counter, tag);\n onNotificationsUpdate(id, !!tagData);\n\n return linkText ? (\n <InternalSideNavigationGroupLink\n {...rest}\n id={id}\n to={to}\n title={linkText}\n isActive={undefined}\n className={className}\n tag={tagData}\n parentId={profileId}\n navigationComponent={isExternalLink ? ExternalNavComponent : navigationComponent}\n />\n ) : null;\n};\n\nexport const ProfileDropdown = Object.assign(ProfileDropdownComponent, {\n Divider: ProfileDropdownDivider,\n Link: ProfileDropdownLink,\n Section: ProfileDropdownSection,\n});\n"],"names":["SvgAccountActive","SvgAccountInactive","useEffect","useState","getCounterTag","DesktopProfileDropdown","useTitanLayoutContext","InternalSideNavigationGroup","InternalSideNavigationGroupDivider","InternalSideNavigationGroupLink","InternalSideNavigationGroupTrigger","useNotificationsContext","useNotificationsState","ExternalNavComponent","children","isActive","to","activeClassName","props","a","href","ProfileDropdownComponent","breakpoint","NavigationComponent","isMobile","MobileProfileDropdown","navigationComponent","profileId","placement","trigger","hintPopup","portal","onClose","onOpen","className","rest","expanded","setExpanded","hasNotifications","NotificationsContextProvider","onNotificationsUpdate","onExpandToggle","id","undefined","title","icon","iconActive","submenuExpanded","onSubmenuExpand","onClick","tag","value","ProfileDropdownDivider","Divider","getText","text","ProfileDropdownSection","MobileProfileDropdownSection","Section","tooltip","counter","sectionText","tagData","ProfileDropdownLink","MobileProfileDropdownLink","Link","external","linkText","isExternalLink","startsWith","parentId","ProfileDropdown","Object","assign"],"mappings":";AAAA,OAAOA,sBAAsB,+DAA+D;AAC5F,OAAOC,wBAAwB,iEAAiE;AAEhG,SAAaC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAEhD,SAASC,aAAa,QAAQ,uBAAuB;AAMrD,SAASC,sBAAsB,QAAQ,uCAAuC;AAE9E,SAASC,qBAAqB,QAAQ,mBAAmB;AACzD,SACIC,2BAA2B,EAC3BC,kCAAkC,EAClCC,+BAA+B,EAC/BC,kCAAkC,QAC/B,kCAAkC;AACzC,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,0BAA0B;AAQzF,MAAMC,uBAAkD,CAAC,EACrDC,QAAQ,EACRC,QAAQ,EACRC,EAAE,EACFC,eAAe,EACf,GAAGC,OACN,iBACG,KAACC;QAAG,GAAGD,KAAK;QAAEE,MAAMJ;kBACfF;;AAIT,SAASO,yBAAyBH,KAA2B;IACzD,MAAM,EAAEI,UAAU,EAAEC,mBAAmB,EAAE,GAAGjB;IAC5C,OAAOgB,WAAWE,QAAQ,iBACtB,KAACC;QAAuB,GAAGP,KAAK;QAAEQ,qBAAqBH;uBAEvD,KAAClB;QAAwB,GAAGa,KAAK;;AAEzC;AACA,MAAMS,YAAY;AAElB,MAAMF,wBAA6E,CAAC,EAChFG,SAAS,EACTC,O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C,SAASD;IACTa,MAAMF;IACNL,SAASF;AACb,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/titan-layout/layout-profile.tsx"],"sourcesContent":["import SvgAccountActive from '@servicetitan/anvil2/assets/icons/st/gnav_account_active.svg';\nimport SvgAccountInactive from '@servicetitan/anvil2/assets/icons/st/gnav_account_inactive.svg';\n\nimport { FC, useEffect, useState } from 'react';\nimport { NavLinkComponentProps } from '../../utils/navigation-context';\nimport { getCounterTag } from '../../utils/side-nav';\nimport {\n ProfileDropdownLinkProps,\n ProfileDropdownProps,\n ProfileDropdownSectionProps,\n} from '../profile-dropdown/interface';\nimport { DesktopProfileDropdown } from '../profile-dropdown/profile-dropdown';\nimport { NavigationComponentProps } from './interface-internal';\nimport { useTitanLayoutContext } from './layout-context';\nimport {\n InternalSideNavigationGroup,\n InternalSideNavigationGroupDivider,\n InternalSideNavigationGroupLink,\n InternalSideNavigationGroupTrigger,\n} from './layout-sidebar-links-internal';\nimport { useNotificationsContext, useNotificationsState } from './notifications-context';\n\nexport type {\n ProfileDropdownProps,\n ProfileDropdownSectionProps,\n ProfileDropdownLinkProps,\n} from '../profile-dropdown/interface';\n\nconst ExternalNavComponent: FC<NavLinkComponentProps> = ({\n children,\n isActive,\n to,\n activeClassName,\n ...props\n}) => (\n <a {...props} href={to}>\n {children}\n </a>\n);\n\nfunction ProfileDropdownComponent(props: ProfileDropdownProps) {\n const { breakpoint, NavigationComponent } = useTitanLayoutContext();\n return breakpoint.isMobile ? (\n <MobileProfileDropdown {...props} navigationComponent={NavigationComponent} />\n ) : (\n <DesktopProfileDropdown {...props} />\n );\n}\nconst profileId = '--profile';\n\nconst MobileProfileDropdown: FC<ProfileDropdownProps & NavigationComponentProps> = ({\n anvil1,\n trigger,\n hintPopup,\n portal,\n onClose,\n onOpen,\n className,\n children,\n ...rest\n}) => {\n const [expanded, setExpanded] = useState(false);\n const { hasNotifications, NotificationsContextProvider } = useNotificationsState();\n const { onNotificationsUpdate } = useNotificationsContext();\n const onExpandToggle = () => {\n setExpanded(!expanded);\n };\n\n useEffect(() => {\n onNotificationsUpdate(profileId, hasNotifications);\n }, [hasNotifications, onNotificationsUpdate]);\n\n return (\n <NotificationsContextProvider>\n <InternalSideNavigationGroup\n id={profileId}\n to={undefined}\n title=\"Profile\"\n icon={SvgAccountInactive}\n iconActive={SvgAccountActive}\n isActive={expanded}\n className={className}\n {...rest}\n submenuExpanded={expanded}\n onSubmenuExpand={onExpandToggle}\n onClick={onExpandToggle}\n tag={{ value: hasNotifications }}\n >\n {children}\n </InternalSideNavigationGroup>\n </NotificationsContextProvider>\n );\n};\n\nconst ProfileDropdownDivider: FC = () => {\n const { breakpoint } = useTitanLayoutContext();\n return breakpoint.isMobile ? (\n <InternalSideNavigationGroupDivider />\n ) : (\n <DesktopProfileDropdown.Divider />\n );\n};\n\nconst getText = (children: any, text: any): string | undefined => {\n if (typeof children === 'string') {\n return children;\n }\n\n if (typeof text === 'string') {\n return text;\n }\n\n return undefined;\n};\n\nfunction ProfileDropdownSection(props: ProfileDropdownSectionProps) {\n const { breakpoint } = useTitanLayoutContext();\n return breakpoint.isMobile ? (\n <MobileProfileDropdownSection {...props} />\n ) : (\n <DesktopProfileDropdown.Section {...props} />\n );\n}\nconst MobileProfileDropdownSection: FC<ProfileDropdownSectionProps> = ({\n id,\n tooltip,\n tag,\n counter,\n\n className,\n children,\n text,\n ...rest\n}) => {\n const sectionText = getText(children, text);\n const { onNotificationsUpdate } = useNotificationsContext();\n const tagData = getCounterTag(counter, tag);\n onNotificationsUpdate(id, !!tagData);\n\n return sectionText ? (\n <InternalSideNavigationGroupTrigger\n {...rest}\n id={id}\n title={sectionText}\n isActive={undefined}\n tag={tagData}\n className={className}\n />\n ) : null;\n};\n\nfunction ProfileDropdownLink(props: ProfileDropdownLinkProps) {\n const { breakpoint, NavigationComponent } = useTitanLayoutContext();\n return breakpoint.isMobile ? (\n <MobileProfileDropdownLink {...props} navigationComponent={NavigationComponent} />\n ) : (\n <DesktopProfileDropdown.Link {...props} />\n );\n}\nconst MobileProfileDropdownLink: FC<ProfileDropdownLinkProps & NavigationComponentProps> = ({\n id,\n external,\n to,\n tooltip,\n text,\n children,\n className,\n navigationComponent,\n tag,\n counter,\n ...rest\n}) => {\n const { onNotificationsUpdate } = useNotificationsContext();\n const linkText = getText(children, text);\n const isExternalLink = external ?? to?.startsWith('http');\n const tagData = getCounterTag(counter, tag);\n onNotificationsUpdate(id, !!tagData);\n\n return linkText ? (\n <InternalSideNavigationGroupLink\n {...rest}\n id={id}\n to={to}\n title={linkText}\n isActive={undefined}\n className={className}\n tag={tagData}\n parentId={profileId}\n navigationComponent={isExternalLink ? ExternalNavComponent : navigationComponent}\n />\n ) : null;\n};\n\nexport const ProfileDropdown = Object.assign(ProfileDropdownComponent, {\n Divider: ProfileDropdownDivider,\n Link: ProfileDropdownLink,\n Section: ProfileDropdownSection,\n});\n"],"names":["SvgAccountActive","SvgAccountInactive","useEffect","useState","getCounterTag","DesktopProfileDropdown","useTitanLayoutContext","InternalSideNavigationGroup","InternalSideNavigationGroupDivider","InternalSideNavigationGroupLink","InternalSideNavigationGroupTrigger","useNotificationsContext","useNotificationsState","ExternalNavComponent","children","isActive","to","activeClassName","props","a","href","ProfileDropdownComponent","breakpoint","NavigationComponent","isMobile","MobileProfileDropdown","navigationComponent","profileId","anvil1","trigger","hintPopup","portal","onClose","onOpen","className","rest","expanded","setExpanded","hasNotifications","NotificationsContextProvider","onNotificationsUpdate","onExpandToggle","id","undefined","title","icon","iconActive","submenuExpanded","onSubmenuExpand","onClick","tag","value","ProfileDropdownDivider","Divider","getText","text","ProfileDropdownSection","MobileProfileDropdownSection","Section","tooltip","counter","sectionText","tagData","ProfileDropdownLink","MobileProfileDropdownLink","Link","external","linkText","isExternalLink","startsWith","parentId","ProfileDropdown","Object","assign"],"mappings":";AAAA,OAAOA,sBAAsB,+DAA+D;AAC5F,OAAOC,wBAAwB,iEAAiE;AAEhG,SAAaC,SAAS,EAAEC,QAAQ,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E9C;AACA,MAAM8C,4BAAqF,CAAC,EACxFtB,EAAE,EACFwB,QAAQ,EACRlD,EAAE,EACF2C,OAAO,EACPJ,IAAI,EACJzC,QAAQ,EACRoB,SAAS,EACTR,mBAAmB,EACnBwB,GAAG,EACHU,OAAO,EACP,GAAGzB,MACN;IACG,MAAM,EAAEK,qBAAqB,EAAE,GAAG7B;IAClC,MAAMwD,WAAWb,QAAQxC,UAAUyC;IACnC,MAAMa,iBAAiBF,qBAAAA,sBAAAA,WAAYlD,eAAAA,yBAAAA,GAAIqD,UAAU,CAAC;IAClD,MAAMP,UAAU1D,cAAcwD,SAASV;IACvCV,sBAAsBE,IAAI,CAAC,CAACoB;IAE5B,OAAOK,yBACH,KAAC1D;QACI,GAAG0B,IAAI;QACRO,IAAIA;QACJ1B,IAAIA;QACJ4B,OAAOuB;QACPpD,UAAU4B;QACVT,WAAWA;QACXgB,KAAKY;QACLQ,UAAU3C;QACVD,qBAAqB0C,iBAAiBvD,uBAAuBa;SAEjE;AACR;AAEA,OAAO,MAAM6C,kBAAkBC,OAAOC,MAAM,CAACpD,0BAA0B;IACnEgC,SAASD;IACTa,MAAMF;IACNL,SAASF;AACb,GAAG"}
|
|
@@ -12,10 +12,10 @@ const WrappedLink = ({ children, isMobile, wrapper: WrapperComponent })=>{
|
|
|
12
12
|
});
|
|
13
13
|
};
|
|
14
14
|
/** Side Navigation menu link */ export function LayoutSidebarLink({ id, to, title, isActive, icon, iconActive, counter, tag, className, tooltip, wrapper, extra, side, ...rest }) {
|
|
15
|
+
var _ref;
|
|
15
16
|
const { NavigationComponent, breakpoint: { isMobile } } = useTitanLayoutContext();
|
|
16
17
|
const { onNotificationsUpdate } = useNotificationsContext();
|
|
17
|
-
|
|
18
|
-
const tagData = getCounterTag((_side_counter = side === null || side === void 0 ? void 0 : side.counter) !== null && _side_counter !== void 0 ? _side_counter : counter, tag);
|
|
18
|
+
const tagData = getCounterTag((_ref = side === null || side === void 0 ? void 0 : side.counter) !== null && _ref !== void 0 ? _ref : counter, tag);
|
|
19
19
|
onNotificationsUpdate(id, !!tagData);
|
|
20
20
|
const element = /*#__PURE__*/ _jsx(InternalSideNavigationLink, {
|
|
21
21
|
id: id,
|
|
@@ -36,10 +36,10 @@ const WrappedLink = ({ children, isMobile, wrapper: WrapperComponent })=>{
|
|
|
36
36
|
}) : element;
|
|
37
37
|
}
|
|
38
38
|
/** Side Navigation menu trigger */ export function LayoutSidebarTrigger({ id, title, isActive, icon, iconActive, counter, tag, className, tooltip, wrapper, extra, side, ...rest }) {
|
|
39
|
+
var _ref;
|
|
39
40
|
const { breakpoint: { isMobile } } = useTitanLayoutContext();
|
|
40
41
|
const { onNotificationsUpdate } = useNotificationsContext();
|
|
41
|
-
|
|
42
|
-
const tagData = getCounterTag((_side_counter = side === null || side === void 0 ? void 0 : side.counter) !== null && _side_counter !== void 0 ? _side_counter : counter, tag);
|
|
42
|
+
const tagData = getCounterTag((_ref = side === null || side === void 0 ? void 0 : side.counter) !== null && _ref !== void 0 ? _ref : counter, tag);
|
|
43
43
|
onNotificationsUpdate(id, !!tagData);
|
|
44
44
|
const element = /*#__PURE__*/ _jsx(InternalSideNavigationTrigger, {
|
|
45
45
|
id: id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/titan-layout/layout-sidebar-links.tsx"],"sourcesContent":["import { FC, ReactElement } from 'react';\nimport { getCounterTag } from '../../utils/side-nav';\nimport { TitanLayoutLinkProps, TitanLayoutTriggerProps } from './interface';\nimport { useTitanLayoutContext } from './layout-context';\nimport {\n InternalSideNavigationLink,\n InternalSideNavigationTrigger,\n} from './layout-sidebar-links-internal';\nimport { useNotificationsContext } from './notifications-context';\n\nconst WrappedLink: FC<{\n children: ReactElement;\n wrapper: NonNullable<TitanLayoutLinkProps['wrapper']>;\n isMobile: boolean;\n}> = ({ children, isMobile, wrapper: WrapperComponent }) => {\n const { sidebar } = useTitanLayoutContext();\n return (\n <WrapperComponent isMobile={isMobile} context={sidebar}>\n {children}\n </WrapperComponent>\n );\n};\n\n/** Side Navigation menu link */\nexport function LayoutSidebarLink({\n id,\n to,\n title,\n isActive,\n icon,\n iconActive,\n counter,\n tag,\n className,\n\n tooltip,\n wrapper,\n extra,\n side,\n ...rest\n}: TitanLayoutLinkProps) {\n const {\n NavigationComponent,\n breakpoint: { isMobile },\n } = useTitanLayoutContext();\n const { onNotificationsUpdate } = useNotificationsContext();\n const tagData = getCounterTag(side?.counter ?? counter, tag);\n\n onNotificationsUpdate(id, !!tagData);\n\n const element = (\n <InternalSideNavigationLink\n id={id}\n to={to}\n title={title}\n isActive={isActive}\n icon={icon}\n iconActive={iconActive}\n tag={tagData}\n className={className}\n {...rest}\n navigationComponent={NavigationComponent}\n />\n );\n\n return wrapper ? (\n <WrappedLink isMobile={isMobile} wrapper={wrapper}>\n {element}\n </WrappedLink>\n ) : (\n element\n );\n}\n\n/** Side Navigation menu trigger */\nexport function LayoutSidebarTrigger({\n id,\n title,\n isActive,\n icon,\n iconActive,\n counter,\n tag,\n className,\n\n tooltip,\n wrapper,\n extra,\n side,\n ...rest\n}: TitanLayoutTriggerProps) {\n const {\n breakpoint: { isMobile },\n } = useTitanLayoutContext();\n const { onNotificationsUpdate } = useNotificationsContext();\n const tagData = getCounterTag(side?.counter ?? counter, tag);\n\n onNotificationsUpdate(id, !!tagData);\n\n const element = (\n <InternalSideNavigationTrigger\n id={id}\n title={title}\n isActive={isActive}\n icon={icon}\n iconActive={iconActive}\n tag={tagData}\n className={className}\n {...rest}\n />\n );\n return wrapper ? (\n <WrappedLink isMobile={isMobile} wrapper={wrapper}>\n {element}\n </WrappedLink>\n ) : (\n element\n );\n}\n"],"names":["getCounterTag","useTitanLayoutContext","InternalSideNavigationLink","InternalSideNavigationTrigger","useNotificationsContext","WrappedLink","children","isMobile","wrapper","WrapperComponent","sidebar","context","LayoutSidebarLink","id","to","title","isActive","icon","iconActive","counter","tag","className","tooltip","extra","side","rest","NavigationComponent","breakpoint","onNotificationsUpdate","tagData","element","navigationComponent","LayoutSidebarTrigger"],"mappings":";AACA,SAASA,aAAa,QAAQ,uBAAuB;AAErD,SAASC,qBAAqB,QAAQ,mBAAmB;AACzD,SACIC,0BAA0B,EAC1BC,6BAA6B,QAC1B,kCAAkC;AACzC,SAASC,uBAAuB,QAAQ,0BAA0B;AAElE,MAAMC,cAID,CAAC,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,SAASC,gBAAgB,EAAE;IACnD,MAAM,EAAEC,OAAO,EAAE,GAAGT;IACpB,qBACI,KAACQ;QAAiBF,UAAUA;QAAUI,SAASD;kBAC1CJ;;AAGb;AAEA,8BAA8B,GAC9B,OAAO,SAASM,kBAAkB,EAC9BC,EAAE,EACFC,EAAE,EACFC,KAAK,EACLC,QAAQ,EACRC,IAAI,EACJC,UAAU,EACVC,OAAO,EACPC,GAAG,EACHC,SAAS,EAETC,OAAO,EACPd,OAAO,EACPe,KAAK,EACLC,IAAI,EACJ,GAAGC,MACgB
|
|
1
|
+
{"version":3,"sources":["../../../src/components/titan-layout/layout-sidebar-links.tsx"],"sourcesContent":["import { FC, ReactElement } from 'react';\nimport { getCounterTag } from '../../utils/side-nav';\nimport { TitanLayoutLinkProps, TitanLayoutTriggerProps } from './interface';\nimport { useTitanLayoutContext } from './layout-context';\nimport {\n InternalSideNavigationLink,\n InternalSideNavigationTrigger,\n} from './layout-sidebar-links-internal';\nimport { useNotificationsContext } from './notifications-context';\n\nconst WrappedLink: FC<{\n children: ReactElement;\n wrapper: NonNullable<TitanLayoutLinkProps['wrapper']>;\n isMobile: boolean;\n}> = ({ children, isMobile, wrapper: WrapperComponent }) => {\n const { sidebar } = useTitanLayoutContext();\n return (\n <WrapperComponent isMobile={isMobile} context={sidebar}>\n {children}\n </WrapperComponent>\n );\n};\n\n/** Side Navigation menu link */\nexport function LayoutSidebarLink({\n id,\n to,\n title,\n isActive,\n icon,\n iconActive,\n counter,\n tag,\n className,\n\n tooltip,\n wrapper,\n extra,\n side,\n ...rest\n}: TitanLayoutLinkProps) {\n const {\n NavigationComponent,\n breakpoint: { isMobile },\n } = useTitanLayoutContext();\n const { onNotificationsUpdate } = useNotificationsContext();\n const tagData = getCounterTag(side?.counter ?? counter, tag);\n\n onNotificationsUpdate(id, !!tagData);\n\n const element = (\n <InternalSideNavigationLink\n id={id}\n to={to}\n title={title}\n isActive={isActive}\n icon={icon}\n iconActive={iconActive}\n tag={tagData}\n className={className}\n {...rest}\n navigationComponent={NavigationComponent}\n />\n );\n\n return wrapper ? (\n <WrappedLink isMobile={isMobile} wrapper={wrapper}>\n {element}\n </WrappedLink>\n ) : (\n element\n );\n}\n\n/** Side Navigation menu trigger */\nexport function LayoutSidebarTrigger({\n id,\n title,\n isActive,\n icon,\n iconActive,\n counter,\n tag,\n className,\n\n tooltip,\n wrapper,\n extra,\n side,\n ...rest\n}: TitanLayoutTriggerProps) {\n const {\n breakpoint: { isMobile },\n } = useTitanLayoutContext();\n const { onNotificationsUpdate } = useNotificationsContext();\n const tagData = getCounterTag(side?.counter ?? counter, tag);\n\n onNotificationsUpdate(id, !!tagData);\n\n const element = (\n <InternalSideNavigationTrigger\n id={id}\n title={title}\n isActive={isActive}\n icon={icon}\n iconActive={iconActive}\n tag={tagData}\n className={className}\n {...rest}\n />\n );\n return wrapper ? (\n <WrappedLink isMobile={isMobile} wrapper={wrapper}>\n {element}\n </WrappedLink>\n ) : (\n element\n );\n}\n"],"names":["getCounterTag","useTitanLayoutContext","InternalSideNavigationLink","InternalSideNavigationTrigger","useNotificationsContext","WrappedLink","children","isMobile","wrapper","WrapperComponent","sidebar","context","LayoutSidebarLink","id","to","title","isActive","icon","iconActive","counter","tag","className","tooltip","extra","side","rest","NavigationComponent","breakpoint","onNotificationsUpdate","tagData","element","navigationComponent","LayoutSidebarTrigger"],"mappings":";AACA,SAASA,aAAa,QAAQ,uBAAuB;AAErD,SAASC,qBAAqB,QAAQ,mBAAmB;AACzD,SACIC,0BAA0B,EAC1BC,6BAA6B,QAC1B,kCAAkC;AACz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IAClC,MAAMyB,UAAU7B,sBAAcwB,iBAAAA,2BAAAA,KAAML,OAAO,uCAAIA,SAASC;IAExDQ,sBAAsBf,IAAI,CAAC,CAACgB;IAE5B,MAAMC,wBACF,KAAC3B;QACGU,IAAIA;QACJE,OAAOA;QACPC,UAAUA;QACVC,MAAMA;QACNC,YAAYA;QACZE,KAAKS;QACLR,WAAWA;QACV,GAAGI,IAAI;;IAGhB,OAAOjB,wBACH,KAACH;QAAYE,UAAUA;QAAUC,SAASA;kBACrCsB;SAGLA;AAER"}
|
|
@@ -118,10 +118,10 @@ LayoutSidebar.displayName = 'LayoutSidebar';
|
|
|
118
118
|
placement: 'right'
|
|
119
119
|
});
|
|
120
120
|
/** Side Navigation menu item */ const SideNavigationGroupItem = ({ item, onSubmenuExpand, barExpanded, submenuExpanded, navigationComponent, touchDevice })=>{
|
|
121
|
+
var _ref, _ref1;
|
|
121
122
|
var _item_submenu, _item_submenu1;
|
|
122
123
|
const { sidebar: { styles: { popoverContent } } } = useTitanLayoutContext();
|
|
123
124
|
const tag = getSubmenuGroupTag(item.submenu, getCounterTag(item.counter, item.tag));
|
|
124
|
-
var _item_submenu_groups, _item_submenu_groups1;
|
|
125
125
|
return barExpanded ? /*#__PURE__*/ _jsx(InternalSideNavigationGroup, {
|
|
126
126
|
id: item.id,
|
|
127
127
|
to: item.to,
|
|
@@ -136,7 +136,7 @@ LayoutSidebar.displayName = 'LayoutSidebar';
|
|
|
136
136
|
navigationComponent: navigationComponent,
|
|
137
137
|
children: /*#__PURE__*/ _jsx(SideNavigationGroupContent, {
|
|
138
138
|
parentId: item.id,
|
|
139
|
-
groups: (
|
|
139
|
+
groups: (_ref = (_item_submenu = item.submenu) === null || _item_submenu === void 0 ? void 0 : _item_submenu.groups) !== null && _ref !== void 0 ? _ref : [],
|
|
140
140
|
navigationComponent: navigationComponent
|
|
141
141
|
})
|
|
142
142
|
}) : /*#__PURE__*/ _jsxs(Popover, {
|
|
@@ -175,7 +175,7 @@ LayoutSidebar.displayName = 'LayoutSidebar';
|
|
|
175
175
|
}),
|
|
176
176
|
/*#__PURE__*/ _jsx(SideNavigationGroupContent, {
|
|
177
177
|
parentId: item.id,
|
|
178
|
-
groups: (
|
|
178
|
+
groups: (_ref1 = (_item_submenu1 = item.submenu) === null || _item_submenu1 === void 0 ? void 0 : _item_submenu1.groups) !== null && _ref1 !== void 0 ? _ref1 : [],
|
|
179
179
|
navigationComponent: navigationComponent
|
|
180
180
|
})
|
|
181
181
|
]
|
|
@@ -187,12 +187,12 @@ LayoutSidebar.displayName = 'LayoutSidebar';
|
|
|
187
187
|
const SideNavigationGroupContent = ({ groups, parentId, navigationComponent })=>{
|
|
188
188
|
return /*#__PURE__*/ _jsx(Fragment, {
|
|
189
189
|
children: groups.reduce((out, group, index)=>{
|
|
190
|
+
var _ref;
|
|
190
191
|
var _group_title;
|
|
191
192
|
if (!group.links.length) {
|
|
192
193
|
return out;
|
|
193
194
|
}
|
|
194
|
-
|
|
195
|
-
const title = (_group_title_trim = (_group_title = group.title) === null || _group_title === void 0 ? void 0 : _group_title.trim()) !== null && _group_title_trim !== void 0 ? _group_title_trim : '';
|
|
195
|
+
const title = (_ref = (_group_title = group.title) === null || _group_title === void 0 ? void 0 : _group_title.trim()) !== null && _ref !== void 0 ? _ref : '';
|
|
196
196
|
/* eslint-disable react/no-array-index-key */ out.push(/*#__PURE__*/ _jsx(Text, {
|
|
197
197
|
variant: "eyebrow",
|
|
198
198
|
className: classNames(Styles.submenuGroupHeader, {
|