@servicetitan/navigation 2.4.2 → 3.1.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/side-navigation/icons.d.ts +4 -0
- package/dist/components/side-navigation/icons.d.ts.map +1 -0
- package/dist/components/side-navigation/icons.js +5 -0
- package/dist/components/side-navigation/icons.js.map +1 -0
- package/dist/components/side-navigation/side-navigation.d.ts +14 -2
- package/dist/components/side-navigation/side-navigation.d.ts.map +1 -1
- package/dist/components/side-navigation/side-navigation.js +21 -3
- package/dist/components/side-navigation/side-navigation.js.map +1 -1
- package/dist/components/side-navigation/side-navigation.module.less +86 -38
- package/dist/components/side-navigation/side-navigation.stories.d.ts.map +1 -1
- package/dist/components/side-navigation/side-navigation.stories.js +3 -2
- package/dist/components/side-navigation/side-navigation.stories.js.map +1 -1
- package/package.json +2 -2
- package/src/components/side-navigation/icons.tsx +73 -0
- package/src/components/side-navigation/side-navigation.module.less +86 -38
- package/src/components/side-navigation/side-navigation.module.less.d.ts +9 -1
- package/src/components/side-navigation/side-navigation.stories.tsx +3 -1
- package/src/components/side-navigation/side-navigation.tsx +121 -15
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const IconSideOptions: () => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const IconSideSlim: () => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const IconSideExpanded: () => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/components/side-navigation/icons.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,+CAyB3B,CAAC;AAEF,eAAO,MAAM,YAAY,+CAkBxB,CAAC;AAEF,eAAO,MAAM,gBAAgB,+CAyB5B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const IconSideOptions = () => (_jsxs("svg", { width: "1em", height: "1em", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M1 3C1 1.89543 1.89543 1 3 1H7V17H3C1.89543 17 1 16.1046 1 15V3Z", stroke: "currentColor", strokeWidth: "2", strokeOpacity: "1" }), _jsx("rect", { x: "1", y: "1", width: "16", height: "16", rx: "2", stroke: "currentColor", strokeWidth: "2", strokeOpacity: "1" })] }));
|
|
3
|
+
export const IconSideSlim = () => (_jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M3 6.375C3 4.51104 4.51104 3 6.375 3H17.625C19.489 3 21 4.51104 21 6.375V17.625C21 19.489 19.489 21 17.625 21H6.375C4.51104 21 3 19.489 3 17.625V6.375Z", stroke: "currentColor", strokeOpacity: "1", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M7 8L7 16", stroke: "currentColor", strokeOpacity: "1", strokeWidth: "2", strokeLinecap: "round" })] }));
|
|
4
|
+
export const IconSideExpanded = () => (_jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M3 6.375C3 4.51104 4.51104 3 6.375 3H17.625C19.489 3 21 4.51104 21 6.375V17.625C21 19.489 19.489 21 17.625 21H6.375C4.51104 21 3 19.489 3 17.625V6.375Z", stroke: "currentColor", strokeOpacity: "1", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M7 8L7 16", stroke: "currentColor", strokeOpacity: "1", strokeWidth: "2", strokeLinecap: "round" }), _jsx("path", { d: "M11 8V16", stroke: "currentColor", strokeOpacity: "1", strokeWidth: "2", strokeLinecap: "round" })] }));
|
|
5
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../../src/components/side-navigation/icons.tsx"],"names":[],"mappings":";AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,CACjC,eACI,KAAK,EAAC,KAAK,EACX,MAAM,EAAC,KAAK,EACZ,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,aAElC,eACI,CAAC,EAAC,kEAAkE,EACpE,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,GAAG,GACnB,EACF,eACI,CAAC,EAAC,GAAG,EACL,CAAC,EAAC,GAAG,EACL,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,EAAE,EAAC,GAAG,EACN,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,GAAG,GACnB,IACA,CACT,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,CAC9B,eAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,4BAA4B,aAC1F,eACI,CAAC,EAAC,yJAAyJ,EAC3J,MAAM,EAAC,cAAc,EACrB,aAAa,EAAC,GAAG,EACjB,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,GACxB,EACF,eACI,CAAC,EAAC,WAAW,EACb,MAAM,EAAC,cAAc,EACrB,aAAa,EAAC,GAAG,EACjB,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,OAAO,GACvB,IACA,CACT,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,CAClC,eAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,4BAA4B,aAC1F,eACI,CAAC,EAAC,yJAAyJ,EAC3J,MAAM,EAAC,cAAc,EACrB,aAAa,EAAC,GAAG,EACjB,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,GACxB,EACF,eACI,CAAC,EAAC,WAAW,EACb,MAAM,EAAC,cAAc,EACrB,aAAa,EAAC,GAAG,EACjB,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,OAAO,GACvB,EACF,eACI,CAAC,EAAC,UAAU,EACZ,MAAM,EAAC,cAAc,EACrB,aAAa,EAAC,GAAG,EACjB,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,OAAO,GACvB,IACA,CACT,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
2
|
import { HeaderNavigationItemData, NavLinkComponentProps } from '../../utils/navigation';
|
|
3
3
|
export interface SideNavigationProps {
|
|
4
4
|
/** container class name */
|
|
@@ -7,12 +7,14 @@ export interface SideNavigationProps {
|
|
|
7
7
|
id?: string;
|
|
8
8
|
/** main navigation items */
|
|
9
9
|
items?: HeaderNavigationItemData[];
|
|
10
|
+
/** top navigation items */
|
|
11
|
+
itemsTop?: HeaderNavigationItemData[];
|
|
10
12
|
/** is menu expanded */
|
|
11
13
|
expanded?: boolean;
|
|
12
14
|
/** navigation component used for routing */
|
|
13
15
|
navigationComponent?: FC<NavLinkComponentProps>;
|
|
14
16
|
/** expand change handler */
|
|
15
|
-
|
|
17
|
+
onExpandedChange(expanded: boolean): void;
|
|
16
18
|
}
|
|
17
19
|
export declare const SideNavigation: FC<SideNavigationProps>;
|
|
18
20
|
interface SideNavigationItemProps extends HeaderNavigationItemData {
|
|
@@ -20,5 +22,15 @@ interface SideNavigationItemProps extends HeaderNavigationItemData {
|
|
|
20
22
|
}
|
|
21
23
|
/** Side Navigation menu item */
|
|
22
24
|
export declare const SideNavigationItem: FC<SideNavigationItemProps>;
|
|
25
|
+
/** Side Navigation options toggle */
|
|
26
|
+
export declare const SideNavigationOptionsToggle: FC<{
|
|
27
|
+
expanded?: boolean;
|
|
28
|
+
onExpandedChange(expanded: boolean): void;
|
|
29
|
+
}>;
|
|
30
|
+
/** Side Navigation options popover */
|
|
31
|
+
export declare const SideNavigationOptionsPopover: FC<PropsWithChildren<{
|
|
32
|
+
expanded?: boolean;
|
|
33
|
+
onExpandedChange(expanded: boolean): void;
|
|
34
|
+
}>>;
|
|
23
35
|
export {};
|
|
24
36
|
//# sourceMappingURL=side-navigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side-navigation.d.ts","sourceRoot":"","sources":["../../../src/components/side-navigation/side-navigation.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"side-navigation.d.ts","sourceRoot":"","sources":["../../../src/components/side-navigation/side-navigation.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAY,iBAAiB,EAAY,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAWzF,MAAM,WAAW,mBAAmB;IAChC,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,4BAA4B;IAC5B,KAAK,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACnC,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACtC,uBAAuB;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4CAA4C;IAC5C,mBAAmB,CAAC,EAAE,EAAE,CAAC,qBAAqB,CAAC,CAAC;IAChD,4BAA4B;IAC5B,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;CAC7C;AAED,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA4ClD,CAAC;AAEF,UAAU,uBAAwB,SAAQ,wBAAwB;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,gCAAgC;AAChC,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CA6C1D,CAAC;AAEF,qCAAqC;AACrC,eAAO,MAAM,2BAA2B,EAAE,EAAE,CAAC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;CAC7C,CAgBI,CAAC;AAEN,sCAAsC;AACtC,eAAO,MAAM,4BAA4B,EAAE,EAAE,CACzC,iBAAiB,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;CAC7C,CAAC,CA8CL,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { BodyText, Divider, Eyebrow, Icon, Popover, Stack } from '@servicetitan/design-system';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
+
import { Fragment, useState } from 'react';
|
|
4
5
|
import { DefaultNavLinkComponent, NavLinkContext, useNavLink, } from '../../utils/navigation-context';
|
|
5
6
|
import { withTooltip } from '../../utils/with-tooltip';
|
|
6
7
|
import { CounterTag } from '../counter-tag';
|
|
8
|
+
import { IconSideExpanded, IconSideOptions, IconSideSlim } from './icons';
|
|
7
9
|
import * as Styles from './side-navigation.module.less';
|
|
8
|
-
export const SideNavigation = ({ className, expanded, id, items, navigationComponent = DefaultNavLinkComponent,
|
|
9
|
-
return (_jsx(NavLinkContext.Provider, { value: navigationComponent, children: _jsxs("div", { className: classNames(Styles.sideNav, expanded ? Styles.sideNavExpanded : Styles.
|
|
10
|
+
export const SideNavigation = ({ className, expanded, id, items, itemsTop, navigationComponent = DefaultNavLinkComponent, onExpandedChange, }) => {
|
|
11
|
+
return (_jsx(NavLinkContext.Provider, { value: navigationComponent, children: _jsxs("div", { className: classNames(Styles.sideNav, expanded ? Styles.sideNavExpanded : Styles.sideNavSlim, className), id: id, "data-cy": "side-navigation", children: [!!(itemsTop === null || itemsTop === void 0 ? void 0 : itemsTop.length) && (_jsxs(Fragment, { children: [_jsx("div", { className: Styles.sideNavTop, "data-cy": "navigation-items-top", children: itemsTop.map(item => (_jsx(SideNavigationItem, Object.assign({ expanded: expanded }, item), item.id))) }), _jsx("div", { className: Styles.divider })] })), _jsx("div", { className: Styles.sideNavContent, "data-cy": "navigation-items", children: items === null || items === void 0 ? void 0 : items.map(item => (_jsx(SideNavigationItem, Object.assign({ expanded: expanded }, item), item.id))) }), _jsx("div", { className: Styles.sideNavBottom, children: _jsx(SideNavigationOptionsToggle, { expanded: expanded, onExpandedChange: onExpandedChange }) })] }) }));
|
|
10
12
|
};
|
|
11
13
|
/** Side Navigation menu item */
|
|
12
14
|
export const SideNavigationItem = ({ id, to, title, hint, counter, className, iconClassName, iconComponent: IconComponent, iconName, isActive, expanded, }) => {
|
|
@@ -16,4 +18,20 @@ export const SideNavigationItem = ({ id, to, title, hint, counter, className, ic
|
|
|
16
18
|
[Styles.navigationItemActive]: isActive === true,
|
|
17
19
|
}), isActive: typeof isActive === 'function' ? isActive : undefined, activeClassName: Styles.navigationItemActive, children: [IconComponent ? (_jsx("i", { className: iconClass, children: _jsx(IconComponent, {}) })) : iconName ? (_jsx(Icon, { name: iconName, className: iconClass })) : (_jsx("i", { className: iconClass })), !!expanded && _jsx("span", { className: Styles.navigationItemText, children: title }), !!counter && _jsx(CounterTag, { data: counter, className: Styles.navigationItemCounter })] }, id), expanded ? undefined : title, 'r');
|
|
18
20
|
};
|
|
21
|
+
/** Side Navigation options toggle */
|
|
22
|
+
export const SideNavigationOptionsToggle = ({ expanded, onExpandedChange }) => withTooltip(_jsxs("div", { "data-cy": "navigation-left-options", "data-pendo": "navigation-left-options", className: classNames(Styles.optionsItem), onClick: () => onExpandedChange(!expanded), children: [_jsx("div", { className: Styles.optionsIcon, children: _jsx(IconSideOptions, {}) }), !!expanded && _jsx("span", { className: Styles.optionsItemText, children: "Collapse Menu" })] }), expanded ? undefined : 'Expand Menu', 'r');
|
|
23
|
+
/** Side Navigation options popover */
|
|
24
|
+
export const SideNavigationOptionsPopover = ({ children, expanded, onExpandedChange }) => {
|
|
25
|
+
const [open, setOpen] = useState(false);
|
|
26
|
+
const onExpand = () => {
|
|
27
|
+
setOpen(false);
|
|
28
|
+
onExpandedChange(true);
|
|
29
|
+
};
|
|
30
|
+
const onCollapse = () => {
|
|
31
|
+
setOpen(false);
|
|
32
|
+
onExpandedChange(false);
|
|
33
|
+
};
|
|
34
|
+
return (_jsxs(Popover, { className: "bg-neutral-30", trigger: children, direction: "tr", onClickOutside: () => setOpen(false), open: open, padding: "s", width: "xs", children: [_jsx(Eyebrow, { className: "p-l-2", children: "menu options" }), _jsx(SideNavigationOptionsItem, { active: !expanded, icon: IconSideSlim, title: "Slim", onClick: onCollapse }), _jsx(SideNavigationOptionsItem, { active: !!expanded, icon: IconSideExpanded, title: "Expanded", onClick: onExpand }), _jsx(Divider, { className: "m-x-half m-y-1" }), _jsx(SideNavigationOptionsItem, { active: false, icon: expanded ? IconSideExpanded : IconSideSlim, title: expanded ? 'Expanded' : 'Slim' })] }));
|
|
35
|
+
};
|
|
36
|
+
const SideNavigationOptionsItem = ({ active, onClick, title, icon: IconComponent }) => (_jsxs(Stack, { className: classNames(active ? Styles.optionsPopoverItemActive : Styles.optionsPopoverItemInactive, 'p-y-1 p-x-2', { [Styles.optionsPopoverItemClickable]: onClick && !active }), alignItems: "center", onClick: !active && onClick, children: [_jsx(IconComponent, {}), _jsx(BodyText, { className: "c-inherit m-l-1 flex-grow-1 flex-basis-0", children: title }), active && _jsx(Icon, { name: "check" })] }));
|
|
19
37
|
//# sourceMappingURL=side-navigation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side-navigation.js","sourceRoot":"","sources":["../../../src/components/side-navigation/side-navigation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"side-navigation.js","sourceRoot":"","sources":["../../../src/components/side-navigation/side-navigation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/F,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAM,QAAQ,EAAqB,QAAQ,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,EACH,uBAAuB,EACvB,cAAc,EACd,UAAU,GACb,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAC;AAmBxD,MAAM,CAAC,MAAM,cAAc,GAA4B,CAAC,EACpD,SAAS,EACT,QAAQ,EACR,EAAE,EACF,KAAK,EACL,QAAQ,EACR,mBAAmB,GAAG,uBAAuB,EAC7C,gBAAgB,GACnB,EAAE,EAAE;IACD,OAAO,CACH,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,mBAAmB,YAC/C,eACI,SAAS,EAAE,UAAU,CACjB,MAAM,CAAC,OAAO,EACd,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EACtD,SAAS,CACZ,EACD,EAAE,EAAE,EAAE,aACE,iBAAiB,aAExB,CAAC,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,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EACb,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,YAAY,EAChD,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,GACvC,IACI,CACb,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAK1B,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CACtD,MAAC,KAAK,IACF,SAAS,EAAE,UAAU,CACjB,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,MAAM,CAAC,0BAA0B,EAC5E,aAAa,EACb,EAAE,CAAC,MAAM,CAAC,2BAA2B,CAAC,EAAE,OAAO,IAAI,CAAC,MAAM,EAAE,CAC/D,EACD,UAAU,EAAC,QAAQ,EACnB,OAAO,EAAE,CAAC,MAAM,IAAI,OAAO,aAE3B,KAAC,aAAa,KAAG,EACjB,KAAC,QAAQ,IAAC,SAAS,EAAC,0CAA0C,YAAE,KAAK,GAAY,EAChF,MAAM,IAAI,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,IAC5B,CACX,CAAC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/* stylelint-disable no-descending-specificity */
|
|
2
2
|
@import (reference) '@servicetitan/tokens/core/tokens.less';
|
|
3
3
|
|
|
4
|
+
@text-color: var(--colorsTextDefault, @color-neutral-400);
|
|
5
|
+
@border-color: var(--colorsBorderGrey, @color-neutral-60);
|
|
6
|
+
@bg-color: var(--colorsSurfaceGrey, @color-neutral-50);
|
|
7
|
+
|
|
4
8
|
.side-nav {
|
|
5
9
|
display: flex;
|
|
6
10
|
flex-direction: column;
|
|
@@ -11,22 +15,19 @@
|
|
|
11
15
|
-o-transition: width 100ms ease-in-out;
|
|
12
16
|
transition: width 100ms ease-in-out;
|
|
13
17
|
|
|
14
|
-
background-color:
|
|
15
|
-
|
|
18
|
+
background-color: @bg-color;
|
|
19
|
+
|
|
20
|
+
.side-nav-bottom {
|
|
21
|
+
padding-left: 12px;
|
|
22
|
+
padding-right: 12px;
|
|
23
|
+
border-top: 1px solid @border-color;
|
|
16
24
|
|
|
17
|
-
.side-nav-top {
|
|
18
25
|
display: flex;
|
|
19
|
-
flex-direction:
|
|
20
|
-
|
|
21
|
-
height: 56px;
|
|
22
|
-
flex-basis: 56px;
|
|
23
|
-
flex-grow: 0;
|
|
24
|
-
flex-shrink: 0;
|
|
25
|
-
border-bottom: 1px solid #c5c5cb;
|
|
26
|
-
padding-left: @spacing-1;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
justify-content: center;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
&.side-nav-
|
|
30
|
+
&.side-nav-slim {
|
|
30
31
|
width: 56px;
|
|
31
32
|
|
|
32
33
|
.navigation-item-counter {
|
|
@@ -39,27 +40,6 @@
|
|
|
39
40
|
|
|
40
41
|
&.side-nav-expanded {
|
|
41
42
|
width: 240px;
|
|
42
|
-
|
|
43
|
-
.side-nav-top :global(.Button) {
|
|
44
|
-
padding: @spacing-1 !important;
|
|
45
|
-
border-radius: 12px;
|
|
46
|
-
cursor: pointer;
|
|
47
|
-
|
|
48
|
-
:global(.Button__content) {
|
|
49
|
-
overflow: hidden;
|
|
50
|
-
white-space: nowrap;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
:global(.Button__icon) {
|
|
54
|
-
font-size: 24px;
|
|
55
|
-
padding-left: @spacing-0;
|
|
56
|
-
padding-right: @spacing-1;
|
|
57
|
-
|
|
58
|
-
svg {
|
|
59
|
-
transform: rotateY(180deg);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
43
|
}
|
|
64
44
|
|
|
65
45
|
.side-nav-content {
|
|
@@ -67,14 +47,24 @@
|
|
|
67
47
|
flex-direction: column;
|
|
68
48
|
align-items: stretch;
|
|
69
49
|
overflow-y: auto;
|
|
70
|
-
|
|
71
|
-
|
|
50
|
+
padding-top: @spacing-1;
|
|
51
|
+
padding-bottom: @spacing-1;
|
|
52
|
+
flex-grow: 1;
|
|
53
|
+
flex-basis: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.side-nav-top {
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
align-items: stretch;
|
|
60
|
+
padding-top: @spacing-1;
|
|
61
|
+
padding-bottom: @spacing-1;
|
|
72
62
|
}
|
|
73
63
|
}
|
|
74
64
|
|
|
75
65
|
.navigation-item {
|
|
76
66
|
font-family: @base-font-family;
|
|
77
|
-
color:
|
|
67
|
+
color: @text-color;
|
|
78
68
|
position: relative;
|
|
79
69
|
display: flex;
|
|
80
70
|
justify-content: flex-start;
|
|
@@ -88,8 +78,7 @@
|
|
|
88
78
|
border-radius: 12px;
|
|
89
79
|
|
|
90
80
|
&.navigation-item-active {
|
|
91
|
-
color: @color-white
|
|
92
|
-
background-color: @color-neutral-500;
|
|
81
|
+
background-color: @color-white;
|
|
93
82
|
}
|
|
94
83
|
|
|
95
84
|
&:hover:not(.navigation-item-active) {
|
|
@@ -114,3 +103,62 @@
|
|
|
114
103
|
width: 24px;
|
|
115
104
|
font-size: 24px;
|
|
116
105
|
}
|
|
106
|
+
|
|
107
|
+
.options-item {
|
|
108
|
+
font-family: @base-font-family;
|
|
109
|
+
color: @text-color;
|
|
110
|
+
position: relative;
|
|
111
|
+
display: flex;
|
|
112
|
+
justify-content: flex-start;
|
|
113
|
+
align-items: center;
|
|
114
|
+
flex-wrap: nowrap;
|
|
115
|
+
text-wrap: nowrap;
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
height: 32px;
|
|
118
|
+
|
|
119
|
+
margin-top: @spacing-1;
|
|
120
|
+
margin-bottom: @spacing-1;
|
|
121
|
+
border-radius: 8px;
|
|
122
|
+
|
|
123
|
+
&:hover {
|
|
124
|
+
background-color: @color-white;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.options-icon {
|
|
128
|
+
height: 18px;
|
|
129
|
+
width: 18px;
|
|
130
|
+
font-size: 18px;
|
|
131
|
+
padding-left: 7px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.options-item-text {
|
|
135
|
+
font-family: @base-font-family;
|
|
136
|
+
font-size: @typescale-3;
|
|
137
|
+
padding-left: @spacing-2;
|
|
138
|
+
flex: 1;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.options-popover-item-clickable {
|
|
143
|
+
cursor: pointer;
|
|
144
|
+
|
|
145
|
+
&:hover {
|
|
146
|
+
background-color: @color-neutral-60;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.options-popover-item-active {
|
|
151
|
+
background-color: @color-blue-100;
|
|
152
|
+
color: @color-blue-500;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.options-popover-item-inactive,
|
|
156
|
+
.options-popover-item-active {
|
|
157
|
+
border-radius: @border-radius-1;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.divider {
|
|
161
|
+
border-top: 1px solid @border-color;
|
|
162
|
+
margin-left: 12px;
|
|
163
|
+
margin-right: 12px;
|
|
164
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side-navigation.stories.d.ts","sourceRoot":"","sources":["../../../src/components/side-navigation/side-navigation.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;;;;;;;AAYpD,wBAKE;
|
|
1
|
+
{"version":3,"file":"side-navigation.stories.d.ts","sourceRoot":"","sources":["../../../src/components/side-navigation/side-navigation.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;;;;;;;AAYpD,wBAKE;AAmDF,eAAO,MAAM,qBAAqB,+CA0BjC,CAAC"}
|
|
@@ -27,13 +27,14 @@ const items = {
|
|
|
27
27
|
pointOfSale: getItem('pointOfSale', { iconName: 'cash-register' }),
|
|
28
28
|
projects: getItem('projects', { iconName: 'folder_special' }),
|
|
29
29
|
reports: getItem('reports', { iconName: 'poll' }),
|
|
30
|
+
tasks: getItem('tasks', { iconName: 'format_list_bulleted' }),
|
|
30
31
|
};
|
|
31
32
|
const NavLinkMock = props => (_jsx("a", { href: props.to, target: props.target, onClick: e => {
|
|
32
33
|
e.preventDefault();
|
|
33
34
|
}, className: props.className, children: props.children }));
|
|
34
35
|
export const DefaultSideNavigation = () => {
|
|
35
36
|
const [expanded, setExpanded] = useState(false);
|
|
36
|
-
return (_jsx(SideNavigation, { navigationComponent: NavLinkMock, expanded: expanded,
|
|
37
|
+
return (_jsx(SideNavigation, { navigationComponent: NavLinkMock, expanded: expanded, onExpandedChange: setExpanded, items: [
|
|
37
38
|
items.dashboard,
|
|
38
39
|
items.calendar,
|
|
39
40
|
items.calls,
|
|
@@ -46,6 +47,6 @@ export const DefaultSideNavigation = () => {
|
|
|
46
47
|
items.priceBook,
|
|
47
48
|
items.pointOfSale,
|
|
48
49
|
items.reports,
|
|
49
|
-
] }));
|
|
50
|
+
], itemsTop: [items.tasks] }));
|
|
50
51
|
};
|
|
51
52
|
//# sourceMappingURL=side-navigation.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side-navigation.stories.js","sourceRoot":"","sources":["../../../src/components/side-navigation/side-navigation.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAEpC,MAAM,MAAM,GAAG,CAAC,KAAoB,EAAE,EAAE;IACpC,OAAO,CACH,eAAK,SAAS,EAAC,YAAY,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,aAClD,KAAC,KAAK,KAAG,EACT,cAAK,SAAS,EAAC,0BAA0B,GAAG,IA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AAC;IACtE,SAAS,EAAE,OAAO,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;IAC1E,SAAS,EAAE,OAAO,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACrD,UAAU,EAAE,OAAO,CAAC,YAAY,EAAE,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC;IACnE,UAAU,EAAE,OAAO,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;IAC7D,SAAS,EAAE,OAAO,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IACzD,SAAS,EAAE,OAAO,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACrD,WAAW,EAAE,OAAO,CAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;IAClE,QAAQ,EAAE,OAAO,CAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7D,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"side-navigation.stories.js","sourceRoot":"","sources":["../../../src/components/side-navigation/side-navigation.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAEpC,MAAM,MAAM,GAAG,CAAC,KAAoB,EAAE,EAAE;IACpC,OAAO,CACH,eAAK,SAAS,EAAC,YAAY,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,aAClD,KAAC,KAAK,KAAG,EACT,cAAK,SAAS,EAAC,0BAA0B,GAAG,IAC1C,CACT,CAAC;AACN,CAAC,CAAC;AACF,eAAe;IACX,KAAK,EAAE,2BAA2B;IAClC,SAAS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W,EAChC,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,WAAW,EAC7B,KAAK,EAAE;YACH,KAAK,CAAC,SAAS;YACf,KAAK,CAAC,QAAQ;YACd,KAAK,CAAC,KAAK;YACX,KAAK,CAAC,UAAU;YAChB,KAAK,CAAC,QAAQ;YAEd,KAAK,CAAC,KAAK;YACX,KAAK,CAAC,SAAS;YACf,KAAK,CAAC,SAAS;YAEf,KAAK,CAAC,SAAS;YACf,KAAK,CAAC,SAAS;YACf,KAAK,CAAC,WAAW;YACjB,KAAK,CAAC,OAAO;SAChB,EACD,QAAQ,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GACzB,CACL,CAAC;AACN,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/navigation",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Navigation components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"less": true,
|
|
44
44
|
"webpack": false
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "bc12bb9c5588e0887811bff83cd360df90708442"
|
|
47
47
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export const IconSideOptions = () => (
|
|
2
|
+
<svg
|
|
3
|
+
width="1em"
|
|
4
|
+
height="1em"
|
|
5
|
+
viewBox="0 0 18 18"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M1 3C1 1.89543 1.89543 1 3 1H7V17H3C1.89543 17 1 16.1046 1 15V3Z"
|
|
11
|
+
stroke="currentColor"
|
|
12
|
+
strokeWidth="2"
|
|
13
|
+
strokeOpacity="1"
|
|
14
|
+
/>
|
|
15
|
+
<rect
|
|
16
|
+
x="1"
|
|
17
|
+
y="1"
|
|
18
|
+
width="16"
|
|
19
|
+
height="16"
|
|
20
|
+
rx="2"
|
|
21
|
+
stroke="currentColor"
|
|
22
|
+
strokeWidth="2"
|
|
23
|
+
strokeOpacity="1"
|
|
24
|
+
/>
|
|
25
|
+
</svg>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export const IconSideSlim = () => (
|
|
29
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
30
|
+
<path
|
|
31
|
+
d="M3 6.375C3 4.51104 4.51104 3 6.375 3H17.625C19.489 3 21 4.51104 21 6.375V17.625C21 19.489 19.489 21 17.625 21H6.375C4.51104 21 3 19.489 3 17.625V6.375Z"
|
|
32
|
+
stroke="currentColor"
|
|
33
|
+
strokeOpacity="1"
|
|
34
|
+
strokeWidth="2"
|
|
35
|
+
strokeLinecap="round"
|
|
36
|
+
strokeLinejoin="round"
|
|
37
|
+
/>
|
|
38
|
+
<path
|
|
39
|
+
d="M7 8L7 16"
|
|
40
|
+
stroke="currentColor"
|
|
41
|
+
strokeOpacity="1"
|
|
42
|
+
strokeWidth="2"
|
|
43
|
+
strokeLinecap="round"
|
|
44
|
+
/>
|
|
45
|
+
</svg>
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
export const IconSideExpanded = () => (
|
|
49
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
50
|
+
<path
|
|
51
|
+
d="M3 6.375C3 4.51104 4.51104 3 6.375 3H17.625C19.489 3 21 4.51104 21 6.375V17.625C21 19.489 19.489 21 17.625 21H6.375C4.51104 21 3 19.489 3 17.625V6.375Z"
|
|
52
|
+
stroke="currentColor"
|
|
53
|
+
strokeOpacity="1"
|
|
54
|
+
strokeWidth="2"
|
|
55
|
+
strokeLinecap="round"
|
|
56
|
+
strokeLinejoin="round"
|
|
57
|
+
/>
|
|
58
|
+
<path
|
|
59
|
+
d="M7 8L7 16"
|
|
60
|
+
stroke="currentColor"
|
|
61
|
+
strokeOpacity="1"
|
|
62
|
+
strokeWidth="2"
|
|
63
|
+
strokeLinecap="round"
|
|
64
|
+
/>
|
|
65
|
+
<path
|
|
66
|
+
d="M11 8V16"
|
|
67
|
+
stroke="currentColor"
|
|
68
|
+
strokeOpacity="1"
|
|
69
|
+
strokeWidth="2"
|
|
70
|
+
strokeLinecap="round"
|
|
71
|
+
/>
|
|
72
|
+
</svg>
|
|
73
|
+
);
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/* stylelint-disable no-descending-specificity */
|
|
2
2
|
@import (reference) '@servicetitan/tokens/core/tokens.less';
|
|
3
3
|
|
|
4
|
+
@text-color: var(--colorsTextDefault, @color-neutral-400);
|
|
5
|
+
@border-color: var(--colorsBorderGrey, @color-neutral-60);
|
|
6
|
+
@bg-color: var(--colorsSurfaceGrey, @color-neutral-50);
|
|
7
|
+
|
|
4
8
|
.side-nav {
|
|
5
9
|
display: flex;
|
|
6
10
|
flex-direction: column;
|
|
@@ -11,22 +15,19 @@
|
|
|
11
15
|
-o-transition: width 100ms ease-in-out;
|
|
12
16
|
transition: width 100ms ease-in-out;
|
|
13
17
|
|
|
14
|
-
background-color:
|
|
15
|
-
|
|
18
|
+
background-color: @bg-color;
|
|
19
|
+
|
|
20
|
+
.side-nav-bottom {
|
|
21
|
+
padding-left: 12px;
|
|
22
|
+
padding-right: 12px;
|
|
23
|
+
border-top: 1px solid @border-color;
|
|
16
24
|
|
|
17
|
-
.side-nav-top {
|
|
18
25
|
display: flex;
|
|
19
|
-
flex-direction:
|
|
20
|
-
|
|
21
|
-
height: 56px;
|
|
22
|
-
flex-basis: 56px;
|
|
23
|
-
flex-grow: 0;
|
|
24
|
-
flex-shrink: 0;
|
|
25
|
-
border-bottom: 1px solid #c5c5cb;
|
|
26
|
-
padding-left: @spacing-1;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
justify-content: center;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
&.side-nav-
|
|
30
|
+
&.side-nav-slim {
|
|
30
31
|
width: 56px;
|
|
31
32
|
|
|
32
33
|
.navigation-item-counter {
|
|
@@ -39,27 +40,6 @@
|
|
|
39
40
|
|
|
40
41
|
&.side-nav-expanded {
|
|
41
42
|
width: 240px;
|
|
42
|
-
|
|
43
|
-
.side-nav-top :global(.Button) {
|
|
44
|
-
padding: @spacing-1 !important;
|
|
45
|
-
border-radius: 12px;
|
|
46
|
-
cursor: pointer;
|
|
47
|
-
|
|
48
|
-
:global(.Button__content) {
|
|
49
|
-
overflow: hidden;
|
|
50
|
-
white-space: nowrap;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
:global(.Button__icon) {
|
|
54
|
-
font-size: 24px;
|
|
55
|
-
padding-left: @spacing-0;
|
|
56
|
-
padding-right: @spacing-1;
|
|
57
|
-
|
|
58
|
-
svg {
|
|
59
|
-
transform: rotateY(180deg);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
43
|
}
|
|
64
44
|
|
|
65
45
|
.side-nav-content {
|
|
@@ -67,14 +47,24 @@
|
|
|
67
47
|
flex-direction: column;
|
|
68
48
|
align-items: stretch;
|
|
69
49
|
overflow-y: auto;
|
|
70
|
-
|
|
71
|
-
|
|
50
|
+
padding-top: @spacing-1;
|
|
51
|
+
padding-bottom: @spacing-1;
|
|
52
|
+
flex-grow: 1;
|
|
53
|
+
flex-basis: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.side-nav-top {
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
align-items: stretch;
|
|
60
|
+
padding-top: @spacing-1;
|
|
61
|
+
padding-bottom: @spacing-1;
|
|
72
62
|
}
|
|
73
63
|
}
|
|
74
64
|
|
|
75
65
|
.navigation-item {
|
|
76
66
|
font-family: @base-font-family;
|
|
77
|
-
color:
|
|
67
|
+
color: @text-color;
|
|
78
68
|
position: relative;
|
|
79
69
|
display: flex;
|
|
80
70
|
justify-content: flex-start;
|
|
@@ -88,8 +78,7 @@
|
|
|
88
78
|
border-radius: 12px;
|
|
89
79
|
|
|
90
80
|
&.navigation-item-active {
|
|
91
|
-
color: @color-white
|
|
92
|
-
background-color: @color-neutral-500;
|
|
81
|
+
background-color: @color-white;
|
|
93
82
|
}
|
|
94
83
|
|
|
95
84
|
&:hover:not(.navigation-item-active) {
|
|
@@ -114,3 +103,62 @@
|
|
|
114
103
|
width: 24px;
|
|
115
104
|
font-size: 24px;
|
|
116
105
|
}
|
|
106
|
+
|
|
107
|
+
.options-item {
|
|
108
|
+
font-family: @base-font-family;
|
|
109
|
+
color: @text-color;
|
|
110
|
+
position: relative;
|
|
111
|
+
display: flex;
|
|
112
|
+
justify-content: flex-start;
|
|
113
|
+
align-items: center;
|
|
114
|
+
flex-wrap: nowrap;
|
|
115
|
+
text-wrap: nowrap;
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
height: 32px;
|
|
118
|
+
|
|
119
|
+
margin-top: @spacing-1;
|
|
120
|
+
margin-bottom: @spacing-1;
|
|
121
|
+
border-radius: 8px;
|
|
122
|
+
|
|
123
|
+
&:hover {
|
|
124
|
+
background-color: @color-white;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.options-icon {
|
|
128
|
+
height: 18px;
|
|
129
|
+
width: 18px;
|
|
130
|
+
font-size: 18px;
|
|
131
|
+
padding-left: 7px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.options-item-text {
|
|
135
|
+
font-family: @base-font-family;
|
|
136
|
+
font-size: @typescale-3;
|
|
137
|
+
padding-left: @spacing-2;
|
|
138
|
+
flex: 1;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.options-popover-item-clickable {
|
|
143
|
+
cursor: pointer;
|
|
144
|
+
|
|
145
|
+
&:hover {
|
|
146
|
+
background-color: @color-neutral-60;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.options-popover-item-active {
|
|
151
|
+
background-color: @color-blue-100;
|
|
152
|
+
color: @color-blue-500;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.options-popover-item-inactive,
|
|
156
|
+
.options-popover-item-active {
|
|
157
|
+
border-radius: @border-radius-1;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.divider {
|
|
161
|
+
border-top: 1px solid @border-color;
|
|
162
|
+
margin-left: 12px;
|
|
163
|
+
margin-right: 12px;
|
|
164
|
+
}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
export const __esModule: true;
|
|
2
|
+
export const divider: string;
|
|
2
3
|
export const navigationIcon: string;
|
|
3
4
|
export const navigationItem: string;
|
|
4
5
|
export const navigationItemActive: string;
|
|
5
6
|
export const navigationItemCounter: string;
|
|
6
7
|
export const navigationItemText: string;
|
|
8
|
+
export const optionsIcon: string;
|
|
9
|
+
export const optionsItem: string;
|
|
10
|
+
export const optionsItemText: string;
|
|
11
|
+
export const optionsPopoverItemActive: string;
|
|
12
|
+
export const optionsPopoverItemClickable: string;
|
|
13
|
+
export const optionsPopoverItemInactive: string;
|
|
7
14
|
export const sideNav: string;
|
|
8
|
-
export const
|
|
15
|
+
export const sideNavBottom: string;
|
|
9
16
|
export const sideNavContent: string;
|
|
10
17
|
export const sideNavExpanded: string;
|
|
18
|
+
export const sideNavSlim: string;
|
|
11
19
|
export const sideNavTop: string;
|
|
12
20
|
|
|
@@ -50,6 +50,7 @@ const items = {
|
|
|
50
50
|
pointOfSale: getItem('pointOfSale', { iconName: 'cash-register' }),
|
|
51
51
|
projects: getItem('projects', { iconName: 'folder_special' }),
|
|
52
52
|
reports: getItem('reports', { iconName: 'poll' }),
|
|
53
|
+
tasks: getItem('tasks', { iconName: 'format_list_bulleted' }),
|
|
53
54
|
};
|
|
54
55
|
|
|
55
56
|
const NavLinkMock: FC<NavLinkComponentProps> = props => (
|
|
@@ -71,7 +72,7 @@ export const DefaultSideNavigation = () => {
|
|
|
71
72
|
<SideNavigation
|
|
72
73
|
navigationComponent={NavLinkMock}
|
|
73
74
|
expanded={expanded}
|
|
74
|
-
|
|
75
|
+
onExpandedChange={setExpanded}
|
|
75
76
|
items={[
|
|
76
77
|
items.dashboard,
|
|
77
78
|
items.calendar,
|
|
@@ -88,6 +89,7 @@ export const DefaultSideNavigation = () => {
|
|
|
88
89
|
items.pointOfSale,
|
|
89
90
|
items.reports,
|
|
90
91
|
]}
|
|
92
|
+
itemsTop={[items.tasks]}
|
|
91
93
|
/>
|
|
92
94
|
);
|
|
93
95
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BodyText, Divider, Eyebrow, Icon, Popover, Stack } from '@servicetitan/design-system';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import { FC } from 'react';
|
|
3
|
+
import { FC, Fragment, PropsWithChildren, useState } from 'react';
|
|
4
4
|
import { HeaderNavigationItemData, NavLinkComponentProps } from '../../utils/navigation';
|
|
5
5
|
import {
|
|
6
6
|
DefaultNavLinkComponent,
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from '../../utils/navigation-context';
|
|
10
10
|
import { withTooltip } from '../../utils/with-tooltip';
|
|
11
11
|
import { CounterTag } from '../counter-tag';
|
|
12
|
+
import { IconSideExpanded, IconSideOptions, IconSideSlim } from './icons';
|
|
12
13
|
import * as Styles from './side-navigation.module.less';
|
|
13
14
|
|
|
14
15
|
export interface SideNavigationProps {
|
|
@@ -18,12 +19,14 @@ export interface SideNavigationProps {
|
|
|
18
19
|
id?: string;
|
|
19
20
|
/** main navigation items */
|
|
20
21
|
items?: HeaderNavigationItemData[];
|
|
22
|
+
/** top navigation items */
|
|
23
|
+
itemsTop?: HeaderNavigationItemData[];
|
|
21
24
|
/** is menu expanded */
|
|
22
25
|
expanded?: boolean;
|
|
23
26
|
/** navigation component used for routing */
|
|
24
27
|
navigationComponent?: FC<NavLinkComponentProps>;
|
|
25
28
|
/** expand change handler */
|
|
26
|
-
|
|
29
|
+
onExpandedChange(expanded: boolean): void;
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
export const SideNavigation: FC<SideNavigationProps> = ({
|
|
@@ -31,35 +34,42 @@ export const SideNavigation: FC<SideNavigationProps> = ({
|
|
|
31
34
|
expanded,
|
|
32
35
|
id,
|
|
33
36
|
items,
|
|
37
|
+
itemsTop,
|
|
34
38
|
navigationComponent = DefaultNavLinkComponent,
|
|
35
|
-
|
|
39
|
+
onExpandedChange,
|
|
36
40
|
}) => {
|
|
37
41
|
return (
|
|
38
42
|
<NavLinkContext.Provider value={navigationComponent}>
|
|
39
43
|
<div
|
|
40
44
|
className={classNames(
|
|
41
45
|
Styles.sideNav,
|
|
42
|
-
expanded ? Styles.sideNavExpanded : Styles.
|
|
46
|
+
expanded ? Styles.sideNavExpanded : Styles.sideNavSlim,
|
|
43
47
|
className
|
|
44
48
|
)}
|
|
45
49
|
id={id}
|
|
46
50
|
data-cy="side-navigation"
|
|
47
51
|
>
|
|
48
|
-
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
{
|
|
56
|
-
</
|
|
57
|
-
|
|
52
|
+
{!!itemsTop?.length && (
|
|
53
|
+
<Fragment>
|
|
54
|
+
<div className={Styles.sideNavTop} data-cy="navigation-items-top">
|
|
55
|
+
{itemsTop.map(item => (
|
|
56
|
+
<SideNavigationItem key={item.id} expanded={expanded} {...item} />
|
|
57
|
+
))}
|
|
58
|
+
</div>
|
|
59
|
+
<div className={Styles.divider} />
|
|
60
|
+
</Fragment>
|
|
61
|
+
)}
|
|
58
62
|
<div className={Styles.sideNavContent} data-cy="navigation-items">
|
|
59
63
|
{items?.map(item => (
|
|
60
64
|
<SideNavigationItem key={item.id} expanded={expanded} {...item} />
|
|
61
65
|
))}
|
|
62
66
|
</div>
|
|
67
|
+
<div className={Styles.sideNavBottom}>
|
|
68
|
+
<SideNavigationOptionsToggle
|
|
69
|
+
expanded={expanded}
|
|
70
|
+
onExpandedChange={onExpandedChange}
|
|
71
|
+
/>
|
|
72
|
+
</div>
|
|
63
73
|
</div>
|
|
64
74
|
</NavLinkContext.Provider>
|
|
65
75
|
);
|
|
@@ -116,3 +126,99 @@ export const SideNavigationItem: FC<SideNavigationItemProps> = ({
|
|
|
116
126
|
'r'
|
|
117
127
|
);
|
|
118
128
|
};
|
|
129
|
+
|
|
130
|
+
/** Side Navigation options toggle */
|
|
131
|
+
export const SideNavigationOptionsToggle: FC<{
|
|
132
|
+
expanded?: boolean;
|
|
133
|
+
onExpandedChange(expanded: boolean): void;
|
|
134
|
+
}> = ({ expanded, onExpandedChange }) =>
|
|
135
|
+
withTooltip(
|
|
136
|
+
<div
|
|
137
|
+
data-cy="navigation-left-options"
|
|
138
|
+
data-pendo="navigation-left-options"
|
|
139
|
+
className={classNames(Styles.optionsItem)}
|
|
140
|
+
onClick={() => onExpandedChange(!expanded)}
|
|
141
|
+
>
|
|
142
|
+
<div className={Styles.optionsIcon}>
|
|
143
|
+
<IconSideOptions />
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
{!!expanded && <span className={Styles.optionsItemText}>Collapse Menu</span>}
|
|
147
|
+
</div>,
|
|
148
|
+
expanded ? undefined : 'Expand Menu',
|
|
149
|
+
'r'
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
/** Side Navigation options popover */
|
|
153
|
+
export const SideNavigationOptionsPopover: FC<
|
|
154
|
+
PropsWithChildren<{
|
|
155
|
+
expanded?: boolean;
|
|
156
|
+
onExpandedChange(expanded: boolean): void;
|
|
157
|
+
}>
|
|
158
|
+
> = ({ children, expanded, onExpandedChange }) => {
|
|
159
|
+
const [open, setOpen] = useState(false);
|
|
160
|
+
|
|
161
|
+
const onExpand = () => {
|
|
162
|
+
setOpen(false);
|
|
163
|
+
onExpandedChange(true);
|
|
164
|
+
};
|
|
165
|
+
const onCollapse = () => {
|
|
166
|
+
setOpen(false);
|
|
167
|
+
onExpandedChange(false);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<Popover
|
|
172
|
+
className="bg-neutral-30"
|
|
173
|
+
trigger={children}
|
|
174
|
+
direction="tr"
|
|
175
|
+
onClickOutside={() => setOpen(false)}
|
|
176
|
+
open={open}
|
|
177
|
+
padding="s"
|
|
178
|
+
width="xs"
|
|
179
|
+
>
|
|
180
|
+
<Eyebrow className="p-l-2">menu options</Eyebrow>
|
|
181
|
+
<SideNavigationOptionsItem
|
|
182
|
+
active={!expanded}
|
|
183
|
+
icon={IconSideSlim}
|
|
184
|
+
title="Slim"
|
|
185
|
+
onClick={onCollapse}
|
|
186
|
+
/>
|
|
187
|
+
<SideNavigationOptionsItem
|
|
188
|
+
active={!!expanded}
|
|
189
|
+
icon={IconSideExpanded}
|
|
190
|
+
title="Expanded"
|
|
191
|
+
onClick={onExpand}
|
|
192
|
+
/>
|
|
193
|
+
|
|
194
|
+
<Divider className="m-x-half m-y-1" />
|
|
195
|
+
|
|
196
|
+
<SideNavigationOptionsItem
|
|
197
|
+
active={false}
|
|
198
|
+
icon={expanded ? IconSideExpanded : IconSideSlim}
|
|
199
|
+
title={expanded ? 'Expanded' : 'Slim'}
|
|
200
|
+
/>
|
|
201
|
+
</Popover>
|
|
202
|
+
);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const SideNavigationOptionsItem: FC<{
|
|
206
|
+
active: boolean;
|
|
207
|
+
icon: FC;
|
|
208
|
+
title: string;
|
|
209
|
+
onClick?: () => void;
|
|
210
|
+
}> = ({ active, onClick, title, icon: IconComponent }) => (
|
|
211
|
+
<Stack
|
|
212
|
+
className={classNames(
|
|
213
|
+
active ? Styles.optionsPopoverItemActive : Styles.optionsPopoverItemInactive,
|
|
214
|
+
'p-y-1 p-x-2',
|
|
215
|
+
{ [Styles.optionsPopoverItemClickable]: onClick && !active }
|
|
216
|
+
)}
|
|
217
|
+
alignItems="center"
|
|
218
|
+
onClick={!active && onClick}
|
|
219
|
+
>
|
|
220
|
+
<IconComponent />
|
|
221
|
+
<BodyText className="c-inherit m-l-1 flex-grow-1 flex-basis-0">{title}</BodyText>
|
|
222
|
+
{active && <Icon name="check" />}
|
|
223
|
+
</Stack>
|
|
224
|
+
);
|